vite 6.0.0-beta.1 → 6.0.0-beta.2

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.
@@ -4,6 +4,7 @@ var path$3 = require('node:path');
4
4
  var node_url = require('node:url');
5
5
  var fs$1 = require('node:fs');
6
6
  var esbuild = require('esbuild');
7
+ var node_child_process = require('node:child_process');
7
8
  var node_module = require('node:module');
8
9
  var require$$0 = require('tty');
9
10
  var require$$1 = require('util');
@@ -15,13 +16,13 @@ var require$$2 = require('os');
15
16
 
16
17
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
17
18
  const { version: version$2 } = JSON.parse(
18
- fs$1.readFileSync(new URL("../../package.json", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)))).toString()
19
+ fs$1.readFileSync(new URL("../../package.json", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)))).toString()
19
20
  );
20
21
  const VERSION = version$2;
21
22
  const FS_PREFIX = `/@fs/`;
22
23
  const VITE_PACKAGE_DIR = path$3.resolve(
23
24
  // import.meta.url is `dist/node/constants.js` after bundle
24
- node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href))),
25
+ node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href))),
25
26
  "../../.."
26
27
  );
27
28
  const CLIENT_ENTRY = path$3.resolve(VITE_PACKAGE_DIR, "dist/client/client.mjs");
@@ -3323,8 +3324,9 @@ function ensureArray(thing) {
3323
3324
  return [thing];
3324
3325
  }
3325
3326
 
3327
+ const normalizePathRegExp = new RegExp(`\\${require$$0$1.win32.sep}`, 'g');
3326
3328
  const normalizePath$1 = function normalizePath(filename) {
3327
- return filename.split(require$$0$1.win32.sep).join(require$$0$1.posix.sep);
3329
+ return filename.replace(normalizePathRegExp, require$$0$1.posix.sep);
3328
3330
  };
3329
3331
 
3330
3332
  function getMatcherString(id, resolutionBase) {
@@ -3356,10 +3358,12 @@ const createFilter$1 = function createFilter(include, exclude, options) {
3356
3358
  };
3357
3359
  const includeMatchers = ensureArray(include).map(getMatcher);
3358
3360
  const excludeMatchers = ensureArray(exclude).map(getMatcher);
3361
+ if (!includeMatchers.length && !excludeMatchers.length)
3362
+ return (id) => typeof id === 'string' && !id.includes('\0');
3359
3363
  return function result(id) {
3360
3364
  if (typeof id !== 'string')
3361
3365
  return false;
3362
- if (/\0/.test(id))
3366
+ if (id.includes('\0'))
3363
3367
  return false;
3364
3368
  const pathId = normalizePath$1(id);
3365
3369
  for (let i = 0; i < excludeMatchers.length; ++i) {
@@ -3397,24 +3401,98 @@ function withTrailingSlash(path) {
3397
3401
  return path;
3398
3402
  }
3399
3403
 
3404
+ let pnp;
3400
3405
  if (process.versions.pnp) {
3401
3406
  try {
3402
- node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)))("pnpapi");
3407
+ pnp = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)))("pnpapi");
3403
3408
  } catch {
3404
3409
  }
3405
3410
  }
