@illuma/core 1.0.0

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.
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/plugins.ts
22
+ var plugins_exports = {};
23
+ __export(plugins_exports, {
24
+ DiagnosticsDefaultReporter: () => DiagnosticsDefaultReporter,
25
+ Illuma: () => Illuma
26
+ });
27
+ module.exports = __toCommonJS(plugins_exports);
28
+
29
+ // src/lib/plugins/core/plugin-container.ts
30
+ var Illuma = class _Illuma {
31
+ static {
32
+ __name(this, "Illuma");
33
+ }
34
+ static _diagnostics = [];
35
+ static _scanners = [];
36
+ /** @internal */
37
+ static get contextScanners() {
38
+ return _Illuma._scanners;
39
+ }
40
+ /**
41
+ * Extends the diagnostics with a new diagnostics module.
42
+ * These will be run on diagnostics reports after container bootstrap.
43
+ *
44
+ * @param m - The diagnostics module instance to add
45
+ */
46
+ static extendDiagnostics(m) {
47
+ _Illuma._diagnostics.push(m);
48
+ }
49
+ /**
50
+ * Extends the context scanners with a new context scanner.
51
+ * These will be run in injection context scans to detect additional injections (alongside `nodeInject` calls).
52
+ *
53
+ * @param scanner - The context scanner instance to add
54
+ */
55
+ static extendContextScanner(scanner) {
56
+ _Illuma._scanners.push(scanner);
57
+ }
58
+ static onReport(report) {
59
+ for (const diag of _Illuma._diagnostics) diag.onReport(report);
60
+ }
61
+ };
62
+
63
+ // src/lib/plugins/diagnostics/default-impl.ts
64
+ var DiagnosticsDefaultReporter = class {
65
+ static {
66
+ __name(this, "DiagnosticsDefaultReporter");
67
+ }
68
+ onReport(report) {
69
+ console.log("[Illuma] \u{1F9F9} Diagnostics:");
70
+ console.log(` Total: ${report.totalNodes} node(s)`);
71
+ console.log(` ${report.unusedNodes.length} were not used while bootstrap:`);
72
+ for (const node of report.unusedNodes) console.log(` - ${node.toString()}`);
73
+ }
74
+ };
75
+ // Annotate the CommonJS export names for ESM import in node:
76
+ 0 && (module.exports = {
77
+ DiagnosticsDefaultReporter,
78
+ Illuma
79
+ });
80
+ //# sourceMappingURL=plugins.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugins.ts","../src/lib/plugins/core/plugin-container.ts","../src/lib/plugins/diagnostics/default-impl.ts"],"sourcesContent":["export * from \"./lib/plugins\";\n","import type { iContextScanner } from \"../context\";\nimport type { iDiagnosticsModule, iDiagnosticsReport } from \"../diagnostics/types\";\n\n/**\n * Global plugin container for managing core plugins such as diagnostics and context scanners.\n */\nexport abstract class Illuma {\n private static readonly _diagnostics = [] as iDiagnosticsModule[];\n private static readonly _scanners = [] as iContextScanner[];\n\n /** @internal */\n public static get contextScanners(): ReadonlyArray<iContextScanner> {\n return Illuma._scanners;\n }\n\n /**\n * Extends the diagnostics with a new diagnostics module.\n * These will be run on diagnostics reports after container bootstrap.\n *\n * @param m - The diagnostics module instance to add\n */\n public static extendDiagnostics(m: iDiagnosticsModule): void {\n Illuma._diagnostics.push(m);\n }\n\n /**\n * Extends the context scanners with a new context scanner.\n * These will be run in injection context scans to detect additional injections (alongside `nodeInject` calls).\n *\n * @param scanner - The context scanner instance to add\n */\n public static extendContextScanner(scanner: iContextScanner): void {\n Illuma._scanners.push(scanner);\n }\n\n protected static onReport(report: iDiagnosticsReport): void {\n for (const diag of Illuma._diagnostics) diag.onReport(report);\n }\n}\n","import type { iDiagnosticsModule, iDiagnosticsReport } from \"./types\";\n\nexport class DiagnosticsDefaultReporter implements iDiagnosticsModule {\n public onReport(report: iDiagnosticsReport): void {\n console.log(\"[Illuma] 🧹 Diagnostics:\");\n console.log(` Total: ${report.totalNodes} node(s)`);\n console.log(` ${report.unusedNodes.length} were not used while bootstrap:`);\n for (const node of report.unusedNodes) console.log(` - ${node.toString()}`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;ACMO,IAAeA,SAAf,MAAeA,QAAAA;EAHtB,OAGsBA;;;EACpB,OAAwBC,eAAe,CAAA;EACvC,OAAwBC,YAAY,CAAA;;EAGpC,WAAkBC,kBAAkD;AAClE,WAAOH,QAAOE;EAChB;;;;;;;EAQA,OAAcE,kBAAkBC,GAA6B;AAC3DL,YAAOC,aAAaK,KAAKD,CAAAA;EAC3B;;;;;;;EAQA,OAAcE,qBAAqBC,SAAgC;AACjER,YAAOE,UAAUI,KAAKE,OAAAA;EACxB;EAEA,OAAiBC,SAASC,QAAkC;AAC1D,eAAWC,QAAQX,QAAOC,aAAcU,MAAKF,SAASC,MAAAA;EACxD;AACF;;;ACpCO,IAAME,6BAAN,MAAMA;EAAb,OAAaA;;;EACJC,SAASC,QAAkC;AAChDC,YAAQC,IAAI,iCAAA;AACZD,YAAQC,IAAI,YAAYF,OAAOG,UAAU,UAAU;AACnDF,YAAQC,IAAI,KAAKF,OAAOI,YAAYC,MAAM,iCAAiC;AAC3E,eAAWC,QAAQN,OAAOI,YAAaH,SAAQC,IAAI,SAASI,KAAKC,SAAQ,CAAA,EAAI;EAC/E;AACF;","names":["Illuma","_diagnostics","_scanners","contextScanners","extendDiagnostics","m","push","extendContextScanner","scanner","onReport","report","diag","DiagnosticsDefaultReporter","onReport","report","console","log","totalNodes","unusedNodes","length","node","toString"]}
@@ -0,0 +1,9 @@
1
+ import { a as iDiagnosticsModule, b as iDiagnosticsReport } from './plugin-container-D8Zwpigq.cjs';
2
+ export { I as Illuma, c as iContextScanner } from './plugin-container-D8Zwpigq.cjs';
3
+ import './providers-D9YA8L_g.cjs';
4
+
5
+ declare class DiagnosticsDefaultReporter implements iDiagnosticsModule {
6
+ onReport(report: iDiagnosticsReport): void;
7
+ }
8
+
9
+ export { DiagnosticsDefaultReporter, iDiagnosticsModule, iDiagnosticsReport };
@@ -0,0 +1,9 @@
1
+ import { a as iDiagnosticsModule, b as iDiagnosticsReport } from './plugin-container-CwkVlVS4.js';
2
+ export { I as Illuma, c as iContextScanner } from './plugin-container-CwkVlVS4.js';
3
+ import './providers-D9YA8L_g.js';
4
+
5
+ declare class DiagnosticsDefaultReporter implements iDiagnosticsModule {
6
+ onReport(report: iDiagnosticsReport): void;
7
+ }
8
+
9
+ export { DiagnosticsDefaultReporter, iDiagnosticsModule, iDiagnosticsReport };
@@ -0,0 +1,54 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/lib/plugins/core/plugin-container.ts
5
+ var Illuma = class _Illuma {
6
+ static {
7
+ __name(this, "Illuma");
8
+ }
9
+ static _diagnostics = [];
10
+ static _scanners = [];
11
+ /** @internal */
12
+ static get contextScanners() {
13
+ return _Illuma._scanners;
14
+ }
15
+ /**
16
+ * Extends the diagnostics with a new diagnostics module.
17
+ * These will be run on diagnostics reports after container bootstrap.
18
+ *
19
+ * @param m - The diagnostics module instance to add
20
+ */
21
+ static extendDiagnostics(m) {
22
+ _Illuma._diagnostics.push(m);
23
+ }
24
+ /**
25
+ * Extends the context scanners with a new context scanner.
26
+ * These will be run in injection context scans to detect additional injections (alongside `nodeInject` calls).
27
+ *
28
+ * @param scanner - The context scanner instance to add
29
+ */
30
+ static extendContextScanner(scanner) {
31
+ _Illuma._scanners.push(scanner);
32
+ }
33
+ static onReport(report) {
34
+ for (const diag of _Illuma._diagnostics) diag.onReport(report);
35
+ }
36
+ };
37
+
38
+ // src/lib/plugins/diagnostics/default-impl.ts
39
+ var DiagnosticsDefaultReporter = class {
40
+ static {
41
+ __name(this, "DiagnosticsDefaultReporter");
42
+ }
43
+ onReport(report) {
44
+ console.log("[Illuma] \u{1F9F9} Diagnostics:");
45
+ console.log(` Total: ${report.totalNodes} node(s)`);
46
+ console.log(` ${report.unusedNodes.length} were not used while bootstrap:`);
47
+ for (const node of report.unusedNodes) console.log(` - ${node.toString()}`);
48
+ }
49
+ };
50
+ export {
51
+ DiagnosticsDefaultReporter,
52
+ Illuma
53
+ };
54
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/plugins/core/plugin-container.ts","../src/lib/plugins/diagnostics/default-impl.ts"],"sourcesContent":["import type { iContextScanner } from \"../context\";\nimport type { iDiagnosticsModule, iDiagnosticsReport } from \"../diagnostics/types\";\n\n/**\n * Global plugin container for managing core plugins such as diagnostics and context scanners.\n */\nexport abstract class Illuma {\n private static readonly _diagnostics = [] as iDiagnosticsModule[];\n private static readonly _scanners = [] as iContextScanner[];\n\n /** @internal */\n public static get contextScanners(): ReadonlyArray<iContextScanner> {\n return Illuma._scanners;\n }\n\n /**\n * Extends the diagnostics with a new diagnostics module.\n * These will be run on diagnostics reports after container bootstrap.\n *\n * @param m - The diagnostics module instance to add\n */\n public static extendDiagnostics(m: iDiagnosticsModule): void {\n Illuma._diagnostics.push(m);\n }\n\n /**\n * Extends the context scanners with a new context scanner.\n * These will be run in injection context scans to detect additional injections (alongside `nodeInject` calls).\n *\n * @param scanner - The context scanner instance to add\n */\n public static extendContextScanner(scanner: iContextScanner): void {\n Illuma._scanners.push(scanner);\n }\n\n protected static onReport(report: iDiagnosticsReport): void {\n for (const diag of Illuma._diagnostics) diag.onReport(report);\n }\n}\n","import type { iDiagnosticsModule, iDiagnosticsReport } from \"./types\";\n\nexport class DiagnosticsDefaultReporter implements iDiagnosticsModule {\n public onReport(report: iDiagnosticsReport): void {\n console.log(\"[Illuma] 🧹 Diagnostics:\");\n console.log(` Total: ${report.totalNodes} node(s)`);\n console.log(` ${report.unusedNodes.length} were not used while bootstrap:`);\n for (const node of report.unusedNodes) console.log(` - ${node.toString()}`);\n }\n}\n"],"mappings":";;;;AAMO,IAAeA,SAAf,MAAeA,QAAAA;EAHtB,OAGsBA;;;EACpB,OAAwBC,eAAe,CAAA;EACvC,OAAwBC,YAAY,CAAA;;EAGpC,WAAkBC,kBAAkD;AAClE,WAAOH,QAAOE;EAChB;;;;;;;EAQA,OAAcE,kBAAkBC,GAA6B;AAC3DL,YAAOC,aAAaK,KAAKD,CAAAA;EAC3B;;;;;;;EAQA,OAAcE,qBAAqBC,SAAgC;AACjER,YAAOE,UAAUI,KAAKE,OAAAA;EACxB;EAEA,OAAiBC,SAASC,QAAkC;AAC1D,eAAWC,QAAQX,QAAOC,aAAcU,MAAKF,SAASC,MAAAA;EACxD;AACF;;;ACpCO,IAAME,6BAAN,MAAMA;EAAb,OAAaA;;;EACJC,SAASC,QAAkC;AAChDC,YAAQC,IAAI,iCAAA;AACZD,YAAQC,IAAI,YAAYF,OAAOG,UAAU,UAAU;AACnDF,YAAQC,IAAI,KAAKF,OAAOI,YAAYC,MAAM,iCAAiC;AAC3E,eAAWC,QAAQN,OAAOI,YAAaH,SAAQC,IAAI,SAASI,KAAKC,SAAQ,CAAA,EAAI;EAC/E;AACF;","names":["Illuma","_diagnostics","_scanners","contextScanners","extendDiagnostics","m","push","extendContextScanner","scanner","onReport","report","diag","DiagnosticsDefaultReporter","onReport","report","console","log","totalNodes","unusedNodes","length","node","toString"]}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Base class for dependency injection tokens.
3
+ * This class should not be instantiated directly. Use {@link NodeToken} or {@link MultiNodeToken} instead.
4
+ *
5
+ * @template T - The type of value this token represents
6
+ */
7
+ declare class NodeBase<T> {
8
+ readonly name: string;
9
+ readonly opts?: iNodeTokenBaseOptions<T> | undefined;
10
+ constructor(name: string, opts?: iNodeTokenBaseOptions<T> | undefined);
11
+ /** Provides this token with a value */
12
+ withValue(value: T): iNodeValueProvider<T>;
13
+ /** Provides this token using a factory function */
14
+ withFactory(factory: () => T): iNodeFactoryProvider<T>;
15
+ /** Provides this token using a class constructor */
16
+ withClass(ctor: Ctor<T>): iNodeClassProvider<T>;
17
+ /** Creates an alias to another token */
18
+ withAlias<K extends T>(alias: Token<K>): iNodeAliasProvider<T>;
19
+ toString(): string;
20
+ }
21
+ /**
22
+ * A token that represents a single dependency in the dependency injection system.
23
+ * Use this to define injectable dependencies that have exactly one provider.
24
+ *
25
+ * @template T - The type of value this token represents
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const LoggerToken = new NodeToken<Logger>('Logger');
30
+ * container.provide({ provide: LoggerToken, useClass: ConsoleLogger });
31
+ * const logger = container.get(LoggerToken);
32
+ * ```
33
+ */
34
+ declare class NodeToken<T> extends NodeBase<T> {
35
+ readonly multi: false;
36
+ toString(): string;
37
+ }
38
+ /**
39
+ * A token that represents multiple dependencies in the dependency injection system.
40
+ * Use this to define injectable dependencies that can have multiple providers.
41
+ * When retrieved, returns an array of all registered providers.
42
+ *
43
+ * @template T - The type of value this token represents
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * const PluginToken = new MultiNodeToken<Plugin>('Plugins');
48
+ * container.provide({ provide: PluginToken, useClass: PluginA });
49
+ * container.provide({ provide: PluginToken, useClass: PluginB });
50
+ * const plugins = container.get(PluginToken); // [PluginA instance, PluginB instance]
51
+ * ```
52
+ */
53
+ declare class MultiNodeToken<T> extends NodeBase<T> {
54
+ readonly multi: true;
55
+ toString(): string;
56
+ }
57
+ /**
58
+ * Type guard to check if a value is a valid dependency injection token.
59
+ *
60
+ * @template T - The type of value the token represents
61
+ * @param specimen - The value to check
62
+ * @returns True if the specimen is a NodeToken or MultiNodeToken, false otherwise
63
+ * @internal
64
+ */
65
+ declare function isNodeBase<T>(specimen: unknown): specimen is NodeToken<T> | MultiNodeToken<T>;
66
+ /**
67
+ * Extracts a valid NodeBase token from a given provider.
68
+ * If the provider is a class constructor decorated with @NodeInjectable, it retrieves the associated token.
69
+ * If the provider is already a NodeBase token, it returns it directly.
70
+ * Throws an InjectionError if the provider is invalid.
71
+ *
72
+ * @template T - The type of value the token represents
73
+ * @param provider - The provider to extract the token from
74
+ * @param isAlias - Whether the provider is being used as an alias
75
+ * @returns The extracted NodeBase token
76
+ * @throws {InjectionError} If the provider is invalid
77
+ * @internal
78
+ */
79
+ declare function extractToken<T>(provider: Token<T>, isAlias?: boolean): NodeToken<T> | MultiNodeToken<T>;
80
+
81
+ /**
82
+ * Represents a constructor function type.
83
+ * @template T - The type that the constructor creates
84
+ */
85
+ type Ctor<T> = new (...args: any[]) => T;
86
+ /**
87
+ * Represents a token that can be either a NodeBase token or a constructor.
88
+ * @template T - The type that the token represents
89
+ */
90
+ type Token<T> = NodeBase<T> | Ctor<T>;
91
+ /**
92
+ * Options for configuring a NodeToken or MultiNodeToken.
93
+ * @template T - The type of value the token represents
94
+ */
95
+ interface iNodeTokenBaseOptions<T> {
96
+ /**
97
+ * Optional factory function to create instances of this token.
98
+ */
99
+ factory?: () => NoInfer<T>;
100
+ }
101
+ /**
102
+ * Provider that supplies a static value for a token.
103
+ * @template T - The type of value being provided
104
+ */
105
+ interface iNodeValueProvider<T> {
106
+ /** The token this provider is for */
107
+ provide: Token<T>;
108
+ /** The static value to provide */
109
+ value: NoInfer<T>;
110
+ }
111
+ /**
112
+ * Provider that uses a factory function to create instances.
113
+ * @template T - The type of value being provided
114
+ */
115
+ interface iNodeFactoryProvider<T> {
116
+ /** The token this provider is for */
117
+ provide: Token<T>;
118
+ /** Factory function to create the value */
119
+ factory: () => NoInfer<T>;
120
+ }
121
+ /**
122
+ * Provider that uses a class constructor to create instances.
123
+ * @template T - The type of value being provided
124
+ */
125
+ interface iNodeClassProvider<T> {
126
+ /** The token this provider is for */
127
+ provide: Token<T>;
128
+ /** The class to instantiate */
129
+ useClass: Ctor<T>;
130
+ }
131
+ /**
132
+ * Provider that creates an alias to another token.
133
+ * When this token is injected, the aliased token's value is returned instead.
134
+ * @template T - The type of value being provided
135
+ */
136
+ interface iNodeAliasProvider<T> {
137
+ /** The token this provider is for */
138
+ provide: Token<T>;
139
+ /** The token to alias to */
140
+ alias: Token<T>;
141
+ }
142
+ /**
143
+ * Union type of all possible provider configurations.
144
+ * @template T - The type of value being provided
145
+ */
146
+ type iNodeProvider<T> = iNodeValueProvider<T> | iNodeFactoryProvider<T> | iNodeClassProvider<T> | iNodeAliasProvider<T>;
147
+ /**
148
+ * Union type of all values that can be provided to a container.
149
+ * @template T - The type of value being provided
150
+ */
151
+ type Provider<T = unknown> = NodeBase<T> | iNodeProvider<T> | Ctor<T> | Provider<unknown>[];
152
+
153
+ export { type Ctor as C, MultiNodeToken as M, NodeBase as N, type Provider as P, type Token as T, NodeToken as a, type iNodeTokenBaseOptions as b, type iNodeValueProvider as c, type iNodeFactoryProvider as d, extractToken as e, type iNodeClassProvider as f, type iNodeAliasProvider as g, type iNodeProvider as h, isNodeBase as i };
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Base class for dependency injection tokens.
3
+ * This class should not be instantiated directly. Use {@link NodeToken} or {@link MultiNodeToken} instead.
4
+ *
5
+ * @template T - The type of value this token represents
6
+ */
7
+ declare class NodeBase<T> {
8
+ readonly name: string;
9
+ readonly opts?: iNodeTokenBaseOptions<T> | undefined;
10
+ constructor(name: string, opts?: iNodeTokenBaseOptions<T> | undefined);
11
+ /** Provides this token with a value */
12
+ withValue(value: T): iNodeValueProvider<T>;
13
+ /** Provides this token using a factory function */
14
+ withFactory(factory: () => T): iNodeFactoryProvider<T>;
15
+ /** Provides this token using a class constructor */
16
+ withClass(ctor: Ctor<T>): iNodeClassProvider<T>;
17
+ /** Creates an alias to another token */
18
+ withAlias<K extends T>(alias: Token<K>): iNodeAliasProvider<T>;
19
+ toString(): string;
20
+ }
21
+ /**
22
+ * A token that represents a single dependency in the dependency injection system.
23
+ * Use this to define injectable dependencies that have exactly one provider.
24
+ *
25
+ * @template T - The type of value this token represents
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const LoggerToken = new NodeToken<Logger>('Logger');
30
+ * container.provide({ provide: LoggerToken, useClass: ConsoleLogger });
31
+ * const logger = container.get(LoggerToken);
32
+ * ```
33
+ */
34
+ declare class NodeToken<T> extends NodeBase<T> {
35
+ readonly multi: false;
36
+ toString(): string;
37
+ }
38
+ /**
39
+ * A token that represents multiple dependencies in the dependency injection system.
40
+ * Use this to define injectable dependencies that can have multiple providers.
41
+ * When retrieved, returns an array of all registered providers.
42
+ *
43
+ * @template T - The type of value this token represents
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * const PluginToken = new MultiNodeToken<Plugin>('Plugins');
48
+ * container.provide({ provide: PluginToken, useClass: PluginA });
49
+ * container.provide({ provide: PluginToken, useClass: PluginB });
50
+ * const plugins = container.get(PluginToken); // [PluginA instance, PluginB instance]
51
+ * ```
52
+ */
53
+ declare class MultiNodeToken<T> extends NodeBase<T> {
54
+ readonly multi: true;
55
+ toString(): string;
56
+ }
57
+ /**
58
+ * Type guard to check if a value is a valid dependency injection token.
59
+ *
60
+ * @template T - The type of value the token represents
61
+ * @param specimen - The value to check
62
+ * @returns True if the specimen is a NodeToken or MultiNodeToken, false otherwise
63
+ * @internal
64
+ */
65
+ declare function isNodeBase<T>(specimen: unknown): specimen is NodeToken<T> | MultiNodeToken<T>;
66
+ /**
67
+ * Extracts a valid NodeBase token from a given provider.
68
+ * If the provider is a class constructor decorated with @NodeInjectable, it retrieves the associated token.
69
+ * If the provider is already a NodeBase token, it returns it directly.
70
+ * Throws an InjectionError if the provider is invalid.
71
+ *
72
+ * @template T - The type of value the token represents
73
+ * @param provider - The provider to extract the token from
74
+ * @param isAlias - Whether the provider is being used as an alias
75
+ * @returns The extracted NodeBase token
76
+ * @throws {InjectionError} If the provider is invalid
77
+ * @internal
78
+ */
79
+ declare function extractToken<T>(provider: Token<T>, isAlias?: boolean): NodeToken<T> | MultiNodeToken<T>;
80
+
81
+ /**
82
+ * Represents a constructor function type.
83
+ * @template T - The type that the constructor creates
84
+ */
85
+ type Ctor<T> = new (...args: any[]) => T;
86
+ /**
87
+ * Represents a token that can be either a NodeBase token or a constructor.
88
+ * @template T - The type that the token represents
89
+ */
90
+ type Token<T> = NodeBase<T> | Ctor<T>;
91
+ /**
92
+ * Options for configuring a NodeToken or MultiNodeToken.
93
+ * @template T - The type of value the token represents
94
+ */
95
+ interface iNodeTokenBaseOptions<T> {
96
+ /**
97
+ * Optional factory function to create instances of this token.
98
+ */
99
+ factory?: () => NoInfer<T>;
100
+ }
101
+ /**
102
+ * Provider that supplies a static value for a token.
103
+ * @template T - The type of value being provided
104
+ */
105
+ interface iNodeValueProvider<T> {
106
+ /** The token this provider is for */
107
+ provide: Token<T>;
108
+ /** The static value to provide */
109
+ value: NoInfer<T>;
110
+ }
111
+ /**
112
+ * Provider that uses a factory function to create instances.
113
+ * @template T - The type of value being provided
114
+ */
115
+ interface iNodeFactoryProvider<T> {
116
+ /** The token this provider is for */
117
+ provide: Token<T>;
118
+ /** Factory function to create the value */
119
+ factory: () => NoInfer<T>;
120
+ }
121
+ /**
122
+ * Provider that uses a class constructor to create instances.
123
+ * @template T - The type of value being provided
124
+ */
125
+ interface iNodeClassProvider<T> {
126
+ /** The token this provider is for */
127
+ provide: Token<T>;
128
+ /** The class to instantiate */
129
+ useClass: Ctor<T>;
130
+ }
131
+ /**
132
+ * Provider that creates an alias to another token.
133
+ * When this token is injected, the aliased token's value is returned instead.
134
+ * @template T - The type of value being provided
135
+ */
136
+ interface iNodeAliasProvider<T> {
137
+ /** The token this provider is for */
138
+ provide: Token<T>;
139
+ /** The token to alias to */
140
+ alias: Token<T>;
141
+ }
142
+ /**
143
+ * Union type of all possible provider configurations.
144
+ * @template T - The type of value being provided
145
+ */
146
+ type iNodeProvider<T> = iNodeValueProvider<T> | iNodeFactoryProvider<T> | iNodeClassProvider<T> | iNodeAliasProvider<T>;
147
+ /**
148
+ * Union type of all values that can be provided to a container.
149
+ * @template T - The type of value being provided
150
+ */
151
+ type Provider<T = unknown> = NodeBase<T> | iNodeProvider<T> | Ctor<T> | Provider<unknown>[];
152
+
153
+ export { type Ctor as C, MultiNodeToken as M, NodeBase as N, type Provider as P, type Token as T, NodeToken as a, type iNodeTokenBaseOptions as b, type iNodeValueProvider as c, type iNodeFactoryProvider as d, extractToken as e, type iNodeClassProvider as f, type iNodeAliasProvider as g, type iNodeProvider as h, isNodeBase as i };