@vitejs/plugin-legacy 2.3.0-beta.0 → 2.3.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 (2) hide show
  1. package/dist/index.cjs +8 -14
  2. package/package.json +6 -6
package/dist/index.cjs CHANGED
@@ -10,15 +10,9 @@ const vite = require('vite');
10
10
  const MagicString = require('magic-string');
11
11
  const require$$0 = require('tty');
12
12
 
13
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
14
-
15
- const path__default = /*#__PURE__*/_interopDefaultLegacy(path);
16
- const MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
17
- const require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
18
-
19
13
  var picocolors = {exports: {}};
20
14
 
21
- let tty = require$$0__default;
15
+ let tty = require$$0;
22
16
 
23
17
  let isColorSupported =
24
18
  !("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
@@ -114,13 +108,13 @@ function toOutputFilePathInHtml(filename, type, hostId, hostType, config, toRela
114
108
  }
115
109
  }
116
110
  function getBaseInHTML(urlRelativePath, config) {
117
- return config.base === "./" || config.base === "" ? path__default.posix.join(
118
- path__default.posix.relative(urlRelativePath, "").slice(0, -2),
111
+ return config.base === "./" || config.base === "" ? path.posix.join(
112
+ path.posix.relative(urlRelativePath, "").slice(0, -2),
119
113
  "./"
120
114
  ) : config.base;
121
115
  }
122
116
  function toAssetPathFromHtml(filename, htmlPath, config) {
123
- const relativeUrlPath = vite.normalizePath(path__default.relative(config.root, htmlPath));
117
+ const relativeUrlPath = vite.normalizePath(path.relative(config.root, htmlPath));
124
118
  const toRelative = (filename2, hostId) => getBaseInHTML(relativeUrlPath, config) + filename2;
125
119
  return toOutputFilePathInHtml(
126
120
  filename,
@@ -281,7 +275,7 @@ function viteLegacyPlugin(options = {}) {
281
275
  }
282
276
  const getLegacyOutputFileName = (fileNames, defaultFileName = "[name]-legacy.[hash].js") => {
283
277
  if (!fileNames) {
284
- return path__default.posix.join(config.build.assetsDir, defaultFileName);
278
+ return path.posix.join(config.build.assetsDir, defaultFileName);
285
279
  }
286
280
  return (chunkInfo) => {
287
281
  let fileName = typeof fileNames === "function" ? fileNames(chunkInfo) : fileNames;
@@ -317,7 +311,7 @@ function viteLegacyPlugin(options = {}) {
317
311
  if (options.modernPolyfills && !Array.isArray(options.modernPolyfills)) {
318
312
  await detectPolyfills(raw, { esmodules: true }, modernPolyfills);
319
313
  }
320
- const ms = new MagicString__default(raw);
314
+ const ms = new MagicString(raw);
321
315
  if (genDynamicFallback && chunk.isEntry) {
322
316
  ms.prepend(forceDynamicImportUsage);
323
317
  }
@@ -547,7 +541,7 @@ async function buildPolyfillChunk(mode, imports, bundle, facadeToChunkMap, build
547
541
  minify = minify ? "terser" : false;
548
542
  const res = await vite.build({
549
543
  mode,
550
- root: path__default.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.cjs', document.baseURI).href)))),
544
+ root: path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.cjs', document.baseURI).href)))),
551
545
  configFile: false,
552
546
  logLevel: "error",
553
547
  plugins: [polyfillsPlugin(imports, excludeSystemJS)],
@@ -660,5 +654,5 @@ const cspHashes = [
660
654
 
661
655
  module.exports = viteLegacyPlugin;
662
656
  module.exports.cspHashes = cspHashes;
663
- module.exports["default"] = viteLegacyPlugin;
657
+ module.exports.default = viteLegacyPlugin;
664
658
  module.exports.detectPolyfills = detectPolyfills;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitejs/plugin-legacy",
3
- "version": "2.3.0-beta.0",
3
+ "version": "2.3.1",
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.19.3",
39
- "core-js": "^3.25.4",
40
- "magic-string": "^0.26.5",
41
- "regenerator-runtime": "^0.13.9",
38
+ "@babel/standalone": "^7.20.0",
39
+ "core-js": "^3.26.0",
40
+ "magic-string": "^0.26.7",
41
+ "regenerator-runtime": "^0.13.10",
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.3",
49
+ "@babel/core": "^7.19.6",
50
50
  "picocolors": "^1.0.0",
51
51
  "vite": "workspace:*"
52
52
  }