react-obsidian 0.0.1
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/.buildkite/pipeline.yml +0 -0
- package/.eslintignore +1 -0
- package/.eslintrc.json +93 -0
- package/.nvmrc +1 -0
- package/LICENSE +7 -0
- package/README.md +160 -0
- package/babel.config.js +12 -0
- package/dist/src/GraphProperties.d.ts +6 -0
- package/dist/src/GraphProperties.d.ts.map +1 -0
- package/dist/src/GraphProperties.js +16 -0
- package/dist/src/GraphProperties.js.map +1 -0
- package/dist/src/Obsidian.d.ts +9 -0
- package/dist/src/Obsidian.d.ts.map +1 -0
- package/dist/src/Obsidian.js +22 -0
- package/dist/src/Obsidian.js.map +1 -0
- package/dist/src/ProvidedPropertiesStore.d.ts +10 -0
- package/dist/src/ProvidedPropertiesStore.d.ts.map +1 -0
- package/dist/src/ProvidedPropertiesStore.js +27 -0
- package/dist/src/ProvidedPropertiesStore.js.map +1 -0
- package/dist/src/Provides.d.ts +9 -0
- package/dist/src/Provides.d.ts.map +1 -0
- package/dist/src/Provides.js +15 -0
- package/dist/src/Provides.js.map +1 -0
- package/dist/src/ReferenceCounter.d.ts +8 -0
- package/dist/src/ReferenceCounter.d.ts.map +1 -0
- package/dist/src/ReferenceCounter.js +25 -0
- package/dist/src/ReferenceCounter.js.map +1 -0
- package/dist/src/ScopedValuesRegistry.d.ts +11 -0
- package/dist/src/ScopedValuesRegistry.d.ts.map +1 -0
- package/dist/src/ScopedValuesRegistry.js +25 -0
- package/dist/src/ScopedValuesRegistry.js.map +1 -0
- package/dist/src/decorators/Graph.d.ts +10 -0
- package/dist/src/decorators/Graph.d.ts.map +1 -0
- package/dist/src/decorators/Graph.js +17 -0
- package/dist/src/decorators/Graph.js.map +1 -0
- package/dist/src/decorators/injectClass.d.ts +7 -0
- package/dist/src/decorators/injectClass.d.ts.map +1 -0
- package/dist/src/decorators/injectClass.js +34 -0
- package/dist/src/decorators/injectClass.js.map +1 -0
- package/dist/src/graph/Graph.d.ts +6 -0
- package/dist/src/graph/Graph.d.ts.map +1 -0
- package/dist/src/graph/Graph.js +3 -0
- package/dist/src/graph/Graph.js.map +1 -0
- package/dist/src/graph/ObjectGraph.d.ts +11 -0
- package/dist/src/graph/ObjectGraph.d.ts.map +1 -0
- package/dist/src/graph/ObjectGraph.js +26 -0
- package/dist/src/graph/ObjectGraph.js.map +1 -0
- package/dist/src/graph/PropertyRetriever.d.ts +8 -0
- package/dist/src/graph/PropertyRetriever.d.ts.map +1 -0
- package/dist/src/graph/PropertyRetriever.js +40 -0
- package/dist/src/graph/PropertyRetriever.js.map +1 -0
- package/dist/src/graph/PropertyRetrieverDelegate.d.ts +5 -0
- package/dist/src/graph/PropertyRetrieverDelegate.d.ts.map +1 -0
- package/dist/src/graph/PropertyRetrieverDelegate.js +3 -0
- package/dist/src/graph/PropertyRetrieverDelegate.js.map +1 -0
- package/dist/src/graph/registry/DefaultGraphResolver.d.ts +7 -0
- package/dist/src/graph/registry/DefaultGraphResolver.d.ts.map +1 -0
- package/dist/src/graph/registry/DefaultGraphResolver.js +30 -0
- package/dist/src/graph/registry/DefaultGraphResolver.js.map +1 -0
- package/dist/src/graph/registry/GraphMiddleware.d.ts +12 -0
- package/dist/src/graph/registry/GraphMiddleware.d.ts.map +1 -0
- package/dist/src/graph/registry/GraphMiddleware.js +25 -0
- package/dist/src/graph/registry/GraphMiddleware.js.map +1 -0
- package/dist/src/graph/registry/GraphMiddlewareChain.d.ts +12 -0
- package/dist/src/graph/registry/GraphMiddlewareChain.d.ts.map +1 -0
- package/dist/src/graph/registry/GraphMiddlewareChain.js +30 -0
- package/dist/src/graph/registry/GraphMiddlewareChain.js.map +1 -0
- package/dist/src/graph/registry/GraphRegistry.d.ts +22 -0
- package/dist/src/graph/registry/GraphRegistry.d.ts.map +1 -0
- package/dist/src/graph/registry/GraphRegistry.js +65 -0
- package/dist/src/graph/registry/GraphRegistry.js.map +1 -0
- package/dist/src/index.d.ts +17 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +24 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/injectHook.d.ts +5 -0
- package/dist/src/injectHook.d.ts.map +1 -0
- package/dist/src/injectHook.js +30 -0
- package/dist/src/injectHook.js.map +1 -0
- package/dist/src/injectors/components/ComponentInjector.d.ts +9 -0
- package/dist/src/injectors/components/ComponentInjector.d.ts.map +1 -0
- package/dist/src/injectors/components/ComponentInjector.js +48 -0
- package/dist/src/injectors/components/ComponentInjector.js.map +1 -0
- package/dist/src/injectors/components/PropsInjector.d.ts +7 -0
- package/dist/src/injectors/components/PropsInjector.d.ts.map +1 -0
- package/dist/src/injectors/components/PropsInjector.js +19 -0
- package/dist/src/injectors/components/PropsInjector.js.map +1 -0
- package/dist/src/injectors/components/useGraph.d.ts +5 -0
- package/dist/src/injectors/components/useGraph.d.ts.map +1 -0
- package/dist/src/injectors/components/useGraph.js +17 -0
- package/dist/src/injectors/components/useGraph.js.map +1 -0
- package/dist/test/integration/fixtures/InjectedComponent.d.ts +8 -0
- package/dist/test/integration/fixtures/InjectedComponent.d.ts.map +1 -0
- package/dist/test/integration/fixtures/InjectedComponent.js +14 -0
- package/dist/test/integration/fixtures/InjectedComponent.js.map +1 -0
- package/dist/test/integration/fixtures/MainGraph.d.ts +6 -0
- package/dist/test/integration/fixtures/MainGraph.d.ts.map +1 -0
- package/dist/test/integration/fixtures/MainGraph.js +53 -0
- package/dist/test/integration/fixtures/MainGraph.js.map +1 -0
- package/dist/test/integration/fixtures/StringProvider.d.ts +5 -0
- package/dist/test/integration/fixtures/StringProvider.d.ts.map +1 -0
- package/dist/test/integration/fixtures/StringProvider.js +15 -0
- package/dist/test/integration/fixtures/StringProvider.js.map +1 -0
- package/dist/test/integration/fixtures/Subgraph.d.ts +8 -0
- package/dist/test/integration/fixtures/Subgraph.d.ts.map +1 -0
- package/dist/test/integration/fixtures/Subgraph.js +71 -0
- package/dist/test/integration/fixtures/Subgraph.js.map +1 -0
- package/dist/test/integration/fixtures/ThrowingMainGraph.d.ts +5 -0
- package/dist/test/integration/fixtures/ThrowingMainGraph.d.ts.map +1 -0
- package/dist/test/integration/fixtures/ThrowingMainGraph.js +52 -0
- package/dist/test/integration/fixtures/ThrowingMainGraph.js.map +1 -0
- package/dist/test/integration/fixtures/injectedValues.d.ts +6 -0
- package/dist/test/integration/fixtures/injectedValues.d.ts.map +1 -0
- package/dist/test/integration/fixtures/injectedValues.js +7 -0
- package/dist/test/integration/fixtures/injectedValues.js.map +1 -0
- package/dist/testkit/index.d.ts +8 -0
- package/dist/testkit/index.d.ts.map +1 -0
- package/dist/testkit/index.js +46 -0
- package/dist/testkit/index.js.map +1 -0
- package/dist/transformers/babel-plugin-obsidian-provide/helpers/index.d.ts +9 -0
- package/dist/transformers/babel-plugin-obsidian-provide/helpers/index.d.ts.map +1 -0
- package/dist/transformers/babel-plugin-obsidian-provide/helpers/index.js +54 -0
- package/dist/transformers/babel-plugin-obsidian-provide/helpers/index.js.map +1 -0
- package/dist/transformers/babel-plugin-obsidian-provide/index.d.ts +3 -0
- package/dist/transformers/babel-plugin-obsidian-provide/index.d.ts.map +1 -0
- package/dist/transformers/babel-plugin-obsidian-provide/index.js +35 -0
- package/dist/transformers/babel-plugin-obsidian-provide/index.js.map +1 -0
- package/example/.buckconfig +6 -0
- package/example/.editorconfig +3 -0
- package/example/.eslintrc.js +4 -0
- package/example/.flowconfig +65 -0
- package/example/.gitattributes +3 -0
- package/example/.prettierrc.js +7 -0
- package/example/.watchmanconfig +1 -0
- package/example/App.tsx +31 -0
- package/example/MyInjectedComponent.tsx +28 -0
- package/example/__tests__/App-test.js +14 -0
- package/example/android/app/BUCK +55 -0
- package/example/android/app/build.gradle +227 -0
- package/example/android/app/build_defs.bzl +19 -0
- package/example/android/app/debug.keystore +0 -0
- package/example/android/app/proguard-rules.pro +10 -0
- package/example/android/app/src/debug/AndroidManifest.xml +13 -0
- package/example/android/app/src/debug/java/com/example/ReactNativeFlipper.java +72 -0
- package/example/android/app/src/main/AndroidManifest.xml +25 -0
- package/example/android/app/src/main/java/com/example/MainActivity.java +15 -0
- package/example/android/app/src/main/java/com/example/MainApplication.java +80 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/values/strings.xml +3 -0
- package/example/android/app/src/main/res/values/styles.xml +8 -0
- package/example/android/build.gradle +38 -0
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/example/android/gradle.properties +28 -0
- package/example/android/gradlew +185 -0
- package/example/android/gradlew.bat +89 -0
- package/example/android/settings.gradle +3 -0
- package/example/app.json +4 -0
- package/example/babel.config.js +8 -0
- package/example/index.js +9 -0
- package/example/ios/Podfile +30 -0
- package/example/ios/Podfile.lock +526 -0
- package/example/ios/example/AppDelegate.h +8 -0
- package/example/ios/example/AppDelegate.m +62 -0
- package/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json +38 -0
- package/example/ios/example/Images.xcassets/Contents.json +6 -0
- package/example/ios/example/Info.plist +55 -0
- package/example/ios/example/LaunchScreen.storyboard +47 -0
- package/example/ios/example/main.m +9 -0
- package/example/ios/example.xcodeproj/project.pbxproj +689 -0
- package/example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme +88 -0
- package/example/ios/example.xcworkspace/contents.xcworkspacedata +10 -0
- package/example/ios/exampleTests/Info.plist +24 -0
- package/example/ios/exampleTests/exampleTests.m +65 -0
- package/example/metro.config.js +44 -0
- package/example/package.json +35 -0
- package/example/tsconfig.json +45 -0
- package/jest.config.js +12 -0
- package/package.json +79 -0
- package/src/@types/obsidian.d.ts +19 -0
- package/src/GraphProperties.ts +11 -0
- package/src/Obsidian.ts +18 -0
- package/src/ProvidedPropertiesStore.ts +22 -0
- package/src/Provides.ts +16 -0
- package/src/ReferenceCounter.ts +20 -0
- package/src/ScopedValuesRegistry.ts +26 -0
- package/src/decorators/Graph.ts +20 -0
- package/src/decorators/injectClass.ts +28 -0
- package/src/graph/Graph.ts +7 -0
- package/src/graph/ObjectGraph.ts +19 -0
- package/src/graph/PropertyRetriever.ts +36 -0
- package/src/graph/PropertyRetrieverDelegate.ts +5 -0
- package/src/graph/registry/DefaultGraphResolver.ts +9 -0
- package/src/graph/registry/GraphMiddleware.ts +24 -0
- package/src/graph/registry/GraphMiddlewareChain.ts +31 -0
- package/src/graph/registry/GraphRegistry.ts +70 -0
- package/src/index.ts +23 -0
- package/src/injectHook.ts +26 -0
- package/src/injectors/components/ComponentInjector.tsx +29 -0
- package/src/injectors/components/PropsInjector.ts +14 -0
- package/src/injectors/components/useGraph.ts +14 -0
- package/testkit/index.ts +25 -0
- package/transformers/babel-plugin-obsidian-provide/helpers/index.ts +59 -0
- package/transformers/babel-plugin-obsidian-provide/index.ts +44 -0
- package/tsconfig.base.json +43 -0
- package/tsconfig.json +3 -0
- package/tsconfig.prod.json +7 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGraph.js","sourceRoot":"","sources":["../../../../src/injectors/components/useGraph.ts"],"names":[],"mappings":";;;;;AACA,+BAA4C;AAE5C,qFAA+D;AAC/D,4EAAsD;AAEtD,mBAAe,UAAI,KAAiC,EAAE,KAAiB;IAC9D,IAAA,KAAK,GAAI,IAAA,gBAAQ,EAAC,uBAAa,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,GAAjD,CAAkD;IAC9D,IAAA,iBAAS,EAAC;QACR,0BAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO,cAAM,OAAA,0BAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,UAAC,CAAC,IAAK,OAAA,uBAAa,CAAC,KAAK,CAAC,CAAC,CAAC,EAAtB,CAAsB,CAAC,EAA9D,CAA8D,CAAC;IAC9E,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,OAAO,KAAK,CAAC;AACf,CAAC,EAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface InjectedComponentProps {
|
|
3
|
+
someString: string;
|
|
4
|
+
stringFromSubgraph: string;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: React.FunctionComponent<Partial<InjectedComponentProps>>;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=InjectedComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InjectedComponent.d.ts","sourceRoot":"","sources":["../../../../test/integration/fixtures/InjectedComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,sBAAsB;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;;AAQD,wBAA6D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var react_1 = __importDefault(require("react"));
|
|
7
|
+
var src_1 = require("../../../src");
|
|
8
|
+
var MainGraph_1 = __importDefault(require("./MainGraph"));
|
|
9
|
+
var InjectedComponent = function (_a) {
|
|
10
|
+
var someString = _a.someString, stringFromSubgraph = _a.stringFromSubgraph;
|
|
11
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, "".concat(someString).concat(stringFromSubgraph)));
|
|
12
|
+
};
|
|
13
|
+
exports.default = (0, src_1.injectComponent)(InjectedComponent, MainGraph_1.default);
|
|
14
|
+
//# sourceMappingURL=InjectedComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InjectedComponent.js","sourceRoot":"","sources":["../../../../test/integration/fixtures/InjectedComponent.tsx"],"names":[],"mappings":";;;;;AAAA,gDAA0B;AAC1B,oCAA+C;AAC/C,0DAAoC;AAOpC,IAAM,iBAAiB,GAAG,UAAC,EAA0D;QAAxD,UAAU,gBAAA,EAAE,kBAAkB,wBAAA;IAA+B,OAAA,CACxF,8DACG,UAAG,UAAU,SAAG,kBAAkB,CAAE,CACpC,CACJ;AAJyF,CAIzF,CAAC;AAEF,kBAAe,IAAA,qBAAe,EAAC,iBAAiB,EAAE,mBAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MainGraph.d.ts","sourceRoot":"","sources":["../../../../test/integration/fixtures/MainGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,WAAW,EAAY,MAAM,cAAc,CAAC;AAC5D,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAI9C,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,WAAW;IAEhD,UAAU,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM;CAGnD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
var src_1 = require("../../../src");
|
|
31
|
+
var StringProvider_1 = __importDefault(require("./StringProvider"));
|
|
32
|
+
var Subgraph_1 = __importDefault(require("./Subgraph"));
|
|
33
|
+
var MainGraph = /** @class */ (function (_super) {
|
|
34
|
+
__extends(MainGraph, _super);
|
|
35
|
+
function MainGraph() {
|
|
36
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
37
|
+
}
|
|
38
|
+
MainGraph.prototype.someString = function (stringProvider) {
|
|
39
|
+
return stringProvider.theString;
|
|
40
|
+
};
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, src_1.Provides)(),
|
|
43
|
+
__metadata("design:type", Function),
|
|
44
|
+
__metadata("design:paramtypes", [StringProvider_1.default]),
|
|
45
|
+
__metadata("design:returntype", String)
|
|
46
|
+
], MainGraph.prototype, "someString", null);
|
|
47
|
+
MainGraph = __decorate([
|
|
48
|
+
(0, src_1.Graph)({ subgraphs: [Subgraph_1.default] })
|
|
49
|
+
], MainGraph);
|
|
50
|
+
return MainGraph;
|
|
51
|
+
}(src_1.ObjectGraph));
|
|
52
|
+
exports.default = MainGraph;
|
|
53
|
+
//# sourceMappingURL=MainGraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MainGraph.js","sourceRoot":"","sources":["../../../../test/integration/fixtures/MainGraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAA4D;AAC5D,oEAA8C;AAC9C,wDAAkC;AAGlC;IAAuC,6BAAW;IAAlD;;IAKA,CAAC;IAHC,8BAAU,GAAV,UAAW,cAA8B;QACvC,OAAO,cAAc,CAAC,SAAS,CAAC;IAClC,CAAC;IAFD;QADC,IAAA,cAAQ,GAAE;;yCACgB,wBAAc;;+CAExC;IAJkB,SAAS;QAD7B,IAAA,WAAK,EAAC,EAAE,SAAS,EAAE,CAAC,kBAAQ,CAAC,EAAE,CAAC;OACZ,SAAS,CAK7B;IAAD,gBAAC;CAAA,AALD,CAAuC,iBAAW,GAKjD;kBALoB,SAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StringProvider.d.ts","sourceRoot":"","sources":["../../../../test/integration/fixtures/StringProvider.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,cAAc;aACL,SAAS,EAAE,MAAM;gBAAjB,SAAS,GAAE,MAA0C;CAClF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var injectedValues_1 = __importDefault(require("./injectedValues"));
|
|
7
|
+
var StringProvider = /** @class */ (function () {
|
|
8
|
+
function StringProvider(theString) {
|
|
9
|
+
if (theString === void 0) { theString = injectedValues_1.default.fromStringProvider; }
|
|
10
|
+
this.theString = theString;
|
|
11
|
+
}
|
|
12
|
+
return StringProvider;
|
|
13
|
+
}());
|
|
14
|
+
exports.default = StringProvider;
|
|
15
|
+
//# sourceMappingURL=StringProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StringProvider.js","sourceRoot":"","sources":["../../../../test/integration/fixtures/StringProvider.ts"],"names":[],"mappings":";;;;;AAAA,oEAA8C;AAE9C;IACE,wBAA4B,SAAqD;QAArD,0BAAA,EAAA,YAAoB,wBAAc,CAAC,kBAAkB;QAArD,cAAS,GAAT,SAAS,CAA4C;IAAI,CAAC;IACxF,qBAAC;AAAD,CAAC,AAFD,IAEC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ObjectGraph } from '../../../src';
|
|
2
|
+
import StringProvider from './StringProvider';
|
|
3
|
+
export default class Subgraph extends ObjectGraph {
|
|
4
|
+
stringProvider(): StringProvider;
|
|
5
|
+
stringFromSubgraph(): string;
|
|
6
|
+
unusedDependency(): string;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=Subgraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Subgraph.d.ts","sourceRoot":"","sources":["../../../../test/integration/fixtures/Subgraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,WAAW,EAAY,MAAM,cAAc,CAAC;AAE5D,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAG9C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,WAAW;IAE/C,cAAc,IAAI,cAAc;IAKhC,kBAAkB,IAAI,MAAM;IAK5B,gBAAgB,IAAI,MAAM;CAG3B"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
var src_1 = require("../../../src");
|
|
31
|
+
var injectedValues_1 = __importDefault(require("./injectedValues"));
|
|
32
|
+
var StringProvider_1 = __importDefault(require("./StringProvider"));
|
|
33
|
+
var Subgraph = /** @class */ (function (_super) {
|
|
34
|
+
__extends(Subgraph, _super);
|
|
35
|
+
function Subgraph() {
|
|
36
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
37
|
+
}
|
|
38
|
+
Subgraph.prototype.stringProvider = function () {
|
|
39
|
+
return new StringProvider_1.default();
|
|
40
|
+
};
|
|
41
|
+
Subgraph.prototype.stringFromSubgraph = function () {
|
|
42
|
+
return injectedValues_1.default.fromSubgraph;
|
|
43
|
+
};
|
|
44
|
+
Subgraph.prototype.unusedDependency = function () {
|
|
45
|
+
throw Error('This dependency should not have been resolved since it not required by anyone.');
|
|
46
|
+
};
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, src_1.Provides)(),
|
|
49
|
+
__metadata("design:type", Function),
|
|
50
|
+
__metadata("design:paramtypes", []),
|
|
51
|
+
__metadata("design:returntype", StringProvider_1.default)
|
|
52
|
+
], Subgraph.prototype, "stringProvider", null);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, src_1.Provides)(),
|
|
55
|
+
__metadata("design:type", Function),
|
|
56
|
+
__metadata("design:paramtypes", []),
|
|
57
|
+
__metadata("design:returntype", String)
|
|
58
|
+
], Subgraph.prototype, "stringFromSubgraph", null);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, src_1.Provides)(),
|
|
61
|
+
__metadata("design:type", Function),
|
|
62
|
+
__metadata("design:paramtypes", []),
|
|
63
|
+
__metadata("design:returntype", String)
|
|
64
|
+
], Subgraph.prototype, "unusedDependency", null);
|
|
65
|
+
Subgraph = __decorate([
|
|
66
|
+
(0, src_1.Graph)()
|
|
67
|
+
], Subgraph);
|
|
68
|
+
return Subgraph;
|
|
69
|
+
}(src_1.ObjectGraph));
|
|
70
|
+
exports.default = Subgraph;
|
|
71
|
+
//# sourceMappingURL=Subgraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Subgraph.js","sourceRoot":"","sources":["../../../../test/integration/fixtures/Subgraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAA4D;AAC5D,oEAA8C;AAC9C,oEAA8C;AAG9C;IAAsC,4BAAW;IAAjD;;IAeA,CAAC;IAbC,iCAAc,GAAd;QACE,OAAO,IAAI,wBAAc,EAAE,CAAC;IAC9B,CAAC;IAGD,qCAAkB,GAAlB;QACE,OAAO,wBAAc,CAAC,YAAY,CAAC;IACrC,CAAC;IAGD,mCAAgB,GAAhB;QACE,MAAM,KAAK,CAAC,gFAAgF,CAAC,CAAC;IAChG,CAAC;IAZD;QADC,IAAA,cAAQ,GAAE;;;wCACO,wBAAc;kDAE/B;IAGD;QADC,IAAA,cAAQ,GAAE;;;;sDAGV;IAGD;QADC,IAAA,cAAQ,GAAE;;;;oDAGV;IAdkB,QAAQ;QAD5B,IAAA,WAAK,GAAE;OACa,QAAQ,CAe5B;IAAD,eAAC;CAAA,AAfD,CAAsC,iBAAW,GAehD;kBAfoB,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThrowingMainGraph.d.ts","sourceRoot":"","sources":["../../../../test/integration/fixtures/ThrowingMainGraph.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,aAAa,CAAC;AAGpC,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,SAAS;IAE7C,UAAU,IAAI,MAAM;CAG9B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
var src_1 = require("../../../src");
|
|
31
|
+
var MainGraph_1 = __importDefault(require("./MainGraph"));
|
|
32
|
+
var ThrowingMainGraph = /** @class */ (function (_super) {
|
|
33
|
+
__extends(ThrowingMainGraph, _super);
|
|
34
|
+
function ThrowingMainGraph() {
|
|
35
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
36
|
+
}
|
|
37
|
+
ThrowingMainGraph.prototype.someString = function () {
|
|
38
|
+
throw new Error('This graph has no valid providers');
|
|
39
|
+
};
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, src_1.Provides)(),
|
|
42
|
+
__metadata("design:type", Function),
|
|
43
|
+
__metadata("design:paramtypes", []),
|
|
44
|
+
__metadata("design:returntype", String)
|
|
45
|
+
], ThrowingMainGraph.prototype, "someString", null);
|
|
46
|
+
ThrowingMainGraph = __decorate([
|
|
47
|
+
(0, src_1.Graph)()
|
|
48
|
+
], ThrowingMainGraph);
|
|
49
|
+
return ThrowingMainGraph;
|
|
50
|
+
}(MainGraph_1.default));
|
|
51
|
+
exports.default = ThrowingMainGraph;
|
|
52
|
+
//# sourceMappingURL=ThrowingMainGraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThrowingMainGraph.js","sourceRoot":"","sources":["../../../../test/integration/fixtures/ThrowingMainGraph.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAA+C;AAC/C,0DAAoC;AAGpC;IAA+C,qCAAS;IAAxD;;IAKA,CAAC;IAHU,sCAAU,GAAnB;QACE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IAFD;QADC,IAAA,cAAQ,GAAE;;;;uDAGV;IAJkB,iBAAiB;QADrC,IAAA,WAAK,GAAE;OACa,iBAAiB,CAKrC;IAAD,wBAAC;CAAA,AALD,CAA+C,mBAAS,GAKvD;kBALoB,iBAAiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectedValues.d.ts","sourceRoot":"","sources":["../../../../test/integration/fixtures/injectedValues.ts"],"names":[],"mappings":";;;;AAAA,wBAGE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectedValues.js","sourceRoot":"","sources":["../../../../test/integration/fixtures/injectedValues.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,YAAY,EAAE,cAAc;IAC5B,kBAAkB,EAAE,qBAAqB;CAC1C,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import ObjectGraph from '../src/graph/Graph';
|
|
2
|
+
import { Constructable } from '../src/@types/obsidian';
|
|
3
|
+
declare class Index {
|
|
4
|
+
mockGraphs(graphNameToGraph: Record<string, Constructable<ObjectGraph>>): void;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: Index;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../testkit/index.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAOvD,cAAM,KAAK;IACT,UAAU,CAAC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CAYxE;;AAED,wBAA2B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
var GraphMiddleware_1 = require("../src/graph/registry/GraphMiddleware");
|
|
19
|
+
var src_1 = require("../src");
|
|
20
|
+
beforeEach(function () {
|
|
21
|
+
src_1.Obsidian.clearGraphMiddlewares();
|
|
22
|
+
});
|
|
23
|
+
var Index = /** @class */ (function () {
|
|
24
|
+
function Index() {
|
|
25
|
+
}
|
|
26
|
+
Index.prototype.mockGraphs = function (graphNameToGraph) {
|
|
27
|
+
var graphMiddleware = new /** @class */ (function (_super) {
|
|
28
|
+
__extends(class_1, _super);
|
|
29
|
+
function class_1() {
|
|
30
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
31
|
+
}
|
|
32
|
+
class_1.prototype.resolve = function (resolveChain, Graph, props) {
|
|
33
|
+
if (graphNameToGraph[Graph.name]) {
|
|
34
|
+
var TheGraph = graphNameToGraph[Graph.name];
|
|
35
|
+
return new TheGraph(props);
|
|
36
|
+
}
|
|
37
|
+
return resolveChain.proceed(Graph, props);
|
|
38
|
+
};
|
|
39
|
+
return class_1;
|
|
40
|
+
}(GraphMiddleware_1.GraphMiddleware))();
|
|
41
|
+
src_1.Obsidian.addGraphMiddleware(graphMiddleware);
|
|
42
|
+
};
|
|
43
|
+
return Index;
|
|
44
|
+
}());
|
|
45
|
+
exports.default = new Index();
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../testkit/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yEAAsF;AAGtF,8BAAkC;AAElC,UAAU,CAAC;IACT,cAAQ,CAAC,qBAAqB,EAAE,CAAC;AACnC,CAAC,CAAC,CAAC;AAEH;IAAA;IAaA,CAAC;IAZC,0BAAU,GAAV,UAAW,gBAA4D;QACrE,IAAM,eAAe,GAAG;YAAkB,2BAAe;YAA7B;;YAQ5B,CAAC;YAPC,yBAAO,GAAP,UAAsC,YAA0B,EAAE,KAAuB,EAAE,KAAa;gBACtG,IAAI,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;oBAChC,IAAM,QAAQ,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBAC9C,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAiB,CAAC;iBAC5C;gBACD,OAAO,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC5C,CAAC;YACH,cAAC;QAAD,CAAC,AAR2B,CAAc,iCAAe,IAQtD,CAAC;QACJ,cAAQ,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAC/C,CAAC;IACH,YAAC;AAAD,CAAC,AAbD,IAaC;AAED,kBAAe,IAAI,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ClassMethod, Decorator, Identifier, ObjectExpression, ObjectPattern } from '@babel/types';
|
|
2
|
+
export declare function providerIsNotNamed(decorator: Decorator): boolean;
|
|
3
|
+
export declare function addNameToProviderArguments(node: ClassMethod, decorator: Decorator): void;
|
|
4
|
+
export declare function getDecoratorArgument(decorator: Decorator): ObjectExpression | undefined;
|
|
5
|
+
export declare function getMethodName(node: ClassMethod): string;
|
|
6
|
+
export declare function getProviderDecorator(decorators: Array<Decorator> | undefined | null): Decorator | undefined;
|
|
7
|
+
export declare function getDecoratorName(decorator?: Decorator): string | undefined;
|
|
8
|
+
export declare function paramsToDestructuringAssignment(params: (Identifier | any)[]): ObjectPattern;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../transformers/babel-plugin-obsidian-provide/helpers/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,WAAW,EACX,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,aAAa,EACd,MAAM,cAAc,CAAC;AAGtB,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAWhE;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,QAOjF;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,gBAAgB,GAAG,SAAS,CAKvF;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAGvD;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAE3G;AAED,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAE1E;AAED,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,CAAC,UAAU,GAAG,GAAG,CAAC,EAAE,GAAG,aAAa,CAI3F"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paramsToDestructuringAssignment = exports.getDecoratorName = exports.getProviderDecorator = exports.getMethodName = exports.getDecoratorArgument = exports.addNameToProviderArguments = exports.providerIsNotNamed = void 0;
|
|
4
|
+
/* eslint-disable no-param-reassign */
|
|
5
|
+
var core_1 = require("@babel/core");
|
|
6
|
+
var lodash_1 = require("lodash");
|
|
7
|
+
function providerIsNotNamed(decorator) {
|
|
8
|
+
var argument = getDecoratorArgument(decorator);
|
|
9
|
+
if (core_1.types.isObjectExpression(argument)) {
|
|
10
|
+
return argument.properties.find(function (p) {
|
|
11
|
+
if (core_1.types.isObjectProperty(p)) {
|
|
12
|
+
return core_1.types.isIdentifier(p.key) && p.key.name === 'name';
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
}) === undefined;
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
exports.providerIsNotNamed = providerIsNotNamed;
|
|
20
|
+
function addNameToProviderArguments(node, decorator) {
|
|
21
|
+
var _a;
|
|
22
|
+
var argument = (_a = getDecoratorArgument(decorator)) !== null && _a !== void 0 ? _a : core_1.types.objectExpression([]);
|
|
23
|
+
argument.properties.push(core_1.types.objectProperty(core_1.types.identifier('name'), core_1.types.stringLiteral(getMethodName(node))));
|
|
24
|
+
decorator.expression.arguments = [argument];
|
|
25
|
+
}
|
|
26
|
+
exports.addNameToProviderArguments = addNameToProviderArguments;
|
|
27
|
+
function getDecoratorArgument(decorator) {
|
|
28
|
+
if (core_1.types.isCallExpression(decorator.expression)) {
|
|
29
|
+
return decorator.expression.arguments.find(function (a) { return core_1.types.isObjectExpression(a); });
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
exports.getDecoratorArgument = getDecoratorArgument;
|
|
34
|
+
function getMethodName(node) {
|
|
35
|
+
if (core_1.types.isIdentifier(node.key))
|
|
36
|
+
return node.key.name;
|
|
37
|
+
throw new Error("Tried to get class name but encountered unexpected key of type: ".concat(node.key.type));
|
|
38
|
+
}
|
|
39
|
+
exports.getMethodName = getMethodName;
|
|
40
|
+
function getProviderDecorator(decorators) {
|
|
41
|
+
return decorators === null || decorators === void 0 ? void 0 : decorators.find(function (decorator) { return (0, lodash_1.get)(decorator, 'expression.callee.name') === 'Provides'; });
|
|
42
|
+
}
|
|
43
|
+
exports.getProviderDecorator = getProviderDecorator;
|
|
44
|
+
function getDecoratorName(decorator) {
|
|
45
|
+
return (0, lodash_1.get)(decorator, 'expression.callee.name');
|
|
46
|
+
}
|
|
47
|
+
exports.getDecoratorName = getDecoratorName;
|
|
48
|
+
function paramsToDestructuringAssignment(params) {
|
|
49
|
+
return core_1.types.objectPattern(params
|
|
50
|
+
.filter(function (p) { return core_1.types.isIdentifier(p); })
|
|
51
|
+
.map(function (p) { return core_1.types.objectProperty(core_1.types.identifier(p.name), core_1.types.identifier(p.name)); }));
|
|
52
|
+
}
|
|
53
|
+
exports.paramsToDestructuringAssignment = paramsToDestructuringAssignment;
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../transformers/babel-plugin-obsidian-provide/helpers/index.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACtC,oCAAyC;AASzC,iCAA6B;AAE7B,SAAgB,kBAAkB,CAAC,SAAoB;IACrD,IAAM,QAAQ,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACjD,IAAI,YAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE;QAClC,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,UAAC,CAAC;YAChC,IAAI,YAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE;gBACzB,OAAO,YAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC;aACvD;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,KAAK,SAAS,CAAC;KAClB;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAXD,gDAWC;AAED,SAAgB,0BAA0B,CAAC,IAAiB,EAAE,SAAoB;;IAChF,IAAM,QAAQ,GAAG,MAAA,oBAAoB,CAAC,SAAS,CAAC,mCAAI,YAAC,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAC3E,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,YAAC,CAAC,cAAc,CACvC,YAAC,CAAC,UAAU,CAAC,MAAM,CAAC,EACpB,YAAC,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CACrC,CAAC,CAAC;IACF,SAAS,CAAC,UAA6B,CAAC,SAAS,GAAG,CAAC,QAAQ,CAAC,CAAC;AAClE,CAAC;AAPD,gEAOC;AAED,SAAgB,oBAAoB,CAAC,SAAoB;IACvD,IAAI,YAAC,CAAC,gBAAgB,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE;QAC5C,OAAO,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,YAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAvB,CAAuB,CAAqB,CAAC;KAChG;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AALD,oDAKC;AAED,SAAgB,aAAa,CAAC,IAAiB;IAC7C,IAAI,YAAC,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;IACnD,MAAM,IAAI,KAAK,CAAC,0EAAmE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,CAAC;AACtG,CAAC;AAHD,sCAGC;AAED,SAAgB,oBAAoB,CAAC,UAA+C;IAClF,OAAO,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,CAAC,UAAC,SAAS,IAAK,OAAA,IAAA,YAAG,EAAC,SAAS,EAAE,wBAAwB,CAAC,KAAK,UAAU,EAAvD,CAAuD,CAAC,CAAC;AAClG,CAAC;AAFD,oDAEC;AAED,SAAgB,gBAAgB,CAAC,SAAqB;IACpD,OAAO,IAAA,YAAG,EAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC;AAClD,CAAC;AAFD,4CAEC;AAED,SAAgB,+BAA+B,CAAC,MAA4B;IAC1E,OAAO,YAAC,CAAC,aAAa,CAAC,MAAM;SAC1B,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,YAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAjB,CAAiB,CAAC;SAChC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,YAAC,CAAC,cAAc,CAAC,YAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,YAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAA5D,CAA4D,CAAC,CAAC,CAAC;AAC/E,CAAC;AAJD,0EAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../transformers/babel-plugin-obsidian-provide/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,SAAS,EAAE,MAAM,aAAa,CAAC;AAuClD,MAAM,CAAC,OAAO,UAAU,MAAM,gDAE7B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var helpers_1 = require("./helpers");
|
|
4
|
+
var providerArgumentsTransformer = {
|
|
5
|
+
visitor: {
|
|
6
|
+
Program: function (path) {
|
|
7
|
+
path.traverse(internalVisitor);
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
var internalVisitor = {
|
|
12
|
+
ClassMethod: {
|
|
13
|
+
enter: function (_a) {
|
|
14
|
+
var node = _a.node;
|
|
15
|
+
var decorator = (0, helpers_1.getProviderDecorator)(node.decorators);
|
|
16
|
+
if ((0, helpers_1.getDecoratorName)(decorator) === 'Provides') {
|
|
17
|
+
convertProviderParamsToDestructuringAssignment(node);
|
|
18
|
+
saveUnmangledMethodNameInProviderArguments(node, decorator);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
function convertProviderParamsToDestructuringAssignment(node) {
|
|
24
|
+
node.params.fill((0, helpers_1.paramsToDestructuringAssignment)(node.params));
|
|
25
|
+
}
|
|
26
|
+
function saveUnmangledMethodNameInProviderArguments(node, decorator) {
|
|
27
|
+
if ((0, helpers_1.providerIsNotNamed)(decorator)) {
|
|
28
|
+
(0, helpers_1.addNameToProviderArguments)(node, decorator);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function plugin() {
|
|
32
|
+
return providerArgumentsTransformer;
|
|
33
|
+
}
|
|
34
|
+
exports.default = plugin;
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../transformers/babel-plugin-obsidian-provide/index.ts"],"names":[],"mappings":";;AAGA,qCAMmB;AAEnB,IAAM,4BAA4B,GAAc;IAC9C,OAAO,EAAE;QACP,OAAO,EAAP,UAAQ,IAAuB;YAC7B,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QACjC,CAAC;KACF;CACF,CAAC;AAEF,IAAM,eAAe,GAAG;IACtB,WAAW,EAAE;QACX,KAAK,EAAL,UAAM,EAA+B;gBAA7B,IAAI,UAAA;YACV,IAAM,SAAS,GAAG,IAAA,8BAAoB,EAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACxD,IAAI,IAAA,0BAAgB,EAAC,SAAS,CAAC,KAAK,UAAU,EAAE;gBAC9C,8CAA8C,CAAC,IAAI,CAAC,CAAC;gBACrD,0CAA0C,CAAC,IAAI,EAAE,SAAU,CAAC,CAAC;aAC9D;QACH,CAAC;KACF;CACF,CAAC;AAEF,SAAS,8CAA8C,CAAC,IAAiB;IACvE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAA,yCAA+B,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,0CAA0C,CAAC,IAAiB,EAAE,SAAoB;IACzF,IAAI,IAAA,4BAAkB,EAAC,SAAS,CAAC,EAAE;QACjC,IAAA,oCAA0B,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC;KAC7C;AACH,CAAC;AAED,SAAwB,MAAM;IAC5B,OAAO,4BAA4B,CAAC;AACtC,CAAC;AAFD,yBAEC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[ignore]
|
|
2
|
+
; We fork some components by platform
|
|
3
|
+
.*/*[.]android.js
|
|
4
|
+
|
|
5
|
+
; Ignore "BUCK" generated dirs
|
|
6
|
+
<PROJECT_ROOT>/\.buckd/
|
|
7
|
+
|
|
8
|
+
; Ignore polyfills
|
|
9
|
+
node_modules/react-native/Libraries/polyfills/.*
|
|
10
|
+
|
|
11
|
+
; Flow doesn't support platforms
|
|
12
|
+
.*/Libraries/Utilities/LoadingView.js
|
|
13
|
+
|
|
14
|
+
[untyped]
|
|
15
|
+
.*/node_modules/@react-native-community/cli/.*/.*
|
|
16
|
+
|
|
17
|
+
[include]
|
|
18
|
+
|
|
19
|
+
[libs]
|
|
20
|
+
node_modules/react-native/interface.js
|
|
21
|
+
node_modules/react-native/flow/
|
|
22
|
+
|
|
23
|
+
[options]
|
|
24
|
+
emoji=true
|
|
25
|
+
|
|
26
|
+
exact_by_default=true
|
|
27
|
+
|
|
28
|
+
format.bracket_spacing=false
|
|
29
|
+
|
|
30
|
+
module.file_ext=.js
|
|
31
|
+
module.file_ext=.json
|
|
32
|
+
module.file_ext=.ios.js
|
|
33
|
+
|
|
34
|
+
munge_underscores=true
|
|
35
|
+
|
|
36
|
+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
|
|
37
|
+
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
|
|
38
|
+
|
|
39
|
+
suppress_type=$FlowIssue
|
|
40
|
+
suppress_type=$FlowFixMe
|
|
41
|
+
suppress_type=$FlowFixMeProps
|
|
42
|
+
suppress_type=$FlowFixMeState
|
|
43
|
+
|
|
44
|
+
[lints]
|
|
45
|
+
sketchy-null-number=warn
|
|
46
|
+
sketchy-null-mixed=warn
|
|
47
|
+
sketchy-number=warn
|
|
48
|
+
untyped-type-import=warn
|
|
49
|
+
nonstrict-import=warn
|
|
50
|
+
deprecated-type=warn
|
|
51
|
+
unsafe-getters-setters=warn
|
|
52
|
+
unnecessary-invariant=warn
|
|
53
|
+
signature-verification-failure=warn
|
|
54
|
+
|
|
55
|
+
[strict]
|
|
56
|
+
deprecated-type
|
|
57
|
+
nonstrict-import
|
|
58
|
+
sketchy-null
|
|
59
|
+
unclear-type
|
|
60
|
+
unsafe-getters-setters
|
|
61
|
+
untyped-import
|
|
62
|
+
untyped-type-import
|
|
63
|
+
|
|
64
|
+
[version]
|
|
65
|
+
^0.158.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|