piral-cli 1.5.3 → 1.5.4-beta.6997
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
CHANGED
|
@@ -42,6 +42,7 @@ async function buildPilet(baseDir = process.cwd(), options = {}) {
|
|
|
42
42
|
const publicUrl = (0, common_1.normalizePublicUrl)(originalPublicUrl);
|
|
43
43
|
const fullBase = (0, path_1.resolve)(process.cwd(), baseDir);
|
|
44
44
|
const entryList = Array.isArray(entry) ? entry : [entry];
|
|
45
|
+
const manifest = 'pilets.json';
|
|
45
46
|
(0, common_1.setLogLevel)(logLevel);
|
|
46
47
|
await hooks.onBegin?.({ options, fullBase });
|
|
47
48
|
(0, common_1.progress)('Reading configuration ...');
|
|
@@ -82,6 +83,7 @@ async function buildPilet(baseDir = process.cwd(), options = {}) {
|
|
|
82
83
|
if (type === 'standalone') {
|
|
83
84
|
const distDir = (0, path_1.dirname)((0, path_1.resolve)(fullBase, target));
|
|
84
85
|
const outDir = (0, path_1.resolve)(distDir, 'standalone');
|
|
86
|
+
const outFile = 'index.html';
|
|
85
87
|
const { apps, root } = pilets[0];
|
|
86
88
|
if (apps.length === 0) {
|
|
87
89
|
(0, common_1.fail)('appInstancesNotGiven_0012');
|
|
@@ -93,7 +95,7 @@ async function buildPilet(baseDir = process.cwd(), options = {}) {
|
|
|
93
95
|
await (0, common_1.removeDirectory)(outDir);
|
|
94
96
|
(0, common_1.progress)('Copying files ...');
|
|
95
97
|
await copyPilets(outDir, pilets);
|
|
96
|
-
await createMetadata(outDir,
|
|
98
|
+
await createMetadata(outDir, manifest, pilets, publicUrl);
|
|
97
99
|
if (isEmulator) {
|
|
98
100
|
// in case of an emulator assets are not "seen" by the bundler, so we
|
|
99
101
|
// just copy overthing over - this should work in most cases.
|
|
@@ -113,7 +115,7 @@ async function buildPilet(baseDir = process.cwd(), options = {}) {
|
|
|
113
115
|
minify,
|
|
114
116
|
externals: [],
|
|
115
117
|
publicUrl,
|
|
116
|
-
outFile
|
|
118
|
+
outFile,
|
|
117
119
|
outDir,
|
|
118
120
|
entryFiles: appFile,
|
|
119
121
|
logLevel,
|
|
@@ -136,7 +138,7 @@ async function buildPilet(baseDir = process.cwd(), options = {}) {
|
|
|
136
138
|
minify,
|
|
137
139
|
externals: (0, common_1.flattenExternals)(externals),
|
|
138
140
|
publicUrl,
|
|
139
|
-
outFile
|
|
141
|
+
outFile,
|
|
140
142
|
outDir,
|
|
141
143
|
entryFiles: appFile,
|
|
142
144
|
logLevel,
|
|
@@ -144,10 +146,13 @@ async function buildPilet(baseDir = process.cwd(), options = {}) {
|
|
|
144
146
|
_,
|
|
145
147
|
}, bundlerName);
|
|
146
148
|
}
|
|
149
|
+
const html = await (0, common_1.readText)(outDir, outFile);
|
|
150
|
+
const newHtml = html.replace('<script', // place the assignment before the first seen script
|
|
151
|
+
`<script>window['dbg:pilet-api']=${JSON.stringify(publicUrl + manifest)};</script><script`);
|
|
152
|
+
await (0, common_1.writeText)(outDir, outFile, newHtml);
|
|
147
153
|
(0, common_1.logDone)(`Standalone app available at "${outDir}"!`);
|
|
148
154
|
}
|
|
149
155
|
else if (type === 'manifest') {
|
|
150
|
-
const manifest = 'pilets.json';
|
|
151
156
|
const outDir = (0, path_1.dirname)((0, path_1.resolve)(fullBase, target));
|
|
152
157
|
(0, common_1.logInfo)('Building pilet manifest ...');
|
|
153
158
|
(0, common_1.progress)('Copying files ...');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-pilet.js","sourceRoot":"","sources":["../../src/apps/build-pilet.ts"],"names":[],"mappings":";;;AAAA,+BAAwC;AACxC,oCAAyE;AACzE,wCAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"build-pilet.js","sourceRoot":"","sources":["../../src/apps/build-pilet.ts"],"names":[],"mappings":";;;AAAA,+BAAwC;AACxC,oCAAyE;AACzE,wCAA4C;AAC5C,sCAuBmB;AAUnB,SAAS,cAAc,CAAC,M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AA6B,CAAC,CAAC;QAEvC,IAAA,iBAAQ,EAAC,mBAAmB,CAAC,CAAC;QAE9B,MAAM,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAEjC,MAAM,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QAE1D,IAAA,gBAAO,EAAC,0BAA0B,MAAM,IAAI,QAAQ,IAAI,CAAC,CAAC;KAC3D;IAED,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;AAC1B,CAAC;AA7KD,gCA6KC"}
|
package/lib/external/index.js
CHANGED
|
@@ -48891,6 +48891,7 @@ var require_unpack = __commonJS({
|
|
|
48891
48891
|
var getFlag = require_get_write_flag();
|
|
48892
48892
|
var platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform;
|
|
48893
48893
|
var isWindows = platform === "win32";
|
|
48894
|
+
var DEFAULT_MAX_DEPTH = 1024;
|
|
48894
48895
|
var unlinkFile = (path2, cb) => {
|
|
48895
48896
|
if (!isWindows) {
|
|
48896
48897
|
return fs2.unlink(path2, cb);
|
|
@@ -48967,6 +48968,7 @@ var require_unpack = __commonJS({
|
|
|
48967
48968
|
}
|
|
48968
48969
|
this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? process.getuid() : null;
|
|
48969
48970
|
this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? process.getgid() : null;
|
|
48971
|
+
this.maxDepth = typeof opt.maxDepth === "number" ? opt.maxDepth : DEFAULT_MAX_DEPTH;
|
|
48970
48972
|
this.forceChown = opt.forceChown === true;
|
|
48971
48973
|
this.win32 = !!opt.win32 || isWindows;
|
|
48972
48974
|
this.newer = !!opt.newer;
|
|
@@ -48996,12 +48998,12 @@ var require_unpack = __commonJS({
|
|
|
48996
48998
|
}
|
|
48997
48999
|
}
|
|
48998
49000
|
[CHECKPATH](entry) {
|
|
49001
|
+
const p = normPath(entry.path);
|
|
49002
|
+
const parts = p.split("/");
|
|
48999
49003
|
if (this.strip) {
|
|
49000
|
-
const parts = normPath(entry.path).split("/");
|
|
49001
49004
|
if (parts.length < this.strip) {
|
|
49002
49005
|
return false;
|
|
49003
49006
|
}
|
|
49004
|
-
entry.path = parts.slice(this.strip).join("/");
|
|
49005
49007
|
if (entry.type === "Link") {
|
|
49006
49008
|
const linkparts = normPath(entry.linkpath).split("/");
|
|
49007
49009
|
if (linkparts.length >= this.strip) {
|
|
@@ -49010,10 +49012,19 @@ var require_unpack = __commonJS({
|
|
|
49010
49012
|
return false;
|
|
49011
49013
|
}
|
|
49012
49014
|
}
|
|
49015
|
+
parts.splice(0, this.strip);
|
|
49016
|
+
entry.path = parts.join("/");
|
|
49017
|
+
}
|
|
49018
|
+
if (isFinite(this.maxDepth) && parts.length > this.maxDepth) {
|
|
49019
|
+
this.warn("TAR_ENTRY_ERROR", "path excessively deep", {
|
|
49020
|
+
entry,
|
|
49021
|
+
path: p,
|
|
49022
|
+
depth: parts.length,
|
|
49023
|
+
maxDepth: this.maxDepth
|
|
49024
|
+
});
|
|
49025
|
+
return false;
|
|
49013
49026
|
}
|
|
49014
49027
|
if (!this.preservePaths) {
|
|
49015
|
-
const p = normPath(entry.path);
|
|
49016
|
-
const parts = p.split("/");
|
|
49017
49028
|
if (parts.includes("..") || isWindows && /^[a-z]:\.\.$/i.test(parts[0])) {
|
|
49018
49029
|
this.warn("TAR_ENTRY_ERROR", `path contains '..'`, {
|
|
49019
49030
|
entry,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4-beta.6997",
|
|
4
4
|
"description": "The standard CLI for creating and building a Piral instance or a Pilet.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portal",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"typescript": "^5.0.0",
|
|
82
82
|
"yargs": "^15.0.0"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "882a0187dea69c8a273e041e1bebd68c56c1d59b"
|
|
85
85
|
}
|
package/src/apps/build-pilet.ts
CHANGED
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
retrievePiletsInfo,
|
|
23
23
|
flattenExternals,
|
|
24
24
|
triggerBuildPilet,
|
|
25
|
+
readText,
|
|
26
|
+
writeText,
|
|
25
27
|
} from '../common';
|
|
26
28
|
|
|
27
29
|
interface PiletData {
|
|
@@ -200,6 +202,7 @@ export async function buildPilet(baseDir = process.cwd(), options: BuildPiletOpt
|
|
|
200
202
|
const publicUrl = normalizePublicUrl(originalPublicUrl);
|
|
201
203
|
const fullBase = resolve(process.cwd(), baseDir);
|
|
202
204
|
const entryList = Array.isArray(entry) ? entry : [entry];
|
|
205
|
+
const manifest = 'pilets.json';
|
|
203
206
|
setLogLevel(logLevel);
|
|
204
207
|
|
|
205
208
|
await hooks.onBegin?.({ options, fullBase });
|
|
@@ -246,6 +249,7 @@ export async function buildPilet(baseDir = process.cwd(), options: BuildPiletOpt
|
|
|
246
249
|
if (type === 'standalone') {
|
|
247
250
|
const distDir = dirname(resolve(fullBase, target));
|
|
248
251
|
const outDir = resolve(distDir, 'standalone');
|
|
252
|
+
const outFile = 'index.html';
|
|
249
253
|
const { apps, root } = pilets[0];
|
|
250
254
|
|
|
251
255
|
if (apps.length === 0) {
|
|
@@ -264,7 +268,7 @@ export async function buildPilet(baseDir = process.cwd(), options: BuildPiletOpt
|
|
|
264
268
|
|
|
265
269
|
await copyPilets(outDir, pilets);
|
|
266
270
|
|
|
267
|
-
await createMetadata(outDir,
|
|
271
|
+
await createMetadata(outDir, manifest, pilets, publicUrl);
|
|
268
272
|
|
|
269
273
|
if (isEmulator) {
|
|
270
274
|
// in case of an emulator assets are not "seen" by the bundler, so we
|
|
@@ -287,7 +291,7 @@ export async function buildPilet(baseDir = process.cwd(), options: BuildPiletOpt
|
|
|
287
291
|
minify,
|
|
288
292
|
externals: [],
|
|
289
293
|
publicUrl,
|
|
290
|
-
outFile
|
|
294
|
+
outFile,
|
|
291
295
|
outDir,
|
|
292
296
|
entryFiles: appFile,
|
|
293
297
|
logLevel,
|
|
@@ -313,7 +317,7 @@ export async function buildPilet(baseDir = process.cwd(), options: BuildPiletOpt
|
|
|
313
317
|
minify,
|
|
314
318
|
externals: flattenExternals(externals),
|
|
315
319
|
publicUrl,
|
|
316
|
-
outFile
|
|
320
|
+
outFile,
|
|
317
321
|
outDir,
|
|
318
322
|
entryFiles: appFile,
|
|
319
323
|
logLevel,
|
|
@@ -324,9 +328,15 @@ export async function buildPilet(baseDir = process.cwd(), options: BuildPiletOpt
|
|
|
324
328
|
);
|
|
325
329
|
}
|
|
326
330
|
|
|
331
|
+
const html = await readText(outDir, outFile);
|
|
332
|
+
const newHtml = html.replace(
|
|
333
|
+
'<script', // place the assignment before the first seen script
|
|
334
|
+
`<script>window['dbg:pilet-api']=${JSON.stringify(publicUrl + manifest)};</script><script`,
|
|
335
|
+
);
|
|
336
|
+
await writeText(outDir, outFile, newHtml);
|
|
337
|
+
|
|
327
338
|
logDone(`Standalone app available at "${outDir}"!`);
|
|
328
339
|
} else if (type === 'manifest') {
|
|
329
|
-
const manifest = 'pilets.json';
|
|
330
340
|
const outDir = dirname(resolve(fullBase, target));
|
|
331
341
|
|
|
332
342
|
logInfo('Building pilet manifest ...');
|