@vitejs/plugin-legacy 5.0.0-beta.2 → 5.0.0-beta.3

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
@@ -156,7 +156,7 @@ The legacy plugin requires inline scripts for [Safari 10.1 `nomodule` fix](https
156
156
 
157
157
  - `sha256-MS6/3FCg4WjP9gwgaBGwLpRCY6fZBgwmhVCdrPrNf3E=`
158
158
  - `sha256-tQjf8gvb2ROOMapIxFvFAYBeUJ0v1HCbOcSmDNXGtDo=`
159
- - `sha256-4y/gEB2/KIwZFTfNqwXJq4olzvmQ0S214m9jwKgNXoc=`
159
+ - `sha256-8uUkKieevHiD3yYtzjkRvyDZWt+uZkBLuGEQWNiV3+c=`
160
160
  - `sha256-+5XkZFazzJo8n0iOP4ti/cLCMUudTf//Mzkb7xNPXIc=`
161
161
 
162
162
  <!--
package/dist/index.cjs CHANGED
@@ -92,7 +92,7 @@ const legacyPolyfillId = "vite-legacy-polyfill";
92
92
  const legacyEntryId = "vite-legacy-entry";
93
93
  const systemJSInlineCode = `System.import(document.getElementById('${legacyEntryId}').getAttribute('data-src'))`;
94
94
  const detectModernBrowserVarName = "__vite_is_modern_browser";
95
- const detectModernBrowserDetector = 'import.meta.url;import("_").catch(()=>1);async function* g(){};';
95
+ const detectModernBrowserDetector = 'import.meta.url;import("_").catch(()=>1);(async function* g(){})();';
96
96
  const detectModernBrowserCode = `${detectModernBrowserDetector}if(location.protocol!="file:"){window.${detectModernBrowserVarName}=true}`;
97
97
  const dynamicFallbackInlineCode = `!function(){if(window.${detectModernBrowserVarName})return;console.warn("vite: loading legacy chunks, syntax error above and the same error below should be ignored");var e=document.getElementById("${legacyPolyfillId}"),n=document.createElement("script");n.src=e.src,n.onload=function(){${systemJSInlineCode}},document.body.appendChild(n)}();`;
98
98
  const modernChunkLegacyGuard = `export function __vite_legacy_guard(){${detectModernBrowserDetector}};`;
@@ -319,7 +319,7 @@ function viteLegacyPlugin(options = {}) {
319
319
  } else if (fileName.includes("[hash]")) {
320
320
  fileName = fileName.replace(/[.-]?\[hash\]/, "-legacy$&");
321
321
  } else {
322
- fileName = fileName.replace(/(.+)\.(.+)/, "$1-legacy.$2");
322
+ fileName = fileName.replace(/(.+?)\.(.+)/, "$1-legacy.$2");
323
323
  }
324
324
  return fileName;
325
325
  };
package/dist/index.d.cts CHANGED
@@ -34,4 +34,4 @@ declare function viteLegacyPlugin(options?: Options): Plugin[];
34
34
  declare function detectPolyfills(code: string, targets: any, list: Set<string>): Promise<void>;
35
35
  declare const cspHashes: string[];
36
36
 
37
- export { cspHashes, viteLegacyPlugin as default, detectPolyfills };
37
+ export { type Options, cspHashes, viteLegacyPlugin as default, detectPolyfills };
package/dist/index.d.mts CHANGED
@@ -34,4 +34,4 @@ declare function viteLegacyPlugin(options?: Options): Plugin[];
34
34
  declare function detectPolyfills(code: string, targets: any, list: Set<string>): Promise<void>;
35
35
  declare const cspHashes: string[];
36
36
 
37
- export { cspHashes, viteLegacyPlugin as default, detectPolyfills };
37
+ export { type Options, cspHashes, viteLegacyPlugin as default, detectPolyfills };
package/dist/index.d.ts CHANGED
@@ -34,4 +34,4 @@ declare function viteLegacyPlugin(options?: Options): Plugin[];
34
34
  declare function detectPolyfills(code: string, targets: any, list: Set<string>): Promise<void>;
35
35
  declare const cspHashes: string[];
36
36
 
37
- export { cspHashes, viteLegacyPlugin as default, detectPolyfills };
37
+ export { type Options, cspHashes, viteLegacyPlugin as default, detectPolyfills };
package/dist/index.mjs CHANGED
@@ -80,7 +80,7 @@ const legacyPolyfillId = "vite-legacy-polyfill";
80
80
  const legacyEntryId = "vite-legacy-entry";
81
81
  const systemJSInlineCode = `System.import(document.getElementById('${legacyEntryId}').getAttribute('data-src'))`;
82
82
  const detectModernBrowserVarName = "__vite_is_modern_browser";
83
- const detectModernBrowserDetector = 'import.meta.url;import("_").catch(()=>1);async function* g(){};';
83
+ const detectModernBrowserDetector = 'import.meta.url;import("_").catch(()=>1);(async function* g(){})();';
84
84
  const detectModernBrowserCode = `${detectModernBrowserDetector}if(location.protocol!="file:"){window.${detectModernBrowserVarName}=true}`;
85
85
  const dynamicFallbackInlineCode = `!function(){if(window.${detectModernBrowserVarName})return;console.warn("vite: loading legacy chunks, syntax error above and the same error below should be ignored");var e=document.getElementById("${legacyPolyfillId}"),n=document.createElement("script");n.src=e.src,n.onload=function(){${systemJSInlineCode}},document.body.appendChild(n)}();`;
86
86
  const modernChunkLegacyGuard = `export function __vite_legacy_guard(){${detectModernBrowserDetector}};`;
@@ -307,7 +307,7 @@ function viteLegacyPlugin(options = {}) {
307
307
  } else if (fileName.includes("[hash]")) {
308
308
  fileName = fileName.replace(/[.-]?\[hash\]/, "-legacy$&");
309
309
  } else {
310
- fileName = fileName.replace(/(.+)\.(.+)/, "$1-legacy.$2");
310
+ fileName = fileName.replace(/(.+?)\.(.+)/, "$1-legacy.$2");
311
311
  }
312
312
  return fileName;
313
313
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitejs/plugin-legacy",
3
- "version": "5.0.0-beta.2",
3
+ "version": "5.0.0-beta.3",
4
4
  "license": "MIT",
5
5
  "author": "Evan You",
6
6
  "files": [
@@ -35,11 +35,11 @@
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.0",
39
- "@babel/preset-env": "^7.22.20",
38
+ "@babel/core": "^7.23.3",
39
+ "@babel/preset-env": "^7.23.3",
40
40
  "browserslist": "^4.22.1",
41
- "core-js": "^3.33.0",
42
- "magic-string": "^0.30.4",
41
+ "core-js": "^3.33.2",
42
+ "magic-string": "^0.30.5",
43
43
  "regenerator-runtime": "^0.14.0",
44
44
  "systemjs": "^6.14.2"
45
45
  },
@@ -48,9 +48,9 @@
48
48
  "vite": "^4.0.0"
49
49
  },
50
50
  "devDependencies": {
51
- "acorn": "^8.10.0",
51
+ "acorn": "^8.11.2",
52
52
  "picocolors": "^1.0.0",
53
- "vite": "5.0.0-beta.5"
53
+ "vite": "5.0.0-beta.19"
54
54
  },
55
55
  "scripts": {
56
56
  "dev": "unbuild --stub",