@vitejs/plugin-legacy 5.4.1 → 5.4.2
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 +1 -1
- package/dist/index.cjs +14 -2
- package/dist/index.mjs +14 -2
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -91,7 +91,7 @@ npm add -D terser
|
|
|
91
91
|
|
|
92
92
|
If `modernTargets` is not set, it is **not recommended** to use the `true` value (which uses auto-detection) because `core-js@3` is very aggressive in polyfill inclusions due to all the bleeding edge features it supports. Even when targeting native ESM support, it injects 15kb of polyfills!
|
|
93
93
|
|
|
94
|
-
If you don't have hard reliance on bleeding edge runtime features, it is not that hard to avoid having to use polyfills in the modern build altogether. Alternatively, consider setting `modernTargets` or using an on-demand service like
|
|
94
|
+
If you don't have hard reliance on bleeding edge runtime features, it is not that hard to avoid having to use polyfills in the modern build altogether. Alternatively, consider setting `modernTargets` or using an on-demand service like https://cdnjs.cloudflare.com/polyfill/ to only inject necessary polyfills based on actual browser user-agents (most modern browsers will need nothing!).
|
|
95
95
|
|
|
96
96
|
### `renderLegacyChunks`
|
|
97
97
|
|
package/dist/index.cjs
CHANGED
|
@@ -142,7 +142,7 @@ function toOutputFilePathInHtml(filename, type, hostId, hostType, config, toRela
|
|
|
142
142
|
if (relative && !config.build.ssr) {
|
|
143
143
|
return toRelative(filename, hostId);
|
|
144
144
|
} else {
|
|
145
|
-
return config.
|
|
145
|
+
return joinUrlSegments(config.decodedBase, filename);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
function getBaseInHTML(urlRelativePath, config) {
|
|
@@ -151,6 +151,18 @@ function getBaseInHTML(urlRelativePath, config) {
|
|
|
151
151
|
"./"
|
|
152
152
|
) : config.base;
|
|
153
153
|
}
|
|
154
|
+
function joinUrlSegments(a, b) {
|
|
155
|
+
if (!a || !b) {
|
|
156
|
+
return a || b || "";
|
|
157
|
+
}
|
|
158
|
+
if (a[a.length - 1] === "/") {
|
|
159
|
+
a = a.substring(0, a.length - 1);
|
|
160
|
+
}
|
|
161
|
+
if (b[0] !== "/") {
|
|
162
|
+
b = "/" + b;
|
|
163
|
+
}
|
|
164
|
+
return a + b;
|
|
165
|
+
}
|
|
154
166
|
function toAssetPathFromHtml(filename, htmlPath, config) {
|
|
155
167
|
const relativeUrlPath = vite.normalizePath(path__default.relative(config.root, htmlPath));
|
|
156
168
|
const toRelative = (filename2, hostId) => getBaseInHTML(relativeUrlPath, config) + filename2;
|
|
@@ -166,7 +178,7 @@ function toAssetPathFromHtml(filename, htmlPath, config) {
|
|
|
166
178
|
const legacyEnvVarMarker = `__VITE_IS_LEGACY__`;
|
|
167
179
|
const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
168
180
|
const nonLeadingHashInFileNameRE = /[^/]+\[hash(?::\d+)?\]/;
|
|
169
|
-
const prefixedHashInFileNameRE = /\W?\[hash(
|
|
181
|
+
const prefixedHashInFileNameRE = /\W?\[hash(?::\d+)?\]/;
|
|
170
182
|
function viteLegacyPlugin(options = {}) {
|
|
171
183
|
let config;
|
|
172
184
|
let targets;
|
package/dist/index.mjs
CHANGED
|
@@ -130,7 +130,7 @@ function toOutputFilePathInHtml(filename, type, hostId, hostType, config, toRela
|
|
|
130
130
|
if (relative && !config.build.ssr) {
|
|
131
131
|
return toRelative(filename, hostId);
|
|
132
132
|
} else {
|
|
133
|
-
return config.
|
|
133
|
+
return joinUrlSegments(config.decodedBase, filename);
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
function getBaseInHTML(urlRelativePath, config) {
|
|
@@ -139,6 +139,18 @@ function getBaseInHTML(urlRelativePath, config) {
|
|
|
139
139
|
"./"
|
|
140
140
|
) : config.base;
|
|
141
141
|
}
|
|
142
|
+
function joinUrlSegments(a, b) {
|
|
143
|
+
if (!a || !b) {
|
|
144
|
+
return a || b || "";
|
|
145
|
+
}
|
|
146
|
+
if (a[a.length - 1] === "/") {
|
|
147
|
+
a = a.substring(0, a.length - 1);
|
|
148
|
+
}
|
|
149
|
+
if (b[0] !== "/") {
|
|
150
|
+
b = "/" + b;
|
|
151
|
+
}
|
|
152
|
+
return a + b;
|
|
153
|
+
}
|
|
142
154
|
function toAssetPathFromHtml(filename, htmlPath, config) {
|
|
143
155
|
const relativeUrlPath = normalizePath(path.relative(config.root, htmlPath));
|
|
144
156
|
const toRelative = (filename2, hostId) => getBaseInHTML(relativeUrlPath, config) + filename2;
|
|
@@ -154,7 +166,7 @@ function toAssetPathFromHtml(filename, htmlPath, config) {
|
|
|
154
166
|
const legacyEnvVarMarker = `__VITE_IS_LEGACY__`;
|
|
155
167
|
const _require = createRequire(import.meta.url);
|
|
156
168
|
const nonLeadingHashInFileNameRE = /[^/]+\[hash(?::\d+)?\]/;
|
|
157
|
-
const prefixedHashInFileNameRE = /\W?\[hash(
|
|
169
|
+
const prefixedHashInFileNameRE = /\W?\[hash(?::\d+)?\]/;
|
|
158
170
|
function viteLegacyPlugin(options = {}) {
|
|
159
171
|
let config;
|
|
160
172
|
let targets;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/plugin-legacy",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Evan You",
|
|
6
6
|
"files": [
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-legacy#readme",
|
|
36
36
|
"funding": "https://github.com/vitejs/vite?sponsor=1",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@babel/core": "^7.
|
|
39
|
-
"@babel/preset-env": "^7.
|
|
40
|
-
"browserslist": "^4.23.
|
|
38
|
+
"@babel/core": "^7.25.2",
|
|
39
|
+
"@babel/preset-env": "^7.25.3",
|
|
40
|
+
"browserslist": "^4.23.3",
|
|
41
41
|
"browserslist-to-esbuild": "^2.1.1",
|
|
42
|
-
"core-js": "^3.
|
|
43
|
-
"magic-string": "^0.30.
|
|
42
|
+
"core-js": "^3.38.0",
|
|
43
|
+
"magic-string": "^0.30.11",
|
|
44
44
|
"regenerator-runtime": "^0.14.1",
|
|
45
45
|
"systemjs": "^6.15.1"
|
|
46
46
|
},
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"vite": "^5.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"acorn": "^8.
|
|
52
|
+
"acorn": "^8.12.1",
|
|
53
53
|
"picocolors": "^1.0.1",
|
|
54
54
|
"unbuild": "^2.0.0",
|
|
55
|
-
"vite": "5.
|
|
55
|
+
"vite": "5.4.1"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"dev": "unbuild --stub",
|