@shijiu/jsview 1.9.915 → 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,28 +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
- let ret = replaceStageContent(options, options.sourcePathList, msgPrefix,
176
- /([0-9}])px/g, '$1');
177
- if (ret < 0) {
178
- console.error(msgPrefix + ': Failed to upgrading pixels.');
179
- process.exit(1);
180
- }
181
-
182
- ret = replaceStageContent(options, options.sourcePathList, msgPrefix,
183
- '+ `px`', '');
184
- ret = replaceStageContent(options, options.sourcePathList, msgPrefix,
185
- '+ \'px\'', '');
186
- ret = replaceStageContent(options, options.sourcePathList, msgPrefix,
187
- '+ \"px\"', '');
188
-
189
- 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;
190
190
  }
191
191
 
192
192
  function upgradeStageAnimation(options)
@@ -205,10 +205,10 @@ function upgradeStageHashHistory(options)
205
205
  const msgPrefix = 'Stage ' + options.stageHashHistory;
206
206
  console.info(msgPrefix + ': Upgrading hash history...');
207
207
 
208
- const ret = replaceStageContent(options, options.sourcePathList, msgPrefix,
209
- 'createJsvHashHistory', 'jsvCreateHashHistory');
208
+ replaceStageContent(options, options.sourcePathList, msgPrefix,
209
+ 'createJsvHashHistory', 'jsvCreateHashHistory');
210
210
 
211
- return ret;
211
+ return;
212
212
  }
213
213
 
214
214
  function upgradeStageAudiotrack(options)
@@ -216,10 +216,10 @@ function upgradeStageAudiotrack(options)
216
216
  const msgPrefix = 'Stage ' + options.stageAudiotrack;
217
217
  console.info(msgPrefix + ': Upgrading audiotrack...');
218
218
 
219
- const ret = replaceStageContent(options, options.sourcePathList, msgPrefix,
220
- '<audiotrack', '<jsv-audiotrack');
219
+ replaceStageContent(options, options.sourcePathList, msgPrefix,
220
+ '<audiotrack', '<jsv-audiotrack');
221
221
 
222
- return ret;
222
+ return;
223
223
  }
224
224
 
225
225
  function upgradeStageImportPostfix(options)
@@ -274,7 +274,7 @@ function upgradeStageImportPostfix(options)
274
274
  console.info(msgPrefix + ': Upgraded ' + path.relative(options.rootDir, filePath));
275
275
  }
276
276
 
277
- return 0;
277
+ return;
278
278
  }
279
279
 
280
280
  function upgradeStageAppConfig(options)
@@ -291,19 +291,15 @@ function upgradeStageAppConfig(options)
291
291
 
292
292
  const appConfigFilePath = path.resolve(appConfigDir, 'app_config.json');
293
293
 
294
- let ret = removeStageFile(options, [ appConfigFilePath ], msgPrefix,
295
- [ 'app_config.json' ], 'app.config.json');
296
- if (ret < 0) {
297
- console.error(msgPrefix + ': Failed to upgrading app config file, is not found.');
298
- process.exit(1);
299
- }
294
+ removeStageFile(options, [ appConfigFilePath ], msgPrefix,
295
+ [ 'app_config.json' ], 'app.config.json');
300
296
 
301
297
  const sourcePathList = getFilesRecursive(appConfigDir);
302
298
 
303
- ret = removeStageFile(options, sourcePathList, msgPrefix,
304
- [ '.js', '.json' ], '.mjs');
299
+ removeStageFile(options, sourcePathList, msgPrefix,
300
+ [ '.js', '.json' ], '.mjs');
305
301
 
306
- return ret;
302
+ return;
307
303
  }
308
304
 
309
305
  function upgradeStageMainEntry(options)
@@ -321,10 +317,10 @@ function upgradeStageMainEntry(options)
321
317
  process.exit(1);
322
318
  }
323
319
 
324
- const ret = removeStageFile(options, [ mainEntryFilePath ], msgPrefix,
325
- [ 'main.ts' ], 'main.tsx');
320
+ removeStageFile(options, [ mainEntryFilePath ], msgPrefix,
321
+ [ 'main.ts' ], 'main.tsx');
326
322
 
327
- return ret;
323
+ return;
328
324
  }
329
325
 
330
326
  function main(argv)
@@ -379,7 +375,7 @@ function main(argv)
379
375
 
380
376
  const requiredUsages = {
381
377
  '--stages': `Upgrade stages, separate by comma(,). The value means the following:
382
- 1. Fix pixels. "[0-9}]px => [0-9}]", "delete (+ \`px\`),(+ 'px'),(+ "px")"
378
+ 1. Fix pixels. "[0-9]px => [0-9]", "delete (+ \`px\`),(+ 'px'),(+ "px")"
383
379
  2. Fix animation. ":onAnimationEnd => @animationend"
384
380
  3. Fix hash history. "createJsvHashHistory => jsvCreateHashHistory"
385
381
  4. Fix audiotrack. "<audiotrack => <jsv-audiotrack"