@vitejs/plugin-legacy 8.0.0-beta.1 → 8.0.0-beta.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/dist/index.js +15 -8
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import path
|
|
2
|
+
import path from "node:path";
|
|
3
3
|
import crypto from "node:crypto";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { build, normalizePath } from "vite";
|
|
6
6
|
import MagicString from "magic-string";
|
|
7
7
|
import browserslist from "browserslist";
|
|
8
8
|
|
|
9
|
-
//#region
|
|
9
|
+
//#region \0rolldown/runtime.js
|
|
10
10
|
var __create = Object.create;
|
|
11
11
|
var __defProp = Object.defineProperty;
|
|
12
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -141,7 +141,7 @@ function toOutputFilePathInHtml(filename, type, hostId, hostType, config, toRela
|
|
|
141
141
|
else return joinUrlSegments(config.decodedBase, filename);
|
|
142
142
|
}
|
|
143
143
|
function getBaseInHTML(urlRelativePath, config) {
|
|
144
|
-
return config.base === "./" || config.base === "" ? path
|
|
144
|
+
return config.base === "./" || config.base === "" ? path.posix.join(path.posix.relative(urlRelativePath, "").slice(0, -2), "./") : config.base;
|
|
145
145
|
}
|
|
146
146
|
function joinUrlSegments(a, b) {
|
|
147
147
|
if (!a || !b) return a || b || "";
|
|
@@ -150,7 +150,7 @@ function joinUrlSegments(a, b) {
|
|
|
150
150
|
return a + b;
|
|
151
151
|
}
|
|
152
152
|
function toAssetPathFromHtml(filename, htmlPath, config) {
|
|
153
|
-
const relativeUrlPath = normalizePath(path
|
|
153
|
+
const relativeUrlPath = normalizePath(path.relative(config.root, htmlPath));
|
|
154
154
|
const toRelative = (filename, _hostId) => getBaseInHTML(relativeUrlPath, config) + filename;
|
|
155
155
|
return toOutputFilePathInHtml(filename, "asset", htmlPath, "html", config, toRelative);
|
|
156
156
|
}
|
|
@@ -262,7 +262,7 @@ function viteLegacyPlugin(options = {}) {
|
|
|
262
262
|
targets = options.targets || browserslistLoadConfig({ path: config.root }) || "last 2 versions and not dead, > 0.3%, Firefox ESR";
|
|
263
263
|
if (isDebug) console.log(`[@vitejs/plugin-legacy] targets:`, targets);
|
|
264
264
|
const getLegacyOutputFileName = (fileNames, defaultFileName = "[name]-legacy-[hash].js") => {
|
|
265
|
-
if (!fileNames) return path
|
|
265
|
+
if (!fileNames) return path.posix.join(config.build.assetsDir, defaultFileName);
|
|
266
266
|
return (chunkInfo) => {
|
|
267
267
|
let fileName = typeof fileNames === "function" ? fileNames(chunkInfo) : fileNames;
|
|
268
268
|
if (fileName.includes("[name]")) fileName = fileName.replace("[name]", "[name]-legacy");
|
|
@@ -472,7 +472,7 @@ async function buildPolyfillChunk(ctx, mode, imports, bundle, facadeToChunkMap,
|
|
|
472
472
|
minify = minify ? "terser" : false;
|
|
473
473
|
const res = await build({
|
|
474
474
|
mode,
|
|
475
|
-
root: path
|
|
475
|
+
root: path.dirname(fileURLToPath(import.meta.url)),
|
|
476
476
|
configFile: false,
|
|
477
477
|
logLevel: "error",
|
|
478
478
|
plugins: [polyfillsPlugin(imports, excludeSystemJS), prependModenChunkLegacyGuard && prependModenChunkLegacyGuardPlugin()],
|
|
@@ -502,9 +502,16 @@ async function buildPolyfillChunk(ctx, mode, imports, bundle, facadeToChunkMap,
|
|
|
502
502
|
if (chunk.type === "chunk" && chunk.facadeModuleId) facadeToChunkMap.set(chunk.facadeModuleId, polyfillChunk.fileName);
|
|
503
503
|
}
|
|
504
504
|
ctx.emitFile({
|
|
505
|
-
type: "
|
|
505
|
+
type: "prebuilt-chunk",
|
|
506
|
+
name: polyfillChunk.name,
|
|
506
507
|
fileName: polyfillChunk.fileName,
|
|
507
|
-
|
|
508
|
+
code: polyfillChunk.code,
|
|
509
|
+
facadeModuleId: polyfillChunk.facadeModuleId ?? void 0,
|
|
510
|
+
isEntry: polyfillChunk.isEntry,
|
|
511
|
+
isDynamicEntry: polyfillChunk.isDynamicEntry,
|
|
512
|
+
exports: [],
|
|
513
|
+
map: polyfillChunk.map ?? void 0,
|
|
514
|
+
sourcemapFileName: polyfillChunk.sourcemapFileName ?? void 0
|
|
508
515
|
});
|
|
509
516
|
if (polyfillChunk.sourcemapFileName) {
|
|
510
517
|
const polyfillChunkMapAsset = _polyfillChunk.output.find((chunk) => chunk.type === "asset" && chunk.fileName === polyfillChunk.sourcemapFileName);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/plugin-legacy",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Evan You",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-legacy#readme",
|
|
29
29
|
"funding": "https://github.com/vitejs/vite?sponsor=1",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@babel/core": "^7.
|
|
31
|
+
"@babel/core": "^7.29.0",
|
|
32
32
|
"@babel/plugin-transform-dynamic-import": "^7.27.1",
|
|
33
|
-
"@babel/plugin-transform-modules-systemjs": "^7.
|
|
34
|
-
"@babel/preset-env": "^7.
|
|
35
|
-
"babel-plugin-polyfill-corejs3": "^0.
|
|
36
|
-
"babel-plugin-polyfill-regenerator": "^0.6.
|
|
33
|
+
"@babel/plugin-transform-modules-systemjs": "^7.29.0",
|
|
34
|
+
"@babel/preset-env": "^7.29.0",
|
|
35
|
+
"babel-plugin-polyfill-corejs3": "^0.14.0",
|
|
36
|
+
"babel-plugin-polyfill-regenerator": "^0.6.6",
|
|
37
37
|
"browserslist": "^4.28.1",
|
|
38
38
|
"browserslist-to-esbuild": "^2.1.1",
|
|
39
|
-
"core-js": "^3.
|
|
39
|
+
"core-js": "^3.48.0",
|
|
40
40
|
"magic-string": "^0.30.21",
|
|
41
41
|
"regenerator-runtime": "^0.14.1",
|
|
42
42
|
"systemjs": "^6.15.1"
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"acorn": "^8.15.0",
|
|
50
50
|
"picocolors": "^1.1.1",
|
|
51
|
-
"tsdown": "^0.
|
|
52
|
-
"vite": "8.0.0-beta.
|
|
51
|
+
"tsdown": "^0.20.1",
|
|
52
|
+
"vite": "8.0.0-beta.12"
|
|
53
53
|
},
|
|
54
54
|
"compatiblePackages": {
|
|
55
55
|
"schemaVersion": 1,
|