@teambit/harmony 0.0.0-19ea14143ef7d5f4e4daa6e8ac8a8c97c9d683d5
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/aspect.ts +52 -0
- package/config/config.ts +36 -0
- package/config/index.ts +1 -0
- package/container.ts +22 -0
- package/dist/aspect.d.ts +27 -0
- package/dist/aspect.js +33 -0
- package/dist/aspect.js.map +1 -0
- package/dist/config/config.d.ts +22 -0
- package/dist/config/config.js +37 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/container.d.ts +8 -0
- package/dist/container.js +22 -0
- package/dist/container.js.map +1 -0
- package/dist/exceptions/extension-init-error.d.ts +2 -0
- package/dist/exceptions/extension-init-error.js +7 -0
- package/dist/exceptions/extension-init-error.js.map +1 -0
- package/dist/exceptions/extension-load-error.d.ts +29 -0
- package/dist/exceptions/extension-load-error.js +29 -0
- package/dist/exceptions/extension-load-error.js.map +1 -0
- package/dist/exceptions/extension-potential-circular.d.ts +22 -0
- package/dist/exceptions/extension-potential-circular.js +25 -0
- package/dist/exceptions/extension-potential-circular.js.map +1 -0
- package/dist/exceptions/harmony-already-running.d.ts +2 -0
- package/dist/exceptions/harmony-already-running.js +7 -0
- package/dist/exceptions/harmony-already-running.js.map +1 -0
- package/dist/exceptions/harmony-error.d.ts +2 -0
- package/dist/exceptions/harmony-error.js +7 -0
- package/dist/exceptions/harmony-error.js.map +1 -0
- package/dist/exceptions/hook-not-found.d.ts +2 -0
- package/dist/exceptions/hook-not-found.js +7 -0
- package/dist/exceptions/hook-not-found.js.map +1 -0
- package/dist/exceptions/index.d.ts +5 -0
- package/dist/exceptions/index.js +17 -0
- package/dist/exceptions/index.js.map +1 -0
- package/dist/exceptions/runtime-not-defined.d.ts +0 -0
- package/dist/exceptions/runtime-not-defined.js +1 -0
- package/dist/exceptions/runtime-not-defined.js.map +1 -0
- package/dist/extension/any-extension.d.ts +5 -0
- package/dist/extension/any-extension.js +8 -0
- package/dist/extension/any-extension.js.map +1 -0
- package/dist/extension/decorator.d.ts +27 -0
- package/dist/extension/decorator.js +109 -0
- package/dist/extension/decorator.js.map +1 -0
- package/dist/extension/extension-manifest.d.ts +41 -0
- package/dist/extension/extension-manifest.js +3 -0
- package/dist/extension/extension-manifest.js.map +1 -0
- package/dist/extension/extension.d.ts +50 -0
- package/dist/extension/extension.js +128 -0
- package/dist/extension/extension.js.map +1 -0
- package/dist/extension/index.d.ts +3 -0
- package/dist/extension/index.js +13 -0
- package/dist/extension/index.js.map +1 -0
- package/dist/extension-graph/extension-graph.d.ts +34 -0
- package/dist/extension-graph/extension-graph.js +152 -0
- package/dist/extension-graph/extension-graph.js.map +1 -0
- package/dist/extension-graph/from-extension.d.ts +31 -0
- package/dist/extension-graph/from-extension.js +63 -0
- package/dist/extension-graph/from-extension.js.map +1 -0
- package/dist/extension-graph/index.d.ts +1 -0
- package/dist/extension-graph/index.js +9 -0
- package/dist/extension-graph/index.js.map +1 -0
- package/dist/factory/extension-factory.d.ts +3 -0
- package/dist/factory/extension-factory.js +11 -0
- package/dist/factory/extension-factory.js.map +1 -0
- package/dist/factory/index.d.ts +1 -0
- package/dist/factory/index.js +6 -0
- package/dist/factory/index.js.map +1 -0
- package/dist/fixtures/aspects/babel/babel.aspect.d.ts +5 -0
- package/dist/fixtures/aspects/babel/babel.aspect.js +13 -0
- package/dist/fixtures/aspects/babel/babel.aspect.js.map +1 -0
- package/dist/fixtures/aspects/babel/babel.cli.d.ts +5 -0
- package/dist/fixtures/aspects/babel/babel.cli.js +28 -0
- package/dist/fixtures/aspects/babel/babel.cli.js.map +1 -0
- package/dist/fixtures/aspects/react/react.aspect.d.ts +6 -0
- package/dist/fixtures/aspects/react/react.aspect.js +19 -0
- package/dist/fixtures/aspects/react/react.aspect.js.map +1 -0
- package/dist/fixtures/aspects/react/react.cli.d.ts +11 -0
- package/dist/fixtures/aspects/react/react.cli.js +71 -0
- package/dist/fixtures/aspects/react/react.cli.js.map +1 -0
- package/dist/fixtures/aspects/react/react.ui.d.ts +5 -0
- package/dist/fixtures/aspects/react/react.ui.js +31 -0
- package/dist/fixtures/aspects/react/react.ui.js.map +1 -0
- package/dist/fixtures/aspects/ui/ui.aspect.d.ts +4 -0
- package/dist/fixtures/aspects/ui/ui.aspect.js +15 -0
- package/dist/fixtures/aspects/ui/ui.aspect.js.map +1 -0
- package/dist/fixtures/aspects/ui/ui.ui.d.ts +4 -0
- package/dist/fixtures/aspects/ui/ui.ui.js +24 -0
- package/dist/fixtures/aspects/ui/ui.ui.js.map +1 -0
- package/dist/fixtures/babel/babel.extension.d.ts +9 -0
- package/dist/fixtures/babel/babel.extension.js +30 -0
- package/dist/fixtures/babel/babel.extension.js.map +1 -0
- package/dist/fixtures/babel/index.d.ts +0 -0
- package/dist/fixtures/babel/index.js +1 -0
- package/dist/fixtures/babel/index.js.map +1 -0
- package/dist/fixtures/base-compiler/base-compiler.extension.d.ts +13 -0
- package/dist/fixtures/base-compiler/base-compiler.extension.js +30 -0
- package/dist/fixtures/base-compiler/base-compiler.extension.js.map +1 -0
- package/dist/fixtures/base-compiler/index.d.ts +1 -0
- package/dist/fixtures/base-compiler/index.js +6 -0
- package/dist/fixtures/base-compiler/index.js.map +1 -0
- package/dist/fixtures/cli/cli.extension.d.ts +18 -0
- package/dist/fixtures/cli/cli.extension.js +24 -0
- package/dist/fixtures/cli/cli.extension.js.map +1 -0
- package/dist/fixtures/cli/command.d.ts +6 -0
- package/dist/fixtures/cli/command.js +1 -0
- package/dist/fixtures/cli/command.js.map +1 -0
- package/dist/fixtures/cli/index.d.ts +1 -0
- package/dist/fixtures/cli/index.js +18 -0
- package/dist/fixtures/cli/index.js.map +1 -0
- package/dist/fixtures/typescript/index.d.ts +0 -0
- package/dist/fixtures/typescript/index.js +1 -0
- package/dist/fixtures/typescript/index.js.map +1 -0
- package/dist/fixtures/typescript/typescript.d.ts +7 -0
- package/dist/fixtures/typescript/typescript.js +31 -0
- package/dist/fixtures/typescript/typescript.js.map +1 -0
- package/dist/harmony-config/config-reader.d.ts +1 -0
- package/dist/harmony-config/config-reader.js +21 -0
- package/dist/harmony-config/config-reader.js.map +1 -0
- package/dist/harmony-config/exceptions/index.d.ts +1 -0
- package/dist/harmony-config/exceptions/index.js +6 -0
- package/dist/harmony-config/exceptions/index.js.map +1 -0
- package/dist/harmony-config/exceptions/read-config-error.d.ts +5 -0
- package/dist/harmony-config/exceptions/read-config-error.js +14 -0
- package/dist/harmony-config/exceptions/read-config-error.js.map +1 -0
- package/dist/harmony-config/harmony-config.d.ts +17 -0
- package/dist/harmony-config/harmony-config.js +36 -0
- package/dist/harmony-config/harmony-config.js.map +1 -0
- package/dist/harmony-config/index.d.ts +1 -0
- package/dist/harmony-config/index.js +6 -0
- package/dist/harmony-config/index.js.map +1 -0
- package/dist/harmony-config/locator.d.ts +0 -0
- package/dist/harmony-config/locator.js +1 -0
- package/dist/harmony-config/locator.js.map +1 -0
- package/dist/harmony.d.ts +63 -0
- package/dist/harmony.docs.mdx +250 -0
- package/dist/harmony.js +151 -0
- package/dist/harmony.js.map +1 -0
- package/dist/harmony.spec.old.d.ts +1 -0
- package/dist/harmony.spec.old.js +144 -0
- package/dist/harmony.spec.old.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/preview-1782314412027.js +7 -0
- package/dist/readme.md +80 -0
- package/dist/runtimes/exceptions/index.d.ts +2 -0
- package/dist/runtimes/exceptions/index.js +8 -0
- package/dist/runtimes/exceptions/index.js.map +1 -0
- package/dist/runtimes/exceptions/runtime-module-error.d.ts +5 -0
- package/dist/runtimes/exceptions/runtime-module-error.js +14 -0
- package/dist/runtimes/exceptions/runtime-module-error.js.map +1 -0
- package/dist/runtimes/exceptions/runtime-not-defined.d.ts +3 -0
- package/dist/runtimes/exceptions/runtime-not-defined.js +8 -0
- package/dist/runtimes/exceptions/runtime-not-defined.js.map +1 -0
- package/dist/runtimes/index.d.ts +3 -0
- package/dist/runtimes/index.js +8 -0
- package/dist/runtimes/index.js.map +1 -0
- package/dist/runtimes/runtime-definition.d.ts +11 -0
- package/dist/runtimes/runtime-definition.js +27 -0
- package/dist/runtimes/runtime-definition.js.map +1 -0
- package/dist/runtimes/runtime-manifest.d.ts +13 -0
- package/dist/runtimes/runtime-manifest.js +3 -0
- package/dist/runtimes/runtime-manifest.js.map +1 -0
- package/dist/runtimes/runtimes.d.ts +14 -0
- package/dist/runtimes/runtimes.js +43 -0
- package/dist/runtimes/runtimes.js.map +1 -0
- package/dist/slots/index.d.ts +2 -0
- package/dist/slots/index.js +8 -0
- package/dist/slots/index.js.map +1 -0
- package/dist/slots/registry.d.ts +21 -0
- package/dist/slots/registry.js +36 -0
- package/dist/slots/registry.js.map +1 -0
- package/dist/slots/slot.d.ts +5 -0
- package/dist/slots/slot.js +13 -0
- package/dist/slots/slot.js.map +1 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/async-for-each.d.ts +5 -0
- package/dist/utils/async-for-each.js +25 -0
- package/dist/utils/async-for-each.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/exceptions/extension-init-error.ts +1 -0
- package/exceptions/extension-load-error.ts +28 -0
- package/exceptions/extension-potential-circular.ts +24 -0
- package/exceptions/harmony-already-running.ts +1 -0
- package/exceptions/harmony-error.ts +1 -0
- package/exceptions/hook-not-found.ts +1 -0
- package/exceptions/index.ts +5 -0
- package/exceptions/runtime-not-defined.ts +0 -0
- package/extension/any-extension.ts +8 -0
- package/extension/decorator.ts +126 -0
- package/extension/extension-manifest.ts +51 -0
- package/extension/extension.ts +142 -0
- package/extension/index.ts +3 -0
- package/extension-graph/extension-graph.ts +165 -0
- package/extension-graph/from-extension.ts +72 -0
- package/extension-graph/index.ts +1 -0
- package/factory/extension-factory.ts +8 -0
- package/factory/index.ts +1 -0
- package/fixtures/aspects/babel/babel.aspect.ts +14 -0
- package/fixtures/aspects/babel/babel.cli.ts +16 -0
- package/fixtures/aspects/react/react.aspect.ts +22 -0
- package/fixtures/aspects/react/react.cli.ts +26 -0
- package/fixtures/aspects/react/react.ui.ts +16 -0
- package/fixtures/aspects/ui/ui.aspect.ts +13 -0
- package/fixtures/aspects/ui/ui.ui.ts +11 -0
- package/fixtures/babel/babel.extension.ts +20 -0
- package/fixtures/babel/index.ts +0 -0
- package/fixtures/base-compiler/base-compiler.extension.ts +31 -0
- package/fixtures/base-compiler/index.ts +1 -0
- package/fixtures/cli/cli.extension.ts +25 -0
- package/fixtures/cli/command.ts +6 -0
- package/fixtures/cli/index.ts +1 -0
- package/fixtures/typescript/index.ts +0 -0
- package/fixtures/typescript/typescript.ts +20 -0
- package/harmony-config/config-reader.ts +18 -0
- package/harmony-config/exceptions/index.ts +1 -0
- package/harmony-config/exceptions/read-config-error.ts +9 -0
- package/harmony-config/harmony-config.ts +49 -0
- package/harmony-config/index.ts +1 -0
- package/harmony-config/locator.ts +0 -0
- package/harmony.docs.mdx +250 -0
- package/harmony.spec.old.ts +177 -0
- package/harmony.ts +148 -0
- package/index.ts +13 -0
- package/package.json +68 -0
- package/readme.md +80 -0
- package/runtimes/exceptions/index.ts +2 -0
- package/runtimes/exceptions/runtime-module-error.ts +9 -0
- package/runtimes/exceptions/runtime-not-defined.ts +5 -0
- package/runtimes/index.ts +3 -0
- package/runtimes/runtime-definition.ts +32 -0
- package/runtimes/runtime-manifest.ts +12 -0
- package/runtimes/runtimes.ts +34 -0
- package/slots/index.ts +2 -0
- package/slots/registry.ts +36 -0
- package/slots/slot.ts +11 -0
- package/types/asset.d.ts +29 -0
- package/types/style.d.ts +42 -0
- package/types.ts +7 -0
- package/utils/async-for-each.ts +10 -0
- package/utils/index.ts +1 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HookRegistry = void 0;
|
|
4
|
+
exports.ExtensionDecorator = ExtensionDecorator;
|
|
5
|
+
exports.provider = provider;
|
|
6
|
+
exports.register = register;
|
|
7
|
+
exports.createHook = createHook;
|
|
8
|
+
exports.hook = hook;
|
|
9
|
+
const map = {};
|
|
10
|
+
/**
|
|
11
|
+
* decorator for an Harmony extension.
|
|
12
|
+
*/
|
|
13
|
+
function ExtensionDecorator({ name, dependencies } = {}) {
|
|
14
|
+
function classDecorator(constructor) {
|
|
15
|
+
Reflect.defineMetadata('harmony:name', name || constructor.name, constructor);
|
|
16
|
+
Reflect.defineMetadata('harmony:dependencies', calculateDependnecies(constructor, dependencies), constructor);
|
|
17
|
+
}
|
|
18
|
+
return classDecorator;
|
|
19
|
+
}
|
|
20
|
+
function provider() {
|
|
21
|
+
return function (target, propertyKey, descriptor) {
|
|
22
|
+
const keys = Reflect.getMetadata('design:paramtypes', descriptor);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
// @hack todo: must be defined and assigned from a single location
|
|
26
|
+
function providerFn(classExtension) {
|
|
27
|
+
return classExtension.provide ? classExtension.provide : classExtension.provider;
|
|
28
|
+
}
|
|
29
|
+
function calculateDependnecies(classExtension, deps) {
|
|
30
|
+
function fromMetadata() {
|
|
31
|
+
const provider = providerFn(classExtension);
|
|
32
|
+
if (provider) {
|
|
33
|
+
// // TODO: check why Reflect.getMetadataKeys(provider) is empty and how to access method param types.
|
|
34
|
+
// console.log(Reflect.getMetadataKeys(classExtension.provide))
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
return Reflect.getMetadata('design:paramtypes', classExtension);
|
|
38
|
+
}
|
|
39
|
+
const dependnecies = deps ? deps : fromMetadata() || [];
|
|
40
|
+
const hookDeps = classExtension.__hookDeps ? classExtension.__hookDeps : [];
|
|
41
|
+
return dependnecies.concat(hookDeps) || [];
|
|
42
|
+
}
|
|
43
|
+
// :TODO refactor this asap to handle harmony objects properly
|
|
44
|
+
function register(extension, name) {
|
|
45
|
+
return function (target, propertyKey, descriptor) {
|
|
46
|
+
// if (!target.constructor.__hookDeps) Reflect.defineMetadata('harmony:subscriptions', [extension], target.constructor);
|
|
47
|
+
// else target.constructor.__hookDeps.push(extension);
|
|
48
|
+
const extensionName = Reflect.getMetadata('harmony:name', extension);
|
|
49
|
+
if (!map[extensionName]) {
|
|
50
|
+
map[extensionName] = {};
|
|
51
|
+
}
|
|
52
|
+
const hook = map[extensionName][name || propertyKey];
|
|
53
|
+
// if (!hook) throw new HookNotFound();
|
|
54
|
+
if (!hook)
|
|
55
|
+
return;
|
|
56
|
+
hook.register(target[propertyKey]);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function createHook() {
|
|
60
|
+
const randomId = Math.random().toString(36).substring(2);
|
|
61
|
+
map[randomId] = HookRegistry.create();
|
|
62
|
+
const decorator = function (target, propertyKey, descriptor) {
|
|
63
|
+
const registry = map[randomId];
|
|
64
|
+
registry.register(descriptor.value);
|
|
65
|
+
};
|
|
66
|
+
decorator.hash = randomId;
|
|
67
|
+
return decorator;
|
|
68
|
+
}
|
|
69
|
+
function hook(name) {
|
|
70
|
+
return function (target, propertyKey) {
|
|
71
|
+
let instance = HookRegistry.create();
|
|
72
|
+
const extensionName = Reflect.getMetadata('harmony:name', target.constructor);
|
|
73
|
+
const hookName = name || propertyKey;
|
|
74
|
+
if (!map[extensionName])
|
|
75
|
+
map[extensionName] = { [hookName]: instance };
|
|
76
|
+
else
|
|
77
|
+
map[extensionName][hookName] = instance;
|
|
78
|
+
Object.defineProperty(target, propertyKey, {
|
|
79
|
+
get: () => {
|
|
80
|
+
return instance;
|
|
81
|
+
},
|
|
82
|
+
set: (value) => {
|
|
83
|
+
instance = value;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
class HookRegistry {
|
|
89
|
+
constructor(fillers, hash) {
|
|
90
|
+
this.fillers = fillers;
|
|
91
|
+
this.hash = hash;
|
|
92
|
+
}
|
|
93
|
+
register(filler) {
|
|
94
|
+
this.fillers.push(filler);
|
|
95
|
+
}
|
|
96
|
+
list() {
|
|
97
|
+
// return map[this.name][name] || [];
|
|
98
|
+
return this.fillers;
|
|
99
|
+
}
|
|
100
|
+
static of(hook) {
|
|
101
|
+
return map[hook.hash];
|
|
102
|
+
}
|
|
103
|
+
// hack due to https://github.com/microsoft/TypeScript/issues/4881
|
|
104
|
+
static create() {
|
|
105
|
+
return new HookRegistry([]);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.HookRegistry = HookRegistry;
|
|
109
|
+
//# sourceMappingURL=decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator.js","sourceRoot":"","sources":["../../extension/decorator.ts"],"names":[],"mappings":";;;AAcA,gDAOC;AAED,4BAIC;AAyBD,4BAeC;AAED,gCAWC;AAED,oBAkBC;AA3FD,MAAM,GAAG,GAAQ,EAAE,CAAC;AAEpB;;GAEG;AACH,SAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,YAAY,KAAuB,EAAE;IAC9E,SAAS,cAAc,CAAqC,WAAa;QACvE,OAAO,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,IAAI,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC9E,OAAO,CAAC,cAAc,CAAC,sBAAsB,EAAE,qBAAqB,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,WAAW,CAAC,CAAA;IAC/G,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,SAAgB,QAAQ;IACtB,OAAO,UAAS,MAAW,EAAE,WAAmB,EAAE,UAA8B;QAC9E,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;IACpE,CAAC,CAAA;AACH,CAAC;AAED,kEAAkE;AAClE,SAAS,UAAU,CAAC,cA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AA;AACH,CAAC;AAED,MAAa,YAAY;IACvB,YACU,OAAY,EACX,IAAa;QADd,YAAO,GAAP,OAAO,CAAK;QACX,SAAI,GAAJ,IAAI,CAAS;IACrB,CAAC;IAEJ,QAAQ,CAAC,MAAS;QAChB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED,IAAI;QACF,qCAAqC;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,MAAM,CAAC,EAAE,CAAI,IAAS;QACpB,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,kEAAkE;IAClE,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,YAAY,CAAI,EAAE,CAAC,CAAC;IACjC,CAAC;CACF;AAvBD,oCAuBC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ProviderFn } from '../types';
|
|
2
|
+
import { SlotProvider } from '../slots';
|
|
3
|
+
export type ExtensionManifest = {
|
|
4
|
+
/**
|
|
5
|
+
* extension name.
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* extension unique ID.
|
|
10
|
+
*/
|
|
11
|
+
id?: string;
|
|
12
|
+
/**
|
|
13
|
+
* version of the extension
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* array of extension dependencies.
|
|
17
|
+
* these other extensions will be installed and resolved prior to this extension activation.
|
|
18
|
+
*/
|
|
19
|
+
dependencies?: ExtensionManifest[];
|
|
20
|
+
/**
|
|
21
|
+
* reference to the extension factory function.
|
|
22
|
+
*/
|
|
23
|
+
provider?: ProviderFn;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* default config of the extension.
|
|
27
|
+
*/
|
|
28
|
+
defaultConfig?: object;
|
|
29
|
+
/**
|
|
30
|
+
* alias to provider.
|
|
31
|
+
*/
|
|
32
|
+
provide?: ProviderFn;
|
|
33
|
+
/**
|
|
34
|
+
* array of slots the extension is exposing.
|
|
35
|
+
*/
|
|
36
|
+
slots?: SlotProvider<unknown>[];
|
|
37
|
+
/**
|
|
38
|
+
* any further keys which might be expected by other extensions.
|
|
39
|
+
*/
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-manifest.js","sourceRoot":"","sources":["../../extension/extension-manifest.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ProviderFn } from '../types';
|
|
2
|
+
import { Harmony } from '../harmony';
|
|
3
|
+
import { ExtensionManifest } from './extension-manifest';
|
|
4
|
+
import { RuntimeDefinition } from '../runtimes';
|
|
5
|
+
export type ExtensionProps = {
|
|
6
|
+
name: string;
|
|
7
|
+
dependencies: any[];
|
|
8
|
+
provider: ProviderFn;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* harmony's extension definition. this can be used to define and extend `Harmony` applications.
|
|
12
|
+
*/
|
|
13
|
+
export declare class Extension {
|
|
14
|
+
/**
|
|
15
|
+
* manifest of the extension.
|
|
16
|
+
*/
|
|
17
|
+
readonly manifest: ExtensionManifest;
|
|
18
|
+
constructor(
|
|
19
|
+
/**
|
|
20
|
+
* manifest of the extension.
|
|
21
|
+
*/
|
|
22
|
+
manifest: ExtensionManifest);
|
|
23
|
+
private _instance;
|
|
24
|
+
private _loaded;
|
|
25
|
+
/**
|
|
26
|
+
* returns the instance of the extension
|
|
27
|
+
*/
|
|
28
|
+
get instance(): any;
|
|
29
|
+
get name(): any;
|
|
30
|
+
get id(): any;
|
|
31
|
+
get dependencies(): Extension[];
|
|
32
|
+
get provider(): any;
|
|
33
|
+
get files(): any;
|
|
34
|
+
/**
|
|
35
|
+
* returns an indication of the extension already loaded (the provider run)
|
|
36
|
+
* We don't rely on the instance since an extension provider might return null
|
|
37
|
+
*/
|
|
38
|
+
get loaded(): boolean;
|
|
39
|
+
toString(): string;
|
|
40
|
+
private buildSlotRegistries;
|
|
41
|
+
get declareRuntime(): any;
|
|
42
|
+
getRuntime(runtime: RuntimeDefinition): any;
|
|
43
|
+
getRuntimes(): any;
|
|
44
|
+
getSlots(extensionRuntime: any): any;
|
|
45
|
+
getConfig(context: Harmony, extensionRuntime: any): any;
|
|
46
|
+
/**
|
|
47
|
+
* initiate Harmony in run-time.
|
|
48
|
+
*/
|
|
49
|
+
__run(dependencies: any[], context: Harmony, runtime: RuntimeDefinition): Promise<any>;
|
|
50
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Extension = void 0;
|
|
13
|
+
const extension_init_error_1 = require("../exceptions/extension-init-error");
|
|
14
|
+
/**
|
|
15
|
+
* harmony's extension definition. this can be used to define and extend `Harmony` applications.
|
|
16
|
+
*/
|
|
17
|
+
class Extension {
|
|
18
|
+
constructor(
|
|
19
|
+
/**
|
|
20
|
+
* manifest of the extension.
|
|
21
|
+
*/
|
|
22
|
+
manifest) {
|
|
23
|
+
this.manifest = manifest;
|
|
24
|
+
this._instance = null;
|
|
25
|
+
this._loaded = false;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* returns the instance of the extension
|
|
29
|
+
*/
|
|
30
|
+
get instance() {
|
|
31
|
+
return this._instance;
|
|
32
|
+
}
|
|
33
|
+
get name() {
|
|
34
|
+
const metadata = Reflect.getMetadata('harmony:name', this.manifest);
|
|
35
|
+
return metadata || this.manifest.id || this.manifest.name;
|
|
36
|
+
}
|
|
37
|
+
get id() {
|
|
38
|
+
return this.name;
|
|
39
|
+
}
|
|
40
|
+
get dependencies() {
|
|
41
|
+
const metadata = Reflect.getMetadata('harmony:dependencies', this.manifest);
|
|
42
|
+
return metadata || this.manifest.dependencies || [];
|
|
43
|
+
}
|
|
44
|
+
get provider() {
|
|
45
|
+
const metadata = Reflect.getMetadata('harmony:provider', this.manifest);
|
|
46
|
+
return metadata || this.manifest.provider;
|
|
47
|
+
}
|
|
48
|
+
get files() {
|
|
49
|
+
return this.manifest.files;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* returns an indication of the extension already loaded (the provider run)
|
|
53
|
+
* We don't rely on the instance since an extension provider might return null
|
|
54
|
+
*/
|
|
55
|
+
get loaded() {
|
|
56
|
+
return this._loaded;
|
|
57
|
+
}
|
|
58
|
+
toString() {
|
|
59
|
+
return JSON.stringify(this.name);
|
|
60
|
+
}
|
|
61
|
+
buildSlotRegistries(slots, context) {
|
|
62
|
+
return slots.map((slot) => {
|
|
63
|
+
return slot(() => {
|
|
64
|
+
return context.current;
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
get declareRuntime() {
|
|
69
|
+
return this.manifest.declareRuntime;
|
|
70
|
+
}
|
|
71
|
+
getRuntime(runtime) {
|
|
72
|
+
return this.manifest.getRuntime(runtime);
|
|
73
|
+
}
|
|
74
|
+
getRuntimes() {
|
|
75
|
+
return this.manifest.getRuntimes();
|
|
76
|
+
}
|
|
77
|
+
getSlots(extensionRuntime) {
|
|
78
|
+
if (extensionRuntime.slots && extensionRuntime.slots.length) {
|
|
79
|
+
return extensionRuntime.slots;
|
|
80
|
+
}
|
|
81
|
+
return this.manifest.slots || [];
|
|
82
|
+
}
|
|
83
|
+
getConfig(context, extensionRuntime) {
|
|
84
|
+
const defaultConfig = extensionRuntime.defaultConfig || this.manifest.defaultConfig || {};
|
|
85
|
+
const config = context.config.get(this.name) || {};
|
|
86
|
+
return Object.assign({}, defaultConfig, config);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* initiate Harmony in run-time.
|
|
90
|
+
*/
|
|
91
|
+
__run(dependencies, context, runtime) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const name = this.name;
|
|
94
|
+
context.initExtension(name);
|
|
95
|
+
const extensionRuntime = this.getRuntime(runtime);
|
|
96
|
+
if (!extensionRuntime) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
const registries = this.buildSlotRegistries(this.getSlots(extensionRuntime), context);
|
|
101
|
+
const config = this.getConfig(context, extensionRuntime);
|
|
102
|
+
if (!this.loaded) {
|
|
103
|
+
if (extensionRuntime.provider)
|
|
104
|
+
this._instance = yield extensionRuntime.provider(dependencies, config, registries, context);
|
|
105
|
+
else {
|
|
106
|
+
try {
|
|
107
|
+
// @ts-ignore
|
|
108
|
+
this._instance = new extensionRuntime.manifest(...dependencies);
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
throw new extension_init_error_1.ExtensionInstantiationException(err instanceof Error ? err.toString() : String(err));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
;
|
|
115
|
+
// @ts-ignore adding the extension ID to the instance.
|
|
116
|
+
// this._instance.id = this.manifest.name;
|
|
117
|
+
// @ts-ignore adding the extension ID to the instance.
|
|
118
|
+
// this._instance.config = config;
|
|
119
|
+
this._loaded = true;
|
|
120
|
+
return this._instance;
|
|
121
|
+
}
|
|
122
|
+
context.endExtension();
|
|
123
|
+
return Promise.resolve(this.instance);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.Extension = Extension;
|
|
128
|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QAAQ,CAAC,CAAC;QACxC,CAAC;KAAA;CACF;AA7HD,8BA6HC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createHook = exports.provider = exports.HookRegistry = exports.hook = exports.register = exports.ExtensionDecorator = exports.Extension = void 0;
|
|
4
|
+
var extension_1 = require("./extension");
|
|
5
|
+
Object.defineProperty(exports, "Extension", { enumerable: true, get: function () { return extension_1.Extension; } });
|
|
6
|
+
var decorator_1 = require("./decorator");
|
|
7
|
+
Object.defineProperty(exports, "ExtensionDecorator", { enumerable: true, get: function () { return decorator_1.ExtensionDecorator; } });
|
|
8
|
+
Object.defineProperty(exports, "register", { enumerable: true, get: function () { return decorator_1.register; } });
|
|
9
|
+
Object.defineProperty(exports, "hook", { enumerable: true, get: function () { return decorator_1.hook; } });
|
|
10
|
+
Object.defineProperty(exports, "HookRegistry", { enumerable: true, get: function () { return decorator_1.HookRegistry; } });
|
|
11
|
+
Object.defineProperty(exports, "provider", { enumerable: true, get: function () { return decorator_1.provider; } });
|
|
12
|
+
Object.defineProperty(exports, "createHook", { enumerable: true, get: function () { return decorator_1.createHook; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../extension/index.ts"],"names":[],"mappings":";;;AAAA,yCAAwD;AAA/C,sGAAA,SAAS,OAAA;AAElB,yCAAqG;AAA5F,+GAAA,kBAAkB,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAAE,iGAAA,IAAI,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAAE,uGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Graph } from 'cleargraph';
|
|
2
|
+
import { ExtensionManifest } from '../extension';
|
|
3
|
+
import { Extension } from '../extension';
|
|
4
|
+
import { RuntimeDefinition, Runtimes } from '../runtimes';
|
|
5
|
+
import { RequireFn } from '../harmony';
|
|
6
|
+
export type DependencyGraphOptions = {
|
|
7
|
+
getName?: (manifest: any) => string;
|
|
8
|
+
};
|
|
9
|
+
export type Edge = {
|
|
10
|
+
type: string;
|
|
11
|
+
runtime?: string;
|
|
12
|
+
};
|
|
13
|
+
export default class DependencyGraph extends Graph<Extension, Edge> {
|
|
14
|
+
private cache;
|
|
15
|
+
getRuntimeDependencies(aspect: Extension, runtime: RuntimeDefinition, options?: DependencyGraphOptions): Extension[];
|
|
16
|
+
private sortDeps;
|
|
17
|
+
byExecutionOrder(): Extension[];
|
|
18
|
+
private enrichRuntimeExtension;
|
|
19
|
+
enrichRuntime(runtime: RuntimeDefinition, runtimes: Runtimes, requireFn: RequireFn, options?: DependencyGraphOptions): Promise<any[][]>;
|
|
20
|
+
add(manifest: ExtensionManifest): this;
|
|
21
|
+
load(extensions: ExtensionManifest[]): this;
|
|
22
|
+
getExtension(manifest: ExtensionManifest): Extension;
|
|
23
|
+
get extensions(): ExtensionManifest[];
|
|
24
|
+
get aspects(): ExtensionManifest[];
|
|
25
|
+
get(id: string): any;
|
|
26
|
+
/**
|
|
27
|
+
* build Harmony from a single extension.
|
|
28
|
+
*/
|
|
29
|
+
static fromRoot(extension: ExtensionManifest): DependencyGraph;
|
|
30
|
+
/**
|
|
31
|
+
* build Harmony from set of extensions
|
|
32
|
+
*/
|
|
33
|
+
static from(extensions: ExtensionManifest[], options?: DependencyGraphOptions): DependencyGraph;
|
|
34
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const cleargraph_1 = require("cleargraph");
|
|
13
|
+
const from_extension_1 = require("./from-extension");
|
|
14
|
+
function getName(manifest) {
|
|
15
|
+
return Reflect.getMetadata('harmony:name', manifest) || manifest.id || manifest.name;
|
|
16
|
+
}
|
|
17
|
+
class DependencyGraph extends cleargraph_1.Graph {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.cache = new Map();
|
|
21
|
+
}
|
|
22
|
+
getRuntimeDependencies(aspect, runtime, options = {}) {
|
|
23
|
+
const dependencies = this.successors(aspect.name);
|
|
24
|
+
const runtimeDeps = this.successors(aspect.name, (edge) => {
|
|
25
|
+
if (!edge.runtime)
|
|
26
|
+
return false;
|
|
27
|
+
return edge.runtime === runtime.name;
|
|
28
|
+
});
|
|
29
|
+
const runtimeManifest = aspect.getRuntime(runtime);
|
|
30
|
+
if (!runtimeManifest)
|
|
31
|
+
return Array.from(dependencies.values());
|
|
32
|
+
if (runtimeDeps && runtimeDeps.size)
|
|
33
|
+
return this.sortDeps(runtimeManifest.dependencies, Array.from(runtimeDeps.values()), options);
|
|
34
|
+
return this.sortDeps(runtimeManifest.dependencies, Array.from(dependencies.values()), options);
|
|
35
|
+
}
|
|
36
|
+
sortDeps(originalDependencies, targetDependencies, options = {}) {
|
|
37
|
+
const _originalDependencies = options.getName ? (originalDependencies === null || originalDependencies === void 0 ? void 0 : originalDependencies.map((aspect) => {
|
|
38
|
+
if (!options.getName)
|
|
39
|
+
return aspect;
|
|
40
|
+
aspect.id = options.getName(aspect);
|
|
41
|
+
return aspect;
|
|
42
|
+
})) || [] : originalDependencies;
|
|
43
|
+
return targetDependencies.sort((a, b) => {
|
|
44
|
+
return _originalDependencies.findIndex(item => item.id === a.id) - _originalDependencies.findIndex(item => item.id === b.id);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
byExecutionOrder() {
|
|
48
|
+
return this.toposort(true);
|
|
49
|
+
}
|
|
50
|
+
enrichRuntimeExtension(id_1, aspect_1, runtime_1, runtimes_1, requireFn_1) {
|
|
51
|
+
return __awaiter(this, arguments, void 0, function* (id, aspect, runtime, runtimes, requireFn, options = {}) {
|
|
52
|
+
yield requireFn(aspect, runtime);
|
|
53
|
+
const runtimeManifest = aspect.getRuntime(runtime);
|
|
54
|
+
if (!runtimeManifest)
|
|
55
|
+
return;
|
|
56
|
+
const deps = runtimeManifest.dependencies;
|
|
57
|
+
if (!deps)
|
|
58
|
+
return;
|
|
59
|
+
const promises = deps.map((dep) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const depId = options.getName ? options.getName(dep) : dep.id;
|
|
61
|
+
if (!this.hasNode(depId)) {
|
|
62
|
+
this.add(dep);
|
|
63
|
+
if (dep.declareRuntime) {
|
|
64
|
+
runtimes.add(dep.declareRuntime);
|
|
65
|
+
}
|
|
66
|
+
const node = this.get(depId);
|
|
67
|
+
if (!node)
|
|
68
|
+
return;
|
|
69
|
+
yield requireFn(node, runtime);
|
|
70
|
+
yield this.enrichRuntimeExtension(depId, this.get(depId), runtime, runtimes, requireFn);
|
|
71
|
+
}
|
|
72
|
+
this.setEdge(id, depId, {
|
|
73
|
+
runtime: runtime.name,
|
|
74
|
+
type: 'runtime-dependency'
|
|
75
|
+
});
|
|
76
|
+
}));
|
|
77
|
+
return Promise.all(promises);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
enrichRuntime(runtime_1, runtimes_1, requireFn_1) {
|
|
81
|
+
return __awaiter(this, arguments, void 0, function* (runtime, runtimes, requireFn, options = {}) {
|
|
82
|
+
const promises = Array.from(this.nodes.entries()).map((_a) => __awaiter(this, [_a], void 0, function* ([id, aspect]) {
|
|
83
|
+
return this.enrichRuntimeExtension(id, aspect, runtime, runtimes, requireFn, options);
|
|
84
|
+
}));
|
|
85
|
+
return Promise.all(promises);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
add(manifest) {
|
|
89
|
+
const { vertices, edges } = (0, from_extension_1.fromExtension)(manifest);
|
|
90
|
+
this.setNodes(vertices);
|
|
91
|
+
this.setEdges(edges);
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
load(extensions) {
|
|
95
|
+
const newExtensions = extensions.filter((extension) => {
|
|
96
|
+
if (!extension.id)
|
|
97
|
+
return false;
|
|
98
|
+
return !this.get(extension.id);
|
|
99
|
+
});
|
|
100
|
+
const { vertices, edges } = (0, from_extension_1.fromExtensions)(newExtensions);
|
|
101
|
+
// Only set new vertices
|
|
102
|
+
this.setNodes(vertices, false); // false because we don't want to override already-loaded extensions
|
|
103
|
+
this.setEdges(edges);
|
|
104
|
+
return this;
|
|
105
|
+
}
|
|
106
|
+
// :TODO refactor this asap
|
|
107
|
+
getExtension(manifest) {
|
|
108
|
+
const id = getName(manifest);
|
|
109
|
+
const cachedVertex = this.cache.get(id);
|
|
110
|
+
if (cachedVertex)
|
|
111
|
+
return cachedVertex;
|
|
112
|
+
const res = this.node(id);
|
|
113
|
+
if (res) {
|
|
114
|
+
this.cache.set(res.name, res);
|
|
115
|
+
return res;
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
get extensions() {
|
|
120
|
+
return Array.from(this.nodes.values());
|
|
121
|
+
}
|
|
122
|
+
get aspects() {
|
|
123
|
+
return this.extensions;
|
|
124
|
+
}
|
|
125
|
+
get(id) {
|
|
126
|
+
const cachedVertex = this.cache.get(id);
|
|
127
|
+
if (cachedVertex)
|
|
128
|
+
return cachedVertex;
|
|
129
|
+
const res = this.node(id);
|
|
130
|
+
if (res) {
|
|
131
|
+
this.cache.set(res.name, res);
|
|
132
|
+
return res;
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* build Harmony from a single extension.
|
|
138
|
+
*/
|
|
139
|
+
static fromRoot(extension) {
|
|
140
|
+
const { vertices, edges } = (0, from_extension_1.fromExtension)(extension);
|
|
141
|
+
return new DependencyGraph(vertices, edges);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* build Harmony from set of extensions
|
|
145
|
+
*/
|
|
146
|
+
static from(extensions, options = {}) {
|
|
147
|
+
const { vertices, edges } = (0, from_extension_1.fromExtensions)(extensions, options);
|
|
148
|
+
return new DependencyGraph(vertices, edges);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.default = DependencyGraph;
|
|
152
|
+
//# sourceMappingURL=extension-graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-graph.js","sourceRoot":"","sources":["../../extension-graph/extension-graph.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2CAAmC;AACnC,qDAAiE;AAUjE,SAAS,OAAO,CAAC,QAAa;IAC5B,OAAO,OAAO,CAAC,WAAW,CAAC,cAAc,EAAE,QAAQ,CAAC,IAAI,QAAQ,CAAC,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC;AACvF,CAAC;AAOD,MAAqB,eAAgB,SAAQ,kBAAsB;IAAnE;;QACU,UAAK,GAAG,IAAI,GAAG,EAAqB,CAAC;IA8I/C,CAAC;IA5IC,sBAAsB,CAAC,MAAiB,EAAE,OAA0B,EAAE,UAAkC,EAAE;QACxG,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClD,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;YACxD,IAAI,CAAC,IAAI,CAAC,OAAO;gBAAE,OAAO,KAAK,CAAC;YAChC,OAAO,IAAI,CAAC,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E,GAAG,CAAC,CAAC;YAC9B,OAAO,GAAG,CAAC;QACb,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,SAA4B;QAC1C,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,IAAA,8BAAa,EAAC,SAAS,CAAC,CAAC;QAErD,OAAO,IAAI,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,UAA+B,EAAE,UAAkC,EAAE;QAC/E,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,IAAA,+BAAc,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAEhE,OAAO,IAAI,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;CACF;AA/ID,kCA+IC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ExtensionManifest } from '../extension';
|
|
2
|
+
import { Extension } from '../extension';
|
|
3
|
+
import { DependencyGraphOptions, Edge } from './extension-graph';
|
|
4
|
+
/**
|
|
5
|
+
* build vertices and edges from the given extension
|
|
6
|
+
*/
|
|
7
|
+
export declare function fromExtension(extension: ExtensionManifest, options?: DependencyGraphOptions): {
|
|
8
|
+
vertices: {
|
|
9
|
+
id: string;
|
|
10
|
+
node: Extension;
|
|
11
|
+
}[];
|
|
12
|
+
edges: {
|
|
13
|
+
sourceId: string;
|
|
14
|
+
targetId: string;
|
|
15
|
+
edge: Edge;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* build vertices and edges from the given list of extensions
|
|
20
|
+
*/
|
|
21
|
+
export declare function fromExtensions(extensions: ExtensionManifest[], options?: DependencyGraphOptions): {
|
|
22
|
+
vertices: {
|
|
23
|
+
id: string;
|
|
24
|
+
node: Extension;
|
|
25
|
+
}[];
|
|
26
|
+
edges: {
|
|
27
|
+
sourceId: string;
|
|
28
|
+
targetId: string;
|
|
29
|
+
edge: Edge;
|
|
30
|
+
}[];
|
|
31
|
+
};
|