@rsbuild/core 1.4.1 → 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/compiled/http-proxy-middleware/index.js +11 -7
- package/compiled/rsbuild-dev-middleware/index.js +5 -3
- package/compiled/sirv/index.js +1 -1
- package/compiled/webpack-bundle-analyzer/index.js +21 -13621
- package/dist/index.cjs +338 -22
- package/dist/index.js +342 -17
- package/package.json +3 -3
- package/compiled/open/index.d.ts +0 -153
- package/compiled/open/index.js +0 -409
- package/compiled/open/package.json +0 -1
- package/compiled/open/xdg-open +0 -1066
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.
|
|
2244
|
+
version: "1.4.2",
|
|
2251
2245
|
rootPath,
|
|
2252
2246
|
distPath: '',
|
|
2253
2247
|
cachePath,
|
|
@@ -3425,7 +3419,322 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3425
3419
|
scriptTests,
|
|
3426
3420
|
styleTests
|
|
3427
3421
|
};
|
|
3428
|
-
},
|
|
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)=>{
|
|
3429
3738
|
if (path === base) return '/';
|
|
3430
3739
|
let trailingSlashBase = addTrailingSlash(base);
|
|
3431
3740
|
return path.startsWith(trailingSlashBase) ? path.slice(trailingSlashBase.length - 1) : path;
|
|
@@ -3611,19 +3920,27 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3611
3920
|
}
|
|
3612
3921
|
}
|
|
3613
3922
|
try {
|
|
3614
|
-
let
|
|
3923
|
+
let options = browser1 ? {
|
|
3615
3924
|
app: {
|
|
3616
3925
|
name: apps[browser1] ?? browser1,
|
|
3617
3926
|
arguments: null == browserArgs1 ? void 0 : browserArgs1.split(' ')
|
|
3618
3927
|
}
|
|
3619
3928
|
} : {};
|
|
3620
|
-
return await
|
|
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;
|
|
3621
3938
|
} catch (err) {
|
|
3622
|
-
return index_js_namespaceObject.logger.error('Failed to
|
|
3939
|
+
return index_js_namespaceObject.logger.error('Failed to launch browser.'), index_js_namespaceObject.logger.error(err), !1;
|
|
3623
3940
|
}
|
|
3624
3941
|
}
|
|
3625
3942
|
let openedURLs = [], replacePortPlaceholder = (url, port)=>url.replace(/<port>/g, String(port));
|
|
3626
|
-
async function
|
|
3943
|
+
async function server_open_open({ https, port, routes, config, clearCache }) {
|
|
3627
3944
|
let { targets, before } = ((config)=>{
|
|
3628
3945
|
let { open } = config.server;
|
|
3629
3946
|
return 'boolean' == typeof open ? {
|
|
@@ -3639,7 +3956,6 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3639
3956
|
before: open.before
|
|
3640
3957
|
};
|
|
3641
3958
|
})(config);
|
|
3642
|
-
if ('true' === process.env.CSB) return;
|
|
3643
3959
|
clearCache && (openedURLs = []);
|
|
3644
3960
|
let urls = [], host = await getHostInUrl(config.server.host), baseUrl = `${https ? 'https' : 'http'}://${host}:${port}`;
|
|
3645
3961
|
for (let url of (targets.length ? urls.push(...targets.map((target)=>(function(str, base) {
|
|
@@ -5172,7 +5488,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5172
5488
|
protocol,
|
|
5173
5489
|
printUrls: config.server.printUrls,
|
|
5174
5490
|
trailingLineBreak: !cliShortcutsEnabled
|
|
5175
|
-
}), openPage = async ()=>
|
|
5491
|
+
}), openPage = async ()=>server_open_open({
|
|
5176
5492
|
https,
|
|
5177
5493
|
port: port1,
|
|
5178
5494
|
routes,
|
|
@@ -5451,7 +5767,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5451
5767
|
protocol,
|
|
5452
5768
|
printUrls: serverConfig.printUrls,
|
|
5453
5769
|
trailingLineBreak: !cliShortcutsEnabled
|
|
5454
|
-
}), openPage = async ()=>
|
|
5770
|
+
}), openPage = async ()=>server_open_open({
|
|
5455
5771
|
https,
|
|
5456
5772
|
port,
|
|
5457
5773
|
routes,
|
|
@@ -5510,7 +5826,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5510
5826
|
...chain.get('experiments'),
|
|
5511
5827
|
rspackFuture: {
|
|
5512
5828
|
bundlerInfo: {
|
|
5513
|
-
force:
|
|
5829
|
+
force: !1
|
|
5514
5830
|
}
|
|
5515
5831
|
}
|
|
5516
5832
|
}), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-silent';
|
|
@@ -6349,7 +6665,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6349
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({
|
|
6350
6666
|
not: 'url'
|
|
6351
6667
|
}).resourceQuery({
|
|
6352
|
-
not: /raw
|
|
6668
|
+
not: /raw/
|
|
6353
6669
|
});
|
|
6354
6670
|
chain.module.rule(CHAIN_ID.RULE.JS_RAW).test(SCRIPT_REGEX).type('asset/source').resourceQuery(/raw/);
|
|
6355
6671
|
let dataUriRule = chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).mimetype({
|
|
@@ -6716,7 +7032,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6716
7032
|
let config = api.getNormalizedConfig();
|
|
6717
7033
|
if (config.server.open) {
|
|
6718
7034
|
var _api_context_devServer;
|
|
6719
|
-
|
|
7035
|
+
server_open_open({
|
|
6720
7036
|
https: null == (_api_context_devServer = api.context.devServer) ? void 0 : _api_context_devServer.https,
|
|
6721
7037
|
port,
|
|
6722
7038
|
routes,
|
|
@@ -7528,11 +7844,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7528
7844
|
].includes(level) && (index_js_namespaceObject.logger.level = level);
|
|
7529
7845
|
}
|
|
7530
7846
|
let { npm_execpath } = process.env;
|
|
7531
|
-
(!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.
|
|
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`);
|
|
7532
7848
|
try {
|
|
7533
7849
|
!function() {
|
|
7534
7850
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
7535
|
-
cli.help(), cli.version("1.4.
|
|
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`', {
|
|
7536
7852
|
default: 'jiti'
|
|
7537
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', {
|
|
7538
7854
|
type: [
|
|
@@ -7590,7 +7906,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7590
7906
|
index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), index_js_namespaceObject.logger.error(err);
|
|
7591
7907
|
}
|
|
7592
7908
|
}
|
|
7593
|
-
let src_version = "1.4.
|
|
7909
|
+
let src_version = "1.4.2";
|
|
7594
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 === [
|
|
7595
7911
|
"PLUGIN_CSS_NAME",
|
|
7596
7912
|
"PLUGIN_SWC_NAME",
|