@rsbuild/core 1.4.0 → 1.4.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.
package/dist/index.cjs CHANGED
@@ -759,12 +759,6 @@ var __webpack_modules__ = {
759
759
  return module;
760
760
  });
761
761
  },
762
- "../../compiled/open/index.js": function(module) {
763
- "use strict";
764
- module.exports = import("../compiled/open/index.js").then(function(module) {
765
- return module;
766
- });
767
- },
768
762
  "../../compiled/postcss-load-config/index.js": function(module) {
769
763
  "use strict";
770
764
  module.exports = import("../compiled/postcss-load-config/index.js").then(function(module) {
@@ -902,7 +896,7 @@ __webpack_require__.n = (module)=>{
902
896
  var __webpack_exports__ = {};
903
897
  for(var __webpack_i__ in (()=>{
904
898
  "use strict";
905
- let swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin;
899
+ let swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin, isDockerCached, cachedResult;
906
900
  __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
907
901
  PLUGIN_CSS_NAME: ()=>PLUGIN_CSS_NAME,
908
902
  createRsbuild: ()=>createRsbuild,
@@ -2247,7 +2241,7 @@ ${section.body}` : section.body).join("\n\n"));
2247
2241
  async function createContext(options, userConfig) {
2248
2242
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
2249
2243
  return {
2250
- version: "1.4.0",
2244
+ version: "1.4.2",
2251
2245
  rootPath,
2252
2246
  distPath: '',
2253
2247
  cachePath,
@@ -2294,7 +2288,7 @@ ${section.body}` : section.body).join("\n\n"));
2294
2288
  setup () {}
2295
2289
  };
2296
2290
  };
2297
- async function outputInspectConfigFiles({ rawBundlerConfigs, rawEnvironmentConfigs, inspectOptions, configType }) {
2291
+ async function outputInspectConfigFiles({ rawBundlerConfigs, rawEnvironmentConfigs, inspectOptions, rawExtraConfigs, configType }) {
2298
2292
  let { outputPath } = inspectOptions, files = [
2299
2293
  ...rawEnvironmentConfigs.map(({ name, content })=>{
2300
2294
  if (1 === rawEnvironmentConfigs.length) return {
@@ -2316,7 +2310,12 @@ ${section.body}` : section.body).join("\n\n"));
2316
2310
  label: `${upperFirst(configType)} Config (${name})`,
2317
2311
  content
2318
2312
  };
2319
- })
2313
+ }),
2314
+ ...(rawExtraConfigs || []).map(({ name, content })=>({
2315
+ path: (0, external_node_path_namespaceObject.join)(outputPath, `${name}.config.mjs`),
2316
+ label: `${upperFirst(name)} Config`,
2317
+ content
2318
+ }))
2320
2319
  ];
2321
2320
  await external_node_fs_default().promises.mkdir(outputPath, {
2322
2321
  recursive: !0
@@ -2362,10 +2361,14 @@ ${section.body}` : section.body).join("\n\n"));
2362
2361
  normalizedConfig: context.normalizedConfig,
2363
2362
  inspectOptions,
2364
2363
  pluginManager
2365
- }), outputPath = (context1 = context, (inspectOptions1 = inspectOptions).outputPath ? (0, external_node_path_namespaceObject.isAbsolute)(inspectOptions1.outputPath) ? inspectOptions1.outputPath : (0, external_node_path_namespaceObject.join)(context1.distPath, inspectOptions1.outputPath) : (0, external_node_path_namespaceObject.join)(context1.distPath, RSBUILD_OUTPUTS_PATH));
2364
+ }), outputPath = (context1 = context, (inspectOptions1 = inspectOptions).outputPath ? (0, external_node_path_namespaceObject.isAbsolute)(inspectOptions1.outputPath) ? inspectOptions1.outputPath : (0, external_node_path_namespaceObject.join)(context1.distPath, inspectOptions1.outputPath) : (0, external_node_path_namespaceObject.join)(context1.distPath, RSBUILD_OUTPUTS_PATH)), rawExtraConfigs = inspectOptions.extraConfigs ? Object.entries(inspectOptions.extraConfigs).map(([name, content])=>({
2365
+ name,
2366
+ content: 'string' == typeof content ? content : stringifyConfig(content, inspectOptions.verbose)
2367
+ })) : void 0;
2366
2368
  return inspectOptions.writeToDisk && await outputInspectConfigFiles({
2367
2369
  rawBundlerConfigs,
2368
2370
  rawEnvironmentConfigs,
2371
+ rawExtraConfigs,
2369
2372
  inspectOptions: {
2370
2373
  ...inspectOptions,
2371
2374
  outputPath
@@ -3416,7 +3419,322 @@ ${section.body}` : section.body).join("\n\n"));
3416
3419
  scriptTests,
3417
3420
  styleTests
3418
3421
  };
3419
- }, normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), joinUrlSegments = (s1, s2)=>s1 && s2 ? addTrailingSlash(s1) + removeLeadingSlash(s2) : s1 || s2 || '', stripBase = (path, base)=>{
3422
+ }, external_node_buffer_namespaceObject = require("node:buffer"), external_node_child_process_namespaceObject = require("node:child_process"), promises_namespaceObject = require("node:fs/promises");
3423
+ function isInsideContainer() {
3424
+ return void 0 === cachedResult && (cachedResult = (()=>{
3425
+ try {
3426
+ return external_node_fs_namespaceObject.statSync('/run/.containerenv'), !0;
3427
+ } catch {
3428
+ return !1;
3429
+ }
3430
+ })() || (void 0 === isDockerCached && (isDockerCached = function() {
3431
+ try {
3432
+ return external_node_fs_namespaceObject.statSync('/.dockerenv'), !0;
3433
+ } catch {
3434
+ return !1;
3435
+ }
3436
+ }() || function() {
3437
+ try {
3438
+ return external_node_fs_namespaceObject.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
3439
+ } catch {
3440
+ return !1;
3441
+ }
3442
+ }()), isDockerCached)), cachedResult;
3443
+ }
3444
+ let isWsl = ()=>{
3445
+ if ('linux' !== external_node_process_namespaceObject.platform) return !1;
3446
+ if (external_node_os_namespaceObject.release().toLowerCase().includes('microsoft')) return !isInsideContainer();
3447
+ try {
3448
+ return !!external_node_fs_namespaceObject.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft') && !isInsideContainer();
3449
+ } catch {
3450
+ return !1;
3451
+ }
3452
+ }, is_wsl = external_node_process_namespaceObject.env.__IS_WSL_TEST__ ? isWsl : isWsl();
3453
+ function defineLazyProperty(object, propertyName, valueGetter) {
3454
+ let define = (value)=>Object.defineProperty(object, propertyName, {
3455
+ value,
3456
+ enumerable: !0,
3457
+ writable: !0
3458
+ });
3459
+ return Object.defineProperty(object, propertyName, {
3460
+ configurable: !0,
3461
+ enumerable: !0,
3462
+ get () {
3463
+ let result = valueGetter();
3464
+ return define(result), result;
3465
+ },
3466
+ set (value) {
3467
+ define(value);
3468
+ }
3469
+ }), object;
3470
+ }
3471
+ let execFileAsync = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
3472
+ async function defaultBrowserId() {
3473
+ if ('darwin' !== external_node_process_namespaceObject.platform) throw Error('macOS only');
3474
+ let { stdout } = await execFileAsync('defaults', [
3475
+ 'read',
3476
+ 'com.apple.LaunchServices/com.apple.launchservices.secure',
3477
+ 'LSHandlers'
3478
+ ]), match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
3479
+ return match?.groups.id ?? 'com.apple.Safari';
3480
+ }
3481
+ let run_applescript_execFileAsync = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
3482
+ async function runAppleScript(script, { humanReadableOutput = !0 } = {}) {
3483
+ if ('darwin' !== external_node_process_namespaceObject.platform) throw Error('macOS only');
3484
+ let { stdout } = await run_applescript_execFileAsync("osascript", [
3485
+ '-e',
3486
+ script,
3487
+ humanReadableOutput ? [] : [
3488
+ '-ss'
3489
+ ]
3490
+ ]);
3491
+ return stdout.trim();
3492
+ }
3493
+ async function bundleName(bundleId) {
3494
+ 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")`);
3495
+ }
3496
+ let windows_execFileAsync = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile), windowsBrowserProgIds = {
3497
+ AppXq0fevzme2pys62n3e0fbqa7peapykr8v: {
3498
+ name: 'Edge',
3499
+ id: 'com.microsoft.edge.old'
3500
+ },
3501
+ MSEdgeDHTML: {
3502
+ name: 'Edge',
3503
+ id: 'com.microsoft.edge'
3504
+ },
3505
+ MSEdgeHTM: {
3506
+ name: 'Edge',
3507
+ id: 'com.microsoft.edge'
3508
+ },
3509
+ 'IE.HTTP': {
3510
+ name: 'Internet Explorer',
3511
+ id: 'com.microsoft.ie'
3512
+ },
3513
+ FirefoxURL: {
3514
+ name: 'Firefox',
3515
+ id: 'org.mozilla.firefox'
3516
+ },
3517
+ ChromeHTML: {
3518
+ name: 'Chrome',
3519
+ id: 'com.google.chrome'
3520
+ },
3521
+ BraveHTML: {
3522
+ name: 'Brave',
3523
+ id: 'com.brave.Browser'
3524
+ },
3525
+ BraveBHTML: {
3526
+ name: 'Brave Beta',
3527
+ id: 'com.brave.Browser.beta'
3528
+ },
3529
+ BraveSSHTM: {
3530
+ name: 'Brave Nightly',
3531
+ id: 'com.brave.Browser.nightly'
3532
+ }
3533
+ };
3534
+ class UnknownBrowserError extends Error {
3535
+ }
3536
+ async function defaultBrowser(_execFileAsync = windows_execFileAsync) {
3537
+ let { stdout } = await _execFileAsync('reg', [
3538
+ 'QUERY',
3539
+ ' HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice',
3540
+ '/v',
3541
+ 'ProgId'
3542
+ ]), match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
3543
+ if (!match) throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
3544
+ let { id } = match.groups, browser = windowsBrowserProgIds[id];
3545
+ if (!browser) throw new UnknownBrowserError(`Unknown browser ID: ${id}`);
3546
+ return browser;
3547
+ }
3548
+ let default_browser_execFileAsync = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
3549
+ async function default_browser_defaultBrowser() {
3550
+ if ('darwin' === external_node_process_namespaceObject.platform) {
3551
+ let id = await defaultBrowserId();
3552
+ return {
3553
+ name: await bundleName(id),
3554
+ id
3555
+ };
3556
+ }
3557
+ if ('linux' === external_node_process_namespaceObject.platform) {
3558
+ let { stdout } = await default_browser_execFileAsync('xdg-mime', [
3559
+ 'query',
3560
+ 'default',
3561
+ 'x-scheme-handler/http'
3562
+ ]), id = stdout.trim();
3563
+ return {
3564
+ name: id.replace(/.desktop$/, '').replace('-', ' ').toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x)=>x.toUpperCase()),
3565
+ id
3566
+ };
3567
+ }
3568
+ if ('win32' === external_node_process_namespaceObject.platform) return defaultBrowser();
3569
+ throw Error('Only macOS, Linux, and Windows are supported');
3570
+ }
3571
+ let execFile = external_node_util_namespaceObject.promisify(external_node_child_process_namespaceObject.execFile), open_dirname = external_node_path_namespaceObject.dirname((0, external_node_url_namespaceObject.fileURLToPath)(__rslib_import_meta_url__)), localXdgOpenPath = external_node_path_namespaceObject.join(open_dirname, 'xdg-open'), { platform, arch } = external_node_process_namespaceObject, getWslDrivesMountPoint = (()=>{
3572
+ let mountPoint, defaultMountPoint = '/mnt/';
3573
+ return async function() {
3574
+ if (mountPoint) return mountPoint;
3575
+ let configFilePath = '/etc/wsl.conf', isConfigFileExists = !1;
3576
+ try {
3577
+ await promises_namespaceObject.access(configFilePath, promises_namespaceObject.constants.F_OK), isConfigFileExists = !0;
3578
+ } catch {}
3579
+ if (!isConfigFileExists) return defaultMountPoint;
3580
+ let configContent = await promises_namespaceObject.readFile(configFilePath, {
3581
+ encoding: 'utf8'
3582
+ }), configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
3583
+ return configMountPoint ? mountPoint = (mountPoint = configMountPoint.groups.mountPoint.trim()).endsWith('/') ? mountPoint : `${mountPoint}/` : defaultMountPoint;
3584
+ };
3585
+ })(), getPowershellPathFromWsl = async ()=>{
3586
+ let mountPoint = await getWslDrivesMountPoint();
3587
+ return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
3588
+ };
3589
+ async function getWindowsDefaultBrowserFromWsl() {
3590
+ let powershellPath = await getPowershellPathFromWsl(), encodedCommand = external_node_buffer_namespaceObject.Buffer.from('(Get-ItemProperty -Path "HKCU:\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice").ProgId', 'utf16le').toString('base64'), { stdout } = await execFile(powershellPath, [
3591
+ '-NoProfile',
3592
+ '-NonInteractive',
3593
+ '-ExecutionPolicy',
3594
+ 'Bypass',
3595
+ '-EncodedCommand',
3596
+ encodedCommand
3597
+ ], {
3598
+ encoding: 'utf8'
3599
+ }), progId = stdout.trim(), browserMap = {
3600
+ ChromeHTML: 'com.google.chrome',
3601
+ MSEdgeHTM: 'com.microsoft.edge',
3602
+ FirefoxURL: 'org.mozilla.firefox'
3603
+ };
3604
+ return browserMap[progId] ? {
3605
+ id: browserMap[progId]
3606
+ } : {};
3607
+ }
3608
+ let pTryEach = async (array, mapper)=>{
3609
+ let latestError;
3610
+ for (let item of array)try {
3611
+ return await mapper(item);
3612
+ } catch (error) {
3613
+ latestError = error;
3614
+ }
3615
+ throw latestError;
3616
+ }, baseOpen = async (options)=>{
3617
+ let command;
3618
+ if (Array.isArray((options = {
3619
+ wait: !1,
3620
+ background: !1,
3621
+ newInstance: !1,
3622
+ allowNonzeroExitCode: !1,
3623
+ ...options
3624
+ }).app)) return pTryEach(options.app, (singleApp)=>baseOpen({
3625
+ ...options,
3626
+ app: singleApp
3627
+ }));
3628
+ let { name: app, arguments: appArguments = [] } = options.app ?? {};
3629
+ if (appArguments = [
3630
+ ...appArguments
3631
+ ], Array.isArray(app)) return pTryEach(app, (appName)=>baseOpen({
3632
+ ...options,
3633
+ app: {
3634
+ name: appName,
3635
+ arguments: appArguments
3636
+ }
3637
+ }));
3638
+ if ('browser' === app || 'browserPrivate' === app) {
3639
+ let ids = {
3640
+ 'com.google.chrome': 'chrome',
3641
+ 'google-chrome.desktop': 'chrome',
3642
+ 'org.mozilla.firefox': 'firefox',
3643
+ 'firefox.desktop': 'firefox',
3644
+ 'com.microsoft.msedge': 'edge',
3645
+ 'com.microsoft.edge': 'edge',
3646
+ 'com.microsoft.edgemac': 'edge',
3647
+ 'microsoft-edge.desktop': 'edge'
3648
+ }, browser = is_wsl ? await getWindowsDefaultBrowserFromWsl() : await default_browser_defaultBrowser();
3649
+ if (browser.id in ids) {
3650
+ let browserName = ids[browser.id];
3651
+ return 'browserPrivate' === app && appArguments.push({
3652
+ chrome: '--incognito',
3653
+ firefox: '--private-window',
3654
+ edge: '--inPrivate'
3655
+ }[browserName]), baseOpen({
3656
+ ...options,
3657
+ app: {
3658
+ name: apps[browserName],
3659
+ arguments: appArguments
3660
+ }
3661
+ });
3662
+ }
3663
+ throw Error(`${browser.name} is not supported as a default browser`);
3664
+ }
3665
+ let cliArguments = [], childProcessOptions = {};
3666
+ 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);
3667
+ else if ('win32' !== platform && (!is_wsl || isInsideContainer() || app)) {
3668
+ if (app) command = app;
3669
+ else {
3670
+ let isBundled = !open_dirname || '/' === open_dirname, exeLocalXdgOpen = !1;
3671
+ try {
3672
+ await promises_namespaceObject.access(localXdgOpenPath, promises_namespaceObject.constants.X_OK), exeLocalXdgOpen = !0;
3673
+ } catch {}
3674
+ command = external_node_process_namespaceObject.versions.electron ?? ('android' === platform || isBundled || !exeLocalXdgOpen) ? 'xdg-open' : localXdgOpenPath;
3675
+ }
3676
+ appArguments.length > 0 && cliArguments.push(...appArguments), options.wait || (childProcessOptions.stdio = 'ignore', childProcessOptions.detached = !0);
3677
+ } else {
3678
+ command = is_wsl ? await getPowershellPathFromWsl() : `${external_node_process_namespaceObject.env.SYSTEMROOT || external_node_process_namespaceObject.env.windir || 'C:\\Windows'}\\System32\\WindowsPowerShell\\v1.0\\powershell`, cliArguments.push('-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-EncodedCommand'), is_wsl || (childProcessOptions.windowsVerbatimArguments = !0);
3679
+ let encodedArguments = [
3680
+ 'Start'
3681
+ ];
3682
+ options.wait && encodedArguments.push('-Wait'), app ? (encodedArguments.push(`"\`"${app}\`""`), options.target && appArguments.push(options.target)) : options.target && encodedArguments.push(`"${options.target}"`), appArguments.length > 0 && (appArguments = appArguments.map((argument)=>`"\`"${argument}\`""`), encodedArguments.push('-ArgumentList', appArguments.join(','))), options.target = external_node_buffer_namespaceObject.Buffer.from(encodedArguments.join(' '), 'utf16le').toString('base64');
3683
+ }
3684
+ 'darwin' === platform && appArguments.length > 0 && cliArguments.push('--args', ...appArguments), options.target && cliArguments.push(options.target);
3685
+ let subprocess = external_node_child_process_namespaceObject.spawn(command, cliArguments, childProcessOptions);
3686
+ return options.wait ? new Promise((resolve, reject)=>{
3687
+ subprocess.once('error', reject), subprocess.once('close', (exitCode)=>{
3688
+ if (!options.allowNonzeroExitCode && exitCode > 0) return void reject(Error(`Exited with code ${exitCode}`));
3689
+ resolve(subprocess);
3690
+ });
3691
+ }) : (subprocess.unref(), subprocess);
3692
+ };
3693
+ function detectArchBinary(binary) {
3694
+ if ('string' == typeof binary || Array.isArray(binary)) return binary;
3695
+ let { [arch]: archBinary } = binary;
3696
+ if (!archBinary) throw Error(`${arch} is not supported`);
3697
+ return archBinary;
3698
+ }
3699
+ function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
3700
+ if (wsl && is_wsl) return detectArchBinary(wsl);
3701
+ if (!platformBinary) throw Error(`${platform} is not supported`);
3702
+ return detectArchBinary(platformBinary);
3703
+ }
3704
+ let apps = {};
3705
+ defineLazyProperty(apps, 'chrome', ()=>detectPlatformBinary({
3706
+ darwin: 'google chrome',
3707
+ win32: 'chrome',
3708
+ linux: [
3709
+ 'google-chrome',
3710
+ 'google-chrome-stable',
3711
+ 'chromium'
3712
+ ]
3713
+ }, {
3714
+ wsl: {
3715
+ ia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',
3716
+ x64: [
3717
+ '/mnt/c/Program Files/Google/Chrome/Application/chrome.exe',
3718
+ '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'
3719
+ ]
3720
+ }
3721
+ })), defineLazyProperty(apps, 'firefox', ()=>detectPlatformBinary({
3722
+ darwin: 'firefox',
3723
+ win32: 'C:\\Program Files\\Mozilla Firefox\\firefox.exe',
3724
+ linux: 'firefox'
3725
+ }, {
3726
+ wsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe'
3727
+ })), defineLazyProperty(apps, 'edge', ()=>detectPlatformBinary({
3728
+ darwin: 'microsoft edge',
3729
+ win32: 'msedge',
3730
+ linux: [
3731
+ 'microsoft-edge',
3732
+ 'microsoft-edge-dev'
3733
+ ]
3734
+ }, {
3735
+ wsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'
3736
+ })), defineLazyProperty(apps, 'browser', ()=>'browser'), defineLazyProperty(apps, 'browserPrivate', ()=>'browserPrivate');
3737
+ let normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), joinUrlSegments = (s1, s2)=>s1 && s2 ? addTrailingSlash(s1) + removeLeadingSlash(s2) : s1 || s2 || '', stripBase = (path, base)=>{
3420
3738
  if (path === base) return '/';
3421
3739
  let trailingSlashBase = addTrailingSlash(base);
3422
3740
  return path.startsWith(trailingSlashBase) ? path.slice(trailingSlashBase.length - 1) : path;
@@ -3602,19 +3920,27 @@ ${section.body}` : section.body).join("\n\n"));
3602
3920
  }
3603
3921
  }
3604
3922
  try {
3605
- let { default: open } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/open/index.js")), { apps } = open, options = browser1 ? {
3923
+ let options = browser1 ? {
3606
3924
  app: {
3607
3925
  name: apps[browser1] ?? browser1,
3608
3926
  arguments: null == browserArgs1 ? void 0 : browserArgs1.split(' ')
3609
3927
  }
3610
3928
  } : {};
3611
- return await open(url, options), !0;
3929
+ return (await ((target, options)=>{
3930
+ if ('string' != typeof target) throw TypeError('Expected a `target`');
3931
+ return baseOpen({
3932
+ ...options,
3933
+ target
3934
+ });
3935
+ })(url, options)).on('error', (err)=>{
3936
+ index_js_namespaceObject.logger.error('Failed to launch browser in child process', err);
3937
+ }), !0;
3612
3938
  } catch (err) {
3613
- return index_js_namespaceObject.logger.error('Failed to open start URL.'), index_js_namespaceObject.logger.error(err), !1;
3939
+ return index_js_namespaceObject.logger.error('Failed to launch browser.'), index_js_namespaceObject.logger.error(err), !1;
3614
3940
  }
3615
3941
  }
3616
3942
  let openedURLs = [], replacePortPlaceholder = (url, port)=>url.replace(/<port>/g, String(port));
3617
- async function open_open({ https, port, routes, config, clearCache }) {
3943
+ async function server_open_open({ https, port, routes, config, clearCache }) {
3618
3944
  let { targets, before } = ((config)=>{
3619
3945
  let { open } = config.server;
3620
3946
  return 'boolean' == typeof open ? {
@@ -3630,7 +3956,6 @@ ${section.body}` : section.body).join("\n\n"));
3630
3956
  before: open.before
