@vitejs/plugin-legacy 5.3.2 → 5.4.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
@@ -49,7 +49,7 @@ npm add -D terser
49
49
  ### `modernTargets`
50
50
 
51
51
  - **Type:** `string | string[]`
52
- - **Default:** [`'edge>=80, firefox>=72, chrome>=80, safari>=13.1, chromeAndroid>=80, iOS>=13.1'`](https://browsersl.ist/#q=edge%3E%3D80%2C+firefox%3E%3D72%2C+chrome%3E%3D80%2C+safari%3E%3D13.1%2C+chromeAndroid%3E%3D80%2C+iOS%3E%3D13.1)
52
+ - **Default:** [`'edge>=79, firefox>=67, chrome>=64, safari>=12, chromeAndroid>=64, iOS>=12'`](https://browsersl.ist/#q=edge%3E%3D79%2C+firefox%3E%3D67%2C+chrome%3E%3D64%2C+safari%3E%3D12%2C+chromeAndroid%3E%3D64%2C+iOS%3E%3D12)
53
53
 
54
54
  If explicitly set, it's passed on to [`@babel/preset-env`](https://babeljs.io/docs/en/babel-preset-env#targets) when rendering **modern chunks**.
55
55
 
@@ -74,7 +74,11 @@ npm add -D terser
74
74
 
75
75
  Add custom imports to the legacy polyfills chunk. Since the usage-based polyfill detection only covers ES language features, it may be necessary to manually specify additional DOM API polyfills using this option.
76
76
 
77
- Note: if additional polyfills are needed for both the modern and legacy chunks, they can simply be imported in the application source code.
77
+ ### `additionalModernPolyfills`
78
+
79
+ - **Type:** `string[]`
80
+
81
+ Add custom imports to the modern polyfills chunk. Since the usage-based polyfill detection only covers ES language features, it may be necessary to manually specify additional DOM API polyfills using this option.
78
82
 
79
83
  ### `modernPolyfills`
80
84
 
package/dist/index.cjs CHANGED
@@ -167,7 +167,7 @@ function viteLegacyPlugin(options = {}) {
167
167
  "chrome64",
168
168
  "safari12"
169
169
  ];
170
- const modernTargetsBabel = "edge>=80, firefox>=72, chrome>=80, safari>=13.1, chromeAndroid>=80, iOS>=13.1";
170
+ const modernTargetsBabel = "edge>=79, firefox>=67, chrome>=64, safari>=12, chromeAndroid>=64, iOS>=12";
171
171
  const genLegacy = options.renderLegacyChunks !== false;
172
172
  const genModern = options.renderModernChunks !== false;
173
173
  if (!genLegacy && !genModern) {
@@ -189,6 +189,11 @@ function viteLegacyPlugin(options = {}) {
189
189
  );
190
190
  });
191
191
  }
