react-obsidian 2.16.1 → 2.17.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/dist/src/decorators/Graph.d.ts +1 -1
- package/dist/src/decorators/Graph.js +2 -2
- package/dist/src/decorators/LifecycleBound.d.ts +1 -1
- package/dist/src/decorators/LifecycleBound.js +2 -2
- package/dist/src/decorators/Singleton.d.ts +1 -1
- package/dist/src/decorators/Singleton.js +3 -3
- package/dist/src/decorators/Singleton.js.map +1 -1
- package/dist/src/decorators/inject/Inject.d.ts +1 -1
- package/dist/src/decorators/inject/Inject.js +2 -2
- package/dist/src/decorators/inject/Injectable.d.ts +1 -1
- package/dist/src/decorators/inject/Injectable.js +2 -2
- package/dist/src/decorators/inject/LateInject.d.ts +1 -1
- package/dist/src/decorators/inject/LateInject.js +2 -2
- package/dist/src/decorators/provides/Provides.d.ts +1 -1
- package/dist/src/decorators/provides/Provides.d.ts.map +1 -1
- package/dist/src/decorators/provides/Provides.js +3 -3
- package/dist/src/decorators/provides/Provides.js.map +1 -1
- package/dist/src/index.d.ts +42 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +50 -15
- package/dist/src/index.js.map +1 -1
- package/dist/test/fixtures/LifecycleBoundGraph.d.ts.map +1 -1
- package/dist/test/fixtures/LifecycleBoundGraph.js +4 -5
- package/dist/test/fixtures/LifecycleBoundGraph.js.map +1 -1
- package/dist/test/fixtures/LifecycleBoundWithLifecycleBoundSubgraph.d.ts.map +1 -1
- package/dist/test/fixtures/LifecycleBoundWithLifecycleBoundSubgraph.js +3 -4
- package/dist/test/fixtures/LifecycleBoundWithLifecycleBoundSubgraph.js.map +1 -1
- package/dist/test/fixtures/ScopedLifecycleBoundGraph.d.ts.map +1 -1
- package/dist/test/fixtures/ScopedLifecycleBoundGraph.js +2 -3
- package/dist/test/fixtures/ScopedLifecycleBoundGraph.js.map +1 -1
- package/dist/test/fixtures/SingletonGraph.js +3 -3
- package/dist/transformers/babel-plugin-obsidian/index.d.ts.map +1 -1
- package/dist/transformers/babel-plugin-obsidian/index.js +5 -0
- package/dist/transformers/babel-plugin-obsidian/index.js.map +1 -1
- package/package.json +1 -1
- package/src/decorators/Graph.ts +1 -1
- package/src/decorators/LifecycleBound.ts +1 -1
- package/src/decorators/Singleton.ts +3 -3
- package/src/decorators/inject/Inject.ts +1 -1
- package/src/decorators/inject/Injectable.ts +1 -1
- package/src/decorators/inject/LateInject.ts +1 -1
- package/src/decorators/provides/Provides.ts +2 -2
- package/src/index.ts +44 -7
- package/transformers/babel-plugin-obsidian/index.ts +5 -1
|
@@ -3,6 +3,6 @@ import { ObjectGraph } from '../graph/ObjectGraph';
|
|
|
3
3
|
interface GraphParams {
|
|
4
4
|
subgraphs: Constructable<ObjectGraph>[];
|
|
5
5
|
}
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function graph({ subgraphs }?: Partial<GraphParams>): (constructor: any) => any;
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=Graph.d.ts.map
|
|
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.graph = graph;
|
|
7
7
|
const GraphRegistry_1 = __importDefault(require("../graph/registry/GraphRegistry"));
|
|
8
|
-
function
|
|
8
|
+
function graph({ subgraphs = [] } = {}) {
|
|
9
9
|
return (constructor) => {
|
|
10
10
|
GraphRegistry_1.default.register(constructor, subgraphs);
|
|
11
11
|
return constructor;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type Options = {
|
|
2
2
|
scope?: 'component' | 'feature' | (string & {});
|
|
3
3
|
};
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function lifecycleBound(options?: Options): (constructor: any) => any;
|
|
5
5
|
export {};
|
|
6
6
|
//# sourceMappingURL=LifecycleBound.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.lifecycleBound = lifecycleBound;
|
|
4
4
|
const reflect_1 = require("../utils/reflect");
|
|
5
|
-
function
|
|
5
|
+
function lifecycleBound(options) {
|
|
6
6
|
return (constructor) => {
|
|
7
7
|
var _a;
|
|
8
8
|
reflect_1.Reflect.defineMetadata('isLifecycleBound', true, constructor);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Constructable } from '../types';
|
|
2
2
|
import { ObjectGraph } from '../graph/ObjectGraph';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function singleton(): (constructorOrGraph: Constructable<ObjectGraph> | ObjectGraph, _property?: string, descriptor?: PropertyDescriptor) => any;
|
|
4
4
|
//# sourceMappingURL=Singleton.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.singleton = singleton;
|
|
4
4
|
const reflect_1 = require("../utils/reflect");
|
|
5
|
-
function
|
|
6
|
-
return
|
|
5
|
+
function singleton() {
|
|
6
|
+
return (constructorOrGraph, _property, descriptor) => {
|
|
7
7
|
const target = descriptor || constructorOrGraph;
|
|
8
8
|
reflect_1.Reflect.defineMetadata('isSingleton', true, target);
|
|
9
9
|
return target;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Singleton.js","sourceRoot":"","sources":["../../../src/decorators/Singleton.ts"],"names":[],"mappings":";;AAIA,8BAUC;AAZD,8CAAyC;AAEzC,SAAgB,SAAS;IACvB,OAAO,
|
|
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,2 +1,2 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function inject(name?: string): (target: Object | any, _propertyKey?: string, indexOrPropertyDescriptor?: number | PropertyDescriptor) => void;
|
|
2
2
|
//# sourceMappingURL=Inject.d.ts.map
|
|
@@ -3,10 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.inject = inject;
|
|
7
7
|
const isNumber_1 = require("../../utils/isNumber");
|
|
8
8
|
const InjectionMetadata_1 = __importDefault(require("../../injectors/class/InjectionMetadata"));
|
|
9
|
-
function
|
|
9
|
+
function inject(name) {
|
|
10
10
|
return (target, _propertyKey, indexOrPropertyDescriptor) => {
|
|
11
11
|
const metadata = new InjectionMetadata_1.default();
|
|
12
12
|
if ((0, isNumber_1.isNumber)(indexOrPropertyDescriptor)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Constructable } from '../../types';
|
|
2
2
|
import { Graph } from '../../graph/Graph';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function injectable(keyOrGraph: string | Constructable<Graph>): any;
|
|
4
4
|
//# sourceMappingURL=Injectable.d.ts.map
|
|
@@ -3,10 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.injectable = injectable;
|
|
7
7
|
const GraphRegistry_1 = __importDefault(require("../../graph/registry/GraphRegistry"));
|
|
8
8
|
const ClassInjector_1 = __importDefault(require("../../injectors/class/ClassInjector"));
|
|
9
|
-
function
|
|
9
|
+
function injectable(keyOrGraph) {
|
|
10
10
|
return new ClassInjector_1.default(GraphRegistry_1.default).inject(keyOrGraph);
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=Injectable.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function lateInject(name?: string): any;
|
|
2
2
|
//# sourceMappingURL=LateInject.d.ts.map
|
|
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.lateInject = lateInject;
|
|
7
7
|
const InjectionMetadata_1 = __importDefault(require("../../injectors/class/InjectionMetadata"));
|
|
8
|
-
function
|
|
8
|
+
function lateInject(name) {
|
|
9
9
|
return (target) => {
|
|
10
10
|
const metadata = new InjectionMetadata_1.default();
|
|
11
11
|
metadata.saveLatePropertyMetadata(target.constructor, name);
|
|
@@ -2,6 +2,6 @@ import { Graph } from '../../graph/Graph';
|
|
|
2
2
|
interface ProvidesParams {
|
|
3
3
|
name: string;
|
|
4
4
|
}
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function provides({ name }?: Partial<ProvidesParams>): (graph: Graph, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=Provides.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provides.d.ts","sourceRoot":"","sources":["../../../../src/decorators/provides/Provides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,GAAE,OAAO,CAAC,cAAc,CAAM,
|
|
1
|
+
{"version":3,"file":"Provides.d.ts","sourceRoot":"","sources":["../../../../src/decorators/provides/Provides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,GAAE,OAAO,CAAC,cAAc,CAAM,WAC9C,KAAK,eAAe,MAAM,cAAc,kBAAkB,wBAI1E"}
|
|
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.provides = provides;
|
|
7
7
|
const ProvidedPropertiesStore_1 = __importDefault(require("../../ProvidedPropertiesStore"));
|
|
8
8
|
const MemoizeDescriptor_1 = require("./MemoizeDescriptor");
|
|
9
|
-
function
|
|
10
|
-
return
|
|
9
|
+
function provides({ name } = {}) {
|
|
10
|
+
return (graph, propertyKey, descriptor) => {
|
|
11
11
|
ProvidedPropertiesStore_1.default.set(graph, propertyKey, name);
|
|
12
12
|
return (0, MemoizeDescriptor_1.memoizeDescriptor)(propertyKey, descriptor);
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provides.js","sourceRoot":"","sources":["../../../../src/decorators/provides/Provides.ts"],"names":[],"mappings":";;;;;AAQA,4BAKC;AAZD,4FAAoE;AACpE,2DAAwD;AAMxD,SAAgB,QAAQ,CAAC,EAAE,IAAI,KAA8B,EAAE;IAC7D,OAAO,
|
|
1
|
+
{"version":3,"file":"Provides.js","sourceRoot":"","sources":["../../../../src/decorators/provides/Provides.ts"],"names":[],"mappings":";;;;;AAQA,4BAKC;AAZD,4FAAoE;AACpE,2DAAwD;AAMxD,SAAgB,QAAQ,CAAC,EAAE,IAAI,KAA8B,EAAE;IAC7D,OAAO,CAAC,KAAY,EAAE,WAAmB,EAAE,UAA8B,EAAE,EAAE;QAC3E,iCAAuB,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,IAAK,CAAC,CAAC;QACvD,OAAO,IAAA,qCAAiB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACpD,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,16 +1,51 @@
|
|
|
1
|
+
import { graph } from './decorators/Graph';
|
|
2
|
+
import { inject } from './decorators/inject/Inject';
|
|
3
|
+
import { injectable } from './decorators/inject/Injectable';
|
|
4
|
+
import { lateInject } from './decorators/inject/LateInject';
|
|
5
|
+
import { lifecycleBound } from './decorators/LifecycleBound';
|
|
6
|
+
import { provides } from './decorators/provides/Provides';
|
|
7
|
+
import { singleton } from './decorators/Singleton';
|
|
1
8
|
import _Obsidian from './Obsidian';
|
|
2
9
|
export * from './types';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
10
|
+
export { graph } from './decorators/Graph';
|
|
11
|
+
export { singleton } from './decorators/Singleton';
|
|
5
12
|
export { ObjectGraph } from './graph/ObjectGraph';
|
|
6
13
|
export { Graph as IGraph } from './graph/Graph';
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
14
|
+
export { provides } from './decorators/provides/Provides';
|
|
15
|
+
export { injectable } from './decorators/inject/Injectable';
|
|
16
|
+
export { inject } from './decorators/inject/Inject';
|
|
17
|
+
export { lateInject } from './decorators/inject/LateInject';
|
|
18
|
+
export { lifecycleBound } from './decorators/LifecycleBound';
|
|
12
19
|
export { GraphMiddleware } from './graph/registry/GraphMiddleware';
|
|
13
20
|
export { GraphResolveChain as ResolveChain } from './graph/registry/GraphResolveChain';
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming conventions. Please use `@graph` instead.
|
|
23
|
+
*/
|
|
24
|
+
export declare const Graph: typeof graph;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@singleton` instead.
|
|
27
|
+
*/
|
|
28
|
+
export declare const Singleton: typeof singleton;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@provides` instead.
|
|
31
|
+
*/
|
|
32
|
+
export declare const Provides: typeof provides;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@injectable` instead.
|
|
35
|
+
*/
|
|
36
|
+
export declare const Injectable: typeof injectable;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@inject` instead.
|
|
39
|
+
*/
|
|
40
|
+
export declare const Inject: typeof inject;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@lateInject` instead.
|
|
43
|
+
*/
|
|
44
|
+
export declare const LateInject: typeof lateInject;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@lifecycleBound` instead.
|
|
47
|
+
*/
|
|
48
|
+
export declare const LifecycleBound: typeof lifecycleBound;
|
|
14
49
|
export declare const Obsidian: _Obsidian;
|
|
15
50
|
export { injectComponent } from './injectors/components/InjectComponent';
|
|
16
51
|
export { injectHook, injectHookWithArguments } from './injectors/hooks/InjectHook';
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|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M,SAAS,kBAAY,CAAC;AACnC;;GAEG;AACH,eAAO,MAAM,QAAQ,iBAAW,CAAC;AACjC;;GAEG;AACH,eAAO,MAAM,UAAU,mBAAa,CAAC;AACrC;;GAEG;AACH,eAAO,MAAM,MAAM,eAAS,CAAC;AAC7B;;GAEG;AACH,eAAO,MAAM,UAAU,mBAAa,CAAC;AACrC;;GAEG;AACH,eAAO,MAAM,cAAc,uBAAiB,CAAC;AAG7C,eAAO,MAAM,QAAQ,WAAkB,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -17,27 +17,62 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.mockGraphs = exports.mockModel = exports.testKit = exports.Model = exports.MediatorObservable = exports.Observable = exports.useObservers = exports.useObserver = exports.injectHookWithArguments = exports.injectHook = exports.injectComponent = exports.Obsidian = exports.GraphMiddleware = exports.
|
|
20
|
+
exports.mockGraphs = exports.mockModel = exports.testKit = exports.Model = exports.MediatorObservable = exports.Observable = exports.useObservers = exports.useObserver = exports.injectHookWithArguments = exports.injectHook = exports.injectComponent = exports.Obsidian = exports.LifecycleBound = exports.LateInject = exports.Inject = exports.Injectable = exports.Provides = exports.Singleton = exports.Graph = exports.GraphMiddleware = exports.lifecycleBound = exports.lateInject = exports.inject = exports.injectable = exports.provides = exports.ObjectGraph = exports.singleton = exports.graph = void 0;
|
|
21
|
+
const Graph_1 = require("./decorators/Graph");
|
|
22
|
+
const Inject_1 = require("./decorators/inject/Inject");
|
|
23
|
+
const Injectable_1 = require("./decorators/inject/Injectable");
|
|
24
|
+
const LateInject_1 = require("./decorators/inject/LateInject");
|
|
25
|
+
const LifecycleBound_1 = require("./decorators/LifecycleBound");
|
|
26
|
+
const Provides_1 = require("./decorators/provides/Provides");
|
|
27
|
+
const Singleton_1 = require("./decorators/Singleton");
|
|
21
28
|
const Obsidian_1 = __importDefault(require("./Obsidian"));
|
|
22
29
|
__exportStar(require("./types"), exports);
|
|
23
|
-
var
|
|
24
|
-
Object.defineProperty(exports, "
|
|
25
|
-
var
|
|
26
|
-
Object.defineProperty(exports, "
|
|
30
|
+
var Graph_2 = require("./decorators/Graph");
|
|
31
|
+
Object.defineProperty(exports, "graph", { enumerable: true, get: function () { return Graph_2.graph; } });
|
|
32
|
+
var Singleton_2 = require("./decorators/Singleton");
|
|
33
|
+
Object.defineProperty(exports, "singleton", { enumerable: true, get: function () { return Singleton_2.singleton; } });
|
|
27
34
|
var ObjectGraph_1 = require("./graph/ObjectGraph");
|
|
28
35
|
Object.defineProperty(exports, "ObjectGraph", { enumerable: true, get: function () { return ObjectGraph_1.ObjectGraph; } });
|
|
29
|
-
var
|
|
30
|
-
Object.defineProperty(exports, "
|
|
31
|
-
var
|
|
32
|
-
Object.defineProperty(exports, "
|
|
33
|
-
var
|
|
34
|
-
Object.defineProperty(exports, "
|
|
35
|
-
var
|
|
36
|
-
Object.defineProperty(exports, "
|
|
37
|
-
var
|
|
38
|
-
Object.defineProperty(exports, "
|
|
36
|
+
var Provides_2 = require("./decorators/provides/Provides");
|
|
37
|
+
Object.defineProperty(exports, "provides", { enumerable: true, get: function () { return Provides_2.provides; } });
|
|
38
|
+
var Injectable_2 = require("./decorators/inject/Injectable");
|
|
39
|
+
Object.defineProperty(exports, "injectable", { enumerable: true, get: function () { return Injectable_2.injectable; } });
|
|
40
|
+
var Inject_2 = require("./decorators/inject/Inject");
|
|
41
|
+
Object.defineProperty(exports, "inject", { enumerable: true, get: function () { return Inject_2.inject; } });
|
|
42
|
+
var LateInject_2 = require("./decorators/inject/LateInject");
|
|
43
|
+
Object.defineProperty(exports, "lateInject", { enumerable: true, get: function () { return LateInject_2.lateInject; } });
|
|
44
|
+
var LifecycleBound_2 = require("./decorators/LifecycleBound");
|
|
45
|
+
Object.defineProperty(exports, "lifecycleBound", { enumerable: true, get: function () { return LifecycleBound_2.lifecycleBound; } });
|
|
39
46
|
var GraphMiddleware_1 = require("./graph/registry/GraphMiddleware");
|
|
40
47
|
Object.defineProperty(exports, "GraphMiddleware", { enumerable: true, get: function () { return GraphMiddleware_1.GraphMiddleware; } });
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming conventions. Please use `@graph` instead.
|
|
50
|
+
*/
|
|
51
|
+
exports.Graph = Graph_1.graph;
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@singleton` instead.
|
|
54
|
+
*/
|
|
55
|
+
exports.Singleton = Singleton_1.singleton;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@provides` instead.
|
|
58
|
+
*/
|
|
59
|
+
exports.Provides = Provides_1.provides;
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@injectable` instead.
|
|
62
|
+
*/
|
|
63
|
+
exports.Injectable = Injectable_1.injectable;
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@inject` instead.
|
|
66
|
+
*/
|
|
67
|
+
exports.Inject = Inject_1.inject;
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@lateInject` instead.
|
|
70
|
+
*/
|
|
71
|
+
exports.LateInject = LateInject_1.lateInject;
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@lifecycleBound` instead.
|
|
74
|
+
*/
|
|
75
|
+
exports.LifecycleBound = LifecycleBound_1.lifecycleBound;
|
|
41
76
|
exports.Obsidian = new Obsidian_1.default();
|
|
42
77
|
var InjectComponent_1 = require("./injectors/components/InjectComponent");
|
|
43
78
|
Object.defineProperty(exports, "injectComponent", { enumerable: true, get: function () { return InjectComponent_1.injectComponent; } });
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AAEnC,0CAAwB;AAExB,4CAA2C;AAAlC,8FAAA,KAAK,OAAA;AACd,oDAAmD;AAA1C,sGAAA,SAAS,OAAA;AAClB,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AAEpB,2DAA0D;AAAjD,oGAAA,QAAQ,OAAA;AACjB,6DAA4D;AAAnD,wGAAA,UAAU,OAAA;AACnB,qDAAoD;AAA3C,gGAAA,MAAM,OAAA;AACf,6DAA4D;AAAnD,wGAAA,UAAU,OAAA;AACnB,8DAA6D;AAApD,gHAAA,cAAc,OAAA;AACvB,oEAAmE;AAA1D,kHAAA,eAAe,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;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AAK,OAAA;AAEd,sCAAqC;AAA5B,kGAAA,OAAO,OAAA;AAChB,0CAAyD;AAAhD,kGAAA,SAAS,OAAA;AAAE,mGAAA,UAAU,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LifecycleBoundGraph.d.ts","sourceRoot":"","sources":["../../../test/fixtures/LifecycleBoundGraph.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"LifecycleBoundGraph.d.ts","sourceRoot":"","sources":["../../../test/fixtures/LifecycleBoundGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAGZ,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtE,qBACa,mBAAoB,SAAQ,WAAW,CAAC,KAAK,CAAC;IACzD,MAAM,CAAC,YAAY,SAAK;IACxB,OAAO,CAAC,KAAK,CAAQ;gBAET,KAAK,EAAE,KAAK;IAOxB,iBAAiB,IAAI,MAAM;IAO3B,mBAAmB,IAAI,MAAM;CAG9B"}
|
|
@@ -12,7 +12,6 @@ var LifecycleBoundGraph_1;
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.LifecycleBoundGraph = void 0;
|
|
14
14
|
const src_1 = require("../../src");
|
|
15
|
-
const LifecycleBound_1 = require("../../src/decorators/LifecycleBound");
|
|
16
15
|
let LifecycleBoundGraph = LifecycleBoundGraph_1 = class LifecycleBoundGraph extends src_1.ObjectGraph {
|
|
17
16
|
constructor(props) {
|
|
18
17
|
super(props);
|
|
@@ -31,20 +30,20 @@ let LifecycleBoundGraph = LifecycleBoundGraph_1 = class LifecycleBoundGraph exte
|
|
|
31
30
|
exports.LifecycleBoundGraph = LifecycleBoundGraph;
|
|
32
31
|
LifecycleBoundGraph.timesCreated = 0;
|
|
33
32
|
__decorate([
|
|
34
|
-
(0, src_1.
|
|
33
|
+
(0, src_1.provides)(),
|
|
35
34
|
__metadata("design:type", Function),
|
|
36
35
|
__metadata("design:paramtypes", []),
|
|
37
36
|
__metadata("design:returntype", String)
|
|
38
37
|
], LifecycleBoundGraph.prototype, "computedFromProps", null);
|
|
39
38
|
__decorate([
|
|
40
|
-
(0, src_1.
|
|
39
|
+
(0, src_1.provides)(),
|
|
41
40
|
__metadata("design:type", Function),
|
|
42
41
|
__metadata("design:paramtypes", []),
|
|
43
42
|
__metadata("design:returntype", String)
|
|
44
43
|
], LifecycleBoundGraph.prototype, "doesNotRequireProps", null);
|
|
45
44
|
exports.LifecycleBoundGraph = LifecycleBoundGraph = LifecycleBoundGraph_1 = __decorate([
|
|
46
|
-
(0,
|
|
47
|
-
(0, src_1.
|
|
45
|
+
(0, src_1.lifecycleBound)(),
|
|
46
|
+
(0, src_1.graph)(),
|
|
48
47
|
__metadata("design:paramtypes", [Object])
|
|
49
48
|
], LifecycleBoundGraph);
|
|
50
49
|
//# sourceMappingURL=LifecycleBoundGraph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LifecycleBoundGraph.js","sourceRoot":"","sources":["../../../test/fixtures/LifecycleBoundGraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"LifecycleBoundGraph.js","sourceRoot":"","sources":["../../../test/fixtures/LifecycleBoundGraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mCAKmB;AAKZ,IAAM,mBAAmB,2BAAzB,MAAM,mBAAoB,SAAQ,iBAAkB;IAIzD,YAAY,KAAY;QACtB,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,qBAAmB,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;IAGD,iBAAiB;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,eAAe;YAC/B,CAAC,CAAC,8BAA8B,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE;YAC5D,CAAC,CAAC,gCAAgC,CAAC;IACvC,CAAC;IAGD,mBAAmB;QACjB,OAAO,sCAAsC,CAAC;IAChD,CAAC;;AApBU,kDAAmB;AACvB,gCAAY,GAAG,CAAC,AAAJ,CAAK;AAUxB;IADC,IAAA,cAAQ,GAAE;;;;4DAKV;AAGD;IADC,IAAA,cAAQ,GAAE;;;;8DAGV;8BApBU,mBAAmB;IAD/B,IAAA,oBAAc,GAAE;IAAE,IAAA,WAAK,GAAE;;GACb,mBAAmB,CAqB/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LifecycleBoundWithLifecycleBoundSubgraph.d.ts","sourceRoot":"","sources":["../../../test/fixtures/LifecycleBoundWithLifecycleBoundSubgraph.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"LifecycleBoundWithLifecycleBoundSubgraph.d.ts","sourceRoot":"","sources":["../../../test/fixtures/LifecycleBoundWithLifecycleBoundSubgraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAGZ,MAAM,WAAW,CAAC;AAGnB,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtE,qBACa,6CAA8C,SAAQ,WAAW;IAG5E,OAAO,CAAC,iBAAiB,EAAE,MAAM,GAAG,MAAM;CAG3C"}
|
|
@@ -11,7 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.LifecycleBoundGraphWithLifecycleBoundSubgraph = void 0;
|
|
13
13
|
const src_1 = require("../../src");
|
|
14
|
-
const LifecycleBound_1 = require("../../src/decorators/LifecycleBound");
|
|
15
14
|
const LifecycleBoundGraph_1 = require("./LifecycleBoundGraph");
|
|
16
15
|
let LifecycleBoundGraphWithLifecycleBoundSubgraph = class LifecycleBoundGraphWithLifecycleBoundSubgraph extends src_1.ObjectGraph {
|
|
17
16
|
aString(computedFromProps) {
|
|
@@ -20,13 +19,13 @@ let LifecycleBoundGraphWithLifecycleBoundSubgraph = class LifecycleBoundGraphWit
|
|
|
20
19
|
};
|
|
21
20
|
exports.LifecycleBoundGraphWithLifecycleBoundSubgraph = LifecycleBoundGraphWithLifecycleBoundSubgraph;
|
|
22
21
|
__decorate([
|
|
23
|
-
(0, src_1.
|
|
22
|
+
(0, src_1.provides)(),
|
|
24
23
|
__metadata("design:type", Function),
|
|
25
24
|
__metadata("design:paramtypes", [String]),
|
|
26
25
|
__metadata("design:returntype", String)
|
|
27
26
|
], LifecycleBoundGraphWithLifecycleBoundSubgraph.prototype, "aString", null);
|
|
28
27
|
exports.LifecycleBoundGraphWithLifecycleBoundSubgraph = LifecycleBoundGraphWithLifecycleBoundSubgraph = __decorate([
|
|
29
|
-
(0,
|
|
30
|
-
(0, src_1.
|
|
28
|
+
(0, src_1.lifecycleBound)(),
|
|
29
|
+
(0, src_1.graph)({ subgraphs: [LifecycleBoundGraph_1.LifecycleBoundGraph] })
|
|
31
30
|
], LifecycleBoundGraphWithLifecycleBoundSubgraph);
|
|
32
31
|
//# sourceMappingURL=LifecycleBoundWithLifecycleBoundSubgraph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LifecycleBoundWithLifecycleBoundSubgraph.js","sourceRoot":"","sources":["../../../test/fixtures/LifecycleBoundWithLifecycleBoundSubgraph.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"LifecycleBoundWithLifecycleBoundSubgraph.js","sourceRoot":"","sources":["../../../test/fixtures/LifecycleBoundWithLifecycleBoundSubgraph.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAKmB;AACnB,+DAA4D;AAKrD,IAAM,6CAA6C,GAAnD,MAAM,6CAA8C,SAAQ,iBAAW;IAG5E,OAAO,CAAC,iBAAyB;QAC/B,OAAO,iEAAiE,iBAAiB,EAAE,CAAC;IAC9F,CAAC;CACF,CAAA;AANY,sGAA6C;AAGxD;IADC,IAAA,cAAQ,GAAE;;;;4EAGV;wDALU,6CAA6C;IADzD,IAAA,oBAAc,GAAE;IAAE,IAAA,WAAK,EAAC,EAAE,SAAS,EAAE,CAAC,yCAAmB,CAAC,EAAE,CAAC;GACjD,6CAA6C,CAMzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScopedLifecycleBoundGraph.d.ts","sourceRoot":"","sources":["../../../test/fixtures/ScopedLifecycleBoundGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,WAAW,
|
|
1
|
+
{"version":3,"file":"ScopedLifecycleBoundGraph.d.ts","sourceRoot":"","sources":["../../../test/fixtures/ScopedLifecycleBoundGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,WAAW,EAAkB,MAAM,WAAW,CAAC;AAE/D,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtE,qBACa,yBAA0B,SAAQ,WAAW,CAAC,KAAK,CAAC;CAEhE"}
|
|
@@ -8,12 +8,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.ScopedLifecycleBoundGraph = void 0;
|
|
10
10
|
const src_1 = require("../../src");
|
|
11
|
-
const LifecycleBound_1 = require("../../src/decorators/LifecycleBound");
|
|
12
11
|
let ScopedLifecycleBoundGraph = class ScopedLifecycleBoundGraph extends src_1.ObjectGraph {
|
|
13
12
|
};
|
|
14
13
|
exports.ScopedLifecycleBoundGraph = ScopedLifecycleBoundGraph;
|
|
15
14
|
exports.ScopedLifecycleBoundGraph = ScopedLifecycleBoundGraph = __decorate([
|
|
16
|
-
(0,
|
|
17
|
-
(0, src_1.
|
|
15
|
+
(0, src_1.lifecycleBound)({ scope: 'component' }),
|
|
16
|
+
(0, src_1.graph)()
|
|
18
17
|
], ScopedLifecycleBoundGraph);
|
|
19
18
|
//# sourceMappingURL=ScopedLifecycleBoundGraph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScopedLifecycleBoundGraph.js","sourceRoot":"","sources":["../../../test/fixtures/ScopedLifecycleBoundGraph.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAA+
|
|
1
|
+
{"version":3,"file":"ScopedLifecycleBoundGraph.js","sourceRoot":"","sources":["../../../test/fixtures/ScopedLifecycleBoundGraph.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mCAA+D;AAKxD,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,iBAAkB;CAEhE,CAAA;AAFY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,oBAAc,EAAC,EAAC,KAAK,EAAE,WAAW,EAAC,CAAC;IAAE,IAAA,WAAK,GAAE;GACjC,yBAAyB,CAErC"}
|
|
@@ -22,14 +22,14 @@ let SingletonGraph = class SingletonGraph extends src_1.ObjectGraph {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
__decorate([
|
|
25
|
-
(0, src_1.
|
|
25
|
+
(0, src_1.provides)(),
|
|
26
26
|
__metadata("design:type", Function),
|
|
27
27
|
__metadata("design:paramtypes", []),
|
|
28
28
|
__metadata("design:returntype", String)
|
|
29
29
|
], SingletonGraph.prototype, "instanceId", null);
|
|
30
30
|
SingletonGraph = __decorate([
|
|
31
|
-
(0, Singleton_1.
|
|
32
|
-
(0, src_1.
|
|
31
|
+
(0, Singleton_1.singleton)(),
|
|
32
|
+
(0, src_1.graph)()
|
|
33
33
|
], SingletonGraph);
|
|
34
34
|
exports.default = SingletonGraph;
|
|
35
35
|
//# sourceMappingURL=SingletonGraph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../transformers/babel-plugin-obsidian/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../transformers/babel-plugin-obsidian/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAY,SAAS,EAAE,MAAM,aAAa,CAAC;AAwClD,MAAM,CAAC,OAAO,UAAU,MAAM,gDAE7B"}
|
|
@@ -15,22 +15,27 @@ const providerArgumentsTransformer = {
|
|
|
15
15
|
const internalVisitor = {
|
|
16
16
|
ClassMethod: {
|
|
17
17
|
enter({ node }) {
|
|
18
|
+
unmagler_1.default.saveClassMethod('provides', node);
|
|
18
19
|
unmagler_1.default.saveClassMethod('Provides', node);
|
|
19
20
|
},
|
|
20
21
|
},
|
|
21
22
|
ClassProperty: {
|
|
22
23
|
enter({ node }) {
|
|
24
|
+
unmagler_1.default.saveClassProperty('inject', node);
|
|
25
|
+
unmagler_1.default.saveClassProperty('lateInject', node);
|
|
23
26
|
unmagler_1.default.saveClassProperty('Inject', node);
|
|
24
27
|
unmagler_1.default.saveClassProperty('LateInject', node);
|
|
25
28
|
},
|
|
26
29
|
},
|
|
27
30
|
Identifier: {
|
|
28
31
|
enter({ node }) {
|
|
32
|
+
unmagler_1.default.saveIdentifier('inject', node);
|
|
29
33
|
unmagler_1.default.saveIdentifier('Inject', node);
|
|
30
34
|
},
|
|
31
35
|
},
|
|
32
36
|
TSParameterProperty: {
|
|
33
37
|
enter({ node }) {
|
|
38
|
+
unmagler_1.default.saveTSParameterProperty('inject', node);
|
|
34
39
|
unmagler_1.default.saveTSParameterProperty('Inject', node);
|
|
35
40
|
},
|
|
36
41
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../transformers/babel-plugin-obsidian/index.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../transformers/babel-plugin-obsidian/index.ts"],"names":[],"mappings":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ANGED
package/src/decorators/Graph.ts
CHANGED
|
@@ -6,7 +6,7 @@ interface GraphParams {
|
|
|
6
6
|
subgraphs: Constructable<ObjectGraph>[];
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export function
|
|
9
|
+
export function graph({ subgraphs = [] }: Partial<GraphParams> = {}) {
|
|
10
10
|
return (constructor: any) => {
|
|
11
11
|
graphRegistry.register(constructor, subgraphs);
|
|
12
12
|
return constructor;
|
|
@@ -4,7 +4,7 @@ type Options = {
|
|
|
4
4
|
scope?: 'component' | 'feature' | (string & {});
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
export function
|
|
7
|
+
export function lifecycleBound(options?: Options) {
|
|
8
8
|
return (constructor: any) => {
|
|
9
9
|
Reflect.defineMetadata('isLifecycleBound', true, constructor);
|
|
10
10
|
Reflect.defineMetadata('lifecycleScope', options?.scope ?? 'feature', constructor);
|
|
@@ -2,12 +2,12 @@ import { Constructable } from '../types';
|
|
|
2
2
|
import { ObjectGraph } from '../graph/ObjectGraph';
|
|
3
3
|
import {Reflect} from '../utils/reflect';
|
|
4
4
|
|
|
5
|
-
export function
|
|
6
|
-
return
|
|
5
|
+
export function singleton() {
|
|
6
|
+
return (
|
|
7
7
|
constructorOrGraph: Constructable<ObjectGraph> | ObjectGraph,
|
|
8
8
|
_property?: string,
|
|
9
9
|
descriptor?: PropertyDescriptor,
|
|
10
|
-
): any {
|
|
10
|
+
): any => {
|
|
11
11
|
const target = descriptor || constructorOrGraph;
|
|
12
12
|
Reflect.defineMetadata('isSingleton', true, target);
|
|
13
13
|
return target;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isNumber } from '../../utils/isNumber';
|
|
2
2
|
import InjectionMetadata from '../../injectors/class/InjectionMetadata';
|
|
3
3
|
|
|
4
|
-
export function
|
|
4
|
+
export function inject(name?: string) {
|
|
5
5
|
return (
|
|
6
6
|
target: Object | any,
|
|
7
7
|
_propertyKey?: string,
|
|
@@ -3,6 +3,6 @@ import { Graph } from '../../graph/Graph';
|
|
|
3
3
|
import graphRegistry from '../../graph/registry/GraphRegistry';
|
|
4
4
|
import ClassInjector from '../../injectors/class/ClassInjector';
|
|
5
5
|
|
|
6
|
-
export function
|
|
6
|
+
export function injectable(keyOrGraph: string | Constructable<Graph>): any {
|
|
7
7
|
return new ClassInjector(graphRegistry).inject(keyOrGraph);
|
|
8
8
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import InjectionMetadata from '../../injectors/class/InjectionMetadata';
|
|
2
2
|
|
|
3
|
-
export function
|
|
3
|
+
export function lateInject(name?: string): any {
|
|
4
4
|
return (target: object) => {
|
|
5
5
|
const metadata = new InjectionMetadata();
|
|
6
6
|
metadata.saveLatePropertyMetadata(target.constructor, name!);
|
|
@@ -6,8 +6,8 @@ interface ProvidesParams {
|
|
|
6
6
|
name: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export function
|
|
10
|
-
return
|
|
9
|
+
export function provides({ name }: Partial<ProvidesParams> = {}) {
|
|
10
|
+
return (graph: Graph, propertyKey: string, descriptor: PropertyDescriptor) => {
|
|
11
11
|
providedPropertiesStore.set(graph, propertyKey, name!);
|
|
12
12
|
return memoizeDescriptor(propertyKey, descriptor);
|
|
13
13
|
};
|
package/src/index.ts
CHANGED
|
@@ -1,19 +1,56 @@
|
|
|
1
|
+
import { graph } from './decorators/Graph';
|
|
2
|
+
import { inject } from './decorators/inject/Inject';
|
|
3
|
+
import { injectable } from './decorators/inject/Injectable';
|
|
4
|
+
import { lateInject } from './decorators/inject/LateInject';
|
|
5
|
+
import { lifecycleBound } from './decorators/LifecycleBound';
|
|
6
|
+
import { provides } from './decorators/provides/Provides';
|
|
7
|
+
import { singleton } from './decorators/Singleton';
|
|
1
8
|
import _Obsidian from './Obsidian';
|
|
2
9
|
|
|
3
10
|
export * from './types';
|
|
4
11
|
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
12
|
+
export { graph } from './decorators/Graph';
|
|
13
|
+
export { singleton } from './decorators/Singleton';
|
|
7
14
|
export { ObjectGraph } from './graph/ObjectGraph';
|
|
8
15
|
export { Graph as IGraph } from './graph/Graph';
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
16
|
+
export { provides } from './decorators/provides/Provides';
|
|
17
|
+
export { injectable } from './decorators/inject/Injectable';
|
|
18
|
+
export { inject } from './decorators/inject/Inject';
|
|
19
|
+
export { lateInject } from './decorators/inject/LateInject';
|
|
20
|
+
export { lifecycleBound } from './decorators/LifecycleBound';
|
|
14
21
|
export { GraphMiddleware } from './graph/registry/GraphMiddleware';
|
|
15
22
|
export { GraphResolveChain as ResolveChain } from './graph/registry/GraphResolveChain';
|
|
16
23
|
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming conventions. Please use `@graph` instead.
|
|
26
|
+
*/
|
|
27
|
+
export const Graph = graph;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@singleton` instead.
|
|
30
|
+
*/
|
|
31
|
+
export const Singleton = singleton;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@provides` instead.
|
|
34
|
+
*/
|
|
35
|
+
export const Provides = provides;
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@injectable` instead.
|
|
38
|
+
*/
|
|
39
|
+
export const Injectable = injectable;
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@inject` instead.
|
|
42
|
+
*/
|
|
43
|
+
export const Inject = inject;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@lateInject` instead.
|
|
46
|
+
*/
|
|
47
|
+
export const LateInject = lateInject;
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Uppercase decorators are deprecated in favor of lowercase decorators to align with common naming convention. Please use `@lifecycleBound` instead.
|
|
50
|
+
*/
|
|
51
|
+
export const LifecycleBound = lifecycleBound;
|
|
52
|
+
|
|
53
|
+
|
|
17
54
|
export const Obsidian = new _Obsidian();
|
|
18
55
|
|
|
19
56
|
export { injectComponent } from './injectors/components/InjectComponent';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-param-reassign */
|
|
2
1
|
import {
|
|
3
2
|
ClassMethod,
|
|
4
3
|
ClassProperty,
|
|
@@ -20,22 +19,27 @@ const providerArgumentsTransformer: PluginObj = {
|
|
|
20
19
|
const internalVisitor = {
|
|
21
20
|
ClassMethod: {
|
|
22
21
|
enter({ node }: NodePath<ClassMethod>) {
|
|
22
|
+
unmagler.saveClassMethod('provides', node);
|
|
23
23
|
unmagler.saveClassMethod('Provides', node);
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
ClassProperty: {
|
|
27
27
|
enter({ node }: NodePath<ClassProperty>) {
|
|
28
|
+
unmagler.saveClassProperty('inject', node);
|
|
29
|
+
unmagler.saveClassProperty('lateInject', node);
|
|
28
30
|
unmagler.saveClassProperty('Inject', node);
|
|
29
31
|
unmagler.saveClassProperty('LateInject', node);
|
|
30
32
|
},
|
|
31
33
|
},
|
|
32
34
|
Identifier: {
|
|
33
35
|
enter({ node }: NodePath<Identifier>) {
|
|
36
|
+
unmagler.saveIdentifier('inject', node);
|
|
34
37
|
unmagler.saveIdentifier('Inject', node);
|
|
35
38
|
},
|
|
36
39
|
},
|
|
37
40
|
TSParameterProperty: {
|
|
38
41
|
enter({ node }: NodePath<TSParameterProperty>) {
|
|
42
|
+
unmagler.saveTSParameterProperty('inject', node);
|
|
39
43
|
unmagler.saveTSParameterProperty('Inject', node);
|
|
40
44
|
},
|
|
41
45
|
},
|