piral-cli 0.15.0-beta.4630 → 0.15.0-beta.4633
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/lib/apps/build-pilet.js +6 -5
- package/lib/apps/build-pilet.js.map +1 -1
- package/lib/apps/build-piral.js +7 -6
- package/lib/apps/build-piral.js.map +1 -1
- package/lib/apps/debug-pilet.js +68 -57
- package/lib/apps/debug-pilet.js.map +1 -1
- package/lib/apps/debug-piral.js +6 -3
- package/lib/apps/debug-piral.js.map +1 -1
- package/lib/apps/publish-pilet.js +3 -3
- package/lib/apps/publish-pilet.js.map +1 -1
- package/lib/build/run-build-pilet.js +4 -4
- package/lib/build/run-build-pilet.js.map +1 -1
- package/lib/build/run-build-piral.js +3 -3
- package/lib/build/run-build-piral.js.map +1 -1
- package/lib/build/run-debug-mono-piral.js +3 -3
- package/lib/build/run-debug-mono-piral.js.map +1 -1
- package/lib/build/run-debug-pilet.js +4 -4
- package/lib/build/run-debug-pilet.js.map +1 -1
- package/lib/build/run-debug-piral.js +3 -3
- package/lib/build/run-debug-piral.js.map +1 -1
- package/lib/common/envs.js +7 -4
- package/lib/common/envs.js.map +1 -1
- package/lib/types/public.d.ts +7 -7
- package/package.json +3 -3
- package/src/apps/build-pilet.ts +7 -5
- package/src/apps/build-piral.ts +7 -6
- package/src/apps/debug-pilet.ts +103 -88
- package/src/apps/debug-piral.ts +4 -3
- package/src/apps/publish-pilet.ts +3 -3
- package/src/build/run-build-pilet.ts +4 -4
- package/src/build/run-build-piral.ts +3 -3
- package/src/build/run-debug-mono-piral.ts +3 -3
- package/src/build/run-debug-pilet.ts +5 -4
- package/src/build/run-debug-piral.ts +3 -3
- package/src/common/envs.ts +6 -4
- package/src/types/public.ts +7 -7
|
@@ -12,10 +12,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
const path_1 = require("path");
|
|
13
13
|
const common_1 = require("../common");
|
|
14
14
|
let handler;
|
|
15
|
-
function run(root, outFile, outDir,
|
|
15
|
+
function run(root, outFile, outDir, piralInstances, hmr, externals, publicUrl, entryFiles, logLevel, args) {
|
|
16
16
|
(0, common_1.progress)(`Preparing supplied Piral instance ...`);
|
|
17
17
|
(0, common_1.setStandardEnvs)({
|
|
18
|
-
|
|
18
|
+
piralInstances,
|
|
19
19
|
dependencies: externals,
|
|
20
20
|
publicPath: publicUrl,
|
|
21
21
|
production: false,
|
|
@@ -49,7 +49,7 @@ process.on('message', (msg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
49
49
|
case 'start':
|
|
50
50
|
const root = process.cwd();
|
|
51
51
|
const outDir = (0, path_1.resolve)(root, 'dist', 'app');
|
|
52
|
-
const bundler = yield run(root, msg.outFile, outDir, msg.
|
|
52
|
+
const bundler = yield run(root, msg.outFile, outDir, msg.piralInstances, true, msg.externals, msg.publicUrl, msg.entryFiles, msg.logLevel, msg);
|
|
53
53
|
const result = yield bundler.bundle();
|
|
54
54
|
(0, common_1.logReset)();
|
|
55
55
|
if (result) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-debug-mono-piral.js","sourceRoot":"","sources":["../../src/build/run-debug-mono-piral.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+BAA+B;AAC/B,sCAAgE;AAGhE,IAAI,OAA0B,CAAC;AAE/B,SAAS,GAAG,CACV,IAAY,EACZ,OAAe,EACf,MAAc,EACd,
|
|
1
|
+
{"version":3,"file":"run-debug-mono-piral.js","sourceRoot":"","sources":["../../src/build/run-debug-mono-piral.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+BAA+B;AAC/B,sCAAgE;AAGhE,IAAI,OAA0B,CAAC;AAE/B,SAAS,GAAG,CACV,IAAY,EACZ,OAAe,EACf,MAAc,EACd,cAA6B,EAC7B,GAAY,EACZ,SAAwB,EACxB,SAAiB,EACjB,UAAkB,EAClB,QAAmB,EACnB,IAAS;IAET,IAAA,iBAAQ,EAAC,uCAAuC,CAAC,CAAC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EAAE,MAAM;wBACZ,MAAM,EAAE,MAAM,CAAC,MAAM;wBACrB,OAAO,EAAE,MAAM,CAAC,OAAO;qBACxB,CAAC,CAAC;iBACJ;gBAED,MAAM;SACT;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO;SACtB,CAAC,CAAC;KACJ;AACH,CAAC,CAAA,CAAC,CAAC"}
|
|
@@ -12,15 +12,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
const common_1 = require("../common");
|
|
13
13
|
let handler;
|
|
14
14
|
let bundler;
|
|
15
|
-
function run(root, targetDir, outDir, outFile,
|
|
15
|
+
function run(root, targetDir, outDir, outFile, piralInstances, externals, importmap, entryModule, version, logLevel, args) {
|
|
16
16
|
(0, common_1.setStandardEnvs)({
|
|
17
17
|
production: false,
|
|
18
|
-
|
|
18
|
+
piralInstances,
|
|
19
19
|
root,
|
|
20
20
|
});
|
|
21
21
|
return handler.create({
|
|
22
22
|
root,
|
|
23
|
-
|
|
23
|
+
piralInstances,
|
|
24
24
|
entryModule,
|
|
25
25
|
targetDir,
|
|
26
26
|
outDir,
|
|
@@ -50,7 +50,7 @@ process.on('message', (msg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
50
50
|
}
|
|
51
51
|
break;
|
|
52
52
|
case 'start':
|
|
53
|
-
bundler = yield run(root, msg.targetDir, msg.outDir, msg.outFile, msg.
|
|
53
|
+
bundler = yield run(root, msg.targetDir, msg.outDir, msg.outFile, msg.piralInstances, msg.externals, msg.importmap, msg.entryModule, msg.version, msg.logLevel, msg);
|
|
54
54
|
if (bundler) {
|
|
55
55
|
bundler.onStart(() => {
|
|
56
56
|
process.send({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-debug-pilet.js","sourceRoot":"","sources":["../../src/build/run-debug-pilet.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA4C;AAS5C,IAAI,OAA0B,CAAC;AAC/B,IAAI,OAA8B,CAAC;AAEnC,SAAS,GAAG,CACV,IAAY,EACZ,SAAiB,EACjB,MAAc,EACd,OAAe,EACf,
|
|
1
|
+
{"version":3,"file":"run-debug-pilet.js","sourceRoot":"","sources":["../../src/build/run-debug-pilet.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA4C;AAS5C,IAAI,OAA0B,CAAC;AAC/B,IAAI,OAA8B,CAAC;AAEnC,SAAS,GAAG,CACV,IAAY,EACZ,SAAiB,EACjB,MAAc,EACd,OAAe,EACf,cAA6B,EAC7B,SAAwB,EACxB,SAAkC,EAClC,WAAmB,EACnB,OAA2B,EAC3B,QAAmB,EACnB,IAAS;IAET,IAAA,wBAAe,EAAC;QACd,UAAU,EAAE,KAAK;QACjB,cAAc;QACd,IAAI;KACL,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,MAAM,CAAC;QACpB,IAAI;QACJ,cAAc;QACd,WAAW;QACX,SAAS;QACT,MAAM;QACN,OAAO;QACP,SAAS;QACT,SAAS;QACT,OAAO;QACP,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,IAAI;QAChB,WAAW,EAAE,IAAI;QACjB,MAAM,EAAE,KAAK;QACb,QAAQ;QACR,KAAK,EAAE,IAAI;QACX,IAAI;KACL,CAAC,CAAC;AACL,CAAC;AAED,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAO,GAAG,EAAE,EAAE;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE3B,IAAI;QACF,QAAQ,GAAG,CAAC,IAAI,EAAE;YAChB,KAAK,MAAM;gBACT,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAC5B,MAAM;YACR,KAAK,QAAQ;gBACX,IAAI,OAAO,EAAE;oBACX,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;iBACx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Module", { value: true });
|
|
|
12
12
|
const common_1 = require("../common");
|
|
13
13
|
let handler;
|
|
14
14
|
let bundler;
|
|
15
|
-
function run(root, outFile, outDir,
|
|
15
|
+
function run(root, outFile, outDir, piralInstances, hmr, externals, publicUrl, entryFiles, logLevel, args) {
|
|
16
16
|
(0, common_1.setStandardEnvs)({
|
|
17
17
|
root,
|
|
18
18
|
debugPiral: true,
|
|
19
19
|
dependencies: externals,
|
|
20
20
|
publicPath: publicUrl,
|
|
21
|
-
|
|
21
|
+
piralInstances,
|
|
22
22
|
});
|
|
23
23
|
return handler.create({
|
|
24
24
|
root,
|
|
@@ -50,7 +50,7 @@ process.on('message', (msg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
50
50
|
}
|
|
51
51
|
break;
|
|
52
52
|
case 'start':
|
|
53
|
-
bundler = yield run(root, msg.outFile, msg.outDir, msg.
|
|
53
|
+
bundler = yield run(root, msg.outFile, msg.outDir, msg.piralInstances, msg.hmr, msg.externals, msg.publicUrl, msg.entryFiles, msg.logLevel, msg);
|
|
54
54
|
if (bundler) {
|
|
55
55
|
bundler.onStart(() => {
|
|
56
56
|
process.send({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-debug-piral.js","sourceRoot":"","sources":["../../src/build/run-debug-piral.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA4C;AAG5C,IAAI,OAA0B,CAAC;AAC/B,IAAI,OAA8B,CAAC;AAEnC,SAAS,GAAG,CACV,IAAY,EACZ,OAAe,EACf,MAAc,EACd,
|
|
1
|
+
{"version":3,"file":"run-debug-piral.js","sourceRoot":"","sources":["../../src/build/run-debug-piral.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA4C;AAG5C,IAAI,OAA0B,CAAC;AAC/B,IAAI,OAA8B,CAAC;AAEnC,SAAS,GAAG,CACV,IAAY,EACZ,OAAe,EACf,MAAc,EACd,cAA6B,EAC7B,GAAY,EACZ,SAAwB,EACxB,SAAiB,EACj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ACL,CAAC,CAAC,CAAC;oBAEH,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE;wBACvB,OAAO,CAAC,IAAI,CAAC;4BACX,IAAI,EAAE,QAAQ;4BACd,OAAO,EAAE,MAAM,CAAC,IAAI;4BACpB,OAAO,EAAE,YAAY;4BACrB,IAAI,EAAE;gCACJ,IAAI;6BACL;yBACF,CAAC,CAAC;oBACL,CAAC,CAAC,CAAC;oBAEH,OAAO,CAAC,IAAI,CAAC;wBACX,IAAI,EAAE,MAAM;wBACZ,MAAM,EAAE,GAAG,CAAC,MAAM;qBACnB,CAAC,CAAC;iBACJ;gBAED,MAAM;SACT;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO;SACtB,CAAC,CAAC;KACJ;AACH,CAAC,CAAA,CAAC,CAAC"}
|
package/lib/common/envs.js
CHANGED
|
@@ -43,11 +43,14 @@ function setStandardEnvs(options) {
|
|
|
43
43
|
else if (!process.env.NODE_ENV) {
|
|
44
44
|
process.env.NODE_ENV = 'development';
|
|
45
45
|
}
|
|
46
|
-
if (options.
|
|
47
|
-
process.env.PIRAL_INSTANCE = options.
|
|
46
|
+
if (Array.isArray(options.piralInstances) && options.piralInstances.length) {
|
|
47
|
+
process.env.PIRAL_INSTANCE = options.piralInstances.join(',');
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
else {
|
|
50
|
+
options.piralInstances = [];
|
|
51
|
+
}
|
|
52
|
+
if (Array.isArray(options.dependencies) && options.dependencies.length) {
|
|
53
|
+
const excludedDependencies = [...constants_1.frameworkLibs, ...options.piralInstances];
|
|
51
54
|
const dependencies = options.dependencies.filter((m) => !excludedDependencies.includes(m));
|
|
52
55
|
process.env.SHARED_DEPENDENCIES = dependencies.join(',');
|
|
53
56
|
}
|
package/lib/common/envs.js.map
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AAC;KACrC;SAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE;QAChC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,aAAa,CAAC;KACtC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE;QAC1E,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAC/D;SAAM;QACL,OAAO,CAAC,cAAc,GAAG,EAAE,CAAC;KAC7B;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE;QACtE,MAAM,oBAAoB,GAAG,CAAC,GAAG,yBAAa,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;QAC3E,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3F,OAAO,CAAC,GAAG,CAAC,mBAAmB,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAC1D;SAAM;QACL,OAAO,CAAC,GAAG,CAAC,mBAAmB,GAAG,EAAE,CAAC;KACtC;AACH,CAAC;AAnDD,0CAmDC"}
|
package/lib/types/public.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export interface BaseBundleParameters {
|
|
|
55
55
|
_: Record<string, any>;
|
|
56
56
|
}
|
|
57
57
|
export interface DebugPiralParameters extends BaseBundleParameters {
|
|
58
|
-
|
|
58
|
+
piralInstances: Array<string>;
|
|
59
59
|
hmr: boolean;
|
|
60
60
|
externals: Array<string>;
|
|
61
61
|
publicUrl: string;
|
|
@@ -65,14 +65,14 @@ export interface DebugPiralParameters extends BaseBundleParameters {
|
|
|
65
65
|
logLevel: LogLevels;
|
|
66
66
|
}
|
|
67
67
|
export interface WatchPiralParameters extends BaseBundleParameters {
|
|
68
|
-
|
|
68
|
+
piralInstances: Array<string>;
|
|
69
69
|
externals: Array<string>;
|
|
70
70
|
publicUrl: string;
|
|
71
71
|
entryFiles: string;
|
|
72
72
|
logLevel: LogLevels;
|
|
73
73
|
}
|
|
74
74
|
export interface BuildPiralParameters extends BaseBundleParameters {
|
|
75
|
-
|
|
75
|
+
piralInstances: Array<string>;
|
|
76
76
|
emulator: boolean;
|
|
77
77
|
standalone: boolean;
|
|
78
78
|
sourceMaps: boolean;
|
|
@@ -86,7 +86,7 @@ export interface BuildPiralParameters extends BaseBundleParameters {
|
|
|
86
86
|
logLevel: LogLevels;
|
|
87
87
|
}
|
|
88
88
|
export interface DebugPiletParameters extends BaseBundleParameters {
|
|
89
|
-
|
|
89
|
+
piralInstances: Array<string>;
|
|
90
90
|
hmr: boolean;
|
|
91
91
|
externals: Array<string>;
|
|
92
92
|
importmap: Array<SharedDependency>;
|
|
@@ -98,7 +98,7 @@ export interface DebugPiletParameters extends BaseBundleParameters {
|
|
|
98
98
|
version: PiletSchemaVersion;
|
|
99
99
|
}
|
|
100
100
|
export interface BuildPiletParameters extends BaseBundleParameters {
|
|
101
|
-
|
|
101
|
+
piralInstances: Array<string>;
|
|
102
102
|
sourceMaps: boolean;
|
|
103
103
|
contentHash: boolean;
|
|
104
104
|
minify: boolean;
|
|
@@ -153,7 +153,7 @@ export interface PiralBuildHandler {
|
|
|
153
153
|
export interface PiletBuildHandler {
|
|
154
154
|
create(config: {
|
|
155
155
|
root: string;
|
|
156
|
-
|
|
156
|
+
piralInstances: Array<string>;
|
|
157
157
|
entryModule: string;
|
|
158
158
|
targetDir: string;
|
|
159
159
|
outDir: string;
|
|
@@ -204,6 +204,6 @@ export interface StandardEnvProps {
|
|
|
204
204
|
debugPilet?: boolean;
|
|
205
205
|
root: string;
|
|
206
206
|
publicPath?: string;
|
|
207
|
-
|
|
207
|
+
piralInstances?: Array<string>;
|
|
208
208
|
dependencies?: Array<string>;
|
|
209
209
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-cli",
|
|
3
|
-
"version": "0.15.0-beta.
|
|
3
|
+
"version": "0.15.0-beta.4633",
|
|
4
4
|
"description": "The standard CLI for creating and building a Piral instance or a Pilet.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portal",
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"chalk": "^2.4.2",
|
|
75
75
|
"dets": "^0.12.0",
|
|
76
|
-
"kras": "^0.15.
|
|
76
|
+
"kras": "^0.15.1",
|
|
77
77
|
"rimraf": "^3.0.0",
|
|
78
78
|
"typescript": "^4.7.3",
|
|
79
79
|
"yargs": "^15.4.1"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "96b950f26e9673595f68518103508dfc76001761"
|
|
82
82
|
}
|
package/src/apps/build-pilet.ts
CHANGED
|
@@ -212,8 +212,8 @@ export async function buildPilet(baseDir = process.cwd(), options: BuildPiletOpt
|
|
|
212
212
|
targetDir,
|
|
213
213
|
app,
|
|
214
214
|
);
|
|
215
|
-
const
|
|
216
|
-
const externals = combinePiletExternals(
|
|
215
|
+
const piralInstances = apps.map(m => m.appPackage.name);
|
|
216
|
+
const externals = combinePiletExternals(piralInstances, peerDependencies, peerModules, importmap);
|
|
217
217
|
const dest = resolve(root, target);
|
|
218
218
|
const outDir = dirname(dest);
|
|
219
219
|
const outFile = basename(dest);
|
|
@@ -230,7 +230,7 @@ export async function buildPilet(baseDir = process.cwd(), options: BuildPiletOpt
|
|
|
230
230
|
await callPiletBuild(
|
|
231
231
|
{
|
|
232
232
|
root,
|
|
233
|
-
|
|
233
|
+
piralInstances,
|
|
234
234
|
optimizeModules,
|
|
235
235
|
sourceMaps,
|
|
236
236
|
contentHash,
|
|
@@ -282,7 +282,9 @@ export async function buildPilet(baseDir = process.cwd(), options: BuildPiletOpt
|
|
|
282
282
|
const distDir = dirname(resolve(fullBase, target));
|
|
283
283
|
const outDir = resolve(distDir, 'standalone');
|
|
284
284
|
const { apps, root } = pilets[0];
|
|
285
|
+
|
|
285
286
|
const { appPackage, appFile } = apps[0];
|
|
287
|
+
const piralInstances = [appPackage.name];
|
|
286
288
|
const isEmulator = checkAppShellPackage(appPackage);
|
|
287
289
|
|
|
288
290
|
logInfo('Building standalone solution ...');
|
|
@@ -306,7 +308,7 @@ export async function buildPilet(baseDir = process.cwd(), options: BuildPiletOpt
|
|
|
306
308
|
await callPiralBuild(
|
|
307
309
|
{
|
|
308
310
|
root,
|
|
309
|
-
|
|
311
|
+
piralInstances,
|
|
310
312
|
emulator: false,
|
|
311
313
|
standalone: true,
|
|
312
314
|
optimizeModules: false,
|
|
@@ -331,7 +333,7 @@ export async function buildPilet(baseDir = process.cwd(), options: BuildPiletOpt
|
|
|
331
333
|
await callPiralBuild(
|
|
332
334
|
{
|
|
333
335
|
root,
|
|
334
|
-
|
|
336
|
+
piralInstances,
|
|
335
337
|
emulator: false,
|
|
336
338
|
standalone: true,
|
|
337
339
|
optimizeModules: false,
|
package/src/apps/build-piral.ts
CHANGED
|
@@ -156,6 +156,7 @@ export async function buildPiral(baseDir = process.cwd(), options: BuildPiralOpt
|
|
|
156
156
|
progress('Reading configuration ...');
|
|
157
157
|
const entryFiles = await retrievePiralRoot(fullBase, entry);
|
|
158
158
|
const { name, root, ignored, externals, scripts } = await retrievePiletsInfo(entryFiles);
|
|
159
|
+
const piralInstances = [name];
|
|
159
160
|
const dest = getDestination(entryFiles, resolve(fullBase, target));
|
|
160
161
|
|
|
161
162
|
await checkCliCompatibility(root);
|
|
@@ -174,7 +175,7 @@ export async function buildPiral(baseDir = process.cwd(), options: BuildPiralOpt
|
|
|
174
175
|
// since we create this anyway let's just pretend we want to have it clean!
|
|
175
176
|
await removeDirectory(targetDir);
|
|
176
177
|
|
|
177
|
-
await hooks.beforeBuild?.({ root, publicUrl: emulatorPublicUrl, externals, entryFiles, targetDir,
|
|
178
|
+
await hooks.beforeBuild?.({ root, publicUrl: emulatorPublicUrl, externals, entryFiles, targetDir, piralInstances });
|
|
178
179
|
|
|
179
180
|
logInfo(`Bundle ${emulatorName} ...`);
|
|
180
181
|
const {
|
|
@@ -184,7 +185,7 @@ export async function buildPiral(baseDir = process.cwd(), options: BuildPiralOpt
|
|
|
184
185
|
} = await callPiralBuild(
|
|
185
186
|
{
|
|
186
187
|
root,
|
|
187
|
-
|
|
188
|
+
piralInstances,
|
|
188
189
|
emulator: true,
|
|
189
190
|
standalone: false,
|
|
190
191
|
optimizeModules,
|
|
@@ -209,7 +210,7 @@ export async function buildPiral(baseDir = process.cwd(), options: BuildPiralOpt
|
|
|
209
210
|
externals,
|
|
210
211
|
entryFiles,
|
|
211
212
|
targetDir,
|
|
212
|
-
|
|
213
|
+
piralInstances,
|
|
213
214
|
hash,
|
|
214
215
|
outDir,
|
|
215
216
|
outFile,
|
|
@@ -246,7 +247,7 @@ export async function buildPiral(baseDir = process.cwd(), options: BuildPiralOpt
|
|
|
246
247
|
|
|
247
248
|
logInfo(`Bundle ${releaseName} ...`);
|
|
248
249
|
|
|
249
|
-
await hooks.beforeBuild?.({ root, publicUrl, externals, entryFiles, targetDir,
|
|
250
|
+
await hooks.beforeBuild?.({ root, publicUrl, externals, entryFiles, targetDir, piralInstances });
|
|
250
251
|
|
|
251
252
|
const {
|
|
252
253
|
dir: outDir,
|
|
@@ -255,7 +256,7 @@ export async function buildPiral(baseDir = process.cwd(), options: BuildPiralOpt
|
|
|
255
256
|
} = await callPiralBuild(
|
|
256
257
|
{
|
|
257
258
|
root,
|
|
258
|
-
|
|
259
|
+
piralInstances,
|
|
259
260
|
emulator: false,
|
|
260
261
|
standalone: false,
|
|
261
262
|
optimizeModules,
|
|
@@ -274,7 +275,7 @@ export async function buildPiral(baseDir = process.cwd(), options: BuildPiralOpt
|
|
|
274
275
|
bundlerName,
|
|
275
276
|
);
|
|
276
277
|
|
|
277
|
-
await hooks.afterBuild?.({ root, publicUrl, externals, entryFiles, targetDir,
|
|
278
|
+
await hooks.afterBuild?.({ root, publicUrl, externals, entryFiles, targetDir, piralInstances, outDir, outFile, hash });
|
|
278
279
|
|
|
279
280
|
await runLifecycle(root, scripts, 'piral:postbuild');
|
|
280
281
|
await runLifecycle(root, scripts, `piral:postbuild-${releaseName}`);
|
package/src/apps/debug-pilet.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join, dirname, resolve, relative, basename } from 'path';
|
|
2
|
-
import { readKrasConfig, krasrc, buildKrasWithCli
|
|
2
|
+
import { readKrasConfig, krasrc, buildKrasWithCli } from 'kras';
|
|
3
3
|
import { callDebugPiralFromMonoRepo, callPiletDebug } from '../bundler';
|
|
4
|
-
import { LogLevels, PiletSchemaVersion } from '../types';
|
|
4
|
+
import { AppDefinition, LogLevels, PiletSchemaVersion } from '../types';
|
|
5
5
|
import {
|
|
6
6
|
checkExistingDirectory,
|
|
7
7
|
retrievePiletData,
|
|
@@ -133,46 +133,60 @@ export const debugPiletDefaults: DebugPiletOptions = {
|
|
|
133
133
|
concurrency: cpuCount,
|
|
134
134
|
};
|
|
135
135
|
|
|
136
|
-
const injectorName = resolve(__dirname, '../injectors/pilet.js');
|
|
137
|
-
|
|
138
136
|
interface AppInfo {
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
apps: Array<AppDefinition>;
|
|
138
|
+
root: string;
|
|
139
|
+
mocks: string;
|
|
141
140
|
publicUrl: string;
|
|
142
|
-
appVersion: string;
|
|
143
141
|
externals: Array<string>;
|
|
144
|
-
piral: string;
|
|
145
142
|
}
|
|
146
143
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
144
|
+
function getOrMakeApps({ apps, publicUrl }: AppInfo, logLevel: LogLevels) {
|
|
145
|
+
return Promise.all(
|
|
146
|
+
apps.map(async ({ emulator, appFile, appPackage }) => {
|
|
147
|
+
if (!emulator) {
|
|
148
|
+
const piralInstances = [appPackage.name];
|
|
149
|
+
const { externals, root, ignored } = await retrievePiletsInfo(appFile);
|
|
150
|
+
const { dir } = await callDebugPiralFromMonoRepo({
|
|
151
|
+
root,
|
|
152
|
+
optimizeModules: false,
|
|
153
|
+
publicUrl,
|
|
154
|
+
ignored,
|
|
155
|
+
externals,
|
|
156
|
+
piralInstances,
|
|
157
|
+
entryFiles: appFile,
|
|
158
|
+
logLevel,
|
|
159
|
+
_: {},
|
|
160
|
+
});
|
|
161
|
+
return dir;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return dirname(appFile);
|
|
165
|
+
}),
|
|
166
|
+
);
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
function checkSanity(pilets: Array<AppInfo>) {
|
|
168
170
|
for (let i = 1; i < pilets.length; i++) {
|
|
169
171
|
const previous = pilets[i - 1];
|
|
170
172
|
const current = pilets[i];
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
const previousInstances = previous.apps;
|
|
174
|
+
const currentInstances = current.apps;
|
|
175
|
+
const previousInstancesNames = previousInstances
|
|
176
|
+
.map((m) => m.appPackage.name)
|
|
177
|
+
.sort()
|
|
178
|
+
.join(', ');
|
|
179
|
+
const currentInstancesNames = currentInstances
|
|
180
|
+
.map((m) => m.appPackage.name)
|
|
181
|
+
.sort()
|
|
182
|
+
.join(', ');
|
|
183
|
+
const previousInstancesVersions = previousInstances.map((m) => m.appPackage.version).join(', ');
|
|
184
|
+
const currentInstancesVersions = currentInstances.map((m) => m.appPackage.version).join(', ');
|
|
185
|
+
|
|
186
|
+
if (previousInstancesNames !== currentInstancesNames) {
|
|
187
|
+
return log('piletMultiDebugAppShellDifferent_0301', previousInstancesNames, currentInstancesNames);
|
|
188
|
+
} else if (previousInstancesVersions !== currentInstancesVersions) {
|
|
189
|
+
return log('piletMultiDebugAppShellVersions_0302', previousInstancesVersions, currentInstancesVersions);
|
|
176
190
|
} else if (previous.externals.length !== current.externals.length) {
|
|
177
191
|
return log('piletMultiDebugExternalsDifferent_0303', previous.externals, current.externals);
|
|
178
192
|
} else if (previous.externals.some((m) => !current.externals.includes(m))) {
|
|
@@ -226,9 +240,8 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt
|
|
|
226
240
|
const pilets = await concurrentWorkers(allEntries, concurrency, async (entryModule) => {
|
|
227
241
|
const targetDir = dirname(entryModule);
|
|
228
242
|
const { peerDependencies, peerModules, root, apps, ignored, importmap } = await retrievePiletData(targetDir, app);
|
|
229
|
-
const
|
|
230
|
-
const
|
|
231
|
-
const externals = combinePiletExternals([piral], peerDependencies, peerModules, importmap);
|
|
243
|
+
const piralInstances = apps.map((m) => m.appPackage.name);
|
|
244
|
+
const externals = combinePiletExternals(piralInstances, peerDependencies, peerModules, importmap);
|
|
232
245
|
const mocks = join(targetDir, 'mocks');
|
|
233
246
|
const dest = resolve(root, target);
|
|
234
247
|
const outDir = dirname(dest);
|
|
@@ -240,7 +253,7 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt
|
|
|
240
253
|
const bundler = await callPiletDebug(
|
|
241
254
|
{
|
|
242
255
|
root,
|
|
243
|
-
|
|
256
|
+
piralInstances,
|
|
244
257
|
optimizeModules,
|
|
245
258
|
hmr,
|
|
246
259
|
externals,
|
|
@@ -262,12 +275,9 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt
|
|
|
262
275
|
});
|
|
263
276
|
|
|
264
277
|
return {
|
|
265
|
-
|
|
266
|
-
appFile,
|
|
278
|
+
apps,
|
|
267
279
|
publicUrl,
|
|
268
|
-
appVersion: appPackage.version,
|
|
269
280
|
externals,
|
|
270
|
-
piral: appPackage.name,
|
|
271
281
|
bundler,
|
|
272
282
|
mocks: mocksExists ? mocks : undefined,
|
|
273
283
|
root,
|
|
@@ -278,54 +288,59 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt
|
|
|
278
288
|
checkSanity(pilets);
|
|
279
289
|
|
|
280
290
|
await hooks.beforeApp?.({ appInstanceDir, pilets });
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
await
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
291
|
+
const appDirs = [appInstanceDir] || (await getOrMakeApps(pilets[0], logLevel));
|
|
292
|
+
|
|
293
|
+
await Promise.all(
|
|
294
|
+
appDirs.map(async (appDir) => {
|
|
295
|
+
const appRoot = dirname(await findFile(appDir, 'package.json'));
|
|
296
|
+
await hooks.afterApp?.({ appInstanceDir, pilets });
|
|
297
|
+
|
|
298
|
+
Promise.all(pilets.map((p) => p.bundler.ready())).then(() => logDone(`Ready!`));
|
|
299
|
+
|
|
300
|
+
const sources = pilets.map((m) => m.mocks).filter(Boolean);
|
|
301
|
+
const baseMocks = resolve(fullBase, 'mocks');
|
|
302
|
+
const krasBaseConfig = resolve(fullBase, krasrc);
|
|
303
|
+
const krasRootConfig = resolve(appRoot, krasrc);
|
|
304
|
+
const initial = createInitialKrasConfig(baseMocks, sources, { [api]: '' }, feed);
|
|
305
|
+
const required = {
|
|
306
|
+
injectors: {
|
|
307
|
+
piral: {
|
|
308
|
+
active: false,
|
|
309
|
+
},
|
|
310
|
+
pilet: {
|
|
311
|
+
active: true,
|
|
312
|
+
pilets,
|
|
313
|
+
app: appDir,
|
|
314
|
+
publicUrl,
|
|
315
|
+
handle: ['/', api],
|
|
316
|
+
api,
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
};
|
|
320
|
+
const configs = [krasBaseConfig, ...pilets.map((p) => resolve(p.root, krasrc)), krasRootConfig];
|
|
321
|
+
const port = await getAvailablePort(originalPort);
|
|
322
|
+
const krasConfig = readKrasConfig({ port, initial, required }, ...configs);
|
|
323
|
+
|
|
324
|
+
log('generalVerbose_0004', `Using kras with configuration: ${JSON.stringify(krasConfig, undefined, 2)}`);
|
|
325
|
+
|
|
326
|
+
const krasServer = buildKrasWithCli(krasConfig);
|
|
327
|
+
krasServer.setMaxListeners(maxListeners);
|
|
328
|
+
krasServer.removeAllListeners('open');
|
|
329
|
+
krasServer.on(
|
|
330
|
+
'open',
|
|
331
|
+
notifyServerOnline(
|
|
332
|
+
pilets.map((p) => p.bundler),
|
|
333
|
+
publicUrl,
|
|
334
|
+
krasConfig.api,
|
|
335
|
+
),
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
await hooks.beforeOnline?.({ krasServer, krasConfig, open, port, api, feed, pilets, publicUrl });
|
|
339
|
+
await krasServer.start();
|
|
340
|
+
openBrowser(open, port, publicUrl, !!krasConfig.ssl);
|
|
341
|
+
await hooks.afterOnline?.({ krasServer, krasConfig, open, port, api, feed, pilets, publicUrl });
|
|
342
|
+
await new Promise((resolve) => krasServer.on('close', resolve));
|
|
343
|
+
await hooks.onEnd?.({});
|
|
344
|
+
}),
|
|
323
345
|
);
|
|
324
|
-
|
|
325
|
-
await hooks.beforeOnline?.({ krasServer, krasConfig, open, port, api, feed, pilets, publicUrl });
|
|
326
|
-
await krasServer.start();
|
|
327
|
-
openBrowser(open, port, publicUrl, !!krasConfig.ssl);
|
|
328
|
-
await hooks.afterOnline?.({ krasServer, krasConfig, open, port, api, feed, pilets, publicUrl });
|
|
329
|
-
await new Promise((resolve) => krasServer.on('close', resolve));
|
|
330
|
-
await hooks.onEnd?.({});
|
|
331
346
|
}
|
package/src/apps/debug-piral.ts
CHANGED
|
@@ -125,16 +125,17 @@ export async function debugPiral(baseDir = process.cwd(), options: DebugPiralOpt
|
|
|
125
125
|
const entryFiles = await retrievePiralRoot(fullBase, entry);
|
|
126
126
|
const targetDir = dirname(entryFiles);
|
|
127
127
|
const { externals, name, root, ignored } = await retrievePiletsInfo(entryFiles);
|
|
128
|
+
const piralInstances = [name];
|
|
128
129
|
const dest = getDestination(entryFiles, resolve(fullBase, target));
|
|
129
130
|
|
|
130
131
|
await checkCliCompatibility(root);
|
|
131
132
|
|
|
132
|
-
await hooks.beforeBuild?.({ root, publicUrl, externals, entryFiles,
|
|
133
|
+
await hooks.beforeBuild?.({ root, publicUrl, externals, entryFiles, piralInstances });
|
|
133
134
|
|
|
134
135
|
const bundler = await callPiralDebug(
|
|
135
136
|
{
|
|
136
137
|
root,
|
|
137
|
-
|
|
138
|
+
piralInstances,
|
|
138
139
|
optimizeModules,
|
|
139
140
|
hmr,
|
|
140
141
|
externals,
|
|
@@ -151,7 +152,7 @@ export async function debugPiral(baseDir = process.cwd(), options: DebugPiralOpt
|
|
|
151
152
|
bundler.ready().then(() => logDone(`Ready!`));
|
|
152
153
|
|
|
153
154
|
bundler.on((args) => {
|
|
154
|
-
hooks.afterBuild?.({ ...args, root, publicUrl, externals, entryFiles,
|
|
155
|
+
hooks.afterBuild?.({ ...args, root, publicUrl, externals, entryFiles, piralInstances, bundler, ...dest });
|
|
155
156
|
});
|
|
156
157
|
|
|
157
158
|
const krasBaseConfig = resolve(fullBase, krasrc);
|
|
@@ -138,12 +138,12 @@ async function getFiles(
|
|
|
138
138
|
const { root, piletPackage, importmap, peerDependencies, peerModules, apps } = await retrievePiletData(
|
|
139
139
|
targetDir,
|
|
140
140
|
);
|
|
141
|
-
const
|
|
141
|
+
const piralInstances = apps.map((m) => m.appPackage.name);
|
|
142
142
|
const { main = 'dist/index.js', name = 'pilet' } = piletPackage;
|
|
143
143
|
const dest = resolve(root, main);
|
|
144
144
|
const outDir = dirname(dest);
|
|
145
145
|
const outFile = basename(dest);
|
|
146
|
-
const externals = combinePiletExternals(
|
|
146
|
+
const externals = combinePiletExternals(piralInstances, peerDependencies, peerModules, importmap);
|
|
147
147
|
progress('Triggering pilet build ...');
|
|
148
148
|
|
|
149
149
|
if (fresh) {
|
|
@@ -156,7 +156,7 @@ async function getFiles(
|
|
|
156
156
|
await callPiletBuild(
|
|
157
157
|
{
|
|
158
158
|
root,
|
|
159
|
-
|
|
159
|
+
piralInstances,
|
|
160
160
|
optimizeModules: false,
|
|
161
161
|
sourceMaps: true,
|
|
162
162
|
contentHash: true,
|