@teambit/harmony 0.2.10 → 0.3.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/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 +3 -2
- package/dist/aspect.js +4 -0
- package/dist/aspect.js.map +1 -0
- package/dist/config/config.d.ts +2 -1
- package/dist/config/config.js +7 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -0
- package/dist/container.js +1 -0
- package/dist/container.js.map +1 -0
- package/dist/exceptions/extension-init-error.js +1 -0
- package/dist/exceptions/extension-init-error.js.map +1 -0
- package/dist/exceptions/extension-load-error.d.ts +1 -1
- package/dist/exceptions/extension-load-error.js +1 -0
- package/dist/exceptions/extension-load-error.js.map +1 -0
- package/dist/exceptions/extension-potential-circular.js +1 -0
- package/dist/exceptions/extension-potential-circular.js.map +1 -0
- package/dist/exceptions/harmony-already-running.js +1 -0
- package/dist/exceptions/harmony-already-running.js.map +1 -0
- package/dist/exceptions/harmony-error.js +1 -0
- package/dist/exceptions/harmony-error.js.map +1 -0
- package/dist/exceptions/hook-not-found.js +1 -0
- package/dist/exceptions/hook-not-found.js.map +1 -0
- package/dist/exceptions/index.js +7 -2
- package/dist/exceptions/index.js.map +1 -0
- package/dist/exceptions/runtime-not-defined.js +1 -1
- package/dist/exceptions/runtime-not-defined.js.map +1 -0
- package/dist/extension/any-extension.js +1 -0
- package/dist/extension/any-extension.js.map +1 -0
- package/dist/extension/decorator.d.ts +2 -2
- package/dist/extension/decorator.js +1 -0
- package/dist/extension/decorator.js.map +1 -0
- package/dist/extension/extension-manifest.js +1 -0
- package/dist/extension/extension-manifest.js.map +1 -0
- package/dist/extension/extension.d.ts +3 -2
- package/dist/extension/extension.js +4 -0
- package/dist/extension/extension.js.map +1 -0
- package/dist/extension/index.js +2 -0
- package/dist/extension/index.js.map +1 -0
- package/dist/extension-graph/extension-graph.d.ts +2 -2
- package/dist/extension-graph/extension-graph.js +5 -4
- package/dist/extension-graph/extension-graph.js.map +1 -0
- package/dist/extension-graph/from-extension.js +3 -2
- package/dist/extension-graph/from-extension.js.map +1 -0
- package/dist/extension-graph/index.js +6 -1
- package/dist/extension-graph/index.js.map +1 -0
- package/dist/factory/extension-factory.js +1 -0
- package/dist/factory/extension-factory.js.map +1 -0
- package/dist/factory/index.js +2 -0
- package/dist/factory/index.js.map +1 -0
- package/dist/fixtures/aspects/babel/babel.aspect.js +1 -0
- package/dist/fixtures/aspects/babel/babel.aspect.js.map +1 -0
- package/dist/fixtures/aspects/babel/babel.cli.js +1 -0
- package/dist/fixtures/aspects/babel/babel.cli.js.map +1 -0
- package/dist/fixtures/aspects/react/react.aspect.js +1 -0
- package/dist/fixtures/aspects/react/react.aspect.js.map +1 -0
- package/dist/fixtures/aspects/react/react.cli.js +2 -1
- package/dist/fixtures/aspects/react/react.cli.js.map +1 -0
- package/dist/fixtures/aspects/react/react.ui.js +1 -0
- package/dist/fixtures/aspects/react/react.ui.js.map +1 -0
- package/dist/fixtures/aspects/ui/ui.aspect.js +1 -0
- package/dist/fixtures/aspects/ui/ui.aspect.js.map +1 -0
- package/dist/fixtures/aspects/ui/ui.ui.js +1 -0
- package/dist/fixtures/aspects/ui/ui.ui.js.map +1 -0
- package/dist/fixtures/babel/babel.extension.d.ts +1 -1
- package/dist/fixtures/babel/babel.extension.js +8 -26
- package/dist/fixtures/babel/babel.extension.js.map +1 -0
- package/dist/fixtures/babel/index.js +1 -1
- package/dist/fixtures/babel/index.js.map +1 -0
- package/dist/fixtures/base-compiler/base-compiler.extension.js +5 -23
- package/dist/fixtures/base-compiler/base-compiler.extension.js.map +1 -0
- package/dist/fixtures/base-compiler/index.js +2 -0
- package/dist/fixtures/base-compiler/index.js.map +1 -0
- package/dist/fixtures/cli/cli.extension.js +5 -12
- package/dist/fixtures/cli/cli.extension.js.map +1 -0
- package/dist/fixtures/cli/command.js +1 -1
- package/dist/fixtures/cli/command.js.map +1 -0
- package/dist/fixtures/cli/index.js +2 -1
- package/dist/fixtures/cli/index.js.map +1 -0
- package/dist/fixtures/typescript/index.js +1 -1
- package/dist/fixtures/typescript/index.js.map +1 -0
- package/dist/fixtures/typescript/typescript.js +8 -22
- package/dist/fixtures/typescript/typescript.js.map +1 -0
- package/dist/harmony-config/config-reader.js +3 -2
- package/dist/harmony-config/config-reader.js.map +1 -0
- package/dist/harmony-config/exceptions/index.js +2 -0
- package/dist/harmony-config/exceptions/index.js.map +1 -0
- package/dist/harmony-config/exceptions/read-config-error.d.ts +1 -1
- package/dist/harmony-config/exceptions/read-config-error.js +1 -0
- package/dist/harmony-config/exceptions/read-config-error.js.map +1 -0
- package/dist/harmony-config/harmony-config.js +5 -4
- package/dist/harmony-config/harmony-config.js.map +1 -0
- package/dist/harmony-config/index.js +2 -0
- package/dist/harmony-config/index.js.map +1 -0
- package/dist/harmony-config/locator.js +1 -1
- package/dist/harmony-config/locator.js.map +1 -0
- package/dist/harmony.docs.mdx +250 -0
- package/dist/harmony.js +3 -2
- package/dist/harmony.js.map +1 -0
- package/dist/{factory/extension-factory.spec.d.ts → harmony.spec.old.d.ts} +0 -0
- package/dist/{harmony.spec.js → harmony.spec.old.js} +12 -23
- package/dist/harmony.spec.old.js.map +1 -0
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -0
- package/dist/readme.md +80 -0
- package/dist/runtimes/exceptions/index.js +2 -0
- package/dist/runtimes/exceptions/index.js.map +1 -0
- package/dist/runtimes/exceptions/runtime-module-error.d.ts +1 -1
- package/dist/runtimes/exceptions/runtime-module-error.js +1 -0
- package/dist/runtimes/exceptions/runtime-module-error.js.map +1 -0
- package/dist/runtimes/exceptions/runtime-not-defined.js +1 -0
- package/dist/runtimes/exceptions/runtime-not-defined.js.map +1 -0
- package/dist/runtimes/index.js +2 -0
- package/dist/runtimes/index.js.map +1 -0
- package/dist/runtimes/runtime-definition.js +1 -0
- package/dist/runtimes/runtime-definition.js.map +1 -0
- package/dist/runtimes/runtime-manifest.js +1 -0
- package/dist/runtimes/runtime-manifest.js.map +1 -0
- package/dist/runtimes/runtimes.js +1 -0
- package/dist/runtimes/runtimes.js.map +1 -0
- package/dist/slots/index.js +2 -0
- package/dist/slots/index.js.map +1 -0
- package/dist/slots/registry.js +1 -0
- package/dist/slots/registry.js.map +1 -0
- package/dist/slots/slot.js +1 -0
- package/dist/slots/slot.js.map +1 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/async-for-each.js +1 -0
- package/dist/utils/async-for-each.js.map +1 -0
- package/dist/utils/index.js +2 -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/{dist/extension-graph/extension-graph.spec.d.ts → 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 +151 -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/{dist/extension/extension.spec.d.ts → 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 +17 -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 +146 -0
- package/index.ts +10 -0
- package/package-tar/teambit-harmony-0.3.1.tgz +0 -0
- package/package.json +42 -28
- package/preview-1649151063005.js +1 -0
- package/readme.md +58 -137
- 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/tsconfig.json +26 -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
- package/dist/extension/extension.spec.js +0 -1
- package/dist/extension-graph/extension-graph.spec.js +0 -1
- package/dist/factory/extension-factory.spec.js +0 -6
- package/dist/harmony-config/harmony-config.spec.d.ts +0 -1
- package/dist/harmony-config/harmony-config.spec.js +0 -8
- package/dist/harmony.spec.d.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.aspect.js","sourceRoot":"","sources":["../../../../fixtures/aspects/ui/ui.aspect.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AACzC,gDAAsD;AAEzC,QAAA,SAAS,GAAG,4BAAiB,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAErD,QAAA,QAAQ,GAAG,eAAM,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,aAAa;IACjB,YAAY,EAAE,EAAE;IAChB,cAAc,EAAE,iBAAS;IACzB,KAAK,EAAE;QACL,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;KAC3B;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.ui.js","sourceRoot":"","sources":["../../../../fixtures/aspects/ui/ui.ui.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAkD;AAElD,MAAa,IAAI;IAGf,MAAM,CAAO,QAAQ;;YACnB,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,CAAC;KAAA;;AALH,oBAMC;AALQ,YAAO,GAAG,qBAAS,CAAC;AAO7B,oBAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -17,32 +8,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
17
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
9
|
});
|
|
19
10
|
};
|
|
20
|
-
var Babel_1;
|
|
21
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
12
|
exports.Babel = void 0;
|
|
23
|
-
const __1 = require("../..");
|
|
24
13
|
class Mock {
|
|
25
14
|
}
|
|
26
|
-
|
|
15
|
+
// @Extension({
|
|
16
|
+
// dependencies: [BaseCompiler]
|
|
17
|
+
// })
|
|
18
|
+
class Babel {
|
|
27
19
|
constructor(mock) {
|
|
28
20
|
this.mock = mock;
|
|
29
21
|
}
|
|
22
|
+
// @provider()
|
|
30
23
|
provide([baseCompiler]) {
|
|
31
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
return new
|
|
25
|
+
return new Babel();
|
|
33
26
|
});
|
|
34
27
|
}
|
|
35
|
-
}
|
|
36
|
-
__decorate([
|
|
37
|
-
__1.provider(),
|
|
38
|
-
__metadata("design:type", Function),
|
|
39
|
-
__metadata("design:paramtypes", [Array]),
|
|
40
|
-
__metadata("design:returntype", Promise)
|
|
41
|
-
], Babel.prototype, "provide", null);
|
|
42
|
-
Babel = Babel_1 = __decorate([
|
|
43
|
-
__1.Extension({
|
|
44
|
-
// dependencies: [BaseCompiler]
|
|
45
|
-
}),
|
|
46
|
-
__metadata("design:paramtypes", [Mock])
|
|
47
|
-
], Babel);
|
|
28
|
+
}
|
|
48
29
|
exports.Babel = Babel;
|
|
30
|
+
//# sourceMappingURL=babel.extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"babel.extension.js","sourceRoot":"","sources":["../../../fixtures/babel/babel.extension.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,MAAM,IAAI;CAET;AAED,eAAe;AACb,+BAA+B;AACjC,KAAK;AACL,MAAa,KAAK;IAChB,YACU,IAAW;QAAX,SAAI,GAAJ,IAAI,CAAO;IAClB,CAAC;IAEJ,cAAc;IACR,OAAO,CAAC,CAAC,YAAY,CAAiB;;YAC1C,OAAO,IAAI,KAAK,EAAE,CAAC;QACrB,CAAC;KAAA;CACF;AATD,sBASC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../fixtures/babel/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.BaseCompiler = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
let BaseCompiler = class BaseCompiler {
|
|
4
|
+
// @Extension()
|
|
5
|
+
class BaseCompiler {
|
|
16
6
|
constructor(cli) {
|
|
17
7
|
this.cli = cli;
|
|
18
8
|
}
|
|
@@ -22,6 +12,7 @@ let BaseCompiler = class BaseCompiler {
|
|
|
22
12
|
cjs: 'blue/green'
|
|
23
13
|
};
|
|
24
14
|
}
|
|
15
|
+
// @Command
|
|
25
16
|
main() {
|
|
26
17
|
return {
|
|
27
18
|
synopsis: 'compile <id>',
|
|
@@ -34,15 +25,6 @@ let BaseCompiler = class BaseCompiler {
|
|
|
34
25
|
this.cli.run();
|
|
35
26
|
return 'hello world';
|
|
36
27
|
}
|
|
37
|
-
}
|
|
38
|
-
__decorate([
|
|
39
|
-
cli_1.Command,
|
|
40
|
-
__metadata("design:type", Function),
|
|
41
|
-
__metadata("design:paramtypes", []),
|
|
42
|
-
__metadata("design:returntype", void 0)
|
|
43
|
-
], BaseCompiler.prototype, "main", null);
|
|
44
|
-
BaseCompiler = __decorate([
|
|
45
|
-
__1.Extension(),
|
|
46
|
-
__metadata("design:paramtypes", [cli_1.CLI])
|
|
47
|
-
], BaseCompiler);
|
|
28
|
+
}
|
|
48
29
|
exports.BaseCompiler = BaseCompiler;
|
|
30
|
+
//# sourceMappingURL=base-compiler.extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-compiler.extension.js","sourceRoot":"","sources":["../../../fixtures/base-compiler/base-compiler.extension.ts"],"names":[],"mappings":";;;AAGA,eAAe;AACf,MAAa,YAAY;IACvB,YACU,GAAQ;QAAR,QAAG,GAAH,GAAG,CAAK;IACf,CAAC;IAEJ,YAAY;IACZ,MAAM;QACJ,OAAO;YACL,GAAG,EAAE,YAAY;SAClB,CAAC;IACJ,CAAC;IAED,WAAW;IACX,IAAI;QACF,OAAO;YACL,QAAQ,EAAE,cAAc;YACxB,MAAM,EAAE,GAAG,EAAE;gBACX,OAAO,sBAAsB,CAAC;YAChC,CAAC;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;QACf,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AA1BD,oCA0BC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseCompiler = void 0;
|
|
3
4
|
var base_compiler_extension_1 = require("./base-compiler.extension");
|
|
4
5
|
Object.defineProperty(exports, "BaseCompiler", { enumerable: true, get: function () { return base_compiler_extension_1.BaseCompiler; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../fixtures/base-compiler/index.ts"],"names":[],"mappings":";;;AAAA,qEAAyD;AAAhD,uHAAA,YAAY,OAAA"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.CLI = exports.Command = void 0;
|
|
10
4
|
const __1 = require("../..");
|
|
@@ -12,8 +6,9 @@ const __2 = require("../..");
|
|
|
12
6
|
/**
|
|
13
7
|
* hook for registering new CLI commands.
|
|
14
8
|
*/
|
|
15
|
-
exports.Command = __1.createHook();
|
|
16
|
-
|
|
9
|
+
exports.Command = (0, __1.createHook)();
|
|
10
|
+
// @Extension()
|
|
11
|
+
class CLI {
|
|
17
12
|
constructor() {
|
|
18
13
|
/**
|
|
19
14
|
* registry for the commands hook
|
|
@@ -24,8 +19,6 @@ let CLI = class CLI {
|
|
|
24
19
|
const commands = this.commands.list();
|
|
25
20
|
return commands;
|
|
26
21
|
}
|
|
27
|
-
}
|
|
28
|
-
CLI = __decorate([
|
|
29
|
-
__1.Extension()
|
|
30
|
-
], CLI);
|
|
22
|
+
}
|
|
31
23
|
exports.CLI = CLI;
|
|
24
|
+
//# sourceMappingURL=cli.extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.extension.js","sourceRoot":"","sources":["../../../fixtures/cli/cli.extension.ts"],"names":[],"mappings":";;;AAAA,6BAA8C;AAC9C,6BAA2C;AAE3C;;GAEG;AACU,QAAA,OAAO,GAAG,IAAA,cAAU,GAAE,CAAC;AAOpC,eAAe;AACf,MAAa,GAAG;IAAhB;QACE;;WAEG;QACK,aAAQ,GAAG,gBAAY,CAAC,EAAE,CAAoB,eAAO,CAAC,CAAC;IAMjE,CAAC;IAJC,GAAG;QACD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtC,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAVD,kBAUC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../fixtures/cli/command.ts"],"names":[],"mappings":""}
|
|
@@ -7,7 +7,8 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
7
7
|
o[k2] = m[k];
|
|
8
8
|
}));
|
|
9
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./cli.extension"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../fixtures/cli/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../fixtures/typescript/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -17,12 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
17
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
9
|
});
|
|
19
10
|
};
|
|
20
|
-
var TypeScript_1;
|
|
21
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
12
|
exports.TypeScript = void 0;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
// @Extension({
|
|
14
|
+
// name: 'typescript',
|
|
15
|
+
// dependencies: [BaseCompiler]
|
|
16
|
+
// })
|
|
17
|
+
class TypeScript {
|
|
26
18
|
constructor(compiler) {
|
|
27
19
|
this.compiler = compiler;
|
|
28
20
|
}
|
|
@@ -31,15 +23,9 @@ let TypeScript = TypeScript_1 = class TypeScript {
|
|
|
31
23
|
}
|
|
32
24
|
static provider([baseCompiler]) {
|
|
33
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
return new
|
|
26
|
+
return new TypeScript(baseCompiler.compile());
|
|
35
27
|
});
|
|
36
28
|
}
|
|
37
|
-
}
|
|
38
|
-
TypeScript = TypeScript_1 = __decorate([
|
|
39
|
-
__1.Extension({
|
|
40
|
-
name: 'typescript',
|
|
41
|
-
dependencies: [base_compiler_1.BaseCompiler]
|
|
42
|
-
}),
|
|
43
|
-
__metadata("design:paramtypes", [String])
|
|
44
|
-
], TypeScript);
|
|
29
|
+
}
|
|
45
30
|
exports.TypeScript = TypeScript;
|
|
31
|
+
//# sourceMappingURL=typescript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../fixtures/typescript/typescript.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,eAAe;AACf,wBAAwB;AACxB,iCAAiC;AACjC,KAAK;AACL,MAAa,UAAU;IACrB,YACU,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IACvB,CAAC;IAEJ,OAAO;QACL,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,MAAM,CAAO,QAAQ,CAAC,CAAC,YAAY,CAAiB;;YAClD,OAAO,IAAI,UAAU,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC;QAChD,CAAC;KAAA;CACF;AAZD,gCAYC"}
|
|
@@ -5,11 +5,11 @@ const comment_json_1 = require("comment-json");
|
|
|
5
5
|
const fs_extra_1 = require("fs-extra");
|
|
6
6
|
const read_config_error_1 = require("./exceptions/read-config-error");
|
|
7
7
|
function readConfigFile(path, mustExist = true) {
|
|
8
|
-
if (!mustExist && !fs_extra_1.existsSync(path)) {
|
|
8
|
+
if (!mustExist && !(0, fs_extra_1.existsSync)(path)) {
|
|
9
9
|
return {};
|
|
10
10
|
}
|
|
11
11
|
try {
|
|
12
|
-
const json = comment_json_1.parse(fs_extra_1.readFileSync(path, 'utf8'));
|
|
12
|
+
const json = (0, comment_json_1.parse)((0, fs_extra_1.readFileSync)(path, 'utf8'));
|
|
13
13
|
delete json.$schema;
|
|
14
14
|
return json;
|
|
15
15
|
}
|
|
@@ -18,3 +18,4 @@ function readConfigFile(path, mustExist = true) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
exports.readConfigFile = readConfigFile;
|
|
21
|
+
//# sourceMappingURL=config-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-reader.js","sourceRoot":"","sources":["../../harmony-config/config-reader.ts"],"names":[],"mappings":";;;AAAA,+CAAqC;AACrC,uCAAoD;AACpD,sEAAiE;AAEjE,SAAgB,cAAc,CAAC,IAAY,EAAE,SAAS,GAAG,IAAI;IAC3D,IAAI,CAAC,SAAS,IAAI,CAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,EAAE;QACnC,OAAO,EAAE,CAAC;KACX;IAED,IAAI;QACF,MAAM,IAAI,GAAG,IAAA,oBAAK,EAAC,IAAA,uBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC;QACpB,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,IAAI,mCAAe,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;KACtC;AACH,CAAC;AAZD,wCAYC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReadConfigError = void 0;
|
|
3
4
|
var read_config_error_1 = require("./read-config-error");
|
|
4
5
|
Object.defineProperty(exports, "ReadConfigError", { enumerable: true, get: function () { return read_config_error_1.ReadConfigError; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../harmony-config/exceptions/index.ts"],"names":[],"mappings":";;;AAAA,yDAAsD;AAA7C,oHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-config-error.js","sourceRoot":"","sources":["../../../harmony-config/exceptions/read-config-error.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,IAAY,EAAU,GAAU;QAC1C,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAC;QADlB,QAAG,GAAH,GAAG,CAAO;IAE5C,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;IACxB,CAAC;CACF;AARD,0CAQC"}
|
|
@@ -17,19 +17,20 @@ class HarmonyConfig {
|
|
|
17
17
|
return this.raw;
|
|
18
18
|
}
|
|
19
19
|
toString() {
|
|
20
|
-
return comment_json_1.stringify(this.raw);
|
|
20
|
+
return (0, comment_json_1.stringify)(this.raw);
|
|
21
21
|
}
|
|
22
22
|
static load(fileName, opts) {
|
|
23
23
|
const mergedOpts = Object.assign(defaultConfig, opts);
|
|
24
|
-
const config = config_reader_1.readConfigFile(path_1.join(mergedOpts.cwd, fileName), mergedOpts.shouldThrow);
|
|
24
|
+
const config = (0, config_reader_1.readConfigFile)((0, path_1.join)(mergedOpts.cwd, fileName), mergedOpts.shouldThrow);
|
|
25
25
|
if (mergedOpts.global) {
|
|
26
26
|
return HarmonyConfig.loadGlobal(mergedOpts.global, config);
|
|
27
27
|
}
|
|
28
28
|
return new HarmonyConfig(config);
|
|
29
29
|
}
|
|
30
30
|
static loadGlobal(globalOpts, config = {}) {
|
|
31
|
-
const globalConfig = config_reader_1.readConfigFile(path_1.join(globalOpts.dir || userHome, globalOpts.name), false);
|
|
32
|
-
return new HarmonyConfig(comment_json_1.assign(config, globalConfig));
|
|
31
|
+
const globalConfig = (0, config_reader_1.readConfigFile)((0, path_1.join)(globalOpts.dir || userHome, globalOpts.name), false);
|
|
32
|
+
return new HarmonyConfig((0, comment_json_1.assign)(config, globalConfig));
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
exports.HarmonyConfig = HarmonyConfig;
|
|
36
|
+
//# sourceMappingURL=harmony-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harmony-config.js","sourceRoot":"","sources":["../../harmony-config/harmony-config.ts"],"names":[],"mappings":";;;AAAA,+CAAiD;AACjD,+BAA4B;AAC5B,mDAAiD;AAEjD,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAatC,MAAM,aAAa,GAAG;IACpB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;IAClB,WAAW,EAAE,IAAI;CAClB,CAAC;AAEF,MAAa,aAAa;IACxB,YAAoB,GAAwB;QAAxB,QAAG,GAAH,GAAG,CAAqB;IAAG,CAAC;IAEhD,QAAQ;QACN,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED,QAAQ;QACN,OAAO,IAAA,wBAAS,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,QAAgB,EAAE,IAAoB;QAChD,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,IAAA,8BAAc,EAAC,IAAA,WAAI,EAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;QAEtF,IAAI,UAAU,CAAC,MAAM,EAAE;YACrB,OAAO,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SAC5D;QAED,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,UAA4B,EAAE,SAAc,EAAE;QAC9D,MAAM,YAAY,GAAG,IAAA,8BAAc,EAAC,IAAA,WAAI,EAAC,UAAU,CAAC,GAAG,IAAI,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;QAC9F,OAAO,IAAI,aAAa,CAAC,IAAA,qBAAM,EAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;IACzD,CAAC;CACF;AA1BD,sCA0BC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Config = void 0;
|
|
3
4
|
var harmony_config_1 = require("./harmony-config");
|
|
4
5
|
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return harmony_config_1.HarmonyConfig; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../harmony-config/index.ts"],"names":[],"mappings":";;;AAAA,mDAA2D;AAAlD,wGAAA,aAAa,OAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
//# sourceMappingURL=locator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locator.js","sourceRoot":"","sources":["../../harmony-config/locator.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Harmony is an abstract extension system you can use to make any software extendable and composable. It is the engine that drives Bit extensibility and composability.
|
|
3
|
+
labels: ['aspect', 'composition', 'extendability']
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Basic features
|
|
7
|
+
|
|
8
|
+
Harmony allows you to implement Aspects as the main building blocks that compose your software. Each Aspect has:
|
|
9
|
+
|
|
10
|
+
* Dependency declaration - Where you declare other Aspects as dependencies.
|
|
11
|
+
* Dependency injection - An Aspect gets providers for all its dependencies.
|
|
12
|
+
* Slots - An easy way for an Aspect to provide API for another aspect to hook into any of its processes.
|
|
13
|
+
* Multiple runtimes - Aspect can annotate in which runtimes it can run (for example providing functionality to run on the server and on the browser).
|
|
14
|
+
|
|
15
|
+
## Harmony config file
|
|
16
|
+
|
|
17
|
+
Use a config file to describe your desired composition of Aspects and their configuration. Harmony uses a basic JSON syntax, where each key is an aspect.
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"teambit.dependencies/dependency-resolver": {}, // load an Aspect without providing configuration
|
|
22
|
+
"teambit.workspace/workspace": { // Load an Aspect with configuration
|
|
23
|
+
"name": "bit",
|
|
24
|
+
"icon": "https://static.bit.dev/bit-logo.svg",
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Define an aspect
|
|
29
|
+
|
|
30
|
+
Harmony Aspect is an object that implements the `ExtensionManifest` interface
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
export type ExtensionManifest = {
|
|
34
|
+
/**
|
|
35
|
+
* Aspect's name.
|
|
36
|
+
*/
|
|
37
|
+
name: string;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Aspect unique ID.
|
|
41
|
+
*/
|
|
42
|
+
id?: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Array of dependencies.
|
|
46
|
+
* These other Aspects to be installed and resolved prior to this Aspect activation.
|
|
47
|
+
*/
|
|
48
|
+
dependencies?: ExtensionManifest[];
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Reference to the Aspect factory function.
|
|
52
|
+
*/
|
|
53
|
+
provider?: ProviderFn;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Default Aspect configuration.
|
|
57
|
+
*/
|
|
58
|
+
defaultConfig?: object;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Alias to the provider.
|
|
62
|
+
*/
|
|
63
|
+
provide?: ProviderFn;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Array of slots the Aspect exposes.
|
|
67
|
+
*/
|
|
68
|
+
slots?: SlotProvider<unknown>[],
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Additional keys which might be expected by other Aspects.
|
|
72
|
+
*/
|
|
73
|
+
[key: string]: any;
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Programmatic API
|
|
78
|
+
|
|
79
|
+
### Static API
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
// Create instance of harmony with the provided aspects, on specific runtime, with provided config
|
|
83
|
+
static async load(aspects: Aspect[], runtime: string, globalConfig: GlobalConfig) {
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Instance API
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
// load an Aspect into the dependency graph
|
|
90
|
+
async load(extensions: ExtensionManifest[])
|
|
91
|
+
|
|
92
|
+
// set extensions during Harmony runtime.
|
|
93
|
+
async set(extensions: ExtensionManifest[])
|
|
94
|
+
|
|
95
|
+
export type RequireFn = (aspect: Extension, runtime: RuntimeDefinition) => Promise<void>;
|
|
96
|
+
|
|
97
|
+
// Start harmony.
|
|
98
|
+
// The require function is a function that get's the aspect and its runtime, and knows to require/load it
|
|
99
|
+
async run(requireFn?: RequireFn)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Assumptions
|
|
103
|
+
|
|
104
|
+
* Harmony does not allow circular dependencies between Aspects.
|
|
105
|
+
|
|
106
|
+
<!--
|
|
107
|
+
|
|
108
|
+
-------------------------for reference only - to remove ------------------
|
|
109
|
+
|
|
110
|
+
## composition model
|
|
111
|
+
Harmony proposes a graph composition model.
|
|
112
|
+
composition model should allow:
|
|
113
|
+
|
|
114
|
+
- full control over composition including dependency composition.
|
|
115
|
+
- easy overrides mechanism for configs.
|
|
116
|
+
- full encapsulation of an extension.
|
|
117
|
+
|
|
118
|
+
bit.config.js
|
|
119
|
+
```js
|
|
120
|
+
import FlowSchemaPlugin from '@bit/plugins.flow-schema';
|
|
121
|
+
|
|
122
|
+
export default () => {
|
|
123
|
+
return [ // returns an array of PluginInstance
|
|
124
|
+
[FlowSchemaPlugin, {
|
|
125
|
+
|
|
126
|
+
}],
|
|
127
|
+
[ReactSchemaPlugin, {
|
|
128
|
+
eslintrc: './.eslintrc'
|
|
129
|
+
}]
|
|
130
|
+
];
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
configured extensions in bit.json
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"extensions": {
|
|
138
|
+
"bit.envs/eslint@0.0.4": {
|
|
139
|
+
"eslintrc": "./.eslintrc"
|
|
140
|
+
},
|
|
141
|
+
"bit.envs/babel@0.0.1": {
|
|
142
|
+
"babelrc": "./.babelrc",
|
|
143
|
+
"strict": true,
|
|
144
|
+
"__alias": "compile"
|
|
145
|
+
},
|
|
146
|
+
"bit.envs/webpack@0.0.1": {
|
|
147
|
+
"config": "./webpack.config.js",
|
|
148
|
+
"mode": "prod",
|
|
149
|
+
"__alias": "bundle"
|
|
150
|
+
},
|
|
151
|
+
"bit.envs/mocha@0.0.1": {
|
|
152
|
+
"reporter": "json",
|
|
153
|
+
"mochaOptions": "./mocha.opts",
|
|
154
|
+
"__alias": "test-mocha"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"pipes": {
|
|
158
|
+
"tag": [""]
|
|
159
|
+
},
|
|
160
|
+
"dist": {
|
|
161
|
+
"target": "",
|
|
162
|
+
"entry": ""
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Open questions
|
|
168
|
+
- How do I install a Bit extensions? Where the component is configured?
|
|
169
|
+
- Is the extension installed with Bit/NPM?
|
|
170
|
+
- What's the impl. behind `bit use <plugin/extension name>`
|
|
171
|
+
- maybe an composition model can co-exist as json and js? what are the tradeoffs?
|
|
172
|
+
|
|
173
|
+
## extension registration
|
|
174
|
+
```js
|
|
175
|
+
import { register } from 'harmony';
|
|
176
|
+
import { DocGen } from '@bit/bit.exts.doc-gen';
|
|
177
|
+
|
|
178
|
+
const extensions = register([DocGen]);
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## lifecycle event invocation
|
|
182
|
+
|
|
183
|
+
```js
|
|
184
|
+
import { invoke } from 'harmony';
|
|
185
|
+
|
|
186
|
+
invoke('tag', ...data);
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## lifecycle event registration
|
|
190
|
+
```js
|
|
191
|
+
import { Lifecycle } from 'harmony';
|
|
192
|
+
|
|
193
|
+
@Lifecycle(Tag);
|
|
194
|
+
function tag() {
|
|
195
|
+
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## state / schema management
|
|
200
|
+
```ts
|
|
201
|
+
@Lifecycle(Tag)
|
|
202
|
+
function tag(component: Component) {
|
|
203
|
+
const docs = component.get('docs'); // returns `Maybe` type?
|
|
204
|
+
const docs: Docs = docs.get();
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## function extension
|
|
209
|
+
|
|
210
|
+
```js
|
|
211
|
+
export default function foo() {
|
|
212
|
+
context.a
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## configuration
|
|
217
|
+
an extension can declaratively ask for configuration type. this can be reflected
|
|
218
|
+
- extensions can be configured during instantiation.
|
|
219
|
+
- configuration types can be built from multiple sources
|
|
220
|
+
|
|
221
|
+
## context
|
|
222
|
+
- standard context can be shared between all extensions in the same instance.
|
|
223
|
+
|
|
224
|
+
## extension composition
|
|
225
|
+
- hook invocation from an extension
|
|
226
|
+
- extension dependencies? how can an extension declare a dependency as part of its execution?
|
|
227
|
+
- contextual/namespaced hooks
|
|
228
|
+
- config api
|
|
229
|
+
|
|
230
|
+
## extension resolution
|
|
231
|
+
```js
|
|
232
|
+
import { resolve } from 'harmony';
|
|
233
|
+
|
|
234
|
+
const extension = resolve('doc-gen');
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Questions (?)
|
|
238
|
+
- can extensions be added/configured during runtime? DI
|
|
239
|
+
- is there a difference between extension composition to registration?
|
|
240
|
+
- how to make autocomplete work for hooks?
|
|
241
|
+
- how to avoid unintentional hook invocation (decorators?)
|
|
242
|
+
- how to declare a new hook..
|
|
243
|
+
- schema validator
|
|
244
|
+
- dev experience of an extension.
|
|
245
|
+
- how do manage different runtime environments? should I? Why is that relevant?
|
|
246
|
+
- runtime capsules?
|
|
247
|
+
- how can one extension run from both server and client? how capsule is related?
|
|
248
|
+
- in which process extensions will run from? also, what will happen from the backend?
|
|
249
|
+
-
|
|
250
|
+
-->
|