@teambit/harmony.testing.load-aspect 0.0.4 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/load-aspect.js +10 -3
- package/dist/load-aspect.js.map +1 -1
- package/dist/tsconfig.json +32 -0
- package/load-aspect.ts +10 -4
- package/package-tar/teambit-harmony.testing.load-aspect-0.0.7.tgz +0 -0
- package/package.json +3 -3
- package/preview-1657251036992.js +5 -0
- package/tsconfig.json +8 -2
- package/package-tar/teambit-harmony.testing.load-aspect-0.0.4.tgz +0 -0
- package/preview-1648265027481.js +0 -1
package/dist/load-aspect.js
CHANGED
|
@@ -18,8 +18,9 @@ const consumer_1 = require("@teambit/legacy/dist/consumer");
|
|
|
18
18
|
const utils_1 = require("@teambit/legacy/dist/utils");
|
|
19
19
|
const fs_1 = require("fs");
|
|
20
20
|
const harmony_1 = require("@teambit/harmony");
|
|
21
|
-
|
|
21
|
+
// TODO: expose this types from harmony (once we have a way to expose it only for node)
|
|
22
22
|
const harmony_config_1 = require("@teambit/harmony/dist/harmony-config");
|
|
23
|
+
const component_1 = require("@teambit/component");
|
|
23
24
|
const cli_1 = require("@teambit/cli");
|
|
24
25
|
const node_1 = require("@teambit/node");
|
|
25
26
|
const component_loader_1 = __importDefault(require("@teambit/legacy/dist/consumer/component/component-loader"));
|
|
@@ -61,8 +62,14 @@ function loadAspect(targetAspect, cwd = process.cwd(), runtime = 'main') {
|
|
|
61
62
|
throw new Error(`could not find runtime '${runtimeDef.name}' for aspect ID '${aspect.id}'`);
|
|
62
63
|
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
63
64
|
const runtimeC = require((0, path_1.join)(packagePath, runtimePath));
|
|
64
|
-
if (aspect.id === targetAspect.id) {
|
|
65
|
-
|
|
65
|
+
if (aspect.manifest._runtimes.length === 0 || aspect.id === targetAspect.id) {
|
|
66
|
+
// core-aspects running outside of bit-bin repo end up here. they don't have runtime.
|
|
67
|
+
// this makes sure to load them from the path were they're imported
|
|
68
|
+
if (!runtimeC.default) {
|
|
69
|
+
throw new Error(`error: ${aspect.id} does not export its main-runtime as default.
|
|
70
|
+
go to the aspect-main file and add a new line with "export default YourAspectMain"`);
|
|
71
|
+
}
|
|
72
|
+
aspect.manifest.addRuntime(runtimeC.default);
|
|
66
73
|
}
|
|
67
74
|
}));
|
|
68
75
|
return harmony.get(targetAspect.id);
|
package/dist/load-aspect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-aspect.js","sourceRoot":"","sources":["../load-aspect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAqC;AACrC,4DAA8E;AAC9E,sDAA8E;AAC9E,2BAAiC;
|
|
1
|
+
{"version":3,"file":"load-aspect.js","sourceRoot":"","sources":["../load-aspect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAqC;AACrC,4DAA8E;AAC9E,sDAA8E;AAC9E,2BAAiC;AACjC,8CAAmD;AACnD,uFAAuF;AACvF,yEAA6E;AAC7E,kDAAiD;AACjD,sCAAyC;AACzC,wCAA2C;AAC3C,gHAAuF;AACvF,6GAAoF;AACpF,mHAA0F;AAC1F,+GAA0G;AAC1G,gIAAsG;AACtG,iEAAyE;AACzE,6GAAoF;AACpF,kHAA8G;AAE9G,SAAS,cAAc,CAAC,MAAW,EAAE,EAAe;IAClD,OAAO,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC;IAC7B,8CAA8C;IAC9C,oDAAoD;AACtD,CAAC;AAED;;;GAGG;AACH,SAAsB,UAAU,CAAI,YAAoB,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,GAAG,MAAM;;QAC7F,oBAAoB,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpC,SAAS,CAAC,qBAAqB,CA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e,CAAC,0BAA0B,GAAG,EAAE,CAAC;IAChD,6BAAkB,CAAC,iCAAiC,GAAG,EAAE,CAAC;IAC1D,0BAAe,CAAC,oCAAoC,GAAG,EAAE,CAAC;IAC1D,0BAAe,CAAC,8BAA8B,GAAG,EAAE,CAAC;IACpD,iDAAsB,CAAC,+BAA+B,GAAG,EAAE,CAAC;IAC5D,aAAa;IACb,wCAAkB,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAClD,aAAa;IACb,gCAAoB,CAAC,iBAAiB,GAAG,EAAE,CAAC;IAC5C,0BAAiB,CAAC,mBAAmB,GAAG,IAAI,GAAG,EAAE,CAAC;IAClD,aAAa;IACb,0BAAe,CAAC,+BAA+B,GAAG,SAAS,CAAC;IAC5D,aAAa;IACb,0BAAe,CAAC,8BAA8B,GAAG,SAAS,CAAC;IAC3D,aAAa;IACb,0BAAe,CAAC,8BAA8B,GAAG,SAAS,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": [
|
|
4
|
+
"es2019",
|
|
5
|
+
"DOM",
|
|
6
|
+
"ES6",
|
|
7
|
+
"DOM.Iterable"
|
|
8
|
+
],
|
|
9
|
+
"target": "es2015",
|
|
10
|
+
"module": "CommonJS",
|
|
11
|
+
"jsx": "react",
|
|
12
|
+
"allowJs": true,
|
|
13
|
+
"composite": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"experimentalDecorators": true,
|
|
18
|
+
"outDir": "dist",
|
|
19
|
+
"moduleResolution": "node",
|
|
20
|
+
"esModuleInterop": true,
|
|
21
|
+
"rootDir": ".",
|
|
22
|
+
"resolveJsonModule": true
|
|
23
|
+
},
|
|
24
|
+
"exclude": [
|
|
25
|
+
"dist",
|
|
26
|
+
"package.json"
|
|
27
|
+
],
|
|
28
|
+
"include": [
|
|
29
|
+
"**/*",
|
|
30
|
+
"**/*.json"
|
|
31
|
+
]
|
|
32
|
+
}
|
package/load-aspect.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { resolve, join } from 'path';
|
|
|
2
2
|
import { getConsumerInfo, loadConsumer } from '@teambit/legacy/dist/consumer';
|
|
3
3
|
import { propogateUntil as propagateUntil } from '@teambit/legacy/dist/utils';
|
|
4
4
|
import { readdirSync } from 'fs';
|
|
5
|
-
import { ConfigOptions } from '@teambit/harmony/dist/harmony-config/harmony-config';
|
|
6
5
|
import { Harmony, Aspect } from '@teambit/harmony';
|
|
6
|
+
// TODO: expose this types from harmony (once we have a way to expose it only for node)
|
|
7
|
+
import { Config, ConfigOptions } from '@teambit/harmony/dist/harmony-config';
|
|
7
8
|
import { ComponentID } from '@teambit/component';
|
|
8
|
-
import { Config } from '@teambit/harmony/dist/harmony-config';
|
|
9
9
|
import { CLIAspect } from '@teambit/cli';
|
|
10
10
|
import { NodeAspect } from '@teambit/node';
|
|
11
11
|
import ComponentLoader from '@teambit/legacy/dist/consumer/component/component-loader';
|
|
@@ -49,8 +49,14 @@ export async function loadAspect<T>(targetAspect: Aspect, cwd = process.cwd(), r
|
|
|
49
49
|
if (!runtimePath) throw new Error(`could not find runtime '${runtimeDef.name}' for aspect ID '${aspect.id}'`);
|
|
50
50
|
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
51
51
|
const runtimeC = require(join(packagePath, runtimePath));
|
|
52
|
-
if (aspect.id === targetAspect.id) {
|
|
53
|
-
|
|
52
|
+
if (aspect.manifest._runtimes.length === 0 || aspect.id === targetAspect.id) {
|
|
53
|
+
// core-aspects running outside of bit-bin repo end up here. they don't have runtime.
|
|
54
|
+
// this makes sure to load them from the path were they're imported
|
|
55
|
+
if (!runtimeC.default) {
|
|
56
|
+
throw new Error(`error: ${aspect.id} does not export its main-runtime as default.
|
|
57
|
+
go to the aspect-main file and add a new line with "export default YourAspectMain"`);
|
|
58
|
+
}
|
|
59
|
+
aspect.manifest.addRuntime(runtimeC.default);
|
|
54
60
|
}
|
|
55
61
|
});
|
|
56
62
|
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/harmony.testing.load-aspect",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/harmony/testing/load-aspect",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.harmony",
|
|
8
8
|
"name": "testing/load-aspect",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.7"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@teambit/harmony": "0.
|
|
12
|
+
"@teambit/harmony": "0.3.3"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@types/mocha": "9.1.0",
|
package/tsconfig.json
CHANGED
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
"DOM.Iterable"
|
|
8
8
|
],
|
|
9
9
|
"target": "es2015",
|
|
10
|
-
"module": "
|
|
10
|
+
"module": "CommonJS",
|
|
11
11
|
"jsx": "react",
|
|
12
12
|
"allowJs": true,
|
|
13
13
|
"composite": true,
|
|
14
14
|
"declaration": true,
|
|
15
15
|
"sourceMap": true,
|
|
16
16
|
"skipLibCheck": true,
|
|
17
|
+
"experimentalDecorators": true,
|
|
17
18
|
"outDir": "dist",
|
|
18
19
|
"moduleResolution": "node",
|
|
19
20
|
"esModuleInterop": true,
|
|
@@ -21,6 +22,11 @@
|
|
|
21
22
|
"resolveJsonModule": true
|
|
22
23
|
},
|
|
23
24
|
"exclude": [
|
|
24
|
-
"dist"
|
|
25
|
+
"dist",
|
|
26
|
+
"package.json"
|
|
27
|
+
],
|
|
28
|
+
"include": [
|
|
29
|
+
"**/*",
|
|
30
|
+
"**/*.json"
|
|
25
31
|
]
|
|
26
32
|
}
|
|
Binary file
|
package/preview-1648265027481.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|