vite 8.0.15 → 8.0.16

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.
@@ -2004,11 +2004,11 @@ function processSrcSetSync(srcs, replacer) {
2004
2004
  descriptor
2005
2005
  })));
2006
2006
  }
2007
- const windowsDriveRE = /^[A-Z]:/;
2007
+ const windowsDriveRE$1 = /^[A-Z]:/;
2008
2008
  const replaceWindowsDriveRE = /^([A-Z]):\//;
2009
2009
  const linuxAbsolutePathRE = /^\/[^/]/;
2010
2010
  function escapeToLinuxLikePath(path) {
2011
- if (windowsDriveRE.test(path)) return path.replace(replaceWindowsDriveRE, "/windows/$1/");
2011
+ if (windowsDriveRE$1.test(path)) return path.replace(replaceWindowsDriveRE, "/windows/$1/");
2012
2012
  if (linuxAbsolutePathRE.test(path)) return `/linux${path}`;
2013
2013
  return path;
2014
2014
  }
@@ -10101,7 +10101,7 @@ var require_shell_quote = /* @__PURE__ */ __commonJSMin(((exports) => {
10101
10101
  exports.parse = require_parse$1();
10102
10102
  }));
10103
10103
  //#endregion
10104
- //#region ../../node_modules/.pnpm/launch-editor@2.14.0/node_modules/launch-editor/editor-info/macos.js
10104
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/macos.js
10105
10105
  var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10106
10106
  module.exports = {
10107
10107
  "/Applications/Atom.app/Contents/MacOS/Atom": "atom",
@@ -10136,7 +10136,7 @@ var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10136
10136
  };
10137
10137
  }));
10138
10138
  //#endregion
10139
- //#region ../../node_modules/.pnpm/launch-editor@2.14.0/node_modules/launch-editor/editor-info/linux.js
10139
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/linux.js
10140
10140
  var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10141
10141
  module.exports = {
10142
10142
  atom: "atom",
@@ -10170,7 +10170,7 @@ var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10170
10170
  };
10171
10171
  }));
10172
10172
  //#endregion
10173
- //#region ../../node_modules/.pnpm/launch-editor@2.14.0/node_modules/launch-editor/editor-info/windows.js
10173
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/windows.js
10174
10174
  var require_windows$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10175
10175
  module.exports = [
10176
10176
  "Brackets.exe",
@@ -10203,7 +10203,7 @@ var require_windows$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10203
10203
  ];
10204
10204
  }));
10205
10205
  //#endregion
10206
- //#region ../../node_modules/.pnpm/launch-editor@2.14.0/node_modules/launch-editor/guess.js
10206
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/guess.js
10207
10207
  var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10208
10208
  const path$9 = __require("path");
10209
10209
  const shellQuote = require_shell_quote();
@@ -10211,60 +10211,74 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10211
10211
  const COMMON_EDITORS_MACOS = require_macos();
10212
10212
  const COMMON_EDITORS_LINUX = require_linux();
10213
10213
  const COMMON_EDITORS_WIN = require_windows$1();
