@illuma/core 0.1.0 → 0.2.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.
- package/CHANGELOG.md +2 -0
- package/dist/index.cjs +101 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +120 -76
- package/dist/index.d.ts +120 -76
- package/dist/index.js +99 -20
- package/dist/index.js.map +1 -1
- package/dist/{injection-Y_bVmBSk.d.ts → injection-CJGqGWJ6.d.cts} +1 -1
- package/dist/{injection-CSxu56ds.d.cts → injection-D22uAh1O.d.ts} +1 -1
- package/dist/{plugin-container-CwkVlVS4.d.ts → plugin-container-CUw26ZhP.d.ts} +21 -18
- package/dist/{plugin-container-D8Zwpigq.d.cts → plugin-container-n0FIqLbh.d.cts} +21 -18
- package/dist/plugins.d.cts +3 -3
- package/dist/plugins.d.ts +3 -3
- package/dist/testkit.cjs +62 -20
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.d.cts +2 -2
- package/dist/testkit.d.ts +2 -2
- package/dist/testkit.js +62 -20
- package/dist/testkit.js.map +1 -1
- package/dist/{providers-D9YA8L_g.d.cts → token-BvQrvm-Q.d.cts} +73 -73
- package/dist/{providers-D9YA8L_g.d.ts → token-BvQrvm-Q.d.ts} +73 -73
- package/package.json +1 -1
|
@@ -1,3 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a constructor function type.
|
|
3
|
+
* @template T - The type that the constructor creates
|
|
4
|
+
*/
|
|
5
|
+
type Ctor<T> = new (...args: any[]) => T;
|
|
6
|
+
/**
|
|
7
|
+
* Represents a token that can be either a NodeBase token or a constructor.
|
|
8
|
+
* @template T - The type that the token represents
|
|
9
|
+
*/
|
|
10
|
+
type Token<T> = NodeBase<T> | Ctor<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Options for configuring a NodeToken or MultiNodeToken.
|
|
13
|
+
* @template T - The type of value the token represents
|
|
14
|
+
*/
|
|
15
|
+
interface iNodeTokenBaseOptions<T> {
|
|
16
|
+
/**
|
|
17
|
+
* Optional factory function to create instances of this token.
|
|
18
|
+
*/
|
|
19
|
+
factory?: () => NoInfer<T>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Provider that supplies a static value for a token.
|
|
23
|
+
* @template T - The type of value being provided
|
|
24
|
+
*/
|
|
25
|
+
interface iNodeValueProvider<T> {
|
|
26
|
+
/** The token this provider is for */
|
|
27
|
+
provide: Token<T>;
|
|
28
|
+
/** The static value to provide */
|
|
29
|
+
value: NoInfer<T>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Provider that uses a factory function to create instances.
|
|
33
|
+
* @template T - The type of value being provided
|
|
34
|
+
*/
|
|
35
|
+
interface iNodeFactoryProvider<T> {
|
|
36
|
+
/** The token this provider is for */
|
|
37
|
+
provide: Token<T>;
|
|
38
|
+
/** Factory function to create the value */
|
|
39
|
+
factory: () => NoInfer<T>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Provider that uses a class constructor to create instances.
|
|
43
|
+
* @template T - The type of value being provided
|
|
44
|
+
*/
|
|
45
|
+
interface iNodeClassProvider<T> {
|
|
46
|
+
/** The token this provider is for */
|
|
47
|
+
provide: Token<T>;
|
|
48
|
+
/** The class to instantiate */
|
|
49
|
+
useClass: Ctor<T>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Provider that creates an alias to another token.
|
|
53
|
+
* When this token is injected, the aliased token's value is returned instead.
|
|
54
|
+
* @template T - The type of value being provided
|
|
55
|
+
*/
|
|
56
|
+
interface iNodeAliasProvider<T> {
|
|
57
|
+
/** The token this provider is for */
|
|
58
|
+
provide: Token<T>;
|
|
59
|
+
/** The token to alias to */
|
|
60
|
+
alias: Token<T>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Union type of all possible provider configurations.
|
|
64
|
+
* @template T - The type of value being provided
|
|
65
|
+
*/
|
|
66
|
+
type iNodeProvider<T> = iNodeValueProvider<T> | iNodeFactoryProvider<T> | iNodeClassProvider<T> | iNodeAliasProvider<T>;
|
|
67
|
+
/**
|
|
68
|
+
* Union type of all values that can be provided to a container.
|
|
69
|
+
* @template T - The type of value being provided
|
|
70
|
+
*/
|
|
71
|
+
type Provider<T = unknown> = NodeBase<T> | iNodeProvider<T> | Ctor<T> | Provider<unknown>[];
|
|
72
|
+
|
|
1
73
|
/**
|
|
2
74
|
* Base class for dependency injection tokens.
|
|
3
75
|
* This class should not be instantiated directly. Use {@link NodeToken} or {@link MultiNodeToken} instead.
|
|
@@ -78,76 +150,4 @@ declare function isNodeBase<T>(specimen: unknown): specimen is NodeToken<T> | Mu
|
|
|
78
150
|
*/
|
|
79
151
|
declare function extractToken<T>(provider: Token<T>, isAlias?: boolean): NodeToken<T> | MultiNodeToken<T>;
|
|
80
152
|
|
|
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 };
|
|
153
|
+
export { type Ctor as C, MultiNodeToken as M, NodeToken as N, type Provider as P, type Token as T, NodeBase 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 };
|
|
@@ -1,3 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a constructor function type.
|
|
3
|
+
* @template T - The type that the constructor creates
|
|
4
|
+
*/
|
|
5
|
+
type Ctor<T> = new (...args: any[]) => T;
|
|
6
|
+
/**
|
|
7
|
+
* Represents a token that can be either a NodeBase token or a constructor.
|
|
8
|
+
* @template T - The type that the token represents
|
|
9
|
+
*/
|
|
10
|
+
type Token<T> = NodeBase<T> | Ctor<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Options for configuring a NodeToken or MultiNodeToken.
|
|
13
|
+
* @template T - The type of value the token represents
|
|
14
|
+
*/
|
|
15
|
+
interface iNodeTokenBaseOptions<T> {
|
|
16
|
+
/**
|
|
17
|
+
* Optional factory function to create instances of this token.
|
|
18
|
+
*/
|
|
19
|
+
factory?: () => NoInfer<T>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Provider that supplies a static value for a token.
|
|
23
|
+
* @template T - The type of value being provided
|
|
24
|
+
*/
|
|
25
|
+
interface iNodeValueProvider<T> {
|
|
26
|
+
/** The token this provider is for */
|
|
27
|
+
provide: Token<T>;
|
|
28
|
+
/** The static value to provide */
|
|
29
|
+
value: NoInfer<T>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Provider that uses a factory function to create instances.
|
|
33
|
+
* @template T - The type of value being provided
|
|
34
|
+
*/
|
|
35
|
+
interface iNodeFactoryProvider<T> {
|
|
36
|
+
/** The token this provider is for */
|
|
37
|
+
provide: Token<T>;
|
|
38
|
+
/** Factory function to create the value */
|
|
39
|
+
factory: () => NoInfer<T>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Provider that uses a class constructor to create instances.
|
|
43
|
+
* @template T - The type of value being provided
|
|
44
|
+
*/
|
|
45
|
+
interface iNodeClassProvider<T> {
|
|
46
|
+
/** The token this provider is for */
|
|
47
|
+
provide: Token<T>;
|
|
48
|
+
/** The class to instantiate */
|
|
49
|
+
useClass: Ctor<T>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Provider that creates an alias to another token.
|
|
53
|
+
* When this token is injected, the aliased token's value is returned instead.
|
|
54
|
+
* @template T - The type of value being provided
|
|
55
|
+
*/
|
|
56
|
+
interface iNodeAliasProvider<T> {
|
|
57
|
+
/** The token this provider is for */
|
|
58
|
+
provide: Token<T>;
|
|
59
|
+
/** The token to alias to */
|
|
60
|
+
alias: Token<T>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Union type of all possible provider configurations.
|
|
64
|
+
* @template T - The type of value being provided
|
|
65
|
+
*/
|
|
66
|
+
type iNodeProvider<T> = iNodeValueProvider<T> | iNodeFactoryProvider<T> | iNodeClassProvider<T> | iNodeAliasProvider<T>;
|
|
67
|
+
/**
|
|
68
|
+
* Union type of all values that can be provided to a container.
|
|
69
|
+
* @template T - The type of value being provided
|
|
70
|
+
*/
|
|
71
|
+
type Provider<T = unknown> = NodeBase<T> | iNodeProvider<T> | Ctor<T> | Provider<unknown>[];
|
|
72
|
+
|
|
1
73
|
/**
|
|
2
74
|
* Base class for dependency injection tokens.
|
|
3
75
|
* This class should not be instantiated directly. Use {@link NodeToken} or {@link MultiNodeToken} instead.
|
|
@@ -78,76 +150,4 @@ declare function isNodeBase<T>(specimen: unknown): specimen is NodeToken<T> | Mu
|
|
|
78
150
|
*/
|
|
79
151
|
declare function extractToken<T>(provider: Token<T>, isAlias?: boolean): NodeToken<T> | MultiNodeToken<T>;
|
|
80
152
|
|
|
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 };
|
|
153
|
+
export { type Ctor as C, MultiNodeToken as M, NodeToken as N, type Provider as P, type Token as T, NodeBase 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 };
|