@vitejs/plugin-legacy 5.4.3 → 6.0.1

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.
Files changed (3) hide show
  1. package/dist/index.cjs +85 -84
  2. package/dist/index.mjs +85 -84
  3. 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
- let p = process || {}, argv = p.argv || [], env = p.env || {};
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
- let formatter = (open, close, replace = open) =>
33
- input => {
34
- let string = "" + input, index = string.indexOf(close, open.length);
35
- return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close
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);
36
+
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
+ };
37
42
 
38
- let replaceClose = (string, close, replace, index) => {
39
- let result = "", cursor = 0;
40
- do {
41
- result += string.substring(cursor, index) + replace;
42
- cursor = index + close.length;
43
- index = string.indexOf(close, cursor);
44
- } while (~index)
45
- return result + string.substring(cursor)
46
- };
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
+ };
47
52
 
48
- let createColors = (enabled = isColorSupported) => {
49
- let f = enabled ? formatter : () => String;
50
- return {
51
- isColorSupported: enabled,
52
- reset: f("\x1b[0m", "\x1b[0m"),
53
- bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
54
- dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
55
- italic: f("\x1b[3m", "\x1b[23m"),
56
- underline: f("\x1b[4m", "\x1b[24m"),
57
- inverse: f("\x1b[7m", "\x1b[27m"),
58
- hidden: f("\x1b[8m", "\x1b[28m"),
59
- strikethrough: f("\x1b[9m", "\x1b[29m"),
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"),
60
65
 
61
- black: f("\x1b[30m", "\x1b[39m"),
62
- red: f("\x1b[31m", "\x1b[39m"),
63
- green: f("\x1b[32m", "\x1b[39m"),
64
- yellow: f("\x1b[33m", "\x1b[39m"),
65
- blue: f("\x1b[34m", "\x1b[39m"),
66
- magenta: f("\x1b[35m", "\x1b[39m"),
67
- cyan: f("\x1b[36m", "\x1b[39m"),
68
- white: f("\x1b[37m", "\x1b[39m"),
69
- gray: f("\x1b[90m", "\x1b[39m"),
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"),
70
75
 
71
- bgBlack: f("\x1b[40m", "\x1b[49m"),
72
- bgRed: f("\x1b[41m", "\x1b[49m"),
73
- bgGreen: f("\x1b[42m", "\x1b[49m"),
74
- bgYellow: f("\x1b[43m", "\x1b[49m"),
75
- bgBlue: f("\x1b[44m", "\x1b[49m"),
76
- bgMagenta: f("\x1b[45m", "\x1b[49m"),
77
- bgCyan: f("\x1b[46m", "\x1b[49m"),
78
- bgWhite: f("\x1b[47m", "\x1b[49m"),
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"),
79
84
 
80
- blackBright: f("\x1b[90m", "\x1b[39m"),
81
- redBright: f("\x1b[91m", "\x1b[39m"),
82
- greenBright: f("\x1b[92m", "\x1b[39m"),
83
- yellowBright: f("\x1b[93m", "\x1b[39m"),
84
- blueBright: f("\x1b[94m", "\x1b[39m"),
85
- magentaBright: f("\x1b[95m", "\x1b[39m"),
86
- cyanBright: f("\x1b[96m", "\x1b[39m"),
87
- whiteBright: f("\x1b[97m", "\x1b[39m"),
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"),
88
93
 
89
- bgBlackBright: f("\x1b[100m", "\x1b[49m"),
90
- bgRedBright: f("\x1b[101m", "\x1b[49m"),
91
- bgGreenBright: f("\x1b[102m", "\x1b[49m"),
92
- bgYellowBright: f("\x1b[103m", "\x1b[49m"),
93
- bgBlueBright: f("\x1b[104m", "\x1b[49m"),
94
- bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
95
- bgCyanBright: f("\x1b[106m", "\x1b[49m"),
96
- bgWhiteBright: f("\x1b[107m", "\x1b[49m"),
97
- }
98
- };
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
+ };
99
104
 
100
- picocolors.exports = createColors();
101
- picocolors.exports.createColors = createColors;
105
+ picocolors.exports = createColors();
106
+ picocolors.exports.createColors = createColors;
107
+ return picocolors.exports;
108
+ }
102
109
 
