@shijiu/jsview 2.2.373 → 2.2.426-test.0
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/dom/bin/DroidSansFallback.ttf +0 -0
- package/dom/bin/NotoColorEmoji.ttf +0 -0
- package/dom/bin/jsview-dom-browser-engine-core.min.js +2 -0
- package/dom/bin/jsview-dom-browser-engine-modules.min.js +2 -0
- package/dom/bin/jsview-dom-browser-forge.1385.f80e.wasm +0 -0
- package/dom/bin/jsview-dom-browser-forge.min.js +1 -0
- package/dom/bin/jsview-dom-browser-forge.worker.min.js +1 -0
- package/dom/bin/jsview-dom-browser.min.js +1 -1
- package/dom/bin/jsview-dom-native.min.js +1 -1
- package/dom/bin/jsview-engine-js-browser.min.js +1 -22
- package/dom/bin/jsview-engine-js-native.min.js +1 -1
- package/dom/bin/jsview-forge-define.min.js +1 -1
- package/dom/index.mjs +8 -10
- package/dom/target_core_revision.mjs +5 -2
- package/loader/jsv-core-api/jsview-core-api-glue.js +74 -0
- package/loader/jsv-core-api/wasm/backgroundtask.js +66 -0
- package/loader/jsv-core-api/wasm/core-api.js +206 -0
- package/loader/jsview-config.js +4 -1
- package/loader/jsview-loader.js +66 -77
- package/loader/jsview-main.mjs +1 -1
- package/package.json +1 -1
- package/patches/node_modules/vite/dist/node/jsview-vite-extension.js +67 -6
- package/shijiu-jsview-0.0.0.tgz +0 -0
- package/tools/https-server-config/cert.pem +61 -0
- package/tools/https-server-config/key.pem +27 -0
- package/tools/https-server-config/serve.config.json +16 -0
- package/tools/jsview-common.mjs +86 -3
- package/tools/jsview-post-build.mjs +99 -0
- package/tools/jsview-post-install.mjs +7 -4
- package/tools/jsview-retrieve-sourcemap.mjs +64 -49
- package/tools/jsview-run-tool.mjs +53 -3
|
@@ -7,6 +7,7 @@ import path from 'node:path';
|
|
|
7
7
|
import url from 'node:url'
|
|
8
8
|
import {
|
|
9
9
|
checkNodeVersion,
|
|
10
|
+
getJsViewBurdenDefaultBaseUrl,
|
|
10
11
|
getOptions,
|
|
11
12
|
loadPackageObject,
|
|
12
13
|
parseArguments,
|
|
@@ -253,6 +254,65 @@ async function signApp(options)
|
|
|
253
254
|
}
|
|
254
255
|
}
|
|
255
256
|
|
|
257
|
+
function redirectBurdenResource(options)
|
|
258
|
+
{
|
|
259
|
+
if(process.env['JSVIEW_BURDEN_LOCAL']) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
let burdenBaseUrl = process.env['JSVIEW_BURDEN_BASEURL'];
|
|
264
|
+
if(!burdenBaseUrl) {
|
|
265
|
+
burdenBaseUrl = getJsViewBurdenDefaultBaseUrl();
|
|
266
|
+
}
|
|
267
|
+
if(!burdenBaseUrl.endsWith('/')) {
|
|
268
|
+
burdenBaseUrl += '/';
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const burdenFilePathList = [];
|
|
272
|
+
|
|
273
|
+
const assetFileNames = fs.readdirSync(options.distAssetsDir);
|
|
274
|
+
for(const fileName of assetFileNames) {
|
|
275
|
+
if (!fileName.endsWith('.ttf')) {
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
burdenFilePathList.push(path.resolve(options.distAssetsDir, fileName));
|
|
279
|
+
}
|
|
280
|
+
const jsFileNames = fs.readdirSync(options.distJsDir);
|
|
281
|
+
for(const fileName of jsFileNames) {
|
|
282
|
+
if (!fileName.endsWith('.wasm')) {
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
burdenFilePathList.push(path.resolve(options.distJsDir, fileName));
|
|
286
|
+
}
|
|
287
|
+
for(const filePath of burdenFilePathList) {
|
|
288
|
+
fs.rmSync(filePath);
|
|
289
|
+
Logger.Info('Config burden file: ' + path.relative(options.projectDir, filePath));
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
for(const fileName of jsFileNames) {
|
|
293
|
+
if (!fileName.endsWith('.js') && !fileName.endsWith('.js.map')) {
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const filePath = path.resolve(options.distJsDir, fileName);
|
|
298
|
+
let sourceContent = fs.readFileSync(filePath, 'utf8');
|
|
299
|
+
|
|
300
|
+
for(const burdenFilePath of burdenFilePathList) {
|
|
301
|
+
const relativeBurdenFilePath = path.relative(options.distJsDir, burdenFilePath);
|
|
302
|
+
if(!sourceContent.includes(relativeBurdenFilePath)) {
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const burdenFileUrl = burdenBaseUrl + path.basename(burdenFilePath);
|
|
307
|
+
|
|
308
|
+
sourceContent = sourceContent.replaceAll(relativeBurdenFilePath, burdenFileUrl);
|
|
309
|
+
Logger.Info('Burdenting ' + path.relative(options.projectDir, filePath) + ' for [' + relativeBurdenFilePath + ']');
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
fs.writeFileSync(filePath, sourceContent, 'utf8');
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
256
316
|
function redirectSourceMappingURL(options)
|
|
257
317
|
{
|
|
258
318
|
const jsFileNames = fs.readdirSync(options.distJsDir);
|
|
@@ -307,6 +367,28 @@ function makeMainJsvMjs(options, framework)
|
|
|
307
367
|
fs.copyFileSync(newEntryFilePath, debugEntryFilePath);
|
|
308
368
|
}
|
|
309
369
|
|
|
370
|
+
function getWasmMapChunkName(options, wasmMapName)
|
|
371
|
+
{
|
|
372
|
+
let chunkName = wasmMapName;
|
|
373
|
+
|
|
374
|
+
const regex = new RegExp(`sourceMappingURL.${wasmMapName}`);
|
|
375
|
+
const jsFileNames = fs.readdirSync(options.distJsDir);
|
|
376
|
+
for(const fileName of jsFileNames) {
|
|
377
|
+
if (!fileName.endsWith('.wasm')) {
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
const filePath = path.resolve(options.distJsDir, fileName);
|
|
382
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
383
|
+
if(regex.test(content)) {
|
|
384
|
+
chunkName = fileName + '.map';
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
return chunkName;
|
|
390
|
+
}
|
|
391
|
+
|
|
310
392
|
function makeDebugMap(options, framework)
|
|
311
393
|
{
|
|
312
394
|
fs.mkdirSync(options.distDebugMapDir, { recursive: true });
|
|
@@ -323,6 +405,19 @@ function makeDebugMap(options, framework)
|
|
|
323
405
|
fs.renameSync(from, to);
|
|
324
406
|
};
|
|
325
407
|
|
|
408
|
+
const wasmFileNames = fs.readdirSync(options.jsviewDomBinDir);
|
|
409
|
+
for(const fileName of wasmFileNames) {
|
|
410
|
+
if (!fileName.endsWith('.wasm.map')) {
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
const chunkName = getWasmMapChunkName(options, fileName);
|
|
415
|
+
const from = path.resolve(options.jsviewDomBinDir, fileName);
|
|
416
|
+
const to = path.resolve(options.distDebugMapDir, chunkName);
|
|
417
|
+
Logger.Info(' -> ' + path.relative(options.projectDir, to));
|
|
418
|
+
fs.copyFileSync(from, to);
|
|
419
|
+
};
|
|
420
|
+
|
|
326
421
|
const jsmapServeName = 'jsview-jsmap-serve.mjs';
|
|
327
422
|
const jsmapServePath = path.resolve(options.jsviewToolsDir, jsmapServeName);
|
|
328
423
|
if (!fs.existsSync(jsmapServePath)) {
|
|
@@ -407,6 +502,10 @@ async function main(argv)
|
|
|
407
502
|
await checkDomDebugDisabled(options);
|
|
408
503
|
|
|
409
504
|
Logger.Info();
|
|
505
|
+
Logger.Info('Redirecting JsView burden resource...');
|
|
506
|
+
redirectBurdenResource(options)
|
|
507
|
+
Logger.Info('Redirected JsView burden resource...');
|
|
508
|
+
|
|
410
509
|
Logger.Info('Redirecting JsView source map...');
|
|
411
510
|
redirectSourceMappingURL(options)
|
|
412
511
|
Logger.Info('Redirected JsView source map...');
|
|
@@ -245,7 +245,7 @@ async function printRevision(options)
|
|
|
245
245
|
Logger.Info('**************************************************');
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
function doPostInstall(framework, pkgNeedPatch, skipCheckVersion)
|
|
248
|
+
function doPostInstall(framework, pkgNeedPatch, skipCheckVersion, skipCheckNpmcmd)
|
|
249
249
|
{
|
|
250
250
|
const options = getOptions(framework);
|
|
251
251
|
options.projectDir = process.cwd();
|
|
@@ -260,7 +260,9 @@ function doPostInstall(framework, pkgNeedPatch, skipCheckVersion)
|
|
|
260
260
|
'@shijiu/jsview-react-extra-samples',
|
|
261
261
|
];
|
|
262
262
|
|
|
263
|
-
|
|
263
|
+
if(!skipCheckNpmcmd) {
|
|
264
|
+
checkNpmCommand();
|
|
265
|
+
}
|
|
264
266
|
|
|
265
267
|
checkNpmLinkForDebug(options, linkablePkgNames);
|
|
266
268
|
|
|
@@ -304,14 +306,15 @@ function main(argv)
|
|
|
304
306
|
Logger.ErrorAndExit('Failed to support framework: ' + framework);
|
|
305
307
|
}
|
|
306
308
|
|
|
307
|
-
doPostInstall(argv.framework, pkgNeedPatch, argv.skipCheckVersion);
|
|
309
|
+
doPostInstall(argv.framework, pkgNeedPatch, argv.skipCheckVersion, argv.skipCheckNpmcmd);
|
|
308
310
|
}
|
|
309
311
|
|
|
310
312
|
const requiredUsages = {
|
|
311
313
|
'--framework': 'Select from [vue|react]',
|
|
312
314
|
};
|
|
313
315
|
const optionalUsages = {
|
|
314
|
-
'--skip-check-version': 'Skip check patches version.'
|
|
316
|
+
'--skip-check-version': 'Skip check patches version.',
|
|
317
|
+
'--skip-check-npmcmd': 'Skip check npm command.'
|
|
315
318
|
};
|
|
316
319
|
const argv = parseArguments(requiredUsages, optionalUsages);
|
|
317
320
|
main(argv);
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
checkNodeVersion,
|
|
9
9
|
convertHomeDirectory,
|
|
10
10
|
execCommand,
|
|
11
|
+
execCommandPromise,
|
|
11
12
|
getOptions,
|
|
12
13
|
parseArguments,
|
|
13
14
|
Logger,
|
|
@@ -24,13 +25,14 @@ function getExtraOptions(argv)
|
|
|
24
25
|
options.inputFile = convertHomeDirectory(argv.inputFile);
|
|
25
26
|
options.outputFile = convertHomeDirectory(argv.outputFile);
|
|
26
27
|
options.sourcemapDir = convertHomeDirectory(argv.sourcemapDir) ?? getDefaultSourceMapDir();
|
|
28
|
+
options.debugWasmFile = argv.debugWasmFile;
|
|
27
29
|
options.sourceMapMoudulePath = path.resolve(options.modulesDir, 'source-map', 'source-map.js');
|
|
28
30
|
|
|
29
31
|
if(!argv.sourcemapDir) {
|
|
30
32
|
Logger.Warn('Use default source map dir: ' + options.sourcemapDir);
|
|
31
33
|
}
|
|
32
34
|
if(fs.existsSync(options.sourcemapDir) == false) {
|
|
33
|
-
Logger.
|
|
35
|
+
Logger.Warn('Source map dir is not exists. Please check dir: ' + options.sourcemapDir);
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
return options;
|
|
@@ -63,17 +65,17 @@ async function parseConsoleLog(options)
|
|
|
63
65
|
const content = fs.readFileSync(options.inputFile, 'utf-8');
|
|
64
66
|
const contentLines = content.split('\n');
|
|
65
67
|
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
+
const regexWasm = / at .* \(.*\.wasm.*:0x[0-9a-f]*\)/;
|
|
69
|
+
const regexJs = / at .* \((.*):(\d+):(\d+)\)/;
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
let resultLines = [];
|
|
70
72
|
for(const line of contentLines) {
|
|
71
|
-
|
|
73
|
+
let recovered = line.replace(/.*?:\d+ /, '');
|
|
72
74
|
|
|
73
|
-
if(
|
|
74
|
-
recovered = await
|
|
75
|
-
} else if(
|
|
76
|
-
recovered = await
|
|
75
|
+
if(regexWasm.test(recovered)) {
|
|
76
|
+
recovered = await recoverWasmLine(options, recovered);
|
|
77
|
+
} else if(regexJs.test(recovered)) {
|
|
78
|
+
recovered = await recoverJsLine(options, recovered);
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
if(!options.outputFile) {
|
|
@@ -89,57 +91,65 @@ async function parseConsoleLog(options)
|
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
|
|
92
|
-
async function
|
|
94
|
+
async function recoverWasmLine(options, content)
|
|
93
95
|
{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var fileRow = matchResult?.[3];
|
|
98
|
-
var fileColumn = matchResult?.[4];
|
|
99
|
-
|
|
100
|
-
// at file.js:row:column
|
|
101
|
-
if(!fileName) {
|
|
102
|
-
fileName = funcName;
|
|
103
|
-
funcName = "";
|
|
104
|
-
} else { // at func (file.js:row:column)
|
|
105
|
-
// do nothing
|
|
96
|
+
if(!options.debugWasmFile) {
|
|
97
|
+
Logger.Warn('Debug wasm file is not exists. Please set by argument: --debug-wasm-file');
|
|
98
|
+
return content;
|
|
106
99
|
}
|
|
107
100
|
|
|
108
|
-
const
|
|
109
|
-
|
|
101
|
+
const prefixIdx = content.lastIndexOf('(');
|
|
102
|
+
const suffixIdx = content.indexOf(')', prefixIdx);
|
|
103
|
+
if(prefixIdx < 0 || suffixIdx < 0) {
|
|
110
104
|
return content;
|
|
111
105
|
}
|
|
112
106
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
107
|
+
const fileInfo = content.slice(prefixIdx + 1).slice(0, suffixIdx - prefixIdx - 1);
|
|
108
|
+
const colonIdx = fileInfo.lastIndexOf(':');
|
|
109
|
+
const address = fileInfo.slice(colonIdx + 1);
|
|
110
|
+
|
|
111
|
+
const cmdline = `emsymbolizer ${options.debugWasmFile} ${address}`;
|
|
112
|
+
const origPos = await execCommandPromise(cmdline);
|
|
119
113
|
|
|
120
|
-
|
|
114
|
+
let result = content.slice(0, prefixIdx + 1);
|
|
115
|
+
result += origPos;
|
|
116
|
+
result += content.slice(suffixIdx);
|
|
117
|
+
|
|
118
|
+
return result;
|
|
121
119
|
}
|
|
122
120
|
|
|
123
|
-
async function
|
|
121
|
+
async function recoverJsLine(options, content)
|
|
124
122
|
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
123
|
+
const prefixIdx = content.lastIndexOf('(');
|
|
124
|
+
const suffixIdx = content.indexOf(')', prefixIdx);
|
|
125
|
+
if(prefixIdx < 0 || suffixIdx < 0) {
|
|
126
|
+
return content;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const fileInfo = content.slice(prefixIdx + 1).slice(0, suffixIdx - prefixIdx - 1);
|
|
130
|
+
const fileInfoArray = fileInfo.split(':');
|
|
131
|
+
let fileName = fileInfoArray[0];
|
|
132
|
+
let fileRow = fileInfoArray[1];
|
|
133
|
+
let fileColumn = fileInfoArray[2];
|
|
134
|
+
|
|
135
|
+
// // at file.js:row:column
|
|
136
|
+
// if(!fileName) {
|
|
137
|
+
// fileName = funcName;
|
|
138
|
+
// funcName = "";
|
|
139
|
+
// } else { // at func (file.js:row:column)
|
|
140
|
+
// // do nothing
|
|
135
141
|
// }
|
|
136
142
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
const origPos = await getOriginalPosition(options, fileName, fileRow, fileColumn);
|
|
144
|
+
if(!origPos) {
|
|
145
|
+
return content;
|
|
146
|
+
}
|
|
141
147
|
|
|
142
|
-
|
|
148
|
+
let result = content.slice(0, prefixIdx + 1);
|
|
149
|
+
result += (origPos.source + ':' + origPos.line + ':' + origPos.column);
|
|
150
|
+
result += content.slice(suffixIdx);
|
|
151
|
+
|
|
152
|
+
return result;
|
|
143
153
|
}
|
|
144
154
|
|
|
145
155
|
async function getOriginalPosition(options, fileName, fileRow, fileColumn)
|
|
@@ -148,13 +158,17 @@ async function getOriginalPosition(options, fileName, fileRow, fileColumn)
|
|
|
148
158
|
return null;
|
|
149
159
|
}
|
|
150
160
|
|
|
151
|
-
|
|
161
|
+
if(fileName.endsWith('.map') == false) {
|
|
162
|
+
fileName = fileName + '.map';
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const sourceMapFilePath = path.resolve(options.sourcemapDir, fileName);
|
|
152
166
|
if(fs.existsSync(sourceMapFilePath) == false) {
|
|
153
167
|
Logger.Warn('Source map file is not found: ' + sourceMapFilePath)
|
|
154
168
|
return null;
|
|
155
169
|
}
|
|
156
170
|
|
|
157
|
-
|
|
171
|
+
let sourceMapConsumer = options.sourceMapConsumerMap[sourceMapFilePath];
|
|
158
172
|
if(!sourceMapConsumer) {
|
|
159
173
|
const sourceMapContent = fs.readFileSync(sourceMapFilePath, 'utf-8');
|
|
160
174
|
sourceMapConsumer = new options.sourceMapModule.SourceMapConsumer(sourceMapContent);
|
|
@@ -188,6 +202,7 @@ const requiredUsages = {
|
|
|
188
202
|
};
|
|
189
203
|
const optionalUsages = {
|
|
190
204
|
'-d | --sourcemap-dir': 'Source map dir. Default dir is: ' + getDefaultSourceMapDir(),
|
|
205
|
+
'-w | --debug-wasm-file': 'Debug wasm file path.',
|
|
191
206
|
'-o | --output-file': 'Recovered console log file path.',
|
|
192
207
|
};
|
|
193
208
|
const argv = parseArguments(requiredUsages, optionalUsages, false);
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
import path from 'node:path';
|
|
4
5
|
import {
|
|
5
6
|
askAndAnswer,
|
|
6
7
|
checkNodeVersion,
|
|
7
|
-
|
|
8
|
+
execCommand,
|
|
9
|
+
getExportPrefix,
|
|
8
10
|
getOptions,
|
|
11
|
+
isCommandAvailable,
|
|
9
12
|
parseArguments,
|
|
10
|
-
Logger,
|
|
11
|
-
execCommand,
|
|
12
13
|
printArgumentsUsages,
|
|
14
|
+
Logger,
|
|
13
15
|
} from './jsview-common.mjs';
|
|
14
16
|
|
|
15
17
|
async function getExtraOptions(argv)
|
|
@@ -22,11 +24,16 @@ async function getExtraOptions(argv)
|
|
|
22
24
|
options.entryUrl = argv.url;
|
|
23
25
|
|
|
24
26
|
let commandCount = 0;
|
|
27
|
+
commandCount += (argv.httpServer ? 1 : 0);
|
|
28
|
+
commandCount += (argv.httpsServer ? 1 : 0);
|
|
29
|
+
commandCount += (argv.httpVite ? 1 : 0);
|
|
30
|
+
commandCount += (argv.httpsVite ? 1 : 0);
|
|
25
31
|
commandCount += (argv.configApp ? 1 : 0);
|
|
26
32
|
commandCount += (argv.genKeypair ? 1 : 0);
|
|
27
33
|
commandCount += (argv.runonAndroid ? 1 : 0);
|
|
28
34
|
commandCount += (argv.buildMinifyExclude ? 1 : 0);
|
|
29
35
|
commandCount += (argv.buildZip ? 1 : 0);
|
|
36
|
+
commandCount += (argv.buildBurdenLocal ? 1 : 0);
|
|
30
37
|
commandCount += (argv.moduleFederation ? 1 : 0);
|
|
31
38
|
commandCount += (argv.vueDevtools ? 1 : 0);
|
|
32
39
|
if(commandCount == 0) {
|
|
@@ -36,11 +43,16 @@ async function getExtraOptions(argv)
|
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
const commandPrompt = [
|
|
46
|
+
'httpServer',
|
|
47
|
+
'httpsServer',
|
|
48
|
+
'httpVite',
|
|
49
|
+
'httpsVite',
|
|
39
50
|
'runonAndroid',
|
|
40
51
|
'configApp',
|
|
41
52
|
'genKeypair',
|
|
42
53
|
'buildMinifyExclude',
|
|
43
54
|
'buildZip',
|
|
55
|
+
'buildBurdenLocal',
|
|
44
56
|
'vueDevtools',
|
|
45
57
|
'moduleFederation',
|
|
46
58
|
];
|
|
@@ -58,11 +70,16 @@ async function getExtraOptions(argv)
|
|
|
58
70
|
Logger.Info('command:', command);
|
|
59
71
|
options[command] = true
|
|
60
72
|
} else if(commandCount == 1) {
|
|
73
|
+
options.httpServer = argv.httpServer;
|
|
74
|
+
options.httpsServer = argv.httpsServer;
|
|
75
|
+
options.httpsVite = argv.httpsVite;
|
|
76
|
+
options.httpVite = argv.httpVite;
|
|
61
77
|
options.runonAndroid = argv.runonAndroid;
|
|
62
78
|
options.configApp = argv.configApp;
|
|
63
79
|
options.genKeypair = argv.genKeypair;
|
|
64
80
|
options.buildMinifyExclude = argv.buildMinifyExclude;
|
|
65
81
|
options.buildZip = argv.buildZip;
|
|
82
|
+
options.buildBurdenLocal = argv.buildBurdenLocal;
|
|
66
83
|
options.vueDevtools = argv.vueDevtools;
|
|
67
84
|
options.moduleFederation = argv.moduleFederation;
|
|
68
85
|
} else if(commandCount > 1) {
|
|
@@ -111,6 +128,8 @@ function doCommand(options, argv) {
|
|
|
111
128
|
}
|
|
112
129
|
|
|
113
130
|
command = 'node node_modules/@shijiu/jsview/tools/jsview-build-zip.mjs --password=' + password;
|
|
131
|
+
} else if(options.buildBurdenLocal) {
|
|
132
|
+
command = 'JSVIEW_BURDEN_LOCAL=true npm run build';
|
|
114
133
|
} else if(options.vueDevtools) {
|
|
115
134
|
var defaultPort = 8098;
|
|
116
135
|
const port = (typeof(options.vueDevtools) === 'string' ? options.vueDevtools : defaultPort);
|
|
@@ -124,6 +143,32 @@ function doCommand(options, argv) {
|
|
|
124
143
|
argumentsLine = argumentsLine.replace(' -f ', ' ').replace(' --module-federation ', ' ');
|
|
125
144
|
|
|
126
145
|
command = 'node node_modules/@shijiu/jsview/tools/jsview-module-federation.mjs' + argumentsLine;
|
|
146
|
+
} else if(options.httpServer) {
|
|
147
|
+
if(isCommandAvailable('serve') == false) {
|
|
148
|
+
Logger.ErrorAndExitNoException("Command `serve` is not found, please install it first by `npm install -g serve`.");
|
|
149
|
+
}
|
|
150
|
+
if(typeof options.httpServer !== 'string') {
|
|
151
|
+
Logger.ErrorAndExitNoException("Dir path is not found, please set dir by [-t|--http-server]=[DirPath].");
|
|
152
|
+
}
|
|
153
|
+
command = `serve -p 8080 --cors ${options.httpServer}`;
|
|
154
|
+
} else if(options.httpsServer) {
|
|
155
|
+
if(isCommandAvailable('serve') == false) {
|
|
156
|
+
Logger.ErrorAndExitNoException("Command `serve` is not found, please install it first by `npm install -g serve`.");
|
|
157
|
+
}
|
|
158
|
+
if(typeof options.httpsServer !== 'string') {
|
|
159
|
+
Logger.ErrorAndExitNoException("Dir path is not found, please set dir by [-s|--https-server]=[DirPath].");
|
|
160
|
+
}
|
|
161
|
+
const exportPrefix = getExportPrefix();
|
|
162
|
+
const certPath = path.resolve(options.jsviewToolsDir, 'https-server-config/cert.pem');
|
|
163
|
+
const keyPath = path.resolve(options.jsviewToolsDir, 'https-server-config/key.pem');
|
|
164
|
+
const configPath = path.resolve(options.jsviewToolsDir, 'https-server-config/serve.config.json');
|
|
165
|
+
command = `${exportPrefix} NODE_OPTIONS='--tls-min-v1.0 --tls-max-v1.2'`;
|
|
166
|
+
command += ` && serve -p 8080 --cors --ssl-cert ${certPath} --ssl-key ${keyPath} --config ${configPath} ${options.httpsServer}`;
|
|
167
|
+
} else if(options.httpVite) {
|
|
168
|
+
command = `npm start`;
|
|
169
|
+
} else if(options.httpsVite) {
|
|
170
|
+
const exportPrefix = getExportPrefix();
|
|
171
|
+
command = `${exportPrefix} JSVIEW_ENABLE_HTTPS=true && npm start`;
|
|
127
172
|
}
|
|
128
173
|
|
|
129
174
|
execCommand(command);
|
|
@@ -142,11 +187,16 @@ const requiredUsages = {
|
|
|
142
187
|
'--framework': 'Select from [vue|react]',
|
|
143
188
|
};
|
|
144
189
|
const optionalUsages = {
|
|
190
|
+
'-t | --http-server': '=[DirPath]. Start http server for debug, port is 8080.',
|
|
191
|
+
'-s | --https-server': '=[DirPath]. Start https server for debug, port is 8080.',
|
|
192
|
+
'-v | --http-vite': 'Start vite https server for debug, same as `npm start`',
|
|
193
|
+
'-i | --https-vite': 'Start vite https server for debug.',
|
|
145
194
|
'-a | --runon-android': 'Run app on android devices.',
|
|
146
195
|
'-c | --config-app': 'Config app, like: -c or --config-app=[AppName:AppTitle].',
|
|
147
196
|
'-g | --gen-keypair': 'Generate sign keypair.',
|
|
148
197
|
'-m | --build-minify-exclude': 'Build target with minify-exclude filter, like: -m or --build-minify-exclude=[filter], additional options: -s or --script=build:dev.',
|
|
149
198
|
'-z | --build-zip': 'Build target to offline zip package, like: -z or --build-zip=[password].',
|
|
199
|
+
'-b | --build-burden-local': 'Build target with local burden files.',
|
|
150
200
|
'-d | --vue-devtools': 'Start vue dev server and vue-devtools standalone, like: -d or --vue-devtools=[port].',
|
|
151
201
|
'-f | --module-federation': 'Make project to module federation, use --module-federation --help for details.',
|
|
152
202
|
};
|