10214
- module.exports = function guessEditor(specifiedEditor) {
10214
+ function getEditorFromMacProcesses(output) {
10215
+ const processNames = Object.keys(COMMON_EDITORS_MACOS);
10216
+ const processList = output.split("\n");
10217
+ for (let i = 0; i < processNames.length; i++) {
10218
+ const processName = processNames[i];
10219
+ if (processList.includes(processName)) return COMMON_EDITORS_MACOS[processName];
10220
+ const processNameWithoutApplications = processName.replace("/Applications", "");
10221
+ if (output.indexOf(processNameWithoutApplications) !== -1) {
10222
+ if (processName !== COMMON_EDITORS_MACOS[processName]) return COMMON_EDITORS_MACOS[processName];
10223
+ const runningProcess = processList.find((procName) => procName.endsWith(processNameWithoutApplications));
10224
+ if (runningProcess !== void 0) return runningProcess;
10225
+ }
10226
+ }
10227
+ }
10228
+ function getEditorFromWindowsProcesses(output) {
10229
+ const runningProcesses = output.split("\r\n");
10230
+ for (let i = 0; i < runningProcesses.length; i++) {
10231
+ const fullProcessPath = runningProcesses[i].trim();
10232
+ const shortProcessName = path$9.win32.basename(fullProcessPath);
10233
+ if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) return fullProcessPath;
10234
+ }
10235
+ }
10236
+ function getEditorFromLinuxProcesses(output) {
10237
+ const processNames = Object.keys(COMMON_EDITORS_LINUX);
10238
+ for (let i = 0; i < processNames.length; i++) {
10239
+ const processName = processNames[i];
10240
+ if (output.indexOf(processName) !== -1) return COMMON_EDITORS_LINUX[processName];
10241
+ }
10242
+ }
10243
+ function guessEditor(specifiedEditor) {
10215
10244
  if (specifiedEditor) return shellQuote.parse(specifiedEditor);
10216
10245
  if (process.env.LAUNCH_EDITOR) return [process.env.LAUNCH_EDITOR];
10217
10246
  if (process.versions.webcontainer) return [process.env.EDITOR || "code"];
10218
10247
  try {
10219
10248
  if (process.platform === "darwin") {
10220
- const output = childProcess$2.execSync("ps x -o comm=", { stdio: [
10249
+ const editor = getEditorFromMacProcesses(childProcess$2.execSync("ps x -o comm=", { stdio: [
10221
10250
  "pipe",
10222
10251
  "pipe",
10223
10252
  "ignore"
10224
- ] }).toString();
10225
- const processNames = Object.keys(COMMON_EDITORS_MACOS);
10226
- const processList = output.split("\n");
10227
- for (let i = 0; i < processNames.length; i++) {
10228
- const processName = processNames[i];
10229
- if (processList.includes(processName)) return [COMMON_EDITORS_MACOS[processName]];
10230
- const processNameWithoutApplications = processName.replace("/Applications", "");
10231
- if (output.indexOf(processNameWithoutApplications) !== -1) {
10232
- if (processName !== COMMON_EDITORS_MACOS[processName]) return [COMMON_EDITORS_MACOS[processName]];
10233
- const runningProcess = processList.find((procName) => procName.endsWith(processNameWithoutApplications));
10234
- if (runningProcess !== void 0) return [runningProcess];
10235
- }
10236
- }
10253
+ ] }).toString());
10254
+ if (editor !== void 0) return [editor];
10237
10255
  } else if (process.platform === "win32") {
10238
- const runningProcesses = childProcess$2.execSync("powershell -NoProfile -Command \"[Console]::OutputEncoding=[Text.Encoding]::UTF8;Get-CimInstance -Query \\\"select executablepath from win32_process where executablepath is not null\\\" | % { $_.ExecutablePath }\"", { stdio: [
10256
+ const editor = getEditorFromWindowsProcesses(childProcess$2.execSync("powershell -NoProfile -Command \"[Console]::OutputEncoding=[Text.Encoding]::UTF8;Get-CimInstance -Query \\\"select executablepath from win32_process where executablepath is not null\\\" | % { $_.ExecutablePath }\"", { stdio: [
10239
10257
  "pipe",
10240
10258
  "pipe",
10241
10259
  "ignore"
10242
- ] }).toString().split("\r\n");
10243
- for (let i = 0; i < runningProcesses.length; i++) {
10244
- const fullProcessPath = runningProcesses[i].trim();
10245
- const shortProcessName = path$9.basename(fullProcessPath);
10246
- if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) return [fullProcessPath];
10247
- }
10260
+ ] }).toString());
10261
+ if (editor !== void 0) return [editor];
10248
10262
  } else if (process.platform === "linux") {
10249
- const output = childProcess$2.execSync("ps x --no-heading -o comm --sort=comm", { stdio: [
10263
+ const editor = getEditorFromLinuxProcesses(childProcess$2.execSync("ps x --no-heading -o comm --sort=comm", { stdio: [
10250
10264
  "pipe",
10251
10265
  "pipe",
10252
10266
  "ignore"
10253
- ] }).toString();
10254
- const processNames = Object.keys(COMMON_EDITORS_LINUX);
10255
- for (let i = 0; i < processNames.length; i++) {
10256
- const processName = processNames[i];
10257
- if (output.indexOf(processName) !== -1) return [COMMON_EDITORS_LINUX[processName]];
10258
- }
10267
+ ] }).toString());
10268
+ if (editor !== void 0) return [editor];
10259
10269
  }
10260
10270
  } catch (ignoreError) {}