103
- var picocolorsExports = picocolors.exports;
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()}}();`;
@@ -115,10 +122,7 @@ const modernChunkLegacyGuard = `export function __vite_legacy_guard(){${detectMo
115
122
 
116
123
  let babel;
117
124
  async function loadBabel() {
118
- if (!babel) {
119
- babel = await import('@babel/core');
120
- }
121
- return babel;
125
+ return babel ??= import('@babel/core');
122
126
  }
123
127
  const { loadConfig: browserslistLoadConfig } = browserslist__default;
124
128
  function toOutputFilePathInHtml(filename, type, hostId, hostType, config, toRelative) {
@@ -252,8 +256,8 @@ function viteLegacyPlugin(options = {}) {
252
256
  config2.build.cssTarget = "chrome61";
253
257
  }
254
258
  if (genLegacy) {
255
- overriddenBuildTarget = config2.build.target !== void 0;
256
- overriddenDefaultModernTargets = options.modernTargets !== void 0;
259
+ overriddenBuildTarget = config2.build.target !== undefined;
260
+ overriddenDefaultModernTargets = options.modernTargets !== undefined;
257
261
  if (options.modernTargets) {
258
262
  const { default: browserslistToEsbuild } = await import('browserslist-to-esbuild');
259
263
  config2.build.target = browserslistToEsbuild(options.modernTargets);
@@ -484,7 +488,7 @@ function viteLegacyPlugin(options = {}) {
484
488
  configFile: false,
485
489
  compact: !!config.build.minify,
486
490
  sourceMaps,
487
- inputSourceMap: void 0,
491
+ inputSourceMap: undefined,
488
492
  presets: [
489
493
  // forcing our plugin to run before preset-env by wrapping it in a
490
494
  // preset so we can catch the injected import statements...
@@ -503,15 +507,12 @@ function viteLegacyPlugin(options = {}) {
503
507
  ]
504
508
  ]
505
509
  });
506
- if (result)
507
- return { code: result.code, map: result.map };
510
+ if (result) return { code: result.code, map: result.map };
508
511
  return null;
509
512
  },
510
513
  transformIndexHtml(html, { chunk }) {
511
- if (config.build.ssr)
512
- return;
513
- if (!chunk)
514
- return;
514
+ if (config.build.ssr) return;
515
+ if (!chunk) return;
515
516
  if (chunk.fileName.includes("-legacy")) {
516
517
  facadeToLegacyChunkMap.set(chunk.facadeModuleId, chunk.fileName);
517
518
  if (genModern) {
@@ -674,7 +675,7 @@ function createBabelPresetEnvOptions(targets, { needPolyfills = true }) {
674
675
  corejs: needPolyfills ? {
675
676
  version: _require("core-js/package.json").version,
676
677
  proposals: false
677
- } : void 0,
678
+ } : undefined,
678
679
  shippedProposals: true,
679
680
  ignoreBrowserslistConfig: true
680
681
  };
@@ -703,6 +704,7 @@ async function buildPolyfillChunk(mode, imports, bundle, facadeToChunkMap, build
703
704
  },
704
705
  output: {
705
706
  format,
707
+ hashCharacters: rollupOutputOptions.hashCharacters,
706
708
  entryFileNames: rollupOutputOptions.entryFileNames
707
709
  }
708
710
  }
@@ -721,8 +723,7 @@ async function buildPolyfillChunk(mode, imports, bundle, facadeToChunkMap, build
721
723
  }
722
724
  });
723
725
  const _polyfillChunk = Array.isArray(res) ? res[0] : res;
724
- if (!("output" in _polyfillChunk))
725
- return;
726
+ if (!("output" in _polyfillChunk)) return;
726
727
  const polyfillChunk = _polyfillChunk.output.find(
727
728
  (chunk) => chunk.type === "chunk" && chunk.isEntry
728
729
  );
package/dist/index.mjs CHANGED
@@ -12,83 +12,90 @@ function getDefaultExportFromCjs (x) {
12
12
 
13
13
  var picocolors = {exports: {}};
14
14
 
15
- let p = process || {}, argv = p.argv || [], env = p.env || {};
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
- let formatter = (open, close, replace = open) =>
21
- input => {
22
- let string = "" + input, index = string.indexOf(close, open.length);
23
- return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close
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);
24
+
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
+ };
25
30
 
26
- let replaceClose = (string, close, replace, index) => {
27
- let result = "", cursor = 0;
28
- do {
29
- result += string.substring(cursor, index) + replace;
30
- cursor = index + close.length;
31
- index = string.indexOf(close, cursor);
32
- } while (~index)
33
- return result + string.substring(cursor)
34
- };
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
+ };
35
40
 
36
- let createColors = (enabled = isColorSupported) => {
37
- let f = enabled ? formatter : () => String;
38
- return {
39
- isColorSupported: enabled,
40
- reset: f("\x1b[0m", "\x1b[0m"),
41
- bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
42
- dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
43
- italic: f("\x1b[3m", "\x1b[23m"),
44
- underline: f("\x1b[4m", "\x1b[24m"),
45
- inverse: f("\x1b[7m", "\x1b[27m"),
46
- hidden: f("\x1b[8m", "\x1b[28m"),
47
- strikethrough: f("\x1b[9m", "\x1b[29m"),
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"),
48
53
 
49
- black: f("\x1b[30m", "\x1b[39m"),
50
- red: f("\x1b[31m", "\x1b[39m"),
51
- green: f("\x1b[32m", "\x1b[39m"),
52
- yellow: f("\x1b[33m", "\x1b[39m"),
53
- blue: f("\x1b[34m", "\x1b[39m"),
54
- magenta: f("\x1b[35m", "\x1b[39m"),
55
- cyan: f("\x1b[36m", "\x1b[39m"),
56
- white: f("\x1b[37m", "\x1b[39m"),
57
- gray: f("\x1b[90m", "\x1b[39m"),
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"),
58
63
 
59
- bgBlack: f("\x1b[40m", "\x1b[49m"),
60
- bgRed: f("\x1b[41m", "\x1b[49m"),
61
- bgGreen: f("\x1b[42m", "\x1b[49m"),
62
- bgYellow: f("\x1b[43m", "\x1b[49m"),
63
- bgBlue: f("\x1b[44m", "\x1b[49m"),
64
- bgMagenta: f("\x1b[45m", "\x1b[49m"),
65
- bgCyan: f("\x1b[46m", "\x1b[49m"),
66
- bgWhite: f("\x1b[47m", "\x1b[49m"),
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"),
67
72
 
68
- blackBright: f("\x1b[90m", "\x1b[39m"),
69
- redBright: f("\x1b[91m", "\x1b[39m"),
70
- greenBright: f("\x1b[92m", "\x1b[39m"),
71
- yellowBright: f("\x1b[93m", "\x1b[39m"),
72
- blueBright: f("\x1b[94m", "\x1b[39m"),
73
- magentaBright: f("\x1b[95m", "\x1b[39m"),
74
- cyanBright: f("\x1b[96m", "\x1b[39m"),
75
- whiteBright: f("\x1b[97m", "\x1b[39m"),
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"),
76
81
 
77
- bgBlackBright: f("\x1b[100m", "\x1b[49m"),
78
- bgRedBright: f("\x1b[101m", "\x1b[49m"),
79
- bgGreenBright: f("\x1b[102m", "\x1b[49m"),
80
- bgYellowBright: f("\x1b[103m", "\x1b[49m"),
81
- bgBlueBright: f("\x1b[104m", "\x1b[49m"),
82
- bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
83
- bgCyanBright: f("\x1b[106m", "\x1b[49m"),
84
- bgWhiteBright: f("\x1b[107m", "\x1b[49m"),
85
- }
86
- };
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
+ };
87
92
 
