@codefast/di 1.0.0-canary.6 → 1.0.0-canary.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +67 -499
- package/dist/binding-scope.d.ts +10 -0
- package/dist/binding-scope.d.ts.map +1 -0
- package/dist/binding-scope.js +24 -0
- package/dist/binding-scope.js.map +1 -0
- package/dist/binding-select.d.ts +16 -0
- package/dist/binding-select.d.ts.map +1 -0
- package/dist/binding-select.js +130 -0
- package/dist/binding-select.js.map +1 -0
- package/dist/binding.d.ts +194 -0
- package/dist/binding.d.ts.map +1 -0
- package/dist/binding.js +46 -0
- package/dist/binding.js.map +1 -0
- package/dist/constraints.d.ts +51 -0
- package/dist/constraints.d.ts.map +1 -0
- package/dist/constraints.js +88 -0
- package/dist/constraints.js.map +1 -0
- package/dist/{constructor-type.d.mts → constructor-type.d.ts} +3 -5
- package/dist/constructor-type.d.ts.map +1 -0
- package/dist/constructor-type.js +2 -0
- package/dist/constructor-type.js.map +1 -0
- package/dist/container.d.ts +58 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/container.js +853 -0
- package/dist/container.js.map +1 -0
- package/dist/decorators/inject.d.ts +46 -0
- package/dist/decorators/inject.d.ts.map +1 -0
- package/dist/decorators/inject.js +145 -0
- package/dist/decorators/inject.js.map +1 -0
- package/dist/decorators/injectable.d.ts +29 -0
- package/dist/decorators/injectable.d.ts.map +1 -0
- package/dist/decorators/injectable.js +53 -0
- package/dist/decorators/injectable.js.map +1 -0
- package/dist/decorators/lifecycle-decorators.d.ts +9 -0
- package/dist/decorators/lifecycle-decorators.d.ts.map +1 -0
- package/dist/decorators/lifecycle-decorators.js +40 -0
- package/dist/decorators/lifecycle-decorators.js.map +1 -0
- package/dist/dependency-graph.d.ts +40 -0
- package/dist/dependency-graph.d.ts.map +1 -0
- package/dist/dependency-graph.js +66 -0
- package/dist/dependency-graph.js.map +1 -0
- package/dist/environment.d.ts +51 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js +100 -0
- package/dist/environment.js.map +1 -0
- package/dist/errors.d.ts +150 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +197 -0
- package/dist/errors.js.map +1 -0
- package/dist/graph-adapters/cytoscape.d.ts +33 -0
- package/dist/graph-adapters/cytoscape.d.ts.map +1 -0
- package/dist/graph-adapters/cytoscape.js +30 -0
- package/dist/graph-adapters/cytoscape.js.map +1 -0
- package/dist/graph-adapters/dot.d.ts +6 -0
- package/dist/graph-adapters/dot.d.ts.map +1 -0
- package/dist/graph-adapters/dot.js +18 -0
- package/dist/graph-adapters/dot.js.map +1 -0
- package/dist/graph-adapters/reactflow.d.ts +38 -0
- package/dist/graph-adapters/reactflow.d.ts.map +1 -0
- package/dist/graph-adapters/reactflow.js +23 -0
- package/dist/graph-adapters/reactflow.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/inspector.d.ts +44 -0
- package/dist/inspector.d.ts.map +1 -0
- package/dist/inspector.js +82 -0
- package/dist/inspector.js.map +1 -0
- package/dist/lifecycle.d.ts +21 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +174 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/metadata/{metadata-keys.d.mts → metadata-keys.d.ts} +5 -7
- package/dist/metadata/metadata-keys.d.ts.map +1 -0
- package/dist/metadata/metadata-keys.js +25 -0
- package/dist/metadata/metadata-keys.js.map +1 -0
- package/dist/metadata/metadata-reader-token.d.ts +7 -0
- package/dist/metadata/metadata-reader-token.d.ts.map +1 -0
- package/dist/metadata/metadata-reader-token.js +6 -0
- package/dist/metadata/metadata-reader-token.js.map +1 -0
- package/dist/metadata/metadata-types.d.ts +48 -0
- package/dist/metadata/metadata-types.d.ts.map +1 -0
- package/dist/metadata/metadata-types.js +2 -0
- package/dist/metadata/metadata-types.js.map +1 -0
- package/dist/metadata/symbol-metadata-reader.d.ts +20 -0
- package/dist/metadata/symbol-metadata-reader.d.ts.map +1 -0
- package/dist/metadata/symbol-metadata-reader.js +34 -0
- package/dist/metadata/symbol-metadata-reader.js.map +1 -0
- package/dist/module.d.ts +60 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +47 -0
- package/dist/module.js.map +1 -0
- package/dist/registry.d.ts +41 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +208 -0
- package/dist/registry.js.map +1 -0
- package/dist/resolve-options.d.ts +19 -0
- package/dist/resolve-options.d.ts.map +1 -0
- package/dist/resolve-options.js +32 -0
- package/dist/resolve-options.js.map +1 -0
- package/dist/resolver.d.ts +90 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/resolver.js +1208 -0
- package/dist/resolver.js.map +1 -0
- package/dist/scope.d.ts +25 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scope.js +61 -0
- package/dist/scope.js.map +1 -0
- package/dist/token.d.ts +23 -0
- package/dist/token.d.ts.map +1 -0
- package/dist/token.js +25 -0
- package/dist/token.js.map +1 -0
- package/dist/types.d.ts +90 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +89 -80
- package/dist/binding-scope.d.mts +0 -13
- package/dist/binding-scope.mjs +0 -21
- package/dist/binding-select.d.mts +0 -19
- package/dist/binding-select.mjs +0 -72
- package/dist/binding.d.mts +0 -191
- package/dist/binding.mjs +0 -36
- package/dist/constraints.d.mts +0 -55
- package/dist/constraints.mjs +0 -87
- package/dist/constructor-type.mjs +0 -1
- package/dist/container.d.mts +0 -62
- package/dist/container.mjs +0 -741
- package/dist/decorators/inject.d.mts +0 -49
- package/dist/decorators/inject.mjs +0 -136
- package/dist/decorators/injectable.d.mts +0 -32
- package/dist/decorators/injectable.mjs +0 -57
- package/dist/decorators/lifecycle-decorators.d.mts +0 -11
- package/dist/decorators/lifecycle-decorators.mjs +0 -38
- package/dist/dependency-graph.d.mts +0 -43
- package/dist/dependency-graph.mjs +0 -63
- package/dist/environment.d.mts +0 -55
- package/dist/environment.mjs +0 -98
- package/dist/errors.d.mts +0 -153
- package/dist/errors.mjs +0 -197
- package/dist/graph-adapters/cytoscape.d.mts +0 -36
- package/dist/graph-adapters/cytoscape.mjs +0 -26
- package/dist/graph-adapters/dot.d.mts +0 -9
- package/dist/graph-adapters/dot.mjs +0 -20
- package/dist/graph-adapters/reactflow.d.mts +0 -41
- package/dist/graph-adapters/reactflow.mjs +0 -29
- package/dist/index.d.mts +0 -18
- package/dist/index.mjs +0 -12
- package/dist/inspector.d.mts +0 -48
- package/dist/inspector.mjs +0 -71
- package/dist/lifecycle.d.mts +0 -25
- package/dist/lifecycle.mjs +0 -118
- package/dist/metadata/metadata-keys.mjs +0 -27
- package/dist/metadata/metadata-reader-token.d.mts +0 -10
- package/dist/metadata/metadata-reader-token.mjs +0 -8
- package/dist/metadata/metadata-types.d.mts +0 -51
- package/dist/metadata/metadata-types.mjs +0 -1
- package/dist/metadata/symbol-metadata-reader.d.mts +0 -23
- package/dist/metadata/symbol-metadata-reader.mjs +0 -29
- package/dist/module.d.mts +0 -62
- package/dist/module.mjs +0 -42
- package/dist/registry.d.mts +0 -45
- package/dist/registry.mjs +0 -163
- package/dist/resolve-options.d.mts +0 -22
- package/dist/resolve-options.mjs +0 -28
- package/dist/resolver.d.mts +0 -94
- package/dist/resolver.mjs +0 -767
- package/dist/scope.d.mts +0 -28
- package/dist/scope.mjs +0 -58
- package/dist/token.d.mts +0 -25
- package/dist/token.mjs +0 -22
- package/dist/types.d.mts +0 -92
- package/dist/types.mjs +0 -1
package/dist/constraints.d.mts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Constructor } from "./constructor-type.mjs";
|
|
2
|
-
import { Token } from "./token.mjs";
|
|
3
|
-
import { BindingTag, ConstraintContext } from "./types.mjs";
|
|
4
|
-
|
|
5
|
-
//#region src/constraints.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* @since 0.3.16-canary.0
|
|
8
|
-
*/
|
|
9
|
-
declare function whenParentIs(token: Token<unknown> | Constructor): (constraintContext: ConstraintContext) => boolean;
|
|
10
|
-
/**
|
|
11
|
-
* @since 0.3.16-canary.0
|
|
12
|
-
*/
|
|
13
|
-
declare function whenNoParentIs(token: Token<unknown> | Constructor): (constraintContext: ConstraintContext) => boolean;
|
|
14
|
-
/**
|
|
15
|
-
* @since 0.3.16-canary.0
|
|
16
|
-
*/
|
|
17
|
-
declare function whenAnyAncestorIs(token: Token<unknown> | Constructor): (constraintContext: ConstraintContext) => boolean;
|
|
18
|
-
/**
|
|
19
|
-
* @since 0.3.16-canary.0
|
|
20
|
-
*/
|
|
21
|
-
declare function whenNoAncestorIs(token: Token<unknown> | Constructor): (constraintContext: ConstraintContext) => boolean;
|
|
22
|
-
/**
|
|
23
|
-
* @since 0.3.16-canary.0
|
|
24
|
-
*/
|
|
25
|
-
declare function whenParentNamed(name: string): (constraintContext: ConstraintContext) => boolean;
|
|
26
|
-
/**
|
|
27
|
-
* @since 0.3.16-canary.0
|
|
28
|
-
*/
|
|
29
|
-
declare function whenAnyAncestorNamed(name: string): (constraintContext: ConstraintContext) => boolean;
|
|
30
|
-
/**
|
|
31
|
-
* @since 0.3.16-canary.0
|
|
32
|
-
*/
|
|
33
|
-
declare function whenParentTagged(tag: string, value: unknown): (constraintContext: ConstraintContext) => boolean;
|
|
34
|
-
/**
|
|
35
|
-
* @since 0.3.16-canary.0
|
|
36
|
-
*/
|
|
37
|
-
declare function whenAnyAncestorTagged(tag: string, value: unknown): (constraintContext: ConstraintContext) => boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Matches when the direct parent slot carries **all** of the given tag pairs.
|
|
40
|
-
* Equivalent to AND-composing multiple `whenParentTagged` calls but evaluates
|
|
41
|
-
* in a single predicate invocation — no intermediate closure allocations.
|
|
42
|
-
*
|
|
43
|
-
* @since 0.3.16-canary.1
|
|
44
|
-
*/
|
|
45
|
-
declare function whenParentTaggedAll(tags: ReadonlyArray<BindingTag>): (constraintContext: ConstraintContext) => boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Matches when at least one ancestor slot carries **all** of the given tag pairs.
|
|
48
|
-
* Equivalent to AND-composing multiple `whenAnyAncestorTagged` calls but evaluates
|
|
49
|
-
* in a single predicate invocation — no intermediate closure allocations.
|
|
50
|
-
*
|
|
51
|
-
* @since 0.3.16-canary.1
|
|
52
|
-
*/
|
|
53
|
-
declare function whenAnyAncestorTaggedAll(tags: ReadonlyArray<BindingTag>): (constraintContext: ConstraintContext) => boolean;
|
|
54
|
-
//#endregion
|
|
55
|
-
export { whenAnyAncestorIs, whenAnyAncestorNamed, whenAnyAncestorTagged, whenAnyAncestorTaggedAll, whenNoAncestorIs, whenNoParentIs, whenParentIs, whenParentNamed, whenParentTagged, whenParentTaggedAll };
|
package/dist/constraints.mjs
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { tokenName } from "./token.mjs";
|
|
2
|
-
//#region src/constraints.ts
|
|
3
|
-
function tokenNameOf(token) {
|
|
4
|
-
return tokenName(token);
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* @since 0.3.16-canary.0
|
|
8
|
-
*/
|
|
9
|
-
function whenParentIs(token) {
|
|
10
|
-
const tokenDisplayName = tokenNameOf(token);
|
|
11
|
-
return (constraintContext) => constraintContext.parent !== void 0 && constraintContext.parent.tokenName === tokenDisplayName;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* @since 0.3.16-canary.0
|
|
15
|
-
*/
|
|
16
|
-
function whenNoParentIs(token) {
|
|
17
|
-
const tokenDisplayName = tokenNameOf(token);
|
|
18
|
-
return (constraintContext) => constraintContext.parent === void 0 || constraintContext.parent.tokenName !== tokenDisplayName;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* @since 0.3.16-canary.0
|
|
22
|
-
*/
|
|
23
|
-
function whenAnyAncestorIs(token) {
|
|
24
|
-
const tokenDisplayName = tokenNameOf(token);
|
|
25
|
-
return (constraintContext) => constraintContext.ancestors.some((ancestorFrame) => ancestorFrame.tokenName === tokenDisplayName);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* @since 0.3.16-canary.0
|
|
29
|
-
*/
|
|
30
|
-
function whenNoAncestorIs(token) {
|
|
31
|
-
const tokenDisplayName = tokenNameOf(token);
|
|
32
|
-
return (constraintContext) => constraintContext.ancestors.every((ancestorFrame) => ancestorFrame.tokenName !== tokenDisplayName);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @since 0.3.16-canary.0
|
|
36
|
-
*/
|
|
37
|
-
function whenParentNamed(name) {
|
|
38
|
-
return (constraintContext) => constraintContext.parent !== void 0 && constraintContext.parent.slot.name === name;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* @since 0.3.16-canary.0
|
|
42
|
-
*/
|
|
43
|
-
function whenAnyAncestorNamed(name) {
|
|
44
|
-
return (constraintContext) => constraintContext.ancestors.some((ancestorFrame) => ancestorFrame.slot.name === name);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* @since 0.3.16-canary.0
|
|
48
|
-
*/
|
|
49
|
-
function whenParentTagged(tag, value) {
|
|
50
|
-
return (constraintContext) => constraintContext.parent !== void 0 && constraintContext.parent.slot.tags.some(([tagKey, tagValue]) => tagKey === tag && Object.is(tagValue, value));
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* @since 0.3.16-canary.0
|
|
54
|
-
*/
|
|
55
|
-
function whenAnyAncestorTagged(tag, value) {
|
|
56
|
-
return (constraintContext) => constraintContext.ancestors.some((ancestorFrame) => ancestorFrame.slot.tags.some(([tagKey, tagValue]) => tagKey === tag && Object.is(tagValue, value)));
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Matches when the direct parent slot carries **all** of the given tag pairs.
|
|
60
|
-
* Equivalent to AND-composing multiple `whenParentTagged` calls but evaluates
|
|
61
|
-
* in a single predicate invocation — no intermediate closure allocations.
|
|
62
|
-
*
|
|
63
|
-
* @since 0.3.16-canary.1
|
|
64
|
-
*/
|
|
65
|
-
function whenParentTaggedAll(tags) {
|
|
66
|
-
return (constraintContext) => {
|
|
67
|
-
const { parent } = constraintContext;
|
|
68
|
-
if (parent === void 0) return false;
|
|
69
|
-
const { tags: parentTags } = parent.slot;
|
|
70
|
-
return tags.every(([tagKey, tagValue]) => parentTags.some(([otherKey, otherValue]) => otherKey === tagKey && Object.is(otherValue, tagValue)));
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Matches when at least one ancestor slot carries **all** of the given tag pairs.
|
|
75
|
-
* Equivalent to AND-composing multiple `whenAnyAncestorTagged` calls but evaluates
|
|
76
|
-
* in a single predicate invocation — no intermediate closure allocations.
|
|
77
|
-
*
|
|
78
|
-
* @since 0.3.16-canary.1
|
|
79
|
-
*/
|
|
80
|
-
function whenAnyAncestorTaggedAll(tags) {
|
|
81
|
-
return (constraintContext) => constraintContext.ancestors.some((frame) => {
|
|
82
|
-
const { tags: frameTags } = frame.slot;
|
|
83
|
-
return tags.every(([tagKey, tagValue]) => frameTags.some(([otherKey, otherValue]) => otherKey === tagKey && Object.is(otherValue, tagValue)));
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
//#endregion
|
|
87
|
-
export { whenAnyAncestorIs, whenAnyAncestorNamed, whenAnyAncestorTagged, whenAnyAncestorTaggedAll, whenNoAncestorIs, whenNoParentIs, whenParentIs, whenParentNamed, whenParentTagged, whenParentTaggedAll };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/container.d.mts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Constructor } from "./constructor-type.mjs";
|
|
2
|
-
import { Token } from "./token.mjs";
|
|
3
|
-
import { ActivationHandler, BindingIdentifier, DeactivationHandler, ResolveOptions } from "./types.mjs";
|
|
4
|
-
import { BindToBuilder } from "./binding.mjs";
|
|
5
|
-
import { AutoRegisterRegistry } from "./decorators/injectable.mjs";
|
|
6
|
-
import { ContainerGraphJson, GraphOptions } from "./dependency-graph.mjs";
|
|
7
|
-
import { BindingSnapshot, ContainerSnapshot } from "./inspector.mjs";
|
|
8
|
-
import { AsyncModule, SyncModule } from "./module.mjs";
|
|
9
|
-
|
|
10
|
-
//#region src/container.d.ts
|
|
11
|
-
/**
|
|
12
|
-
* @since 0.3.16-canary.0
|
|
13
|
-
*/
|
|
14
|
-
interface Container {
|
|
15
|
-
readonly isDisposed: boolean;
|
|
16
|
-
bind<const Value>(token: Token<Value> | Constructor<Value>): BindToBuilder<Value>;
|
|
17
|
-
unbind(tokenOrId: Token<unknown> | Constructor | BindingIdentifier): void;
|
|
18
|
-
unbindAsync(tokenOrId: Token<unknown> | Constructor | BindingIdentifier): Promise<void>;
|
|
19
|
-
unbindAll(): void;
|
|
20
|
-
unbindAllAsync(): Promise<void>;
|
|
21
|
-
rebind<const Value>(token: Token<Value> | Constructor<Value>): BindToBuilder<Value>;
|
|
22
|
-
load(...modules: Array<SyncModule>): void;
|
|
23
|
-
loadAsync(...modules: Array<SyncModule | AsyncModule>): Promise<void>;
|
|
24
|
-
unload(...modules: Array<SyncModule>): void;
|
|
25
|
-
unloadAsync(...modules: Array<SyncModule | AsyncModule>): Promise<void>;
|
|
26
|
-
loadAutoRegistered(registry: AutoRegisterRegistry): number;
|
|
27
|
-
onActivation<const Value>(token: Token<Value> | Constructor<Value>, handler: ActivationHandler<Value>): void;
|
|
28
|
-
onDeactivation<const Value>(token: Token<Value> | Constructor<Value>, handler: DeactivationHandler<Value>): void;
|
|
29
|
-
resolve<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Value;
|
|
30
|
-
resolveAsync<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Promise<Value>;
|
|
31
|
-
resolveOptional<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Value | undefined;
|
|
32
|
-
resolveOptionalAsync<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Promise<Value | undefined>;
|
|
33
|
-
resolveAll<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Array<Value>;
|
|
34
|
-
resolveAllAsync<const Value>(token: Token<Value> | Constructor<Value>, options?: ResolveOptions): Promise<Array<Value>>;
|
|
35
|
-
createChild(): Container;
|
|
36
|
-
dispose(): Promise<void>;
|
|
37
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
38
|
-
[Symbol.dispose](): never;
|
|
39
|
-
initializeAsync(): Promise<void>;
|
|
40
|
-
validate(): void;
|
|
41
|
-
has(token: Token<unknown> | Constructor, options?: ResolveOptions): boolean;
|
|
42
|
-
hasOwn(token: Token<unknown> | Constructor, options?: ResolveOptions): boolean;
|
|
43
|
-
lookupBindings<const Value>(token: Token<Value> | Constructor<Value>): ReadonlyArray<BindingSnapshot>;
|
|
44
|
-
inspect(): ContainerSnapshot;
|
|
45
|
-
generateDependencyGraph(options?: GraphOptions): ContainerGraphJson;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* @since 0.3.16-canary.0
|
|
49
|
-
*/
|
|
50
|
-
interface ContainerStatic {
|
|
51
|
-
create(): Container;
|
|
52
|
-
fromModules(...modules: Array<SyncModule>): Container;
|
|
53
|
-
fromModulesAsync(...modules: Array<SyncModule | AsyncModule>): Promise<Container>;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* @since 0.3.16-canary.0
|
|
57
|
-
*/
|
|
58
|
-
declare const Container: ContainerStatic & {
|
|
59
|
-
create(): Container;
|
|
60
|
-
};
|
|
61
|
-
//#endregion
|
|
62
|
-
export { Container, ContainerStatic };
|