@lppedd/di-wise-neo 0.12.0 → 0.13.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/README.md +1 -1
- package/dist/cjs/index.d.ts +5 -21
- package/dist/cjs/index.js +9 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.d.mts +5 -21
- package/dist/es/index.mjs +9 -17
- package/dist/es/index.mjs.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[](https://github.com/lppedd/di-wise-neo/blob/main/CHANGELOG.md#0100)
|
|
9
9
|
[](https://github.com/lppedd/di-wise-neo/actions/workflows/test.yml)
|
|
10
10
|
[](https://app.codecov.io/gh/lppedd/di-wise-neo/tree/main/src)
|
|
11
|
-
[](https://github.com/lppedd/di-wise-neo/blob/main/LICENSE)
|
|
12
12
|
|
|
13
13
|
</div>
|
|
14
14
|
<img align="center" src="./.github/images/neo-wall.jpg" alt="di-wise-neo" style="border: 3px solid black; border-radius: 15px;" />
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,35 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type API.
|
|
3
3
|
*/
|
|
4
|
-
interface Type<
|
|
4
|
+
interface Type<T> {
|
|
5
5
|
/**
|
|
6
6
|
* The name of the type.
|
|
7
7
|
*/
|
|
8
8
|
readonly name: string;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Ensures that different `Type<T>` types are not structurally compatible.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* ```ts
|
|
14
|
-
* const A = createType<A>("A");
|
|
15
|
-
* const B = createType<B>("B");
|
|
16
|
-
*
|
|
17
|
-
* A.inter("I", B); // => Type<A & B>
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
inter<B>(typeName: string, B: Type<B>): Type<A & B>;
|
|
21
|
-
/**
|
|
22
|
-
* Creates a union type from another type.
|
|
12
|
+
* This property is never used at runtime.
|
|
23
13
|
*
|
|
24
|
-
* @
|
|
25
|
-
* ```ts
|
|
26
|
-
* const A = createType<A>("A");
|
|
27
|
-
* const B = createType<B>("B");
|
|
28
|
-
*
|
|
29
|
-
* A.union("U", B); // => Type<A | B>
|
|
30
|
-
* ```
|
|
14
|
+
* @private
|
|
31
15
|
*/
|
|
32
|
-
|
|
16
|
+
readonly __type?: T;
|
|
33
17
|
}
|
|
34
18
|
/**
|
|
35
19
|
* Constructor type.
|
package/dist/cjs/index.js
CHANGED
|
@@ -349,15 +349,11 @@ const Scope = {
|
|
|
349
349
|
*
|
|
350
350
|
* @__NO_SIDE_EFFECTS__
|
|
351
351
|
*/ function createType(typeName) {
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
toString () {
|
|
357
|
-
return type.name;
|
|
358
|
-
}
|
|
352
|
+
const name = `Type<${typeName}>`;
|
|
353
|
+
return {
|
|
354
|
+
name: name,
|
|
355
|
+
toString: ()=>name
|
|
359
356
|
};
|
|
360
|
-
return type;
|
|
361
357
|
}
|
|
362
358
|
// @internal
|
|
363
359
|
function isConstructor(token) {
|
|
@@ -509,9 +505,8 @@ function isDisposable(value) {
|
|
|
509
505
|
this.myDisposed = false;
|
|
510
506
|
this.myParent = parent;
|
|
511
507
|
this.myOptions = {
|
|
512
|
-
autoRegister: false,
|
|
513
|
-
defaultScope: Scope.Transient
|
|
514
|
-
...options
|
|
508
|
+
autoRegister: options?.autoRegister ?? false,
|
|
509
|
+
defaultScope: options?.defaultScope ?? Scope.Transient
|
|
515
510
|
};
|
|
516
511
|
this.myTokenRegistry = new TokenRegistry(this.myParent?.myTokenRegistry);
|
|
517
512
|
}
|
|
@@ -532,8 +527,8 @@ function isDisposable(value) {
|
|
|
532
527
|
createChild(options) {
|
|
533
528
|
this.checkDisposed();
|
|
534
529
|
const container = new ContainerImpl(this, {
|
|
535
|
-
|
|
536
|
-
|
|
530
|
+
autoRegister: options?.autoRegister ?? this.myOptions.autoRegister,
|
|
531
|
+
defaultScope: options?.defaultScope ?? this.myOptions.defaultScope
|
|
537
532
|
});
|
|
538
533
|
this.myChildren.add(container);
|
|
539
534
|
return container;
|
|
@@ -945,10 +940,7 @@ function isDisposable(value) {
|
|
|
945
940
|
|
|
946
941
|
/**
|
|
947
942
|
* Creates a new container.
|
|
948
|
-
*/ function createContainer(options
|
|
949
|
-
autoRegister: false,
|
|
950
|
-
defaultScope: Scope.Transient
|
|
951
|
-
}) {
|
|
943
|
+
*/ function createContainer(options) {
|
|
952
944
|
return new ContainerImpl(undefined, options);
|
|
953
945
|
}
|
|
954
946
|
|