88
- picocolors.exports = createColors();
89
- picocolors.exports.createColors = createColors;
93
+ picocolors.exports = createColors();
94
+ picocolors.exports.createColors = createColors;
95
+ return picocolors.exports;
96
+ }
90
97
 
91
- var picocolorsExports = picocolors.exports;
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()}}();`;
@@ -103,10 +110,7 @@ const modernChunkLegacyGuard = `export function __vite_legacy_guard(){${detectMo
103
110
 
104
111
  let babel;
105
112
  async function loadBabel() {
106
- if (!babel) {
107
- babel = await import('@babel/core');
108
- }
109
- return babel;
113
+ return babel ??= import('@babel/core');
110
114
  }
111
115
  const { loadConfig: browserslistLoadConfig } = browserslist;
112
116
  function toOutputFilePathInHtml(filename, type, hostId, hostType, config, toRelative) {
@@ -240,8 +244,8 @@ function viteLegacyPlugin(options = {}) {
240
244
  config2.build.cssTarget = "chrome61";
241
245
  }
242
246
  if (genLegacy) {
243
- overriddenBuildTarget = config2.build.target !== void 0;
244
- overriddenDefaultModernTargets = options.modernTargets !== void 0;
247
+ overriddenBuildTarget = config2.build.target !== undefined;
248
+ overriddenDefaultModernTargets = options.modernTargets !== undefined;
245
249
  if (options.modernTargets) {
246
250
  const { default: browserslistToEsbuild } = await import('browserslist-to-esbuild');
247
251
  config2.build.target = browserslistToEsbuild(options.modernTargets);
@@ -472,7 +476,7 @@ function viteLegacyPlugin(options = {}) {
472
476
  configFile: false,
473
477
  compact: !!config.build.minify,
474
478
  sourceMaps,
475
- inputSourceMap: void 0,
479
+ inputSourceMap: undefined,
476
480
  presets: [
477
481
  // forcing our plugin to run before preset-env by wrapping it in a
478
482
  // preset so we can catch the injected import statements...
@@ -491,15 +495,12 @@ function viteLegacyPlugin(options = {}) {
491
495
  ]
492
496
  ]
493
497
  });
494
- if (result)
495
- return { code: result.code, map: result.map };
498
+ if (result) return { code: result.code, map: result.map };
496
499
  return null;
497
500
  },
498
501
  transformIndexHtml(html, { chunk }) {
499
- if (config.build.ssr)
500
- return;
501
- if (!chunk)
502
- return;
502
+ if (config.build.ssr) return;
503
+ if (!chunk) return;
503
504
  if (chunk.fileName.includes("-legacy")) {
504
505
  facadeToLegacyChunkMap.set(chunk.facadeModuleId, chunk.fileName);
505
506
  if (genModern) {
@@ -662,7 +663,7 @@ function createBabelPresetEnvOptions(targets, { needPolyfills = true }) {
662
663
  corejs: needPolyfills ? {
663
664
  version: _require("core-js/package.json").version,
664
665
  proposals: false
665
- } : void 0,
666
+ } : undefined,
666
667
  shippedProposals: true,
667
668
  ignoreBrowserslistConfig: true
668
669
  };
@@ -691,6 +692,7 @@ async function buildPolyfillChunk(mode, imports, bundle, facadeToChunkMap, build
691
692
  },
692
693
  output: {
693
694
  format,
695
+ hashCharacters: rollupOutputOptions.hashCharacters,
694
696
  entryFileNames: rollupOutputOptions.entryFileNames
695
697
  }
696
698
  }
@@ -709,8 +711,7 @@ async function buildPolyfillChunk(mode, imports, bundle, facadeToChunkMap, build
709
711
  }
710
712
  });
711
713
  const _polyfillChunk = Array.isArray(res) ? res[0] : res;
712
- if (!("output" in _polyfillChunk))
713
- return;
714
+ if (!("output" in _polyfillChunk)) return;
714
715
  const polyfillChunk = _polyfillChunk.output.find(
715
716
  (chunk) => chunk.type === "chunk" && chunk.isEntry
716
717
  );
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@vitejs/plugin-legacy",
3
- "version": "5.4.3",
3
+ "version": "6.0.1",
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 || >=20.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.25.8",
39
- "@babel/preset-env": "^7.25.8",
40
- "browserslist": "^4.24.0",
39
+ "@babel/core": "^7.26.7",
40
+ "@babel/preset-env": "^7.26.7",
41
+ "browserslist": "^4.24.4",
41
42
  "browserslist-to-esbuild": "^2.1.1",
42
- "core-js": "^3.38.1",
43
- "magic-string": "^0.30.12",
43
+ "core-js": "^3.40.0",
44
+ "magic-string": "^0.30.17",
44
45
  "regenerator-runtime": "^0.14.1",
45
46
  "systemjs": "^6.15.1"
46
47
  },
47
48
  "peerDependencies": {
48
- "terser": "^5.4.0",
49
- "vite": "^5.0.0"
49
+ "terser": "^5.16.0",
50
+ "vite": "^6.0.0"
50
51
  },
51
52
  "devDependencies": {
52
- "acorn": "^8.13.0",
53
+ "acorn": "^8.14.0",
53
54
  "picocolors": "^1.1.1",
54
- "unbuild": "^2.0.0",
55
- "vite": "6.0.0-beta.5"
55
+ "unbuild": "^3.3.1",
56
+ "vite": "6.1.0"
56
57
  },
57
58
  "scripts": {
58
59
  "dev": "unbuild --stub",