3631
3957
  };
3632
3958
  })(config);
3633
- if ('true' === process.env.CSB) return;
3634
3959
  clearCache && (openedURLs = []);
3635
3960
  let urls = [], host = await getHostInUrl(config.server.host), baseUrl = `${https ? 'https' : 'http'}://${host}:${port}`;
3636
3961
  for (let url of (targets.length ? urls.push(...targets.map((target)=>(function(str, base) {
@@ -5163,7 +5488,7 @@ ${section.body}` : section.body).join("\n\n"));
5163
5488
  protocol,
5164
5489
  printUrls: config.server.printUrls,
5165
5490
  trailingLineBreak: !cliShortcutsEnabled
5166
- }), openPage = async ()=>open_open({
5491
+ }), openPage = async ()=>server_open_open({
5167
5492
  https,
5168
5493
  port: port1,
5169
5494
  routes,
@@ -5442,7 +5767,7 @@ ${section.body}` : section.body).join("\n\n"));
5442
5767
  protocol,
5443
5768
  printUrls: serverConfig.printUrls,
5444
5769
  trailingLineBreak: !cliShortcutsEnabled
5445
- }), openPage = async ()=>open_open({
5770
+ }), openPage = async ()=>server_open_open({
5446
5771
  https,
5447
5772
  port,
5448
5773
  routes,
@@ -5501,7 +5826,7 @@ ${section.body}` : section.body).join("\n\n"));
5501
5826
  ...chain.get('experiments'),
5502
5827
  rspackFuture: {
5503
5828
  bundlerInfo: {
5504
- force: !!config.security.sri.enable
5829
+ force: !1
5505
5830
  }
5506
5831
  }
5507
5832
  }), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-silent';
@@ -6340,7 +6665,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6340
6665
  let { config, browserslist } = environment, cacheRoot = external_node_path_default().join(api.context.cachePath, '.swc'), rule = chain.module.rule(CHAIN_ID.RULE.JS).test(SCRIPT_REGEX).type("javascript/auto").dependency({
6341
6666
  not: 'url'
6342
6667
  }).resourceQuery({
6343
- not: /raw|inline/
6668
+ not: /raw/
6344
6669
  });
6345
6670
  chain.module.rule(CHAIN_ID.RULE.JS_RAW).test(SCRIPT_REGEX).type('asset/source').resourceQuery(/raw/);
6346
6671
  let dataUriRule = chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).mimetype({
@@ -6707,7 +7032,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6707
7032
  let config = api.getNormalizedConfig();
6708
7033
  if (config.server.open) {
6709
7034
  var _api_context_devServer;
6710
- open_open({
7035
+ server_open_open({
6711
7036
  https: null == (_api_context_devServer = api.context.devServer) ? void 0 : _api_context_devServer.https,
6712
7037
  port,
6713
7038
  routes,
@@ -7519,11 +7844,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
7519
7844
  ].includes(level) && (index_js_namespaceObject.logger.level = level);
7520
7845
  }
7521
7846
  let { npm_execpath } = process.env;
7522
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && index_js_namespaceObject.logger.log(), index_js_namespaceObject.logger.greet(` Rsbuild v1.4.0\n`);
7847
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && index_js_namespaceObject.logger.log(), index_js_namespaceObject.logger.greet(` Rsbuild v1.4.2\n`);
7523
7848
  try {
7524
7849
  !function() {
7525
7850
  let cli = ((name = "")=>new CAC(name))('rsbuild');
7526
- cli.help(), cli.version("1.4.0"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
7851
+ cli.help(), cli.version("1.4.2"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
7527
7852
  default: 'jiti'
7528
7853
  }).option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m, --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--log-level <level>', 'specify the log level, can be `info`, `warn`, `error` or `silent`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', {
7529
7854
  type: [
@@ -7581,7 +7906,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
7581
7906
  index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), index_js_namespaceObject.logger.error(err);
7582
7907
  }
7583
7908
  }
7584
- let src_version = "1.4.0";
7909
+ let src_version = "1.4.2";
7585
7910
  })(), exports.PLUGIN_CSS_NAME = __webpack_exports__.PLUGIN_CSS_NAME, exports.PLUGIN_SWC_NAME = __webpack_exports__.PLUGIN_SWC_NAME, exports.createRsbuild = __webpack_exports__.createRsbuild, exports.defaultAllowedOrigins = __webpack_exports__.defaultAllowedOrigins, exports.defineConfig = __webpack_exports__.defineConfig, exports.ensureAssetPrefix = __webpack_exports__.ensureAssetPrefix, exports.loadConfig = __webpack_exports__.loadConfig, exports.loadEnv = __webpack_exports__.loadEnv, exports.logger = __webpack_exports__.logger, exports.mergeRsbuildConfig = __webpack_exports__.mergeRsbuildConfig, exports.rspack = __webpack_exports__.rspack, exports.runCLI = __webpack_exports__.runCLI, exports.version = __webpack_exports__.version, __webpack_exports__)-1 === [
7586
7911
  "PLUGIN_CSS_NAME",
7587
7912
  "PLUGIN_SWC_NAME",