@shijiu/jsview 2.3.151-test.0 → 3.0.0-test.0
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-engine-core.min.js +1 -1
- package/dom/bin/jsview-dom-browser-engine-modules.min.js +1 -1
- package/dom/bin/{jsview-dom-browser-forge.1493.9a36.wasm → jsview-dom-browser-forge.1760.0e35.wasm} +0 -0
- package/dom/bin/jsview-dom-browser-forge.min.js +1 -1
- package/dom/bin/jsview-dom-browser-forge.worker.min.js +1 -1
- 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-native.min.js +1 -1
- package/dom/target_core_revision.mjs +2 -2
- package/loader/jsv-core-api/jsview-core-api-glue.js +10 -1
- package/loader/jsv-core-api/wasm/core-api.js +87 -2
- package/loader/jsv-core-api/wasm/wasm-extension.js +5 -0
- package/loader/jsview-loader.js +7 -0
- package/loader/jsview-main.mjs +2 -1
- package/loader/jsview.config.default.js +4 -0
- package/package.json +7 -5
- package/patches/@vitejs+plugin-vue+4.0.0.patch +51 -0
- package/patches/@vitejs+plugin-vue+6.0.6.patch +54 -0
- package/patches/@vue+compiler-dom+3.2.45.patch +22 -0
- package/patches/@vue+compiler-dom+3.6.0-beta.10.patch +22 -0
- package/patches/@vue+compiler-sfc+3.2.45.patch +1986 -0
- package/patches/@vue+compiler-sfc+3.6.0-beta.10.patch +69 -0
- package/patches/@vue+runtime-core+3.2.45.patch +353 -0
- package/patches/@vue+runtime-core+3.6.0-beta.10.patch +198 -0
- package/patches/@vue+runtime-dom+3.2.45.patch +81 -0
- package/patches/@vue+runtime-dom+3.6.0-beta.10.patch +47 -0
- package/patches/postcss-js+5.1.0.patch +20 -0
- package/patches/vite+4.0.0.patch +117 -0
- package/patches/vite+8.0.9.patch +77 -0
- package/patches/vue-router+4.1.6.patch +17 -0
- package/patches/vue-router+5.0.6.patch +0 -0
- package/{patches/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js → thirdparty/@vue/compiler-sfc/jsview-css-to-js.cjs} +15 -10
- package/{patches/node_modules/@vue/compiler-sfc/dist/jsview-style-checker.js → thirdparty/@vue/compiler-sfc/jsview-style-checker.cjs} +6 -1
- package/{patches/node_modules/@vue/compiler-sfc/dist/jsview-style-formator.cjs.js → thirdparty/@vue/compiler-sfc/jsview-style-formator.cjs} +3 -0
- package/thirdparty/@vue/runtime-core/jsview-render-break.mjs +201 -0
- package/thirdparty/vite/jsview-vite-extension.mjs +336 -0
- package/tools/jsview-build-zip.mjs +7 -2
- package/tools/jsview-common.mjs +17 -4
- package/tools/{jsview-logger.js → jsview-logger.cjs} +1 -1
- package/tools/jsview-post-build.mjs +55 -0
- package/tools/jsview-post-install.mjs +98 -110
- package/tools/jsview-run-tool.mjs +3 -6
- package/tools/jsview-vue-devtools.mjs +1 -1
- package/loader/jsview-react-main.js +0 -37
- package/loader/jsview-react-script-loader.js +0 -134
- package/patches/node_modules/@vitejs/plugin-react/dist/index.cjs +0 -520
- package/patches/node_modules/@vitejs/plugin-react/package.json +0 -55
- package/patches/node_modules/@vitejs/plugin-vue/dist/index.mjs +0 -2756
- package/patches/node_modules/@vitejs/plugin-vue/package.json +0 -51
- package/patches/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js +0 -3152
- package/patches/node_modules/@vue/compiler-dom/package.json +0 -43
- package/patches/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +0 -17730
- package/patches/node_modules/@vue/compiler-sfc/package.json +0 -59
- package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +0 -8154
- package/patches/node_modules/@vue/runtime-core/package.json +0 -38
- package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts +0 -1531
- package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0 -1740
- package/patches/node_modules/@vue/runtime-dom/package.json +0 -42
- package/patches/node_modules/postcss-js/objectifier.js +0 -94
- package/patches/node_modules/postcss-js/package.json +0 -42
- package/patches/node_modules/react-dev-utils/WebpackDevServerUtils.js +0 -450
- package/patches/node_modules/react-dev-utils/package.json +0 -88
- package/patches/node_modules/react-dom/cjs/react-dom.development.js +0 -29868
- package/patches/node_modules/react-dom/cjs/react-dom.production.min.js +0 -323
- package/patches/node_modules/react-dom/package.json +0 -62
- package/patches/node_modules/react-scripts/config/paths.js +0 -179
- package/patches/node_modules/react-scripts/config/webpack.config.js +0 -858
- package/patches/node_modules/react-scripts/package.json +0 -108
- package/patches/node_modules/vite/dist/node/chunks/dep-ed9cb113.js +0 -63182
- package/patches/node_modules/vite/dist/node/constants.js +0 -125
- package/patches/node_modules/vite/dist/node/jsview-vite-extension.js +0 -245
- package/patches/node_modules/vite/package.json +0 -153
- package/patches/node_modules/vue-router/dist/vue-router.mjs +0 -3613
- package/patches/node_modules/vue-router/package.json +0 -114
- package/patches/node_modules/webpack-dev-server/client/utils/reloadApp.js +0 -76
- package/patches/node_modules/webpack-dev-server/client/utils/sendMessage.js +0 -21
- package/patches/node_modules/webpack-dev-server/package.json +0 -141
- /package/patches/{node_modules/@originjs/vite-plugin-federation/1.3.4/@originjs+vite-plugin-federation+1.3.4.patch → @originjs+vite-plugin-federation+1.3.4.patch} +0 -0
|
@@ -1,125 +0,0 @@
|
|
|
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 };
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite'
|
|
2
|
-
import fs from 'fs'
|
|
3
|
-
import path from 'path'
|
|
4
|
-
// import fullReload from 'vite-plugin-full-reload';
|
|
5
|
-
// import wasm from "vite-plugin-wasm";
|
|
6
|
-
|
|
7
|
-
// https://vitejs.dev/config/
|
|
8
|
-
const jsviewConfig = defineConfig({
|
|
9
|
-
assetsInclude: ['**/*.bmp'],
|
|
10
|
-
base: './', // index.html 使用相对路径
|
|
11
|
-
build: {
|
|
12
|
-
assetsInlineLimit: 0,
|
|
13
|
-
//cssTarget: 'css/', // 未生效
|
|
14
|
-
commonjsOptions: {
|
|
15
|
-
'gifuct-js': true,
|
|
16
|
-
'js-binary-schema-parser': true,
|
|
17
|
-
'mockjs': true,
|
|
18
|
-
'qr.js': true,
|
|
19
|
-
},
|
|
20
|
-
emptyOutDir: true,
|
|
21
|
-
minify: process.env['JSVIEW_DISABLE_MINIFY'] ? false : true,
|
|
22
|
-
jsvMinifyExclude: process.env['JSVIEW_MINIFY_EXCLUDE'],
|
|
23
|
-
modulePreload: {
|
|
24
|
-
polyfill: false
|
|
25
|
-
},
|
|
26
|
-
rollupOptions: {
|
|
27
|
-
onwarn: onRollupWarning,
|
|
28
|
-
output: {
|
|
29
|
-
assetFileNames: getFileName,
|
|
30
|
-
chunkFileNames: getFileName,
|
|
31
|
-
entryFileNames: 'js/main.jsv.[hash].js',
|
|
32
|
-
format: 'esm',
|
|
33
|
-
manualChunks: {
|
|
34
|
-
'export-sfc': ['\0plugin-vue:export-helper', '@shijiu/jsview-vue/bin/export-sfc.mjs'], // 将_export_sfc独立出来,防止被集成在jsview-vue中导致import deadloop.
|
|
35
|
-
'vue': ['vue'], // 将vue独立出来,防止被集成在main.js中导致import deadloop.
|
|
36
|
-
// 将dom-entry和forge-define分割出来,防止被集成在main.js中导致import deadloop.
|
|
37
|
-
'jsview-forge-define': ['@shijiu/jsview/dom/jsv-forge-define.mjs'],
|
|
38
|
-
'jsview-dom-entry': ['@shijiu/jsview/dom/index.mjs'],
|
|
39
|
-
'jsview-vue-entry': ['@shijiu/jsview-vue/index.js'],
|
|
40
|
-
'jsview-vue-common': ['@shijiu/jsview-vue/bin/jsview-vue-common.mjs'],
|
|
41
|
-
// 'jsview-vue-export-sfc': [], // 将jsview-vue中的export-sfc,防止被集成在jsview-vue-entry中导致import deadloop.
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
plugins: [
|
|
45
|
-
{
|
|
46
|
-
name: 'vite-plugin-remove-bangs',
|
|
47
|
-
renderChunk(code) { return {
|
|
48
|
-
code: code.replace(/^\/\/!/g, '//').replace(/^\/\*!/g, '/*'),
|
|
49
|
-
map: null,
|
|
50
|
-
}},
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
sourcemap: true,
|
|
55
|
-
target: 'es2022', // 不转译async/await
|
|
56
|
-
},
|
|
57
|
-
isCustomElement: (tag) => {
|
|
58
|
-
return tag == 'fdiv' || tag.startsWith('jsv-')
|
|
59
|
-
},
|
|
60
|
-
optimizeDeps: {
|
|
61
|
-
include: [
|
|
62
|
-
'gifuct-js',
|
|
63
|
-
// 'mockjs',
|
|
64
|
-
'qr.js'
|
|
65
|
-
],
|
|
66
|
-
exclude: [
|
|
67
|
-
'@shijiu/jsview/loader/jsview-main.mjs', // 解决windows上出现解析异常的问题。
|
|
68
|
-
'@shijiu/jsview',
|
|
69
|
-
'@shijiu/jsview-vue',
|
|
70
|
-
'@shijiu/jsview-vue-samples',
|
|
71
|
-
'jsview',
|
|
72
|
-
'jsview-vue',
|
|
73
|
-
'jsview-vue-samples',
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
plugins: [
|
|
77
|
-
// fullReload('node_modules/@shijiu/**/*'),
|
|
78
|
-
// wasm(),
|
|
79
|
-
],
|
|
80
|
-
resolve: {
|
|
81
|
-
alias: {
|
|
82
|
-
// 'jsview': path.resolve(process.cwd(), 'node_modules/@shijiu/jsview'),
|
|
83
|
-
'jsview-vue': path.resolve(process.cwd(), 'node_modules/@shijiu/jsview-vue'),
|
|
84
|
-
'jsview-vue-samples': path.resolve(process.cwd(), 'node_modules/@shijiu/jsview-vue-samples'),
|
|
85
|
-
'jsview-react': path.resolve(process.cwd(), 'node_modules/@shijiu/jsview-react'),
|
|
86
|
-
'jsview-react-samples': path.resolve(process.cwd(), 'node_modules/@shijiu/jsview-react-samples'),
|
|
87
|
-
'/js/main.jsv.mjs': path.resolve(process.cwd(), 'node_modules/@shijiu/jsview/loader/jsview-main.mjs'),
|
|
88
|
-
},
|
|
89
|
-
preserveSymlinks: true
|
|
90
|
-
},
|
|
91
|
-
server: {
|
|
92
|
-
headers: { // 启用浏览器SharedArrayBuffer,webassmbly的thread用
|
|
93
|
-
'Cross-Origin-Opener-Policy': 'same-origin',
|
|
94
|
-
'Cross-Origin-Embedder-Policy': 'require-corp',
|
|
95
|
-
},
|
|
96
|
-
host: true,
|
|
97
|
-
https: process.env['JSVIEW_ENABLE_HTTPS'] ? getHttpsConfig() : false,
|
|
98
|
-
open: !process.env['JSVIEW_DISABLE_OPEN_BROWSER'] && process.platform === "darwin",
|
|
99
|
-
watch: {
|
|
100
|
-
ignored: [
|
|
101
|
-
'!**/node_modules/@shijiu/**',
|
|
102
|
-
],
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
worker: {
|
|
106
|
-
format: 'esm',
|
|
107
|
-
rollupOptions: {
|
|
108
|
-
output: {
|
|
109
|
-
assetFileNames: getFileName,
|
|
110
|
-
chunkFileNames: getFileName,
|
|
111
|
-
entryFileNames: getFileName,
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
function getModuleDir() {
|
|
118
|
-
const moduleDir = path.resolve(process.cwd(), 'node_modules');
|
|
119
|
-
return moduleDir;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function ensureFramework(originConfig) {
|
|
123
|
-
const checkFramework = function (name) {
|
|
124
|
-
if (name.indexOf('vue') >= 0) {
|
|
125
|
-
return 'vue';
|
|
126
|
-
} else if (name.indexOf('react') >= 0) {
|
|
127
|
-
return 'react';
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return null;
|
|
131
|
-
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
let framework = 'unknown';
|
|
135
|
-
for (const plugins of originConfig.plugins) {
|
|
136
|
-
if (Array.isArray(plugins)) {
|
|
137
|
-
for (const plugin of plugins) {
|
|
138
|
-
framework = checkFramework(plugin.name);
|
|
139
|
-
if (framework) {
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
} else {
|
|
144
|
-
const plugin = plugins;
|
|
145
|
-
framework = checkFramework(plugin.name);
|
|
146
|
-
}
|
|
147
|
-
if (framework) {
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return framework;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function getFileName(chunkInfo) {
|
|
156
|
-
if(chunkInfo.name.endsWith('.css')) {
|
|
157
|
-
return 'css/[name].[hash].css';
|
|
158
|
-
} else if(chunkInfo.name.endsWith('.ttf')) {
|
|
159
|
-
return 'assets/[name].ttf';
|
|
160
|
-
} else if(chunkInfo.name.endsWith('.wasm')) {
|
|
161
|
-
return 'js/[name].wasm';
|
|
162
|
-
} else if(chunkInfo.type == 'chunk') {
|
|
163
|
-
return (process.env['JSVIEW_KEEP_CHUNKNAME'] ? 'js/[name].[hash].js' : 'js/chunk.jsv2.[hash].js');
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return 'assets/[name].[hash].[ext]'
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function onRollupWarning(warning, defaultHandler) {
|
|
170
|
-
if (warning.code === 'FILE_NAME_CONFLICT') {
|
|
171
|
-
if(warning.message.includes('jsview-dom-browser-forge')
|
|
172
|
-
&& warning.message.includes('.wasm')) {
|
|
173
|
-
console.info('\nJsView Info: Ignore warning', warning.message)
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
} else if (warning.code === 'EVAL') {
|
|
177
|
-
if(warning.message.includes('mock.js')) {
|
|
178
|
-
console.info('\nJsView Info: Ignore warning', warning.message)
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
defaultHandler(warning);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function getHttpsConfig() {
|
|
187
|
-
const configDir = path.resolve(getModuleDir(), '@shijiu/jsview/tools/https-server-config');
|
|
188
|
-
const certFilePath = path.resolve(configDir, 'cert.pem');
|
|
189
|
-
const keyFilePath = path.resolve(configDir, 'key.pem');
|
|
190
|
-
|
|
191
|
-
return {
|
|
192
|
-
cert: fs.readFileSync(certFilePath),
|
|
193
|
-
key: fs.readFileSync(keyFilePath),
|
|
194
|
-
maxVersion: 'TLSv1.2',
|
|
195
|
-
minVersion: 'TLSv1',
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function jsvCreateJsViewViteConfig(originConfig) {
|
|
200
|
-
let aliasJsView;
|
|
201
|
-
|
|
202
|
-
const moduleDir = getModuleDir();
|
|
203
|
-
const framework = ensureFramework(originConfig);
|
|
204
|
-
switch (framework) {
|
|
205
|
-
case 'vue':
|
|
206
|
-
aliasJsView = path.resolve(moduleDir, '@shijiu/jsview-vue');
|
|
207
|
-
break;
|
|
208
|
-
case 'react':
|
|
209
|
-
aliasJsView = path.resolve(moduleDir, '@shijiu/jsview-react');
|
|
210
|
-
break;
|
|
211
|
-
default:
|
|
212
|
-
throw new Error('JsView Error: Failed to support framework: ' + framework);
|
|
213
|
-
}
|
|
214
|
-
jsviewConfig.resolve.alias['jsview'] = aliasJsView;
|
|
215
|
-
|
|
216
|
-
if(process.env['JSVIEW_DISABLE_MANUALCHUNKS']) {
|
|
217
|
-
delete jsviewConfig.build.rollupOptions.output.manualChunks
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// 解决templete工程中没有mockjs导致的报错。
|
|
221
|
-
const mockjs = path.resolve(moduleDir, 'mockjs');
|
|
222
|
-
if(fs.existsSync(mockjs)) {
|
|
223
|
-
jsviewConfig.optimizeDeps.include.push('mockjs');
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
return jsviewConfig;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
function jsvSaveUrlToCache(urls) {
|
|
230
|
-
if ((urls?.network?.length ?? -1 )<= 0) {
|
|
231
|
-
console.error("JsView Error: Failed to find network info.");
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
const moduleDir = getModuleDir();
|
|
236
|
-
const urlCacheDir = path.resolve(moduleDir, '.vite', 'jsview')
|
|
237
|
-
const urlCacheFilePath = path.resolve(urlCacheDir, 'network.mjs')
|
|
238
|
-
fs.mkdirSync(urlCacheDir, { recursive: true });
|
|
239
|
-
fs.writeFileSync(urlCacheFilePath, `export default "${urls.network[0]}"`)
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
export {
|
|
243
|
-
jsvCreateJsViewViteConfig,
|
|
244
|
-
jsvSaveUrlToCache,
|
|
245
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vite",
|
|
3
|
-
"version": "4.0.0",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"author": "Evan You",
|
|
7
|
-
"description": "Native-ESM powered web dev build tool",
|
|
8
|
-
"bin": {
|
|
9
|
-
"vite": "bin/vite.js"
|
|
10
|
-
},
|
|
11
|
-
"main": "./dist/node/index.js",
|
|
12
|
-
"module": "./dist/node/index.js",
|
|
13
|
-
"types": "./dist/node/index.d.ts",
|
|
14
|
-
"exports": {
|
|
15
|
-
".": {
|
|
16
|
-
"types": "./dist/node/index.d.ts",
|
|
17
|
-
"import": "./dist/node/index.js",
|
|
18
|
-
"require": "./index.cjs"
|
|
19
|
-
},
|
|
20
|
-
"./client": {
|
|
21
|
-
"types": "./client.d.ts"
|
|
22
|
-
},
|
|
23
|
-
"./dist/client/*": "./dist/client/*",
|
|
24
|
-
"./package.json": "./package.json"
|
|
25
|
-
},
|
|
26
|
-
"files": [
|
|
27
|
-
"bin",
|
|
28
|
-
"dist",
|
|
29
|
-
"client.d.ts",
|
|
30
|
-
"index.cjs",
|
|
31
|
-
"types"
|
|
32
|
-
],
|
|
33
|
-
"engines": {
|
|
34
|
-
"node": "^14.18.0 || >=16.0.0"
|
|
35
|
-
},
|
|
36
|
-
"repository": {
|
|
37
|
-
"type": "git",
|
|
38
|
-
"url": "git+https://github.com/vitejs/vite.git",
|
|
39
|
-
"directory": "packages/vite"
|
|
40
|
-
},
|
|
41
|
-
"bugs": {
|
|
42
|
-
"url": "https://github.com/vitejs/vite/issues"
|
|
43
|
-
},
|
|
44
|
-
"homepage": "https://github.com/vitejs/vite/tree/main/#readme",
|
|
45
|
-
"scripts": {
|
|
46
|
-
"dev": "rimraf dist && pnpm run build-bundle -w",
|
|
47
|
-
"build": "rimraf dist && run-s build-bundle build-types",
|
|
48
|
-
"build-bundle": "rollup --config rollup.config.ts --configPlugin typescript",
|
|
49
|
-
"build-types": "run-s build-types-temp build-types-pre-patch build-types-roll build-types-post-patch build-types-check",
|
|
50
|
-
"build-types-temp": "tsc --emitDeclarationOnly --outDir temp/node -p src/node",
|
|
51
|
-
"build-types-pre-patch": "tsx scripts/prePatchTypes.ts",
|
|
52
|
-
"build-types-roll": "api-extractor run && rimraf temp",
|
|
53
|
-
"build-types-post-patch": "tsx scripts/postPatchTypes.ts",
|
|
54
|
-
"build-types-check": "tsx scripts/checkBuiltTypes.ts && tsc --project tsconfig.check.json",
|
|
55
|
-
"lint": "eslint --cache --ext .ts src/**",
|
|
56
|
-
"format": "prettier --write --cache --parser typescript \"src/**/*.ts\"",
|
|
57
|
-
"prepublishOnly": "npm run build"
|
|
58
|
-
},
|
|
59
|
-
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
|
|
60
|
-
"dependencies": {
|
|
61
|
-
"esbuild": "^0.16.3",
|
|
62
|
-
"postcss": "^8.4.19",
|
|
63
|
-
"resolve": "^1.22.1",
|
|
64
|
-
"rollup": "^3.7.0"
|
|
65
|
-
},
|
|
66
|
-
"optionalDependencies": {
|
|
67
|
-
"fsevents": "~2.3.2"
|
|
68
|
-
},
|
|
69
|
-
"devDependencies": {
|
|
70
|
-
"@ampproject/remapping": "^2.2.0",
|
|
71
|
-
"@babel/parser": "^7.20.5",
|
|
72
|
-
"@babel/types": "^7.20.5",
|
|
73
|
-
"@jridgewell/trace-mapping": "^0.3.17",
|
|
74
|
-
"@rollup/plugin-alias": "^4.0.2",
|
|
75
|
-
"@rollup/plugin-commonjs": "^23.0.3",
|
|
76
|
-
"@rollup/plugin-dynamic-import-vars": "^2.0.1",
|
|
77
|
-
"@rollup/plugin-json": "^5.0.2",
|
|
78
|
-
"@rollup/plugin-node-resolve": "15.0.1",
|
|
79
|
-
"@rollup/plugin-typescript": "^10.0.1",
|
|
80
|
-
"@rollup/pluginutils": "^5.0.2",
|
|
81
|
-
"acorn": "^8.8.1",
|
|
82
|
-
"acorn-walk": "^8.2.0",
|
|
83
|
-
"cac": "^6.7.14",
|
|
84
|
-
"chokidar": "^3.5.3",
|
|
85
|
-
"connect": "^3.7.0",
|
|
86
|
-
"connect-history-api-fallback": "^2.0.0",
|
|
87
|
-
"convert-source-map": "^1.9.0",
|
|
88
|
-
"cors": "^2.8.5",
|
|
89
|
-
"cross-spawn": "^7.0.3",
|
|
90
|
-
"debug": "^4.3.4",
|
|
91
|
-
"dep-types": "link:./src/types",
|
|
92
|
-
"dotenv": "^16.0.3",
|
|
93
|
-
"dotenv-expand": "^9.0.0",
|
|
94
|
-
"es-module-lexer": "^1.1.0",
|
|
95
|
-
"estree-walker": "^3.0.1",
|
|
96
|
-
"etag": "^1.8.1",
|
|
97
|
-
"fast-glob": "^3.2.12",
|
|
98
|
-
"http-proxy": "^1.18.1",
|
|
99
|
-
"launch-editor-middleware": "^2.6.0",
|
|
100
|
-
"magic-string": "^0.27.0",
|
|
101
|
-
"micromatch": "^4.0.5",
|
|
102
|
-
"mlly": "^0.5.17",
|
|
103
|
-
"mrmime": "^1.0.1",
|
|
104
|
-
"okie": "^1.0.1",
|
|
105
|
-
"open": "^8.4.0",
|
|
106
|
-
"parse5": "^7.1.2",
|
|
107
|
-
"periscopic": "^3.0.4",
|
|
108
|
-
"picocolors": "^1.0.0",
|
|
109
|
-
"picomatch": "^2.3.1",
|
|
110
|
-
"postcss-import": "^15.0.1",
|
|
111
|
-
"postcss-load-config": "^4.0.1",
|
|
112
|
-
"postcss-modules": "^6.0.0",
|
|
113
|
-
"resolve.exports": "^1.1.0",
|
|
114
|
-
"sirv": "^2.0.2",
|
|
115
|
-
"source-map-js": "^1.0.2",
|
|
116
|
-
"source-map-support": "^0.5.21",
|
|
117
|
-
"strip-ansi": "^7.0.1",
|
|
118
|
-
"strip-literal": "^0.4.2",
|
|
119
|
-
"tsconfck": "^2.0.1",
|
|
120
|
-
"tslib": "^2.4.1",
|
|
121
|
-
"types": "link:./types",
|
|
122
|
-
"ufo": "^0.8.6",
|
|
123
|
-
"ws": "^8.11.0"
|
|
124
|
-
},
|
|
125
|
-
"peerDependencies": {
|
|
126
|
-
"@types/node": ">= 14",
|
|
127
|
-
"less": "*",
|
|
128
|
-
"sass": "*",
|
|
129
|
-
"stylus": "*",
|
|
130
|
-
"sugarss": "*",
|
|
131
|
-
"terser": "^5.4.0"
|
|
132
|
-
},
|
|
133
|
-
"peerDependenciesMeta": {
|
|
134
|
-
"@types/node": {
|
|
135
|
-
"optional": true
|
|
136
|
-
},
|
|
137
|
-
"sass": {
|
|
138
|
-
"optional": true
|
|
139
|
-
},
|
|
140
|
-
"stylus": {
|
|
141
|
-
"optional": true
|
|
142
|
-
},
|
|
143
|
-
"less": {
|
|
144
|
-
"optional": true
|
|
145
|
-
},
|
|
146
|
-
"sugarss": {
|
|
147
|
-
"optional": true
|
|
148
|
-
},
|
|
149
|
-
"terser": {
|
|
150
|
-
"optional": true
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|