@rsbuild/core 1.2.18 → 1.2.19
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 +90 -68
- package/dist/index.js +90 -68
- package/dist-types/createContext.d.ts +2 -2
- package/dist-types/index.d.ts +1 -1
- package/dist-types/loadEnv.d.ts +2 -1
- package/dist-types/provider/build.d.ts +1 -0
- package/dist-types/types/rsbuild.d.ts +14 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1556,43 +1556,39 @@ var __webpack_exports__ = {};
|
|
|
1556
1556
|
merged[key] = merge(x[key], y[key], childPath);
|
|
1557
1557
|
}
|
|
1558
1558
|
return merged;
|
|
1559
|
-
}, mergeRsbuildConfig = (...configs)=>2 === configs.length ? merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>merge(result, config), {}), commonOpts = {}, getEnvDir = (cwd, envDir)=>envDir ? external_node_path_default().isAbsolute(envDir) ? envDir : external_node_path_default().join(cwd, envDir) : cwd
|
|
1559
|
+
}, mergeRsbuildConfig = (...configs)=>2 === configs.length ? merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>merge(result, config), {}), commonOpts = {}, getEnvDir = (cwd, envDir)=>envDir ? external_node_path_default().isAbsolute(envDir) ? envDir : external_node_path_default().join(cwd, envDir) : cwd, init_loadConfig = async (root)=>{
|
|
1560
|
+
var _config_server;
|
|
1561
|
+
let { content: config, filePath } = await config_loadConfig({
|
|
1562
|
+
cwd: root,
|
|
1563
|
+
path: commonOpts.config,
|
|
1564
|
+
envMode: commonOpts.envMode,
|
|
1565
|
+
loader: commonOpts.configLoader
|
|
1566
|
+
});
|
|
1567
|
+
return config.dev ||= {}, config.source ||= {}, config.server ||= {}, commonOpts.base && (config.server.base = commonOpts.base), commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), !commonOpts.open || (null === (_config_server = config.server) || void 0 === _config_server ? void 0 : _config_server.open) || (config.server.open = commonOpts.open), commonOpts.host && (config.server.host = commonOpts.host), commonOpts.port && (config.server.port = commonOpts.port), void 0 === config.dev.cliShortcuts && (config.dev.cliShortcuts = !0), filePath && (config.dev.watchFiles = [
|
|
1568
|
+
...config.dev.watchFiles ? castArray(config.dev.watchFiles) : [],
|
|
1569
|
+
{
|
|
1570
|
+
paths: filePath,
|
|
1571
|
+
type: 'reload-server'
|
|
1572
|
+
}
|
|
1573
|
+
]), config;
|
|
1574
|
+
};
|
|
1560
1575
|
async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
1561
1576
|
cliOptions && (commonOpts = cliOptions);
|
|
1562
1577
|
try {
|
|
1563
|
-
|
|
1564
|
-
let cwd = process.cwd(), root = commonOpts.root ? getAbsolutePath(cwd, commonOpts.root) : cwd, envs = loadEnv({
|
|
1565
|
-
cwd: getEnvDir(root, commonOpts.envDir),
|
|
1566
|
-
mode: commonOpts.envMode
|
|
1567
|
-
}), { content: config, filePath: configFilePath } = await config_loadConfig({
|
|
1568
|
-
cwd: root,
|
|
1569
|
-
path: commonOpts.config,
|
|
1570
|
-
envMode: commonOpts.envMode,
|
|
1571
|
-
loader: commonOpts.configLoader
|
|
1572
|
-
});
|
|
1573
|
-
if (config.source ||= {}, config.source.define = {
|
|
1574
|
-
...envs.publicVars,
|
|
1575
|
-
...config.source.define
|
|
1576
|
-
}, commonOpts.base && (config.server ||= {}, config.server.base = commonOpts.base), commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), !commonOpts.open || (null === (_config_server = config.server) || void 0 === _config_server ? void 0 : _config_server.open) || (config.server ||= {}, config.server.open = commonOpts.open), commonOpts.host && (config.server ||= {}, config.server.host = commonOpts.host), commonOpts.port && (config.server ||= {}, config.server.port = commonOpts.port), (null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.cliShortcuts) === void 0 && (config.dev ||= {}, config.dev.cliShortcuts = !0), (null === (_config_performance = config.performance) || void 0 === _config_performance ? void 0 : _config_performance.buildCache) && envs.filePaths.length > 0) {
|
|
1577
|
-
let { buildCache } = config.performance;
|
|
1578
|
-
!0 === buildCache ? config.performance.buildCache = {
|
|
1579
|
-
buildDependencies: envs.filePaths
|
|
1580
|
-
} : (buildCache.buildDependencies ||= [], buildCache.buildDependencies.push(...envs.filePaths));
|
|
1581
|
-
}
|
|
1582
|
-
let rsbuild = await createRsbuild({
|
|
1578
|
+
let cwd = process.cwd(), root = commonOpts.root ? getAbsolutePath(cwd, commonOpts.root) : cwd, rsbuild = await createRsbuild({
|
|
1583
1579
|
cwd: root,
|
|
1584
|
-
rsbuildConfig:
|
|
1585
|
-
environment: commonOpts.environment
|
|
1580
|
+
rsbuildConfig: ()=>init_loadConfig(root),
|
|
1581
|
+
environment: commonOpts.environment,
|
|
1582
|
+
loadEnv: {
|
|
1583
|
+
cwd: getEnvDir(root, commonOpts.envDir),
|
|
1584
|
+
mode: commonOpts.envMode
|
|
1585
|
+
}
|
|
1586
1586
|
});
|
|
1587
1587
|
return rsbuild.onBeforeCreateCompiler(()=>{
|
|
1588
1588
|
let command = process.argv[2];
|
|
1589
1589
|
if ('dev' === command || isBuildWatch) {
|
|
1590
1590
|
var _config_dev;
|
|
1591
|
-
let files = [
|
|
1592
|
-
...envs.filePaths
|
|
1593
|
-
];
|
|
1594
|
-
configFilePath && files.push(configFilePath);
|
|
1595
|
-
let config = rsbuild.getNormalizedConfig();
|
|
1591
|
+
let files = [], config = rsbuild.getNormalizedConfig();
|
|
1596
1592
|
if (null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.watchFiles) for (let watchFilesConfig of castArray(config.dev.watchFiles)){
|
|
1597
1593
|
if ('reload-server' !== watchFilesConfig.type) continue;
|
|
1598
1594
|
let paths = castArray(watchFilesConfig.paths);
|
|
@@ -1600,7 +1596,7 @@ var __webpack_exports__ = {};
|
|
|
1600
1596
|
}
|
|
1601
1597
|
watchFilesForRestart(files, root, isBuildWatch);
|
|
1602
1598
|
}
|
|
1603
|
-
}), rsbuild
|
|
1599
|
+
}), rsbuild;
|
|
1604
1600
|
} catch (err) {
|
|
1605
1601
|
if (isRestart) rslog_index_js_namespaceObject.logger.error(err);
|
|
1606
1602
|
else throw err;
|
|
@@ -2379,14 +2375,14 @@ var __webpack_exports__ = {};
|
|
|
2379
2375
|
});
|
|
2380
2376
|
}
|
|
2381
2377
|
}
|
|
2382
|
-
async function createContext(options, userConfig
|
|
2378
|
+
async function createContext(options, userConfig) {
|
|
2383
2379
|
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(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;
|
|
2384
2380
|
return {
|
|
2385
|
-
version: "1.2.
|
|
2381
|
+
version: "1.2.19",
|
|
2386
2382
|
rootPath,
|
|
2387
2383
|
distPath: '',
|
|
2388
2384
|
cachePath,
|
|
2389
|
-
bundlerType,
|
|
2385
|
+
bundlerType: userConfig.provider ? 'webpack' : 'rspack',
|
|
2390
2386
|
environments: {},
|
|
2391
2387
|
hooks: {
|
|
2392
2388
|
onExit: createAsyncHook(),
|
|
@@ -5362,24 +5358,24 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
5362
5358
|
getStats(name) {
|
|
5363
5359
|
let curStats = this.stats[name];
|
|
5364
5360
|
if (!curStats) return null;
|
|
5365
|
-
let statsOptions = getStatsOptions(curStats.compilation.compiler)
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5361
|
+
let statsOptions = getStatsOptions(curStats.compilation.compiler), statsJson = curStats.toJson({
|
|
5362
|
+
all: !1,
|
|
5363
|
+
hash: !0,
|
|
5364
|
+
assets: !0,
|
|
5365
|
+
warnings: !0,
|
|
5366
|
+
warningsCount: !0,
|
|
5367
|
+
errors: !0,
|
|
5368
|
+
errorsCount: !0,
|
|
5369
|
+
errorDetails: !1,
|
|
5370
|
+
entrypoints: !0,
|
|
5371
|
+
children: !0,
|
|
5372
|
+
moduleTrace: !0,
|
|
5373
|
+
...statsOptions
|
|
5374
|
+
});
|
|
5375
|
+
return statsJson ? {
|
|
5376
|
+
statsJson,
|
|
5381
5377
|
root: curStats.compilation.compiler.options.context
|
|
5382
|
-
};
|
|
5378
|
+
} : null;
|
|
5383
5379
|
}
|
|
5384
5380
|
sendStats({ force = !1, compilationId }) {
|
|
5385
5381
|
let result = this.getStats(compilationId);
|
|
@@ -6468,7 +6464,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6468
6464
|
rspackConfigs
|
|
6469
6465
|
};
|
|
6470
6466
|
}
|
|
6471
|
-
let build_build = async (initOptions, { watch, compiler: customCompiler } = {})=>{
|
|
6467
|
+
let RSPACK_BUILD_ERROR = 'Rspack build failed.', build_build = async (initOptions, { watch, compiler: customCompiler } = {})=>{
|
|
6472
6468
|
let compiler, bundlerConfigs;
|
|
6473
6469
|
let { context } = initOptions;
|
|
6474
6470
|
if (customCompiler) compiler = customCompiler;
|
|
@@ -6493,7 +6489,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6493
6489
|
};
|
|
6494
6490
|
let { stats } = await new Promise((resolve, reject)=>{
|
|
6495
6491
|
compiler.run((err, stats)=>{
|
|
6496
|
-
err ? reject(err) : (null == stats ? void 0 : stats.hasErrors()) ? reject(Error(
|
|
6492
|
+
err ? reject(err) : (null == stats ? void 0 : stats.hasErrors()) ? reject(Error(RSPACK_BUILD_ERROR)) : compiler.close((closeErr)=>{
|
|
6497
6493
|
closeErr && rslog_index_js_namespaceObject.logger.error(closeErr), resolve({
|
|
6498
6494
|
stats
|
|
6499
6495
|
});
|
|
@@ -6789,10 +6785,34 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6789
6785
|
}
|
|
6790
6786
|
async function createRsbuild(options = {}) {
|
|
6791
6787
|
let plugins;
|
|
6792
|
-
let
|
|
6788
|
+
let envs = options.loadEnv ? loadEnv({
|
|
6789
|
+
cwd: options.cwd,
|
|
6790
|
+
...'boolean' == typeof options.loadEnv ? {} : options.loadEnv
|
|
6791
|
+
}) : null, config = isFunction(options.rsbuildConfig) ? await options.rsbuildConfig() : options.rsbuildConfig || {};
|
|
6792
|
+
!function(config, envs) {
|
|
6793
|
+
var _config_performance;
|
|
6794
|
+
if (null !== envs) {
|
|
6795
|
+
if (config.source ||= {}, config.source.define = {
|
|
6796
|
+
...envs.publicVars,
|
|
6797
|
+
...config.source.define
|
|
6798
|
+
}, 0 !== envs.filePaths.length && (config.dev ||= {}, config.dev.watchFiles = [
|
|
6799
|
+
...config.dev.watchFiles ? castArray(config.dev.watchFiles) : [],
|
|
6800
|
+
{
|
|
6801
|
+
paths: envs.filePaths,
|
|
6802
|
+
type: 'reload-server'
|
|
6803
|
+
}
|
|
6804
|
+
], null === (_config_performance = config.performance) || void 0 === _config_performance ? void 0 : _config_performance.buildCache)) {
|
|
6805
|
+
let { buildCache } = config.performance;
|
|
6806
|
+
!0 === buildCache ? config.performance.buildCache = {
|
|
6807
|
+
buildDependencies: envs.filePaths
|
|
6808
|
+
} : (buildCache.buildDependencies ||= [], buildCache.buildDependencies.push(...envs.filePaths));
|
|
6809
|
+
}
|
|
6810
|
+
}
|
|
6811
|
+
}(config, envs);
|
|
6812
|
+
let resolvedOptions = {
|
|
6793
6813
|
cwd: process.cwd(),
|
|
6794
|
-
|
|
6795
|
-
|
|
6814
|
+
...options,
|
|
6815
|
+
rsbuildConfig: config
|
|
6796
6816
|
}, pluginManager = (plugins = [], {
|
|
6797
6817
|
getPlugins: (options = {
|
|
6798
6818
|
environment: RSBUILD_ALL_ENVIRONMENT_SYMBOL
|
|
@@ -6844,7 +6864,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6844
6864
|
isPluginExists: (pluginName, options = {
|
|
6845
6865
|
environment: RSBUILD_ALL_ENVIRONMENT_SYMBOL
|
|
6846
6866
|
})=>!!plugins.find((plugin)=>plugin.instance.name === pluginName && isPluginMatchEnvironment(plugin.environment, options.environment))
|
|
6847
|
-
}), context = await createContext(
|
|
6867
|
+
}), context = await createContext(resolvedOptions, config), getPluginAPI = function({ context, pluginManager }) {
|
|
6848
6868
|
let { hooks } = context, publicContext = function(context) {
|
|
6849
6869
|
let exposedKeys = [
|
|
6850
6870
|
'version',
|
|
@@ -7025,10 +7045,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7025
7045
|
context.getPluginAPI = getPluginAPI;
|
|
7026
7046
|
let globalPluginAPI = getPluginAPI();
|
|
7027
7047
|
rslog_index_js_namespaceObject.logger.debug('add default plugins'), await applyDefaultPlugins(pluginManager, context), rslog_index_js_namespaceObject.logger.debug('add default plugins done');
|
|
7028
|
-
let provider =
|
|
7048
|
+
let provider = config.provider || rspackProvider, providerInstance = await provider({
|
|
7029
7049
|
context,
|
|
7030
7050
|
pluginManager,
|
|
7031
|
-
rsbuildOptions,
|
|
7051
|
+
rsbuildOptions: resolvedOptions,
|
|
7032
7052
|
helpers: provider_helpers_namespaceObject
|
|
7033
7053
|
}), rsbuild = {
|
|
7034
7054
|
build: async (...args)=>{
|
|
@@ -7086,19 +7106,21 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7086
7106
|
'initConfigs',
|
|
7087
7107
|
'inspectConfig'
|
|
7088
7108
|
])
|
|
7089
|
-
}
|
|
7109
|
+
};
|
|
7110
|
+
envs && (rsbuild.onCloseBuild(envs.cleanup), rsbuild.onCloseDevServer(envs.cleanup));
|
|
7111
|
+
let getFlattenedPlugins = async (pluginOptions)=>{
|
|
7090
7112
|
let plugins = pluginOptions;
|
|
7091
7113
|
do plugins = (await Promise.all(plugins)).flat(Number.POSITIVE_INFINITY);
|
|
7092
7114
|
while (plugins.some((v)=>(0, types_namespaceObject.isPromise)(v)));
|
|
7093
7115
|
return plugins;
|
|
7094
7116
|
};
|
|
7095
|
-
if (
|
|
7096
|
-
let plugins = await getFlattenedPlugins(
|
|
7117
|
+
if (config.plugins) {
|
|
7118
|
+
let plugins = await getFlattenedPlugins(config.plugins);
|
|
7097
7119
|
rsbuild.addPlugins(plugins);
|
|
7098
7120
|
}
|
|
7099
|
-
return
|
|
7100
|
-
if (!
|
|
7101
|
-
let plugins = await getFlattenedPlugins(
|
|
7121
|
+
return config.environments && await Promise.all(Object.entries(config.environments).map(async ([name, environmentConfig])=>{
|
|
7122
|
+
if (!environmentConfig.plugins || context.specifiedEnvironments && !context.specifiedEnvironments.includes(name)) return;
|
|
7123
|
+
let plugins = await getFlattenedPlugins(environmentConfig.plugins);
|
|
7102
7124
|
rsbuild.addPlugins(plugins, {
|
|
7103
7125
|
environment: name
|
|
7104
7126
|
});
|
|
@@ -7432,13 +7454,13 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
7432
7454
|
}
|
|
7433
7455
|
}(), process.title = 'rsbuild-node';
|
|
7434
7456
|
let { npm_execpath } = process.env;
|
|
7435
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.
|
|
7457
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.2.19\n`);
|
|
7436
7458
|
}();
|
|
7437
7459
|
try {
|
|
7438
7460
|
!function() {
|
|
7439
7461
|
let cli = cac_dist('rsbuild');
|
|
7440
|
-
cli.help(), cli.version("1.2.
|
|
7441
|
-
let devCommand = cli.command('
|
|
7462
|
+
cli.help(), cli.version("1.2.19"), applyCommonOptions(cli);
|
|
7463
|
+
let devCommand = cli.command('', 'starting the dev server').alias('dev'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
|
|
7442
7464
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
7443
7465
|
try {
|
|
7444
7466
|
let rsbuild = await init({
|
|
@@ -7458,7 +7480,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
7458
7480
|
}));
|
|
7459
7481
|
buildInstance && (options.watch ? onBeforeRestartServer(buildInstance.close) : await buildInstance.close());
|
|
7460
7482
|
} catch (err) {
|
|
7461
|
-
rslog_index_js_namespaceObject.logger.error('Failed to build.'), rslog_index_js_namespaceObject.logger.error(err), process.exit(1);
|
|
7483
|
+
err instanceof Error && err.message === RSPACK_BUILD_ERROR || rslog_index_js_namespaceObject.logger.error('Failed to build.'), rslog_index_js_namespaceObject.logger.error(err), process.exit(1);
|
|
7462
7484
|
}
|
|
7463
7485
|
}), previewCommand.action(async (options)=>{
|
|
7464
7486
|
try {
|
|
@@ -7488,7 +7510,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
7488
7510
|
rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
|
|
7489
7511
|
}
|
|
7490
7512
|
}
|
|
7491
|
-
let src_rslib_entry_version = "1.2.
|
|
7513
|
+
let src_rslib_entry_version = "1.2.19";
|
|
7492
7514
|
})();
|
|
7493
7515
|
var __webpack_export_target__ = exports;
|
|
7494
7516
|
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
package/dist/index.js
CHANGED
|
@@ -1458,43 +1458,39 @@ let configCache = {}, OVERRIDE_PATHS = [
|
|
|
1458
1458
|
merged[key] = merge(x[key], y[key], childPath);
|
|
1459
1459
|
}
|
|
1460
1460
|
return merged;
|
|
1461
|
-
}, mergeRsbuildConfig = (...configs)=>2 === configs.length ? merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>merge(result, config), {}), commonOpts = {}, getEnvDir = (cwd, envDir)=>envDir ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.isAbsolute(envDir) ? envDir : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(cwd, envDir) : cwd
|
|
1461
|
+
}, mergeRsbuildConfig = (...configs)=>2 === configs.length ? merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>merge(result, config), {}), commonOpts = {}, getEnvDir = (cwd, envDir)=>envDir ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.isAbsolute(envDir) ? envDir : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(cwd, envDir) : cwd, init_loadConfig = async (root)=>{
|
|
1462
|
+
var _config_server;
|
|
1463
|
+
let { content: config, filePath } = await config_loadConfig({
|
|
1464
|
+
cwd: root,
|
|
1465
|
+
path: commonOpts.config,
|
|
1466
|
+
envMode: commonOpts.envMode,
|
|
1467
|
+
loader: commonOpts.configLoader
|
|
1468
|
+
});
|
|
1469
|
+
return config.dev ||= {}, config.source ||= {}, config.server ||= {}, commonOpts.base && (config.server.base = commonOpts.base), commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), !commonOpts.open || (null === (_config_server = config.server) || void 0 === _config_server ? void 0 : _config_server.open) || (config.server.open = commonOpts.open), commonOpts.host && (config.server.host = commonOpts.host), commonOpts.port && (config.server.port = commonOpts.port), void 0 === config.dev.cliShortcuts && (config.dev.cliShortcuts = !0), filePath && (config.dev.watchFiles = [
|
|
1470
|
+
...config.dev.watchFiles ? castArray(config.dev.watchFiles) : [],
|
|
1471
|
+
{
|
|
1472
|
+
paths: filePath,
|
|
1473
|
+
type: 'reload-server'
|
|
1474
|
+
}
|
|
1475
|
+
]), config;
|
|
1476
|
+
};
|
|
1462
1477
|
async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
1463
1478
|
cliOptions && (commonOpts = cliOptions);
|
|
1464
1479
|
try {
|
|
1465
|
-
|
|
1466
|
-
let cwd = process.cwd(), root = commonOpts.root ? getAbsolutePath(cwd, commonOpts.root) : cwd, envs = loadEnv({
|
|
1467
|
-
cwd: getEnvDir(root, commonOpts.envDir),
|
|
1468
|
-
mode: commonOpts.envMode
|
|
1469
|
-
}), { content: config, filePath: configFilePath } = await config_loadConfig({
|
|
1470
|
-
cwd: root,
|
|
1471
|
-
path: commonOpts.config,
|
|
1472
|
-
envMode: commonOpts.envMode,
|
|
1473
|
-
loader: commonOpts.configLoader
|
|
1474
|
-
});
|
|
1475
|
-
if (config.source ||= {}, config.source.define = {
|
|
1476
|
-
...envs.publicVars,
|
|
1477
|
-
...config.source.define
|
|
1478
|
-
}, commonOpts.base && (config.server ||= {}, config.server.base = commonOpts.base), commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), !commonOpts.open || (null === (_config_server = config.server) || void 0 === _config_server ? void 0 : _config_server.open) || (config.server ||= {}, config.server.open = commonOpts.open), commonOpts.host && (config.server ||= {}, config.server.host = commonOpts.host), commonOpts.port && (config.server ||= {}, config.server.port = commonOpts.port), (null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.cliShortcuts) === void 0 && (config.dev ||= {}, config.dev.cliShortcuts = !0), (null === (_config_performance = config.performance) || void 0 === _config_performance ? void 0 : _config_performance.buildCache) && envs.filePaths.length > 0) {
|
|
1479
|
-
let { buildCache } = config.performance;
|
|
1480
|
-
!0 === buildCache ? config.performance.buildCache = {
|
|
1481
|
-
buildDependencies: envs.filePaths
|
|
1482
|
-
} : (buildCache.buildDependencies ||= [], buildCache.buildDependencies.push(...envs.filePaths));
|
|
1483
|
-
}
|
|
1484
|
-
let rsbuild = await createRsbuild({
|
|
1480
|
+
let cwd = process.cwd(), root = commonOpts.root ? getAbsolutePath(cwd, commonOpts.root) : cwd, rsbuild = await createRsbuild({
|
|
1485
1481
|
cwd: root,
|
|
1486
|
-
rsbuildConfig:
|
|
1487
|
-
environment: commonOpts.environment
|
|
1482
|
+
rsbuildConfig: ()=>init_loadConfig(root),
|
|
1483
|
+
environment: commonOpts.environment,
|
|
1484
|
+
loadEnv: {
|
|
1485
|
+
cwd: getEnvDir(root, commonOpts.envDir),
|
|
1486
|
+
mode: commonOpts.envMode
|
|
1487
|
+
}
|
|
1488
1488
|
});
|
|
1489
1489
|
return rsbuild.onBeforeCreateCompiler(()=>{
|
|
1490
1490
|
let command = process.argv[2];
|
|
1491
1491
|
if ('dev' === command || isBuildWatch) {
|
|
1492
1492
|
var _config_dev;
|
|
1493
|
-
let files = [
|
|
1494
|
-
...envs.filePaths
|
|
1495
|
-
];
|
|
1496
|
-
configFilePath && files.push(configFilePath);
|
|
1497
|
-
let config = rsbuild.getNormalizedConfig();
|
|
1493
|
+
let files = [], config = rsbuild.getNormalizedConfig();
|
|
1498
1494
|
if (null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.watchFiles) for (let watchFilesConfig of castArray(config.dev.watchFiles)){
|
|
1499
1495
|
if ('reload-server' !== watchFilesConfig.type) continue;
|
|
1500
1496
|
let paths = castArray(watchFilesConfig.paths);
|
|
@@ -1502,7 +1498,7 @@ async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
|
1502
1498
|
}
|
|
1503
1499
|
watchFilesForRestart(files, root, isBuildWatch);
|
|
1504
1500
|
}
|
|
1505
|
-
}), rsbuild
|
|
1501
|
+
}), rsbuild;
|
|
1506
1502
|
} catch (err) {
|
|
1507
1503
|
if (isRestart) __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
1508
1504
|
else throw err;
|
|
@@ -2281,14 +2277,14 @@ async function updateEnvironmentContext(context, configs) {
|
|
|
2281
2277
|
});
|
|
2282
2278
|
}
|
|
2283
2279
|
}
|
|
2284
|
-
async function createContext(options, userConfig
|
|
2280
|
+
async function createContext(options, userConfig) {
|
|
2285
2281
|
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
2286
2282
|
return {
|
|
2287
|
-
version: "1.2.
|
|
2283
|
+
version: "1.2.19",
|
|
2288
2284
|
rootPath,
|
|
2289
2285
|
distPath: '',
|
|
2290
2286
|
cachePath,
|
|
2291
|
-
bundlerType,
|
|
2287
|
+
bundlerType: userConfig.provider ? 'webpack' : 'rspack',
|
|
2292
2288
|
environments: {},
|
|
2293
2289
|
hooks: {
|
|
2294
2290
|
onExit: createAsyncHook(),
|
|
@@ -5249,24 +5245,24 @@ class SocketServer {
|
|
|
5249
5245
|
getStats(name) {
|
|
5250
5246
|
let curStats = this.stats[name];
|
|
5251
5247
|
if (!curStats) return null;
|
|
5252
|
-
let statsOptions = getStatsOptions(curStats.compilation.compiler)
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5248
|
+
let statsOptions = getStatsOptions(curStats.compilation.compiler), statsJson = curStats.toJson({
|
|
5249
|
+
all: !1,
|
|
5250
|
+
hash: !0,
|
|
5251
|
+
assets: !0,
|
|
5252
|
+
warnings: !0,
|
|
5253
|
+
warningsCount: !0,
|
|
5254
|
+
errors: !0,
|
|
5255
|
+
errorsCount: !0,
|
|
5256
|
+
errorDetails: !1,
|
|
5257
|
+
entrypoints: !0,
|
|
5258
|
+
children: !0,
|
|
5259
|
+
moduleTrace: !0,
|
|
5260
|
+
...statsOptions
|
|
5261
|
+
});
|
|
5262
|
+
return statsJson ? {
|
|
5263
|
+
statsJson,
|
|
5268
5264
|
root: curStats.compilation.compiler.options.context
|
|
5269
|
-
};
|
|
5265
|
+
} : null;
|
|
5270
5266
|
}
|
|
5271
5267
|
sendStats({ force = !1, compilationId }) {
|
|
5272
5268
|
let result = this.getStats(compilationId);
|
|
@@ -6350,7 +6346,7 @@ async function createCompiler_createCompiler(options) {
|
|
|
6350
6346
|
rspackConfigs
|
|
6351
6347
|
};
|
|
6352
6348
|
}
|
|
6353
|
-
let build_build = async (initOptions, { watch, compiler: customCompiler } = {})=>{
|
|
6349
|
+
let RSPACK_BUILD_ERROR = 'Rspack build failed.', build_build = async (initOptions, { watch, compiler: customCompiler } = {})=>{
|
|
6354
6350
|
let compiler, bundlerConfigs;
|
|
6355
6351
|
let { context } = initOptions;
|
|
6356
6352
|
if (customCompiler) compiler = customCompiler;
|
|
@@ -6375,7 +6371,7 @@ let build_build = async (initOptions, { watch, compiler: customCompiler } = {})=
|
|
|
6375
6371
|
};
|
|
6376
6372
|
let { stats } = await new Promise((resolve, reject)=>{
|
|
6377
6373
|
compiler.run((err, stats)=>{
|
|
6378
|
-
err ? reject(err) : (null == stats ? void 0 : stats.hasErrors()) ? reject(Error(
|
|
6374
|
+
err ? reject(err) : (null == stats ? void 0 : stats.hasErrors()) ? reject(Error(RSPACK_BUILD_ERROR)) : compiler.close((closeErr)=>{
|
|
6379
6375
|
closeErr && __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(closeErr), resolve({
|
|
6380
6376
|
stats
|
|
6381
6377
|
});
|
|
@@ -6671,10 +6667,34 @@ async function applyDefaultPlugins(pluginManager, context) {
|
|
|
6671
6667
|
}
|
|
6672
6668
|
async function createRsbuild(options = {}) {
|
|
6673
6669
|
let plugins;
|
|
6674
|
-
let
|
|
6670
|
+
let envs = options.loadEnv ? loadEnv({
|
|
6671
|
+
cwd: options.cwd,
|
|
6672
|
+
...'boolean' == typeof options.loadEnv ? {} : options.loadEnv
|
|
6673
|
+
}) : null, config = isFunction(options.rsbuildConfig) ? await options.rsbuildConfig() : options.rsbuildConfig || {};
|
|
6674
|
+
!function(config, envs) {
|
|
6675
|
+
var _config_performance;
|
|
6676
|
+
if (null !== envs) {
|
|
6677
|
+
if (config.source ||= {}, config.source.define = {
|
|
6678
|
+
...envs.publicVars,
|
|
6679
|
+
...config.source.define
|
|
6680
|
+
}, 0 !== envs.filePaths.length && (config.dev ||= {}, config.dev.watchFiles = [
|
|
6681
|
+
...config.dev.watchFiles ? castArray(config.dev.watchFiles) : [],
|
|
6682
|
+
{
|
|
6683
|
+
paths: envs.filePaths,
|
|
6684
|
+
type: 'reload-server'
|
|
6685
|
+
}
|
|
6686
|
+
], null === (_config_performance = config.performance) || void 0 === _config_performance ? void 0 : _config_performance.buildCache)) {
|
|
6687
|
+
let { buildCache } = config.performance;
|
|
6688
|
+
!0 === buildCache ? config.performance.buildCache = {
|
|
6689
|
+
buildDependencies: envs.filePaths
|
|
6690
|
+
} : (buildCache.buildDependencies ||= [], buildCache.buildDependencies.push(...envs.filePaths));
|
|
6691
|
+
}
|
|
6692
|
+
}
|
|
6693
|
+
}(config, envs);
|
|
6694
|
+
let resolvedOptions = {
|
|
6675
6695
|
cwd: process.cwd(),
|
|
6676
|
-
|
|
6677
|
-
|
|
6696
|
+
...options,
|
|
6697
|
+
rsbuildConfig: config
|
|
6678
6698
|
}, pluginManager = (plugins = [], {
|
|
6679
6699
|
getPlugins: (options = {
|
|
6680
6700
|
environment: RSBUILD_ALL_ENVIRONMENT_SYMBOL
|
|
@@ -6726,7 +6746,7 @@ async function createRsbuild(options = {}) {
|
|
|
6726
6746
|
isPluginExists: (pluginName, options = {
|
|
6727
6747
|
environment: RSBUILD_ALL_ENVIRONMENT_SYMBOL
|
|
6728
6748
|
})=>!!plugins.find((plugin)=>plugin.instance.name === pluginName && isPluginMatchEnvironment(plugin.environment, options.environment))
|
|
6729
|
-
}), context = await createContext(
|
|
6749
|
+
}), context = await createContext(resolvedOptions, config), getPluginAPI = function({ context, pluginManager }) {
|
|
6730
6750
|
let { hooks } = context, publicContext = function(context) {
|
|
6731
6751
|
let exposedKeys = [
|
|
6732
6752
|
'version',
|
|
@@ -6907,10 +6927,10 @@ async function createRsbuild(options = {}) {
|
|
|
6907
6927
|
context.getPluginAPI = getPluginAPI;
|
|
6908
6928
|
let globalPluginAPI = getPluginAPI();
|
|
6909
6929
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('add default plugins'), await applyDefaultPlugins(pluginManager, context), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug('add default plugins done');
|
|
6910
|
-
let provider =
|
|
6930
|
+
let provider = config.provider || rspackProvider, providerInstance = await provider({
|
|
6911
6931
|
context,
|
|
6912
6932
|
pluginManager,
|
|
6913
|
-
rsbuildOptions,
|
|
6933
|
+
rsbuildOptions: resolvedOptions,
|
|
6914
6934
|
helpers: provider_helpers_namespaceObject
|
|
6915
6935
|
}), rsbuild = {
|
|
6916
6936
|
build: async (...args)=>{
|
|
@@ -6968,19 +6988,21 @@ async function createRsbuild(options = {}) {
|
|
|
6968
6988
|
'initConfigs',
|
|
6969
6989
|
'inspectConfig'
|
|
6970
6990
|
])
|
|
6971
|
-
}
|
|
6991
|
+
};
|
|
6992
|
+
envs && (rsbuild.onCloseBuild(envs.cleanup), rsbuild.onCloseDevServer(envs.cleanup));
|
|
6993
|
+
let getFlattenedPlugins = async (pluginOptions)=>{
|
|
6972
6994
|
let plugins = pluginOptions;
|
|
6973
6995
|
do plugins = (await Promise.all(plugins)).flat(Number.POSITIVE_INFINITY);
|
|
6974
6996
|
while (plugins.some((v)=>(0, __WEBPACK_EXTERNAL_MODULE_node_util_types_ce11fc49__.isPromise)(v)));
|
|
6975
6997
|
return plugins;
|
|
6976
6998
|
};
|
|
6977
|
-
if (
|
|
6978
|
-
let plugins = await getFlattenedPlugins(
|
|
6999
|
+
if (config.plugins) {
|
|
7000
|
+
let plugins = await getFlattenedPlugins(config.plugins);
|
|
6979
7001
|
rsbuild.addPlugins(plugins);
|
|
6980
7002
|
}
|
|
6981
|
-
return
|
|
6982
|
-
if (!
|
|
6983
|
-
let plugins = await getFlattenedPlugins(
|
|
7003
|
+
return config.environments && await Promise.all(Object.entries(config.environments).map(async ([name, environmentConfig])=>{
|
|
7004
|
+
if (!environmentConfig.plugins || context.specifiedEnvironments && !context.specifiedEnvironments.includes(name)) return;
|
|
7005
|
+
let plugins = await getFlattenedPlugins(environmentConfig.plugins);
|
|
6984
7006
|
rsbuild.addPlugins(plugins, {
|
|
6985
7007
|
environment: name
|
|
6986
7008
|
});
|
|
@@ -7313,13 +7335,13 @@ async function runCLI() {
|
|
|
7313
7335
|
}
|
|
7314
7336
|
}(), process.title = 'rsbuild-node';
|
|
7315
7337
|
let { npm_execpath } = process.env;
|
|
7316
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.2.
|
|
7338
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.2.19\n`);
|
|
7317
7339
|
}();
|
|
7318
7340
|
try {
|
|
7319
7341
|
!function() {
|
|
7320
7342
|
let cli = cac_dist('rsbuild');
|
|
7321
|
-
cli.help(), cli.version("1.2.
|
|
7322
|
-
let devCommand = cli.command('
|
|
7343
|
+
cli.help(), cli.version("1.2.19"), applyCommonOptions(cli);
|
|
7344
|
+
let devCommand = cli.command('', 'starting the dev server').alias('dev'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
|
|
7323
7345
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
7324
7346
|
try {
|
|
7325
7347
|
let rsbuild = await init({
|
|
@@ -7339,7 +7361,7 @@ async function runCLI() {
|
|
|
7339
7361
|
}));
|
|
7340
7362
|
buildInstance && (options.watch ? onBeforeRestartServer(buildInstance.close) : await buildInstance.close());
|
|
7341
7363
|
} catch (err) {
|
|
7342
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to build.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err), process.exit(1);
|
|
7364
|
+
err instanceof Error && err.message === RSPACK_BUILD_ERROR || __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to build.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err), process.exit(1);
|
|
7343
7365
|
}
|
|
7344
7366
|
}), previewCommand.action(async (options)=>{
|
|
7345
7367
|
try {
|
|
@@ -7369,6 +7391,6 @@ async function runCLI() {
|
|
|
7369
7391
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to start Rsbuild CLI.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
7370
7392
|
}
|
|
7371
7393
|
}
|
|
7372
|
-
let src_version = "1.2.
|
|
7394
|
+
let src_version = "1.2.19";
|
|
7373
7395
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
|
|
7374
7396
|
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defineConfig, ensureAssetPrefix, config_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, runCLI, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { InternalContext, NormalizedEnvironmentConfig, ResolvedCreateRsbuildOptions, RsbuildConfig, RsbuildContext } from './types';
|
|
2
2
|
export declare function getBrowserslist(path: string): Promise<string[] | null>;
|
|
3
3
|
export declare function getBrowserslistByEnvironment(path: string, config: NormalizedEnvironmentConfig): Promise<string[]>;
|
|
4
4
|
export declare function updateEnvironmentContext(context: InternalContext, configs: Record<string, NormalizedEnvironmentConfig>): Promise<void>;
|
|
@@ -8,4 +8,4 @@ export declare function createPublicContext(context: RsbuildContext): Readonly<R
|
|
|
8
8
|
* Generate the actual context used in the build,
|
|
9
9
|
* which can have a lot of overhead and take some side effects.
|
|
10
10
|
*/
|
|
11
|
-
export declare function createContext(options: ResolvedCreateRsbuildOptions, userConfig: RsbuildConfig
|
|
11
|
+
export declare function createContext(options: ResolvedCreateRsbuildOptions, userConfig: RsbuildConfig): Promise<InternalContext>;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { rspack } from '@rspack/core';
|
|
6
6
|
import type * as Rspack from '@rspack/core';
|
|
7
|
-
export { loadEnv } from './loadEnv';
|
|
7
|
+
export { loadEnv, type LoadEnvOptions, type LoadEnvResult } from './loadEnv';
|
|
8
8
|
export { createRsbuild } from './createRsbuild';
|
|
9
9
|
export { loadConfig, defineConfig, type ConfigParams, type LoadConfigOptions, type LoadConfigResult, } from './config';
|
|
10
10
|
export { runCLI } from './cli';
|
package/dist-types/loadEnv.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export type LoadEnvOptions = {
|
|
|
21
21
|
*/
|
|
22
22
|
processEnv?: Record<string, string>;
|
|
23
23
|
};
|
|
24
|
-
export
|
|
24
|
+
export type LoadEnvResult = {
|
|
25
25
|
/**
|
|
26
26
|
* All env variables in the .env file
|
|
27
27
|
*/
|
|
@@ -60,3 +60,4 @@ export declare function loadEnv({ cwd, mode, prefixes, processEnv, }?: LoadEnvOp
|
|
|
60
60
|
*/
|
|
61
61
|
cleanup: () => void;
|
|
62
62
|
};
|
|
63
|
+
export declare function loadEnv({ cwd, mode, prefixes, processEnv, }?: LoadEnvOptions): LoadEnvResult;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Build, BuildOptions } from '../types';
|
|
2
2
|
import type { InitConfigsOptions } from './initConfigs';
|
|
3
|
+
export declare const RSPACK_BUILD_ERROR = "Rspack build failed.";
|
|
3
4
|
export declare const build: (initOptions: InitConfigsOptions, { watch, compiler: customCompiler }?: BuildOptions) => Promise<ReturnType<Build>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Compiler, MultiCompiler } from '@rspack/core';
|
|
2
|
+
import type { LoadEnvOptions } from '../loadEnv';
|
|
2
3
|
import type * as providerHelpers from '../provider/helpers';
|
|
3
4
|
import type { RsbuildDevServer } from '../server/devServer';
|
|
4
5
|
import type { StartServerResult } from '../server/helper';
|
|
@@ -53,7 +54,8 @@ export type BuildOptions = {
|
|
|
53
54
|
};
|
|
54
55
|
export type Build = (options?: BuildOptions) => Promise<{
|
|
55
56
|
/**
|
|
56
|
-
*
|
|
57
|
+
* Close the build and call the `onCloseBuild` hook.
|
|
58
|
+
* In watch mode, this method will stop watching.
|
|
57
59
|
*/
|
|
58
60
|
close: () => Promise<void>;
|
|
59
61
|
/**
|
|
@@ -110,10 +112,19 @@ export type CreateRsbuildOptions = {
|
|
|
110
112
|
environment?: string[];
|
|
111
113
|
/**
|
|
112
114
|
* Rsbuild configurations.
|
|
115
|
+
* Passing a function to load the config asynchronously with custom logic.
|
|
113
116
|
*/
|
|
114
|
-
rsbuildConfig?: RsbuildConfig;
|
|
117
|
+
rsbuildConfig?: RsbuildConfig | (() => Promise<RsbuildConfig>);
|
|
118
|
+
/**
|
|
119
|
+
* Whether to call `loadEnv` to load environment variables and define them
|
|
120
|
+
* as global variables.
|
|
121
|
+
* @default false
|
|
122
|
+
*/
|
|
123
|
+
loadEnv?: boolean | LoadEnvOptions;
|
|
124
|
+
};
|
|
125
|
+
export type ResolvedCreateRsbuildOptions = Required<Pick<CreateRsbuildOptions, 'cwd'>> & Pick<CreateRsbuildOptions, 'loadEnv' | 'environment'> & {
|
|
126
|
+
rsbuildConfig: RsbuildConfig;
|
|
115
127
|
};
|
|
116
|
-
export type ResolvedCreateRsbuildOptions = CreateRsbuildOptions & Required<Omit<CreateRsbuildOptions, 'environment'>>;
|
|
117
128
|
export type CreateDevServer = (options?: CreateDevServerOptions) => Promise<RsbuildDevServer>;
|
|
118
129
|
export type StartDevServer = (options?: StartDevServerOptions) => Promise<StartServerResult>;
|
|
119
130
|
export type ProviderInstance<B extends 'rspack' | 'webpack' = 'rspack'> = {
|