@shijiu/jsview 2.0.1002 → 2.0.1045-next-vue.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/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 -1
- package/dom/bin/jsview-forge-define.min.js +1 -1
- package/dom/target_core_revision.mjs +4 -6
- package/loader/jsview-loader.js +1 -11
- package/loader/jsview-main.mjs +6 -6
- package/package.json +1 -1
- package/tools/jsview-batch-upgrade.mjs +83 -106
- package/tools/jsview-common.mjs +13 -0
|
@@ -1 +1 @@
|
|
|
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(!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:"))return void(this.href=e);let i=e.indexOf("://");if(!(i<0||i>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.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!==document.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=document.location.href;let e=document.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.MainPath=document.location.origin+document.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
|
|
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(!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:"))return void(this.href=e);let i=e.indexOf("://");if(!(i<0||i>10)||e.startsWith("./")||e.startsWith("/")||(e="./"+e),!0===e.startsWith("/"))e=document.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!==document.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=document.location.href;let e=document.location.pathname.lastIndexOf(window.JsView.Dom.JsSubPath);window.JsView.Dom.MainPath=document.location.origin+document.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 d=a>1?r.substring(a+3):"";a=d.indexOf("/"),this.host=a>0?d.substring(0,a):"",this.pathname=a>=1?d.substring(a):"","file:"==this.protocol&&(this.host="",this.pathname=d),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}href="";origin="";protocol="";host="";hostname="";port="";pathname="";search="";hash=""}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,d){let h,l={};if("string"==typeof o){const e=new t(o);if(e instanceof t==!1)throw Error("Bad Argument.",e);l.url=e.href}else"linear-gradient"==o?.type&&(l.gradient=o);if(l.gradient)if(l.gradient.colors?.length>2){const e=l.gradient.colors,t=[e[0],e[e.length-1]],i=e.slice(1,e.length-1);h=window.JsvCode.ForgeHandles.TextureManager.CreateLinearGradientTexture(t,i)}else 2==l.gradient.colors?.length?h=window.JsvCode.ForgeHandles.TextureManager.CreateMiniGradientTexture(!0,l.gradient.colors[0],l.gradient.colors[1],l.gradient.rawValue):console.warn("Failed to create backgroundImage gradient, bad colors.",l.gradient.colors);else l.url&&(h=l.url.includes(".gif")||l.url.includes(".webp")?window.JsvCode.ForgeHandles.TextureManager.GetGifImage(l.url,!1,null,d):window.JsvCode.ForgeHandles.TextureManager.GetImage2(l.url,!1,r,a||e.ColorSpace.RGBA_8888));if(h){let t;n&&(t=new e.ViewRoundCornerMask(n.topLeft,n.topRight,n.bottomLeft,n.bottomRight));const o=new e.ExternalTextureSetting(h,t);if(i.ResetTexture(o),s){let e=h.RegisterLoadImageCallback(null,(function(){s({width:h.Width,height:h.Height})}));i.RegisterDetachCallback((()=>{h.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};
|
|
@@ -3,17 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
const TargetRevision = {
|
|
6
|
-
"CoreRevision":
|
|
7
|
-
"CoreRevisionAndBranch": "
|
|
8
|
-
"JseRevision": "1.0.
|
|
6
|
+
"CoreRevision": 1021348,
|
|
7
|
+
"CoreRevisionAndBranch": "1021348",
|
|
8
|
+
"JseRevision": "1.0.884",
|
|
9
9
|
"JseUrl":
|
|
10
|
-
"http://cdn.release.qcast.cn/forge_js/master/
|
|
10
|
+
"http://cdn.release.qcast.cn/forge_js/master/JsViewES6_js2c_r884.jsv.e3645d6b.js"
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
// 版本是否存在测试方法
|
|
14
14
|
// 启动参数的UpdateUrl + CoreRevisionAndBranch
|
|
15
15
|
// 例如: https://launcher.cluster.qcast.cn/jsview/version/1021047_release_build_js2c
|
|
16
16
|
|
|
17
|
-
// 不要用export default,update-env脚本不能解析
|
|
18
|
-
// module.exports = TargetRevision;
|
|
19
17
|
export default TargetRevision;
|
package/loader/jsview-loader.js
CHANGED
|
@@ -83,7 +83,7 @@ export default class JsViewLoader {
|
|
|
83
83
|
window.JsView.addKeysMap(this.#config.vendorConfig.bindKeys);
|
|
84
84
|
|
|
85
85
|
// (可选配置)localStorage支持
|
|
86
|
-
window.JsView.setStorageDomain(appName); // Domain为app包名
|
|
86
|
+
window.JsView.setStorageDomain(this.#config.jsviewConfig.localStorage.domain??appName); // Domain为app包名
|
|
87
87
|
|
|
88
88
|
const localStorageKeys = this.#config.jsviewConfig.localStorage.presetKeys;
|
|
89
89
|
window.JsView.enableStorageNames(...localStorageKeys);
|
|
@@ -147,16 +147,6 @@ export default class JsViewLoader {
|
|
|
147
147
|
console.error("JsView Error: Load designed map failed");
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
// 设置播放器的屏幕坐标尺寸
|
|
151
|
-
if (window.JsView) {
|
|
152
|
-
window.JsView.setVideoDesignMapWidth?.(designMap.width);
|
|
153
|
-
} else {
|
|
154
|
-
// 借助Audio标签设置基类BaseMedia的屏幕尺寸配置,绕开react的unref语法检测
|
|
155
|
-
if (Audio.setDesignMapWidth) {
|
|
156
|
-
Audio.setDesignMapWidth(designMap.width);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
150
|
return designMap;
|
|
161
151
|
}
|
|
162
152
|
|
package/loader/jsview-main.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import AppData from '/src/appConfig/app.config.mjs'
|
|
2
|
-
import JsViewVendorConfig from "/src/appConfig/jsview.config.mjs"
|
|
3
|
-
|
|
4
1
|
async function main() {
|
|
2
|
+
const { default: appConfig } = await import("/src/appConfig/app.config.mjs");
|
|
3
|
+
const { default: jsviewVendorConfig } = await import("/src/appConfig/jsview.config.mjs");
|
|
4
|
+
|
|
5
5
|
let JsViewLoader = null;
|
|
6
6
|
// 根据JsViewConfig, 判断厂商是否设置了使用远程loader启动
|
|
7
|
-
const remoteLoader =
|
|
7
|
+
const remoteLoader = jsviewVendorConfig.jsviewConfig.remoteLoader;
|
|
8
8
|
if (remoteLoader) {
|
|
9
9
|
JsViewLoader = (await import(remoteLoader)).default;
|
|
10
10
|
} else {
|
|
@@ -13,7 +13,7 @@ async function main() {
|
|
|
13
13
|
const jsviewLoader = new JsViewLoader();
|
|
14
14
|
|
|
15
15
|
// 使用vendor配置值覆盖默认配置。
|
|
16
|
-
const config = jsviewLoader.mergeConfig(
|
|
16
|
+
const config = jsviewLoader.mergeConfig(jsviewVendorConfig);
|
|
17
17
|
console.log("JsView config: " + JSON.stringify(config));
|
|
18
18
|
|
|
19
19
|
jsviewLoader.initForgeEnv();
|
|
@@ -23,7 +23,7 @@ async function main() {
|
|
|
23
23
|
// JsView环境加载完毕后,加载vue/react的main.js文件。
|
|
24
24
|
import('/src/main.tsx');
|
|
25
25
|
};
|
|
26
|
-
jsviewLoader.initJsViewEnv(
|
|
26
|
+
jsviewLoader.initJsViewEnv(appConfig.AppName, onInitJsViewEnv);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// webpack/vite运行入口
|
package/package.json
CHANGED
|
@@ -17,48 +17,43 @@ function main(argv)
|
|
|
17
17
|
const options = getOptions(argv);
|
|
18
18
|
|
|
19
19
|
// Stage 1
|
|
20
|
+
if (options.stages.includes(options.stageAppConfig)) {
|
|
21
|
+
upgradeStageAppConfig(options);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Stage 2
|
|
20
25
|
if (options.stages.includes(options.stageAlias)) {
|
|
21
26
|
upgradeStageAlias(options);
|
|
22
27
|
}
|
|
23
28
|
|
|
24
|
-
// Stage
|
|
29
|
+
// Stage 3
|
|
25
30
|
if (options.stages.includes(options.stageImportPostfix)) {
|
|
26
31
|
upgradeStageImportPostfix(options);
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
// Stage
|
|
34
|
+
// Stage 4
|
|
30
35
|
if (options.stages.includes(options.stageCommonJS)) {
|
|
31
36
|
upgradeStageCommonJS(options);
|
|
32
37
|
}
|
|
33
38
|
|
|
34
|
-
// Stage
|
|
39
|
+
// Stage 5
|
|
35
40
|
if (options.stages.includes(options.stageHashHistory)) {
|
|
36
41
|
upgradeStageHashHistory(options);
|
|
37
42
|
}
|
|
38
43
|
|
|
39
|
-
// Stage
|
|
44
|
+
// Stage 6
|
|
40
45
|
if (options.stages.includes(options.stageAnimation)) {
|
|
41
46
|
upgradeStageAnimation(options);
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
// Stage 6
|
|
45
|
-
if (options.stages.includes(options.stagePixels)) {
|
|
46
|
-
upgradeStagePixel(options);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
49
|
// Stage 7
|
|
50
|
-
if (options.stages.includes(options.
|
|
51
|
-
|
|
50
|
+
if (options.stages.includes(options.stageJsvAudio)) {
|
|
51
|
+
upgradeStageJsvAudio(options);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
// Stage 8
|
|
55
|
-
if (options.stages.includes(options.
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Stage 9
|
|
60
|
-
if (options.stages.includes(options.stageMainEntry)) {
|
|
61
|
-
upgradeStageMainEntry(options);
|
|
55
|
+
if (options.stages.includes(options.stagePixels)) {
|
|
56
|
+
upgradeStagePixel(options);
|
|
62
57
|
}
|
|
63
58
|
} catch (ex) {
|
|
64
59
|
console.error('JsView Error: Failed to update jsview source!');
|
|
@@ -72,15 +67,14 @@ function main(argv)
|
|
|
72
67
|
function getOptions(argv)
|
|
73
68
|
{
|
|
74
69
|
const options = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
stageMainEntry: '9',
|
|
70
|
+
stageAppConfig: '1',
|
|
71
|
+
stageAlias: '2',
|
|
72
|
+
stageImportPostfix: '3',
|
|
73
|
+
stageCommonJS: '4',
|
|
74
|
+
stageHashHistory: '5',
|
|
75
|
+
stageAnimation: '6',
|
|
76
|
+
stageJsvAudio: '7',
|
|
77
|
+
stagePixels: '8',
|
|
84
78
|
};
|
|
85
79
|
|
|
86
80
|
options.projectDir = process.cwd();
|
|
@@ -115,6 +109,29 @@ function getOptions(argv)
|
|
|
115
109
|
return options;
|
|
116
110
|
}
|
|
117
111
|
|
|
112
|
+
function upgradeStageAppConfig(options)
|
|
113
|
+
{
|
|
114
|
+
const msgPrefix = 'Stage ' + options.stageAppConfig;
|
|
115
|
+
console.info(msgPrefix + ': Upgrading appConfig...');
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
const appConfigDir = path.resolve(options.upgradeDir, 'appConfig');
|
|
119
|
+
if (fs.existsSync(appConfigDir) == false) {
|
|
120
|
+
console.error(msgPrefix + ': Failed to upgrading appConfig, appConfig folder is not found.');
|
|
121
|
+
process.exit(1);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const appConfigFilePath = path.resolve(appConfigDir, 'app_config.json');
|
|
125
|
+
|
|
126
|
+
renameStageFile(options, [ appConfigFilePath ], msgPrefix,
|
|
127
|
+
[ 'app_config.json' ], 'app.config.mjs');
|
|
128
|
+
|
|
129
|
+
renameStageFile(options, [ appConfigFilePath ], msgPrefix,
|
|
130
|
+
[ 'jsview.config.js' ], 'jsview.config.mjs');
|
|
131
|
+
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
118
135
|
function upgradeStageAlias(options)
|
|
119
136
|
{
|
|
120
137
|
const msgPrefix = 'Stage ' + options.stageAlias;
|
|
@@ -271,8 +288,6 @@ function upgradeStagePixel(options) {
|
|
|
271
288
|
'top',
|
|
272
289
|
'width',
|
|
273
290
|
|
|
274
|
-
'borderRadius',
|
|
275
|
-
|
|
276
291
|
'fontSize',
|
|
277
292
|
'lineHeight',
|
|
278
293
|
];
|
|
@@ -288,59 +303,19 @@ function upgradeStagePixel(options) {
|
|
|
288
303
|
return;
|
|
289
304
|
}
|
|
290
305
|
|
|
291
|
-
function
|
|
306
|
+
function upgradeStageJsvAudio(options)
|
|
292
307
|
{
|
|
293
|
-
const msgPrefix = 'Stage ' + options.
|
|
294
|
-
console.info(msgPrefix + ': Upgrading
|
|
308
|
+
const msgPrefix = 'Stage ' + options.stageJsvAudio;
|
|
309
|
+
console.info(msgPrefix + ': Upgrading jsv audio...');
|
|
295
310
|
|
|
296
|
-
|
|
297
|
-
|
|
311
|
+
const amendJsvAudio = function(content) {
|
|
312
|
+
let fixedContent = content.replace('<audiotrack', '<jsv-audiotrack');
|
|
313
|
+
fixedContent = fixedContent.replace(/import *JsvAudio *from.*/, "import { JsvAudio } from 'jsview'");
|
|
298
314
|
|
|
299
|
-
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
function upgradeStageAppConfig(options)
|
|
303
|
-
{
|
|
304
|
-
const msgPrefix = 'Stage ' + options.stageAppConfig;
|
|
305
|
-
console.info(msgPrefix + ': Upgrading appConfig...');
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
const appConfigDir = path.resolve(options.upgradeDir, 'appConfig');
|
|
309
|
-
if (fs.existsSync(appConfigDir) == false) {
|
|
310
|
-
console.error(msgPrefix + ': Failed to upgrading appConfig, appConfig folder is not found.');
|
|
311
|
-
process.exit(1);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
const appConfigFilePath = path.resolve(appConfigDir, 'app_config.json');
|
|
315
|
-
|
|
316
|
-
removeStageFile(options, [ appConfigFilePath ], msgPrefix,
|
|
317
|
-
[ 'app_config.json' ], 'app.config.json');
|
|
318
|
-
|
|
319
|
-
const sourcePathList = getFilesRecursive(appConfigDir);
|
|
320
|
-
|
|
321
|
-
removeStageFile(options, sourcePathList, msgPrefix,
|
|
322
|
-
[ '.js', '.json' ], '.mjs');
|
|
323
|
-
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
function upgradeStageMainEntry(options)
|
|
328
|
-
{
|
|
329
|
-
const msgPrefix = 'Stage ' + options.stageMainEntry;
|
|
330
|
-
console.info(msgPrefix + ': Upgrading main entry...');
|
|
331
|
-
|
|
332
|
-
const mainEntryFilePath = path.resolve(options.upgradeDir, 'main.ts');
|
|
333
|
-
const fixedMainEntryFilePath = path.resolve(options.upgradeDir, 'main.tsx');
|
|
334
|
-
if (fs.existsSync(mainEntryFilePath) == false) {
|
|
335
|
-
if (fs.existsSync(fixedMainEntryFilePath)) {
|
|
336
|
-
return 0;
|
|
337
|
-
}
|
|
338
|
-
console.error(msgPrefix + ': Failed to upgrading main entry, main.ts is not found.');
|
|
339
|
-
process.exit(1);
|
|
315
|
+
return fixedContent;
|
|
340
316
|
}
|
|
341
317
|
|
|
342
|
-
|
|
343
|
-
[ 'main.ts' ], 'main.tsx');
|
|
318
|
+
processSourceLineByLine(options, options.sourcePathList, msgPrefix, amendJsvAudio);
|
|
344
319
|
|
|
345
320
|
return;
|
|
346
321
|
}
|
|
@@ -426,7 +401,7 @@ function replaceStageContent(options, sourcePathList, msgPrefix,
|
|
|
426
401
|
return;
|
|
427
402
|
}
|
|
428
403
|
|
|
429
|
-
function
|
|
404
|
+
function renameStageFile(options, sourcePathList, msgPrefix,
|
|
430
405
|
fromExtNameList, toExtName)
|
|
431
406
|
{
|
|
432
407
|
for (const filePath of sourcePathList) {
|
|
@@ -445,13 +420,13 @@ function removeStageFile(options, sourcePathList, msgPrefix,
|
|
|
445
420
|
fs.renameSync(filePath, toFilePath)
|
|
446
421
|
|
|
447
422
|
// json => mjs
|
|
448
|
-
if (fromExtName
|
|
423
|
+
if (fromExtName.endsWith('.json')) {
|
|
449
424
|
const content = fs.readFileSync(toFilePath, 'utf8');
|
|
450
|
-
const fixedContent = 'export default ' + content;
|
|
425
|
+
const fixedContent = 'export default ' + content.replaceAll(/"([^"]+)":/g, '$1:');
|
|
451
426
|
fs.writeFileSync(toFilePath, fixedContent, 'utf8');
|
|
452
427
|
}
|
|
453
428
|
|
|
454
|
-
console.info(msgPrefix + ': Upgraded ' + path.relative(options.projectDir, filePath));
|
|
429
|
+
console.info(msgPrefix + ': Upgraded ' + path.relative(options.projectDir, filePath) + ' => ' + path.relative(options.projectDir, toFilePath));
|
|
455
430
|
}
|
|
456
431
|
|
|
457
432
|
return;
|
|
@@ -512,38 +487,40 @@ function processSourceLineByLine(options, sourcePathList, msgPrefix, processor)
|
|
|
512
487
|
const requiredUsages = {
|
|
513
488
|
'--stages': `Upgrade stages, separate by comma(,). The value means the following:
|
|
514
489
|
|
|
515
|
-
1. Fix
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
=> import somemodule from 'somemodule[.js|.vue|/index.js|/index.vue]',
|
|
520
|
-
* import('somemodule')
|
|
521
|
-
=> import('somemodule[.js|.vue|/index.js|/index.vue]')
|
|
490
|
+
1. Fix appConfig. * app_config.json
|
|
491
|
+
=> app.config.mjs
|
|
492
|
+
* jsview.config.js
|
|
493
|
+
=> jsview.config.mjs
|
|
522
494
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
* module.exports = somemodule
|
|
526
|
-
=> export default somemodule
|
|
527
|
-
* module.exports = {}
|
|
528
|
-
=> export {}
|
|
495
|
+
2. Fix alias: @. * import App from '@/App'
|
|
496
|
+
=> import App from '/src/App'
|
|
529
497
|
|
|
530
|
-
|
|
531
|
-
|
|
498
|
+
3. Fix import postfix. * import somemodule from 'somemodule'
|
|
499
|
+
=> import somemodule from 'somemodule[.js|.vue|/index.js|/index.vue]',
|
|
500
|
+
* import('somemodule')
|
|
501
|
+
=> import('somemodule[.js|.vue|/index.js|/index.vue]')
|
|
532
502
|
|
|
533
|
-
|
|
534
|
-
|
|
503
|
+
4. Fix commonjs. * const somemodule = require('somemodule')
|
|
504
|
+
=> import somemodule from 'somemodule',
|
|
505
|
+
* module.exports = somemodule
|
|
506
|
+
=> export default somemodule
|
|
507
|
+
* module.exports = {}
|
|
508
|
+
=> export {}
|
|
535
509
|
|
|
536
|
-
|
|
537
|
-
|
|
510
|
+
5. Fix hash history. * createJsvHashHistory
|
|
511
|
+
=> jsvCreateHashHistory
|
|
538
512
|
|
|
539
|
-
|
|
540
|
-
|
|
513
|
+
6. Fix animation. * :onAnimationEnd
|
|
514
|
+
=> @animationend
|
|
541
515
|
|
|
542
|
-
|
|
543
|
-
|
|
516
|
+
7. Fix jsv-audio. * <audiotrack>
|
|
517
|
+
=> <jsv-audiotrack>
|
|
518
|
+
* import JsvPlayer from 'jsview'
|
|
519
|
+
=> import { JsvPlayer } from 'jsview'
|
|
544
520
|
|
|
545
|
-
|
|
546
|
-
|
|
521
|
+
8. Fix pixels. * [left, top, width, height, fontSize, lineHeight]="00px"
|
|
522
|
+
=> [left, top, width, height, fontSize, lineHeight]=00
|
|
523
|
+
`
|
|
547
524
|
};
|
|
548
525
|
const optionalUsages = {
|
|
549
526
|
'--dir': 'Upgrade directory, default is [src].',
|
package/tools/jsview-common.mjs
CHANGED
|
@@ -331,6 +331,18 @@ function askAndAnswer(question)
|
|
|
331
331
|
return answer;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
+
function readJsonFile(filePath) {
|
|
335
|
+
try {
|
|
336
|
+
const pkgJsonContent = fs.readFileSync(filePath, 'utf8');
|
|
337
|
+
const pkgJsonObj = JSON.parse(pkgJsonContent);
|
|
338
|
+
|
|
339
|
+
return pkgJsonObj;
|
|
340
|
+
} catch (ex) {
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
|
+
|
|
334
346
|
export {
|
|
335
347
|
askAndAnswer,
|
|
336
348
|
checkNodeVersion,
|
|
@@ -340,6 +352,7 @@ export {
|
|
|
340
352
|
getPackageObject,
|
|
341
353
|
isSymlinkSync,
|
|
342
354
|
parseArguments,
|
|
355
|
+
readJsonFile,
|
|
343
356
|
rmSync,
|
|
344
357
|
symlinkSync,
|
|
345
358
|
}
|