3411
+ function resolvePackageData(pkgName, basedir, preserveSymlinks = false, packageCache) {
3412
+ if (pnp) {
3413
+ try {
3414
+ const pkg = pnp.resolveToUnqualified(pkgName, basedir, {
3415
+ considerBuiltins: false
3416
+ });
3417
+ if (!pkg) return null;
3418
+ const pkgData = loadPackageData(path$3.join(pkg, "package.json"));
3419
+ return pkgData;
3420
+ } catch {
3421
+ return null;
3422
+ }
3423
+ }
3424
+ while (basedir) {
3425
+ const pkg = path$3.join(basedir, "node_modules", pkgName, "package.json");
3426
+ try {
3427
+ if (fs$1.existsSync(pkg)) {
3428
+ const pkgPath = preserveSymlinks ? pkg : safeRealpathSync(pkg);
3429
+ const pkgData = loadPackageData(pkgPath);
3430
+ return pkgData;
3431
+ }
3432
+ } catch {
3433
+ }
3434
+ const nextBasedir = path$3.dirname(basedir);
3435
+ if (nextBasedir === basedir) break;
3436
+ basedir = nextBasedir;
3437
+ }
3438
+ return null;
3439
+ }
3440
+ function loadPackageData(pkgPath) {
3441
+ const data = JSON.parse(fs$1.readFileSync(pkgPath, "utf-8"));
3442
+ const pkgDir = normalizePath(path$3.dirname(pkgPath));
3443
+ const { sideEffects } = data;
3444
+ let hasSideEffects;
3445
+ if (typeof sideEffects === "boolean") {
3446
+ hasSideEffects = () => sideEffects;
3447
+ } else if (Array.isArray(sideEffects)) {
3448
+ if (sideEffects.length <= 0) {
3449
+ hasSideEffects = () => false;
3450
+ } else {
3451
+ const finalPackageSideEffects = sideEffects.map((sideEffect) => {
3452
+ if (sideEffect.includes("/")) {
3453
+ return sideEffect;
3454
+ }
3455
+ return `**/${sideEffect}`;
3456
+ });
3457
+ hasSideEffects = createFilter(finalPackageSideEffects, null, {
3458
+ resolve: pkgDir
3459
+ });
3460
+ }
3461
+ } else {
3462
+ hasSideEffects = () => null;
3463
+ }
3464
+ const pkg = {
3465
+ dir: pkgDir,
3466
+ data,
3467
+ hasSideEffects,
3468
+ webResolvedImports: {},
3469
+ nodeResolvedImports: {},
3470
+ setResolvedCache(key, entry, targetWeb) {
3471
+ if (targetWeb) {
3472
+ pkg.webResolvedImports[key] = entry;
3473
+ } else {
3474
+ pkg.nodeResolvedImports[key] = entry;
3475
+ }
3476
+ },
3477
+ getResolvedCache(key, targetWeb) {
3478
+ if (targetWeb) {
3479
+ return pkg.webResolvedImports[key];
3480
+ } else {
3481
+ return pkg.nodeResolvedImports[key];
3482
+ }
3483
+ }
3484
+ };
3485
+ return pkg;
3486
+ }
3406
3487
 
3407
3488
  const createFilter = createFilter$1;
3408
3489
  node_module.builtinModules.filter((id) => !id.includes(":"));
3409
3490
  function isInNodeModules(id) {
3410
3491
  return id.includes("node_modules");
3411
3492
  }
3412
- const _require = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)));
3413
- function resolveDependencyVersion(dep, pkgRelativePath = "../../package.json") {
3414
- const pkgPath = path$3.resolve(_require.resolve(dep), pkgRelativePath);
3415
- return JSON.parse(fs$1.readFileSync(pkgPath, "utf-8")).version;
3416
- }
3417
- const rollupVersion = resolveDependencyVersion("rollup");
3493
+ node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)));
3494
+ const _dirname = path$3.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href))));
3495
+ const rollupVersion = resolvePackageData("rollup", _dirname, true)?.data.version ?? "";
3418
3496
  const filter = process.env.VITE_DEBUG_FILTER;
3419
3497
  const DEBUG = process.env.DEBUG;
3420
3498
  function createDebugger(namespace, options = {}) {
@@ -3492,10 +3570,57 @@ function isFileReadable(filename) {
3492
3570
  return false;
3493
3571
  }
3494
3572
  }
