react-obsidian 2.20.1 → 2.21.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/babel.config.legacy.js +13 -0
- package/dist/src/decorators/Graph.d.ts +2 -2
- package/dist/src/decorators/Graph.d.ts.map +1 -1
- package/dist/src/decorators/Graph.js +3 -3
- package/dist/src/decorators/Graph.js.map +1 -1
- package/dist/src/decorators/inject/Inject.d.ts +1 -1
- package/dist/src/decorators/inject/Inject.d.ts.map +1 -1
- package/dist/src/decorators/inject/Inject.js +7 -7
- package/dist/src/decorators/inject/Inject.js.map +1 -1
- package/dist/src/decorators/inject/inject.legacy.d.ts +2 -0
- package/dist/src/decorators/inject/inject.legacy.d.ts.map +1 -0
- package/dist/src/decorators/inject/inject.legacy.js +12 -0
- package/dist/src/decorators/inject/inject.legacy.js.map +1 -0
- package/dist/src/decorators/inject/inject.modern.d.ts +5 -0
- package/dist/src/decorators/inject/inject.modern.d.ts.map +1 -0
- package/dist/src/decorators/inject/{LateInject.js → inject.modern.js} +6 -6
- package/dist/src/decorators/inject/inject.modern.js.map +1 -0
- package/dist/src/decorators/injectable/Injectable.d.ts.map +1 -0
- package/dist/src/decorators/injectable/Injectable.js.map +1 -0
- package/dist/src/decorators/lateInject/LateInject.d.ts.map +1 -0
- package/dist/src/decorators/lateInject/LateInject.js +14 -0
- package/dist/src/decorators/lateInject/LateInject.js.map +1 -0
- package/dist/src/decorators/lateInject/lateInject.legacy.d.ts +2 -0
- package/dist/src/decorators/lateInject/lateInject.legacy.d.ts.map +1 -0
- package/dist/src/decorators/lateInject/lateInject.legacy.js +12 -0
- package/dist/src/decorators/lateInject/lateInject.legacy.js.map +1 -0
- package/dist/src/decorators/lateInject/lateInject.modern.d.ts +5 -0
- package/dist/src/decorators/lateInject/lateInject.modern.d.ts.map +1 -0
- package/dist/src/decorators/lateInject/lateInject.modern.js +14 -0
- package/dist/src/decorators/lateInject/lateInject.modern.js.map +1 -0
- package/dist/src/decorators/provides/Provides.d.ts +1 -2
- package/dist/src/decorators/provides/Provides.d.ts.map +1 -1
- package/dist/src/decorators/provides/Provides.js +7 -8
- package/dist/src/decorators/provides/Provides.js.map +1 -1
- package/dist/src/decorators/provides/provides.legacy.d.ts +3 -0
- package/dist/src/decorators/provides/provides.legacy.d.ts.map +1 -0
- package/dist/src/decorators/provides/provides.legacy.js +13 -0
- package/dist/src/decorators/provides/provides.legacy.js.map +1 -0
- package/dist/src/decorators/provides/provides.modern.d.ts +2 -0
- package/dist/src/decorators/provides/provides.modern.d.ts.map +1 -0
- package/dist/src/decorators/provides/provides.modern.js +34 -0
- package/dist/src/decorators/provides/provides.modern.js.map +1 -0
- package/dist/src/decorators/singleton/Singleton.d.ts +2 -0
- package/dist/src/decorators/singleton/Singleton.d.ts.map +1 -0
- package/dist/src/decorators/singleton/Singleton.js +14 -0
- package/dist/src/decorators/singleton/Singleton.js.map +1 -0
- package/dist/src/decorators/singleton/singleton.legacy.d.ts +4 -0
- package/dist/src/decorators/singleton/singleton.legacy.d.ts.map +1 -0
- package/dist/src/decorators/singleton/singleton.legacy.js +10 -0
- package/dist/src/decorators/singleton/singleton.legacy.js.map +1 -0
- package/dist/src/decorators/singleton/singleton.modern.d.ts +2 -0
- package/dist/src/decorators/singleton/singleton.modern.d.ts.map +1 -0
- package/dist/src/decorators/singleton/singleton.modern.js +9 -0
- package/dist/src/decorators/singleton/singleton.modern.js.map +1 -0
- package/dist/src/index.d.ts +6 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -6
- package/dist/src/index.js.map +1 -1
- package/dist/src/utils/decorators.d.ts +2 -0
- package/dist/src/utils/decorators.d.ts.map +1 -0
- package/dist/src/utils/decorators.js +7 -0
- package/dist/src/utils/decorators.js.map +1 -0
- package/dist/test/fixtures/CircularDependencyFromSubgraph.js +66 -21
- package/dist/test/fixtures/CircularDependencyFromSubgraph.js.map +1 -1
- package/dist/test/fixtures/CircularDependencyGraph.js +66 -21
- package/dist/test/fixtures/CircularDependencyGraph.js.map +1 -1
- package/dist/test/fixtures/CircularDependencyGraph2.js +78 -39
- package/dist/test/fixtures/CircularDependencyGraph2.js.map +1 -1
- package/dist/test/fixtures/GraphWithMultipleDependencies.js +84 -48
- package/dist/test/fixtures/GraphWithMultipleDependencies.js.map +1 -1
- package/dist/test/fixtures/GraphWithOnBind.js +69 -24
- package/dist/test/fixtures/GraphWithOnBind.js.map +1 -1
- package/dist/test/fixtures/LifecycleBoundGraph.js +79 -41
- package/dist/test/fixtures/LifecycleBoundGraph.js.map +1 -1
- package/dist/test/fixtures/LifecycleBoundWithLifecycleBoundSubgraph.js +66 -22
- package/dist/test/fixtures/LifecycleBoundWithLifecycleBoundSubgraph.js.map +1 -1
- package/dist/test/fixtures/MainGraph.js +72 -31
- package/dist/test/fixtures/MainGraph.js.map +1 -1
- package/dist/test/fixtures/ScopedLifecycleBoundGraph.js +56 -11
- package/dist/test/fixtures/ScopedLifecycleBoundGraph.js.map +1 -1
- package/dist/test/fixtures/SingletonGraph.js +67 -27
- package/dist/test/fixtures/SingletonGraph.js.map +1 -1
- package/dist/test/fixtures/Subgraph.js +84 -48
- package/dist/test/fixtures/Subgraph.js.map +1 -1
- package/dist/test/fixtures/SubgraphWithCircularDependency.js +72 -31
- package/dist/test/fixtures/SubgraphWithCircularDependency.js.map +1 -1
- package/dist/test/fixtures/ThrowingMainGraph.js +66 -21
- package/dist/test/fixtures/ThrowingMainGraph.js.map +1 -1
- package/dist/test/fixtures/UniqueNumberGraph.js +73 -37
- package/dist/test/fixtures/UniqueNumberGraph.js.map +1 -1
- package/jest.config.legacy.js +26 -0
- package/package.json +21 -17
- package/src/decorators/Graph.ts +5 -5
- package/src/decorators/inject/Inject.ts +7 -8
- package/src/decorators/inject/inject.legacy.ts +11 -0
- package/src/decorators/inject/inject.modern.ts +12 -0
- package/src/decorators/lateInject/LateInject.ts +11 -0
- package/src/decorators/lateInject/lateInject.legacy.ts +11 -0
- package/src/decorators/lateInject/lateInject.modern.ts +12 -0
- package/src/decorators/provides/Provides.ts +8 -7
- package/src/decorators/provides/provides.legacy.ts +13 -0
- package/src/decorators/provides/provides.modern.ts +36 -0
- package/src/decorators/singleton/Singleton.ts +11 -0
- package/src/decorators/singleton/singleton.legacy.ts +13 -0
- package/src/decorators/singleton/singleton.modern.ts +8 -0
- package/src/index.ts +6 -6
- package/src/utils/decorators.ts +3 -0
- package/wallaby.legacy.js +9 -0
- package/dist/src/decorators/Singleton.d.ts +0 -4
- package/dist/src/decorators/Singleton.d.ts.map +0 -1
- package/dist/src/decorators/Singleton.js +0 -12
- package/dist/src/decorators/Singleton.js.map +0 -1
- package/dist/src/decorators/inject/Injectable.d.ts.map +0 -1
- package/dist/src/decorators/inject/Injectable.js.map +0 -1
- package/dist/src/decorators/inject/LateInject.d.ts.map +0 -1
- package/dist/src/decorators/inject/LateInject.js.map +0 -1
- package/src/decorators/Singleton.ts +0 -15
- package/src/decorators/inject/LateInject.ts +0 -8
- /package/dist/src/decorators/{inject → injectable}/Injectable.d.ts +0 -0
- /package/dist/src/decorators/{inject → injectable}/Injectable.js +0 -0
- /package/dist/src/decorators/{inject → lateInject}/LateInject.d.ts +0 -0
- /package/src/decorators/{inject → injectable}/Injectable.ts +0 -0
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { shouldUseModernDecorator } from '../../utils/decorators';
|
|
2
|
+
import { legacyDecorator } from './inject.legacy';
|
|
3
|
+
import { modernDecorator } from './inject.modern';
|
|
2
4
|
|
|
3
5
|
export function inject(name?: string) {
|
|
4
|
-
return (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
) => {
|
|
9
|
-
const metadata = new InjectionMetadata();
|
|
10
|
-
metadata.savePropertyMetadata(target.constructor, name!);
|
|
6
|
+
return (...args: any[]) => {
|
|
7
|
+
return shouldUseModernDecorator(args) ?
|
|
8
|
+
modernDecorator(name, args[0], args[1]) :
|
|
9
|
+
legacyDecorator(name, args[0], args[1], args[2]);
|
|
11
10
|
};
|
|
12
11
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import InjectionMetadata from '../../injectors/class/InjectionMetadata';
|
|
2
|
+
|
|
3
|
+
export function legacyDecorator(
|
|
4
|
+
name: string | undefined,
|
|
5
|
+
target: Object | any,
|
|
6
|
+
propertyKey: string,
|
|
7
|
+
_indexOrPropertyDescriptor?: number | PropertyDescriptor,
|
|
8
|
+
) {
|
|
9
|
+
const metadata = new InjectionMetadata();
|
|
10
|
+
metadata.savePropertyMetadata(target.constructor, name ?? propertyKey);
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import InjectionMetadata from '../../injectors/class/InjectionMetadata';
|
|
2
|
+
|
|
3
|
+
export function modernDecorator<This, Args extends any[], Return>(
|
|
4
|
+
name: string | undefined,
|
|
5
|
+
_target: (this: This, ...args: Args) => Return,
|
|
6
|
+
context: { name: string | symbol; addInitializer: (callback: () => void) => void },
|
|
7
|
+
) {
|
|
8
|
+
context.addInitializer(function initializer(this: any) {
|
|
9
|
+
const metadata = new InjectionMetadata();
|
|
10
|
+
metadata.savePropertyMetadata(this.constructor, name!);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { shouldUseModernDecorator } from '../../utils/decorators';
|
|
2
|
+
import { legacyDecorator } from './lateInject.legacy';
|
|
3
|
+
import { modernDecorator } from './lateInject.modern';
|
|
4
|
+
|
|
5
|
+
export function lateInject(name?: string): any {
|
|
6
|
+
return (...args: any[]) => {
|
|
7
|
+
return shouldUseModernDecorator(args) ?
|
|
8
|
+
modernDecorator(name, args[0], args[1]) :
|
|
9
|
+
legacyDecorator(name, args[0], args[1], args[2]);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import InjectionMetadata from '../../injectors/class/InjectionMetadata';
|
|
2
|
+
|
|
3
|
+
export function legacyDecorator(
|
|
4
|
+
name: string | undefined,
|
|
5
|
+
target: Object | any,
|
|
6
|
+
propertyKey: string,
|
|
7
|
+
_indexOrPropertyDescriptor?: number | PropertyDescriptor,
|
|
8
|
+
) {
|
|
9
|
+
const metadata = new InjectionMetadata();
|
|
10
|
+
metadata.saveLatePropertyMetadata(target.constructor, name ?? propertyKey);
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import InjectionMetadata from '../../injectors/class/InjectionMetadata';
|
|
2
|
+
|
|
3
|
+
export function modernDecorator<This, Args extends any[], Return>(
|
|
4
|
+
name: string | undefined,
|
|
5
|
+
_target: (this: This, ...args: Args) => Return,
|
|
6
|
+
context: { name: string | symbol; addInitializer: (callback: () => void) => void },
|
|
7
|
+
) {
|
|
8
|
+
context.addInitializer(function initializer(this: any) {
|
|
9
|
+
const metadata = new InjectionMetadata();
|
|
10
|
+
metadata.saveLatePropertyMetadata(this.constructor, name ?? String(context.name));
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { shouldUseModernDecorator } from '../../utils/decorators';
|
|
2
|
+
import { legacyDecorator } from './provides.legacy';
|
|
3
|
+
import { modernDecorator } from './provides.modern';
|
|
4
4
|
|
|
5
5
|
interface ProvidesParams {
|
|
6
6
|
name: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export function provides({ name }: Partial<ProvidesParams> = {}) {
|
|
10
|
-
return (
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
export function provides({ name }: Partial<ProvidesParams> = {}): any {
|
|
10
|
+
return (...args: any[]) => {
|
|
11
|
+
return shouldUseModernDecorator(args)
|
|
12
|
+
? modernDecorator(name, args[0], args[1])
|
|
13
|
+
: legacyDecorator(name, args[0], args[1], args[2]);
|
|
13
14
|
};
|
|
14
15
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Graph } from '../../graph/Graph';
|
|
2
|
+
import providedPropertiesStore from '../../ProvidedPropertiesStore';
|
|
3
|
+
import { memoizeDescriptor } from './MemoizeDescriptor';
|
|
4
|
+
|
|
5
|
+
export function legacyDecorator(
|
|
6
|
+
name: string | undefined,
|
|
7
|
+
graph: Graph,
|
|
8
|
+
propertyKey: string,
|
|
9
|
+
descriptor: PropertyDescriptor,
|
|
10
|
+
) {
|
|
11
|
+
providedPropertiesStore.set(graph, propertyKey, name!);
|
|
12
|
+
return memoizeDescriptor(propertyKey, descriptor);
|
|
13
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Graph } from '../../graph/Graph';
|
|
2
|
+
import providedPropertiesStore from '../../ProvidedPropertiesStore';
|
|
3
|
+
import { Reflect } from '../../utils/reflect';
|
|
4
|
+
|
|
5
|
+
export function modernDecorator<This, Args extends any[], Return>(
|
|
6
|
+
name: string | undefined,
|
|
7
|
+
target: (this: This, ...args: Args) => Return,
|
|
8
|
+
context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return>,
|
|
9
|
+
) {
|
|
10
|
+
context.addInitializer(function initializer(this: This) {
|
|
11
|
+
const mangledProperty = String(context.name);
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
this[mangledProperty] = this[mangledProperty].bind(this);
|
|
14
|
+
providedPropertiesStore.set(this as Graph, mangledProperty, name!);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
function getMemoizationTarget(zis: This) {
|
|
18
|
+
if (Reflect.getMetadata('isSingleton', target)) {
|
|
19
|
+
return (zis as any).constructor;
|
|
20
|
+
}
|
|
21
|
+
return zis;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function replacementMethod(this: This, ...args: Args): Return {
|
|
25
|
+
const memoizationTarget = getMemoizationTarget(this);
|
|
26
|
+
const memoizedResult = Reflect.getMetadata(`memoized${name!}`, memoizationTarget);
|
|
27
|
+
if (memoizedResult === undefined) {
|
|
28
|
+
const result = target.call(this, ...args);
|
|
29
|
+
Reflect.defineMetadata(`memoized${name!}`, result, memoizationTarget);
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
return memoizedResult;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return replacementMethod;
|
|
36
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { modernDecorator } from './singleton.modern';
|
|
2
|
+
import { legacyDecorator } from './singleton.legacy';
|
|
3
|
+
import { shouldUseModernDecorator } from '../../utils/decorators';
|
|
4
|
+
|
|
5
|
+
export function singleton() {
|
|
6
|
+
return (...args: any[]) => {
|
|
7
|
+
return shouldUseModernDecorator(args) ?
|
|
8
|
+
modernDecorator(args[0]) :
|
|
9
|
+
legacyDecorator(args[0], args[1], args[2]);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Constructable } from '../../types';
|
|
2
|
+
import { ObjectGraph } from '../../graph/ObjectGraph';
|
|
3
|
+
import {Reflect} from '../../utils/reflect';
|
|
4
|
+
|
|
5
|
+
export function legacyDecorator(
|
|
6
|
+
constructorOrGraph: Constructable<ObjectGraph> | ObjectGraph,
|
|
7
|
+
_property?: string,
|
|
8
|
+
descriptor?: PropertyDescriptor,
|
|
9
|
+
): any {
|
|
10
|
+
const target = descriptor || constructorOrGraph;
|
|
11
|
+
Reflect.defineMetadata('isSingleton', true, target);
|
|
12
|
+
return target;
|
|
13
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { graph } from './decorators/Graph';
|
|
2
2
|
import { inject } from './decorators/inject/Inject';
|
|
3
|
-
import { injectable } from './decorators/
|
|
4
|
-
import { lateInject } from './decorators/
|
|
3
|
+
import { injectable } from './decorators/injectable/Injectable';
|
|
4
|
+
import { lateInject } from './decorators/lateInject/LateInject';
|
|
5
5
|
import { lifecycleBound } from './decorators/LifecycleBound';
|
|
6
6
|
import { provides } from './decorators/provides/Provides';
|
|
7
|
-
import { singleton } from './decorators/Singleton';
|
|
7
|
+
import { singleton } from './decorators/singleton/Singleton';
|
|
8
8
|
import _Obsidian from './Obsidian';
|
|
9
9
|
|
|
10
10
|
export * from './types';
|
|
11
11
|
|
|
12
12
|
export { graph } from './decorators/Graph';
|
|
13
|
-
export { singleton } from './decorators/Singleton';
|
|
13
|
+
export { singleton } from './decorators/singleton/Singleton';
|
|
14
14
|
export { ObjectGraph } from './graph/ObjectGraph';
|
|
15
15
|
export { Graph as IGraph } from './graph/Graph';
|
|
16
16
|
export { provides } from './decorators/provides/Provides';
|
|
17
|
-
export { injectable } from './decorators/
|
|
17
|
+
export { injectable } from './decorators/injectable/Injectable';
|
|
18
18
|
export { inject } from './decorators/inject/Inject';
|
|
19
|
-
export { lateInject } from './decorators/
|
|
19
|
+
export { lateInject } from './decorators/lateInject/LateInject';
|
|
20
20
|
export { lifecycleBound } from './decorators/LifecycleBound';
|
|
21
21
|
export { GraphMiddleware } from './graph/registry/GraphMiddleware';
|
|
22
22
|
export { GraphResolveChain as ResolveChain } from './graph/registry/GraphResolveChain';
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Constructable } from '../types';
|
|
2
|
-
import { ObjectGraph } from '../graph/ObjectGraph';
|
|
3
|
-
export declare function singleton(): (constructorOrGraph: Constructable<ObjectGraph> | ObjectGraph, _property?: string, descriptor?: PropertyDescriptor) => any;
|
|
4
|
-
//# sourceMappingURL=Singleton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Singleton.d.ts","sourceRoot":"","sources":["../../../src/decorators/Singleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,wBAAgB,SAAS,yBAED,aAAa,CAAC,WAAW,CAAC,GAAG,WAAW,cAChD,MAAM,eACL,kBAAkB,KAC9B,GAAG,CAKP"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.singleton = singleton;
|
|
4
|
-
const reflect_1 = require("../utils/reflect");
|
|
5
|
-
function singleton() {
|
|
6
|
-
return (constructorOrGraph, _property, descriptor) => {
|
|
7
|
-
const target = descriptor || constructorOrGraph;
|
|
8
|
-
reflect_1.Reflect.defineMetadata('isSingleton', true, target);
|
|
9
|
-
return target;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=Singleton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Singleton.js","sourceRoot":"","sources":["../../../src/decorators/Singleton.ts"],"names":[],"mappings":";;AAIA,8BAUC;AAZD,8CAAyC;AAEzC,SAAgB,SAAS;IACvB,OAAO,CACL,kBAA4D,EAC5D,SAAkB,EAClB,UAA+B,EAC1B,EAAE;QACP,MAAM,MAAM,GAAG,UAAU,IAAI,kBAAkB,CAAC;QAChD,iBAAO,CAAC,cAAc,CAAC,aAAa,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACpD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Injectable.d.ts","sourceRoot":"","sources":["../../../../src/decorators/inject/Injectable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,GAAG,CAEzE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Injectable.js","sourceRoot":"","sources":["../../../../src/decorators/inject/Injectable.ts"],"names":[],"mappings":";;;;;AAKA,gCAEC;AALD,uFAA+D;AAC/D,wFAAgE;AAEhE,SAAgB,UAAU,CAAC,UAAyC;IAClE,OAAO,IAAI,uBAAa,CAAC,uBAAa,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LateInject.d.ts","sourceRoot":"","sources":["../../../../src/decorators/inject/LateInject.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG,CAK7C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LateInject.js","sourceRoot":"","sources":["../../../../src/decorators/inject/LateInject.ts"],"names":[],"mappings":";;;;;AAEA,gCAKC;AAPD,gGAAwE;AAExE,SAAgB,UAAU,CAAC,IAAa;IACtC,OAAO,CAAC,MAAc,EAAE,EAAE;QACxB,MAAM,QAAQ,GAAG,IAAI,2BAAiB,EAAE,CAAC;QACzC,QAAQ,CAAC,wBAAwB,CAAC,MAAM,CAAC,WAAW,EAAE,IAAK,CAAC,CAAC;IAC/D,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Constructable } from '../types';
|
|
2
|
-
import { ObjectGraph } from '../graph/ObjectGraph';
|
|
3
|
-
import {Reflect} from '../utils/reflect';
|
|
4
|
-
|
|
5
|
-
export function singleton() {
|
|
6
|
-
return (
|
|
7
|
-
constructorOrGraph: Constructable<ObjectGraph> | ObjectGraph,
|
|
8
|
-
_property?: string,
|
|
9
|
-
descriptor?: PropertyDescriptor,
|
|
10
|
-
): any => {
|
|
11
|
-
const target = descriptor || constructorOrGraph;
|
|
12
|
-
Reflect.defineMetadata('isSingleton', true, target);
|
|
13
|
-
return target;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import InjectionMetadata from '../../injectors/class/InjectionMetadata';
|
|
2
|
-
|
|
3
|
-
export function lateInject(name?: string): any {
|
|
4
|
-
return (target: object) => {
|
|
5
|
-
const metadata = new InjectionMetadata();
|
|
6
|
-
metadata.saveLatePropertyMetadata(target.constructor, name!);
|
|
7
|
-
};
|
|
8
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|