@shijiu/jsview 1.9.837 → 1.9.839
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/jsv-browser-debug-dom.js +1 -1
- package/dom/jsv-dom.js +1 -1
- package/dom/jsv-engine-js-browser.js +1 -1
- package/dom/jsv-forge-define.js +1 -1
- package/package.json +1 -1
- package/patches/node_modules/vite/dist/node/constants.js +125 -0
- package/patches/node_modules/vite/dist/node/jsview-vite-extension.js +2 -1
package/dom/jsv-dom.js
CHANGED
package/dom/jsv-forge-define.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import path, { resolve } from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
|
|
5
|
+
const { version } = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url)).toString());
|
|
6
|
+
const VERSION = version;
|
|
7
|
+
const DEFAULT_MAIN_FIELDS = [
|
|
8
|
+
'module',
|
|
9
|
+
'jsnext:main',
|
|
10
|
+
'jsnext',
|
|
11
|
+
];
|
|
12
|
+
// Baseline support browserslist
|
|
13
|
+
// "defaults and supports es6-module and supports es6-module-dynamic-import"
|
|
14
|
+
// Higher browser versions may be needed for extra features.
|
|
15
|
+
const ESBUILD_MODULES_TARGET = [
|
|
16
|
+
// JsView Modified >>>
|
|
17
|
+
// 解决对top-level-await的原生支持问题。
|
|
18
|
+
//'es2020',
|
|
19
|
+
//'edge88',
|
|
20
|
+
//'firefox78',
|
|
21
|
+
//'chrome87',
|
|
22
|
+
//'safari14',
|
|
23
|
+
'es2022',
|
|
24
|
+
// JsView Modified <<<
|
|
25
|
+
];
|
|
26
|
+
const DEFAULT_EXTENSIONS = [
|
|
27
|
+
'.mjs',
|
|
28
|
+
'.js',
|
|
29
|
+
'.mts',
|
|
30
|
+
'.ts',
|
|
31
|
+
'.jsx',
|
|
32
|
+
'.tsx',
|
|
33
|
+
'.json',
|
|
34
|
+
];
|
|
35
|
+
const DEFAULT_CONFIG_FILES = [
|
|
36
|
+
'vite.config.js',
|
|
37
|
+
'vite.config.mjs',
|
|
38
|
+
'vite.config.ts',
|
|
39
|
+
'vite.config.cjs',
|
|
40
|
+
'vite.config.mts',
|
|
41
|
+
'vite.config.cts',
|
|
42
|
+
];
|
|
43
|
+
const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
|
|
44
|
+
const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
|
45
|
+
const OPTIMIZABLE_ENTRY_RE = /\.[cm]?[jt]s$/;
|
|
46
|
+
const SPECIAL_QUERY_RE = /[?&](?:worker|sharedworker|raw|url)\b/;
|
|
47
|
+
/**
|
|
48
|
+
* Prefix for resolved fs paths, since windows paths may not be valid as URLs.
|
|
49
|
+
*/
|
|
50
|
+
const FS_PREFIX = `/@fs/`;
|
|
51
|
+
/**
|
|
52
|
+
* Prefix for resolved Ids that are not valid browser import specifiers
|
|
53
|
+
*/
|
|
54
|
+
const VALID_ID_PREFIX = `/@id/`;
|
|
55
|
+
/**
|
|
56
|
+
* Plugins that use 'virtual modules' (e.g. for helper functions), prefix the
|
|
57
|
+
* module ID with `\0`, a convention from the rollup ecosystem.
|
|
58
|
+
* This prevents other plugins from trying to process the id (like node resolution),
|
|
59
|
+
* and core features like sourcemaps can use this info to differentiate between
|
|
60
|
+
* virtual modules and regular files.
|
|
61
|
+
* `\0` is not a permitted char in import URLs so we have to replace them during
|
|
62
|
+
* import analysis. The id will be decoded back before entering the plugins pipeline.
|
|
63
|
+
* These encoded virtual ids are also prefixed by the VALID_ID_PREFIX, so virtual
|
|
64
|
+
* modules in the browser end up encoded as `/@id/__x00__{id}`
|
|
65
|
+
*/
|
|
66
|
+
const NULL_BYTE_PLACEHOLDER = `__x00__`;
|
|
67
|
+
const CLIENT_PUBLIC_PATH = `/@vite/client`;
|
|
68
|
+
const ENV_PUBLIC_PATH = `/@vite/env`;
|
|
69
|
+
const VITE_PACKAGE_DIR = resolve(
|
|
70
|
+
// import.meta.url is `dist/node/constants.js` after bundle
|
|
71
|
+
fileURLToPath(import.meta.url), '../../..');
|
|
72
|
+
const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
|
|
73
|
+
const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
|
|
74
|
+
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
|
75
|
+
// ** READ THIS ** before editing `KNOWN_ASSET_TYPES`.
|
|
76
|
+
// If you add an asset to `KNOWN_ASSET_TYPES`, make sure to also add it
|
|
77
|
+
// to the TypeScript declaration file `packages/vite/client.d.ts` and
|
|
78
|
+
// add a mime type to the `registerCustomMime` in
|
|
79
|
+
// `packages/vite/src/node/plugin/assets.ts` if mime type cannot be
|
|
80
|
+
// looked up by mrmime.
|
|
81
|
+
const KNOWN_ASSET_TYPES = [
|
|
82
|
+
// images
|
|
83
|
+
'png',
|
|
84
|
+
'jpe?g',
|
|
85
|
+
'jfif',
|
|
86
|
+
'pjpeg',
|
|
87
|
+
'pjp',
|
|
88
|
+
'gif',
|
|
89
|
+
'svg',
|
|
90
|
+
'ico',
|
|
91
|
+
'webp',
|
|
92
|
+
'avif',
|
|
93
|
+
// media
|
|
94
|
+
'mp4',
|
|
95
|
+
'webm',
|
|
96
|
+
'ogg',
|
|
97
|
+
'mp3',
|
|
98
|
+
'wav',
|
|
99
|
+
'flac',
|
|
100
|
+
'aac',
|
|
101
|
+
// fonts
|
|
102
|
+
'woff2?',
|
|
103
|
+
'eot',
|
|
104
|
+
'ttf',
|
|
105
|
+
'otf',
|
|
106
|
+
// other
|
|
107
|
+
'webmanifest',
|
|
108
|
+
'pdf',
|
|
109
|
+
'txt',
|
|
110
|
+
];
|
|
111
|
+
const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
|
|
112
|
+
const DEP_VERSION_RE = /[?&](v=[\w.-]+)\b/;
|
|
113
|
+
const loopbackHosts = new Set([
|
|
114
|
+
'localhost',
|
|
115
|
+
'127.0.0.1',
|
|
116
|
+
'::1',
|
|
117
|
+
'0000:0000:0000:0000:0000:0000:0000:0001',
|
|
118
|
+
]);
|
|
119
|
+
const wildcardHosts = new Set([
|
|
120
|
+
'0.0.0.0',
|
|
121
|
+
'::',
|
|
122
|
+
'0000:0000:0000:0000:0000:0000:0000:0000',
|
|
123
|
+
]);
|
|
124
|
+
|
|
125
|
+
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
|
|
@@ -31,7 +31,8 @@ const jsviewConfig = defineConfig({
|
|
|
31
31
|
entryFileNames: 'js/main.jsv.[hash].js',
|
|
32
32
|
format: 'esm',
|
|
33
33
|
manualChunks: {
|
|
34
|
-
'
|
|
34
|
+
'export-sfc': ['\0plugin-vue:export-helper'], // 将_export_sfc独立出来,防止被集成在jsview-vue中导致import deadloop.
|
|
35
|
+
'vue': ['vue'], // 将vue独立出来,防止被集成在main.js中导致import deadloop.
|
|
35
36
|
},
|
|
36
37
|
},
|
|
37
38
|
},
|