@shijiu/jsview 2.2.201 → 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 +2 -0
- package/dom/bin/jsview-forge-define.min.js +1 -1
- package/dom/index.mjs +38 -14
- package/dom/target_core_revision.mjs +10 -5
- 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 +22 -0
- package/loader/jsview-loader.js +74 -85
- package/loader/jsview-main.mjs +8 -14
- package/loader/jsview.config.default.js +2 -2
- 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 +87 -3
- package/tools/jsview-post-build.mjs +248 -70
- package/tools/jsview-post-install.mjs +7 -4
- package/tools/jsview-retrieve-sourcemap.mjs +64 -49
- package/tools/jsview-run-tool.mjs +53 -3
- package/tools/jsview-vue-devtools.mjs +2 -0
|
@@ -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
|
};
|
|
@@ -55,8 +55,10 @@ async function runVueDevtoolsStandalone(options)
|
|
|
55
55
|
|
|
56
56
|
const exportElectronMirror = exportPrefix + ' ELECTRON_MIRROR=http://cdn.release.qcast.cn/RN_devtools/electron-env/'
|
|
57
57
|
let cmdline = exportElectronMirror + ' && npm install --package-lock-only --save-exact --save-dev electron@21.4.4 @vue/devtools@6.5.1'
|
|
58
|
+
cmdline = cmdline.replace(' &&', '&&'); // 解决window系统设置后多了一个空格的问题
|
|
58
59
|
execCommand(cmdline);
|
|
59
60
|
cmdline = exportElectronMirror + ' && npm ci'
|
|
61
|
+
cmdline = cmdline.replace(' &&', '&&'); // 解决window系统设置后多了一个空格的问题
|
|
60
62
|
execCommand(cmdline);
|
|
61
63
|
|
|
62
64
|
console.log()
|