@rsbuild/core 1.6.7-canary-57e2a56d-20251120152633 → 1.6.8

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.
package/dist/2~open.cjs CHANGED
@@ -3,13 +3,13 @@ const __rslib_import_meta_url__ = 'undefined' == typeof document ? new (require(
3
3
  exports.ids = [
4
4
  "664"
5
5
  ], exports.modules = {
6
- "../../node_modules/.pnpm/open@10.2.0/node_modules/open/index.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
7
- let isDockerCached, cachedResult, mountPoint, defaultMountPoint;
6
+ "../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
7
+ let isDockerCached, cachedResult, canAccessPowerShellPromise, mountPoint, defaultMountPoint;
8
8
  __webpack_require__.d(__webpack_exports__, {
9
9
  default: ()=>node_modules_open,
10
- apps: ()=>apps
10
+ apps: ()=>open_apps
11
11
  });
12
- var external_node_process_ = __webpack_require__("node:process"), external_node_buffer_ = __webpack_require__("node:buffer"), external_node_path_ = __webpack_require__("node:path"), external_node_url_ = __webpack_require__("node:url"), external_node_util_ = __webpack_require__("node:util"), external_node_child_process_ = __webpack_require__("node:child_process"), promises_ = __webpack_require__("node:fs/promises"), external_node_os_ = __webpack_require__("node:os"), external_node_fs_ = __webpack_require__("node:fs");
12
+ var external_node_process_ = __webpack_require__("node:process"), external_node_path_ = __webpack_require__("node:path"), external_node_url_ = __webpack_require__("node:url"), external_node_child_process_ = __webpack_require__("node:child_process"), promises_ = __webpack_require__("node:fs/promises"), external_node_os_ = __webpack_require__("node:os"), external_node_fs_ = __webpack_require__("node:fs");
13
13
  function hasDockerEnv() {
14
14
  try {
15
15
  return external_node_fs_.statSync('/.dockerenv'), !0;
@@ -44,7 +44,26 @@ exports.ids = [
44
44
  } catch {
45
45
  return !1;
46
46
  }
47
- }, is_wsl = external_node_process_.env.__IS_WSL_TEST__ ? isWsl : isWsl(), wslDrivesMountPoint = (defaultMountPoint = '/mnt/', async function() {
47
+ }, is_wsl = external_node_process_.env.__IS_WSL_TEST__ ? isWsl : isWsl();
48
+ var external_node_util_ = __webpack_require__("node:util"), external_node_buffer_ = __webpack_require__("node:buffer");
49
+ let execFile = (0, external_node_util_.promisify)(external_node_child_process_.execFile), powerShellPath = ()=>`${external_node_process_.env.SYSTEMROOT || external_node_process_.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, executePowerShell = async (command, options = {})=>{
50
+ let { powerShellPath: psPath, ...execFileOptions } = options, encodedCommand = executePowerShell.encodeCommand(command);
51
+ return execFile(psPath ?? powerShellPath(), [
52
+ ...executePowerShell.argumentsPrefix,
53
+ encodedCommand
54
+ ], {
55
+ encoding: 'utf8',
56
+ ...execFileOptions
57
+ });
58
+ };
59
+ executePowerShell.argumentsPrefix = [
60
+ '-NoProfile',
61
+ '-NonInteractive',
62
+ '-ExecutionPolicy',
63
+ 'Bypass',
64
+ '-EncodedCommand'
65
+ ], executePowerShell.encodeCommand = (command)=>external_node_buffer_.Buffer.from(command, 'utf16le').toString('base64'), executePowerShell.escapeArgument = (value)=>`'${String(value).replaceAll('\'', '\'\'')}'`;
66
+ let wsl_utils_execFile = (0, external_node_util_.promisify)(external_node_child_process_.execFile), wslDrivesMountPoint = (defaultMountPoint = '/mnt/', async function() {
48
67
  if (mountPoint) return mountPoint;
49
68
  let configFilePath = '/etc/wsl.conf', isConfigFileExists = !1;
50
69
  try {
@@ -58,7 +77,32 @@ exports.ids = [
58
77
  }), powerShellPathFromWsl = async ()=>{
59
78
  let mountPoint = await wslDrivesMountPoint();
60
79
  return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
61
- }, powerShellPath = async ()=>is_wsl ? powerShellPathFromWsl() : `${external_node_process_.env.SYSTEMROOT || external_node_process_.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
80
+ }, wsl_utils_powerShellPath = is_wsl ? powerShellPathFromWsl : powerShellPath, wsl_utils_canAccessPowerShell = async ()=>canAccessPowerShellPromise ??= (async ()=>{
81
+ try {
82
+ let psPath = await wsl_utils_powerShellPath();
83
+ return await promises_.access(psPath, promises_.constants.X_OK), !0;
84
+ } catch {
85
+ return !1;
86
+ }
87
+ })(), wslDefaultBrowser = async ()=>{
88
+ let psPath = await wsl_utils_powerShellPath(), command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`, { stdout } = await executePowerShell(command, {
89
+ powerShellPath: psPath
90
+ });
91
+ return stdout.trim();
92
+ }, convertWslPathToWindows = async (path)=>{
93
+ if (/^[a-z]+:\/\//i.test(path)) return path;
94
+ try {
95
+ let { stdout } = await wsl_utils_execFile('wslpath', [
96
+ '-aw',
97
+ path
98
+ ], {
99
+ encoding: 'utf8'
100
+ });
101
+ return stdout.trim();
102
+ } catch {
103
+ return path;
104
+ }
105
+ };
62
106
  function defineLazyProperty(object, propertyName, valueGetter) {
63
107
  let define = (value)=>Object.defineProperty(object, propertyName, {
64
108
  value,
@@ -77,58 +121,39 @@ exports.ids = [
77
121
  }
78
122
  }), object;
79
123
  }
80
- let execFileAsync = (0, external_node_util_.promisify)(external_node_child_process_.execFile);
81
- async function defaultBrowserId() {
82
- if ('darwin' !== external_node_process_.platform) throw Error('macOS only');
83
- let { stdout } = await execFileAsync('defaults', [
84
- 'read',
85
- 'com.apple.LaunchServices/com.apple.launchservices.secure',
86
- 'LSHandlers'
87
- ]), match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
88
- return match?.groups.id ?? 'com.apple.Safari';
89
- }
90
- let run_applescript_execFileAsync = (0, external_node_util_.promisify)(external_node_child_process_.execFile);
91
- async function runAppleScript(script, { humanReadableOutput = !0, signal } = {}) {
92
- if ('darwin' !== external_node_process_.platform) throw Error('macOS only');
93
- let execOptions = {};
94
- signal && (execOptions.signal = signal);
95
- let { stdout } = await run_applescript_execFileAsync("osascript", [
96
- '-e',
97
- script,
98
- humanReadableOutput ? [] : [
99
- '-ss'
100
- ]
101
- ], execOptions);
102
- return stdout.trim();
103
- }
104
- async function bundleName(bundleId) {
105
- return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
106
- }
107
- let windows_execFileAsync = (0, external_node_util_.promisify)(external_node_child_process_.execFile), windowsBrowserProgIds = {
108
- AppXq0fevzme2pys62n3e0fbqa7peapykr8v: {
109
- name: 'Edge',
110
- id: 'com.microsoft.edge.old'
111
- },
112
- MSEdgeDHTML: {
113
- name: 'Edge',
114
- id: 'com.microsoft.edge'
115
- },
124
+ let execFileAsync = (0, external_node_util_.promisify)(external_node_child_process_.execFile), windowsBrowserProgIds = {
116
125
  MSEdgeHTM: {
117
126
  name: 'Edge',
118
127
  id: 'com.microsoft.edge'
119
128
  },
120
- 'IE.HTTP': {
121
- name: 'Internet Explorer',
122
- id: 'com.microsoft.ie'
129
+ MSEdgeBHTML: {
130
+ name: 'Edge Beta',
131
+ id: 'com.microsoft.edge.beta'
123
132
  },
124
- FirefoxURL: {
125
- name: 'Firefox',
126
- id: 'org.mozilla.firefox'
133
+ MSEdgeDHTML: {
134
+ name: 'Edge Dev',
135
+ id: 'com.microsoft.edge.dev'
136
+ },
137
+ AppXq0fevzme2pys62n3e0fbqa7peapykr8v: {
138
+ name: 'Edge',
139
+ id: 'com.microsoft.edge.old'
127
140
  },
128
141
  ChromeHTML: {
129
142
  name: 'Chrome',
130
143
  id: 'com.google.chrome'
131
144
  },
145
+ ChromeBHTML: {
146
+ name: 'Chrome Beta',
147
+ id: 'com.google.chrome.beta'
148
+ },
149
+ ChromeDHTML: {
150
+ name: 'Chrome Dev',
151
+ id: 'com.google.chrome.dev'
152
+ },
153
+ ChromiumHTM: {
154
+ name: 'Chromium',
155
+ id: 'org.chromium.Chromium'
156
+ },
132
157
  BraveHTML: {
133
158
  name: 'Brave',
134
159
  id: 'com.brave.Browser'
@@ -137,14 +162,34 @@ exports.ids = [
137
162
  name: 'Brave Beta',
138
163
  id: 'com.brave.Browser.beta'
139
164
  },
165
+ BraveDHTML: {
166
+ name: 'Brave Dev',
167
+ id: 'com.brave.Browser.dev'
168
+ },
140
169
  BraveSSHTM: {
141
170
  name: 'Brave Nightly',
142
171
  id: 'com.brave.Browser.nightly'
172
+ },
173
+ FirefoxURL: {
174
+ name: 'Firefox',
175
+ id: 'org.mozilla.firefox'
176
+ },
177
+ OperaStable: {
178
+ name: 'Opera',
179
+ id: 'com.operasoftware.Opera'
180
+ },
181
+ VivaldiHTM: {
182
+ name: 'Vivaldi',
183
+ id: 'com.vivaldi.Vivaldi'
184
+ },
185
+ 'IE.HTTP': {
186
+ name: 'Internet Explorer',
187
+ id: 'com.microsoft.ie'
143
188
  }
144
- };
189
+ }, _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
145
190
  class UnknownBrowserError extends Error {
146
191
  }
147
- async function defaultBrowser(_execFileAsync = windows_execFileAsync) {
192
+ async function defaultBrowser(_execFileAsync = execFileAsync) {
148
193
  let { stdout } = await _execFileAsync('reg', [
149
194
  'QUERY',
150
195
  ' HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice',
@@ -156,6 +201,33 @@ exports.ids = [
156
201
  if (!browser) throw new UnknownBrowserError(`Unknown browser ID: ${id}`);
157
202
  return browser;
158
203
  }
204
+ let default_browser_id_execFileAsync = (0, external_node_util_.promisify)(external_node_child_process_.execFile);
205
+ async function defaultBrowserId() {
206
+ if ('darwin' !== external_node_process_.platform) throw Error('macOS only');
207
+ let { stdout } = await default_browser_id_execFileAsync('defaults', [
208
+ 'read',
209
+ 'com.apple.LaunchServices/com.apple.launchservices.secure',
210
+ 'LSHandlers'
211
+ ]), match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
212
+ return match?.groups.id ?? 'com.apple.Safari';
213
+ }
214
+ let run_applescript_execFileAsync = (0, external_node_util_.promisify)(external_node_child_process_.execFile);
215
+ async function runAppleScript(script, { humanReadableOutput = !0, signal } = {}) {
216
+ if ('darwin' !== external_node_process_.platform) throw Error('macOS only');
217
+ let execOptions = {};
218
+ signal && (execOptions.signal = signal);
219
+ let { stdout } = await run_applescript_execFileAsync("osascript", [
220
+ '-e',
221
+ script,
222
+ humanReadableOutput ? [] : [
223
+ '-ss'
224
+ ]
225
+ ], execOptions);
226
+ return stdout.trim();
227
+ }
228
+ async function bundleName(bundleId) {
229
+ return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
230
+ }
159
231
  let default_browser_execFileAsync = (0, external_node_util_.promisify)(external_node_child_process_.execFile);
160
232
  async function default_browser_defaultBrowser() {
161
233
  if ('darwin' === external_node_process_.platform) {
@@ -179,89 +251,87 @@ exports.ids = [
179
251
  if ('win32' === external_node_process_.platform) return defaultBrowser();
180
252
  throw Error('Only macOS, Linux, and Windows are supported');
181
253
  }
182
- let execFile = (0, external_node_util_.promisify)(external_node_child_process_.execFile), open_dirname = external_node_path_.dirname((0, external_node_url_.fileURLToPath)(__rslib_import_meta_url__)), localXdgOpenPath = external_node_path_.join(open_dirname, 'xdg-open'), { platform, arch } = external_node_process_;
183
- async function getWindowsDefaultBrowserFromWsl() {
184
- let powershellPath = await powerShellPath(), rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`, encodedCommand = external_node_buffer_.Buffer.from(rawCommand, 'utf16le').toString('base64'), { stdout } = await execFile(powershellPath, [
185
- '-NoProfile',
186
- '-NonInteractive',
187
- '-ExecutionPolicy',
188
- 'Bypass',
189
- '-EncodedCommand',
190
- encodedCommand
191
- ], {
192
- encoding: 'utf8'
193
- }), progId = stdout.trim(), browserMap = {
194
- ChromeHTML: 'com.google.chrome',
195
- BraveHTML: 'com.brave.Browser',
196
- MSEdgeHTM: 'com.microsoft.edge',
197
- FirefoxURL: 'org.mozilla.firefox'
198
- };
199
- return browserMap[progId] ? {
200
- id: browserMap[progId]
201
- } : {};
202
- }
203
- let pTryEach = async (array, mapper)=>{
204
- let latestError;
205
- for (let item of array)try {
206
- return await mapper(item);
254
+ let isInSsh = !!(external_node_process_.env.SSH_CONNECTION || external_node_process_.env.SSH_CLIENT || external_node_process_.env.SSH_TTY), fallbackAttemptSymbol = Symbol('fallbackAttempt'), open_dirname = __rslib_import_meta_url__ ? external_node_path_.dirname((0, external_node_url_.fileURLToPath)(__rslib_import_meta_url__)) : '', localXdgOpenPath = external_node_path_.join(open_dirname, 'xdg-open'), { platform, arch } = external_node_process_, tryEachApp = async (apps, opener)=>{
255
+ if (0 === apps.length) return;
256
+ let errors = [];
257
+ for (let app of apps)try {
258
+ return await opener(app);
207
259
  } catch (error) {
208
- latestError = error;
260
+ errors.push(error);
209
261
  }
210
- throw latestError;
262
+ throw AggregateError(errors, 'Failed to open in all supported apps');
211
263
  }, baseOpen = async (options)=>{
212
- let command;
213
- if (Array.isArray((options = {
264
+ let command, isFallbackAttempt = !0 === (options = {
214
265
  wait: !1,
215
266
  background: !1,
216
267
  newInstance: !1,
217
268
  allowNonzeroExitCode: !1,
218
269
  ...options
219
- }).app)) return pTryEach(options.app, (singleApp)=>baseOpen({
270
+ })[fallbackAttemptSymbol];
271
+ if (delete options[fallbackAttemptSymbol], Array.isArray(options.app)) return tryEachApp(options.app, (singleApp)=>baseOpen({
220
272
  ...options,
221
- app: singleApp
273
+ app: singleApp,
274
+ [fallbackAttemptSymbol]: !0
222
275
  }));
223
276
  let { name: app, arguments: appArguments = [] } = options.app ?? {};
224
277
  if (appArguments = [
225
278
  ...appArguments
226
- ], Array.isArray(app)) return pTryEach(app, (appName)=>baseOpen({
279
+ ], Array.isArray(app)) return tryEachApp(app, (appName)=>baseOpen({
227
280
  ...options,
228
281
  app: {
229
282
  name: appName,
230
283
  arguments: appArguments
231
- }
284
+ },
285
+ [fallbackAttemptSymbol]: !0
232
286
  }));
233
287
  if ('browser' === app || 'browserPrivate' === app) {
234
- let ids = {
288
+ let browser, ids = {
235
289
  'com.google.chrome': 'chrome',
236
290
  'google-chrome.desktop': 'chrome',
237
- 'com.brave.Browser': 'brave',
291
+ 'com.brave.browser': 'brave',
238
292
  'org.mozilla.firefox': 'firefox',
239
293
  'firefox.desktop': 'firefox',
240
294
  'com.microsoft.msedge': 'edge',
241
295
  'com.microsoft.edge': 'edge',
242
296
  'com.microsoft.edgemac': 'edge',
243
- 'microsoft-edge.desktop': 'edge'
244
- }, browser = is_wsl ? await getWindowsDefaultBrowserFromWsl() : await default_browser_defaultBrowser();
297
+ 'microsoft-edge.desktop': 'edge',
298
+ 'com.apple.safari': 'safari'
299
+ };
300
+ if (is_wsl) {
301
+ let progId = await wslDefaultBrowser();
302
+ browser = _windowsBrowserProgIdMap.get(progId) ?? {};
303
+ } else browser = await default_browser_defaultBrowser();
245
304
  if (browser.id in ids) {
246
- let browserName = ids[browser.id];
247
- return 'browserPrivate' === app && appArguments.push({
248
- chrome: '--incognito',
249
- brave: '--incognito',
250
- firefox: '--private-window',
251
- edge: '--inPrivate'
252
- }[browserName]), baseOpen({
305
+ let browserName = ids[browser.id.toLowerCase()];
306
+ if ('browserPrivate' === app) {
307
+ if ('safari' === browserName) throw Error('Safari doesn\'t support opening in private mode via command line');
308
+ appArguments.push({
309
+ chrome: '--incognito',
310
+ brave: '--incognito',
311
+ firefox: '--private-window',
312
+ edge: '--inPrivate'
313
+ }[browserName]);
314
+ }
315
+ return baseOpen({
253
316
  ...options,
254
317
  app: {
255
- name: apps[browserName],
318
+ name: open_apps[browserName],
256
319
  arguments: appArguments
257
320
  }
258
321
  });
259
322
  }
260
323
  throw Error(`${browser.name} is not supported as a default browser`);
261
324
  }
262
- let cliArguments = [], childProcessOptions = {};
263
- if ('darwin' === platform) command = 'open', options.wait && cliArguments.push('--wait-apps'), options.background && cliArguments.push('--background'), options.newInstance && cliArguments.push('--new'), app && cliArguments.push('-a', app);
264
- else if ('win32' !== platform && (!is_wsl || isInsideContainer() || app)) {
325
+ let cliArguments = [], childProcessOptions = {}, shouldUseWindowsInWsl = !1;
326
+ if (!is_wsl || isInsideContainer() || isInSsh || app || (shouldUseWindowsInWsl = await wsl_utils_canAccessPowerShell()), 'darwin' === platform) command = 'open', options.wait && cliArguments.push('--wait-apps'), options.background && cliArguments.push('--background'), options.newInstance && cliArguments.push('--new'), app && cliArguments.push('-a', app);
327
+ else if ('win32' === platform || shouldUseWindowsInWsl) {
328
+ command = await wsl_utils_powerShellPath(), cliArguments.push(...executePowerShell.argumentsPrefix), is_wsl || (childProcessOptions.windowsVerbatimArguments = !0), is_wsl && options.target && (options.target = await convertWslPathToWindows(options.target));
329
+ let encodedArguments = [
330
+ '$ProgressPreference = \'SilentlyContinue\';',
331
+ 'Start'
332
+ ];
333
+ options.wait && encodedArguments.push('-Wait'), app ? (encodedArguments.push(executePowerShell.escapeArgument(app)), options.target && appArguments.push(options.target)) : options.target && encodedArguments.push(executePowerShell.escapeArgument(options.target)), appArguments.length > 0 && encodedArguments.push('-ArgumentList', (appArguments = appArguments.map((argument)=>executePowerShell.escapeArgument(argument))).join(',')), options.target = executePowerShell.encodeCommand(encodedArguments.join(' ')), options.wait || (childProcessOptions.stdio = 'ignore');
334
+ } else {
265
335
  if (app) command = app;
266
336
  else {
267
337
  let exeLocalXdgOpen = !1;
@@ -271,20 +341,24 @@ exports.ids = [
271
341
  command = external_node_process_.versions.electron ?? ('android' === platform || !open_dirname || '/' === open_dirname || !exeLocalXdgOpen) ? 'xdg-open' : localXdgOpenPath;
272
342
  }
273
343
  appArguments.length > 0 && cliArguments.push(...appArguments), options.wait || (childProcessOptions.stdio = 'ignore', childProcessOptions.detached = !0);
274
- } else {
275
- command = await powerShellPath(), cliArguments.push('-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-EncodedCommand'), is_wsl || (childProcessOptions.windowsVerbatimArguments = !0);
276
- let encodedArguments = [
277
- 'Start'
278
- ];
279
- options.wait && encodedArguments.push('-Wait'), app ? (encodedArguments.push(`"\`"${app}\`""`), options.target && appArguments.push(options.target)) : options.target && encodedArguments.push(`"${options.target}"`), appArguments.length > 0 && encodedArguments.push('-ArgumentList', (appArguments = appArguments.map((argument)=>`"\`"${argument}\`""`)).join(',')), options.target = external_node_buffer_.Buffer.from(encodedArguments.join(' '), 'utf16le').toString('base64');
280
344
  }
281
345
  'darwin' === platform && appArguments.length > 0 && cliArguments.push('--args', ...appArguments), options.target && cliArguments.push(options.target);
282
346
  let subprocess = external_node_child_process_.spawn(command, cliArguments, childProcessOptions);
283
347
  return options.wait ? new Promise((resolve, reject)=>{
284
348
  subprocess.once('error', reject), subprocess.once('close', (exitCode)=>{
285
- !options.allowNonzeroExitCode && exitCode > 0 ? reject(Error(`Exited with code ${exitCode}`)) : resolve(subprocess);
349
+ options.allowNonzeroExitCode || 0 === exitCode ? resolve(subprocess) : reject(Error(`Exited with code ${exitCode}`));
286
350
  });
287
- }) : (subprocess.unref(), subprocess);
351
+ }) : isFallbackAttempt ? new Promise((resolve, reject)=>{
352
+ subprocess.once('error', reject), subprocess.once('spawn', ()=>{
353
+ subprocess.once('close', (exitCode)=>{
354
+ (subprocess.off('error', reject), 0 !== exitCode) ? reject(Error(`Exited with code ${exitCode}`)) : (subprocess.unref(), resolve(subprocess));
355
+ });
356
+ });
357
+ }) : (subprocess.unref(), new Promise((resolve, reject)=>{
358
+ subprocess.once('error', reject), subprocess.once('spawn', ()=>{
359
+ subprocess.off('error', reject), resolve(subprocess);
360
+ });
361
+ }));
288
362
  };
289
363
  function detectArchBinary(binary) {
290
364
  if ('string' == typeof binary || Array.isArray(binary)) return binary;
@@ -292,19 +366,23 @@ exports.ids = [
292
366
  if (!archBinary) throw Error(`${arch} is not supported`);
293
367
  return archBinary;
294
368
  }
295
- function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
369
+ function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
296
370
  if (wsl && is_wsl) return detectArchBinary(wsl);
297
371
  if (!platformBinary) throw Error(`${platform} is not supported`);
298
372
  return detectArchBinary(platformBinary);
299
373
  }
300
- let apps = {};
301
- defineLazyProperty(apps, 'chrome', ()=>detectPlatformBinary({
374
+ let open_apps = {
375
+ browser: 'browser',
376
+ browserPrivate: 'browserPrivate'
377
+ };
378
+ defineLazyProperty(open_apps, 'chrome', ()=>detectPlatformBinary({
302
379
  darwin: 'google chrome',
303
380
  win32: 'chrome',
304
381
  linux: [
305
382
  'google-chrome',
306
383
  'google-chrome-stable',
307
- 'chromium'
384
+ 'chromium',
385
+ 'chromium-browser'
308
386
  ]
309
387
  }, {
310
388
  wsl: {
@@ -314,7 +392,7 @@ exports.ids = [
314
392
  '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'
315
393
  ]
316
394
  }
317
- })), defineLazyProperty(apps, 'brave', ()=>detectPlatformBinary({
395
+ })), defineLazyProperty(open_apps, 'brave', ()=>detectPlatformBinary({
318
396
  darwin: 'brave browser',
319
397
  win32: 'brave',
320
398
  linux: [
@@ -329,13 +407,13 @@ exports.ids = [
329
407
  '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe'
330
408
  ]
331
409
  }
332
- })), defineLazyProperty(apps, 'firefox', ()=>detectPlatformBinary({
410
+ })), defineLazyProperty(open_apps, 'firefox', ()=>detectPlatformBinary({
333
411
  darwin: 'firefox',
334
412
  win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
335
413
  linux: 'firefox'
336
414
  }, {
337
415
  wsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe'
338
- })), defineLazyProperty(apps, 'edge', ()=>detectPlatformBinary({
416
+ })), defineLazyProperty(open_apps, 'edge', ()=>detectPlatformBinary({
339
417
  darwin: 'microsoft edge',
340
418
  win32: 'msedge',
341
419
  linux: [
@@ -344,7 +422,9 @@ exports.ids = [
344
422
  ]
345
423
  }, {
346
424
  wsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'
347
- })), defineLazyProperty(apps, 'browser', ()=>'browser'), defineLazyProperty(apps, 'browserPrivate', ()=>'browserPrivate');
425
+ })), defineLazyProperty(open_apps, 'safari', ()=>detectPlatformBinary({
426
+ darwin: 'Safari'
427
+ }));
348
428
  let node_modules_open = (target, options)=>{
349
429
  if ('string' != typeof target) throw TypeError('Expected a `target`');
350
430
  return baseOpen({
@@ -1,4 +1,4 @@
1
- /*! For license information please see 169.js.LICENSE.txt */
1
+ /*! For license information please see 506.js.LICENSE.txt */
2
2
  let swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin, hmrClientPath, overlayClientPath;
3
3
  let __WEBPACK_EXTERNAL_createRequire_require = __WEBPACK_EXTERNAL_createRequire(import.meta.url);
4
4
  import * as __WEBPACK_EXTERNAL_MODULE_async_hooks__ from "async_hooks";
@@ -4083,7 +4083,7 @@ function createPublicContext(context) {
4083
4083
  async function createContext(options, userConfig) {
4084
4084
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
4085
4085
  return {
4086
- version: "1.6.7-canary-57e2a56d-20251120152633",
4086
+ version: "1.6.8",
4087
4087
  rootPath,
4088
4088
  distPath: '',
4089
4089
  cachePath,
@@ -5588,7 +5588,7 @@ async function openBrowser(url) {
5588
5588
  }
5589
5589
  let { apps, default: baseOpen } = await import("./0~open.js").then((mod)=>({
5590
5590
  default: mod.node_modules_open,
5591
- apps: mod.apps
5591
+ apps: mod.open_apps
5592
5592
  }));
5593
5593
  try {
5594
5594
  let options = browser ? {
@@ -5632,7 +5632,7 @@ async function open_open({ https, port, routes, config, clearCache }) {
5632
5632
  })(config);
5633
5633
  clearCache && (openedURLs = []);
5634
5634
  let urls = [], host = await getHostInUrl(config.server.host), baseUrl = `${https ? 'https' : 'http'}://${host}:${port}`;
5635
- for (let url of (targets.length ? urls.push(...targets.map((target)=>resolveUrl(replacePortPlaceholder(target, port), baseUrl))) : routes.length && urls.push(`${baseUrl}${routes[0].pathname}`), before && await before(), urls))openedURLs.includes(url) || (openBrowser(url), openedURLs.push(url));
5635
+ for (let url of (targets.length ? urls.push(...targets.map((target)=>resolveUrl(replacePortPlaceholder(target, port), baseUrl))) : routes.length ? urls.push(`${baseUrl}${routes[0].pathname}`) : urls.push(baseUrl), before && await before(), urls))openedURLs.includes(url) || (openBrowser(url), openedURLs.push(url));
5636
5636
  }
5637
5637
  function recursiveChunkGroup(chunkGroup, visited = new Set()) {
5638
5638
  if (visited.has(chunkGroup)) return [];
@@ -8678,21 +8678,16 @@ function applyDefaultPlugins(pluginManager, context) {
8678
8678
  ],
8679
8679
  raw: !0
8680
8680
  }, ({ code, emitFile, resourcePath })=>{
8681
- let name = ((resourcePath)=>{
8682
- let basename = '';
8683
- if (resourcePath) {
8684
- let parsed = external_node_path_.default.parse(resourcePath);
8685
- parsed.dir && (basename = parsed.name);
8686
- }
8687
- return basename ? `${basename}.node` : null;
8688
- })(resourcePath);
8689
- if (null === name) throw Error(`${color.dim('[rsbuild:node-addons]')} Failed to load Node.js addon: ${color.yellow(resourcePath)}`);
8690
- return emitFile(name, code), `
8681
+ let name, name1 = (name = resourcePath && external_node_path_.default.parse(resourcePath).name) ? `${name}.node` : null;
8682
+ if (null === name1) throw Error(`${color.dim('[rsbuild:node-addons]')} Failed to load Node.js addon: ${color.yellow(resourcePath)}`);
8683
+ return emitFile(name1, code), `
8691
8684
  try {
8692
- const path = require("path");
8693
- process.dlopen(module, path.join(__dirname, "${name}"));
8685
+ const path = require("node:path");
8686
+ process.dlopen(module, path.join(__dirname, "${name1}"));
8694
8687
  } catch (error) {
8695
- throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
8688
+ throw new Error('Failed to load Node.js addon: "${name1}"', {
8689
+ cause: error,
8690
+ });
8696
8691
  }
8697
8692
  `;
8698
8693
  });
@@ -9257,8 +9252,8 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
9257
9252
  filter,
9258
9253
  writeToFileEmit: isDev && !0 !== writeToDisk,
9259
9254
  generate: (_seed, files, entries, { compilation })=>{
9260
- let chunkEntries = new Map(), licenseMap = new Map(), publicPath = getPublicPathFromCompiler(compilation), allFiles = files.map((file)=>{
9261
- if (file.chunk) for (let entryName of recursiveChunkEntryNames(file.chunk))chunkEntries.set(entryName, [
9255
+ let chunkEntries = new Map(), licenseMap = new Map(), publicPath = getPublicPathFromCompiler(compilation), integrity = {}, allFiles = files.map((file)=>{
9256
+ if (file.integrity && (integrity[file.path] = file.integrity), file.chunk) for (let entryName of recursiveChunkEntryNames(file.chunk))chunkEntries.set(entryName, [
9262
9257
  file,
9263
9258
  ...chunkEntries.get(entryName) || []
9264
9259
  ]);
@@ -9298,7 +9293,8 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
9298
9293
  }
9299
9294
  let manifestData = {
9300
9295
  allFiles,
9301
- entries: manifestEntries
9296
+ entries: manifestEntries,
9297
+ integrity
9302
9298
  };
9303
9299
  if (manifestOptions.generate) {
9304
9300
  let generatedManifest = manifestOptions.generate({
@@ -9712,7 +9708,7 @@ let applyServerOptions = (command)=>{
9712
9708
  };
9713
9709
  function setupCommands() {
9714
9710
  let cli = ((name = "")=>new CAC(name))('rsbuild');
9715
- cli.version("1.6.7-canary-57e2a56d-20251120152633"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
9711
+ cli.version("1.6.8"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
9716
9712
  default: 'auto'
9717
9713
  }).option('--env-dir <dir>', 'Set the directory for loading `.env` files').option('--env-mode <mode>', 'Set the env mode to load the `.env.[mode]` file').option('--environment <name>', 'Set the environment name(s) to build', {
9718
9714
  type: [
@@ -9781,7 +9777,7 @@ function initNodeEnv() {
9781
9777
  }
9782
9778
  function showGreeting() {
9783
9779
  let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
9784
- logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.7-canary-57e2a56d-20251120152633\n`);
9780
+ logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.8\n`);
9785
9781
  }
9786
9782
  function setupLogLevel() {
9787
9783
  let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
@@ -9802,7 +9798,7 @@ function runCLI() {
9802
9798
  logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
9803
9799
  }
9804
9800
  }
9805
- let src_version = "1.6.7-canary-57e2a56d-20251120152633";
9801
+ let src_version = "1.6.8";
9806
9802
  import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
9807
9803
  import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "node:module";
9808
9804
  import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";