@shijiu/jsview 1.9.843 → 1.9.859

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.
@@ -1,4 +1,5 @@
1
- import './browser-root-style.css'
1
+ // 再vite环境下,dynamic import css文件没有生效,所以直接卸载了index.html中.
2
+ // import './browser-root-style.css'
2
3
 
3
4
  import JsvCodeDebug from './jsv-code-debug.mjs'
4
5
 
@@ -8,11 +9,11 @@ if (!JsvCodeDebug.enableDebug) {
8
9
  // Release entry
9
10
  domBrowser = await import('./bin/jsview-browser-debug-dom.min');
10
11
  } else {
11
- // Debug entry
12
- domBrowser = await import(JsvCodeDebug.domBrowserPath);
13
-
14
- // for Webpack
15
- // domBrowser = await import('./code/src/dom-browser-hook');
12
+ // Debug entry (兼容webpack写法)
13
+ domBrowser = await import(
14
+ /* webpackExclude: /@shijiu\/jsview\/dom\/code\/node_modules\// */
15
+ `${JsvCodeDebug.domBrowserPath}`
16
+ );
16
17
  }
17
18
 
18
19
  export default domBrowser;
@@ -1,4 +1,3 @@
1
-
2
1
  const JsvCodeDebug = {
3
2
  // true: Debug entry
4
3
  // false: Release entry
package/dom/jsv-dom.js CHANGED
@@ -6,11 +6,11 @@ if (!JsvCodeDebug.enableDebug) {
6
6
  // Release entry
7
7
  domNative = await import('./bin/jsview-dom.min');
8
8
  } else {
9
- // Debug entry
10
- domNative = await import(JsvCodeDebug.domNativePath);
11
-
12
- // for Webpack
13
- // domNative = await import('./code/src/dom-wrapper');
9
+ // Debug entry (兼容webpack写法)
10
+ domNative = await import(
11
+ /* webpackExclude: /@shijiu\/jsview\/dom\/code\/node_modules\// */
12
+ `${JsvCodeDebug.domNativePath}`
13
+ );
14
14
  }
15
15
 
16
16
  export {
@@ -6,11 +6,11 @@ if (!JsvCodeDebug.enableDebug) {
6
6
  // Release entry
7
7
  engineBrowser = await import("./bin/jsview-engine-js-browser.min");
8
8
  } else {
9
- // Debug entry
10
- engineBrowser = await import(JsvCodeDebug.engineBrowserPath);
11
-
12
- // for Webpack
13
- // engineBrowser = await import('./code/src/engine-js/browser');
9
+ // Debug entry (兼容webpack写法)
10
+ engineBrowser = await import(
11
+ /* webpackExclude: /@shijiu\/jsview\/dom\/code\/node_modules\// */
12
+ `${JsvCodeDebug.engineBrowserPath}`
13
+ );
14
14
  }
15
15
 
16
16
  export default engineBrowser;
@@ -6,11 +6,11 @@ if (!JsvCodeDebug.enableDebug) {
6
6
  // Release entry
7
7
  forgeDefine = await import('./bin/jsview-forge-define.min');
8
8
  } else {
9
- // Debug entry
10
- forgeDefine = await import(JsvCodeDebug.forgeDefinePath);
11
-
12
- // for Webpack
13
- // forgeDefine = await import('./code/src/engine-js');
9
+ // Debug entry (兼容webpack写法)
10
+ forgeDefine = await import(
11
+ /* webpackExclude: /@shijiu\/jsview\/dom\/code\/node_modules\// */
12
+ `${JsvCodeDebug.forgeDefinePath}`
13
+ );
14
14
  }
15
15
 
16
16
  const Forge = forgeDefine.Forge;
@@ -3,8 +3,8 @@
3
3
  */
4
4
 
5
5
  const TargetRevision = {
6
- "CoreRevision": 1021253,
7
- "CoreRevisionAndBranch": "1021253",
6
+ "CoreRevision": 1021272,
7
+ "CoreRevisionAndBranch": "1021272",
8
8
  "JseRevision": "1.0.827",
9
9
  "JseUrl":
10
10
  "http://cdn.release.qcast.cn/forge_js/master/JsViewES6_react_r827.jsv.6825753b.js"
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview",
3
- "version": "1.9.843",
3
+ "version": "1.9.859",
4
4
  "bin": {
5
5
  "jsview-post-build": "./tools/jsview-post-build.js",
6
6
  "jsview-post-install": "./tools/jsview-post-install.js"
@@ -323,6 +323,16 @@ module.exports = function (webpackEnv) {
323
323
  ],
324
324
  },
325
325
  resolve: {
326
+ // JsView Added >>>
327
+ // 解决JsViewDom的Code Debug中,import(variable)时,npm start报错。
328
+ fallback: {
329
+ "buffer": false,
330
+ "child_process": false,
331
+ "os": false,
332
+ "path": false,
333
+ "stream": false,
334
+ "worker_threads": false,
335
+ },
326
336
  // This allows you to set a fallback for where webpack should look for modules.
327
337
  // We placed these paths second because we want `node_modules` to "win"
328
338
  // if there are any conflicts. This matches Node resolution mechanism.
@@ -447,7 +457,7 @@ module.exports = function (webpackEnv) {
447
457
  // JsView Modified >>>
448
458
  // 将jsview和jsviewDebugPath计入打包
449
459
  // include: paths.appSrc,
450
- include: [paths.appSrc, paths.jsviewPath, paths.jsviewDebugPath ],
460
+ include: [ paths.appSrc, paths.jsviewPath, paths.jsviewDebugPath ],
451
461
  // JsView Modified <<<
452
462
  loader: require.resolve('babel-loader'),
453
463
  options: {
@@ -48,7 +48,7 @@ const jsviewConfig = defineConfig({
48
48
  'qr.js'
49
49
  ],
50
50
  exclude: [
51
- '@shijiu/jsview/loader/jsview-main.js', // 解决windows上出现解析异常的问题。
51
+ '@shijiu/jsview/loader/jsview-main.mjs', // 解决windows上出现解析异常的问题。
52
52
  'jsview',
53
53
  'jsview-vue',
54
54
  'jsview-vue-samples',
@@ -67,7 +67,7 @@ const jsviewConfig = defineConfig({
67
67
  'jsview-vue-samples': path.resolve(process.cwd(), 'node_modules/@shijiu/jsview-vue-samples'),
68
68
  'jsview-react': path.resolve(process.cwd(), 'node_modules/@shijiu/jsview-react'),
69
69
  'jsview-react-samples': path.resolve(process.cwd(), 'node_modules/@shijiu/jsview-react-samples'),
70
- '/js/main.jsv.js': path.resolve(process.cwd(), 'node_modules/@shijiu/jsview/loader/jsview-main.js'),
70
+ '/js/main.jsv.mjs': path.resolve(process.cwd(), 'node_modules/@shijiu/jsview/loader/jsview-main.mjs'),
71
71
  },
72
72
  preserveSymlinks: true
73
73
  },
@@ -154,6 +154,29 @@ function jsvSaveUrlToCache(urls) {
154
154
  fs.writeFileSync(urlCacheFilePath, `export default "${urls.network[0]}"`)
155
155
  }
156
156
 
157
+ async function checkDomDebugDisabled() {
158
+ // production 时检查jsview-dom是否处于Debug模式。
159
+ if (process.env.NODE_ENV !== 'production') {
160
+ return;
161
+ }
162
+
163
+ const moduleDir = getModuleDir();
164
+ const jsviewDomCodeDebugFilePath = path.resolve(moduleDir, '@shijiu/jsview/dom/jsv-code-debug.mjs');
165
+ if (!fs.existsSync(jsviewDomCodeDebugFilePath)) {
166
+ return;
167
+ }
168
+
169
+ const { default: jsviewDomCodeDebug } = await import(jsviewDomCodeDebugFilePath);
170
+ if (jsviewDomCodeDebug.enableDebug) {
171
+ throw new Error('JsView Error: Dom debug is enabled, please disable it first.')
172
+ }
173
+ }
174
+
175
+ async function main() {
176
+ await checkDomDebugDisabled();
177
+ }
178
+ await main()
179
+
157
180
  export {
158
181
  jsvCreateJsViewViteConfig,
159
182
  jsvSaveUrlToCache,
@@ -7,6 +7,7 @@ const path = require('path');
7
7
  const {
8
8
  checkNodeVersion,
9
9
  getOptions,
10
+ parseArguments,
10
11
  } = require('./jsview-common');
11
12
 
12
13
  // main.js处理AppData信息
@@ -138,7 +139,27 @@ function redirectSourceMappingURL(options)
138
139
  };
139
140
  }
140
141
 
141
- function makeDebugMap(options)
142
+ function makeMainJsvMjs(options, framework)
143
+ {
144
+ if (framework != 'vue') {
145
+ return;
146
+ }
147
+
148
+ let jsEntryFilePath;
149
+ const jsFileNames = fs.readdirSync(options.distJsDir);
150
+ for(const fileName of jsFileNames) {
151
+ if (fileName.startsWith('main.jsv') && fileName.endsWith('.js')) {
152
+ jsEntryFilePath = path.resolve(options.distJsDir, fileName);
153
+ break;
154
+ }
155
+ };
156
+
157
+ const to = jsEntryFilePath.replace(/.js$/, '.mjs');
158
+ console.log(' -> ' + path.relative(options.projectDir, to));
159
+ fs.copyFileSync(jsEntryFilePath, to);
160
+ }
161
+
162
+ function makeDebugMap(options, framework)
142
163
  {
143
164
  fs.mkdirSync(options.distDebugMapDir, { recursive: true });
144
165
 
@@ -159,7 +180,11 @@ function makeDebugMap(options)
159
180
  };
160
181
 
161
182
  if (jsEntryFilePath) {
162
- const to = path.resolve(options.distJsDir, 'main.jsv.js');
183
+ let extName = path.extname(jsEntryFilePath);
184
+ if (framework == 'vue') {
185
+ extName = '.mjs'
186
+ }
187
+ const to = path.resolve(options.distJsDir, 'main.jsv' + extName);
163
188
  console.log(' -> ' + path.relative(options.projectDir, to));
164
189
  fs.copyFileSync(jsEntryFilePath, to);
165
190
  }
@@ -176,7 +201,7 @@ function makeDebugMap(options)
176
201
  fs.copyFileSync(jsmapServePath, to);
177
202
  }
178
203
 
179
- async function main()
204
+ async function main(argv)
180
205
  {
181
206
  checkNodeVersion();
182
207
 
@@ -199,9 +224,19 @@ async function main()
199
224
  await signApp(options);
200
225
  console.info('Signed JsView App.');
201
226
 
227
+ console.info('Making JsView main.jsv.mjs...');
228
+ makeMainJsvMjs(options, argv.framework);
229
+ console.info('Made JsView main.jsv.mjs...');
230
+
202
231
  console.info('Making JsView Debug map...');
203
- makeDebugMap(options);
232
+ makeDebugMap(options, argv.framework);
204
233
  console.info('Made JsView Debug map.');
205
234
  }
206
235
 
207
- main();
236
+ const requiredUsages = {
237
+ '--framework': 'Select from [vue|react]',
238
+ };
239
+ const optionalUsages = {
240
+ };
241
+ const argv = parseArguments(requiredUsages, optionalUsages);
242
+ main(argv);
@@ -30,11 +30,12 @@ async function getExtraOptions(argv)
30
30
  const baseUrlFile = url.pathToFileURL(options.baseUrlFile);
31
31
  let { default: baseUrl } = await import(baseUrlFile);
32
32
  baseUrl = baseUrl.replace(/\u001b\[.*?m/g, '')
33
- options.entryUrl = baseUrl + 'js/main.jsv.js';
34
33
 
34
+ let entryUrl = baseUrl + 'js/main.jsv.js';
35
35
  if (argv.framework === 'vue') {
36
- options.entryUrl += '?module=true';
36
+ entryUrl = 'js/main.jsv.mjs';
37
37
  }
38
+ options.entryUrl = baseUrl + entryUrl;
38
39
 
39
40
  return options;
40
41
  }