10261
10271
  if (process.env.VISUAL) return [process.env.VISUAL];
10262
10272
  else if (process.env.EDITOR) return [process.env.EDITOR];
10263
10273
  return [null];
10264
- };
10274
+ }
10275
+ module.exports = guessEditor;
10276
+ module.exports.getEditorFromMacProcesses = getEditorFromMacProcesses;
10277
+ module.exports.getEditorFromWindowsProcesses = getEditorFromWindowsProcesses;
10278
+ module.exports.getEditorFromLinuxProcesses = getEditorFromLinuxProcesses;
10265
10279
  }));
10266
10280
  //#endregion
10267
- //#region ../../node_modules/.pnpm/launch-editor@2.14.0/node_modules/launch-editor/get-args.js
10281
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/get-args.js
10268
10282
  var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10269
10283
  const path$8 = __require("path");
10270
10284
  module.exports = function getArgumentsForPosition(editor, fileName, lineNumber, columnNumber = 1) {
@@ -10343,7 +10357,7 @@ var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10343
10357
  };
10344
10358
  }));
10345
10359
  //#endregion
10346
- //#region ../../node_modules/.pnpm/launch-editor@2.14.0/node_modules/launch-editor/index.js
10360
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/index.js
10347
10361
  var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10348
10362
  /**
10349
10363
  * Copyright (c) 2015-present, Facebook, Inc.
@@ -10397,6 +10411,7 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
10397
10411
  const parsed = parseFile(file);
10398
10412
  let { fileName } = parsed;
10399
10413
  const { lineNumber, columnNumber } = parsed;
10414
+ if (process.platform === "win32" && path$7.resolve(fileName).startsWith("\\\\")) return onErrorCallback(fileName, "UNC paths are not supported on Windows to avoid security issues. See https://github.com/vitejs/launch-editor/tree/main/packages/launch-editor#unc-paths-on-windows for details.");
10400
10415
  if (!fs$6.existsSync(fileName)) return;
10401
10416
  if (typeof specifiedEditor === "function") {
10402
10417
  onErrorCallback = specifiedEditor;
@@ -10442,7 +10457,7 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
10442
10457
  module.exports = launchEditor;
10443
10458
  }));
10444
10459
  //#endregion
10445
- //#region ../../node_modules/.pnpm/launch-editor-middleware@2.14.0/node_modules/launch-editor-middleware/index.js
10460
+ //#region ../../node_modules/.pnpm/launch-editor-middleware@2.14.1/node_modules/launch-editor-middleware/index.js
10446
10461
  var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10447
10462
  const path$6 = __require("path");
10448
10463
  const launch = require_launch_editor();
@@ -24229,12 +24244,15 @@ function isFileServingAllowed(configOrUrl, urlOrServer) {
24229
24244
  function isFileInTargetPath(targetPath, filePath) {
24230
24245
  return isSameFilePath(targetPath, filePath) || isParentDirectory(targetPath, filePath);
24231
24246
  }
24247
+ const windowsDriveRE = /^[A-Z]:/i;
24232
24248
  /**
24233
24249
  * Warning: parameters are not validated, only works with normalized absolute paths
24234
24250
  */
24235
24251
  function isFileLoadingAllowed(config, filePath) {
24236
24252
  const { fs } = config.server;
24237
24253
  if (!fs.strict) return true;
24254
+ if (isWindows && filePath.includes("~")) return false;
24255
+ if ((isWindows && windowsDriveRE.test(filePath) ? filePath.slice(2) : filePath).includes(":")) return false;
24238
24256
  const filePathWithoutTrailingSlash = filePath.endsWith("/") ? filePath.slice(0, -1) : filePath;
24239
24257
  if (config.fsDenyGlob(filePathWithoutTrailingSlash)) return false;
24240
24258
  if (config.safeModulePaths.has(filePath)) return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "8.0.15",
3
+ "version": "8.0.16",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -98,7 +98,7 @@
98
98
  "etag": "^1.8.1",
99
99
  "host-validation-middleware": "^0.1.4",
100
100
  "http-proxy-3": "^1.23.2",
101
- "launch-editor-middleware": "^2.14.0",
101
+ "launch-editor-middleware": "^2.14.1",
102
102
  "magic-string": "^0.30.21",
103
103
  "mlly": "^1.8.2",
104
104
  "mrmime": "^2.0.1",