Comparing version 2.9.3 to 2.10.0
@@ -24,6 +24,6 @@ import { Awaitable, Promisify } from 'cosmokit'; | ||
export interface Context { | ||
using(deps: readonly string[], callback: Plugin.Function<void, Context.Configured<this>>): ForkScope<Context.Configured<this>>; | ||
plugin<S extends Plugin<Context.Configured<this>>, T extends Plugin.Config<S>>(plugin: S, config?: boolean | T): ForkScope<Context.Configured<this, T>>; | ||
using(deps: readonly string[], callback: Plugin.Function<void, Context.Parameterized<this>>): ForkScope<Context.Parameterized<this>>; | ||
plugin<S extends Plugin<Context.Parameterized<this>>, T extends Plugin.Config<S>>(plugin: S, config?: T): ForkScope<Context.Parameterized<this, T>>; | ||
/** @deprecated use `ctx.registry.delete()` instead */ | ||
dispose(plugin?: Plugin<Context.Configured<this>>): boolean; | ||
dispose(plugin?: Plugin<Context.Parameterized<this>>): boolean; | ||
} | ||
@@ -36,3 +36,2 @@ export namespace Registry { | ||
private root; | ||
static readonly methods: string[]; | ||
private _counter; | ||
@@ -157,3 +156,2 @@ constructor(root: Context, config: Registry.Config); | ||
private root; | ||
static readonly methods: string[]; | ||
isActive: boolean; | ||
@@ -166,3 +164,4 @@ _tasks: Set<Promise<void>>; | ||
flush(): Promise<void>; | ||
getHooks(name: keyof any, thisArg?: object): Generator<(...args: any[]) => any, void, unknown>; | ||
getHooks(name: keyof any, thisArg?: object): ((...args: any[]) => any)[]; | ||
prepareEvent(type: string, args: any[]): readonly [((...args: any[]) => any)[], any]; | ||
parallel(...args: any[]): Promise<void>; | ||
@@ -184,16 +183,44 @@ emit(...args: any[]): void; | ||
'dispose'(): Awaitable<void>; | ||
'internal/fork'(fork: ForkScope<Context.Configured<C>>): void; | ||
'internal/runtime'(runtime: MainScope<Context.Configured<C>>): void; | ||
'internal/status'(scope: EffectScope<Context.Configured<C>>, oldValue: ScopeStatus): void; | ||
'internal/fork'(fork: ForkScope<Context.Parameterized<C>>): void; | ||
'internal/runtime'(runtime: MainScope<Context.Parameterized<C>>): void; | ||
'internal/status'(scope: EffectScope<Context.Parameterized<C>>, oldValue: ScopeStatus): void; | ||
'internal/warning'(format: any, ...param: any[]): void; | ||
'internal/before-service'(name: string, value: any): void; | ||
'internal/service'(name: string, oldValue: any): void; | ||
'internal/before-update'(fork: ForkScope<Context.Configured<C>>, config: any): void; | ||
'internal/update'(fork: ForkScope<Context.Configured<C>>, oldConfig: any): void; | ||
'internal/before-update'(fork: ForkScope<Context.Parameterized<C>>, config: any): void; | ||
'internal/update'(fork: ForkScope<Context.Parameterized<C>>, oldConfig: any): void; | ||
'internal/hook'(this: Lifecycle, name: string, listener: Function, prepend: boolean): () => boolean; | ||
'internal/event'(type: 'emit' | 'parallel' | 'serial' | 'bail', name: string, args: any[], thisArg: any): void; | ||
} | ||
export namespace Context { | ||
type Parameterized<C, T = any> = Omit<C, 'config'> & { | ||
config: T; | ||
}; | ||
interface Config extends Lifecycle.Config, Registry.Config { | ||
} | ||
/** @deprecated use `string[]` instead */ | ||
interface MixinOptions { | ||
methods?: string[]; | ||
accessors?: string[]; | ||
prototype?: {}; | ||
} | ||
type Internal = Internal.Service | Internal.Mixin; | ||
namespace Internal { | ||
interface Service { | ||
type: 'service'; | ||
key: symbol; | ||
prototype?: {}; | ||
} | ||
interface Mixin { | ||
type: 'mixin'; | ||
service: keyof any; | ||
} | ||
} | ||
} | ||
export interface Context<T = any> { | ||
[Context.config]: Context.Config; | ||
root: Context.Configured<this, this[typeof Context.config]>; | ||
mapping: Record<string | symbol, symbol>; | ||
[Context.shadow]: Record<string | symbol, symbol>; | ||
[Context.internal]: Record<keyof any, Context.Internal>; | ||
root: Context.Parameterized<this, this[typeof Context.config]>; | ||
realms: Record<string, Record<string, symbol>>; | ||
lifecycle: Lifecycle; | ||
@@ -210,4 +237,11 @@ registry: Registry<this>; | ||
static readonly expose: unique symbol; | ||
static readonly shadow: unique symbol; | ||
static readonly current: unique symbol; | ||
static readonly internal: unique symbol; | ||
private static ensureInternal; | ||
/** @deprecated */ | ||
static mixin(name: keyof any, options: string[] | Context.MixinOptions): void; | ||
/** @deprecated */ | ||
static service(name: keyof any, options?: string[] | Context.MixinOptions): void; | ||
static handler: ProxyHandler<Context>; | ||
constructor(config?: Context.Config); | ||
@@ -217,21 +251,7 @@ get events(): Lifecycle; | ||
get state(): EffectScope<this>; | ||
provide(name: string, value?: any): void; | ||
mixin(name: string, mixins: string[]): void; | ||
extend(meta?: {}): this; | ||
isolate(names: string[]): this; | ||
isolate(names: string[], label?: string): this; | ||
} | ||
export namespace Context { | ||
type Configured<C, T = any> = Omit<C, 'config'> & { | ||
config: T; | ||
}; | ||
interface Config extends Lifecycle.Config, Registry.Config { | ||
} | ||
interface MixinOptions { | ||
methods?: string[]; | ||
properties?: string[]; | ||
} | ||
function mixin(name: keyof any, options: MixinOptions): void; | ||
interface ServiceOptions extends MixinOptions { | ||
prototype?: any; | ||
} | ||
function service(name: keyof any, options?: ServiceOptions): void; | ||
} | ||
export class Service<C extends Context = Context> { | ||
@@ -238,0 +258,0 @@ protected ctx: C; |
{ | ||
"name": "cordis", | ||
"description": "AOP Framework for Modern JavaScript Applications", | ||
"version": "2.9.3", | ||
"version": "2.10.0", | ||
"sideEffects": false, | ||
@@ -6,0 +6,0 @@ "main": "lib/index.cjs", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
192697
1797