@rsbuild/core 1.4.14 → 1.4.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.
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 814: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 377: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  const path = __nccwpck_require__(928);
5
- const launch = __nccwpck_require__(586);
5
+ const launch = __nccwpck_require__(719);
6
6
  module.exports = (specifiedEditor, srcRoot, onErrorCallback) => {
7
7
  if (typeof specifiedEditor === "function") {
8
8
  onErrorCallback = specifiedEditor;
@@ -16,7 +16,10 @@
16
16
  return function launchEditorMiddleware(req, res) {
17
17
  let url;
18
18
  try {
19
- url = new URL(req.url);
19
+ const fullUrl = req.url.startsWith("http")
20
+ ? req.url
21
+ : `http://localhost${req.url}`;
22
+ url = new URL(fullUrl);
20
23
  } catch (_err) {
21
24
  res.statusCode = 500;
22
25
  res.end(`launch-editor-middleware: invalid URL.`);
@@ -38,7 +41,7 @@
38
41
  };
39
42
  };
40
43
  },
41
- 575: (module) => {
44
+ 218: (module) => {
42
45
  module.exports = {
43
46
  atom: "atom",
44
47
  Brackets: "brackets",
@@ -68,7 +71,7 @@
68
71
  zed: "zed",
69
72
  };
70
73
  },
71
- 780: (module) => {
74
+ 193: (module) => {
72
75
  module.exports = {
73
76
  "/Applications/Atom.app/Contents/MacOS/Atom": "atom",
74
77
  "/Applications/Atom Beta.app/Contents/MacOS/Atom Beta":
@@ -116,7 +119,7 @@
116
119
  "/Applications/Zed.app/Contents/MacOS/zed": "zed",
117
120
  };
118
121
  },
119
- 708: (module) => {
122
+ 361: (module) => {
120
123
  module.exports = [
121
124
  "Brackets.exe",
122
125
  "Code.exe",
@@ -145,7 +148,7 @@
145
148
  "trae.exe",
146
149
  ];
147
150
  },
148
- 118: (module, __unused_webpack_exports, __nccwpck_require__) => {
151
+ 421: (module, __unused_webpack_exports, __nccwpck_require__) => {
149
152
  const path = __nccwpck_require__(928);
150
153
  module.exports = function getArgumentsForPosition(
151
154
  editor,
@@ -217,13 +220,13 @@
217
220
  return [fileName];
218
221
  };
219
222
  },
220
- 191: (module, __unused_webpack_exports, __nccwpck_require__) => {
223
+ 346: (module, __unused_webpack_exports, __nccwpck_require__) => {
221
224
  const path = __nccwpck_require__(928);
222
225
  const shellQuote = __nccwpck_require__(710);
223
226
  const childProcess = __nccwpck_require__(317);
224
- const COMMON_EDITORS_MACOS = __nccwpck_require__(780);
225
- const COMMON_EDITORS_LINUX = __nccwpck_require__(575);
226
- const COMMON_EDITORS_WIN = __nccwpck_require__(708);
227
+ const COMMON_EDITORS_MACOS = __nccwpck_require__(193);
228
+ const COMMON_EDITORS_LINUX = __nccwpck_require__(218);
229
+ const COMMON_EDITORS_WIN = __nccwpck_require__(361);
227
230
  module.exports = function guessEditor(specifiedEditor) {
228
231
  if (specifiedEditor) {
229
232
  return shellQuote.parse(specifiedEditor);
@@ -303,14 +306,14 @@
303
306
  return [null];
304
307
  };
305
308
  },
306
- 586: (module, __unused_webpack_exports, __nccwpck_require__) => {
309
+ 719: (module, __unused_webpack_exports, __nccwpck_require__) => {
307
310
  const fs = __nccwpck_require__(896);
308
311
  const os = __nccwpck_require__(857);
309
312
  const path = __nccwpck_require__(928);
310
313
  const colors = __nccwpck_require__(717);
311
314
  const childProcess = __nccwpck_require__(317);
312
- const guessEditor = __nccwpck_require__(191);
313
- const getArgumentsForPosition = __nccwpck_require__(118);
315
+ const guessEditor = __nccwpck_require__(346);
316
+ const getArgumentsForPosition = __nccwpck_require__(421);
314
317
  function wrapErrorCallback(cb) {
315
318
  return (fileName, errorMessage) => {
316
319
  console.log();
@@ -710,6 +713,6 @@
710
713
  }
711
714
  if (typeof __nccwpck_require__ !== "undefined")
712
715
  __nccwpck_require__.ab = __dirname + "/";
713
- var __webpack_exports__ = __nccwpck_require__(814);
716
+ var __webpack_exports__ = __nccwpck_require__(377);
714
717
  module.exports = __webpack_exports__;
715
718
  })();
@@ -1 +1 @@
1
- {"name":"launch-editor-middleware","author":"Evan You","version":"2.11.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"launch-editor-middleware","author":"Evan You","version":"2.11.1","license":"MIT","types":"index.d.ts","type":"commonjs"}
@@ -1,73 +1,67 @@
1
- declare type ColorFn = (input: string | number | null | undefined) => string;
2
-
3
- declare let createLogger: (options?: Options) => Logger;
4
-
5
- declare let LOG_TYPES: {
6
- error: {
7
- label: string;
8
- level: "error";
9
- color: ColorFn;
10
- };
11
- warn: {
12
- label: string;
13
- level: "warn";
14
- color: ColorFn;
15
- };
16
- info: {
17
- label: string;
18
- level: "info";
19
- color: ColorFn;
20
- };
21
- start: {
22
- label: string;
23
- level: "info";
24
- color: ColorFn;
25
- };
26
- ready: {
27
- label: string;
28
- level: "info";
29
- color: ColorFn;
30
- };
31
- success: {
32
- label: string;
33
- level: "info";
34
- color: ColorFn;
35
- };
36
- log: {
37
- level: "info";
38
- };
39
- debug: {
40
- label: string;
41
- level: "verbose";
42
- color: ColorFn;
43
- };
44
- };
45
-
46
- declare type LogFunction = (message?: LogMessage, ...args: any[]) => void;
47
-
48
- declare type Logger = Record<LogMethods, LogFunction> & {
49
- greet: (message: string) => void;
50
- level: LogLevel;
51
- override: (customLogger: Partial<Record<LogMethods, LogFunction>>) => void;
52
- };
53
-
54
- declare let logger: Logger;
55
-
56
- declare type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'log' | 'verbose';
57
-
58
- declare type LogMessage = unknown;
59
-
60
- declare type LogMethods = keyof typeof LOG_TYPES;
61
-
62
- declare interface LogType {
63
- label?: string;
64
- level: LogLevel;
65
- color?: ColorFn;
66
- }
67
-
68
- declare interface Options {
69
- level?: LogLevel;
1
+ type ColorFn = (input: string | number | null | undefined) => string;
2
+
3
+ declare let LOG_TYPES: {
4
+ error: {
5
+ label: string;
6
+ level: "error";
7
+ color: ColorFn;
8
+ };
9
+ warn: {
10
+ label: string;
11
+ level: "warn";
12
+ color: ColorFn;
13
+ };
14
+ info: {
15
+ label: string;
16
+ level: "info";
17
+ color: ColorFn;
18
+ };
19
+ start: {
20
+ label: string;
21
+ level: "info";
22
+ color: ColorFn;
23
+ };
24
+ ready: {
25
+ label: string;
26
+ level: "info";
27
+ color: ColorFn;
28
+ };
29
+ success: {
30
+ label: string;
31
+ level: "info";
32
+ color: ColorFn;
33
+ };
34
+ log: {
35
+ level: "info";
36
+ };
37
+ debug: {
38
+ label: string;
39
+ level: "verbose";
40
+ color: ColorFn;
41
+ };
42
+ };
43
+
44
+ type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'log' | 'verbose';
45
+ type LogMessage = unknown;
46
+ interface LogType {
47
+ label?: string;
48
+ level: LogLevel;
49
+ color?: ColorFn;
50
+ }
51
+ type LogFunction = (message?: LogMessage, ...args: any[]) => void;
52
+ interface Options {
53
+ level?: LogLevel;
70
54
  }
55
+ type LogMethods = keyof typeof LOG_TYPES;
56
+ type Logger = Record<LogMethods, LogFunction> & {
57
+ greet: (message: string) => void;
58
+ level: LogLevel;
59
+ override: (customLogger: Partial<Record<LogMethods, LogFunction>>) => void;
60
+ };
61
+
62
+ declare let createLogger: (options?: Options) => Logger;
63
+
64
+ declare let logger: Logger;
71
65
 
72
66
  export { createLogger, logger };
73
67
  export type { LogFunction, LogLevel, LogMessage, LogType, Logger, Options };
@@ -99,6 +99,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
99
99
  if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
100
100
  if ('truecolor' === env.COLORTERM) return 3;
101
101
  if ('xterm-kitty' === env.TERM) return 3;
102
+ if ('xterm-ghostty' === env.TERM) return 3;
102
103
  if ('TERM_PROGRAM' in env) {
103
104
  const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
104
105
  switch(env.TERM_PROGRAM){
@@ -1 +1 @@
1
- {"name":"rslog","version":"1.2.9","license":"MIT","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"rslog","version":"1.2.11","license":"MIT","types":"index.d.ts","type":"commonjs"}
@@ -1 +1 @@
1
- {"name":"rspack-chain","author":"rspack-contrib","version":"1.3.1","license":"MIT","types":"types/index.d.ts","type":"commonjs"}
1
+ {"name":"rspack-chain","author":"rspack-contrib","version":"1.3.2","license":"MIT","types":"types/index.d.ts","type":"commonjs"}
@@ -1,9 +1,10 @@
1
- const hmr_config = RSBUILD_CLIENT_CONFIG;
2
- const resolvedConfig = RSBUILD_RESOLVED_CLIENT_CONFIG;
3
- function formatURL(config) {
1
+ const config = RSBUILD_CLIENT_CONFIG;
2
+ const serverHost = RSBUILD_SERVER_HOST;
3
+ const serverPort = RSBUILD_SERVER_PORT;
4
+ function formatURL(fallback) {
4
5
  const { location } = self;
5
- const hostname = config.host || location.hostname;
6
- const port = config.port || location.port;
6
+ const hostname = (fallback ? serverHost : config.host) || location.hostname;
7
+ const port = (fallback ? serverPort : config.port) || location.port;
7
8
  const protocol = config.protocol || ('https:' === location.protocol ? 'wss' : 'ws');
8
9
  const pathname = config.path;
9
10
  if ('undefined' != typeof URL) {
@@ -117,8 +118,8 @@ function onMessage(e) {
117
118
  }
118
119
  }
119
120
  function onClose() {
120
- if (reconnectCount >= hmr_config.reconnect) {
121
- if (hmr_config.reconnect > 0) console.info('[HMR] connection failure after maximum reconnect limit exceeded.');
121
+ if (reconnectCount >= config.reconnect) {
122
+ if (config.reconnect > 0) console.info('[HMR] connection failure after maximum reconnect limit exceeded.');
122
123
  return;
123
124
  }
124
125
  console.info('[HMR] disconnected. Attempting to reconnect.');
@@ -128,7 +129,7 @@ function onClose() {
128
129
  setTimeout(connect, 1000 * 1.5 ** reconnectCount);
129
130
  }
130
131
  function onError() {
131
- if (formatURL(hmr_config) !== formatURL(resolvedConfig)) {
132
+ if (formatURL() !== formatURL(true)) {
132
133
  console.error('[HMR] WebSocket connection error, attempting direct fallback.');
133
134
  removeListeners();
134
135
  connection = null;
@@ -137,7 +138,7 @@ function onError() {
137
138
  }
138
139
  function connect() {
139
140
  let fallback = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : false;
140
- const socketUrl = formatURL(fallback ? resolvedConfig : hmr_config);
141
+ const socketUrl = formatURL(fallback);
141
142
  connection = new WebSocket(socketUrl);
142
143
  connection.addEventListener('open', onOpen);
143
144
  connection.addEventListener('close', onClose);