@shijiu/jsview 1.9.914 → 1.9.921

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.
@@ -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 0;
138
+ return;
138
139
  }
139
140
 
140
141
  function removeStageFile(options, sourcePathList, msgPrefix,
@@ -165,16 +166,27 @@ function removeStageFile(options, sourcePathList, msgPrefix,
165
166
  console.info(msgPrefix + ': Upgraded ' + path.relative(options.rootDir, filePath));
166
167
  }
167
168
 
168
- return 0;
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
- const ret = replaceStageContent(options, options.sourcePathList, msgPrefix,
176
- /([0-9}])px/g, '$1');
177
- return ret;
176
+ // 过滤 (+ px), (+ 'px'), (+ "px"), (+ `px`), ( + ' px ') 等
177
+ replaceStageContent(options, options.sourcePathList, msgPrefix,
178
+ / *\+ ['"`]* *px *['"`]*/g, '');
179
+ // 过滤 (00px), ('00px'), ("00px"), (`00px`), ('00px') 等
180
+ replaceStageContent(options, options.sourcePathList, msgPrefix,
181
+ /['"`]*([0-9]+)px['"`]*/g, '$1');
182
+ // 过滤 (' 00px '), (" 00px "), (` 00px `), ('00px ') 等
183
+ replaceStageContent(options, options.sourcePathList, msgPrefix,
184
+ /['"`] *([0-9]+)px *['"`]/g, '$1');
185
+ // 过滤 ('${00}px'), ("${00}px"), (`${00}px`), ( ' ${00}px ') 等
186
+ replaceStageContent(options, options.sourcePathList, msgPrefix,
187
+ /['"`]*(\${.*?})px *['"`]*/g, '$1');
188
+
189
+ return;
178
190
  }
179
191
 
180
192
  function upgradeStageAnimation(options)
@@ -193,10 +205,10 @@ function upgradeStageHashHistory(options)
193
205
  const msgPrefix = 'Stage ' + options.stageHashHistory;
194
206
  console.info(msgPrefix + ': Upgrading hash history...');
195
207
 
196
- const ret = replaceStageContent(options, options.sourcePathList, msgPrefix,
197
- 'createJsvHashHistory', 'jsvCreateHashHistory');
208
+ replaceStageContent(options, options.sourcePathList, msgPrefix,
209
+ 'createJsvHashHistory', 'jsvCreateHashHistory');
198
210
 
199
- return ret;
211
+ return;
200
212
  }
201
213
 
202
214
  function upgradeStageAudiotrack(options)
@@ -204,10 +216,10 @@ function upgradeStageAudiotrack(options)
204
216
  const msgPrefix = 'Stage ' + options.stageAudiotrack;
205
217
  console.info(msgPrefix + ': Upgrading audiotrack...');
206
218
 
207
- const ret = replaceStageContent(options, options.sourcePathList, msgPrefix,
208
- '<audiotrack', '<jsv-audiotrack');
219
+ replaceStageContent(options, options.sourcePathList, msgPrefix,
220
+ '<audiotrack', '<jsv-audiotrack');
209
221
 
210
- return ret;
222
+ return;
211
223
  }
212
224
 
213
225
  function upgradeStageImportPostfix(options)
@@ -262,7 +274,7 @@ function upgradeStageImportPostfix(options)
262
274
  console.info(msgPrefix + ': Upgraded ' + path.relative(options.rootDir, filePath));
263
275
  }
264
276
 
265
- return 0;
277
+ return;
266
278
  }
267
279
 
268
280
  function upgradeStageAppConfig(options)
@@ -279,19 +291,15 @@ function upgradeStageAppConfig(options)
279
291
 
280
292
  const appConfigFilePath = path.resolve(appConfigDir, 'app_config.json');
281
293
 
282
- let ret = removeStageFile(options, [ appConfigFilePath ], msgPrefix,
283
- [ 'app_config.json' ], 'app.config.json');
284
- if (ret < 0) {
285
- console.error(msgPrefix + ': Failed to upgrading app config file, is not found.');
286
- process.exit(1);
287
- }
294
+ removeStageFile(options, [ appConfigFilePath ], msgPrefix,
295
+ [ 'app_config.json' ], 'app.config.json');
288
296
 
289
297
  const sourcePathList = getFilesRecursive(appConfigDir);
290
298
 
291
- ret = removeStageFile(options, sourcePathList, msgPrefix,
292
- [ '.js', '.json' ], '.mjs');
299
+ removeStageFile(options, sourcePathList, msgPrefix,
300
+ [ '.js', '.json' ], '.mjs');
293
301
 
294
- return ret;
302
+ return;
295
303
  }
296
304
 
297
305
  function upgradeStageMainEntry(options)
@@ -309,10 +317,10 @@ function upgradeStageMainEntry(options)
309
317
  process.exit(1);
310
318
  }
311
319
 
312
- const ret = removeStageFile(options, [ mainEntryFilePath ], msgPrefix,
313
- [ 'main.ts' ], 'main.tsx');
320
+ removeStageFile(options, [ mainEntryFilePath ], msgPrefix,
321
+ [ 'main.ts' ], 'main.tsx');
314
322
 
315
- return ret;
323
+ return;
316
324
  }
317
325
 
318
326
  function main(argv)
@@ -367,7 +375,7 @@ function main(argv)
367
375
 
368
376
  const requiredUsages = {
369
377
  '--stages': `Upgrade stages, separate by comma(,). The value means the following:
370
- 1. Fix pixels. "[0-9}]px => [0-9}]"
378
+ 1. Fix pixels. "[0-9]px => [0-9]", "delete (+ \`px\`),(+ 'px'),(+ "px")"
371
379
  2. Fix animation. ":onAnimationEnd => @animationend"
372
380
  3. Fix hash history. "createJsvHashHistory => jsvCreateHashHistory"
373
381
  4. Fix audiotrack. "<audiotrack => <jsv-audiotrack"