@vitejs/plugin-legacy 4.1.0 → 5.0.0-beta.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/README.md +2 -2
- package/dist/index.cjs +4 -3
- package/dist/index.mjs +1 -1
- package/package.json +17 -18
package/README.md
CHANGED
|
@@ -73,14 +73,14 @@ npm add -D terser
|
|
|
73
73
|
- `browserslist` field in `package.json`
|
|
74
74
|
- `.browserslistrc` file in cwd.
|
|
75
75
|
|
|
76
|
-
Set to `
|
|
76
|
+
Set to `true` to ignore these sources.
|
|
77
77
|
|
|
78
78
|
### `modernPolyfills`
|
|
79
79
|
|
|
80
80
|
- **Type:** `boolean | string[]`
|
|
81
81
|
- **Default:** `false`
|
|
82
82
|
|
|
83
|
-
Defaults to `false`. Enabling this option will generate a separate polyfills chunk for the modern build (targeting browsers
|
|
83
|
+
Defaults to `false`. Enabling this option will generate a separate polyfills chunk for the modern build (targeting [browsers that support widely-available features](#browsers-that-supports-esm-but-does-not-support-widely-available-features)).
|
|
84
84
|
|
|
85
85
|
Set to a list of strings to explicitly control which polyfills to include. See [Polyfill Specifiers](#polyfill-specifiers) for details.
|
|
86
86
|
|
package/dist/index.cjs
CHANGED
|
@@ -11,6 +11,7 @@ const MagicString = require('magic-string');
|
|
|
11
11
|
const require$$0 = require('tty');
|
|
12
12
|
const browserslist = require('browserslist');
|
|
13
13
|
|
|
14
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
14
15
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
15
16
|
|
|
16
17
|
const path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
@@ -152,7 +153,7 @@ function toAssetPathFromHtml(filename, htmlPath, config) {
|
|
|
152
153
|
);
|
|
153
154
|
}
|
|
154
155
|
const legacyEnvVarMarker = `__VITE_IS_LEGACY__`;
|
|
155
|
-
const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (
|
|
156
|
+
const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
156
157
|
function viteLegacyPlugin(options = {}) {
|
|
157
158
|
let config;
|
|
158
159
|
let targets;
|
|
@@ -362,7 +363,7 @@ function viteLegacyPlugin(options = {}) {
|
|
|
362
363
|
if (config.build.sourcemap) {
|
|
363
364
|
return {
|
|
364
365
|
code: ms.toString(),
|
|
365
|
-
map: ms.generateMap({ hires:
|
|
366
|
+
map: ms.generateMap({ hires: "boundary" })
|
|
366
367
|
};
|
|
367
368
|
}
|
|
368
369
|
return {
|
|
@@ -592,7 +593,7 @@ async function buildPolyfillChunk(mode, imports, bundle, facadeToChunkMap, build
|
|
|
592
593
|
const res = await vite.build({
|
|
593
594
|
mode,
|
|
594
595
|
// so that everything is resolved from here
|
|
595
|
-
root: path__default.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (
|
|
596
|
+
root: path__default.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)))),
|
|
596
597
|
configFile: false,
|
|
597
598
|
logLevel: "error",
|
|
598
599
|
plugins: [polyfillsPlugin(imports, excludeSystemJS)],
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/plugin-legacy",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Evan You",
|
|
6
6
|
"files": [
|
|
@@ -22,14 +22,8 @@
|
|
|
22
22
|
"require": "./dist/index.cjs"
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"dev": "unbuild --stub",
|
|
27
|
-
"build": "unbuild && pnpm run patch-cjs",
|
|
28
|
-
"patch-cjs": "tsx ../../scripts/patchCJS.ts",
|
|
29
|
-
"prepublishOnly": "npm run build"
|
|
30
|
-
},
|
|
31
25
|
"engines": {
|
|
32
|
-
"node": "^
|
|
26
|
+
"node": "^18.0.0 || >=20.0.0"
|
|
33
27
|
},
|
|
34
28
|
"repository": {
|
|
35
29
|
"type": "git",
|
|
@@ -42,21 +36,26 @@
|
|
|
42
36
|
"homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-legacy#readme",
|
|
43
37
|
"funding": "https://github.com/vitejs/vite?sponsor=1",
|
|
44
38
|
"dependencies": {
|
|
45
|
-
"@babel/core": "^7.22.
|
|
46
|
-
"@babel/preset-env": "^7.22.
|
|
47
|
-
"browserslist": "^4.21.
|
|
48
|
-
"core-js": "^3.
|
|
49
|
-
"magic-string": "^0.30.
|
|
50
|
-
"regenerator-runtime": "^0.
|
|
51
|
-
"systemjs": "^6.14.
|
|
39
|
+
"@babel/core": "^7.22.20",
|
|
40
|
+
"@babel/preset-env": "^7.22.20",
|
|
41
|
+
"browserslist": "^4.21.10",
|
|
42
|
+
"core-js": "^3.32.2",
|
|
43
|
+
"magic-string": "^0.30.3",
|
|
44
|
+
"regenerator-runtime": "^0.14.0",
|
|
45
|
+
"systemjs": "^6.14.2"
|
|
52
46
|
},
|
|
53
47
|
"peerDependencies": {
|
|
54
48
|
"terser": "^5.4.0",
|
|
55
49
|
"vite": "^4.0.0"
|
|
56
50
|
},
|
|
57
51
|
"devDependencies": {
|
|
58
|
-
"acorn": "^8.
|
|
52
|
+
"acorn": "^8.10.0",
|
|
59
53
|
"picocolors": "^1.0.0",
|
|
60
|
-
"vite": "
|
|
54
|
+
"vite": "5.0.0-beta.2"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"dev": "unbuild --stub",
|
|
58
|
+
"build": "unbuild && pnpm run patch-cjs",
|
|
59
|
+
"patch-cjs": "tsx ../../scripts/patchCJS.ts"
|
|
61
60
|
}
|
|
62
|
-
}
|
|
61
|
+
}
|