Comparing version 3.1.2 to 3.1.3
@@ -1,2 +0,2 @@ | ||
import { Awaitable, Promisify } from 'cosmokit'; | ||
import { Awaitable, Promisify, Dict } from 'cosmokit'; | ||
export function isConstructor(func: any): func is new (...args: any) => any; | ||
@@ -247,4 +247,4 @@ export function getConstructor(instance: any): any; | ||
[Context.config]: Context.Config; | ||
[Context.shadow]: Record<string | symbol, symbol>; | ||
[Context.internal]: Record<keyof any, Context.Internal>; | ||
[Context.shadow]: Dict<symbol>; | ||
[Context.internal]: Dict<Context.Internal>; | ||
root: Context.Parameterized<this, this[typeof Context.config]>; | ||
@@ -286,2 +286,3 @@ realms: Record<string, Record<string, symbol>>; | ||
protected ctx: C; | ||
name: string; | ||
protected start(): Awaitable<void>; | ||
@@ -292,2 +293,3 @@ protected stop(): Awaitable<void>; | ||
get caller(): C; | ||
[Context.filter](ctx: Context): boolean; | ||
} |
{ | ||
"name": "cordis", | ||
"description": "AOP Framework for Modern JavaScript Applications", | ||
"version": "3.1.2", | ||
"version": "3.1.3", | ||
"sideEffects": false, | ||
@@ -33,16 +33,16 @@ "main": "lib/index.cjs", | ||
"devDependencies": { | ||
"@types/chai": "^4.3.5", | ||
"@types/chai-as-promised": "^7.1.5", | ||
"@types/chai": "^4.3.9", | ||
"@types/chai-as-promised": "^7.1.7", | ||
"@types/mocha": "^9.1.1", | ||
"@types/node": "^20.4.2", | ||
"@types/node": "^20.8.9", | ||
"c8": "^7.14.0", | ||
"chai": "^4.3.7", | ||
"chai": "^4.3.10", | ||
"chai-as-promised": "^7.1.1", | ||
"dtsc": "^2.3.0", | ||
"esbuild": "^0.18.14", | ||
"esbuild-register": "^3.4.2", | ||
"esbuild": "^0.18.20", | ||
"esbuild-register": "^3.5.0", | ||
"jest-mock": "^28.1.3", | ||
"mocha": "^9.2.2", | ||
"shx": "^0.3.4", | ||
"typescript": "^5.1.6" | ||
"typescript": "^5.2.2" | ||
}, | ||
@@ -49,0 +49,0 @@ "dependencies": { |
@@ -1,2 +0,2 @@ | ||
import { defineProperty, isNullable } from 'cosmokit' | ||
import { defineProperty, Dict, isNullable } from 'cosmokit' | ||
import { Lifecycle } from './events' | ||
@@ -37,4 +37,4 @@ import { Registry } from './registry' | ||
[Context.config]: Context.Config | ||
[Context.shadow]: Record<string | symbol, symbol> | ||
[Context.internal]: Record<keyof any, Context.Internal> | ||
[Context.shadow]: Dict<symbol> | ||
[Context.internal]: Dict<Context.Internal> | ||
root: Context.Parameterized<this, this[typeof Context.config]> | ||
@@ -144,8 +144,2 @@ realms: Record<string, Record<string, symbol>> | ||
// setup filter for events | ||
const self = Object.create(null) | ||
self[Context.filter] = (ctx2: Context) => { | ||
return ctx[Context.shadow][name] === ctx2[Context.shadow][name] | ||
} | ||
// check override | ||
@@ -159,2 +153,8 @@ if (value && oldValue) { | ||
// setup filter for events | ||
const self = Object.create(null) | ||
self[Context.filter] = (ctx2: Context) => { | ||
return ctx[Context.shadow][name] === ctx2[Context.shadow][name] | ||
} | ||
ctx.root.emit(self, 'internal/before-service', name, value) | ||
@@ -185,3 +185,3 @@ ctx.root[key] = value | ||
attach(Object.getPrototypeOf(internal)) | ||
for (const key of [...Object.getOwnPropertyNames(internal), ...Object.getOwnPropertySymbols(internal)]) { | ||
for (const key of Object.getOwnPropertyNames(internal)) { | ||
const constructor = internal[key]['prototype']?.constructor | ||
@@ -188,0 +188,0 @@ if (!constructor) continue |
@@ -9,3 +9,3 @@ import { Awaitable, defineProperty } from 'cosmokit' | ||
constructor(protected ctx: C, name: string, immediate?: boolean) { | ||
constructor(protected ctx: C, public name: string, immediate?: boolean) { | ||
ctx.root.provide(name) | ||
@@ -34,2 +34,6 @@ defineProperty(this, Context.current, ctx) | ||
} | ||
[Context.filter](ctx: Context) { | ||
return ctx[Context.shadow][this.name] === this.ctx[Context.shadow][this.name] | ||
} | ||
} |
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
175873
2923