@rsbuild/core 1.3.0-beta.0 → 1.3.0-beta.1
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/rspack-chain/index.d.ts +1 -1
- package/compiled/rspack-chain/index.js +66 -66
- package/compiled/rspack-chain/package.json +1 -1
- package/dist/index.cjs +221 -199
- package/dist/index.js +221 -199
- package/dist/transformLoader.mjs +20 -16
- package/dist/transformRawLoader.mjs +20 -16
- package/dist-types/config.d.ts +0 -2
- package/dist-types/configChain.d.ts +10 -2
- package/dist-types/helpers/index.d.ts +0 -1
- package/dist-types/restart.d.ts +18 -0
- package/dist-types/server/cliShortcuts.d.ts +1 -1
- package/dist-types/types/context.d.ts +10 -8
- package/package.json +2 -2
- package/types.d.ts +28 -0
- package/dist-types/cli/prepare.d.ts +0 -1
- package/dist-types/server/restart.d.ts +0 -14
package/dist/index.js
CHANGED
|
@@ -1072,7 +1072,7 @@ async function emptyDir(dir, keep = [], checkExists = !0) {
|
|
|
1072
1072
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(`failed to empty dir: ${dir}`), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(err);
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
|
-
let hintNodePolyfill = (message)=>{
|
|
1075
|
+
let formatFileName = (fileName)=>/:\d+:\d+/.test(fileName) ? `File: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.cyan(fileName)}\n` : `File: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.cyan(fileName)}:1:1\n`, hintNodePolyfill = (message)=>{
|
|
1076
1076
|
let getTips = (moduleName)=>{
|
|
1077
1077
|
let tips = [
|
|
1078
1078
|
`Tip: "${moduleName}" is a built-in Node.js module. It cannot be imported in client-side code.`,
|
|
@@ -1134,11 +1134,11 @@ function formatMessage(stats, verbose) {
|
|
|
1134
1134
|
let matched = stats.moduleIdentifier.match(/(?:\!|^)([^!]+)$/);
|
|
1135
1135
|
if (matched) {
|
|
1136
1136
|
let fileName = matched.pop();
|
|
1137
|
-
if (fileName) return
|
|
1137
|
+
if (fileName) return formatFileName(fileName);
|
|
1138
1138
|
}
|
|
1139
1139
|
}
|
|
1140
1140
|
let file = stats.file || stats.moduleName;
|
|
1141
|
-
return file ?
|
|
1141
|
+
return file ? formatFileName(file) : '';
|
|
1142
1142
|
}(stats), mainMessage = stats.message, details = verbose && stats.details ? `\nDetails: ${stats.details}\n` : '', stack = verbose && stats.stack ? `\n${stats.stack}` : '', moduleTrace = function(stats) {
|
|
1143
1143
|
let traceStr = '';
|
|
1144
1144
|
if (stats.moduleTrace) for (let trace of stats.moduleTrace)trace.originName && (traceStr += `\n @ ${trace.originName}`);
|
|
@@ -1220,10 +1220,10 @@ function formatStats(statsData, hasErrors) {
|
|
|
1220
1220
|
}, verbose);
|
|
1221
1221
|
return {
|
|
1222
1222
|
message: function(errors) {
|
|
1223
|
-
let title = __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.bold(__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.red('
|
|
1223
|
+
let title = __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.bold(__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.red('Build error: '));
|
|
1224
1224
|
if (!errors.length) return `${title}\n${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.yellow("For more details, please setting 'stats.errors: true' ")}`;
|
|
1225
|
-
let
|
|
1226
|
-
return `${title}\n${
|
|
1225
|
+
let text = `${errors.join('\n\n')}\n`;
|
|
1226
|
+
return `${title}\n${text}`;
|
|
1227
1227
|
}(errors),
|
|
1228
1228
|
level: 'error'
|
|
1229
1229
|
};
|
|
@@ -1462,146 +1462,7 @@ let configCache = {}, OVERRIDE_PATHS = [
|
|
|
1462
1462
|
merged[key] = merge(x[key], y[key], childPath);
|
|
1463
1463
|
}
|
|
1464
1464
|
return merged;
|
|
1465
|
-
}, mergeRsbuildConfig = (...configs)=>2 === configs.length ? merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>merge(result, config), {}),
|
|
1466
|
-
var _config_server;
|
|
1467
|
-
let { content: config, filePath } = await config_loadConfig({
|
|
1468
|
-
cwd: root,
|
|
1469
|
-
path: commonOpts.config,
|
|
1470
|
-
envMode: commonOpts.envMode,
|
|
1471
|
-
loader: commonOpts.configLoader
|
|
1472
|
-
});
|
|
1473
|
-
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 = [
|
|
1474
|
-
...config.dev.watchFiles ? castArray(config.dev.watchFiles) : [],
|
|
1475
|
-
{
|
|
1476
|
-
paths: filePath,
|
|
1477
|
-
type: 'reload-server'
|
|
1478
|
-
}
|
|
1479
|
-
]), config;
|
|
1480
|
-
};
|
|
1481
|
-
async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
1482
|
-
cliOptions && (commonOpts = cliOptions);
|
|
1483
|
-
try {
|
|
1484
|
-
let cwd = process.cwd(), root = commonOpts.root ? getAbsolutePath(cwd, commonOpts.root) : cwd, rsbuild = await createRsbuild({
|
|
1485
|
-
cwd: root,
|
|
1486
|
-
rsbuildConfig: ()=>init_loadConfig(root),
|
|
1487
|
-
environment: commonOpts.environment,
|
|
1488
|
-
loadEnv: {
|
|
1489
|
-
cwd: getEnvDir(root, commonOpts.envDir),
|
|
1490
|
-
mode: commonOpts.envMode
|
|
1491
|
-
}
|
|
1492
|
-
});
|
|
1493
|
-
return rsbuild.onBeforeCreateCompiler(()=>{
|
|
1494
|
-
let command = process.argv[2];
|
|
1495
|
-
if ('dev' === command || isBuildWatch) {
|
|
1496
|
-
var _config_dev;
|
|
1497
|
-
let files = [], config = rsbuild.getNormalizedConfig();
|
|
1498
|
-
if (null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.watchFiles) for (let watchFilesConfig of castArray(config.dev.watchFiles)){
|
|
1499
|
-
if ('reload-server' !== watchFilesConfig.type) continue;
|
|
1500
|
-
let paths = castArray(watchFilesConfig.paths);
|
|
1501
|
-
watchFilesConfig.options ? watchFilesForRestart(paths, root, isBuildWatch, watchFilesConfig.options) : files.push(...paths);
|
|
1502
|
-
}
|
|
1503
|
-
watchFilesForRestart(files, root, isBuildWatch);
|
|
1504
|
-
}
|
|
1505
|
-
}), rsbuild;
|
|
1506
|
-
} catch (err) {
|
|
1507
|
-
if (isRestart) __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
1508
|
-
else throw err;
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
let cleaners = [], onBeforeRestartServer = (cleaner)=>{
|
|
1512
|
-
cleaners.push(cleaner);
|
|
1513
|
-
}, clearConsole = ()=>{
|
|
1514
|
-
isTTY() && !process.env.DEBUG && process.stdout.write('\x1B[H\x1B[2J');
|
|
1515
|
-
}, beforeRestart = async ({ filePath, clear = !0, id })=>{
|
|
1516
|
-
if (clear && clearConsole(), filePath) {
|
|
1517
|
-
let filename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.basename(filePath);
|
|
1518
|
-
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`restarting ${id} because ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.yellow(filename)} has changed\n`);
|
|
1519
|
-
} else __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`restarting ${id}...\n`);
|
|
1520
|
-
for (let cleaner of cleaners)await cleaner();
|
|
1521
|
-
cleaners = [];
|
|
1522
|
-
}, restartDevServer = async ({ filePath, clear = !0 } = {})=>{
|
|
1523
|
-
await beforeRestart({
|
|
1524
|
-
filePath,
|
|
1525
|
-
clear,
|
|
1526
|
-
id: 'server'
|
|
1527
|
-
});
|
|
1528
|
-
let rsbuild = await init({
|
|
1529
|
-
isRestart: !0
|
|
1530
|
-
});
|
|
1531
|
-
rsbuild && await rsbuild.startDevServer();
|
|
1532
|
-
}, restartBuild = async ({ filePath, clear = !0 } = {})=>{
|
|
1533
|
-
await beforeRestart({
|
|
1534
|
-
filePath,
|
|
1535
|
-
clear,
|
|
1536
|
-
id: 'build'
|
|
1537
|
-
});
|
|
1538
|
-
let rsbuild = await init({
|
|
1539
|
-
isRestart: !0,
|
|
1540
|
-
isBuildWatch: !0
|
|
1541
|
-
});
|
|
1542
|
-
rsbuild && onBeforeRestartServer((await rsbuild.build({
|
|
1543
|
-
watch: !0
|
|
1544
|
-
})).close);
|
|
1545
|
-
};
|
|
1546
|
-
async function setupWatchFiles(options) {
|
|
1547
|
-
let { dev, server, root, compileMiddlewareAPI } = options, { hmr, liveReload } = dev;
|
|
1548
|
-
if (!hmr && !liveReload || !compileMiddlewareAPI) return;
|
|
1549
|
-
let closeDevFilesWatcher = await watchDevFiles(dev, compileMiddlewareAPI, root), serverFilesWatcher = await function(serverConfig, compileMiddlewareAPI, root) {
|
|
1550
|
-
let publicDirs = normalizePublicDirs(serverConfig.publicDir);
|
|
1551
|
-
if (!publicDirs.length) return;
|
|
1552
|
-
let watchPaths = publicDirs.filter((item)=>item.watch).map((item)=>item.name);
|
|
1553
|
-
if (watchPaths.length) return startWatchFiles(prepareWatchOptions(watchPaths), compileMiddlewareAPI, root);
|
|
1554
|
-
}(server, compileMiddlewareAPI, root);
|
|
1555
|
-
return {
|
|
1556
|
-
async close () {
|
|
1557
|
-
await Promise.all([
|
|
1558
|
-
null == closeDevFilesWatcher ? void 0 : closeDevFilesWatcher(),
|
|
1559
|
-
null == serverFilesWatcher ? void 0 : serverFilesWatcher.close()
|
|
1560
|
-
]);
|
|
1561
|
-
}
|
|
1562
|
-
};
|
|
1563
|
-
}
|
|
1564
|
-
async function watchDevFiles(devConfig, compileMiddlewareAPI, root) {
|
|
1565
|
-
let { watchFiles } = devConfig;
|
|
1566
|
-
if (!watchFiles) return;
|
|
1567
|
-
let watchers = [];
|
|
1568
|
-
for (let { paths, options, type } of castArray(watchFiles)){
|
|
1569
|
-
let watchOptions = prepareWatchOptions(paths, options, type), watcher = await startWatchFiles(watchOptions, compileMiddlewareAPI, root);
|
|
1570
|
-
watcher && watchers.push(watcher);
|
|
1571
|
-
}
|
|
1572
|
-
return async ()=>{
|
|
1573
|
-
for (let watcher of watchers)await watcher.close();
|
|
1574
|
-
};
|
|
1575
|
-
}
|
|
1576
|
-
function prepareWatchOptions(paths, options = {}, type) {
|
|
1577
|
-
return {
|
|
1578
|
-
paths: 'string' == typeof paths ? [
|
|
1579
|
-
paths
|
|
1580
|
-
] : paths,
|
|
1581
|
-
options,
|
|
1582
|
-
type
|
|
1583
|
-
};
|
|
1584
|
-
}
|
|
1585
|
-
let GLOB_REGEX = /[*?{}[\]()!@+|]/, isGlob = (str)=>GLOB_REGEX.test(str);
|
|
1586
|
-
async function createChokidar(pathOrGlobs, root, options) {
|
|
1587
|
-
let chokidar = await import("../compiled/chokidar/index.js"), watchFiles = new Set(), globPatterns = pathOrGlobs.filter((pathOrGlob)=>!!isGlob(pathOrGlob) || (watchFiles.add(pathOrGlob), !1));
|
|
1588
|
-
if (globPatterns.length) {
|
|
1589
|
-
let tinyglobby = await import("../compiled/tinyglobby/index.js"), { glob } = tinyglobby.default || tinyglobby;
|
|
1590
|
-
for (let file of (await glob(globPatterns, {
|
|
1591
|
-
cwd: root,
|
|
1592
|
-
absolute: !0
|
|
1593
|
-
})))watchFiles.add(file);
|
|
1594
|
-
}
|
|
1595
|
-
return chokidar.watch(Array.from(watchFiles), options);
|
|
1596
|
-
}
|
|
1597
|
-
async function startWatchFiles({ paths, options, type = 'reload-page' }, compileMiddlewareAPI, root) {
|
|
1598
|
-
if ('reload-page' !== type) return;
|
|
1599
|
-
let watcher = await createChokidar(paths, root, options);
|
|
1600
|
-
return watcher.on('change', ()=>{
|
|
1601
|
-
compileMiddlewareAPI.sockWrite('static-changed');
|
|
1602
|
-
}), watcher;
|
|
1603
|
-
}
|
|
1604
|
-
let config_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url), getDefaultDevConfig = ()=>({
|
|
1465
|
+
}, mergeRsbuildConfig = (...configs)=>2 === configs.length ? merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>merge(result, config), {}), config_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url), getDefaultDevConfig = ()=>({
|
|
1605
1466
|
hmr: !0,
|
|
1606
1467
|
liveReload: !0,
|
|
1607
1468
|
assetPrefix: DEFAULT_ASSET_PREFIX,
|
|
@@ -1770,27 +1631,6 @@ let resolveConfigPath = (root, customConfig)=>{
|
|
|
1770
1631
|
}
|
|
1771
1632
|
return null;
|
|
1772
1633
|
};
|
|
1773
|
-
async function watchFilesForRestart(files, root, isBuildWatch, watchOptions) {
|
|
1774
|
-
var func;
|
|
1775
|
-
let timeoutId;
|
|
1776
|
-
if (!files.length) return;
|
|
1777
|
-
let watcher = await createChokidar(files, root, {
|
|
1778
|
-
ignoreInitial: !0,
|
|
1779
|
-
ignorePermissionErrors: !0,
|
|
1780
|
-
...watchOptions
|
|
1781
|
-
}), callback = (func = async (filePath)=>{
|
|
1782
|
-
await watcher.close(), isBuildWatch ? await restartBuild({
|
|
1783
|
-
filePath
|
|
1784
|
-
}) : await restartDevServer({
|
|
1785
|
-
filePath
|
|
1786
|
-
});
|
|
1787
|
-
}, timeoutId = null, (...args)=>{
|
|
1788
|
-
null !== timeoutId && clearTimeout(timeoutId), timeoutId = setTimeout(()=>{
|
|
1789
|
-
func(...args);
|
|
1790
|
-
}, 300);
|
|
1791
|
-
});
|
|
1792
|
-
watcher.on('add', callback), watcher.on('change', callback), watcher.on('unlink', callback);
|
|
1793
|
-
}
|
|
1794
1634
|
async function config_loadConfig({ cwd = process.cwd(), path, envMode, meta, loader = 'jiti' } = {}) {
|
|
1795
1635
|
let configExport;
|
|
1796
1636
|
let configFilePath = resolveConfigPath(cwd, path);
|
|
@@ -2284,7 +2124,7 @@ async function updateEnvironmentContext(context, configs) {
|
|
|
2284
2124
|
async function createContext(options, userConfig) {
|
|
2285
2125
|
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
2126
|
return {
|
|
2287
|
-
version: "1.3.0-beta.
|
|
2127
|
+
version: "1.3.0-beta.1",
|
|
2288
2128
|
rootPath,
|
|
2289
2129
|
distPath: '',
|
|
2290
2130
|
cachePath,
|
|
@@ -2450,9 +2290,13 @@ let configChain_CHAIN_ID = {
|
|
|
2450
2290
|
JS_DATA_URI: 'js-data-uri',
|
|
2451
2291
|
TS: 'ts',
|
|
2452
2292
|
CSS: 'css',
|
|
2293
|
+
CSS_RAW: 'css-raw',
|
|
2453
2294
|
LESS: 'less',
|
|
2295
|
+
LESS_RAW: 'less-raw',
|
|
2454
2296
|
SASS: 'sass',
|
|
2297
|
+
SASS_RAW: 'sass-raw',
|
|
2455
2298
|
STYLUS: 'stylus',
|
|
2299
|
+
STYLUS_RAW: 'stylus-raw',
|
|
2456
2300
|
SVG: 'svg',
|
|
2457
2301
|
PUG: 'pug',
|
|
2458
2302
|
VUE: 'vue',
|
|
@@ -2881,7 +2725,9 @@ let isPostcssPluginCreator = (plugin)=>'function' == typeof plugin && !0 === plu
|
|
|
2881
2725
|
let rule = chain.module.rule(CHAIN_ID.RULE.CSS), { config } = environment;
|
|
2882
2726
|
rule.test(CSS_REGEX).type("javascript/auto").dependency({
|
|
2883
2727
|
not: 'url'
|
|
2884
|
-
})
|
|
2728
|
+
}).resourceQuery({
|
|
2729
|
+
not: /raw/
|
|
2730
|
+
}), chain.module.rule(CHAIN_ID.RULE.CSS_RAW).test(CSS_REGEX).type('asset/source').resourceQuery(/raw/);
|
|
2885
2731
|
let emitCss = config.output.emitCss ?? 'web' === target;
|
|
2886
2732
|
if (emitCss) {
|
|
2887
2733
|
if (config.output.injectStyles) {
|
|
@@ -2940,20 +2786,32 @@ let isPostcssPluginCreator = (plugin)=>'function' == typeof plugin && !0 === plu
|
|
|
2940
2786
|
name: 'rsbuild:define',
|
|
2941
2787
|
setup (api) {
|
|
2942
2788
|
api.modifyBundlerChain((chain, { CHAIN_ID, bundler, environment })=>{
|
|
2943
|
-
let { config } = environment, baseUrl = JSON.stringify(config.server.base), assetPrefix = JSON.stringify(getPublicPathFromChain(chain, !1)),
|
|
2789
|
+
let { config } = environment, baseUrl = JSON.stringify(config.server.base), assetPrefix = JSON.stringify(getPublicPathFromChain(chain, !1)), mergedDefine = {
|
|
2944
2790
|
'import.meta.env.MODE': JSON.stringify(config.mode),
|
|
2945
2791
|
'import.meta.env.DEV': 'development' === config.mode,
|
|
2946
2792
|
'import.meta.env.PROD': 'production' === config.mode,
|
|
2947
2793
|
'import.meta.env.BASE_URL': baseUrl,
|
|
2948
2794
|
'import.meta.env.ASSET_PREFIX': assetPrefix,
|
|
2949
2795
|
'process.env.BASE_URL': baseUrl,
|
|
2950
|
-
'process.env.ASSET_PREFIX': assetPrefix
|
|
2796
|
+
'process.env.ASSET_PREFIX': assetPrefix,
|
|
2797
|
+
...config.source.define
|
|
2951
2798
|
};
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2799
|
+
!function(define) {
|
|
2800
|
+
let value = define['process.env'];
|
|
2801
|
+
if (!value) return;
|
|
2802
|
+
let check = (value)=>{
|
|
2803
|
+
let pathKey = Object.keys(value).find((key)=>'path' === key.toLowerCase() && value[key] === process.env[key]);
|
|
2804
|
+
pathKey && __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.yellow(`[rsbuild:config] The "source.define" option includes an object with the key ${JSON.stringify(pathKey)} under "process.env", indicating potential exposure of all environment variables. This can lead to security risks and should be avoided.`));
|
|
2805
|
+
};
|
|
2806
|
+
if ('object' == typeof value) {
|
|
2807
|
+
check(value);
|
|
2808
|
+
return;
|
|
2956
2809
|
}
|
|
2810
|
+
if ('string' == typeof value) try {
|
|
2811
|
+
check(JSON.parse(value));
|
|
2812
|
+
} catch (error) {}
|
|
2813
|
+
}(mergedDefine), chain.plugin(CHAIN_ID.PLUGIN.DEFINE).use(bundler.DefinePlugin, [
|
|
2814
|
+
mergedDefine
|
|
2957
2815
|
]);
|
|
2958
2816
|
});
|
|
2959
2817
|
}
|
|
@@ -4982,6 +4840,167 @@ async function initConfigs({ context, pluginManager, rsbuildOptions }) {
|
|
|
4982
4840
|
rspackConfigs
|
|
4983
4841
|
};
|
|
4984
4842
|
}
|
|
4843
|
+
let 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)=>{
|
|
4844
|
+
var _config_server;
|
|
4845
|
+
let { content: config, filePath } = await config_loadConfig({
|
|
4846
|
+
cwd: root,
|
|
4847
|
+
path: commonOpts.config,
|
|
4848
|
+
envMode: commonOpts.envMode,
|
|
4849
|
+
loader: commonOpts.configLoader
|
|
4850
|
+
});
|
|
4851
|
+
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 = [
|
|
4852
|
+
...config.dev.watchFiles ? castArray(config.dev.watchFiles) : [],
|
|
4853
|
+
{
|
|
4854
|
+
paths: filePath,
|
|
4855
|
+
type: 'reload-server'
|
|
4856
|
+
}
|
|
4857
|
+
]), config;
|
|
4858
|
+
};
|
|
4859
|
+
async function init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
4860
|
+
cliOptions && (commonOpts = cliOptions);
|
|
4861
|
+
try {
|
|
4862
|
+
let cwd = process.cwd(), root = commonOpts.root ? getAbsolutePath(cwd, commonOpts.root) : cwd, rsbuild = await createRsbuild({
|
|
4863
|
+
cwd: root,
|
|
4864
|
+
rsbuildConfig: ()=>init_loadConfig(root),
|
|
4865
|
+
environment: commonOpts.environment,
|
|
4866
|
+
loadEnv: {
|
|
4867
|
+
cwd: getEnvDir(root, commonOpts.envDir),
|
|
4868
|
+
mode: commonOpts.envMode
|
|
4869
|
+
}
|
|
4870
|
+
});
|
|
4871
|
+
return rsbuild.onBeforeCreateCompiler(()=>{
|
|
4872
|
+
var _config_dev;
|
|
4873
|
+
if ('dev' !== rsbuild.context.action && !isBuildWatch) return;
|
|
4874
|
+
let files = [], config = rsbuild.getNormalizedConfig();
|
|
4875
|
+
if (null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.watchFiles) for (let watchFilesConfig of castArray(config.dev.watchFiles)){
|
|
4876
|
+
if ('reload-server' !== watchFilesConfig.type) continue;
|
|
4877
|
+
let paths = castArray(watchFilesConfig.paths);
|
|
4878
|
+
watchFilesConfig.options ? watchFilesForRestart({
|
|
4879
|
+
files: paths,
|
|
4880
|
+
rsbuild,
|
|
4881
|
+
isBuildWatch,
|
|
4882
|
+
watchOptions: watchFilesConfig.options
|
|
4883
|
+
}) : files.push(...paths);
|
|
4884
|
+
}
|
|
4885
|
+
watchFilesForRestart({
|
|
4886
|
+
files,
|
|
4887
|
+
rsbuild,
|
|
4888
|
+
isBuildWatch
|
|
4889
|
+
});
|
|
4890
|
+
}), rsbuild;
|
|
4891
|
+
} catch (err) {
|
|
4892
|
+
if (isRestart) __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
4893
|
+
else throw err;
|
|
4894
|
+
}
|
|
4895
|
+
}
|
|
4896
|
+
async function setupWatchFiles(options) {
|
|
4897
|
+
let { dev, server, root, compileMiddlewareAPI } = options, { hmr, liveReload } = dev;
|
|
4898
|
+
if (!hmr && !liveReload || !compileMiddlewareAPI) return;
|
|
4899
|
+
let closeDevFilesWatcher = await watchDevFiles(dev, compileMiddlewareAPI, root), serverFilesWatcher = await function(serverConfig, compileMiddlewareAPI, root) {
|
|
4900
|
+
let publicDirs = normalizePublicDirs(serverConfig.publicDir);
|
|
4901
|
+
if (!publicDirs.length) return;
|
|
4902
|
+
let watchPaths = publicDirs.filter((item)=>item.watch).map((item)=>item.name);
|
|
4903
|
+
if (watchPaths.length) return startWatchFiles(prepareWatchOptions(watchPaths), compileMiddlewareAPI, root);
|
|
4904
|
+
}(server, compileMiddlewareAPI, root);
|
|
4905
|
+
return {
|
|
4906
|
+
async close () {
|
|
4907
|
+
await Promise.all([
|
|
4908
|
+
null == closeDevFilesWatcher ? void 0 : closeDevFilesWatcher(),
|
|
4909
|
+
null == serverFilesWatcher ? void 0 : serverFilesWatcher.close()
|
|
4910
|
+
]);
|
|
4911
|
+
}
|
|
4912
|
+
};
|
|
4913
|
+
}
|
|
4914
|
+
async function watchDevFiles(devConfig, compileMiddlewareAPI, root) {
|
|
4915
|
+
let { watchFiles } = devConfig;
|
|
4916
|
+
if (!watchFiles) return;
|
|
4917
|
+
let watchers = [];
|
|
4918
|
+
for (let { paths, options, type } of castArray(watchFiles)){
|
|
4919
|
+
let watchOptions = prepareWatchOptions(paths, options, type), watcher = await startWatchFiles(watchOptions, compileMiddlewareAPI, root);
|
|
4920
|
+
watcher && watchers.push(watcher);
|
|
4921
|
+
}
|
|
4922
|
+
return async ()=>{
|
|
4923
|
+
for (let watcher of watchers)await watcher.close();
|
|
4924
|
+
};
|
|
4925
|
+
}
|
|
4926
|
+
function prepareWatchOptions(paths, options = {}, type) {
|
|
4927
|
+
return {
|
|
4928
|
+
paths: 'string' == typeof paths ? [
|
|
4929
|
+
paths
|
|
4930
|
+
] : paths,
|
|
4931
|
+
options,
|
|
4932
|
+
type
|
|
4933
|
+
};
|
|
4934
|
+
}
|
|
4935
|
+
let GLOB_REGEX = /[*?{}[\]()!@+|]/, isGlob = (str)=>GLOB_REGEX.test(str);
|
|
4936
|
+
async function createChokidar(pathOrGlobs, root, options) {
|
|
4937
|
+
let chokidar = await import("../compiled/chokidar/index.js"), watchFiles = new Set(), globPatterns = pathOrGlobs.filter((pathOrGlob)=>!!isGlob(pathOrGlob) || (watchFiles.add(pathOrGlob), !1));
|
|
4938
|
+
if (globPatterns.length) {
|
|
4939
|
+
let tinyglobby = await import("../compiled/tinyglobby/index.js"), { glob } = tinyglobby.default || tinyglobby;
|
|
4940
|
+
for (let file of (await glob(globPatterns, {
|
|
4941
|
+
cwd: root,
|
|
4942
|
+
absolute: !0
|
|
4943
|
+
})))watchFiles.add(file);
|
|
4944
|
+
}
|
|
4945
|
+
return chokidar.watch(Array.from(watchFiles), options);
|
|
4946
|
+
}
|
|
4947
|
+
async function startWatchFiles({ paths, options, type = 'reload-page' }, compileMiddlewareAPI, root) {
|
|
4948
|
+
if ('reload-page' !== type) return;
|
|
4949
|
+
let watcher = await createChokidar(paths, root, options);
|
|
4950
|
+
return watcher.on('change', ()=>{
|
|
4951
|
+
compileMiddlewareAPI.sockWrite('static-changed');
|
|
4952
|
+
}), watcher;
|
|
4953
|
+
}
|
|
4954
|
+
let cleaners = [], onBeforeRestartServer = (cleaner)=>{
|
|
4955
|
+
cleaners.push(cleaner);
|
|
4956
|
+
}, clearConsole = ()=>{
|
|
4957
|
+
isTTY() && !process.env.DEBUG && process.stdout.write('\x1B[H\x1B[2J');
|
|
4958
|
+
}, beforeRestart = async ({ filePath, clear = !0, id })=>{
|
|
4959
|
+
if (clear && clearConsole(), filePath) {
|
|
4960
|
+
let filename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.basename(filePath);
|
|
4961
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`restarting ${id} as ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.yellow(filename)} changed\n`);
|
|
4962
|
+
} else __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`restarting ${id}...\n`);
|
|
4963
|
+
for (let cleaner of cleaners)await cleaner();
|
|
4964
|
+
cleaners = [];
|
|
4965
|
+
}, restartDevServer = async ({ filePath, clear = !0 } = {})=>{
|
|
4966
|
+
await beforeRestart({
|
|
4967
|
+
filePath,
|
|
4968
|
+
clear,
|
|
4969
|
+
id: 'server'
|
|
4970
|
+
});
|
|
4971
|
+
let rsbuild = await init({
|
|
4972
|
+
isRestart: !0
|
|
4973
|
+
});
|
|
4974
|
+
return !!rsbuild && (await rsbuild.startDevServer(), !0);
|
|
4975
|
+
}, restartBuild = async ({ filePath, clear = !0 } = {})=>{
|
|
4976
|
+
await beforeRestart({
|
|
4977
|
+
filePath,
|
|
4978
|
+
clear,
|
|
4979
|
+
id: 'build'
|
|
4980
|
+
});
|
|
4981
|
+
let rsbuild = await init({
|
|
4982
|
+
isRestart: !0,
|
|
4983
|
+
isBuildWatch: !0
|
|
4984
|
+
});
|
|
4985
|
+
return !!rsbuild && (onBeforeRestartServer((await rsbuild.build({
|
|
4986
|
+
watch: !0
|
|
4987
|
+
})).close), !0);
|
|
4988
|
+
};
|
|
4989
|
+
async function watchFilesForRestart({ files, rsbuild, isBuildWatch, watchOptions }) {
|
|
4990
|
+
if (!files.length) return;
|
|
4991
|
+
let root = rsbuild.context.rootPath, watcher = await createChokidar(files, root, {
|
|
4992
|
+
ignoreInitial: !0,
|
|
4993
|
+
ignorePermissionErrors: !0,
|
|
4994
|
+
...watchOptions
|
|
4995
|
+
}), restarting = !1, onChange = async (filePath)=>{
|
|
4996
|
+
!restarting && (restarting = !0, (isBuildWatch ? await restartBuild({
|
|
4997
|
+
filePath
|
|
4998
|
+
}) : await restartDevServer({
|
|
4999
|
+
filePath
|
|
5000
|
+
})) ? await watcher.close() : __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(isBuildWatch ? 'Restart build failed.' : 'Restart server failed.'), restarting = !1);
|
|
5001
|
+
};
|
|
5002
|
+
watcher.on('add', onChange), watcher.on('change', onChange), watcher.on('unlink', onChange);
|
|
5003
|
+
}
|
|
4985
5004
|
let isCliShortcutsEnabled = (devConfig)=>devConfig.cliShortcuts && isTTY('stdin');
|
|
4986
5005
|
function setupCliShortcuts({ help = !0, openPage, closeServer, printUrls, restartServer, customShortcuts }) {
|
|
4987
5006
|
let shortcuts = [
|
|
@@ -6058,9 +6077,13 @@ let runner_run = async ({ bundlePath, ...runnerFactoryOptions })=>new BasicRunne
|
|
|
6058
6077
|
cleanupCallbacks.add(callback);
|
|
6059
6078
|
}, removeCleanup = (callback)=>{
|
|
6060
6079
|
cleanupCallbacks.delete(callback);
|
|
6061
|
-
}, shutdownRefCount = 0, setupGracefulShutdown = ()=>
|
|
6062
|
-
|
|
6063
|
-
|
|
6080
|
+
}, shutdownRefCount = 0, setupGracefulShutdown = ()=>{
|
|
6081
|
+
shutdownRefCount++, process.once('SIGTERM', handleTermination);
|
|
6082
|
+
let isCI = 'true' === process.env.CI;
|
|
6083
|
+
return isCI || process.stdin.on('end', handleTermination), ()=>{
|
|
6084
|
+
!(--shutdownRefCount > 0) && (process.removeListener('SIGTERM', handleTermination), isCI || process.stdin.removeListener('end', handleTermination));
|
|
6085
|
+
};
|
|
6086
|
+
}, createHttpServer = async ({ serverConfig, middlewares })=>{
|
|
6064
6087
|
if (serverConfig.https) {
|
|
6065
6088
|
if (serverConfig.proxy) {
|
|
6066
6089
|
let { createServer } = await import("node:https");
|
|
@@ -6276,7 +6299,7 @@ async function createCompiler_createCompiler(options) {
|
|
|
6276
6299
|
}
|
|
6277
6300
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.start('build started...');
|
|
6278
6301
|
}(compiler, context), isCompiling = !0;
|
|
6279
|
-
}), 'build' === context.
|
|
6302
|
+
}), 'build' === context.action && compiler.hooks.run.tap('rsbuild:run', logRspackVersion);
|
|
6280
6303
|
let done = (stats)=>{
|
|
6281
6304
|
let statsOptions = getStatsOptions(compiler), statsJson = stats.toJson({
|
|
6282
6305
|
children: !0,
|
|
@@ -6301,7 +6324,7 @@ async function createCompiler_createCompiler(options) {
|
|
|
6301
6324
|
};
|
|
6302
6325
|
return compiler.hooks.done.tap('rsbuild:done', (stats)=>{
|
|
6303
6326
|
done(stats);
|
|
6304
|
-
}), 'dev' === context.
|
|
6327
|
+
}), 'dev' === context.action && registerDevHook({
|
|
6305
6328
|
context,
|
|
6306
6329
|
compiler,
|
|
6307
6330
|
bundlerConfigs: rspackConfigs,
|
|
@@ -6717,6 +6740,7 @@ async function createRsbuild(options = {}) {
|
|
|
6717
6740
|
}), context = await createContext(resolvedOptions, config), getPluginAPI = function({ context, pluginManager }) {
|
|
6718
6741
|
let { hooks } = context, publicContext = function(context) {
|
|
6719
6742
|
let exposedKeys = [
|
|
6743
|
+
'action',
|
|
6720
6744
|
'version',
|
|
6721
6745
|
'rootPath',
|
|
6722
6746
|
'distPath',
|
|
@@ -6902,7 +6926,7 @@ async function createRsbuild(options = {}) {
|
|
|
6902
6926
|
helpers: provider_helpers_namespaceObject
|
|
6903
6927
|
}), rsbuild = {
|
|
6904
6928
|
build: async (...args)=>{
|
|
6905
|
-
context.
|
|
6929
|
+
context.action = 'build', getNodeEnv() || setNodeEnv('production');
|
|
6906
6930
|
let buildInstance = await providerInstance.build(...args);
|
|
6907
6931
|
return {
|
|
6908
6932
|
...buildInstance,
|
|
@@ -6912,7 +6936,7 @@ async function createRsbuild(options = {}) {
|
|
|
6912
6936
|
};
|
|
6913
6937
|
},
|
|
6914
6938
|
preview: async (options = {})=>{
|
|
6915
|
-
context.
|
|
6939
|
+
context.action = 'preview', getNodeEnv() || setNodeEnv('production');
|
|
6916
6940
|
let config = await initRsbuildConfig({
|
|
6917
6941
|
context,
|
|
6918
6942
|
pluginManager
|
|
@@ -6926,9 +6950,9 @@ async function createRsbuild(options = {}) {
|
|
|
6926
6950
|
}
|
|
6927
6951
|
return startProdServer(context, config, options);
|
|
6928
6952
|
},
|
|
6929
|
-
startDevServer: (...args)=>(context.
|
|
6930
|
-
createCompiler: (...args)=>(context.
|
|
6931
|
-
createDevServer: (...args)=>(context.
|
|
6953
|
+
startDevServer: (...args)=>(context.action = 'dev', getNodeEnv() || setNodeEnv('development'), providerInstance.startDevServer(...args)),
|
|
6954
|
+
createCompiler: (...args)=>(context.action || (context.action = 'development' === getNodeEnv() ? 'dev' : 'build'), providerInstance.createCompiler(...args)),
|
|
6955
|
+
createDevServer: (...args)=>(context.action = 'dev', getNodeEnv() || setNodeEnv('development'), providerInstance.createDevServer(...args)),
|
|
6932
6956
|
...pick(pluginManager, [
|
|
6933
6957
|
'addPlugins',
|
|
6934
6958
|
'getPlugins',
|
|
@@ -7293,22 +7317,20 @@ let cac_dist = (name = "")=>new CAC(name), applyCommonOptions = (cli)=>{
|
|
|
7293
7317
|
};
|
|
7294
7318
|
async function runCLI() {
|
|
7295
7319
|
!function() {
|
|
7296
|
-
!
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
(!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.3.0-beta.0\n`);
|
|
7307
|
-
}();
|
|
7320
|
+
if (!process.env.NODE_ENV) {
|
|
7321
|
+
let command = process.argv[2];
|
|
7322
|
+
process.env.NODE_ENV = [
|
|
7323
|
+
'build',
|
|
7324
|
+
'preview'
|
|
7325
|
+
].includes(command) ? 'production' : 'development';
|
|
7326
|
+
}
|
|
7327
|
+
}(), process.title = 'rsbuild-node';
|
|
7328
|
+
let { npm_execpath } = process.env;
|
|
7329
|
+
(!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.3.0-beta.1\n`);
|
|
7308
7330
|
try {
|
|
7309
7331
|
!function() {
|
|
7310
7332
|
let cli = cac_dist('rsbuild');
|
|
7311
|
-
cli.help(), cli.version("1.3.0-beta.
|
|
7333
|
+
cli.help(), cli.version("1.3.0-beta.1"), applyCommonOptions(cli);
|
|
7312
7334
|
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');
|
|
7313
7335
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
7314
7336
|
try {
|
|
@@ -7359,6 +7381,6 @@ async function runCLI() {
|
|
|
7359
7381
|
__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);
|
|
7360
7382
|
}
|
|
7361
7383
|
}
|
|
7362
|
-
let src_version = "1.3.0-beta.
|
|
7384
|
+
let src_version = "1.3.0-beta.1";
|
|
7363
7385
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
|
|
7364
7386
|
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 };
|
package/dist/transformLoader.mjs
CHANGED
|
@@ -4,21 +4,25 @@ async function transformLoader_rslib_entry_transform(source, map) {
|
|
|
4
4
|
if (!transformId) return bypass();
|
|
5
5
|
let transform = null === (_this__compiler = this._compiler) || void 0 === _this__compiler ? void 0 : null === (_this__compiler___rsbuildTransformer = _this__compiler.__rsbuildTransformer) || void 0 === _this__compiler___rsbuildTransformer ? void 0 : _this__compiler___rsbuildTransformer[transformId];
|
|
6
6
|
if (!transform) return bypass();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
try {
|
|
8
|
+
let result = await transform({
|
|
9
|
+
code: source,
|
|
10
|
+
context: this.context,
|
|
11
|
+
resource: this.resource,
|
|
12
|
+
resourcePath: this.resourcePath,
|
|
13
|
+
resourceQuery: this.resourceQuery,
|
|
14
|
+
environment: getEnvironment(),
|
|
15
|
+
addDependency: this.addDependency.bind(this),
|
|
16
|
+
emitFile: this.emitFile.bind(this),
|
|
17
|
+
importModule: this.importModule.bind(this),
|
|
18
|
+
resolve: this.resolve.bind(this)
|
|
19
|
+
});
|
|
20
|
+
if (null == result) return bypass();
|
|
21
|
+
if ('string' == typeof result) return callback(null, result, map);
|
|
22
|
+
let useMap = null != map, finalMap = result.map ?? map;
|
|
23
|
+
callback(null, result.code, useMap ? finalMap : void 0);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
error instanceof Error ? callback(error) : callback(Error(String(error)));
|
|
26
|
+
}
|
|
23
27
|
}
|
|
24
28
|
export { transformLoader_rslib_entry_transform as default };
|
|
@@ -4,21 +4,25 @@ let transformRawLoader_rslib_entry_ = async function(source, map) {
|
|
|
4
4
|
if (!transformId) return bypass();
|
|
5
5
|
let transform = null === (_this__compiler = this._compiler) || void 0 === _this__compiler ? void 0 : null === (_this__compiler___rsbuildTransformer = _this__compiler.__rsbuildTransformer) || void 0 === _this__compiler___rsbuildTransformer ? void 0 : _this__compiler___rsbuildTransformer[transformId];
|
|
6
6
|
if (!transform) return bypass();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
try {
|
|
8
|
+
let result = await transform({
|
|
9
|
+
code: source,
|
|
10
|
+
context: this.context,
|
|
11
|
+
resource: this.resource,
|
|
12
|
+
resourcePath: this.resourcePath,
|
|
13
|
+
resourceQuery: this.resourceQuery,
|
|
14
|
+
environment: getEnvironment(),
|
|
15
|
+
addDependency: this.addDependency.bind(this),
|
|
16
|
+
emitFile: this.emitFile.bind(this),
|
|
17
|
+
importModule: this.importModule.bind(this),
|
|
18
|
+
resolve: this.resolve.bind(this)
|
|
19
|
+
});
|
|
20
|
+
if (null == result) return bypass();
|
|
21
|
+
if ('string' == typeof result) return callback(null, result, map);
|
|
22
|
+
let useMap = null != map, finalMap = result.map ?? map;
|
|
23
|
+
callback(null, result.code, useMap ? finalMap : void 0);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
error instanceof Error ? callback(error) : callback(Error(String(error)));
|
|
26
|
+
}
|
|
23
27
|
}, raw = !0;
|
|
24
28
|
export { transformRawLoader_rslib_entry_ as default, raw };
|