@vitejs/plugin-legacy 2.3.1 → 3.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/README.md CHANGED
@@ -21,9 +21,9 @@ import legacy from '@vitejs/plugin-legacy'
21
21
  export default {
22
22
  plugins: [
23
23
  legacy({
24
- targets: ['defaults', 'not IE 11']
25
- })
26
- ]
24
+ targets: ['defaults', 'not IE 11'],
25
+ }),
26
+ ],
27
27
  }
28
28
  ```
29
29
 
@@ -104,9 +104,9 @@ npm add -D terser
104
104
  modernPolyfills: [
105
105
  /* ... */
106
106
  ],
107
- renderLegacyChunks: false
108
- })
109
- ]
107
+ renderLegacyChunks: false,
108
+ }),
109
+ ],
110
110
  }
111
111
  ```
112
112
 
@@ -141,9 +141,9 @@ export default {
141
141
  plugins: [
142
142
  legacy({
143
143
  polyfills: ['es.promise.finally', 'es/map', 'es/set'],
144
- modernPolyfills: ['es.promise.finally']
145
- })
146
- ]
144
+ modernPolyfills: ['es.promise.finally'],
145
+ }),
146
+ ],
147
147
  }
148
148
  ```
149
149
 
package/dist/index.cjs CHANGED
@@ -273,7 +273,7 @@ function viteLegacyPlugin(options = {}) {
273
273
  if (!genLegacy || config.build.ssr) {
274
274
  return;
275
275
  }
276
- const getLegacyOutputFileName = (fileNames, defaultFileName = "[name]-legacy.[hash].js") => {
276
+ const getLegacyOutputFileName = (fileNames, defaultFileName = "[name]-legacy-[hash].js") => {
277
277
  if (!fileNames) {
278
278
  return path.posix.join(config.build.assetsDir, defaultFileName);
279
279
  }
@@ -350,7 +350,7 @@ function viteLegacyPlugin(options = {}) {
350
350
  configFile: false,
351
351
  compact: !!config.build.minify,
352
352
  sourceMaps,
353
- inputSourceMap: sourceMaps ? chunk.map : void 0,
353
+ inputSourceMap: void 0,
354
354
  presets: [
355
355
  [
356
356
  () => ({
@@ -505,7 +505,9 @@ async function detectPolyfills(code, targets, list) {
505
505
  presets: [
506
506
  [
507
507
  "env",
508
- createBabelPresetEnvOptions(targets, { ignoreBrowserslistConfig: true })
508
+ createBabelPresetEnvOptions(targets, {
509
+ ignoreBrowserslistConfig: true
510
+ })
509
511
  ]
510
512
  ]
511
513
  });
@@ -589,7 +591,7 @@ function polyfillsPlugin(imports, excludeSystemJS) {
589
591
  },
590
592
  load(id) {
591
593
  if (id === polyfillId) {
592
- return [...imports].map((i) => `import "${i}";`).join("") + (excludeSystemJS ? "" : `import "systemjs/dist/s.min.js";`);
594
+ return [...imports].map((i) => `import ${JSON.stringify(i)};`).join("") + (excludeSystemJS ? "" : `import "systemjs/dist/s.min.js";`);
593
595
  }
594
596
  }
595
597
  };
package/dist/index.mjs CHANGED
@@ -269,7 +269,7 @@ function viteLegacyPlugin(options = {}) {
269
269
  if (!genLegacy || config.build.ssr) {
270
270
  return;
271
271
  }
272
- const getLegacyOutputFileName = (fileNames, defaultFileName = "[name]-legacy.[hash].js") => {
272
+ const getLegacyOutputFileName = (fileNames, defaultFileName = "[name]-legacy-[hash].js") => {
273
273
  if (!fileNames) {
274
274
  return path.posix.join(config.build.assetsDir, defaultFileName);
275
275
  }
@@ -346,7 +346,7 @@ function viteLegacyPlugin(options = {}) {
346
346
  configFile: false,
347
347
  compact: !!config.build.minify,
348
348
  sourceMaps,
349
- inputSourceMap: sourceMaps ? chunk.map : void 0,
349
+ inputSourceMap: void 0,
350
350
  presets: [
351
351
  [
352
352
  () => ({
@@ -501,7 +501,9 @@ async function detectPolyfills(code, targets, list) {
501
501
  presets: [
502
502
  [
503
503
  "env",
504
- createBabelPresetEnvOptions(targets, { ignoreBrowserslistConfig: true })
504
+ createBabelPresetEnvOptions(targets, {
505
+ ignoreBrowserslistConfig: true
506
+ })
505
507
  ]
506
508
  ]
507
509
  });
@@ -585,7 +587,7 @@ function polyfillsPlugin(imports, excludeSystemJS) {
585
587
  },
586
588
  load(id) {
587
589
  if (id === polyfillId) {
588
- return [...imports].map((i) => `import "${i}";`).join("") + (excludeSystemJS ? "" : `import "systemjs/dist/s.min.js";`);
590
+ return [...imports].map((i) => `import ${JSON.stringify(i)};`).join("") + (excludeSystemJS ? "" : `import "systemjs/dist/s.min.js";`);
589
591
  }
590
592
  }
591
593
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitejs/plugin-legacy",
3
- "version": "2.3.1",
3
+ "version": "3.0.0",
4
4
  "license": "MIT",
5
5
  "author": "Evan You",
6
6
  "files": [
@@ -35,10 +35,10 @@
35
35
  },
36
36
  "homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-legacy#readme",
37
37
  "dependencies": {
38
- "@babel/standalone": "^7.20.0",
39
- "core-js": "^3.26.0",
40
- "magic-string": "^0.26.7",
41
- "regenerator-runtime": "^0.13.10",
38
+ "@babel/standalone": "^7.20.6",
39
+ "core-js": "^3.26.1",
40
+ "magic-string": "^0.27.0",
41
+ "regenerator-runtime": "^0.13.11",
42
42
  "systemjs": "^6.13.0"
43
43
  },
44
44
  "peerDependencies": {
@@ -46,7 +46,7 @@
46
46
  "vite": "^3.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@babel/core": "^7.19.6",
49
+ "@babel/core": "^7.20.5",
50
50
  "picocolors": "^1.0.0",
51
51
  "vite": "workspace:*"
52
52
  }