192
+ if (Array.isArray(options.additionalModernPolyfills)) {
193
+ options.additionalModernPolyfills.forEach((i) => {
194
+ modernPolyfills.add(i);
195
+ });
196
+ }
192
197
  if (Array.isArray(options.polyfills)) {
193
198
  options.polyfills.forEach((i) => {
194
199
  if (i.startsWith(`regenerator`)) {
package/dist/index.d.cts CHANGED
@@ -8,7 +8,7 @@ interface Options {
8
8
  [key: string]: string;
9
9
  };
10
10
  /**
11
- * default: 'edge>=80, firefox>=72, chrome>=80, safari>=13.1, chromeAndroid>=80, iOS>=13.1'
11
+ * default: 'edge>=79, firefox>=67, chrome>=64, safari>=12, chromeAndroid>=64, iOS>=12'
12
12
  */
13
13
  modernTargets?: string | string[];
14
14
  /**
@@ -16,6 +16,7 @@ interface Options {
16
16
  */
17
17
  polyfills?: boolean | string[];
18
18
  additionalLegacyPolyfills?: string[];
19
+ additionalModernPolyfills?: string[];
19
20
  /**
20
21
  * default: false
21
22
  */
package/dist/index.d.mts CHANGED
@@ -8,7 +8,7 @@ interface Options {
8
8
  [key: string]: string;
9
9
  };
10
10
  /**
11
- * default: 'edge>=80, firefox>=72, chrome>=80, safari>=13.1, chromeAndroid>=80, iOS>=13.1'
11
+ * default: 'edge>=79, firefox>=67, chrome>=64, safari>=12, chromeAndroid>=64, iOS>=12'
12
12
  */
13
13
  modernTargets?: string | string[];
14
14
  /**
@@ -16,6 +16,7 @@ interface Options {
16
16
  */
17
17
  polyfills?: boolean | string[];
18
18
  additionalLegacyPolyfills?: string[];
19
+ additionalModernPolyfills?: string[];
19
20
  /**
20
21
  * default: false
21
22
  */
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ interface Options {
8
8
  [key: string]: string;
9
9
  };
10
10
  /**
11
- * default: 'edge>=80, firefox>=72, chrome>=80, safari>=13.1, chromeAndroid>=80, iOS>=13.1'
11
+ * default: 'edge>=79, firefox>=67, chrome>=64, safari>=12, chromeAndroid>=64, iOS>=12'
12
12
  */
13
13
  modernTargets?: string | string[];
14
14
  /**
@@ -16,6 +16,7 @@ interface Options {
16
16
  */
17
17
  polyfills?: boolean | string[];
18
18
  additionalLegacyPolyfills?: string[];
19
+ additionalModernPolyfills?: string[];
19
20
  /**
20
21
  * default: false
21
22
  */
package/dist/index.mjs CHANGED
@@ -155,7 +155,7 @@ function viteLegacyPlugin(options = {}) {
155
155
  "chrome64",
156
156
  "safari12"
157
157
  ];
158
- const modernTargetsBabel = "edge>=80, firefox>=72, chrome>=80, safari>=13.1, chromeAndroid>=80, iOS>=13.1";
158
+ const modernTargetsBabel = "edge>=79, firefox>=67, chrome>=64, safari>=12, chromeAndroid>=64, iOS>=12";
159
159
  const genLegacy = options.renderLegacyChunks !== false;
160
160
  const genModern = options.renderModernChunks !== false;
161
161
  if (!genLegacy && !genModern) {
@@ -177,6 +177,11 @@ function viteLegacyPlugin(options = {}) {
177
177
  );
178
178
  });
179
179
  }
180
+ if (Array.isArray(options.additionalModernPolyfills)) {
181
+ options.additionalModernPolyfills.forEach((i) => {
182
+ modernPolyfills.add(i);
183
+ });
184
+ }
180
185
  if (Array.isArray(options.polyfills)) {
181
186
  options.polyfills.forEach((i) => {
182
187
  if (i.startsWith(`regenerator`)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitejs/plugin-legacy",
3
- "version": "5.3.2",
3
+ "version": "5.4.0",
4
4
  "license": "MIT",
5
5
  "author": "Evan You",
6
6
  "files": [
@@ -35,14 +35,14 @@
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.23.9",
39
- "@babel/preset-env": "^7.23.9",
38
+ "@babel/core": "^7.24.5",
39
+ "@babel/preset-env": "^7.24.5",
40
40
  "browserslist": "^4.23.0",
41
41
  "browserslist-to-esbuild": "^2.1.1",
42
- "core-js": "^3.36.0",
43
- "magic-string": "^0.30.7",
42
+ "core-js": "^3.37.0",
43
+ "magic-string": "^0.30.10",
44
44
  "regenerator-runtime": "^0.14.1",
45
- "systemjs": "^6.14.3"
45
+ "systemjs": "^6.15.1"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "terser": "^5.4.0",
@@ -51,7 +51,7 @@
51
51
  "devDependencies": {
52
52
  "acorn": "^8.11.3",
53
53
  "picocolors": "^1.0.0",
54
- "vite": "5.1.5"
54
+ "vite": "5.2.11"
55
55
  },
56
56
  "scripts": {
57
57
  "dev": "unbuild --stub",