piral-cli 1.4.0-beta.6247 → 1.4.0-beta.6252
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/api.js +8 -17
- package/lib/api.js.map +1 -1
- package/lib/apps/add-piral-instance-pilet.js +20 -34
- package/lib/apps/add-piral-instance-pilet.js.map +1 -1
- package/lib/apps/build-pilet.js +139 -147
- package/lib/apps/build-pilet.js.map +1 -1
- package/lib/apps/build-piral.js +130 -144
- package/lib/apps/build-piral.js.map +1 -1
- package/lib/apps/debug-pilet.js +107 -119
- package/lib/apps/debug-pilet.js.map +1 -1
- package/lib/apps/debug-piral.js +62 -70
- package/lib/apps/debug-piral.js.map +1 -1
- package/lib/apps/declaration-piral.js +6 -17
- package/lib/apps/declaration-piral.js.map +1 -1
- package/lib/apps/new-pilet.js +71 -81
- package/lib/apps/new-pilet.js.map +1 -1
- package/lib/apps/new-piral.js +42 -53
- package/lib/apps/new-piral.js.map +1 -1
- package/lib/apps/pack-pilet.js +7 -18
- package/lib/apps/pack-pilet.js.map +1 -1
- package/lib/apps/publish-pilet.js +127 -141
- package/lib/apps/publish-pilet.js.map +1 -1
- package/lib/apps/publish-piral.js +48 -63
- package/lib/apps/publish-piral.js.map +1 -1
- package/lib/apps/remove-piral-instance-pilet.js +30 -35
- package/lib/apps/remove-piral-instance-pilet.js.map +1 -1
- package/lib/apps/run-emulator-piral.js +49 -61
- package/lib/apps/run-emulator-piral.js.map +1 -1
- package/lib/apps/upgrade-pilet.js +64 -75
- package/lib/apps/upgrade-pilet.js.map +1 -1
- package/lib/apps/upgrade-piral.js +31 -43
- package/lib/apps/upgrade-piral.js.map +1 -1
- package/lib/apps/validate-pilet.js +34 -45
- package/lib/apps/validate-pilet.js.map +1 -1
- package/lib/apps/validate-piral.js +29 -51
- package/lib/apps/validate-piral.js.map +1 -1
- package/lib/build/bundler-calls.js +12 -3
- package/lib/build/bundler-calls.js.map +1 -1
- package/lib/build/run-build-pilet.js +5 -14
- package/lib/build/run-build-pilet.js.map +1 -1
- package/lib/build/run-build-piral.js +5 -14
- package/lib/build/run-build-piral.js.map +1 -1
- package/lib/build/run-debug-mono-piral.js +5 -14
- package/lib/build/run-debug-mono-piral.js.map +1 -1
- package/lib/build/run-debug-pilet.js +5 -14
- package/lib/build/run-debug-pilet.js.map +1 -1
- package/lib/build/run-debug-piral.js +5 -14
- package/lib/build/run-debug-piral.js.map +1 -1
- package/lib/bundler.js +100 -127
- package/lib/bundler.js.map +1 -1
- package/lib/commands.js +5 -1
- package/lib/commands.js.map +1 -1
- package/lib/common/browser.js +13 -26
- package/lib/common/browser.js.map +1 -1
- package/lib/common/compatibility.js +10 -21
- package/lib/common/compatibility.js.map +1 -1
- package/lib/common/declaration.js +80 -101
- package/lib/common/declaration.js.map +1 -1
- package/lib/common/emulator.js +186 -182
- package/lib/common/emulator.js.map +1 -1
- package/lib/common/http.js +7 -4
- package/lib/common/http.js.map +1 -1
- package/lib/common/importmap.js +172 -187
- package/lib/common/importmap.js.map +1 -1
- package/lib/common/injectors.js +4 -1
- package/lib/common/injectors.js.map +1 -1
- package/lib/common/inspect.js +5 -2
- package/lib/common/inspect.js.map +1 -1
- package/lib/common/interactive.js +9 -15
- package/lib/common/interactive.js.map +1 -1
- package/lib/common/io.js +256 -299
- package/lib/common/io.js.map +1 -1
- package/lib/common/language.js +21 -5
- package/lib/common/language.js.map +1 -1
- package/lib/common/npm.js +193 -228
- package/lib/common/npm.js.map +1 -1
- package/lib/common/pack.js +71 -86
- package/lib/common/pack.js.map +1 -1
- package/lib/common/package.d.ts +1 -2
- package/lib/common/package.js +428 -458
- package/lib/common/package.js.map +1 -1
- package/lib/common/parallel.js +12 -23
- package/lib/common/parallel.js.map +1 -1
- package/lib/common/patcher.js +54 -71
- package/lib/common/patcher.js.map +1 -1
- package/lib/common/platform.js +1 -12
- package/lib/common/platform.js.map +1 -1
- package/lib/common/port.js +11 -24
- package/lib/common/port.js.map +1 -1
- package/lib/common/rules.js +6 -17
- package/lib/common/rules.js.map +1 -1
- package/lib/common/scaffold.js +52 -59
- package/lib/common/scaffold.js.map +1 -1
- package/lib/common/shell.d.ts +2 -2
- package/lib/common/shell.js +53 -31
- package/lib/common/shell.js.map +1 -1
- package/lib/common/spec.js +1 -1
- package/lib/common/spec.js.map +1 -1
- package/lib/common/template.js +3 -14
- package/lib/common/template.js.map +1 -1
- package/lib/common/watcher.js +7 -16
- package/lib/common/watcher.js.map +1 -1
- package/lib/common/website.d.ts +2 -2
- package/lib/common/website.js +68 -56
- package/lib/common/website.js.map +1 -1
- package/lib/injectors/pilet-injector.d.ts +12 -10
- package/lib/injectors/pilet-injector.js +123 -87
- package/lib/injectors/pilet-injector.js.map +1 -1
- package/lib/injectors/piral-injector.d.ts +5 -5
- package/lib/injectors/piral-injector.js +32 -14
- package/lib/injectors/piral-injector.js.map +1 -1
- package/lib/messages.d.ts +81 -0
- package/lib/messages.js +94 -1
- package/lib/messages.js.map +1 -1
- package/lib/npm-clients/bun.js +36 -60
- package/lib/npm-clients/bun.js.map +1 -1
- package/lib/npm-clients/index.js +10 -21
- package/lib/npm-clients/index.js.map +1 -1
- package/lib/npm-clients/lerna.js +48 -72
- package/lib/npm-clients/lerna.js.map +1 -1
- package/lib/npm-clients/npm.js +69 -105
- package/lib/npm-clients/npm.js.map +1 -1
- package/lib/npm-clients/pnp.js +35 -59
- package/lib/npm-clients/pnp.js.map +1 -1
- package/lib/npm-clients/pnpm.js +35 -59
- package/lib/npm-clients/pnpm.js.map +1 -1
- package/lib/npm-clients/rush.js +53 -77
- package/lib/npm-clients/rush.js.map +1 -1
- package/lib/npm-clients/yarn.js +35 -59
- package/lib/npm-clients/yarn.js.map +1 -1
- package/lib/platforms/node.js +4 -17
- package/lib/platforms/node.js.map +1 -1
- package/lib/platforms/web.js +81 -96
- package/lib/platforms/web.js.map +1 -1
- package/lib/plugin.js +56 -75
- package/lib/plugin.js.map +1 -1
- package/lib/questionnaire.js +46 -12
- package/lib/questionnaire.js.map +1 -1
- package/lib/release.js +32 -47
- package/lib/release.js.map +1 -1
- package/lib/rules/index.js +10 -23
- package/lib/rules/index.js.map +1 -1
- package/lib/rules/pilet-has-externals-as-peers.js +34 -45
- package/lib/rules/pilet-has-externals-as-peers.js.map +1 -1
- package/lib/rules/pilet-has-no-self-reference.js +16 -27
- package/lib/rules/pilet-has-no-self-reference.js.map +1 -1
- package/lib/rules/pilet-has-non-conflicting-css.js +27 -42
- package/lib/rules/pilet-has-non-conflicting-css.js.map +1 -1
- package/lib/rules/pilet-stays-small.js +20 -33
- package/lib/rules/pilet-stays-small.js.map +1 -1
- package/lib/rules/pilet-uses-latest-piral.js +17 -28
- package/lib/rules/pilet-uses-latest-piral.js.map +1 -1
- package/lib/rules/piral-has-valid-devDependencies.js +4 -1
- package/lib/rules/piral-has-valid-devDependencies.js.map +1 -1
- package/lib/runner.js +3 -12
- package/lib/runner.js.map +1 -1
- package/lib/select.js +21 -32
- package/lib/select.js.map +1 -1
- package/lib/start.js +6 -17
- package/lib/start.js.map +1 -1
- package/package.json +2 -2
- package/src/apps/add-piral-instance-pilet.ts +1 -16
- package/src/apps/build-piral.test.ts +1 -1
- package/src/apps/new-pilet.ts +4 -10
- package/src/apps/run-emulator-piral.ts +1 -1
- package/src/apps/upgrade-pilet.ts +3 -2
- package/src/common/package.ts +29 -37
- package/src/common/shell.ts +59 -18
- package/src/common/website.ts +47 -17
- package/src/injectors/pilet-injector.test.ts +4 -4
- package/src/injectors/pilet-injector.ts +97 -41
- package/src/injectors/piral-injector.test.ts +2 -2
- package/src/injectors/piral-injector.ts +31 -20
- package/src/messages.ts +93 -0
package/lib/apps/build-piral.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.buildPiral = exports.buildPiralDefaults = void 0;
|
|
13
4
|
const path_1 = require("path");
|
|
@@ -33,145 +24,140 @@ exports.buildPiralDefaults = {
|
|
|
33
24
|
contentHash: true,
|
|
34
25
|
optimizeModules: false,
|
|
35
26
|
};
|
|
36
|
-
function runLifecycle(root, scripts, type) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
});
|
|
27
|
+
async function runLifecycle(root, scripts, type) {
|
|
28
|
+
const script = scripts?.[type];
|
|
29
|
+
if (script) {
|
|
30
|
+
(0, common_1.log)('generalDebug_0003', `Running "${type}" ("${script}") ...`);
|
|
31
|
+
await (0, common_1.runScript)(script, root);
|
|
32
|
+
(0, common_1.log)('generalDebug_0003', `Finished running "${type}".`);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
(0, common_1.log)('generalDebug_0003', `No script for "${type}" found ...`);
|
|
36
|
+
}
|
|
48
37
|
}
|
|
49
|
-
function buildPiral(baseDir = process.cwd(), options = {}) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
(0, common_1.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
38
|
+
async function buildPiral(baseDir = process.cwd(), options = {}) {
|
|
39
|
+
const { entry = exports.buildPiralDefaults.entry, target = exports.buildPiralDefaults.target, publicUrl: originalPublicUrl = exports.buildPiralDefaults.publicUrl, logLevel = exports.buildPiralDefaults.logLevel, minify = exports.buildPiralDefaults.minify, sourceMaps = exports.buildPiralDefaults.sourceMaps, watch = exports.buildPiralDefaults.watch, contentHash = exports.buildPiralDefaults.contentHash, subdir = exports.buildPiralDefaults.subdir, fresh = exports.buildPiralDefaults.fresh, type = exports.buildPiralDefaults.type, optimizeModules = exports.buildPiralDefaults.optimizeModules, _ = {}, hooks = {}, bundlerName, } = options;
|
|
40
|
+
const publicUrl = (0, common_1.normalizePublicUrl)(originalPublicUrl);
|
|
41
|
+
const fullBase = (0, path_1.resolve)(process.cwd(), baseDir);
|
|
42
|
+
const useSubdir = type === 'all' || subdir;
|
|
43
|
+
(0, common_1.setLogLevel)(logLevel);
|
|
44
|
+
await hooks.onBegin?.({ options, fullBase });
|
|
45
|
+
(0, common_1.progress)('Reading configuration ...');
|
|
46
|
+
const entryFiles = await (0, common_1.retrievePiralRoot)(fullBase, entry);
|
|
47
|
+
const { name, root, ignored, externals, scripts } = await (0, common_1.retrievePiletsInfo)(entryFiles);
|
|
48
|
+
const piralInstances = [name];
|
|
49
|
+
const dest = (0, common_1.getDestination)(entryFiles, (0, path_1.resolve)(fullBase, target));
|
|
50
|
+
await (0, common_1.checkCliCompatibility)(root);
|
|
51
|
+
(0, common_1.validateSharedDependencies)(externals);
|
|
52
|
+
if (fresh) {
|
|
53
|
+
(0, common_1.progress)('Removing output directory ...');
|
|
54
|
+
await (0, common_1.removeDirectory)(dest.outDir);
|
|
55
|
+
}
|
|
56
|
+
// either 'emulator-*' or 'all'
|
|
57
|
+
if (type === emulatorName || type === emulatorSourcesName || type === emulatorWebsiteName || type === allName) {
|
|
58
|
+
const emulatorPublicUrl = '/';
|
|
59
|
+
const targetDir = useSubdir ? (0, path_1.join)(dest.outDir, emulatorName) : dest.outDir;
|
|
60
|
+
const appDir = type !== emulatorWebsiteName ? (0, path_1.join)(targetDir, 'app') : targetDir;
|
|
61
|
+
(0, common_1.progress)('Starting emulator build ...');
|
|
62
|
+
// since we create this anyway let's just pretend we want to have it clean!
|
|
63
|
+
await (0, common_1.removeDirectory)(targetDir);
|
|
64
|
+
await hooks.beforeBuild?.({ root, publicUrl: emulatorPublicUrl, externals, entryFiles, targetDir, piralInstances });
|
|
65
|
+
(0, common_1.logInfo)(`Bundle ${emulatorName} ...`);
|
|
66
|
+
const { dir: outDir, name: outFile, hash, } = await (0, bundler_1.callPiralBuild)({
|
|
67
|
+
root,
|
|
68
|
+
piralInstances,
|
|
69
|
+
emulator: true,
|
|
70
|
+
standalone: false,
|
|
71
|
+
optimizeModules,
|
|
72
|
+
sourceMaps,
|
|
73
|
+
watch,
|
|
74
|
+
contentHash,
|
|
75
|
+
minify: false,
|
|
76
|
+
externals: (0, common_1.flattenExternals)(externals),
|
|
77
|
+
publicUrl: emulatorPublicUrl,
|
|
78
|
+
entryFiles,
|
|
79
|
+
logLevel,
|
|
80
|
+
ignored,
|
|
81
|
+
outDir: appDir,
|
|
82
|
+
outFile: dest.outFile,
|
|
83
|
+
_,
|
|
84
|
+
}, bundlerName);
|
|
85
|
+
await hooks.afterBuild?.({
|
|
86
|
+
root,
|
|
87
|
+
publicUrl: emulatorPublicUrl,
|
|
88
|
+
externals,
|
|
89
|
+
entryFiles,
|
|
90
|
+
targetDir,
|
|
91
|
+
piralInstances,
|
|
92
|
+
hash,
|
|
93
|
+
outDir,
|
|
94
|
+
outFile,
|
|
95
|
+
});
|
|
96
|
+
await runLifecycle(root, scripts, 'piral:postbuild');
|
|
97
|
+
await runLifecycle(root, scripts, `piral:postbuild-${emulatorName}`);
|
|
98
|
+
await hooks.beforeEmulator?.({ root, externals, targetDir, outDir });
|
|
99
|
+
const rootDir = await (type !== emulatorWebsiteName
|
|
100
|
+
? (0, common_1.createEmulatorSources)(root, externals, outDir, outFile, logLevel)
|
|
101
|
+
: (0, common_1.createEmulatorWebsite)(root, externals, outDir, outFile, logLevel));
|
|
102
|
+
await hooks.afterEmulator?.({ root, externals, targetDir, outDir, rootDir });
|
|
103
|
+
if (type === allName || type === emulatorName) {
|
|
104
|
+
await hooks.beforePackage?.({ root, externals, targetDir, outDir, rootDir });
|
|
105
|
+
await (0, common_1.packageEmulator)(rootDir);
|
|
106
|
+
await hooks.afterPackage?.({ root, externals, targetDir, outDir, rootDir });
|
|
107
|
+
(0, common_1.logDone)(`Emulator package available in "${rootDir}".`);
|
|
68
108
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const emulatorPublicUrl = '/';
|
|
72
|
-
const targetDir = useSubdir ? (0, path_1.join)(dest.outDir, emulatorName) : dest.outDir;
|
|
73
|
-
const appDir = type !== emulatorWebsiteName ? (0, path_1.join)(targetDir, 'app') : targetDir;
|
|
74
|
-
(0, common_1.progress)('Starting emulator build ...');
|
|
75
|
-
// since we create this anyway let's just pretend we want to have it clean!
|
|
76
|
-
yield (0, common_1.removeDirectory)(targetDir);
|
|
77
|
-
yield ((_b = hooks.beforeBuild) === null || _b === void 0 ? void 0 : _b.call(hooks, { root, publicUrl: emulatorPublicUrl, externals, entryFiles, targetDir, piralInstances }));
|
|
78
|
-
(0, common_1.logInfo)(`Bundle ${emulatorName} ...`);
|
|
79
|
-
const { dir: outDir, name: outFile, hash, } = yield (0, bundler_1.callPiralBuild)({
|
|
80
|
-
root,
|
|
81
|
-
piralInstances,
|
|
82
|
-
emulator: true,
|
|
83
|
-
standalone: false,
|
|
84
|
-
optimizeModules,
|
|
85
|
-
sourceMaps,
|
|
86
|
-
watch,
|
|
87
|
-
contentHash,
|
|
88
|
-
minify: false,
|
|
89
|
-
externals: (0, common_1.flattenExternals)(externals),
|
|
90
|
-
publicUrl: emulatorPublicUrl,
|
|
91
|
-
entryFiles,
|
|
92
|
-
logLevel,
|
|
93
|
-
ignored,
|
|
94
|
-
outDir: appDir,
|
|
95
|
-
outFile: dest.outFile,
|
|
96
|
-
_,
|
|
97
|
-
}, bundlerName);
|
|
98
|
-
yield ((_c = hooks.afterBuild) === null || _c === void 0 ? void 0 : _c.call(hooks, {
|
|
99
|
-
root,
|
|
100
|
-
publicUrl: emulatorPublicUrl,
|
|
101
|
-
externals,
|
|
102
|
-
entryFiles,
|
|
103
|
-
targetDir,
|
|
104
|
-
piralInstances,
|
|
105
|
-
hash,
|
|
106
|
-
outDir,
|
|
107
|
-
outFile,
|
|
108
|
-
}));
|
|
109
|
-
yield runLifecycle(root, scripts, 'piral:postbuild');
|
|
110
|
-
yield runLifecycle(root, scripts, `piral:postbuild-${emulatorName}`);
|
|
111
|
-
yield ((_d = hooks.beforeEmulator) === null || _d === void 0 ? void 0 : _d.call(hooks, { root, externals, targetDir, outDir }));
|
|
112
|
-
const rootDir = yield (type !== emulatorWebsiteName
|
|
113
|
-
? (0, common_1.createEmulatorSources)(root, externals, outDir, outFile, logLevel)
|
|
114
|
-
: (0, common_1.createEmulatorWebsite)(root, externals, outDir, outFile, logLevel));
|
|
115
|
-
yield ((_e = hooks.afterEmulator) === null || _e === void 0 ? void 0 : _e.call(hooks, { root, externals, targetDir, outDir, rootDir }));
|
|
116
|
-
if (type === allName || type === emulatorName) {
|
|
117
|
-
yield ((_f = hooks.beforePackage) === null || _f === void 0 ? void 0 : _f.call(hooks, { root, externals, targetDir, outDir, rootDir }));
|
|
118
|
-
yield (0, common_1.packageEmulator)(rootDir);
|
|
119
|
-
yield ((_g = hooks.afterPackage) === null || _g === void 0 ? void 0 : _g.call(hooks, { root, externals, targetDir, outDir, rootDir }));
|
|
120
|
-
(0, common_1.logDone)(`Emulator package available in "${rootDir}".`);
|
|
121
|
-
}
|
|
122
|
-
else if (type === emulatorSourcesName) {
|
|
123
|
-
(0, common_1.logDone)(`Emulator sources available in "${rootDir}".`);
|
|
124
|
-
}
|
|
125
|
-
else if (type === emulatorWebsiteName) {
|
|
126
|
-
(0, common_1.logDone)(`Emulator website available in "${rootDir}".`);
|
|
127
|
-
}
|
|
128
|
-
(0, common_1.logReset)();
|
|
109
|
+
else if (type === emulatorSourcesName) {
|
|
110
|
+
(0, common_1.logDone)(`Emulator sources available in "${rootDir}".`);
|
|
129
111
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const targetDir = useSubdir ? (0, path_1.join)(dest.outDir, releaseName) : dest.outDir;
|
|
133
|
-
(0, common_1.progress)('Starting release build ...');
|
|
134
|
-
// since we create this anyway let's just pretend we want to have it clean!
|
|
135
|
-
yield (0, common_1.removeDirectory)(targetDir);
|
|
136
|
-
(0, common_1.logInfo)(`Bundle ${releaseName} ...`);
|
|
137
|
-
yield ((_h = hooks.beforeBuild) === null || _h === void 0 ? void 0 : _h.call(hooks, { root, publicUrl, externals, entryFiles, targetDir, piralInstances }));
|
|
138
|
-
const { dir: outDir, name: outFile, hash, } = yield (0, bundler_1.callPiralBuild)({
|
|
139
|
-
root,
|
|
140
|
-
piralInstances,
|
|
141
|
-
emulator: false,
|
|
142
|
-
standalone: false,
|
|
143
|
-
optimizeModules,
|
|
144
|
-
sourceMaps,
|
|
145
|
-
watch,
|
|
146
|
-
contentHash,
|
|
147
|
-
minify,
|
|
148
|
-
externals: (0, common_1.flattenExternals)(externals),
|
|
149
|
-
publicUrl,
|
|
150
|
-
outFile: dest.outFile,
|
|
151
|
-
outDir: targetDir,
|
|
152
|
-
entryFiles,
|
|
153
|
-
logLevel,
|
|
154
|
-
ignored,
|
|
155
|
-
_,
|
|
156
|
-
}, bundlerName);
|
|
157
|
-
yield ((_j = hooks.afterBuild) === null || _j === void 0 ? void 0 : _j.call(hooks, {
|
|
158
|
-
root,
|
|
159
|
-
publicUrl,
|
|
160
|
-
externals,
|
|
161
|
-
entryFiles,
|
|
162
|
-
targetDir,
|
|
163
|
-
piralInstances,
|
|
164
|
-
outDir,
|
|
165
|
-
outFile,
|
|
166
|
-
hash,
|
|
167
|
-
}));
|
|
168
|
-
yield runLifecycle(root, scripts, 'piral:postbuild');
|
|
169
|
-
yield runLifecycle(root, scripts, `piral:postbuild-${releaseName}`);
|
|
170
|
-
(0, common_1.logDone)(`Files for publication available in "${outDir}".`);
|
|
171
|
-
(0, common_1.logReset)();
|
|
112
|
+
else if (type === emulatorWebsiteName) {
|
|
113
|
+
(0, common_1.logDone)(`Emulator website available in "${rootDir}".`);
|
|
172
114
|
}
|
|
173
|
-
|
|
174
|
-
}
|
|
115
|
+
(0, common_1.logReset)();
|
|
116
|
+
}
|
|
117
|
+
// either 'release' or 'all'
|
|
118
|
+
if (type === releaseName || type === allName) {
|
|
119
|
+
const targetDir = useSubdir ? (0, path_1.join)(dest.outDir, releaseName) : dest.outDir;
|
|
120
|
+
(0, common_1.progress)('Starting release build ...');
|
|
121
|
+
// since we create this anyway let's just pretend we want to have it clean!
|
|
122
|
+
await (0, common_1.removeDirectory)(targetDir);
|
|
123
|
+
(0, common_1.logInfo)(`Bundle ${releaseName} ...`);
|
|
124
|
+
await hooks.beforeBuild?.({ root, publicUrl, externals, entryFiles, targetDir, piralInstances });
|
|
125
|
+
const { dir: outDir, name: outFile, hash, } = await (0, bundler_1.callPiralBuild)({
|
|
126
|
+
root,
|
|
127
|
+
piralInstances,
|
|
128
|
+
emulator: false,
|
|
129
|
+
standalone: false,
|
|
130
|
+
optimizeModules,
|
|
131
|
+
sourceMaps,
|
|
132
|
+
watch,
|
|
133
|
+
contentHash,
|
|
134
|
+
minify,
|
|
135
|
+
externals: (0, common_1.flattenExternals)(externals),
|
|
136
|
+
publicUrl,
|
|
137
|
+
outFile: dest.outFile,
|
|
138
|
+
outDir: targetDir,
|
|
139
|
+
entryFiles,
|
|
140
|
+
logLevel,
|
|
141
|
+
ignored,
|
|
142
|
+
_,
|
|
143
|
+
}, bundlerName);
|
|
144
|
+
await hooks.afterBuild?.({
|
|
145
|
+
root,
|
|
146
|
+
publicUrl,
|
|
147
|
+
externals,
|
|
148
|
+
entryFiles,
|
|
149
|
+
targetDir,
|
|
150
|
+
piralInstances,
|
|
151
|
+
outDir,
|
|
152
|
+
outFile,
|
|
153
|
+
hash,
|
|
154
|
+
});
|
|
155
|
+
await runLifecycle(root, scripts, 'piral:postbuild');
|
|
156
|
+
await runLifecycle(root, scripts, `piral:postbuild-${releaseName}`);
|
|
157
|
+
(0, common_1.logDone)(`Files for publication available in "${outDir}".`);
|
|
158
|
+
(0, common_1.logReset)();
|
|
159
|
+
}
|
|
160
|
+
await hooks.onEnd?.({ root });
|
|
175
161
|
}
|
|
176
162
|
exports.buildPiral = buildPiral;
|
|
177
163
|
//# sourceMappingURL=build-piral.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-piral.js","sourceRoot":"","sources":["../../src/apps/build-piral.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-piral.js","sourceRoot":"","sources":["../../src/apps/build-piral.ts"],"names":[],"mappings":";;;AAAA,+BAAqC;AACrC,wCAA4C;AAC5C,oCAAqD;AACrD,sCAmBmB;AAEnB,MAAM,OAAO,GAAG,KAAK,CAAC;AACtB,MAAM,WAAW,GAAG,SAAS,CAAC;AAC9B,MAAM,YAAY,GAAG,UAAU,CAAC;AAChC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAC/C,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAwFlC,QAAA,kBAAkB,GAAsB;IACnD,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,GAAG;IACd,QAAQ,EAAE,iBAAS,CAAC,IAAI;IACxB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,IAAI;IACZ,UAAU,EAAE,IAAI;IAChB,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,IAAI;IACjB,eAAe,EAAE,KAAK;CACvB,CAAC;AAEF,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,OAA+B,EAAE,IAAY;IACrF,M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EAAE,IAAI,EAAE,CAAC,CAAC;AAChC,CAAC;AA/KD,gCA+KC"}
|
package/lib/apps/debug-pilet.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.debugPilet = exports.debugPiletDefaults = void 0;
|
|
13
4
|
const path_1 = require("path");
|
|
@@ -31,11 +22,11 @@ function byPort(a, b) {
|
|
|
31
22
|
return a[1] - b[1];
|
|
32
23
|
}
|
|
33
24
|
function getOrMakeApps({ apps, publicUrl }, logLevel) {
|
|
34
|
-
return Promise.all(apps.map(({ emulator, appFile, appPackage, appPort }) =>
|
|
25
|
+
return Promise.all(apps.map(async ({ emulator, appFile, appPackage, appPort }) => {
|
|
35
26
|
if (!emulator) {
|
|
36
27
|
const piralInstances = [appPackage.name];
|
|
37
|
-
const { externals, root, ignored } =
|
|
38
|
-
const { dir } =
|
|
28
|
+
const { externals, root, ignored } = await (0, common_1.retrievePiletsInfo)(appFile);
|
|
29
|
+
const { dir } = await (0, bundler_1.callDebugPiralFromMonoRepo)({
|
|
39
30
|
root,
|
|
40
31
|
optimizeModules: false,
|
|
41
32
|
publicUrl,
|
|
@@ -49,7 +40,7 @@ function getOrMakeApps({ apps, publicUrl }, logLevel) {
|
|
|
49
40
|
return [dir, appPort];
|
|
50
41
|
}
|
|
51
42
|
return [(0, path_1.dirname)(appFile), appPort];
|
|
52
|
-
}))
|
|
43
|
+
}));
|
|
53
44
|
}
|
|
54
45
|
function checkSanity(pilets) {
|
|
55
46
|
for (let i = 1; i < pilets.length; i++) {
|
|
@@ -81,119 +72,116 @@ function checkSanity(pilets) {
|
|
|
81
72
|
}
|
|
82
73
|
}
|
|
83
74
|
}
|
|
84
|
-
function debugPilet(baseDir = process.cwd(), options = {}) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
75
|
+
async function debugPilet(baseDir = process.cwd(), options = {}) {
|
|
76
|
+
const { entry = exports.debugPiletDefaults.entry, target = exports.debugPiletDefaults.target, open = exports.debugPiletDefaults.open, hmr = exports.debugPiletDefaults.hmr, port: originalPort = exports.debugPiletDefaults.port, publicUrl: originalPublicUrl = exports.debugPiletDefaults.publicUrl, logLevel = exports.debugPiletDefaults.logLevel, concurrency = exports.debugPiletDefaults.concurrency, krasrc: customkrasrc = exports.debugPiletDefaults.krasrc, optimizeModules = exports.debugPiletDefaults.optimizeModules, schemaVersion: originalSchemaVersion = exports.debugPiletDefaults.schemaVersion, _ = {}, hooks = {}, bundlerName, app, appInstanceDir, feed, } = options;
|
|
77
|
+
const publicUrl = (0, common_1.normalizePublicUrl)(originalPublicUrl);
|
|
78
|
+
const fullBase = (0, path_1.resolve)(process.cwd(), baseDir);
|
|
79
|
+
(0, common_1.setLogLevel)(logLevel);
|
|
80
|
+
await hooks.onBegin?.({ options, fullBase });
|
|
81
|
+
const watcherRef = await (0, common_1.watcherTask)(async (watcherContext) => {
|
|
82
|
+
(0, common_1.progress)('Reading configuration ...');
|
|
83
|
+
const entryList = Array.isArray(entry) ? entry : [entry];
|
|
84
|
+
const multi = entryList.length > 1 || entryList[0].indexOf('*') !== -1;
|
|
85
|
+
(0, common_1.log)('generalDebug_0003', `Looking for (${multi ? 'multi' : 'single'}) "${entryList.join('", "')}" in "${fullBase}".`);
|
|
86
|
+
const allEntries = await (0, common_1.matchAnyPilet)(fullBase, entryList);
|
|
87
|
+
const maxListeners = Math.max(2 + allEntries.length * 2, 16);
|
|
88
|
+
(0, common_1.log)('generalDebug_0003', `Found the following entries: ${allEntries.join(', ')}`);
|
|
89
|
+
if (allEntries.length === 0) {
|
|
90
|
+
(0, common_1.fail)('entryFileMissing_0077');
|
|
91
|
+
}
|
|
92
|
+
process.stderr?.setMaxListeners(maxListeners);
|
|
93
|
+
process.stdout?.setMaxListeners(maxListeners);
|
|
94
|
+
process.stdin?.setMaxListeners(maxListeners);
|
|
95
|
+
const pilets = await (0, common_1.concurrentWorkers)(allEntries, concurrency, async (entryModule) => {
|
|
96
|
+
const targetDir = (0, path_1.dirname)(entryModule);
|
|
97
|
+
const { peerDependencies, peerModules, root, apps, ignored, importmap, schema } = await (0, common_1.retrievePiletData)(targetDir, app);
|
|
98
|
+
const schemaVersion = originalSchemaVersion || schema || common_1.config.schemaVersion || common_1.defaultSchemaVersion;
|
|
99
|
+
const piralInstances = apps.map((m) => m.appPackage.name);
|
|
100
|
+
const externals = (0, common_1.combinePiletExternals)(piralInstances, peerDependencies, peerModules, importmap);
|
|
101
|
+
const mocks = (0, path_1.join)(targetDir, 'mocks');
|
|
102
|
+
const dest = (0, path_1.resolve)(root, target);
|
|
103
|
+
const outDir = (0, path_1.dirname)(dest);
|
|
104
|
+
const outFile = (0, path_1.basename)(dest);
|
|
105
|
+
const mocksExists = await (0, common_1.checkExistingDirectory)(mocks);
|
|
106
|
+
(0, common_1.validateSharedDependencies)(importmap);
|
|
107
|
+
await hooks.beforeBuild?.({ root, publicUrl, importmap, entryModule, schemaVersion });
|
|
108
|
+
watcherContext.watch((0, path_1.join)(root, common_1.packageJson));
|
|
109
|
+
watcherContext.watch((0, path_1.join)(root, common_1.piletJson));
|
|
110
|
+
const bundler = await (0, bundler_1.callPiletDebug)({
|
|
111
|
+
root,
|
|
112
|
+
piralInstances,
|
|
113
|
+
optimizeModules,
|
|
114
|
+
hmr,
|
|
115
|
+
externals,
|
|
116
|
+
targetDir,
|
|
117
|
+
importmap,
|
|
118
|
+
outFile,
|
|
119
|
+
outDir,
|
|
120
|
+
entryModule: `./${(0, path_1.relative)(root, entryModule)}`,
|
|
121
|
+
logLevel,
|
|
122
|
+
version: schemaVersion,
|
|
123
|
+
ignored,
|
|
124
|
+
_,
|
|
125
|
+
}, bundlerName);
|
|
126
|
+
bundler.on((args) => {
|
|
127
|
+
hooks.afterBuild?.({
|
|
128
|
+
...args,
|
|
124
129
|
root,
|
|
125
|
-
|
|
126
|
-
optimizeModules,
|
|
127
|
-
hmr,
|
|
128
|
-
externals,
|
|
129
|
-
targetDir,
|
|
130
|
+
publicUrl,
|
|
130
131
|
importmap,
|
|
132
|
+
entryModule,
|
|
133
|
+
schemaVersion,
|
|
134
|
+
bundler,
|
|
131
135
|
outFile,
|
|
132
136
|
outDir,
|
|
133
|
-
entryModule: `./${(0, path_1.relative)(root, entryModule)}`,
|
|
134
|
-
logLevel,
|
|
135
|
-
version: schemaVersion,
|
|
136
|
-
ignored,
|
|
137
|
-
_,
|
|
138
|
-
}, bundlerName);
|
|
139
|
-
bundler.on((args) => {
|
|
140
|
-
var _a;
|
|
141
|
-
(_a = hooks.afterBuild) === null || _a === void 0 ? void 0 : _a.call(hooks, Object.assign(Object.assign({}, args), { root,
|
|
142
|
-
publicUrl,
|
|
143
|
-
importmap,
|
|
144
|
-
entryModule,
|
|
145
|
-
schemaVersion,
|
|
146
|
-
bundler,
|
|
147
|
-
outFile,
|
|
148
|
-
outDir }));
|
|
149
|
-
});
|
|
150
|
-
return {
|
|
151
|
-
apps,
|
|
152
|
-
publicUrl,
|
|
153
|
-
externals,
|
|
154
|
-
bundler,
|
|
155
|
-
mocks: mocksExists ? mocks : undefined,
|
|
156
|
-
root,
|
|
157
|
-
};
|
|
158
|
-
}));
|
|
159
|
-
// sanity check see #250
|
|
160
|
-
checkSanity(pilets);
|
|
161
|
-
yield ((_f = hooks.beforeApp) === null || _f === void 0 ? void 0 : _f.call(hooks, { appInstanceDir, pilets }));
|
|
162
|
-
const appInstances = appInstanceDir
|
|
163
|
-
? [[appInstanceDir, 0]]
|
|
164
|
-
: yield getOrMakeApps(pilets[0], logLevel);
|
|
165
|
-
Promise.all(pilets.map((p) => p.bundler.ready())).then(() => (0, common_1.logDone)(`Ready!`));
|
|
166
|
-
pilets.forEach((p) => p.bundler.start());
|
|
167
|
-
if (appInstances.length === 0) {
|
|
168
|
-
appInstances.push([undefined, originalPort]);
|
|
169
|
-
}
|
|
170
|
-
yield Promise.all(appInstances.sort(byPort).map(([appDir, appPort], i) => __awaiter(this, void 0, void 0, function* () {
|
|
171
|
-
const platform = (0, common_1.configurePlatform)();
|
|
172
|
-
const suggestedPort = appPort || originalPort + i;
|
|
173
|
-
yield platform.startModule({
|
|
174
|
-
appDir,
|
|
175
|
-
pilets,
|
|
176
|
-
customkrasrc,
|
|
177
|
-
feed,
|
|
178
|
-
fullBase,
|
|
179
|
-
hooks,
|
|
180
|
-
open,
|
|
181
|
-
originalPort: suggestedPort,
|
|
182
|
-
publicUrl,
|
|
183
|
-
maxListeners,
|
|
184
|
-
registerEnd(cb) {
|
|
185
|
-
return watcherContext.onClean(cb);
|
|
186
|
-
},
|
|
187
|
-
registerWatcher(file) {
|
|
188
|
-
return watcherContext.watch(file);
|
|
189
|
-
},
|
|
190
137
|
});
|
|
191
|
-
})
|
|
192
|
-
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
apps,
|
|
141
|
+
publicUrl,
|
|
142
|
+
externals,
|
|
143
|
+
bundler,
|
|
144
|
+
mocks: mocksExists ? mocks : undefined,
|
|
145
|
+
root,
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
|
+
// sanity check see #250
|
|
149
|
+
checkSanity(pilets);
|
|
150
|
+
await hooks.beforeApp?.({ appInstanceDir, pilets });
|
|
151
|
+
const appInstances = appInstanceDir
|
|
152
|
+
? [[appInstanceDir, 0]]
|
|
153
|
+
: await getOrMakeApps(pilets[0], logLevel);
|
|
154
|
+
Promise.all(pilets.map((p) => p.bundler.ready())).then(() => (0, common_1.logDone)(`Ready!`));
|
|
155
|
+
pilets.forEach((p) => p.bundler.start());
|
|
156
|
+
if (appInstances.length === 0) {
|
|
157
|
+
appInstances.push([undefined, originalPort]);
|
|
158
|
+
}
|
|
159
|
+
await Promise.all(appInstances.sort(byPort).map(async ([appDir, appPort], i) => {
|
|
160
|
+
const platform = (0, common_1.configurePlatform)();
|
|
161
|
+
const suggestedPort = appPort || originalPort + i;
|
|
162
|
+
await platform.startModule({
|
|
163
|
+
appDir,
|
|
164
|
+
pilets,
|
|
165
|
+
customkrasrc,
|
|
166
|
+
feed,
|
|
167
|
+
fullBase,
|
|
168
|
+
hooks,
|
|
169
|
+
open,
|
|
170
|
+
originalPort: suggestedPort,
|
|
171
|
+
publicUrl,
|
|
172
|
+
maxListeners,
|
|
173
|
+
registerEnd(cb) {
|
|
174
|
+
return watcherContext.onClean(cb);
|
|
175
|
+
},
|
|
176
|
+
registerWatcher(file) {
|
|
177
|
+
return watcherContext.watch(file);
|
|
178
|
+
},
|
|
179
|
+
});
|
|
193
180
|
}));
|
|
194
|
-
|
|
195
|
-
yield ((_b = hooks.onEnd) === null || _b === void 0 ? void 0 : _b.call(hooks, {}));
|
|
181
|
+
await hooks.afterApp?.({ appInstanceDir, pilets });
|
|
196
182
|
});
|
|
183
|
+
await Promise.all([watcherRef.end]);
|
|
184
|
+
await hooks.onEnd?.({});
|
|
197
185
|
}
|
|
198
186
|
exports.debugPilet = debugPilet;
|
|
199
187
|
//# sourceMappingURL=debug-pilet.js.map
|