@shijiu/jsview 1.9.783 → 1.9.825
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/jsview-browser-debug-dom.min.js +1 -1
- package/dom/bin/jsview-dom.min.js +1 -1
- package/dom/bin/jsview-engine-js-browser.min.js +1 -1
- package/dom/jsv-browser-debug-dom.js +6 -3
- package/dom/jsv-code-debug.mjs +5 -5
- package/dom/jsv-dom.js +5 -2
- package/dom/jsv-engine-js-browser.js +3 -0
- package/dom/jsv-forge-define.js +5 -2
- package/dom/target_core_revision.mjs +4 -4
- package/loader/jsview-browser-forgeapp.js +13 -0
- package/loader/jsview-loader.js +198 -0
- package/loader/jsview-main.js +14 -33
- package/loader/jsview-react-main.js +36 -0
- package/loader/{header_script_loader.js → jsview-react-script-loader.js} +0 -0
- package/package.json +1 -1
- package/patches/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +925 -921
- package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +1 -0
- package/patches/node_modules/postcss-js/objectifier.js +1 -0
- package/patches/node_modules/react-dev-utils/WebpackDevServerUtils.js +450 -0
- package/patches/node_modules/react-dev-utils/package.json +88 -0
- package/patches/node_modules/react-scripts/config/paths.js +17 -6
- package/patches/node_modules/react-scripts/config/webpack.config.js +36 -15
- package/patches/node_modules/vite/dist/node/chunks/dep-ed9cb113.js +12 -8
- package/patches/node_modules/vue-router/dist/vue-router.mjs +1 -0
- package/patches/node_modules/webpack-dev-server/client/utils/reloadApp.js +76 -0
- package/patches/node_modules/webpack-dev-server/client/utils/sendMessage.js +21 -0
- package/patches/node_modules/webpack-dev-server/package.json +141 -0
- package/tools/jsview-common.js +54 -21
- package/tools/jsview-post-build.js +16 -6
- package/tools/jsview-post-install.js +60 -9
- package/loader/jsview.default.config.js +0 -37
- package/loader/loader.js +0 -183
- package/loader/loader_webkit.js +0 -40
- package/tools/index.js +0 -209
|
@@ -62,7 +62,11 @@ const emitErrorsAsWarnings = process.env.ESLINT_NO_DEV_ERRORS === 'true';
|
|
|
62
62
|
const disableESLintPlugin = process.env.DISABLE_ESLINT_PLUGIN === 'true';
|
|
63
63
|
|
|
64
64
|
const imageInlineSizeLimit = parseInt(
|
|
65
|
-
|
|
65
|
+
// JsView Modified >>>
|
|
66
|
+
// 资源文件不使用base64
|
|
67
|
+
// process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
|
|
68
|
+
process.env.IMAGE_INLINE_SIZE_LIMIT || '0'
|
|
69
|
+
// JsView Modified <<<
|
|
66
70
|
);
|
|
67
71
|
|
|
68
72
|
// Check if TypeScript is setup
|
|
@@ -117,8 +121,13 @@ module.exports = function (webpackEnv) {
|
|
|
117
121
|
// common function to get style loaders
|
|
118
122
|
const getStyleLoaders = (cssOptions, preProcessor) => {
|
|
119
123
|
const loaders = [
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
// JsView Modified >>>
|
|
125
|
+
// 盒子不支持加载css文件,去掉 build 后的css文件,直接集成到js中。
|
|
126
|
+
// isEnvDevelopment && require.resolve('style-loader'),
|
|
127
|
+
// isEnvProduction && {
|
|
128
|
+
require.resolve('style-loader'),
|
|
129
|
+
false && {
|
|
130
|
+
// JsView Modified <<<
|
|
122
131
|
loader: MiniCssExtractPlugin.loader,
|
|
123
132
|
// css is located in `static/css`, use '../../' to locate index.html folder
|
|
124
133
|
// in production `paths.publicUrlOrPath` can be a relative path
|
|
@@ -219,22 +228,24 @@ module.exports = function (webpackEnv) {
|
|
|
219
228
|
// There will be one main bundle, and one file per asynchronous chunk.
|
|
220
229
|
// In development, it does not produce real files.
|
|
221
230
|
filename: isEnvProduction
|
|
222
|
-
|
|
231
|
+
// JsView Modified >>>
|
|
232
|
+
// 修改 entry 的文件名
|
|
223
233
|
// ? 'static/js/[name].[contenthash:8].js'
|
|
224
234
|
// : isEnvDevelopment && 'static/js/bundle.js',
|
|
225
235
|
? 'js/main.jsv.[contenthash:8].js'
|
|
226
236
|
: isEnvDevelopment && 'js/main.jsv.js',
|
|
227
|
-
|
|
237
|
+
// JsView Modified <<<
|
|
228
238
|
// There are also additional JS chunk files if you use code splitting.
|
|
229
239
|
chunkFilename: isEnvProduction
|
|
230
|
-
|
|
240
|
+
// JsView Modified >>>
|
|
241
|
+
// 修改 chunk 的文件名
|
|
231
242
|
// ? 'static/js/[name].[contenthash:8].chunk.js'
|
|
232
243
|
// : isEnvDevelopment && 'static/js/[name].chunk.js',
|
|
233
244
|
// assetModuleFilename: 'static/media/[name].[hash][ext]',
|
|
234
245
|
? 'js/chunk.jsv.[contenthash:8].js'
|
|
235
246
|
: isEnvDevelopment && 'js/[name].chunk.js',
|
|
236
247
|
assetModuleFilename: 'media/[name].[hash][ext]',
|
|
237
|
-
|
|
248
|
+
// JsView Modified <<<
|
|
238
249
|
// webpack uses `publicPath` to determine where the app is being served from.
|
|
239
250
|
// It requires a trailing slash, or the file assets will get an incorrect path.
|
|
240
251
|
// We inferred the "public path" (such as / or /my-project) from homepage.
|
|
@@ -339,9 +350,10 @@ module.exports = function (webpackEnv) {
|
|
|
339
350
|
}),
|
|
340
351
|
...(modules.webpackAliases || {}),
|
|
341
352
|
|
|
342
|
-
|
|
353
|
+
// JsView Added >>>
|
|
354
|
+
// 添加 jsview alias
|
|
343
355
|
'jsview': '@shijiu/jsview-react'
|
|
344
|
-
|
|
356
|
+
// JsView Added <<<
|
|
345
357
|
},
|
|
346
358
|
plugins: [
|
|
347
359
|
// Prevents users from importing files from outside of src/ (or node_modules/).
|
|
@@ -416,10 +428,11 @@ module.exports = function (webpackEnv) {
|
|
|
416
428
|
{
|
|
417
429
|
loader: require.resolve('file-loader'),
|
|
418
430
|
options: {
|
|
419
|
-
|
|
431
|
+
// JsView Modified >>>
|
|
432
|
+
// 修改资源的文件名
|
|
420
433
|
// name: 'static/media/[name].[hash].[ext]',
|
|
421
434
|
name: 'media/[name].[hash].[ext]',
|
|
422
|
-
|
|
435
|
+
// JsView Modified <<<
|
|
423
436
|
},
|
|
424
437
|
},
|
|
425
438
|
],
|
|
@@ -431,10 +444,11 @@ module.exports = function (webpackEnv) {
|
|
|
431
444
|
// The preset includes JSX, Flow, TypeScript, and some ESnext features.
|
|
432
445
|
{
|
|
433
446
|
test: /\.(js|mjs|jsx|ts|tsx)$/,
|
|
434
|
-
|
|
447
|
+
// JsView Modified >>>
|
|
448
|
+
// 将jsview和jsviewDebugPath计入打包
|
|
435
449
|
// include: paths.appSrc,
|
|
436
450
|
include: [paths.appSrc, paths.jsviewPath, paths.jsviewDebugPath ],
|
|
437
|
-
|
|
451
|
+
// JsView Modified <<<
|
|
438
452
|
loader: require.resolve('babel-loader'),
|
|
439
453
|
options: {
|
|
440
454
|
customize: require.resolve(
|
|
@@ -685,12 +699,13 @@ module.exports = function (webpackEnv) {
|
|
|
685
699
|
new MiniCssExtractPlugin({
|
|
686
700
|
// Options similar to the same options in webpackOptions.output
|
|
687
701
|
// both options are optional
|
|
688
|
-
|
|
702
|
+
// JsView Modified >>>
|
|
703
|
+
// 修改Css文件名
|
|
689
704
|
// filename: 'static/css/[name].[contenthash:8].css',
|
|
690
705
|
// chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
|
|
691
706
|
filename: 'css/[name].[contenthash:8].css',
|
|
692
707
|
chunkFilename: 'css/[name].[contenthash:8].chunk.css',
|
|
693
|
-
|
|
708
|
+
// JsView Modified <<<
|
|
694
709
|
}),
|
|
695
710
|
// Generate an asset manifest file with the following content:
|
|
696
711
|
// - "files" key: Mapping of all asset filenames to their corresponding
|
|
@@ -820,6 +835,12 @@ module.exports = function (webpackEnv) {
|
|
|
820
835
|
experiments: {
|
|
821
836
|
topLevelAwait: true
|
|
822
837
|
},
|
|
838
|
+
ignoreWarnings: [
|
|
839
|
+
{
|
|
840
|
+
module: /@shijiu\/jsview/,
|
|
841
|
+
message: /Critical dependency: the request of a dependency is an expression/,
|
|
842
|
+
},
|
|
843
|
+
],
|
|
823
844
|
// JsView Added <<<
|
|
824
845
|
};
|
|
825
846
|
};
|
|
@@ -12601,11 +12601,12 @@ function printServerUrls(urls, optionsHost, info) {
|
|
|
12601
12601
|
picocolors.exports.bold('--host') +
|
|
12602
12602
|
picocolors.exports.dim(' to expose'));
|
|
12603
12603
|
}
|
|
12604
|
-
|
|
12604
|
+
// JsView Modified >>>
|
|
12605
|
+
// 将url写入network.mjs文件,用于npm run android。
|
|
12605
12606
|
import('../jsview-vite-extension.js').then((module) => {
|
|
12606
12607
|
module.jsvSaveUrlToCache(urls);
|
|
12607
12608
|
});
|
|
12608
|
-
|
|
12609
|
+
// JsView Modified <<<
|
|
12609
12610
|
}
|
|
12610
12611
|
|
|
12611
12612
|
const groups = [
|
|
@@ -44391,10 +44392,11 @@ function preload(baseModule, deps, importerUrl) {
|
|
|
44391
44392
|
function buildImportAnalysisPlugin(config) {
|
|
44392
44393
|
const ssr = !!config.build.ssr;
|
|
44393
44394
|
const isWorker = config.isWorker;
|
|
44394
|
-
|
|
44395
|
+
// JsView Modified >>>
|
|
44396
|
+
// 关闭 preload,盒子不支持
|
|
44395
44397
|
// const insertPreload = !(ssr ||
|
|
44396
44398
|
const insertPreload = false && !(ssr ||
|
|
44397
|
-
|
|
44399
|
+
// JsView Modified <<<
|
|
44398
44400
|
!!config.build.lib ||
|
|
44399
44401
|
isWorker ||
|
|
44400
44402
|
config.build.modulePreload === false);
|
|
@@ -61904,14 +61906,15 @@ async function createServer(inlineConfig = {}) {
|
|
|
61904
61906
|
if (httpServer) {
|
|
61905
61907
|
setClientErrorHandler(httpServer, config.logger);
|
|
61906
61908
|
}
|
|
61907
|
-
|
|
61909
|
+
// JsView Modified >>>
|
|
61910
|
+
// 将@shijiu目录加入文件改变监控
|
|
61908
61911
|
// const watcher = chokidar.watch(path$o.resolve(root), resolvedWatchOptions);
|
|
61909
61912
|
const watchPaths = [
|
|
61910
61913
|
path$o.resolve(root),
|
|
61911
61914
|
path$o.resolve(root, 'node_modules/@shijiu'),
|
|
61912
61915
|
];
|
|
61913
61916
|
const watcher = chokidar.watch(watchPaths, resolvedWatchOptions);
|
|
61914
|
-
|
|
61917
|
+
// JsView Modified <<<
|
|
61915
61918
|
const moduleGraph = new ModuleGraph((url, ssr) => container.resolveId(url, undefined, { ssr }));
|
|
61916
61919
|
const container = await createPluginContainer(config, moduleGraph, watcher);
|
|
61917
61920
|
const closeHttpServer = createServerCloseFn(httpServer);
|
|
@@ -62595,13 +62598,14 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
|
|
|
62595
62598
|
}
|
|
62596
62599
|
}
|
|
62597
62600
|
|
|
62598
|
-
|
|
62601
|
+
// JsView Added >>>
|
|
62602
|
+
// 合并jsview自定义config
|
|
62599
62603
|
const { jsvCreateJsViewViteConfig } = (await import('../jsview-vite-extension.js'));
|
|
62600
62604
|
const jsviewViteConfig = jsvCreateJsViewViteConfig(config);
|
|
62601
62605
|
if (jsviewViteConfig) {
|
|
62602
62606
|
config = mergeConfig(jsviewViteConfig, config);
|
|
62603
62607
|
}
|
|
62604
|
-
|
|
62608
|
+
// JsView Added <<<
|
|
62605
62609
|
|
|
62606
62610
|
// user config may provide an alternative mode. But --mode has a higher priority
|
|
62607
62611
|
mode = inlineConfig.mode || config.mode || mode;
|
|
@@ -3089,6 +3089,7 @@ function createRouter(options) {
|
|
|
3089
3089
|
}
|
|
3090
3090
|
function checkCanceledNavigation(to, from) {
|
|
3091
3091
|
// JsView Modified >>>
|
|
3092
|
+
// 修改location是否相等判定
|
|
3092
3093
|
// if (pendingLocation !== to) {
|
|
3093
3094
|
if (pendingLocation.href !== to.href) { // 防止按键粘连带来的连续进入同一页面报警
|
|
3094
3095
|
// JsView Modified <<<
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import hotEmitter from "webpack/hot/emitter.js";
|
|
2
|
+
import { log } from "./log.js";
|
|
3
|
+
/** @typedef {import("../index").Options} Options
|
|
4
|
+
/** @typedef {import("../index").Status} Status
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {Options} options
|
|
8
|
+
* @param {Status} status
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
function reloadApp(_ref, status) {
|
|
12
|
+
var hot = _ref.hot,
|
|
13
|
+
liveReload = _ref.liveReload;
|
|
14
|
+
|
|
15
|
+
if (status.isUnloading) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var currentHash = status.currentHash,
|
|
20
|
+
previousHash = status.previousHash;
|
|
21
|
+
var isInitial = currentHash.indexOf(
|
|
22
|
+
/** @type {string} */
|
|
23
|
+
previousHash) >= 0;
|
|
24
|
+
|
|
25
|
+
if (isInitial) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @param {Window} rootWindow
|
|
30
|
+
* @param {number} intervalId
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
function applyReload(rootWindow, intervalId) {
|
|
35
|
+
clearInterval(intervalId);
|
|
36
|
+
log.info("App updated. Reloading...");
|
|
37
|
+
rootWindow.location.reload();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var search = self.location.search.toLowerCase();
|
|
41
|
+
var allowToHot = search.indexOf("webpack-dev-server-hot=false") === -1;
|
|
42
|
+
var allowToLiveReload = search.indexOf("webpack-dev-server-live-reload=false") === -1;
|
|
43
|
+
|
|
44
|
+
if (hot && allowToHot) {
|
|
45
|
+
log.info("App hot update...");
|
|
46
|
+
hotEmitter.emit("webpackHotUpdate", status.currentHash);
|
|
47
|
+
|
|
48
|
+
if (typeof self !== "undefined" && self.window) {
|
|
49
|
+
// broadcast update to window
|
|
50
|
+
// JsView Modified >>>
|
|
51
|
+
// 忽略盒子不支持的self.postMessage
|
|
52
|
+
// self.postMessage("webpackHotUpdate".concat(status.currentHash), "*");
|
|
53
|
+
self.postMessage?.("webpackHotUpdate".concat(status.currentHash), "*");
|
|
54
|
+
// JsView Modified <<<
|
|
55
|
+
}
|
|
56
|
+
} // allow refreshing the page only if liveReload isn't disabled
|
|
57
|
+
else if (liveReload && allowToLiveReload) {
|
|
58
|
+
var rootWindow = self; // use parent window for reload (in case we're in an iframe with no valid src)
|
|
59
|
+
|
|
60
|
+
var intervalId = self.setInterval(function () {
|
|
61
|
+
if (rootWindow.location.protocol !== "about:") {
|
|
62
|
+
// reload immediately if protocol is valid
|
|
63
|
+
applyReload(rootWindow, intervalId);
|
|
64
|
+
} else {
|
|
65
|
+
rootWindow = rootWindow.parent;
|
|
66
|
+
|
|
67
|
+
if (rootWindow.parent === rootWindow) {
|
|
68
|
+
// if parent equals current window we've reached the root which would continue forever, so trigger a reload anyways
|
|
69
|
+
applyReload(rootWindow, intervalId);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default reloadApp;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* global __resourceQuery WorkerGlobalScope */
|
|
2
|
+
// Send messages to the outside, so plugins can consume it.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {string} type
|
|
6
|
+
* @param {any} [data]
|
|
7
|
+
*/
|
|
8
|
+
function sendMsg(type, data) {
|
|
9
|
+
if (typeof self !== "undefined" && (typeof WorkerGlobalScope === "undefined" || !(self instanceof WorkerGlobalScope))) {
|
|
10
|
+
// JsView Modified >>>
|
|
11
|
+
// 忽略盒子不支持的self.postMessage
|
|
12
|
+
// self.postMessage({
|
|
13
|
+
self.postMessage?.({
|
|
14
|
+
// JsView Modified <<<
|
|
15
|
+
type: "webpack".concat(type),
|
|
16
|
+
data: data
|
|
17
|
+
}, "*");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default sendMsg;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "webpack-dev-server",
|
|
3
|
+
"version": "4.11.1",
|
|
4
|
+
"description": "Serves a webpack app. Updates the browser on changes.",
|
|
5
|
+
"bin": "bin/webpack-dev-server.js",
|
|
6
|
+
"main": "lib/Server.js",
|
|
7
|
+
"types": "types/lib/Server.d.ts",
|
|
8
|
+
"author": "Tobias Koppers @sokra",
|
|
9
|
+
"bugs": "https://github.com/webpack/webpack-dev-server/issues",
|
|
10
|
+
"homepage": "https://github.com/webpack/webpack-dev-server#readme",
|
|
11
|
+
"repository": "https://github.com/webpack/webpack-dev-server",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"funding": {
|
|
14
|
+
"type": "opencollective",
|
|
15
|
+
"url": "https://opencollective.com/webpack"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"bin",
|
|
19
|
+
"lib",
|
|
20
|
+
"client",
|
|
21
|
+
"types"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">= 12.13.0"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"fmt:check": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different",
|
|
28
|
+
"lint:js": "eslint . --cache",
|
|
29
|
+
"lint:types": "tsc --pretty --noEmit",
|
|
30
|
+
"lint": "npm-run-all -p \"fmt:**\" \"lint:**\"",
|
|
31
|
+
"fmt": "npm run fmt:check -- --write",
|
|
32
|
+
"fix:js": "npm run lint:js -- --fix",
|
|
33
|
+
"fix": "npm-run-all fix:js fmt",
|
|
34
|
+
"commitlint": "commitlint --from=master",
|
|
35
|
+
"build:client": "rimraf ./client/* && babel client-src/ --out-dir client/ --ignore \"client-src/webpack.config.js\" --ignore \"client-src/modules\" && webpack --config client-src/webpack.config.js",
|
|
36
|
+
"build:types": "rimraf ./types/* && tsc --declaration --emitDeclarationOnly --outDir types && node ./scripts/extend-webpack-types.js && prettier \"types/**/*.ts\" --write && prettier \"types/**/*.ts\" --write",
|
|
37
|
+
"build": "npm-run-all -p \"build:**\"",
|
|
38
|
+
"test:only": "jest",
|
|
39
|
+
"test:coverage": "npm run test:only -- --coverage",
|
|
40
|
+
"test:watch": "npm run test:coverage --watch",
|
|
41
|
+
"test": "npm run test:coverage",
|
|
42
|
+
"pretest": "npm run lint",
|
|
43
|
+
"prepare": "husky install && npm run build",
|
|
44
|
+
"release": "standard-version"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@types/bonjour": "^3.5.9",
|
|
48
|
+
"@types/connect-history-api-fallback": "^1.3.5",
|
|
49
|
+
"@types/express": "^4.17.13",
|
|
50
|
+
"@types/serve-index": "^1.9.1",
|
|
51
|
+
"@types/serve-static": "^1.13.10",
|
|
52
|
+
"@types/sockjs": "^0.3.33",
|
|
53
|
+
"@types/ws": "^8.5.1",
|
|
54
|
+
"ansi-html-community": "^0.0.8",
|
|
55
|
+
"bonjour-service": "^1.0.11",
|
|
56
|
+
"chokidar": "^3.5.3",
|
|
57
|
+
"colorette": "^2.0.10",
|
|
58
|
+
"compression": "^1.7.4",
|
|
59
|
+
"connect-history-api-fallback": "^2.0.0",
|
|
60
|
+
"default-gateway": "^6.0.3",
|
|
61
|
+
"express": "^4.17.3",
|
|
62
|
+
"graceful-fs": "^4.2.6",
|
|
63
|
+
"html-entities": "^2.3.2",
|
|
64
|
+
"http-proxy-middleware": "^2.0.3",
|
|
65
|
+
"ipaddr.js": "^2.0.1",
|
|
66
|
+
"open": "^8.0.9",
|
|
67
|
+
"p-retry": "^4.5.0",
|
|
68
|
+
"rimraf": "^3.0.2",
|
|
69
|
+
"schema-utils": "^4.0.0",
|
|
70
|
+
"selfsigned": "^2.1.1",
|
|
71
|
+
"serve-index": "^1.9.1",
|
|
72
|
+
"sockjs": "^0.3.24",
|
|
73
|
+
"spdy": "^4.0.2",
|
|
74
|
+
"webpack-dev-middleware": "^5.3.1",
|
|
75
|
+
"ws": "^8.4.2"
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@babel/cli": "^7.17.3",
|
|
79
|
+
"@babel/core": "^7.17.5",
|
|
80
|
+
"@babel/eslint-parser": "^7.17.0",
|
|
81
|
+
"@babel/plugin-transform-object-assign": "^7.14.5",
|
|
82
|
+
"@babel/plugin-transform-runtime": "^7.17.0",
|
|
83
|
+
"@babel/preset-env": "^7.16.11",
|
|
84
|
+
"@babel/runtime": "^7.17.2",
|
|
85
|
+
"@commitlint/cli": "^16.2.3",
|
|
86
|
+
"@commitlint/config-conventional": "^16.2.1",
|
|
87
|
+
"@types/compression": "^1.7.2",
|
|
88
|
+
"@types/default-gateway": "^3.0.1",
|
|
89
|
+
"@types/node-forge": "^1.0.4",
|
|
90
|
+
"@types/rimraf": "^3.0.2",
|
|
91
|
+
"@types/sockjs-client": "^1.5.1",
|
|
92
|
+
"@types/trusted-types": "^2.0.2",
|
|
93
|
+
"acorn": "^8.2.4",
|
|
94
|
+
"babel-jest": "^28.1.3",
|
|
95
|
+
"babel-loader": "^8.2.4",
|
|
96
|
+
"body-parser": "^1.19.2",
|
|
97
|
+
"core-js": "^3.21.1",
|
|
98
|
+
"css-loader": "^5.2.4",
|
|
99
|
+
"eslint": "^8.12.0",
|
|
100
|
+
"eslint-config-prettier": "^8.4.0",
|
|
101
|
+
"eslint-config-webpack": "^1.2.5",
|
|
102
|
+
"eslint-plugin-import": "^2.23.2",
|
|
103
|
+
"execa": "^5.1.1",
|
|
104
|
+
"file-loader": "^6.2.0",
|
|
105
|
+
"html-webpack-plugin": "^4.5.2",
|
|
106
|
+
"http-proxy": "^1.18.1",
|
|
107
|
+
"husky": "^7.0.0",
|
|
108
|
+
"jest": "^28.1.3",
|
|
109
|
+
"jest-environment-jsdom": "^28.1.3",
|
|
110
|
+
"klona": "^2.0.4",
|
|
111
|
+
"less": "^4.1.1",
|
|
112
|
+
"less-loader": "^7.3.0",
|
|
113
|
+
"lint-staged": "^12.3.4",
|
|
114
|
+
"marked": "^4.0.12",
|
|
115
|
+
"memfs": "^3.2.2",
|
|
116
|
+
"npm-run-all": "^4.1.5",
|
|
117
|
+
"prettier": "^2.6.1",
|
|
118
|
+
"puppeteer": "^13.4.1",
|
|
119
|
+
"require-from-string": "^2.0.2",
|
|
120
|
+
"rimraf": "^3.0.2",
|
|
121
|
+
"sockjs-client": "^1.6.1",
|
|
122
|
+
"standard-version": "^9.3.0",
|
|
123
|
+
"strip-ansi-v6": "npm:strip-ansi@^6.0.0",
|
|
124
|
+
"style-loader": "^2.0.0",
|
|
125
|
+
"supertest": "^6.1.3",
|
|
126
|
+
"tcp-port-used": "^1.0.2",
|
|
127
|
+
"typescript": "^4.7.2",
|
|
128
|
+
"url-loader": "^4.1.1",
|
|
129
|
+
"webpack": "^5.71.0",
|
|
130
|
+
"webpack-cli": "^4.7.2",
|
|
131
|
+
"webpack-merge": "^5.8.0"
|
|
132
|
+
},
|
|
133
|
+
"peerDependencies": {
|
|
134
|
+
"webpack": "^4.37.0 || ^5.0.0"
|
|
135
|
+
},
|
|
136
|
+
"peerDependenciesMeta": {
|
|
137
|
+
"webpack-cli": {
|
|
138
|
+
"optional": true
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
package/tools/jsview-common.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
const childProcess = require('child_process');
|
|
4
5
|
const fs = require('fs');
|
|
5
6
|
const path = require('path');
|
|
6
7
|
|
|
@@ -103,7 +104,7 @@ function parseArguments(requiredUsages = {},
|
|
|
103
104
|
}
|
|
104
105
|
if (key.startsWith('-') == false) {
|
|
105
106
|
if (withoutUnparsed) {
|
|
106
|
-
console.error('Failed to parse argument: ' + argu);
|
|
107
|
+
console.error('JsView Error: Failed to parse argument: ' + argu);
|
|
107
108
|
process.exit(1);
|
|
108
109
|
} else {
|
|
109
110
|
options.unparsed.push(key);
|
|
@@ -174,6 +175,7 @@ function getOptions(framework)
|
|
|
174
175
|
|
|
175
176
|
options.modulesDir = path.resolve(options.projectDir, 'node_modules');
|
|
176
177
|
options.jsviewDir = path.resolve(options.modulesDir, '@shijiu', 'jsview');
|
|
178
|
+
options.jsviewDomDir = path.resolve(options.jsviewDir, 'dom');
|
|
177
179
|
options.jsviewPatchesDir = path.resolve(options.jsviewDir, 'patches');
|
|
178
180
|
options.jsviewPatchModulesDir = path.resolve(options.jsviewPatchesDir, 'node_modules');
|
|
179
181
|
options.jsviewToolsDir = path.resolve(options.jsviewDir, 'tools');
|
|
@@ -203,7 +205,7 @@ function getPackageObject(modulePath)
|
|
|
203
205
|
{
|
|
204
206
|
const pkgFullFile = path.resolve(modulePath, 'package.json');
|
|
205
207
|
if (!fs.existsSync(pkgFullFile)) {
|
|
206
|
-
console.error('Error: Failed to get ' + modulePath + ', file is not exists.');
|
|
208
|
+
console.error('JsView Error: Failed to get ' + modulePath + ', file is not exists.');
|
|
207
209
|
process.exit(1);
|
|
208
210
|
}
|
|
209
211
|
const pkgObj = require(pkgFullFile);
|
|
@@ -211,54 +213,85 @@ function getPackageObject(modulePath)
|
|
|
211
213
|
return pkgObj;
|
|
212
214
|
}
|
|
213
215
|
|
|
214
|
-
function cpSync(workDir,
|
|
216
|
+
function cpSync(workDir, srcPath, destPath, ignore=[])
|
|
215
217
|
{
|
|
216
|
-
const exists = fs.existsSync(
|
|
217
|
-
const stats = exists && fs.statSync(
|
|
218
|
+
const exists = fs.existsSync(srcPath);
|
|
219
|
+
const stats = exists && fs.statSync(srcPath);
|
|
218
220
|
const isDirectory = exists && stats.isDirectory();
|
|
219
221
|
if (isDirectory) {
|
|
220
|
-
if (fs.existsSync(
|
|
221
|
-
fs.mkdirSync(
|
|
222
|
+
if (fs.existsSync(destPath) == false) {
|
|
223
|
+
fs.mkdirSync(destPath);
|
|
222
224
|
}
|
|
223
|
-
const childFileNames = fs.readdirSync(
|
|
225
|
+
const childFileNames = fs.readdirSync(srcPath);
|
|
224
226
|
for (const childName of childFileNames) {
|
|
225
227
|
cpSync(
|
|
226
228
|
workDir,
|
|
227
|
-
path.join(
|
|
228
|
-
path.join(
|
|
229
|
+
path.join(srcPath, childName),
|
|
230
|
+
path.join(destPath, childName),
|
|
229
231
|
ignore
|
|
230
232
|
);
|
|
231
233
|
};
|
|
232
234
|
} else {
|
|
233
|
-
const filename = path.basename(
|
|
235
|
+
const filename = path.basename(srcPath);
|
|
234
236
|
if (ignore && ignore.includes(filename)) {
|
|
235
237
|
return;
|
|
236
238
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
);
|
|
240
|
-
fs.copyFileSync(src, dest);
|
|
239
|
+
const desc = ' ' + path.relative(workDir, srcPath) + ' -> ' + path.relative(workDir, destPath);
|
|
240
|
+
console.info(desc);
|
|
241
|
+
fs.copyFileSync(srcPath, destPath);
|
|
241
242
|
}
|
|
242
243
|
}
|
|
243
244
|
|
|
244
|
-
function rmSync(
|
|
245
|
+
function rmSync(workDir, filePath)
|
|
245
246
|
{
|
|
246
|
-
|
|
247
|
+
const desc = ' -x ' + path.relative(workDir, filePath);
|
|
248
|
+
console.info(desc);
|
|
249
|
+
fs.rmSync(filePath, { recursive: true, force: true });
|
|
247
250
|
}
|
|
248
251
|
|
|
249
|
-
function symlinkSync(
|
|
252
|
+
function symlinkSync(workDir, targetPath, toPath)
|
|
250
253
|
{
|
|
251
|
-
rmSync(
|
|
254
|
+
fs.rmSync(toPath, { recursive: true });
|
|
252
255
|
|
|
253
|
-
const
|
|
256
|
+
const relativePath = path.relative(path.dirname(toPath), targetPath);
|
|
254
257
|
|
|
255
|
-
|
|
258
|
+
const desc = ' ' + path.relative(workDir, toPath) + ' -* ' + path.relative(workDir, relativePath);
|
|
259
|
+
console.info(desc);
|
|
260
|
+
fs.symlinkSync(relativePath, toPath, 'dir');
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function isSymlinkSync(filePath)
|
|
264
|
+
{
|
|
265
|
+
const stats = fs.lstatSync(filePath);
|
|
266
|
+
|
|
267
|
+
return stats.isSymbolicLink();
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function execCommand(cmdline, withOutput)
|
|
271
|
+
{
|
|
272
|
+
console.info('Run [' + cmdline + ']... ');
|
|
273
|
+
try {
|
|
274
|
+
const ret = childProcess.execSync(cmdline, { stdio: withOutput ? 'pipe' : 'inherit' });
|
|
275
|
+
if (ret) {
|
|
276
|
+
return ret.toString();
|
|
277
|
+
}
|
|
278
|
+
return null;
|
|
279
|
+
} catch (err) {
|
|
280
|
+
if (withOutput) {
|
|
281
|
+
return err.stderr?.toString()
|
|
282
|
+
} else {
|
|
283
|
+
console.log(err)
|
|
284
|
+
process.exit(err.status);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
256
287
|
}
|
|
257
288
|
|
|
258
289
|
module.exports = {
|
|
259
290
|
cpSync,
|
|
291
|
+
execCommand,
|
|
260
292
|
getOptions,
|
|
261
293
|
getPackageObject,
|
|
294
|
+
isSymlinkSync,
|
|
262
295
|
parseArguments,
|
|
263
296
|
rmSync,
|
|
264
297
|
symlinkSync,
|
|
@@ -12,24 +12,24 @@ async function prepareMainAppData(options, fileMd5)
|
|
|
12
12
|
// 加载私钥文件
|
|
13
13
|
const privateKeyFile = path.resolve(options.appConfigDir, 'app_sign_private_key.crt');
|
|
14
14
|
if (!fs.existsSync(privateKeyFile)) {
|
|
15
|
-
console.error('Failed to open private key file from ' + privateKeyFile);
|
|
15
|
+
console.error('JsView Error: Failed to open private key file from ' + privateKeyFile);
|
|
16
16
|
process.exit(1);
|
|
17
17
|
}
|
|
18
18
|
const privateKeyText = fs.readFileSync(privateKeyFile);
|
|
19
19
|
if (privateKeyText.indexOf('-----BEGIN PRIVATE KEY-----') < 0) {
|
|
20
|
-
console.error('Get private from src/appConfig/app_sign_private_key.crt failed.');
|
|
20
|
+
console.error('JsView Error: Get private from src/appConfig/app_sign_private_key.crt failed.');
|
|
21
21
|
process.exit(1);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// 加载公钥文件
|
|
25
25
|
const publicKeyFile = path.resolve(options.appConfigDir, 'app_sign_public_key.pem');
|
|
26
26
|
if (!fs.existsSync(publicKeyFile)) {
|
|
27
|
-
console.error('Failed to open public key file from ' + publicKeyFile);
|
|
27
|
+
console.error('JsView Error: Failed to open public key file from ' + publicKeyFile);
|
|
28
28
|
process.exit(1);
|
|
29
29
|
}
|
|
30
30
|
const publicKeyText = fs.readFileSync(publicKeyFile);
|
|
31
31
|
if (publicKeyText.indexOf('-----BEGIN PUBLIC KEY-----') < 0) {
|
|
32
|
-
console.error('Get private from src/appConfig/app_sign_public_key.pem failed.');
|
|
32
|
+
console.error('JsView Error: Get private from src/appConfig/app_sign_public_key.pem failed.');
|
|
33
33
|
process.exit(1);
|
|
34
34
|
}
|
|
35
35
|
// 公钥格式转化pem -> der,因为java中的解码处理只识别der格式
|
|
@@ -59,14 +59,14 @@ async function prepareMainAppData(options, fileMd5)
|
|
|
59
59
|
Buffer.from(encryptCodeBase64, 'base64')
|
|
60
60
|
).toString();
|
|
61
61
|
if (decryptCode !== fileMd5) {
|
|
62
|
-
console.error('Error: public key dismath to private key!');
|
|
62
|
+
console.error('JsView Error: public key dismath to private key!');
|
|
63
63
|
process.exit(1);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
// 获取AppData信息
|
|
67
67
|
const appConfigFile = path.resolve(options.appConfigDir, 'app.config.mjs');
|
|
68
68
|
if (!fs.existsSync(appConfigFile)) {
|
|
69
|
-
console.error('Failed to open app config file from ' + appConfigFile);
|
|
69
|
+
console.error('JsView Error: Failed to open app config file from ' + appConfigFile);
|
|
70
70
|
process.exit(1);
|
|
71
71
|
}
|
|
72
72
|
// const appConfigText = fs.readFileSync(appConfigFile);
|
|
@@ -139,8 +139,12 @@ function makeDebugMap(options)
|
|
|
139
139
|
{
|
|
140
140
|
fs.mkdirSync(options.distDebugMapDir, { recursive: true });
|
|
141
141
|
|
|
142
|
+
let jsEntryFilePath;
|
|
142
143
|
const jsFileNames = fs.readdirSync(options.distJsDir);
|
|
143
144
|
for(const fileName of jsFileNames) {
|
|
145
|
+
if (fileName.startsWith('main.jsv') && fileName.endsWith('.js')) {
|
|
146
|
+
jsEntryFilePath = path.resolve(options.distJsDir, fileName);
|
|
147
|
+
}
|
|
144
148
|
if (!fileName.endsWith('.map')) {
|
|
145
149
|
continue;
|
|
146
150
|
}
|
|
@@ -151,6 +155,12 @@ function makeDebugMap(options)
|
|
|
151
155
|
fs.renameSync(from, to);
|
|
152
156
|
};
|
|
153
157
|
|
|
158
|
+
if (jsEntryFilePath) {
|
|
159
|
+
const to = path.resolve(options.distJsDir, 'main.jsv.js');
|
|
160
|
+
console.log(' -> ' + path.relative(options.projectDir, to));
|
|
161
|
+
fs.copyFileSync(jsEntryFilePath, to);
|
|
162
|
+
}
|
|
163
|
+
|
|
154
164
|
const jsmapServeName = 'jsview-jsmap-serve.mjs';
|
|
155
165
|
const jsmapServePath = path.resolve(options.jsviewToolsDir, jsmapServeName);
|
|
156
166
|
if (!fs.existsSync(jsmapServePath)) {
|