@rspack/dev-server 2.0.3 → 2.1.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.
@@ -1,7 +1,7 @@
1
- import { __webpack_require__ } from "./465.js";
2
- import "./465.js";
1
+ import { __webpack_require__ } from "./944.js";
2
+ import "./944.js";
3
3
  __webpack_require__.add({
4
- "./node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/editor-info/linux.js" (module) {
4
+ "./node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/linux.js" (module) {
5
5
  module.exports = {
6
6
  atom: 'atom',
7
7
  Brackets: 'brackets',
@@ -33,7 +33,7 @@ __webpack_require__.add({
33
33
  zed: 'zed'
34
34
  };
35
35
  },
36
- "./node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/editor-info/macos.js" (module) {
36
+ "./node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/macos.js" (module) {
37
37
  module.exports = {
38
38
  '/Applications/Atom.app/Contents/MacOS/Atom': 'atom',
39
39
  '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta': '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta',
@@ -66,7 +66,7 @@ __webpack_require__.add({
66
66
  '/Applications/Zed.app/Contents/MacOS/zed': 'zed'
67
67
  };
68
68
  },
69
- "./node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/editor-info/windows.js" (module) {
69
+ "./node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/windows.js" (module) {
70
70
  module.exports = [
71
71
  'Brackets.exe',
72
72
  'Code.exe',
@@ -97,7 +97,7 @@ __webpack_require__.add({
97
97
  'Antigravity.exe'
98
98
  ];
99
99
  },
100
- "./node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/get-args.js" (module, __unused_rspack_exports, __webpack_require__) {
100
+ "./node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/get-args.js" (module, __unused_rspack_exports, __webpack_require__) {
101
101
  const path = __webpack_require__("path");
102
102
  module.exports = function(editor, fileName, lineNumber, columnNumber = 1) {
103
103
  const editorBasename = path.basename(editor).replace(/\.(exe|cmd|bat)$/i, '');
@@ -196,14 +196,43 @@ __webpack_require__.add({
196
196
  ];
197
197
  };
198
198
  },
199
- "./node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/guess.js" (module, __unused_rspack_exports, __webpack_require__) {
199
+ "./node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/guess.js" (module, __unused_rspack_exports, __webpack_require__) {
200
200
  const path = __webpack_require__("path");
201
- const shellQuote = __webpack_require__("./node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/index.js");
201
+ const shellQuote = __webpack_require__("./node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/index.js");
202
202
  const childProcess = __webpack_require__("child_process");
203
- const COMMON_EDITORS_MACOS = __webpack_require__("./node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/editor-info/macos.js");
204
- const COMMON_EDITORS_LINUX = __webpack_require__("./node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/editor-info/linux.js");
205
- const COMMON_EDITORS_WIN = __webpack_require__("./node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/editor-info/windows.js");
206
- module.exports = function(specifiedEditor) {
203
+ const COMMON_EDITORS_MACOS = __webpack_require__("./node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/macos.js");
204
+ const COMMON_EDITORS_LINUX = __webpack_require__("./node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/linux.js");
205
+ const COMMON_EDITORS_WIN = __webpack_require__("./node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/windows.js");
206
+ function getEditorFromMacProcesses(output) {
207
+ const processNames = Object.keys(COMMON_EDITORS_MACOS);
208
+ const processList = output.split('\n');
209
+ for(let i = 0; i < processNames.length; i++){
210
+ const processName = processNames[i];
211
+ if (processList.includes(processName)) return COMMON_EDITORS_MACOS[processName];
212
+ const processNameWithoutApplications = processName.replace('/Applications', '');
213
+ if (-1 !== output.indexOf(processNameWithoutApplications)) {
214
+ if (processName !== COMMON_EDITORS_MACOS[processName]) return COMMON_EDITORS_MACOS[processName];
215
+ const runningProcess = processList.find((procName)=>procName.endsWith(processNameWithoutApplications));
216
+ if (void 0 !== runningProcess) return runningProcess;
217
+ }
218
+ }
219
+ }
220
+ function getEditorFromWindowsProcesses(output) {
221
+ const runningProcesses = output.split('\r\n');
222
+ for(let i = 0; i < runningProcesses.length; i++){
223
+ const fullProcessPath = runningProcesses[i].trim();
224
+ const shortProcessName = path.win32.basename(fullProcessPath);
225
+ if (-1 !== COMMON_EDITORS_WIN.indexOf(shortProcessName)) return fullProcessPath;
226
+ }
227
+ }
228
+ function getEditorFromLinuxProcesses(output) {
229
+ const processNames = Object.keys(COMMON_EDITORS_LINUX);
230
+ for(let i = 0; i < processNames.length; i++){
231
+ const processName = processNames[i];
232
+ if (-1 !== output.indexOf(processName)) return COMMON_EDITORS_LINUX[processName];
233
+ }
234
+ }
235
+ function guessEditor(specifiedEditor) {
207
236
  if (specifiedEditor) return shellQuote.parse(specifiedEditor);
208
237
  if (process.env.LAUNCH_EDITOR) return [
209
238
  process.env.LAUNCH_EDITOR
@@ -220,24 +249,10 @@ __webpack_require__.add({
220
249
  'ignore'
221
250
  ]
222
251
  }).toString();
223
- const processNames = Object.keys(COMMON_EDITORS_MACOS);
224
- const processList = output.split('\n');
225
- for(let i = 0; i < processNames.length; i++){
226
- const processName = processNames[i];
227
- if (processList.includes(processName)) return [
228
- COMMON_EDITORS_MACOS[processName]
229
- ];
230
- const processNameWithoutApplications = processName.replace('/Applications', '');
231
- if (-1 !== output.indexOf(processNameWithoutApplications)) {
232
- if (processName !== COMMON_EDITORS_MACOS[processName]) return [
233
- COMMON_EDITORS_MACOS[processName]
234
- ];
235
- const runningProcess = processList.find((procName)=>procName.endsWith(processNameWithoutApplications));
236
- if (void 0 !== runningProcess) return [
237
- runningProcess
238
- ];
239
- }
240
- }
252
+ const editor = getEditorFromMacProcesses(output);
253
+ if (void 0 !== editor) return [
254
+ editor
255
+ ];
241
256
  } else if ('win32' === process.platform) {
242
257
  const output = childProcess.execSync('powershell -NoProfile -Command "[Console]::OutputEncoding=[Text.Encoding]::UTF8;Get-CimInstance -Query \\"select executablepath from win32_process where executablepath is not null\\" | % { $_.ExecutablePath }"', {
243
258
  stdio: [
@@ -246,14 +261,10 @@ __webpack_require__.add({
246
261
  'ignore'
247
262
  ]
248
263
  }).toString();
249
- const runningProcesses = output.split('\r\n');
250
- for(let i = 0; i < runningProcesses.length; i++){
251
- const fullProcessPath = runningProcesses[i].trim();
252
- const shortProcessName = path.basename(fullProcessPath);
253
- if (-1 !== COMMON_EDITORS_WIN.indexOf(shortProcessName)) return [
254
- fullProcessPath
255
- ];
256
- }
264
+ const editor = getEditorFromWindowsProcesses(output);
265
+ if (void 0 !== editor) return [
266
+ editor
267
+ ];
257
268
  } else if ('linux' === process.platform) {
258
269
  const output = childProcess.execSync('ps x --no-heading -o comm --sort=comm', {
259
270
  stdio: [
@@ -262,13 +273,10 @@ __webpack_require__.add({
262
273
  'ignore'
263
274
  ]
264
275
  }).toString();
265
- const processNames = Object.keys(COMMON_EDITORS_LINUX);
266
- for(let i = 0; i < processNames.length; i++){
267
- const processName = processNames[i];
268
- if (-1 !== output.indexOf(processName)) return [
269
- COMMON_EDITORS_LINUX[processName]
270
- ];
271
- }
276
+ const editor = getEditorFromLinuxProcesses(output);
277
+ if (void 0 !== editor) return [
278
+ editor
279
+ ];
272
280
  }
273
281
  } catch (ignoreError) {}
274
282
  if (process.env.VISUAL) return [
@@ -280,16 +288,20 @@ __webpack_require__.add({
280
288
  return [
281
289
  null
282
290
  ];
283
- };
291
+ }
292
+ module.exports = guessEditor;
293
+ module.exports.getEditorFromMacProcesses = getEditorFromMacProcesses;
294
+ module.exports.getEditorFromWindowsProcesses = getEditorFromWindowsProcesses;
295
+ module.exports.getEditorFromLinuxProcesses = getEditorFromLinuxProcesses;
284
296
  },
285
- "./node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/index.js" (module, __unused_rspack_exports, __webpack_require__) {
297
+ "./node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/index.js" (module, __unused_rspack_exports, __webpack_require__) {
286
298
  const fs = __webpack_require__("fs");
287
299
  const os = __webpack_require__("os");
288
300
  const path = __webpack_require__("path");
289
301
  const colors = __webpack_require__("./node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
290
302
  const childProcess = __webpack_require__("child_process");
291
- const guessEditor = __webpack_require__("./node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/guess.js");
292
- const getArgumentsForPosition = __webpack_require__("./node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/get-args.js");
303
+ const guessEditor = __webpack_require__("./node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/guess.js");
304
+ const getArgumentsForPosition = __webpack_require__("./node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/get-args.js");
293
305
  function wrapErrorCallback(cb) {
294
306
  return (fileName, errorMessage)=>{
295
307
  console.log();
@@ -324,11 +336,12 @@ __webpack_require__.add({
324
336
  columnNumber
325
337
  };
326
338
  }
327
- let _childProcess = null;
339
+ let currentChildProcess = null;
328
340
  function launchEditor(file, specifiedEditor, onErrorCallback) {
329
341
  const parsed = parseFile(file);
330
342
  let { fileName } = parsed;
331
343
  const { lineNumber, columnNumber } = parsed;
344
+ if ('win32' === process.platform && path.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.");
332
345
  if (!fs.existsSync(fileName)) return;
333
346
  if ('function' == typeof specifiedEditor) {
334
347
  onErrorCallback = specifiedEditor;
@@ -342,7 +355,7 @@ __webpack_require__.add({
342
355
  const extraArgs = getArgumentsForPosition(editor, fileName, lineNumber, columnNumber);
343
356
  args.push.apply(args, extraArgs);
344
357
  } else args.push(fileName);
345
- if (_childProcess && isTerminalEditor(editor)) _childProcess.kill('SIGKILL');
358
+ if (currentChildProcess && isTerminalEditor(editor)) currentChildProcess.kill('SIGKILL');
346
359
  if ('win32' === process.platform) {
347
360
  function escapeCmdArgs(cmdArgs) {
348
361
  return cmdArgs.replace(/([&|<>,;=^])/g, '^$1');
@@ -356,18 +369,18 @@ __webpack_require__.add({
356
369
  editor,
357
370
  ...args.map(escapeCmdArgs)
358
371
  ].map(doubleQuoteIfNeeded).join(' ');
359
- _childProcess = childProcess.exec(launchCommand, {
372
+ currentChildProcess = childProcess.exec(launchCommand, {
360
373
  stdio: 'inherit',
361
374
  shell: true
362
375
  });
363
- } else _childProcess = childProcess.spawn(editor, args, {
376
+ } else currentChildProcess = childProcess.spawn(editor, args, {
364
377
  stdio: 'inherit'
365
378
  });
366
- _childProcess.on('exit', function(errorCode) {
367
- _childProcess = null;
379
+ currentChildProcess.on('exit', function(errorCode) {
380
+ currentChildProcess = null;
368
381
  if (errorCode) onErrorCallback(fileName, '(code ' + errorCode + ')');
369
382
  });
370
- _childProcess.on('error', function(error) {
383
+ currentChildProcess.on('error', function(error) {
371
384
  let { code, message } = error;
372
385
  if ('ENOENT' === code) message = `${message} ('${editor}' command does not exist in 'PATH')`;
373
386
  onErrorCallback(fileName, message);
@@ -441,11 +454,11 @@ __webpack_require__.add({
441
454
  module.exports = createColors();
442
455
  module.exports.createColors = createColors;
443
456
  },
444
- "./node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/index.js" (__unused_rspack_module, exports, __webpack_require__) {
445
- __webpack_require__("./node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/quote.js");
446
- exports.parse = __webpack_require__("./node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/parse.js");
457
+ "./node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/index.js" (__unused_rspack_module, exports, __webpack_require__) {
458
+ __webpack_require__("./node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/quote.js");
459
+ exports.parse = __webpack_require__("./node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/parse.js");
447
460
  },
448
- "./node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/parse.js" (module) {
461
+ "./node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/parse.js" (module) {
449
462
  var CONTROL = "(?:\\|\\||\\&\\&|;;|\\|\\&|\\<\\(|\\<\\<\\<|>>|>\\&|<\\&|[&;()|<>])";
450
463
  var controlRE = new RegExp('^' + CONTROL + '$');
451
464
  var META = '|&;()<> \\t';
@@ -586,11 +599,46 @@ __webpack_require__.add({
586
599
  }, []);
587
600
  };
588
601
  },
589
- "./node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/quote.js" (module) {
602
+ "./node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/quote.js" (module) {
603
+ var OPS = [
604
+ '||',
605
+ '&&',
606
+ ';;',
607
+ '|&',
608
+ '<(',
609
+ '<<<',
610
+ '>>',
611
+ '>&',
612
+ '<&',
613
+ '&',
614
+ ';',
615
+ '(',
616
+ ')',
617
+ '|',
618
+ '<',
619
+ '>'
620
+ ];
621
+ var LINE_TERMINATORS = /[\n\r\u2028\u2029]/;
622
+ var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|]/g;
590
623
  module.exports = function(xs) {
591
624
  return xs.map(function(s) {
592
625
  if ('' === s) return '\'\'';
593
- if (s && 'object' == typeof s) return s.op.replace(/(.)/g, '\\$1');
626
+ if (s && 'object' == typeof s) {
627
+ if ('glob' === s.op) {
628
+ if ('string' != typeof s.pattern) throw new TypeError('glob token requires a string `pattern`');
629
+ if (LINE_TERMINATORS.test(s.pattern)) throw new TypeError('glob `pattern` must not contain line terminators');
630
+ return s.pattern.replace(GLOB_SHELL_SPECIAL, '\\$&');
631
+ }
632
+ if ('string' == typeof s.op) {
633
+ if (OPS.indexOf(s.op) < 0) throw new TypeError('invalid `op` value: ' + JSON.stringify(s.op));
634
+ return s.op.replace(/[\s\S]/g, '\\$&');
635
+ }
636
+ if ('string' == typeof s.comment) {
637
+ if (LINE_TERMINATORS.test(s.comment)) throw new TypeError('`comment` must not contain line terminators');
638
+ return '#' + s.comment;
639
+ }
640
+ throw new TypeError('unrecognized object token shape');
641
+ }
594
642
  if (/["\s\\]/.test(s) && !/'/.test(s)) return "'" + s.replace(/(['])/g, '\\$1') + "'";
595
643
  if (/["'\s]/.test(s)) return '"' + s.replace(/(["\\$`!])/g, '\\$1') + '"';
596
644
  return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, '$1\\$2');
@@ -598,4 +646,4 @@ __webpack_require__.add({
598
646
  };
599
647
  }
600
648
  });
601
- __webpack_require__("./node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/index.js");
649
+ __webpack_require__("./node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/index.js");