@shijiu/jsview 2.1.482-test.0 → 2.2.128
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-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 +22 -1
- package/dom/bin/jsview-forge-define.min.js +1 -1
- package/dom/target_core_revision.mjs +5 -5
- package/package.json +1 -1
- package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +3 -1
- package/patches/node_modules/vite/dist/node/chunks/dep-ed9cb113.js +19 -0
- package/patches/node_modules/vite/dist/node/jsview-vite-extension.js +1 -0
- package/tools/{jsview-build-minmap.mjs → jsview-build-minify-exclude.mjs} +7 -11
- package/tools/jsview-post-build.mjs +22 -2
- package/tools/jsview-run-tool.mjs +18 -12
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* eslint-disable */ void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var e=window.Forge;class t{constructor(e,t){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!e)return;if(!0===e.startsWith("url")){let t=e.indexOf("(")+1,i=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,i).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:")||!0===e.startsWith("jsvtexturestore:"))return void(this.href=e);let i=e.indexOf("://");if(!(i<0||i>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=
|
|
1
|
+
/* eslint-disable */ void 0===window.Forge?(window.Forge={},console.log("Define forge browser")):console.log("Define using JsView forge engine-js");var e=window.Forge;class t{constructor(e,t){if(this.href="",this.origin="",this.protocol="",this.host="",this.hostname="",this.port="",this.pathname="",this.search="",this.hash="",!e)return;if(!0===e.startsWith("url")){let t=e.indexOf("(")+1,i=e.lastIndexOf(")");if("undefined"===(e=e.substring(t,i).trim())||"null"===e||0===e.length)return}if(!0===e.startsWith("data:")||!0===e.startsWith("jsvtexturestore:"))return void(this.href=e);let i=e.indexOf("://");if(!(i<0||i>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=window.location.origin+e;else if(!0===e.startsWith("./")&&void 0!==window.JsView&&void 0!==window.JsView.Dom.JsSubPath){if(void 0===window.JsView.Dom.MainPath||"undefined"===window.JsView.Dom.MainPathRef||window.JsView.Dom.MainPathRef!==window.location.href){window.JsView.Dom.JsSubPath.startsWith("/")||(window.JsView.Dom.JsSubPath="/"+window.JsView.Dom.JsSubPath),window.JsView.Dom.JsSubPath.endsWith("/")||(window.JsView.Dom.JsSubPath=window.JsView.Dom.JsSubPath+"/"),window.JsView.Dom.MainPathRef=window.location.href;let e=window.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.MainPath=window.location.origin+window.location.pathname.substring(0,e)}e=window.JsView.Dom.MainPath+e.substring(1)}if(this.href=e,!t)return;let o=this.href,n=o.indexOf("#");n>0&&(this.hash=o.substring(n),o=o.substring(0,n));let s=o.indexOf("?");s>1&&(this.search=o.substring(s),o=o.substring(0,s));let r=o,a=r.indexOf("://");this.protocol=a>0?r.substring(0,a+1):"";let h=a>1?r.substring(a+3):"";a=h.indexOf("/"),this.host=a>0?h.substring(0,a):"",this.pathname=a>=1?h.substring(a):"","file:"==this.protocol&&(this.host="",this.pathname=h),this.origin=this.protocol+"//"+this.host,a=this.host.indexOf(":"),this.hostname=a>0?this.host.substring(0,a):this.host,this.port=a>1?this.host.substring(a+1):""}replace(e){this.href=e}}class i{static SetBackgroundColor(t,i,o){const n=window.JsvCode.ForgeHandles.TextureManager.GetColorTextureCached(i);let s;o&&(s=new e.ViewRoundCornerMask(o.topLeft,o.topRight,o.bottomLeft,o.bottomRight));const r=new e.ExternalTextureSetting(n,s);t.ResetTexture(r)}static SetBackgroundImage(i,o,n,s,r,a,h){let w,d={};if("string"==typeof o){const e=new t(o);if(e instanceof t==!1)throw Error("Bad Argument.",e);d.url=e.href}else"linear-gradient"==o?.type&&(d.gradient=o);if(d.gradient)if(d.gradient.colors?.length>2){const e=d.gradient.colors,t=[e[0],e[e.length-1]],i=e.slice(1,e.length-1);w=window.JsvCode.ForgeHandles.TextureManager.CreateLinearGradientTexture(t,i)}else 2==d.gradient.colors?.length?w=window.JsvCode.ForgeHandles.TextureManager.CreateMiniGradientTexture(!0,d.gradient.colors[0],d.gradient.colors[1],d.gradient.rawValue):console.warn("Failed to create backgroundImage gradient, bad colors.",d.gradient.colors);else d.url&&(w=d.url.includes(".gif")||d.url.includes(".webp")?window.JsvCode.ForgeHandles.TextureManager.GetGifImage(d.url,!1,null,h):window.JsvCode.ForgeHandles.TextureManager.GetImage2(d.url,!1,r,a||e.ColorSpace.RGBA_8888));if(w){let t;n&&(t=new e.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const o=new e.ExternalTextureSetting(w,t);if(i.ResetTexture(o),s){let e=w.RegisterLoadImageCallback(null,(function(){s({width:w.Width,height:w.Height})}));i.RegisterDetachCallback((()=>{w.UnregisterLoadImageCallback(e)}))}}}static SetMaskedBackgroundImage(i,o,n,s){if("string"==typeof o&&(o=new t(o)),o instanceof t==!1)throw Error("Bad Argument.",o);if("string"==typeof n&&(n=new t(n)),n instanceof t==!1)throw Error("Bad Argument(MaskURL).",n);const r=window.JsvCode.ForgeHandles.TextureManager.GetImage2(o.href,!1,null,s||e.ColorSpace.RGBA_8888);if(r){const t=window.JsvCode.ForgeHandles.TextureManager.GetImage2(n.href,!1,null,e.ColorSpace.RGBA_8888),o=new e.ExternalTextureSetting(r,new e.ViewTextureMask(t));i.ResetTexture(o)}}}export{e as Forge,i as ForgeExtension};
|
|
2
2
|
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
const TargetRevision = {
|
|
6
|
-
"CoreRevision":
|
|
7
|
-
"CoreRevisionAndBranch": "
|
|
8
|
-
"JseRevision": "1.0.
|
|
6
|
+
"CoreRevision": 1021792,
|
|
7
|
+
"CoreRevisionAndBranch": "1021792",
|
|
8
|
+
"JseRevision": "1.0.960",
|
|
9
9
|
"JseUrl":
|
|
10
|
-
"http://cdn.release.qcast.cn/forge_js/master/
|
|
11
|
-
"JseName": "
|
|
10
|
+
"http://cdn.release.qcast.cn/forge_js/master/JsViewES6_js2c_r960.jsv.8e87b175.js",
|
|
11
|
+
"JseName": "JsViewES6_js2c_r960.jsv.8e87b175.js",
|
|
12
12
|
"JsidtName": "libjsidt.102.7.so",
|
|
13
13
|
};
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -5167,7 +5167,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5167
5167
|
// 有按键打断, 取消patch
|
|
5168
5168
|
if (n1 == null && n2) {
|
|
5169
5169
|
if (n2.key == "__QcodeJsviewMetroWidgetSlot"
|
|
5170
|
-
&& (jsvPendingForFirstDelayRender
|
|
5170
|
+
&& (jsvPendingForFirstDelayRender
|
|
5171
|
+
|| window.JsvCode.Dom.GetLazyTaskAmount() > 1200 // 1200个同步单位时间 = 60ms(每个相当于50us)
|
|
5172
|
+
|| window.JsView?.hasPendingUserInput?.())
|
|
5171
5173
|
&& JsvRenderCount >= (window.JsView?.getInstantRenderNum?.() ?? 0)) {
|
|
5172
5174
|
// 创建Comment节点, 以解决el释放可能出错问题
|
|
5173
5175
|
// 同时存储el以便给父节点进行属性链接
|
|
@@ -13543,6 +13543,17 @@ const buildEsbuildPlugin = (config) => {
|
|
|
13543
13543
|
if (!options) {
|
|
13544
13544
|
return null;
|
|
13545
13545
|
}
|
|
13546
|
+
|
|
13547
|
+
// JsView Added >>>
|
|
13548
|
+
// Minify文件过滤
|
|
13549
|
+
if(options.minify && tsconfckParseOptions.jsvMinifyExclude) {
|
|
13550
|
+
const regex = new RegExp(tsconfckParseOptions.jsvMinifyExclude.trim() );
|
|
13551
|
+
if(regex.test(chunk.name)) {
|
|
13552
|
+
options.minify = false;
|
|
13553
|
+
}
|
|
13554
|
+
}
|
|
13555
|
+
// JsView Added <<<
|
|
13556
|
+
|
|
13546
13557
|
const res = await transformWithEsbuild(code, chunk.fileName, options);
|
|
13547
13558
|
if (config.build.lib) {
|
|
13548
13559
|
// #7188, esbuild adds helpers out of the UMD and IIFE wrappers, and the
|
|
@@ -13664,6 +13675,10 @@ const tsconfckParseOptions = {
|
|
|
13664
13675
|
tsConfigPaths: undefined,
|
|
13665
13676
|
root: undefined,
|
|
13666
13677
|
resolveWithEmptyIfConfigNotFound: true,
|
|
13678
|
+
// JsView Added >>>
|
|
13679
|
+
// Minify文件过滤
|
|
13680
|
+
jsvMinifyExclude: undefined,
|
|
13681
|
+
// JsView Added <<<
|
|
13667
13682
|
};
|
|
13668
13683
|
async function initTSConfck(config) {
|
|
13669
13684
|
const workspaceRoot = searchForWorkspaceRoot(config.root);
|
|
@@ -13675,6 +13690,10 @@ async function initTSConfck(config) {
|
|
|
13675
13690
|
skip: (dir) => dir === 'node_modules' || dir === '.git',
|
|
13676
13691
|
})),
|
|
13677
13692
|
]);
|
|
13693
|
+
// JsView Added >>>
|
|
13694
|
+
// Minify文件过滤
|
|
13695
|
+
tsconfckParseOptions.jsvMinifyExclude = config.build.jsvMinifyExclude;
|
|
13696
|
+
// JsView Added <<<
|
|
13678
13697
|
debug$f(`init tsconfck end`);
|
|
13679
13698
|
}
|
|
13680
13699
|
async function loadTsconfigJsonForFile(filename) {
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
import fs from 'node:fs';
|
|
5
|
-
import path from 'node:path';
|
|
6
4
|
import {
|
|
7
5
|
checkNodeVersion,
|
|
8
6
|
execCommand,
|
|
9
7
|
getOptions,
|
|
10
8
|
parseArguments,
|
|
11
|
-
rmSync,
|
|
12
9
|
Logger,
|
|
13
10
|
} from './jsview-common.mjs';
|
|
14
11
|
|
|
@@ -18,20 +15,18 @@ async function main(argv)
|
|
|
18
15
|
|
|
19
16
|
const options = getOptions();
|
|
20
17
|
|
|
21
|
-
const filter = argv.filter ?? '
|
|
22
|
-
const
|
|
18
|
+
const filter = argv.filter ?? 'jsview-';
|
|
19
|
+
const script = argv.script ?? 'build';
|
|
23
20
|
|
|
24
21
|
var exportPrefix = 'export';
|
|
25
22
|
if(process.platform == 'win32') {
|
|
26
23
|
exportPrefix = 'set'
|
|
27
24
|
}
|
|
28
|
-
execCommand(exportPrefix + ' JSVIEW_KEEP_CHUNKNAME=true && npm run build');
|
|
29
25
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
26
|
+
const cmdline = exportPrefix + ' JSVIEW_MINIFY_EXCLUDE=' + filter + ' && '
|
|
27
|
+
+ exportPrefix + ' JSVIEW_KEEP_CHUNKNAME=true' + ' && '
|
|
28
|
+
+ 'npm run ' + script;
|
|
29
|
+
execCommand(cmdline);
|
|
35
30
|
|
|
36
31
|
Logger.Info('Done...');
|
|
37
32
|
}
|
|
@@ -40,6 +35,7 @@ const requiredUsages = {
|
|
|
40
35
|
};
|
|
41
36
|
const optionalUsages = {
|
|
42
37
|
'--filter': "Filter condition, it's a regex.",
|
|
38
|
+
'--script': "Build script, like: build.",
|
|
43
39
|
};
|
|
44
40
|
const argv = parseArguments(requiredUsages, optionalUsages);
|
|
45
41
|
main(argv);
|
|
@@ -82,9 +82,29 @@ async function prepareMainAppData(options, fileMd5)
|
|
|
82
82
|
const appConfigFileUrl = url.pathToFileURL(appConfigFilePath);
|
|
83
83
|
const { default: appConfig } = await import(appConfigFileUrl);
|
|
84
84
|
|
|
85
|
+
// 获取 chunk.jsv的map
|
|
86
|
+
const chunkHash = {};
|
|
87
|
+
const jsFileNames = fs.readdirSync(options.distJsDir);
|
|
88
|
+
for(const fileName of jsFileNames) {
|
|
89
|
+
if (!fileName.startsWith('chunk.jsv') || !fileName.endsWith('.js')) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const hash = fileName.replace(/.*chunk\.jsv.([a-fA-F0-9].*).js/, '$1');
|
|
94
|
+
|
|
95
|
+
const filePath = path.resolve(options.distJsDir, fileName);
|
|
96
|
+
const sourceContent = fs.readFileSync(filePath, 'utf8');
|
|
97
|
+
const md5 = sourceContent.replace(/\n/g, '').replace(/.*\/\*jsvmd5:([a-fA-F0-9]{8})[a-fA-F0-9]*\*\/.*/, '$1');
|
|
98
|
+
|
|
99
|
+
chunkHash[hash] = md5;
|
|
100
|
+
}
|
|
101
|
+
|
|
85
102
|
// 组装AppData
|
|
86
103
|
appConfig.PublicKeys = [publicKeyDerText]; // 使用签名数组,支持后续追加签名
|
|
87
104
|
appConfig.EncryptCodes = [encryptCodeBase64]; // 同样使用数组,支持后续追加
|
|
105
|
+
appConfig.ChunkHash = chunkHash;
|
|
106
|
+
|
|
107
|
+
|
|
88
108
|
|
|
89
109
|
return JSON.stringify(appConfig);
|
|
90
110
|
}
|
|
@@ -182,8 +202,8 @@ function makeMainJsvMjs(options, framework)
|
|
|
182
202
|
};
|
|
183
203
|
|
|
184
204
|
const sourceContent = fs.readFileSync(jsEntryFilePath, 'utf8');
|
|
185
|
-
const
|
|
186
|
-
const newEntryFileName = `main.jsv.${
|
|
205
|
+
const md5 = sourceContent.replace(/\n/g, '').replace(/.*\/\*jsvmd5:([a-fA-F0-9]{8})[a-fA-F0-9]*\*\/.*/, '$1');
|
|
206
|
+
const newEntryFileName = `main.jsv.${md5}.js`;
|
|
187
207
|
const newEntryFilePath = path.resolve(path.dirname(jsEntryFilePath), newEntryFileName);
|
|
188
208
|
Logger.Info(' -> ' + path.relative(options.projectDir, newEntryFilePath));
|
|
189
209
|
fs.renameSync(jsEntryFilePath, newEntryFilePath);
|
|
@@ -25,7 +25,7 @@ async function getExtraOptions(argv)
|
|
|
25
25
|
commandCount += (argv.configApp ? 1 : 0);
|
|
26
26
|
commandCount += (argv.genKeypair ? 1 : 0);
|
|
27
27
|
commandCount += (argv.runonAndroid ? 1 : 0);
|
|
28
|
-
commandCount += (argv.
|
|
28
|
+
commandCount += (argv.buildMinifyExclude ? 1 : 0);
|
|
29
29
|
commandCount += (argv.buildZip ? 1 : 0);
|
|
30
30
|
commandCount += (argv.moduleFederation ? 1 : 0);
|
|
31
31
|
commandCount += (argv.vueDevtools ? 1 : 0);
|
|
@@ -39,7 +39,7 @@ async function getExtraOptions(argv)
|
|
|
39
39
|
'runonAndroid',
|
|
40
40
|
'configApp',
|
|
41
41
|
'genKeypair',
|
|
42
|
-
'
|
|
42
|
+
'buildMinifyExclude',
|
|
43
43
|
'buildZip',
|
|
44
44
|
'vueDevtools',
|
|
45
45
|
'moduleFederation',
|
|
@@ -61,7 +61,7 @@ async function getExtraOptions(argv)
|
|
|
61
61
|
options.runonAndroid = argv.runonAndroid;
|
|
62
62
|
options.configApp = argv.configApp;
|
|
63
63
|
options.genKeypair = argv.genKeypair;
|
|
64
|
-
options.
|
|
64
|
+
options.buildMinifyExclude = argv.buildMinifyExclude;
|
|
65
65
|
options.buildZip = argv.buildZip;
|
|
66
66
|
options.vueDevtools = argv.vueDevtools;
|
|
67
67
|
options.moduleFederation = argv.moduleFederation;
|
|
@@ -72,7 +72,7 @@ async function getExtraOptions(argv)
|
|
|
72
72
|
return options;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
function doCommand(options) {
|
|
75
|
+
function doCommand(options, argv) {
|
|
76
76
|
let command;
|
|
77
77
|
if(options.runonAndroid) {
|
|
78
78
|
command = 'node node_modules/@shijiu/jsview/tools/jsview-run-android.mjs --framework=vue';
|
|
@@ -89,14 +89,20 @@ function doCommand(options) {
|
|
|
89
89
|
command = 'node node_modules/@shijiu/jsview/tools/jsview-config-app.mjs --app-name=' + appName + ' --app-title=' + appTitle;
|
|
90
90
|
} else if(options.genKeypair) {
|
|
91
91
|
command = 'node node_modules/@shijiu/jsview/tools/jsview-generate-keypair.mjs';
|
|
92
|
-
} else if(options.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
Logger.Warn('
|
|
92
|
+
} else if(options.buildMinifyExclude) {
|
|
93
|
+
let filter = options.buildMinifyExclude;
|
|
94
|
+
if(typeof(filter) !== 'string') {
|
|
95
|
+
filter = 'jsview-';
|
|
96
|
+
Logger.Warn('Minify filter is not set, use default value: ' + filter);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
let script = argv.s ?? argv.script;
|
|
100
|
+
if(typeof(script) !== 'string') {
|
|
101
|
+
script = 'build';
|
|
102
|
+
Logger.Warn('Build script is not set, use default value: ' + script);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
command = 'node node_modules/@shijiu/jsview/tools/jsview-build-minify-exclude.mjs --filter=' + filter + ' --script=' + script;
|
|
100
106
|
} else if(options.buildZip) {
|
|
101
107
|
const defaultPassword = 'jsview.shijiu.com';
|
|
102
108
|
const password = (typeof(options.buildZip) === 'string' ? options.buildZip : defaultPassword);
|
|
@@ -129,7 +135,7 @@ async function main(argv)
|
|
|
129
135
|
|
|
130
136
|
const options = await getExtraOptions(argv);
|
|
131
137
|
|
|
132
|
-
doCommand(options);
|
|
138
|
+
doCommand(options, argv);
|
|
133
139
|
}
|
|
134
140
|
|
|
135
141
|
const requiredUsages = {
|
|
@@ -139,7 +145,7 @@ const optionalUsages = {
|
|
|
139
145
|
'-a | --runon-android': 'Run app on android devices.',
|
|
140
146
|
'-c | --config-app': 'Config app, like: -c or --config-app=[AppName:AppTitle].',
|
|
141
147
|
'-g | --gen-keypair': 'Generate sign keypair.',
|
|
142
|
-
'-m | --build-
|
|
148
|
+
'-m | --build-minify-exclude': 'Build target with minify-exclude filter, like: -m or --build-minify-exclude=[filter], additional options: -s or --script=build:dev.',
|
|
143
149
|
'-z | --build-zip': 'Build target to offline zip package, like: -z or --build-zip=[password].',
|
|
144
150
|
'-d | --vue-devtools': 'Start vue dev server and vue-devtools standalone, like: -d or --vue-devtools=[port].',
|
|
145
151
|
'-f | --module-federation': 'Make project to module federation, use --module-federation --help for details.',
|