@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 @@
|
|
|
1
|
+
{"version":3,"file":"harm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Q,EAAE,SAAS,IAAI,gBAAgB,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAEvG,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;YACrD,MAAM,IAAA,oBAAY,EAAC,cAAc,EAAE,CAAO,GAAc,EAAE,EAAE;gBAC1D,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAClC,CAAC,CAAA,CAAC,CAAC;QACL,CAAC;KAAA;IAED,MAAM,CAAO,IAAI;6DAAC,OAAiB,EAAE,OAAe,EAAE,YAA0B,EAAE,UAAkC,EAAE;YACpH,MAAM,WAAW,GAAG,yBAAc,CAAC,IAAI,CAAC,OAAc,EAAE,OAAO,CAAC,CAAC;YACjE,MAAM,QAAQ,GAAG,MAAM,mBAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAClD,OAAO,IAAI,OAAO,CAAC,WAAW,EAAE,eAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACzF,CAAC;KAAA;CACF;AAlID,0BAkIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
describe('Harmony', () => {
|
|
4
|
+
describe('run()', () => {
|
|
5
|
+
// it('should return a string', async () => {
|
|
6
|
+
// const manifest = {
|
|
7
|
+
// name: 'HelloWorld',
|
|
8
|
+
// provider: async () => 'hello world'
|
|
9
|
+
// };
|
|
10
|
+
// await harmony.run(manifest);
|
|
11
|
+
// expect(harmony.get('HelloWorld')).eql('hello world');
|
|
12
|
+
// });
|
|
13
|
+
// it('should load an array of different extensions', async () => {
|
|
14
|
+
// await harmony.run([BaseCompiler, TypeScript]);
|
|
15
|
+
// const compiler = harmony.get<BaseCompiler>('BaseCompiler')
|
|
16
|
+
// const typescript = harmony.get<TypeScript>('typescript')
|
|
17
|
+
// expect(typescript.compile()).to.eq('hello world');
|
|
18
|
+
// expect(compiler.compile()).to.eq('hello world');
|
|
19
|
+
// });
|
|
20
|
+
// it('should load extensions with slots', async () => {
|
|
21
|
+
// class Env {
|
|
22
|
+
// build () {
|
|
23
|
+
// return 'react built';
|
|
24
|
+
// }
|
|
25
|
+
// }
|
|
26
|
+
// it('extension instance should include an ID', async () => {
|
|
27
|
+
// const React = {
|
|
28
|
+
// name: '@teambit/react',
|
|
29
|
+
// dependencies: [],
|
|
30
|
+
// provide: async () => {}
|
|
31
|
+
// };
|
|
32
|
+
// await harmony.run([React]);
|
|
33
|
+
// const react = harmony.get<any>(React.name);
|
|
34
|
+
// expect(react.id).to.eq(React.name);
|
|
35
|
+
// });
|
|
36
|
+
// const Envs: ExtensionManifest = {
|
|
37
|
+
// name: '@teambit/envs',
|
|
38
|
+
// slots: [Slot.withType<Env>()],
|
|
39
|
+
// provider: async ([], config: {env: string}, [envSlot]: [SlotRegistry<Env>]) => {
|
|
40
|
+
// return {
|
|
41
|
+
// register: (env: Env) => {
|
|
42
|
+
// envSlot.register(env);
|
|
43
|
+
// },
|
|
44
|
+
// start() {
|
|
45
|
+
// const instance = envSlot.get(config.env);
|
|
46
|
+
// if (!instance) throw new Error('could not find envs');
|
|
47
|
+
// return instance.build();
|
|
48
|
+
// }
|
|
49
|
+
// };
|
|
50
|
+
// }
|
|
51
|
+
// };
|
|
52
|
+
// const React = {
|
|
53
|
+
// name: '@teambit/react',
|
|
54
|
+
// dependencies: [Envs],
|
|
55
|
+
// provide: async ([envs]: [{ register: (env: Env) => void }], config: {}) => {
|
|
56
|
+
// envs.register(new Env());
|
|
57
|
+
// }
|
|
58
|
+
// };
|
|
59
|
+
// const harmony = Harmony.load([Envs, React], {
|
|
60
|
+
// '@teambit/envs': {
|
|
61
|
+
// env: '@teambit/react'
|
|
62
|
+
// }
|
|
63
|
+
// });
|
|
64
|
+
// await harmony.run([Envs, React]);
|
|
65
|
+
// const envs = harmony.get<any>(Envs.name);
|
|
66
|
+
// expect(envs.start()).to.eq('react built');
|
|
67
|
+
// });
|
|
68
|
+
// it('should load extensions with config', async () => {
|
|
69
|
+
// const e1 = {
|
|
70
|
+
// name: '@teambit/typescript',
|
|
71
|
+
// provider: async ([], config: { declarations: boolean }) => {
|
|
72
|
+
// return {
|
|
73
|
+
// get: () => {
|
|
74
|
+
// return config.declarations || false
|
|
75
|
+
// }
|
|
76
|
+
// };
|
|
77
|
+
// }
|
|
78
|
+
// };
|
|
79
|
+
// const e2 = { name: '@teambit/react', defaultConfig: {ts: false}, provide: async ([], config: any) => {
|
|
80
|
+
// return {
|
|
81
|
+
// config: config.ts
|
|
82
|
+
// };
|
|
83
|
+
// }
|
|
84
|
+
// };
|
|
85
|
+
// const harmony = Harmony.load([e1], {
|
|
86
|
+
// '@teambit/typescript': {
|
|
87
|
+
// declarations: true
|
|
88
|
+
// },
|
|
89
|
+
// });
|
|
90
|
+
// await harmony.run([e1]);
|
|
91
|
+
// const ts = harmony.get<{get: () => {}}>('@teambit/typescript');
|
|
92
|
+
// expect(ts.get()).to.eq(true);
|
|
93
|
+
// harmony.config.set('@teambit/react', {ts: true});
|
|
94
|
+
// await harmony.set([e2]);
|
|
95
|
+
// const react = harmony.get<{[key: string]: object}>('@teambit/react');
|
|
96
|
+
// expect(react.config).to.eq(true);
|
|
97
|
+
// });
|
|
98
|
+
// it('should invoke a class extension method', async () => {
|
|
99
|
+
// await harmony.run(BaseCompiler);
|
|
100
|
+
// const compiler = harmony.get<BaseCompiler>('BaseCompiler')
|
|
101
|
+
// expect(compiler.compile()).to.eq('hello world');
|
|
102
|
+
// });
|
|
103
|
+
// it('should invoke a class extension with configured dependencies', async () => {
|
|
104
|
+
// await harmony.run(TypeScript);
|
|
105
|
+
// const typescript = harmony.get<TypeScript>('typescript')
|
|
106
|
+
// expect(typescript.compile()).to.eq('hello world');
|
|
107
|
+
// });
|
|
108
|
+
// it('should use prefer id over name', async () => {
|
|
109
|
+
// const dependency = {
|
|
110
|
+
// name: 'dependencyName',
|
|
111
|
+
// id: 'dependencyId',
|
|
112
|
+
// provider: async () => 'hello world'
|
|
113
|
+
// };
|
|
114
|
+
// const dependent = {
|
|
115
|
+
// name: 'dependentName',
|
|
116
|
+
// id: 'dependentId',
|
|
117
|
+
// dependencies: [dependency],
|
|
118
|
+
// provider: async () => 'hello world'
|
|
119
|
+
// };
|
|
120
|
+
// await harmony.run(dependent);
|
|
121
|
+
// const ids = harmony.extensionsIds;
|
|
122
|
+
// expect(ids).to.contain('dependencyId');
|
|
123
|
+
// expect(ids).to.contain('dependentId');
|
|
124
|
+
// });
|
|
125
|
+
// it('should execute bit core extension graph', async () => {
|
|
126
|
+
// // const bit = await Harmony.run(BitExt);
|
|
127
|
+
// });
|
|
128
|
+
// it('should register during run', async () => {
|
|
129
|
+
// const compiler = await harmony.run(Babel);
|
|
130
|
+
// });
|
|
131
|
+
// it('should execute an aspect in the cli runtime', async() => {
|
|
132
|
+
// const harmony = await Harmony.load([ReactAspect], 'cli', {});
|
|
133
|
+
// await harmony.run();
|
|
134
|
+
// const react = harmony.get<ReactCLI>('@teambit/react');
|
|
135
|
+
// })
|
|
136
|
+
// it('should execute an aspect in the ui runtime', async() => {
|
|
137
|
+
// const harmony = await Harmony.load([ReactAspect], 'ui', {});
|
|
138
|
+
// await harmony.run();
|
|
139
|
+
// const react = harmony.get<ReactUI>('@teambit/react');
|
|
140
|
+
// expect(react.render()).toBeTruthy;
|
|
141
|
+
// })
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
//# sourceMappingURL=harmony.spec.old.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harmony.spec.old.js","sourceRoot":"","sources":["../harmony.spec.old.ts"],"names":[],"mappings":";;AAYA,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;QACv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AA+B;QAC/B,4EAA4E;QAC5E,wCAAwC;QACxC,QAAQ;QAER,+DAA+D;QAC/D,uCAAuC;QACvC,iEAAiE;QACjE,uDAAuD;QACvD,QAAQ;QAER,qFAAqF;QACrF,qCAAqC;QACrC,qEAAqE;QACrE,yDAAyD;QACzD,QAAQ;QAER,uDAAuD;QACvD,2BAA2B;QAC3B,gCAAgC;QAChC,4BAA4B;QAC5B,4CAA4C;QAC5C,SAAS;QACT,0BAA0B;QAC1B,+BAA+B;QAC/B,2BAA2B;QAC3B,oCAAoC;QACpC,4CAA4C;QAC5C,SAAS;QACT,oCAAoC;QACpC,2CAA2C;QAC3C,8CAA8C;QAC9C,6CAA6C;QAC7C,QAAQ;QAER,gEAAgE;QAChE,gDAAgD;QAChD,QAAQ;QAER,mDAAmD;QACnD,iDAAiD;QACjD,QAAQ;QAEN,iEAAiE;QACjE,kEAAkE;QAClE,yBAAyB;QACzB,2DAA2D;QAC3D,KAAK;QAEL,gEAAgE;QAChE,iEAAiE;QACjE,yBAAyB;QACzB,0DAA0D;QAC1D,uCAAuC;QACvC,KAAK;IACP,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { ExtensionDecorator, Extension, register, HookRegistry, hook, provider, createHook } from './extension';
|
|
2
|
+
export { Harmony, GlobalConfig } from './harmony';
|
|
3
|
+
export { Slot, SlotRegistry } from './slots';
|
|
4
|
+
export { ProviderFn } from './types';
|
|
5
|
+
export { ExtensionManifest } from './extension/extension-manifest';
|
|
6
|
+
export { HarmonyError } from './exceptions/harmony-error';
|
|
7
|
+
export { Aspect } from './aspect';
|
|
8
|
+
export { RuntimeDefinition, RuntimeManifest } from './runtimes';
|
|
9
|
+
export { default as AspectGraph } from './extension-graph/extension-graph';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
exports.AspectGraph = exports.RuntimeDefinition = exports.Aspect = exports.HarmonyError = exports.SlotRegistry = exports.Slot = exports.Harmony = exports.createHook = exports.provider = exports.hook = exports.HookRegistry = exports.register = exports.Extension = exports.ExtensionDecorator = void 0;
|
|
7
|
+
var extension_1 = require("./extension");
|
|
8
|
+
Object.defineProperty(exports, "ExtensionDecorator", { enumerable: true, get: function () { return extension_1.ExtensionDecorator; } });
|
|
9
|
+
Object.defineProperty(exports, "Extension", { enumerable: true, get: function () { return extension_1.Extension; } });
|
|
10
|
+
Object.defineProperty(exports, "register", { enumerable: true, get: function () { return extension_1.register; } });
|
|
11
|
+
Object.defineProperty(exports, "HookRegistry", { enumerable: true, get: function () { return extension_1.HookRegistry; } });
|
|
12
|
+
Object.defineProperty(exports, "hook", { enumerable: true, get: function () { return extension_1.hook; } });
|
|
13
|
+
Object.defineProperty(exports, "provider", { enumerable: true, get: function () { return extension_1.provider; } });
|
|
14
|
+
Object.defineProperty(exports, "createHook", { enumerable: true, get: function () { return extension_1.createHook; } });
|
|
15
|
+
var harmony_1 = require("./harmony");
|
|
16
|
+
Object.defineProperty(exports, "Harmony", { enumerable: true, get: function () { return harmony_1.Harmony; } });
|
|
17
|
+
var slots_1 = require("./slots");
|
|
18
|
+
Object.defineProperty(exports, "Slot", { enumerable: true, get: function () { return slots_1.Slot; } });
|
|
19
|
+
Object.defineProperty(exports, "SlotRegistry", { enumerable: true, get: function () { return slots_1.SlotRegistry; } });
|
|
20
|
+
var harmony_error_1 = require("./exceptions/harmony-error");
|
|
21
|
+
Object.defineProperty(exports, "HarmonyError", { enumerable: true, get: function () { return harmony_error_1.HarmonyError; } });
|
|
22
|
+
var aspect_1 = require("./aspect");
|
|
23
|
+
Object.defineProperty(exports, "Aspect", { enumerable: true, get: function () { return aspect_1.Aspect; } });
|
|
24
|
+
var runtimes_1 = require("./runtimes");
|
|
25
|
+
Object.defineProperty(exports, "RuntimeDefinition", { enumerable: true, get: function () { return runtimes_1.RuntimeDefinition; } });
|
|
26
|
+
var extension_graph_1 = require("./extension-graph/extension-graph");
|
|
27
|
+
Object.defineProperty(exports, "AspectGraph", { enumerable: true, get: function () { return __importDefault(extension_graph_1).default; } });
|
|
28
|
+
// `Config` / `ConfigOptions` are not re-exported from the root because they
|
|
29
|
+
// pull in node-only modules and would break browser bundles. They are exposed
|
|
30
|
+
// via the subpath `@teambit/harmony/harmony-config` with a `node` exports
|
|
31
|
+
// condition — see this component's `packageJson.exports` in component.json.
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAgH;AAAvG,+GAAA,kBAAkB,OAAA;AAAE,sGAAA,SAAS,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,iGAAA,IAAI,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAAE,uGAAA,UAAU,OAAA;AAC1F,qCAAkD;AAAzC,kGAAA,OAAO,OAAA;AAChB,iCAA6C;AAApC,6FAAA,IAAI,OAAA;AAAE,qGAAA,YAAY,OAAA;AAG3B,4DAA0D;AAAjD,6GAAA,YAAY,OAAA;AACrB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,uCAAgE;AAAvD,6GAAA,iBAAiB,OAAA;AAC1B,qEAA2E;AAAlE,+HAAA,OAAO,OAAe;AAC/B,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAC1E,4EAA4E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
;
|
|
2
|
+
import * as overview_0 from '/tmp/capsules-root/sign-capsules/2026-5-24/1mdigc3/teambit.harmony_harmony@19ea14143ef7d5f4e4daa6e8ac8a8c97c9d683d5/dist/harmony.docs.mdx';
|
|
3
|
+
|
|
4
|
+
export const compositions = [];
|
|
5
|
+
export const overview = [overview_0];
|
|
6
|
+
|
|
7
|
+
export const compositions_metadata = {"compositions":[]};
|
package/dist/readme.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Harmony
|
|
2
|
+
Harmony is the engine that drives Bit extensibility and composability.
|
|
3
|
+
It's an abstract extension system indended to make any software extendable and composable.
|
|
4
|
+
|
|
5
|
+
Harmony takes a "micro-kernel" approach and implements the near-minimum amount of software required to build any JavaScript system from independent components through composition.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
```bash
|
|
9
|
+
$ bit install @teambit/harmony
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
```ts
|
|
14
|
+
import { Harmony, Extension } from 'harmony';
|
|
15
|
+
|
|
16
|
+
@Extensioin
|
|
17
|
+
class Person {
|
|
18
|
+
sayHello(name = 'world') {
|
|
19
|
+
return `hello ${name}!`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const person = Harmony.load(Person);
|
|
24
|
+
helloWorld.sayHello(); // returns 'hello world!'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Component composition
|
|
28
|
+
|
|
29
|
+
### DI
|
|
30
|
+
```ts
|
|
31
|
+
class Dude {
|
|
32
|
+
constructor(
|
|
33
|
+
private person: Person
|
|
34
|
+
) {}
|
|
35
|
+
|
|
36
|
+
sayHello() {
|
|
37
|
+
return this.person.sayHello('dude');
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
Harmony.load([Dude]).sayHello(); // echos 'hello dude!'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Hooks
|
|
45
|
+
```ts
|
|
46
|
+
@Extension()
|
|
47
|
+
class CLI {
|
|
48
|
+
// @hook('command') commands = Hook.create<Command>();
|
|
49
|
+
static command() {
|
|
50
|
+
return Hook.create<Command>();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
run() {
|
|
54
|
+
const allCommands = this.commands.list(); // outputs all hook subscribers
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@Extension()
|
|
59
|
+
class Compiler {
|
|
60
|
+
|
|
61
|
+
@command()
|
|
62
|
+
main() {
|
|
63
|
+
return {
|
|
64
|
+
synopsis: 'compile <path>',
|
|
65
|
+
render: () => <Box></Box>
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Extension configuration
|
|
72
|
+
|
|
73
|
+
## Extension metadata
|
|
74
|
+
|
|
75
|
+
## API reference
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
Apache License, Version 2.0
|
|
79
|
+
|
|
80
|
+
Made with ❤ to open software by Team Bit.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuntimeModuleError = exports.RuntimeNotDefined = void 0;
|
|
4
|
+
var runtime_not_defined_1 = require("./runtime-not-defined");
|
|
5
|
+
Object.defineProperty(exports, "RuntimeNotDefined", { enumerable: true, get: function () { return runtime_not_defined_1.RuntimeNotDefined; } });
|
|
6
|
+
var runtime_module_error_1 = require("./runtime-module-error");
|
|
7
|
+
Object.defineProperty(exports, "RuntimeModuleError", { enumerable: true, get: function () { return runtime_module_error_1.RuntimeModuleError; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../runtimes/exceptions/index.ts"],"names":[],"mappings":";;;AAAA,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAC1B,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuntimeModuleError = void 0;
|
|
4
|
+
class RuntimeModuleError extends Error {
|
|
5
|
+
constructor(err) {
|
|
6
|
+
super(`failed to load Harmony aspect with error message: ${err.message}`);
|
|
7
|
+
this.err = err;
|
|
8
|
+
}
|
|
9
|
+
get stack() {
|
|
10
|
+
return this.err.stack;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.RuntimeModuleError = RuntimeModuleError;
|
|
14
|
+
//# sourceMappingURL=runtime-module-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-module-error.js","sourceRoot":"","sources":["../../../runtimes/exceptions/runtime-module-error.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAmB,SAAQ,KAAK;IAC3C,YACU,GAAU;QAChB,KAAK,CAAC,qDAAqD,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;QADnE,QAAG,GAAH,GAAG,CAAO;IAC0D,CAAC;IAE/E,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;IACxB,CAAC;CACF;AARD,gDAQC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuntimeNotDefined = void 0;
|
|
4
|
+
class RuntimeNotDefined extends Error {
|
|
5
|
+
constructor(name) { super(`runtime: '${name}' was not defined by any aspect`); }
|
|
6
|
+
}
|
|
7
|
+
exports.RuntimeNotDefined = RuntimeNotDefined;
|
|
8
|
+
//# sourceMappingURL=runtime-not-defined.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-not-defined.js","sourceRoot":"","sources":["../../../runtimes/exceptions/runtime-not-defined.ts"],"names":[],"mappings":";;;AAAA,MAAa,iBAAkB,SAAQ,KAAK;IAC1C,YACE,IAAY,IACV,KAAK,CAAC,aAAa,IAAI,iCAAiC,CAAC,CAAA,CAAC,CAAC;CAChE;AAJD,8CAIC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuntimeDefinition = exports.Runtimes = void 0;
|
|
4
|
+
var runtimes_1 = require("./runtimes");
|
|
5
|
+
Object.defineProperty(exports, "Runtimes", { enumerable: true, get: function () { return runtimes_1.Runtimes; } });
|
|
6
|
+
var runtime_definition_1 = require("./runtime-definition");
|
|
7
|
+
Object.defineProperty(exports, "RuntimeDefinition", { enumerable: true, get: function () { return runtime_definition_1.RuntimeDefinition; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../runtimes/index.ts"],"names":[],"mappings":";;;AACA,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,2DAAyD;AAAhD,uHAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type RuntimeDefProps = {
|
|
2
|
+
name: string;
|
|
3
|
+
};
|
|
4
|
+
export declare class RuntimeDefinition {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly filePredicate: (filePath: string, name: string) => boolean;
|
|
7
|
+
constructor(name: string, filePredicate?: (filePath: string, name: string) => boolean);
|
|
8
|
+
getRuntimeFile(paths: string[]): string | undefined;
|
|
9
|
+
require(file: string): void;
|
|
10
|
+
static create(def: RuntimeDefProps): RuntimeDefinition;
|
|
11
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuntimeDefinition = void 0;
|
|
4
|
+
const DEFAULT_PREDICATE = (filePath, name) => {
|
|
5
|
+
return filePath.includes(`.${name}.`);
|
|
6
|
+
};
|
|
7
|
+
class RuntimeDefinition {
|
|
8
|
+
constructor(name, filePredicate = DEFAULT_PREDICATE) {
|
|
9
|
+
this.name = name;
|
|
10
|
+
this.filePredicate = filePredicate;
|
|
11
|
+
}
|
|
12
|
+
getRuntimeFile(paths) {
|
|
13
|
+
return paths.find(path => this.filePredicate(path, this.name));
|
|
14
|
+
}
|
|
15
|
+
require(file) {
|
|
16
|
+
// try {
|
|
17
|
+
// require(file);
|
|
18
|
+
// } catch(err) {
|
|
19
|
+
// throw new RuntimeModuleError(err);
|
|
20
|
+
// }
|
|
21
|
+
}
|
|
22
|
+
static create(def) {
|
|
23
|
+
return new RuntimeDefinition(def.name);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.RuntimeDefinition = RuntimeDefinition;
|
|
27
|
+
//# sourceMappingURL=runtime-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-definition.js","sourceRoot":"","sources":["../../runtimes/runtime-definition.ts"],"names":[],"mappings":";;;AAMA,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAE,IAAY,EAAE,EAAE;IAC3D,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;AACxC,CAAC,CAAA;AAED,MAAa,iBAAiB;IAC5B,YACW,IAAY,EACZ,gBAA6D,iBAAiB;QAD9E,SAAI,GAAJ,IAAI,CAAQ;QACZ,kBAAa,GAAb,aAAa,CAAiE;IACtF,CAAC;IAEJ,cAAc,CAAC,KAAe;QAC5B,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,CAAC,IAAY;QAClB,QAAQ;QACR,mBAAmB;QACnB,iBAAiB;QACjB,uCAAuC;QACvC,IAAI;IACN,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,GAAoB;QAChC,OAAO,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AArBD,8CAqBC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RuntimeDefinition } from './runtime-definition';
|
|
2
|
+
import { ProviderFn } from '../types';
|
|
3
|
+
import { Aspect } from '../aspect';
|
|
4
|
+
import { SlotProvider } from '../slots';
|
|
5
|
+
export interface RuntimeManifest {
|
|
6
|
+
runtime: RuntimeDefinition | string;
|
|
7
|
+
provider: ProviderFn;
|
|
8
|
+
dependencies?: Aspect[];
|
|
9
|
+
slots?: SlotProvider<unknown>[];
|
|
10
|
+
defaultConfig?: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-manifest.js","sourceRoot":"","sources":["../../runtimes/runtime-manifest.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RuntimeDefinition } from './runtime-definition';
|
|
2
|
+
import DependencyGraph from '../extension-graph/extension-graph';
|
|
3
|
+
export declare class Runtimes {
|
|
4
|
+
readonly runtimeDefinition: {
|
|
5
|
+
[key: string]: RuntimeDefinition;
|
|
6
|
+
};
|
|
7
|
+
constructor(runtimeDefinition: {
|
|
8
|
+
[key: string]: RuntimeDefinition;
|
|
9
|
+
});
|
|
10
|
+
add(runtime: RuntimeDefinition): this;
|
|
11
|
+
get(name: string): RuntimeDefinition;
|
|
12
|
+
dispose(): void;
|
|
13
|
+
static load(graph: DependencyGraph): Promise<Runtimes>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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.Runtimes = void 0;
|
|
13
|
+
const exceptions_1 = require("./exceptions");
|
|
14
|
+
class Runtimes {
|
|
15
|
+
constructor(runtimeDefinition) {
|
|
16
|
+
this.runtimeDefinition = runtimeDefinition;
|
|
17
|
+
}
|
|
18
|
+
add(runtime) {
|
|
19
|
+
this.runtimeDefinition[runtime.name] = runtime;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
get(name) {
|
|
23
|
+
const runtime = this.runtimeDefinition[name];
|
|
24
|
+
if (!runtime)
|
|
25
|
+
throw new exceptions_1.RuntimeNotDefined(name);
|
|
26
|
+
return this.runtimeDefinition[name];
|
|
27
|
+
}
|
|
28
|
+
dispose() {
|
|
29
|
+
}
|
|
30
|
+
static load(graph) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const runtimes = {};
|
|
33
|
+
graph.extensions.forEach(manifest => {
|
|
34
|
+
if (!manifest.declareRuntime)
|
|
35
|
+
return;
|
|
36
|
+
runtimes[manifest.declareRuntime.name] = manifest.declareRuntime;
|
|
37
|
+
});
|
|
38
|
+
return new Runtimes(runtimes);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.Runtimes = Runtimes;
|
|
43
|
+
//# sourceMappingURL=runtimes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimes.js","sourceRoot":"","sources":["../../runtimes/runtimes.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,6CAAiD;AAEjD,MAAa,QAAQ;IACnB,YACW,iBAAqD;QAArD,sBAAiB,GAAjB,iBAAiB,CAAoC;IAC7D,CAAC;IAEJ,GAAG,CAAC,OAA0B;QAC5B,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,GAAG,CAAC,IAAY;QACd,MAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,8BAAiB,CAAC,IAAI,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,OAAO;IAEP,CAAC;IAED,MAAM,CAAO,IAAI,CAAC,KAAsB;;YACtC,MAAM,QAAQ,GAAyC,EAAE,CAAC;YAC1D,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAClC,IAAI,CAAC,QAAQ,CAAC,cAAc;oBAAE,OAAO;gBACrC,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC;YACnE,CAAC,CAAC,CAAC;YAEH,OAAO,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC;KAAA;CACF;AA7BD,4BA6BC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SlotRegistry = exports.Slot = void 0;
|
|
4
|
+
var slot_1 = require("./slot");
|
|
5
|
+
Object.defineProperty(exports, "Slot", { enumerable: true, get: function () { return slot_1.Slot; } });
|
|
6
|
+
var registry_1 = require("./registry");
|
|
7
|
+
Object.defineProperty(exports, "SlotRegistry", { enumerable: true, get: function () { return registry_1.SlotRegistry; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../slots/index.ts"],"names":[],"mappings":";;;AAAA,+BAA4C;AAAnC,4FAAA,IAAI,OAAA;AACb,uCAA0C;AAAjC,wGAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare class SlotRegistry<T> {
|
|
2
|
+
private registerFn;
|
|
3
|
+
readonly map: Map<string, T>;
|
|
4
|
+
constructor(registerFn: () => string, map?: Map<string, T>);
|
|
5
|
+
/**
|
|
6
|
+
* get a slot value by extension id.
|
|
7
|
+
*/
|
|
8
|
+
get(id: string): T | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* return an array of all slots.
|
|
11
|
+
*/
|
|
12
|
+
toArray(): [string, T][];
|
|
13
|
+
/**
|
|
14
|
+
* get all registered values.
|
|
15
|
+
*/
|
|
16
|
+
values(): T[];
|
|
17
|
+
/**
|
|
18
|
+
* register a new entry to the slot registry
|
|
19
|
+
*/
|
|
20
|
+
register(value: T): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SlotRegistry = void 0;
|
|
4
|
+
class SlotRegistry {
|
|
5
|
+
constructor(registerFn, map = new Map()) {
|
|
6
|
+
this.registerFn = registerFn;
|
|
7
|
+
this.map = map;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* get a slot value by extension id.
|
|
11
|
+
*/
|
|
12
|
+
get(id) {
|
|
13
|
+
return this.map.get(id);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* return an array of all slots.
|
|
17
|
+
*/
|
|
18
|
+
toArray() {
|
|
19
|
+
return Array.from(this.map.entries());
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* get all registered values.
|
|
23
|
+
*/
|
|
24
|
+
values() {
|
|
25
|
+
return Array.from(this.map.values());
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* register a new entry to the slot registry
|
|
29
|
+
*/
|
|
30
|
+
register(value) {
|
|
31
|
+
const id = this.registerFn();
|
|
32
|
+
this.map.set(id, value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.SlotRegistry = SlotRegistry;
|
|
36
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../slots/registry.ts"],"names":[],"mappings":";;;AACA,MAAa,YAAY;IACvB,YACU,UAAwB,EACvB,MAAM,IAAI,GAAG,EAAa;QAD3B,eAAU,GAAV,UAAU,CAAc;QACvB,QAAG,GAAH,GAAG,CAAuB;IAClC,CAAC;IAEJ;;OAEG;IACH,GAAG,CAAC,EAAU;QACZ,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,KAAQ;QACf,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAC1B,CAAC;CACF;AAlCD,oCAkCC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Slot = void 0;
|
|
4
|
+
const registry_1 = require("./registry");
|
|
5
|
+
class Slot {
|
|
6
|
+
static withType() {
|
|
7
|
+
return (registerFn) => {
|
|
8
|
+
return new registry_1.SlotRegistry(registerFn);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.Slot = Slot;
|
|
13
|
+
//# sourceMappingURL=slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot.js","sourceRoot":"","sources":["../../slots/slot.ts"],"names":[],"mappings":";;;AAAA,yCAA0C;AAE1C,MAAa,IAAI;IACf,MAAM,CAAC,QAAQ;QACb,OAAO,CAAC,UAAwB,EAAE,EAAE;YAClC,OAAO,IAAI,uBAAY,CAAI,UAAU,CAAC,CAAC;QACzC,CAAC,CAAA;IACH,CAAC;CACF;AAND,oBAMC"}
|
package/dist/types.d.ts
ADDED
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":""}
|