3573
+ let safeRealpathSync = isWindows ? windowsSafeRealPathSync : fs$1.realpathSync.native;
3574
+ const windowsNetworkMap = /* @__PURE__ */ new Map();
3575
+ function windowsMappedRealpathSync(path2) {
3576
+ const realPath = fs$1.realpathSync.native(path2);
3577
+ if (realPath.startsWith("\\\\")) {
3578
+ for (const [network, volume] of windowsNetworkMap) {
3579
+ if (realPath.startsWith(network)) return realPath.replace(network, volume);
3580
+ }
3581
+ }
3582
+ return realPath;
3583
+ }
3584
+ const parseNetUseRE = /^\w* +(\w:) +([^ ]+)\s/;
3585
+ let firstSafeRealPathSyncRun = false;
3586
+ function windowsSafeRealPathSync(path2) {
3587
+ if (!firstSafeRealPathSyncRun) {
3588
+ optimizeSafeRealPathSync();
3589
+ firstSafeRealPathSyncRun = true;
3590
+ }
3591
+ return fs$1.realpathSync(path2);
3592
+ }
3593
+ function optimizeSafeRealPathSync() {
3594
+ const nodeVersion = process.versions.node.split(".").map(Number);
3595
+ if (nodeVersion[0] < 18 || nodeVersion[0] === 18 && nodeVersion[1] < 10) {
3596
+ safeRealpathSync = fs$1.realpathSync;
3597
+ return;
3598
+ }
3599
+ try {
3600
+ fs$1.realpathSync.native(path$3.resolve("./"));
3601
+ } catch (error) {
3602
+ if (error.message.includes("EISDIR: illegal operation on a directory")) {
3603
+ safeRealpathSync = fs$1.realpathSync;
3604
+ return;
3605
+ }
3606
+ }
3607
+ node_child_process.exec("net use", (error, stdout) => {
3608
+ if (error) return;
3609
+ const lines = stdout.split("\n");
3610
+ for (const line of lines) {
3611
+ const m = parseNetUseRE.exec(line);
3612
+ if (m) windowsNetworkMap.set(m[2], m[1]);
3613
+ }
3614
+ if (windowsNetworkMap.size === 0) {
3615
+ safeRealpathSync = fs$1.realpathSync.native;
3616
+ } else {
3617
+ safeRealpathSync = windowsMappedRealpathSync;
3618
+ }
3619
+ });
3620
+ }
3495
3621
  function arraify(target) {
3496
3622
  return Array.isArray(target) ? target : [target];
3497
3623
  }
3498
- path$3.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href))));
3499
3624
  function backwardCompatibleWorkerPlugins(plugins) {
3500
3625
  if (Array.isArray(plugins)) {
3501
3626
  return plugins;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "6.0.0-beta.1",
3
+ "version": "6.0.0-beta.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -72,9 +72,9 @@
72
72
  "funding": "https://github.com/vitejs/vite?sponsor=1",
73
73
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
74
74
  "dependencies": {
75
- "esbuild": "^0.21.3",
76
- "postcss": "^8.4.45",
77
- "rollup": "^4.20.0"
75
+ "esbuild": "^0.24.0",
76
+ "postcss": "^8.4.47",
77
+ "rollup": "^4.22.5"
78
78
  },
79
79
  "optionalDependencies": {
80
80
  "fsevents": "~2.3.3"
@@ -84,12 +84,12 @@
84
84
  "@babel/parser": "^7.25.6",
85
85
  "@jridgewell/trace-mapping": "^0.3.25",
86
86
  "@polka/compression": "^1.0.0-next.25",
87
- "@rollup/plugin-alias": "^5.1.0",
88
- "@rollup/plugin-commonjs": "^26.0.1",
89
- "@rollup/plugin-dynamic-import-vars": "^2.1.2",
87
+ "@rollup/plugin-alias": "^5.1.1",
88
+ "@rollup/plugin-commonjs": "^26.0.3",
89
+ "@rollup/plugin-dynamic-import-vars": "^2.1.3",
90
90
  "@rollup/plugin-json": "^6.1.0",
91
- "@rollup/plugin-node-resolve": "15.2.3",
92
- "@rollup/pluginutils": "^5.1.0",
91
+ "@rollup/plugin-node-resolve": "15.3.0",
92
+ "@rollup/pluginutils": "^5.1.2",
93
93
  "@types/escape-html": "^1.0.4",
94
94
  "@types/pnpapi": "^0.0.5",
95
95
  "artichokie": "^0.2.1",
@@ -110,7 +110,7 @@
110
110
  "fast-glob": "^3.3.2",
111
111
  "http-proxy": "^1.18.1",
112
112
  "launch-editor-middleware": "^2.9.1",
113
- "lightningcss": "^1.26.0",
113
+ "lightningcss": "^1.27.0",
114
114
  "magic-string": "^0.30.11",
115
115
  "micromatch": "^4.0.8",
116
116
  "mlly": "^1.7.1",
@@ -128,9 +128,9 @@
128
128
  "resolve.exports": "^2.0.2",
129
129
  "rollup-plugin-dts": "^6.1.1",
130
130
  "rollup-plugin-esbuild": "^6.1.1",
131
- "rollup-plugin-license": "^3.5.2",
132
- "sass": "^1.78.0",
133
- "sass-embedded": "^1.78.0",
131
+ "rollup-plugin-license": "^3.5.3",
132
+ "sass": "^1.79.4",
133
+ "sass-embedded": "^1.79.4",
134
134
  "sirv": "^2.0.4",
135
135
  "source-map-support": "^0.5.21",
136
136
  "strip-ansi": "^7.1.0",