Merge remote-tracking branch 'origin/master' into feat/loader-entry-disabled-interpolation
# Conflicts: # vendor/README.md # vendor/loader/src/config/entry.ts
This commit is contained in:
33
vendor/loader/src/config/entry.ts
vendored
33
vendor/loader/src/config/entry.ts
vendored
@@ -5,17 +5,6 @@ import { EntryGroup } from './group.ts'
|
||||
import { EntryTree } from './tree.ts'
|
||||
import { evaluate, isJsExpr } from './utils.ts'
|
||||
|
||||
/** Static plugin hook for resolving a container config while preserving nested entry configs. */
|
||||
export const EntryConfigResolver = Symbol.for('cordis.loader.entry-config-resolver')
|
||||
|
||||
/**
|
||||
* Resolve a container's own config while preserving any nested entry configs.
|
||||
* @param ctx - the container plugin context.
|
||||
* @param config - the container's raw config.
|
||||
* @returns the config to validate for this activation.
|
||||
*/
|
||||
export type EntryConfigResolver = (ctx: Context, config: any) => any
|
||||
|
||||
/** Serialized plugin entry options stored in loader config files. */
|
||||
export interface EntryOptions {
|
||||
/** Stable id inside the containing entry tree. */
|
||||
@@ -73,8 +62,6 @@ export class Entry {
|
||||
|
||||
_initTask?: Promise<void>
|
||||
_disposing = 0
|
||||
private runtimeEnabled = false
|
||||
private runtimeEnableTask?: Promise<void>
|
||||
|
||||
constructor(public loader: Loader) {
|
||||
this.ctx = loader.ctx.extend({ [Entry.key]: this })
|
||||
@@ -101,10 +88,10 @@ export class Entry {
|
||||
private _disabled(options: EntryOptions) {
|
||||
// group is always enabled
|
||||
if (options.group) return false
|
||||
if (this.disabledOf(options) && !this.runtimeEnabled) return true
|
||||
if (this.disabledOf(options)) return true
|
||||
let entry = this.parent.ctx.fiber.entry
|
||||
while (entry) {
|
||||
if (this.disabledOf(entry.options) && !entry.runtimeEnabled) return true
|
||||
if (this.disabledOf(entry.options)) return true
|
||||
entry = entry.parent.ctx.fiber.entry
|
||||
}
|
||||
return false
|
||||
@@ -120,22 +107,6 @@ export class Entry {
|
||||
: Boolean(options.disabled)
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable this in-memory entry without rewriting its configured `disabled`
|
||||
* value; the override survives config reapplication for this entry object.
|
||||
* @returns a promise settling after its initial activation attempt.
|
||||
*/
|
||||
enableRuntime(): Promise<void> {
|
||||
if (this.runtimeEnableTask !== undefined) return this.runtimeEnableTask
|
||||
this.runtimeEnabled = true
|
||||
this.runtimeEnableTask = this.refresh().catch((error: unknown) => {
|
||||
this.runtimeEnabled = false
|
||||
this.runtimeEnableTask = undefined
|
||||
throw error
|
||||
})
|
||||
return this.runtimeEnableTask
|
||||
}
|
||||
|
||||
evaluate(expr: string) {
|
||||
return evaluate(this.ctx, expr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user