@vitejs/plugin-legacy 5.4.3 → 6.0.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/dist/index.cjs +79 -76
- package/dist/index.mjs +79 -76
- package/package.json +13 -12
package/dist/index.cjs
CHANGED
|
@@ -24,83 +24,90 @@ function getDefaultExportFromCjs (x) {
|
|
|
24
24
|
|
|
25
25
|
var picocolors = {exports: {}};
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
let isColorSupported =
|
|
29
|
-
!(!!env.NO_COLOR || argv.includes("--no-color")) &&
|
|
30
|
-
(!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || ((p.stdout || {}).isTTY && env.TERM !== "dumb") || !!env.CI);
|
|
27
|
+
var hasRequiredPicocolors;
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
function requirePicocolors () {
|
|
30
|
+
if (hasRequiredPicocolors) return picocolors.exports;
|
|
31
|
+
hasRequiredPicocolors = 1;
|
|
32
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
33
|
+
let isColorSupported =
|
|
34
|
+
!(!!env.NO_COLOR || argv.includes("--no-color")) &&
|
|
35
|
+
(!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || ((p.stdout || {}).isTTY && env.TERM !== "dumb") || !!env.CI);
|
|
37
36
|
|
|
38
|
-
let
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
index = string.indexOf(close, cursor);
|
|
44
|
-
} while (~index)
|
|
45
|
-
return result + string.substring(cursor)
|
|
46
|
-
};
|
|
37
|
+
let formatter = (open, close, replace = open) =>
|
|
38
|
+
input => {
|
|
39
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
40
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close
|
|
41
|
+
};
|
|
47
42
|
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
58
|
-
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
59
|
-
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
43
|
+
let replaceClose = (string, close, replace, index) => {
|
|
44
|
+
let result = "", cursor = 0;
|
|
45
|
+
do {
|
|
46
|
+
result += string.substring(cursor, index) + replace;
|
|
47
|
+
cursor = index + close.length;
|
|
48
|
+
index = string.indexOf(close, cursor);
|
|
49
|
+
} while (~index)
|
|
50
|
+
return result + string.substring(cursor)
|
|
51
|
+
};
|
|
60
52
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
53
|
+
let createColors = (enabled = isColorSupported) => {
|
|
54
|
+
let f = enabled ? formatter : () => String;
|
|
55
|
+
return {
|
|
56
|
+
isColorSupported: enabled,
|
|
57
|
+
reset: f("\x1b[0m", "\x1b[0m"),
|
|
58
|
+
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
|
59
|
+
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
|
60
|
+
italic: f("\x1b[3m", "\x1b[23m"),
|
|
61
|
+
underline: f("\x1b[4m", "\x1b[24m"),
|
|
62
|
+
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
63
|
+
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
64
|
+
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
70
65
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
black: f("\x1b[30m", "\x1b[39m"),
|
|
67
|
+
red: f("\x1b[31m", "\x1b[39m"),
|
|
68
|
+
green: f("\x1b[32m", "\x1b[39m"),
|
|
69
|
+
yellow: f("\x1b[33m", "\x1b[39m"),
|
|
70
|
+
blue: f("\x1b[34m", "\x1b[39m"),
|
|
71
|
+
magenta: f("\x1b[35m", "\x1b[39m"),
|
|
72
|
+
cyan: f("\x1b[36m", "\x1b[39m"),
|
|
73
|
+
white: f("\x1b[37m", "\x1b[39m"),
|
|
74
|
+
gray: f("\x1b[90m", "\x1b[39m"),
|
|
79
75
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
bgBlack: f("\x1b[40m", "\x1b[49m"),
|
|
77
|
+
bgRed: f("\x1b[41m", "\x1b[49m"),
|
|
78
|
+
bgGreen: f("\x1b[42m", "\x1b[49m"),
|
|
79
|
+
bgYellow: f("\x1b[43m", "\x1b[49m"),
|
|
80
|
+
bgBlue: f("\x1b[44m", "\x1b[49m"),
|
|
81
|
+
bgMagenta: f("\x1b[45m", "\x1b[49m"),
|
|
82
|
+
bgCyan: f("\x1b[46m", "\x1b[49m"),
|
|
83
|
+
bgWhite: f("\x1b[47m", "\x1b[49m"),
|
|
88
84
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
};
|
|
85
|
+
blackBright: f("\x1b[90m", "\x1b[39m"),
|
|
86
|
+
redBright: f("\x1b[91m", "\x1b[39m"),
|
|
87
|
+
greenBright: f("\x1b[92m", "\x1b[39m"),
|
|
88
|
+
yellowBright: f("\x1b[93m", "\x1b[39m"),
|
|
89
|
+
blueBright: f("\x1b[94m", "\x1b[39m"),
|
|
90
|
+
magentaBright: f("\x1b[95m", "\x1b[39m"),
|
|
91
|
+
cyanBright: f("\x1b[96m", "\x1b[39m"),
|
|
92
|
+
whiteBright: f("\x1b[97m", "\x1b[39m"),
|
|
99
93
|
|
|
100
|
-
|
|
101
|
-
|
|
94
|
+
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
|
|
95
|
+
bgRedBright: f("\x1b[101m", "\x1b[49m"),
|
|
96
|
+
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
|
|
97
|
+
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
|
|
98
|
+
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
|
|
99
|
+
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
|
|
100
|
+
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
|
|
101
|
+
bgWhiteBright: f("\x1b[107m", "\x1b[49m"),
|
|
102
|
+
}
|
|
103
|
+
};
|
|
102
104
|
|
|
103
|
-
|
|
105
|
+
picocolors.exports = createColors();
|
|
106
|
+
picocolors.exports.createColors = createColors;
|
|
107
|
+
return picocolors.exports;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
var picocolorsExports = /*@__PURE__*/ requirePicocolors();
|
|
104
111
|
const colors = /*@__PURE__*/getDefaultExportFromCjs(picocolorsExports);
|
|
105
112
|
|
|
106
113
|
const safari10NoModuleFix = `!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();`;
|
|
@@ -503,15 +510,12 @@ function viteLegacyPlugin(options = {}) {
|
|
|
503
510
|
]
|
|
504
511
|
]
|
|
505
512
|
});
|
|
506
|
-
if (result)
|
|
507
|
-
return { code: result.code, map: result.map };
|
|
513
|
+
if (result) return { code: result.code, map: result.map };
|
|
508
514
|
return null;
|
|
509
515
|
},
|
|
510
516
|
transformIndexHtml(html, { chunk }) {
|
|
511
|
-
if (config.build.ssr)
|
|
512
|
-
|
|
513
|
-
if (!chunk)
|
|
514
|
-
return;
|
|
517
|
+
if (config.build.ssr) return;
|
|
518
|
+
if (!chunk) return;
|
|
515
519
|
if (chunk.fileName.includes("-legacy")) {
|
|
516
520
|
facadeToLegacyChunkMap.set(chunk.facadeModuleId, chunk.fileName);
|
|
517
521
|
if (genModern) {
|
|
@@ -721,8 +725,7 @@ async function buildPolyfillChunk(mode, imports, bundle, facadeToChunkMap, build
|
|
|
721
725
|
}
|
|
722
726
|
});
|
|
723
727
|
const _polyfillChunk = Array.isArray(res) ? res[0] : res;
|
|
724
|
-
if (!("output" in _polyfillChunk))
|
|
725
|
-
return;
|
|
728
|
+
if (!("output" in _polyfillChunk)) return;
|
|
726
729
|
const polyfillChunk = _polyfillChunk.output.find(
|
|
727
730
|
(chunk) => chunk.type === "chunk" && chunk.isEntry
|
|
728
731
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -12,83 +12,90 @@ function getDefaultExportFromCjs (x) {
|
|
|
12
12
|
|
|
13
13
|
var picocolors = {exports: {}};
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
let isColorSupported =
|
|
17
|
-
!(!!env.NO_COLOR || argv.includes("--no-color")) &&
|
|
18
|
-
(!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || ((p.stdout || {}).isTTY && env.TERM !== "dumb") || !!env.CI);
|
|
15
|
+
var hasRequiredPicocolors;
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
function requirePicocolors () {
|
|
18
|
+
if (hasRequiredPicocolors) return picocolors.exports;
|
|
19
|
+
hasRequiredPicocolors = 1;
|
|
20
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
21
|
+
let isColorSupported =
|
|
22
|
+
!(!!env.NO_COLOR || argv.includes("--no-color")) &&
|
|
23
|
+
(!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || ((p.stdout || {}).isTTY && env.TERM !== "dumb") || !!env.CI);
|
|
25
24
|
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
index = string.indexOf(close, cursor);
|
|
32
|
-
} while (~index)
|
|
33
|
-
return result + string.substring(cursor)
|
|
34
|
-
};
|
|
25
|
+
let formatter = (open, close, replace = open) =>
|
|
26
|
+
input => {
|
|
27
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
28
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close
|
|
29
|
+
};
|
|
35
30
|
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
46
|
-
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
47
|
-
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
31
|
+
let replaceClose = (string, close, replace, index) => {
|
|
32
|
+
let result = "", cursor = 0;
|
|
33
|
+
do {
|
|
34
|
+
result += string.substring(cursor, index) + replace;
|
|
35
|
+
cursor = index + close.length;
|
|
36
|
+
index = string.indexOf(close, cursor);
|
|
37
|
+
} while (~index)
|
|
38
|
+
return result + string.substring(cursor)
|
|
39
|
+
};
|
|
48
40
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
41
|
+
let createColors = (enabled = isColorSupported) => {
|
|
42
|
+
let f = enabled ? formatter : () => String;
|
|
43
|
+
return {
|
|
44
|
+
isColorSupported: enabled,
|
|
45
|
+
reset: f("\x1b[0m", "\x1b[0m"),
|
|
46
|
+
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
|
47
|
+
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
|
48
|
+
italic: f("\x1b[3m", "\x1b[23m"),
|
|
49
|
+
underline: f("\x1b[4m", "\x1b[24m"),
|
|
50
|
+
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
51
|
+
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
52
|
+
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
58
53
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
black: f("\x1b[30m", "\x1b[39m"),
|
|
55
|
+
red: f("\x1b[31m", "\x1b[39m"),
|
|
56
|
+
green: f("\x1b[32m", "\x1b[39m"),
|
|
57
|
+
yellow: f("\x1b[33m", "\x1b[39m"),
|
|
58
|
+
blue: f("\x1b[34m", "\x1b[39m"),
|
|
59
|
+
magenta: f("\x1b[35m", "\x1b[39m"),
|
|
60
|
+
cyan: f("\x1b[36m", "\x1b[39m"),
|
|
61
|
+
white: f("\x1b[37m", "\x1b[39m"),
|
|
62
|
+
gray: f("\x1b[90m", "\x1b[39m"),
|
|
67
63
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
64
|
+
bgBlack: f("\x1b[40m", "\x1b[49m"),
|
|
65
|
+
bgRed: f("\x1b[41m", "\x1b[49m"),
|
|
66
|
+
bgGreen: f("\x1b[42m", "\x1b[49m"),
|
|
67
|
+
bgYellow: f("\x1b[43m", "\x1b[49m"),
|
|
68
|
+
bgBlue: f("\x1b[44m", "\x1b[49m"),
|
|
69
|
+
bgMagenta: f("\x1b[45m", "\x1b[49m"),
|
|
70
|
+
bgCyan: f("\x1b[46m", "\x1b[49m"),
|
|
71
|
+
bgWhite: f("\x1b[47m", "\x1b[49m"),
|
|
76
72
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
};
|
|
73
|
+
blackBright: f("\x1b[90m", "\x1b[39m"),
|
|
74
|
+
redBright: f("\x1b[91m", "\x1b[39m"),
|
|
75
|
+
greenBright: f("\x1b[92m", "\x1b[39m"),
|
|
76
|
+
yellowBright: f("\x1b[93m", "\x1b[39m"),
|
|
77
|
+
blueBright: f("\x1b[94m", "\x1b[39m"),
|
|
78
|
+
magentaBright: f("\x1b[95m", "\x1b[39m"),
|
|
79
|
+
cyanBright: f("\x1b[96m", "\x1b[39m"),
|
|
80
|
+
whiteBright: f("\x1b[97m", "\x1b[39m"),
|
|
87
81
|
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
|
|
83
|
+
bgRedBright: f("\x1b[101m", "\x1b[49m"),
|
|
84
|
+
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
|
|
85
|
+
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
|
|
86
|
+
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
|
|
87
|
+
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
|
|
88
|
+
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
|
|
89
|
+
bgWhiteBright: f("\x1b[107m", "\x1b[49m"),
|
|
90
|
+
}
|
|
91
|
+
};
|
|
90
92
|
|
|
91
|
-
|
|
93
|
+
picocolors.exports = createColors();
|
|
94
|
+
picocolors.exports.createColors = createColors;
|
|
95
|
+
return picocolors.exports;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
var picocolorsExports = /*@__PURE__*/ requirePicocolors();
|
|
92
99
|
const colors = /*@__PURE__*/getDefaultExportFromCjs(picocolorsExports);
|
|
93
100
|
|
|
94
101
|
const safari10NoModuleFix = `!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();`;
|
|
@@ -491,15 +498,12 @@ function viteLegacyPlugin(options = {}) {
|
|
|
491
498
|
]
|
|
492
499
|
]
|
|
493
500
|
});
|
|
494
|
-
if (result)
|
|
495
|
-
return { code: result.code, map: result.map };
|
|
501
|
+
if (result) return { code: result.code, map: result.map };
|
|
496
502
|
return null;
|
|
497
503
|
},
|
|
498
504
|
transformIndexHtml(html, { chunk }) {
|
|
499
|
-
if (config.build.ssr)
|
|
500
|
-
|
|
501
|
-
if (!chunk)
|
|
502
|
-
return;
|
|
505
|
+
if (config.build.ssr) return;
|
|
506
|
+
if (!chunk) return;
|
|
503
507
|
if (chunk.fileName.includes("-legacy")) {
|
|
504
508
|
facadeToLegacyChunkMap.set(chunk.facadeModuleId, chunk.fileName);
|
|
505
509
|
if (genModern) {
|
|
@@ -709,8 +713,7 @@ async function buildPolyfillChunk(mode, imports, bundle, facadeToChunkMap, build
|
|
|
709
713
|
}
|
|
710
714
|
});
|
|
711
715
|
const _polyfillChunk = Array.isArray(res) ? res[0] : res;
|
|
712
|
-
if (!("output" in _polyfillChunk))
|
|
713
|
-
return;
|
|
716
|
+
if (!("output" in _polyfillChunk)) return;
|
|
714
717
|
const polyfillChunk = _polyfillChunk.output.find(
|
|
715
718
|
(chunk) => chunk.type === "chunk" && chunk.isEntry
|
|
716
719
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/plugin-legacy",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"license": "MIT",
|
|
5
6
|
"author": "Evan You",
|
|
6
7
|
"files": [
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
}
|
|
23
24
|
},
|
|
24
25
|
"engines": {
|
|
25
|
-
"node": "^18.0.0 ||
|
|
26
|
+
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
|
|
26
27
|
},
|
|
27
28
|
"repository": {
|
|
28
29
|
"type": "git",
|
|
@@ -35,24 +36,24 @@
|
|
|
35
36
|
"homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-legacy#readme",
|
|
36
37
|
"funding": "https://github.com/vitejs/vite?sponsor=1",
|
|
37
38
|
"dependencies": {
|
|
38
|
-
"@babel/core": "^7.
|
|
39
|
-
"@babel/preset-env": "^7.
|
|
40
|
-
"browserslist": "^4.24.
|
|
39
|
+
"@babel/core": "^7.26.0",
|
|
40
|
+
"@babel/preset-env": "^7.26.0",
|
|
41
|
+
"browserslist": "^4.24.2",
|
|
41
42
|
"browserslist-to-esbuild": "^2.1.1",
|
|
42
|
-
"core-js": "^3.
|
|
43
|
-
"magic-string": "^0.30.
|
|
43
|
+
"core-js": "^3.39.0",
|
|
44
|
+
"magic-string": "^0.30.13",
|
|
44
45
|
"regenerator-runtime": "^0.14.1",
|
|
45
46
|
"systemjs": "^6.15.1"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
|
-
"terser": "^5.
|
|
49
|
-
"vite": "^
|
|
49
|
+
"terser": "^5.16.0",
|
|
50
|
+
"vite": "^6.0.0"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"acorn": "^8.
|
|
53
|
+
"acorn": "^8.14.0",
|
|
53
54
|
"picocolors": "^1.1.1",
|
|
54
|
-
"unbuild": "^
|
|
55
|
-
"vite": "6.0.0
|
|
55
|
+
"unbuild": "^3.0.0-rc.11",
|
|
56
|
+
"vite": "6.0.0"
|
|
56
57
|
},
|
|
57
58
|
"scripts": {
|
|
58
59
|
"dev": "unbuild --stub",
|