@shijiu/jsview 1.9.915 → 1.9.931
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/index.mjs +2 -1
- package/dom/target_core_revision.mjs +4 -4
- package/package.json +1 -1
- package/patches/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js +3152 -0
- package/patches/node_modules/@vue/compiler-dom/package.json +43 -0
- package/patches/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +2 -17
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +87 -53
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-format.js +4 -4
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-types.js +3 -0
- package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts +1531 -0
- package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +17 -0
- package/patches/node_modules/vite/dist/node/jsview-vite-extension.js +3 -0
- package/tools/jsview-batch-upgrade.mjs +67 -36
- package/tools/jsview-post-install.mjs +1 -0
|
@@ -333,6 +333,23 @@ function parseName(name) {
|
|
|
333
333
|
options[m[0].toLowerCase()] = true;
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
+
// JsView Added >>>
|
|
337
|
+
// 处理自定义的 addEventListener() options, 前缀为jsv
|
|
338
|
+
// onJsvXxx留给自定义Event,这样判断防止出现下面写法
|
|
339
|
+
// :jsvevent.jsvoption1.jsvoption2 => onJsvEventJsvOption1JsvOption2
|
|
340
|
+
if (name.lastIndexOf('Jsv') > 2) {
|
|
341
|
+
options = options ?? {};
|
|
342
|
+
|
|
343
|
+
const optNames = name.substring(3); // 过滤掉jsvEvent
|
|
344
|
+
const optArray = optNames.split('Jsv');
|
|
345
|
+
// optArray[0] 为EventName部分内容
|
|
346
|
+
for (let idx = optArray.length - 1; idx > 0; idx--) {
|
|
347
|
+
const optName = 'jsv' + optArray[idx];
|
|
348
|
+
options[optName] = true;
|
|
349
|
+
name = name.slice(0, name.length - optName.length);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
// JsView Added <<<
|
|
336
353
|
const event = name[2] === ':' ? name.slice(3) : hyphenate(name.slice(2));
|
|
337
354
|
return [event, options];
|
|
338
355
|
}
|
|
@@ -33,6 +33,9 @@ const jsviewConfig = defineConfig({
|
|
|
33
33
|
manualChunks: {
|
|
34
34
|
'export-sfc': ['\0plugin-vue:export-helper'], // 将_export_sfc独立出来,防止被集成在jsview-vue中导致import deadloop.
|
|
35
35
|
'vue': ['vue'], // 将vue独立出来,防止被集成在main.js中导致import deadloop.
|
|
36
|
+
// 将dom-entry和forge-define分割出来,防止被集成在main.js中导致import deadloop.
|
|
37
|
+
// 'forge-define': ['@shijiu/jsview/dom/jsv-forge-define.mjs'],
|
|
38
|
+
// 'jsivew-dom-entry': ['@shijiu/jsview/dom/index.mjs'],
|
|
36
39
|
},
|
|
37
40
|
},
|
|
38
41
|
},
|
|
@@ -25,6 +25,7 @@ function getOptions(argv)
|
|
|
25
25
|
|
|
26
26
|
const scriptPath = path.resolve(process.cwd(), process.argv[1]);
|
|
27
27
|
options.rootDir = scriptPath.replaceAll(/node_modules\/@shijiu\/jsview.*/g, '');
|
|
28
|
+
options.rootDir = options.rootDir.replaceAll(/node_modules\\@shijiu\\jsview.*/g, ''); // for windows
|
|
28
29
|
|
|
29
30
|
options.stages = argv.stages?.split(',') ?? [];
|
|
30
31
|
|
|
@@ -134,7 +135,7 @@ function replaceStageContent(options, sourcePathList, msgPrefix,
|
|
|
134
135
|
console.info(msgPrefix + ': Upgraded ' + path.relative(options.rootDir, filePath));
|
|
135
136
|
}
|
|
136
137
|
|
|
137
|
-
return
|
|
138
|
+
return;
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
function removeStageFile(options, sourcePathList, msgPrefix,
|
|
@@ -165,28 +166,57 @@ function removeStageFile(options, sourcePathList, msgPrefix,
|
|
|
165
166
|
console.info(msgPrefix + ': Upgraded ' + path.relative(options.rootDir, filePath));
|
|
166
167
|
}
|
|
167
168
|
|
|
168
|
-
return
|
|
169
|
+
return;
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
function upgradeStagePixel(options) {
|
|
172
173
|
const msgPrefix = 'Stage ' + options.stagePixels;
|
|
173
174
|
console.info(msgPrefix + ': Upgrading pixels...');
|
|
174
175
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
// 过滤 (+ px), (+ 'px'), (+ "px"), (+ `px`), ( + ' px ') 等
|
|
177
|
+
replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
178
|
+
/ *\+ ['"`]* *px *['"`]*/g, '');
|
|
179
|
+
// 过滤 (' 00px '), (" 00px "), (` 00px `), ('00px ') 等
|
|
180
|
+
replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
181
|
+
/' *([0-9]+)px *'/g, '$1');
|
|
182
|
+
replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
183
|
+
/" *([0-9]+)px *"/g, '$1');
|
|
184
|
+
replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
185
|
+
/` *([0-9]+)px *`/g, '$1');
|
|
186
|
+
// 过滤 ('${00}px'), ("${00}px"), (`${00}px`), ( ' ${00}px ') 等
|
|
187
|
+
replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
188
|
+
/['"`]*(\${.*?})px *['"`]*/g, '$1');
|
|
189
|
+
// 过滤 (00px), ('00px'), ("00px"), (`00px`), ('00px') 等
|
|
190
|
+
replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
191
|
+
/'([0-9]+)px'/g, '$1');
|
|
192
|
+
replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
193
|
+
/"([0-9]+)px"/g, '$1');
|
|
194
|
+
replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
195
|
+
/`([0-9]+)px`/g, '$1');
|
|
196
|
+
replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
197
|
+
/([0-9]+)px/g, '$1');
|
|
198
|
+
|
|
199
|
+
const numberStyleList = [
|
|
200
|
+
'height',
|
|
201
|
+
'left',
|
|
202
|
+
'top',
|
|
203
|
+
'width',
|
|
204
|
+
|
|
205
|
+
'borderRadius',
|
|
206
|
+
|
|
207
|
+
'fontSize',
|
|
208
|
+
'lineHeight',
|
|
209
|
+
];
|
|
181
210
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
'+ \'px\'', '');
|
|
186
|
-
ret = replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
187
|
-
'+ \"px\"', '');
|
|
211
|
+
for (const numberStyle of numberStyleList) {
|
|
212
|
+
const regExp = new RegExp(`:${numberStyle}=['"\`] *([0-9]+) *['"\`]`, 'g');
|
|
213
|
+
const toValue = `:${numberStyle}=$1`;
|
|
188
214
|
|
|
189
|
-
|
|
215
|
+
replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
216
|
+
regExp, toValue);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return;
|
|
190
220
|
}
|
|
191
221
|
|
|
192
222
|
function upgradeStageAnimation(options)
|
|
@@ -205,10 +235,10 @@ function upgradeStageHashHistory(options)
|
|
|
205
235
|
const msgPrefix = 'Stage ' + options.stageHashHistory;
|
|
206
236
|
console.info(msgPrefix + ': Upgrading hash history...');
|
|
207
237
|
|
|
208
|
-
|
|
209
|
-
|
|
238
|
+
replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
239
|
+
'createJsvHashHistory', 'jsvCreateHashHistory');
|
|
210
240
|
|
|
211
|
-
return
|
|
241
|
+
return;
|
|
212
242
|
}
|
|
213
243
|
|
|
214
244
|
function upgradeStageAudiotrack(options)
|
|
@@ -216,10 +246,10 @@ function upgradeStageAudiotrack(options)
|
|
|
216
246
|
const msgPrefix = 'Stage ' + options.stageAudiotrack;
|
|
217
247
|
console.info(msgPrefix + ': Upgrading audiotrack...');
|
|
218
248
|
|
|
219
|
-
|
|
220
|
-
|
|
249
|
+
replaceStageContent(options, options.sourcePathList, msgPrefix,
|
|
250
|
+
'<audiotrack', '<jsv-audiotrack');
|
|
221
251
|
|
|
222
|
-
return
|
|
252
|
+
return;
|
|
223
253
|
}
|
|
224
254
|
|
|
225
255
|
function upgradeStageImportPostfix(options)
|
|
@@ -242,7 +272,12 @@ function upgradeStageImportPostfix(options)
|
|
|
242
272
|
|
|
243
273
|
let fixedContent = content;
|
|
244
274
|
|
|
245
|
-
|
|
275
|
+
let importFilePath = null;
|
|
276
|
+
if (importFromFile.startsWith('@')) {
|
|
277
|
+
importFilePath = path.resolve(options.rootDir, 'src', importFromFile.replace('@/', ''));
|
|
278
|
+
} else {
|
|
279
|
+
importFilePath = path.resolve(currentDir, importFromFile);
|
|
280
|
+
}
|
|
246
281
|
if (fs.existsSync(importFilePath + '.js')) {
|
|
247
282
|
// 执行到此处,则需要给给import的文件加上js尾缀。当同时存在.js和.vue时,.js优先。
|
|
248
283
|
fixedContent = content.replace(importFromFile, importFromFile + '.js');
|
|
@@ -274,7 +309,7 @@ function upgradeStageImportPostfix(options)
|
|
|
274
309
|
console.info(msgPrefix + ': Upgraded ' + path.relative(options.rootDir, filePath));
|
|
275
310
|
}
|
|
276
311
|
|
|
277
|
-
return
|
|
312
|
+
return;
|
|
278
313
|
}
|
|
279
314
|
|
|
280
315
|
function upgradeStageAppConfig(options)
|
|
@@ -291,19 +326,15 @@ function upgradeStageAppConfig(options)
|
|
|
291
326
|
|
|
292
327
|
const appConfigFilePath = path.resolve(appConfigDir, 'app_config.json');
|
|
293
328
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
if (ret < 0) {
|
|
297
|
-
console.error(msgPrefix + ': Failed to upgrading app config file, is not found.');
|
|
298
|
-
process.exit(1);
|
|
299
|
-
}
|
|
329
|
+
removeStageFile(options, [ appConfigFilePath ], msgPrefix,
|
|
330
|
+
[ 'app_config.json' ], 'app.config.json');
|
|
300
331
|
|
|
301
332
|
const sourcePathList = getFilesRecursive(appConfigDir);
|
|
302
333
|
|
|
303
|
-
|
|
304
|
-
|
|
334
|
+
removeStageFile(options, sourcePathList, msgPrefix,
|
|
335
|
+
[ '.js', '.json' ], '.mjs');
|
|
305
336
|
|
|
306
|
-
return
|
|
337
|
+
return;
|
|
307
338
|
}
|
|
308
339
|
|
|
309
340
|
function upgradeStageMainEntry(options)
|
|
@@ -321,10 +352,10 @@ function upgradeStageMainEntry(options)
|
|
|
321
352
|
process.exit(1);
|
|
322
353
|
}
|
|
323
354
|
|
|
324
|
-
|
|
325
|
-
|
|
355
|
+
removeStageFile(options, [ mainEntryFilePath ], msgPrefix,
|
|
356
|
+
[ 'main.ts' ], 'main.tsx');
|
|
326
357
|
|
|
327
|
-
return
|
|
358
|
+
return;
|
|
328
359
|
}
|
|
329
360
|
|
|
330
361
|
function main(argv)
|
|
@@ -379,7 +410,7 @@ function main(argv)
|
|
|
379
410
|
|
|
380
411
|
const requiredUsages = {
|
|
381
412
|
'--stages': `Upgrade stages, separate by comma(,). The value means the following:
|
|
382
|
-
1. Fix pixels. "[0-9
|
|
413
|
+
1. Fix pixels. "[0-9]px => [0-9]", "delete (+ \`px\`),(+ 'px'),(+ "px")"
|
|
383
414
|
2. Fix animation. ":onAnimationEnd => @animationend"
|
|
384
415
|
3. Fix hash history. "createJsvHashHistory => jsvCreateHashHistory"
|
|
385
416
|
4. Fix audiotrack. "<audiotrack => <jsv-audiotrack"
|