@rslib/core 0.9.2 → 0.10.0

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.js CHANGED
@@ -1,13 +1,13 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__ from "../compiled/rslog/index.js";
2
- import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
3
- import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
4
- import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
5
- import * as __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__ from "../compiled/picocolors/index.js";
6
- import * as __WEBPACK_EXTERNAL_MODULE_events__ from "events";
1
+ import { logger } from "../compiled/rslog/index.js";
2
+ import external_node_fs_default, { chmodSync, promises } from "node:fs";
3
+ import promises_default from "node:fs/promises";
4
+ import external_node_path_default, { basename, dirname, extname as external_node_path_extname, isAbsolute, join } from "node:path";
5
+ import index_js_default from "../compiled/picocolors/index.js";
6
+ import { EventEmitter } from "events";
7
+ import { glob } from "tinyglobby";
8
+ import { createRequire } from "node:module";
9
+ import { createRequire as external_module_createRequire } from "module";
7
10
  import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
8
- import * as __WEBPACK_EXTERNAL_MODULE_tinyglobby__ from "tinyglobby";
9
- import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
10
- import * as __WEBPACK_EXTERNAL_MODULE_module__ from "module";
11
11
  const nodeBuiltInModules = [
12
12
  'assert',
13
13
  'assert/strict',
@@ -68,7 +68,7 @@ const nodeBuiltInModules = [
68
68
  ];
69
69
  async function calcLongestCommonPath(absPaths) {
70
70
  if (0 === absPaths.length) return null;
71
- const sep = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.sep;
71
+ const sep = external_node_path_default.posix.sep;
72
72
  const splitPaths = absPaths.map((p)=>p.split(sep));
73
73
  let lcaFragments = splitPaths[0];
74
74
  for(let i = 1; i < splitPaths.length; i++){
@@ -79,20 +79,20 @@ async function calcLongestCommonPath(absPaths) {
79
79
  lcaFragments = lcaFragments.slice(0, j);
80
80
  }
81
81
  let lca = lcaFragments.length > 0 ? lcaFragments.join(sep) : sep;
82
- const stats = await __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__["default"].stat(lca);
83
- if (stats?.isFile()) lca = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(lca);
82
+ const stats = await promises_default.stat(lca);
83
+ if (stats?.isFile()) lca = external_node_path_default.dirname(lca);
84
84
  return lca;
85
85
  }
86
86
  function getAbsolutePath(base, filepath) {
87
- return (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.isAbsolute)(filepath) ? filepath : (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(base, filepath);
87
+ return isAbsolute(filepath) ? filepath : join(base, filepath);
88
88
  }
89
89
  const readPackageJson = (rootPath)=>{
90
- const pkgJsonPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(rootPath, './package.json');
91
- if (!__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(pkgJsonPath)) return void __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`The \`package.json\` file does not exist in the ${rootPath} directory`);
90
+ const pkgJsonPath = external_node_path_default.join(rootPath, './package.json');
91
+ if (!external_node_fs_default.existsSync(pkgJsonPath)) return void logger.warn(`The \`package.json\` file does not exist in the ${rootPath} directory`);
92
92
  try {
93
- return JSON.parse(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(pkgJsonPath, 'utf8'));
93
+ return JSON.parse(external_node_fs_default.readFileSync(pkgJsonPath, 'utf8'));
94
94
  } catch (err) {
95
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`Failed to parse ${pkgJsonPath}, it might not be valid JSON`);
95
+ logger.warn(`Failed to parse ${pkgJsonPath}, it might not be valid JSON`);
96
96
  return;
97
97
  }
98
98
  };
@@ -124,7 +124,7 @@ function checkMFPlugin(config, sharedPlugins) {
124
124
  ...config.plugins || []
125
125
  ]);
126
126
  if (!added) {
127
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green('format: "mf"')} should be used with ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].blue('@module-federation/rsbuild-plugin')}", consider installing and adding it to plugins. Check the documentation (https://module-federation.io/guide/basic/rsbuild.html#rslib-module) to get started with "mf" output.`);
127
+ logger.warn(`${index_js_default.green('format: "mf"')} should be used with ${index_js_default.blue('@module-federation/rsbuild-plugin')}", consider installing and adding it to plugins. Check the documentation (https://module-federation.io/guide/basic/rsbuild.html#rslib-module) to get started with "mf" output.`);
128
128
  process.exit(1);
129
129
  }
130
130
  return added;
@@ -154,7 +154,7 @@ const isDebug = ()=>{
154
154
  '*'
155
155
  ].some((key)=>values.includes(key));
156
156
  };
157
- if (isDebug()) __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.level = 'verbose';
157
+ if (isDebug()) logger.level = 'verbose';
158
158
  function getTime() {
159
159
  const now = new Date();
160
160
  const hours = String(now.getHours()).padStart(2, '0');
@@ -162,11 +162,11 @@ function getTime() {
162
162
  const seconds = String(now.getSeconds()).padStart(2, '0');
163
163
  return `${hours}:${minutes}:${seconds}`;
164
164
  }
165
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.override({
165
+ logger.override({
166
166
  debug: (message, ...args)=>{
167
- if ('verbose' !== __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.level) return;
168
- const time = __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].gray(`${getTime()}`);
169
- console.log(` ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green('rslib')} ${time} ${message}`, ...args);
167
+ if ('verbose' !== logger.level) return;
168
+ const time = index_js_default.gray(`${getTime()}`);
169
+ console.log(` ${index_js_default.green('rslib')} ${time} ${message}`, ...args);
170
170
  }
171
171
  });
172
172
  function initNodeEnv() {
@@ -181,7 +181,7 @@ function prepareCli() {
181
181
  initNodeEnv();
182
182
  const { npm_execpath } = process.env;
183
183
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
184
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rslib v0.9.2\n`);
184
+ logger.greet(` Rslib v0.10.0\n`);
185
185
  }
186
186
  function toArr(any) {
187
187
  return null == any ? [] : Array.isArray(any) ? any : [
@@ -503,7 +503,7 @@ class GlobalCommand extends Command {
503
503
  }
504
504
  }
505
505
  var __assign = Object.assign;
506
- class CAC extends __WEBPACK_EXTERNAL_MODULE_events__.EventEmitter {
506
+ class CAC extends EventEmitter {
507
507
  constructor(name = ""){
508
508
  super();
509
509
  this.name = name;
@@ -903,7 +903,7 @@ class LibCssExtractPlugin {
903
903
  });
904
904
  }
905
905
  }
906
- const cssConfig_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
906
+ const cssConfig_require = createRequire(import.meta.url);
907
907
  const RSLIB_CSS_ENTRY_FLAG = '__rslib_css__';
908
908
  function isCssFile(filepath) {
909
909
  return CSS_EXTENSIONS_PATTERN.test(filepath);
@@ -919,7 +919,7 @@ function parsePathQueryFragment(str) {
919
919
  };
920
920
  }
921
921
  function cssConfig_isCssModulesFile(filepath, auto) {
922
- const filename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(filepath);
922
+ const filename = external_node_path_default.basename(filepath);
923
923
  if (true === auto) return CSS_MODULE_REG.test(filename);
924
924
  if (auto instanceof RegExp) return auto.test(filepath);
925
925
  if ('function' == typeof auto) {
@@ -1001,7 +1001,7 @@ const composeCssConfig = (rootDir, auto, bundle = true, banner, footer)=>{
1001
1001
  }
1002
1002
  };
1003
1003
  };
1004
- const EntryChunkPlugin_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
1004
+ const EntryChunkPlugin_require = createRequire(import.meta.url);
1005
1005
  const EntryChunkPlugin_PLUGIN_NAME = 'rsbuild:lib-entry-chunk';
1006
1006
  const EntryChunkPlugin_LOADER_NAME = 'rsbuild:lib-entry-module';
1007
1007
  const IMPORT_META_URL_SHIM = `const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
@@ -1105,7 +1105,7 @@ class EntryChunkPlugin {
1105
1105
  });
1106
1106
  });
1107
1107
  compiler.hooks.assetEmitted.tap(EntryChunkPlugin_PLUGIN_NAME, (file, { targetPath })=>{
1108
- if (this.shebangInjectedAssets.has(file)) (0, __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.chmodSync)(targetPath, this.shebangChmod);
1108
+ if (this.shebangInjectedAssets.has(file)) chmodSync(targetPath, this.shebangChmod);
1109
1109
  });
1110
1110
  }
1111
1111
  }
@@ -1170,7 +1170,7 @@ const getDefaultExtension = (options)=>{
1170
1170
  dtsExtension
1171
1171
  };
1172
1172
  if (!pkgJson) {
1173
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn('The `autoExtension` configuration will not be applied due to read package.json failed');
1173
+ logger.warn('The `autoExtension` configuration will not be applied due to read package.json failed');
1174
1174
  return {
1175
1175
  jsExtension,
1176
1176
  dtsExtension
@@ -1355,8 +1355,8 @@ function transformSyntaxToBrowserslist(syntax, target) {
1355
1355
  if (Array.isArray(syntax)) return syntax.flatMap(handleSyntaxItem);
1356
1356
  return handleSyntaxItem(syntax);
1357
1357
  }
1358
- const POSIX_SEP_RE = new RegExp('\\' + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.sep, 'g');
1359
- const NATIVE_SEP_RE = new RegExp('\\' + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep, 'g');
1358
+ const POSIX_SEP_RE = new RegExp('\\' + external_node_path_default.posix.sep, 'g');
1359
+ const NATIVE_SEP_RE = new RegExp('\\' + external_node_path_default.sep, 'g');
1360
1360
  const PATTERN_REGEX_CACHE = new Map();
1361
1361
  const GLOB_ALL_PATTERN = "**/*";
1362
1362
  const TS_EXTENSIONS = [
@@ -1374,7 +1374,7 @@ const util_JS_EXTENSIONS = [
1374
1374
  const TSJS_EXTENSIONS = TS_EXTENSIONS.concat(util_JS_EXTENSIONS);
1375
1375
  const TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext)=>ext.substring(1)).join('|')})`;
1376
1376
  const TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext)=>ext.substring(1)).join('|')})`;
1377
- const IS_POSIX = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.sep === __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep;
1377
+ const IS_POSIX = external_node_path_default.posix.sep === external_node_path_default.sep;
1378
1378
  function util_makePromise() {
1379
1379
  let resolve, reject;
1380
1380
  const promise = new Promise((res, rej)=>{
@@ -1388,22 +1388,22 @@ function util_makePromise() {
1388
1388
  };
1389
1389
  }
1390
1390
  async function util_resolveTSConfigJson(filename, cache) {
1391
- if ('.json' !== __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(filename)) return;
1392
- const tsconfig = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(filename);
1391
+ if ('.json' !== external_node_path_default.extname(filename)) return;
1392
+ const tsconfig = external_node_path_default.resolve(filename);
1393
1393
  if (cache && (cache.hasParseResult(tsconfig) || cache.hasParseResult(filename))) return tsconfig;
1394
- return __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.promises.stat(tsconfig).then((stat)=>{
1394
+ return promises.stat(tsconfig).then((stat)=>{
1395
1395
  if (stat.isFile() || stat.isFIFO()) return tsconfig;
1396
1396
  throw new Error(`${filename} exists but is not a regular file.`);
1397
1397
  });
1398
1398
  }
1399
1399
  const util_isInNodeModules = IS_POSIX ? (dir)=>dir.includes('/node_modules/') : (dir)=>dir.match(/[/\\]node_modules[/\\]/);
1400
- const posix2native = IS_POSIX ? (filename)=>filename : (filename)=>filename.replace(POSIX_SEP_RE, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep);
1401
- const util_native2posix = IS_POSIX ? (filename)=>filename : (filename)=>filename.replace(NATIVE_SEP_RE, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.sep);
1402
- const resolve2posix = IS_POSIX ? (dir, filename)=>dir ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(dir, filename) : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(filename) : (dir, filename)=>util_native2posix(dir ? __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(posix2native(dir), posix2native(filename)) : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(posix2native(filename)));
1400
+ const posix2native = IS_POSIX ? (filename)=>filename : (filename)=>filename.replace(POSIX_SEP_RE, external_node_path_default.sep);
1401
+ const util_native2posix = IS_POSIX ? (filename)=>filename : (filename)=>filename.replace(NATIVE_SEP_RE, external_node_path_default.posix.sep);
1402
+ const resolve2posix = IS_POSIX ? (dir, filename)=>dir ? external_node_path_default.resolve(dir, filename) : external_node_path_default.resolve(filename) : (dir, filename)=>util_native2posix(dir ? external_node_path_default.resolve(posix2native(dir), posix2native(filename)) : external_node_path_default.resolve(posix2native(filename)));
1403
1403
  function util_resolveReferencedTSConfigFiles(result, options) {
1404
- const dir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(result.tsconfigFile);
1404
+ const dir = external_node_path_default.dirname(result.tsconfigFile);
1405
1405
  return result.tsconfig.references.map((ref)=>{
1406
- const refPath = ref.path.endsWith('.json') ? ref.path : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(ref.path, options?.configName ?? 'tsconfig.json');
1406
+ const refPath = ref.path.endsWith('.json') ? ref.path : external_node_path_default.join(ref.path, options?.configName ?? 'tsconfig.json');
1407
1407
  return resolve2posix(dir, refPath);
1408
1408
  });
1409
1409
  }
@@ -1417,7 +1417,7 @@ function util_resolveSolutionTSConfig(filename, result) {
1417
1417
  return result;
1418
1418
  }
1419
1419
  function util_isIncluded(filename, result) {
1420
- const dir = util_native2posix(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(result.tsconfigFile));
1420
+ const dir = util_native2posix(external_node_path_default.dirname(result.tsconfigFile));
1421
1421
  const files = (result.tsconfig.files || []).map((file)=>resolve2posix(dir, file));
1422
1422
  const absoluteFilename = resolve2posix(null, filename);
1423
1423
  if (files.includes(filename)) return true;
@@ -1505,16 +1505,16 @@ function pattern2regex(resolvedPattern, allowJs) {
1505
1505
  return new RegExp(regexStr);
1506
1506
  }
1507
1507
  function util_replaceTokens(result) {
1508
- if (result.tsconfig) result.tsconfig = JSON.parse(JSON.stringify(result.tsconfig).replaceAll(/"\${configDir}/g, `"${util_native2posix(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(result.tsconfigFile))}`));
1508
+ if (result.tsconfig) result.tsconfig = JSON.parse(JSON.stringify(result.tsconfig).replaceAll(/"\${configDir}/g, `"${util_native2posix(external_node_path_default.dirname(result.tsconfigFile))}`));
1509
1509
  }
1510
1510
  async function find(filename, options) {
1511
- let dir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(filename));
1511
+ let dir = external_node_path_default.dirname(external_node_path_default.resolve(filename));
1512
1512
  if (options?.ignoreNodeModules && util_isInNodeModules(dir)) return null;
1513
1513
  const cache = options?.cache;
1514
1514
  const configName = options?.configName ?? 'tsconfig.json';
1515
1515
  if (cache?.hasConfigPath(dir, configName)) return cache.getConfigPath(dir, configName);
1516
1516
  const { promise, resolve, reject } = util_makePromise();
1517
- if (options?.root && !__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(options.root)) options.root = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(options.root);
1517
+ if (options?.root && !external_node_path_default.isAbsolute(options.root)) options.root = external_node_path_default.resolve(options.root);
1518
1518
  findUp(dir, {
1519
1519
  promise,
1520
1520
  resolve,
@@ -1535,13 +1535,13 @@ function findUp(dir, { resolve, reject, promise }, options) {
1535
1535
  if (cached?.then) cached.then(resolve).catch(reject);
1536
1536
  else resolve(cached);
1537
1537
  } else cache.setConfigPath(dir, promise, configName);
1538
- const tsconfig = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(dir, options?.configName ?? 'tsconfig.json');
1539
- __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].stat(tsconfig, (err, stats)=>{
1538
+ const tsconfig = external_node_path_default.join(dir, options?.configName ?? 'tsconfig.json');
1539
+ external_node_fs_default.stat(tsconfig, (err, stats)=>{
1540
1540
  if (stats && (stats.isFile() || stats.isFIFO())) resolve(tsconfig);
1541
1541
  else if (err?.code !== 'ENOENT') reject(err);
1542
1542
  else {
1543
1543
  let parent;
1544
- if (root === dir || (parent = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(dir)) === dir) resolve(null);
1544
+ if (root === dir || (parent = external_node_path_default.dirname(dir)) === dir) resolve(null);
1545
1545
  else findUp(parent, {
1546
1546
  promise,
1547
1547
  resolve,
@@ -1550,7 +1550,7 @@ function findUp(dir, { resolve, reject, promise }, options) {
1550
1550
  }
1551
1551
  });
1552
1552
  }
1553
- __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep;
1553
+ external_node_path_default.sep;
1554
1554
  function toJson(tsconfigJson) {
1555
1555
  const stripped = stripDanglingComma(stripJsonComments(stripBom(tsconfigJson)));
1556
1556
  if ('' === stripped.trim()) return '{}';
@@ -1691,12 +1691,12 @@ async function getParsedDeep(filename, cache, options) {
1691
1691
  }
1692
1692
  async function parseFile(tsconfigFile, cache, skipCache) {
1693
1693
  if (!skipCache && cache?.hasParseResult(tsconfigFile) && !cache.getParseResult(tsconfigFile)._isRootFile_) return cache.getParseResult(tsconfigFile);
1694
- const promise = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.promises.readFile(tsconfigFile, 'utf-8').then(toJson).then((json)=>{
1694
+ const promise = promises.readFile(tsconfigFile, 'utf-8').then(toJson).then((json)=>{
1695
1695
  const parsed = JSON.parse(json);
1696
1696
  applyDefaults(parsed, tsconfigFile);
1697
1697
  return {
1698
1698
  tsconfigFile,
1699
- tsconfig: normalizeTSConfig(parsed, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(tsconfigFile))
1699
+ tsconfig: normalizeTSConfig(parsed, external_node_path_default.dirname(tsconfigFile))
1700
1700
  };
1701
1701
  }).catch((e)=>{
1702
1702
  throw new TSConfckParseError(`parsing ${tsconfigFile} failed: ${e}`, 'PARSE_FILE', tsconfigFile, e);
@@ -1706,7 +1706,7 @@ async function parseFile(tsconfigFile, cache, skipCache) {
1706
1706
  }
1707
1707
  function normalizeTSConfig(tsconfig, dir) {
1708
1708
  const baseUrl = tsconfig.compilerOptions?.baseUrl;
1709
- if (baseUrl && !baseUrl.startsWith('${') && !__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(baseUrl)) tsconfig.compilerOptions.baseUrl = resolve2posix(dir, baseUrl);
1709
+ if (baseUrl && !baseUrl.startsWith('${') && !external_node_path_default.isAbsolute(baseUrl)) tsconfig.compilerOptions.baseUrl = resolve2posix(dir, baseUrl);
1710
1710
  return tsconfig;
1711
1711
  }
1712
1712
  async function parseReferences(result, options) {
@@ -1762,14 +1762,14 @@ function resolveExtends(extended, from) {
1762
1762
  '.',
1763
1763
  '..'
1764
1764
  ].includes(extended)) extended += '/tsconfig.json';
1765
- const req = (0, __WEBPACK_EXTERNAL_MODULE_module__.createRequire)(from);
1765
+ const req = external_module_createRequire(from);
1766
1766
  let error;
1767
1767
  try {
1768
1768
  return req.resolve(extended);
1769
1769
  } catch (e) {
1770
1770
  error = e;
1771
1771
  }
1772
- if ('.' !== extended[0] && !__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(extended)) try {
1772
+ if ('.' !== extended[0] && !external_node_path_default.isAbsolute(extended)) try {
1773
1773
  return req.resolve(`${extended}/tsconfig.json`);
1774
1774
  } catch (e) {
1775
1775
  error = e;
@@ -1789,7 +1789,7 @@ const EXTENDABLE_KEYS = [
1789
1789
  function extendTSConfig(extending, extended) {
1790
1790
  const extendingConfig = extending.tsconfig;
1791
1791
  const extendedConfig = extended.tsconfig;
1792
- const relativePath = util_native2posix(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(extending.tsconfigFile), __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(extended.tsconfigFile)));
1792
+ const relativePath = util_native2posix(external_node_path_default.relative(external_node_path_default.dirname(extending.tsconfigFile), external_node_path_default.dirname(extended.tsconfigFile)));
1793
1793
  for (const key of Object.keys(extendedConfig).filter((key)=>EXTENDABLE_KEYS.includes(key)))if ('compilerOptions' === key) {
1794
1794
  if (!extendingConfig.compilerOptions) extendingConfig.compilerOptions = {};
1795
1795
  for (const option of Object.keys(extendedConfig.compilerOptions))if (!Object.prototype.hasOwnProperty.call(extendingConfig.compilerOptions, option)) extendingConfig.compilerOptions[option] = rebaseRelative(option, extendedConfig.compilerOptions[option], relativePath);
@@ -1818,8 +1818,8 @@ function rebaseRelative(key, value, prependPath) {
1818
1818
  return rebasePath(value, prependPath);
1819
1819
  }
1820
1820
  function rebasePath(value, prependPath) {
1821
- if (__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(value) || value.startsWith('${configDir}')) return value;
1822
- return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.normalize(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join(prependPath, value));
1821
+ if (external_node_path_default.isAbsolute(value) || value.startsWith('${configDir}')) return value;
1822
+ return external_node_path_default.posix.normalize(external_node_path_default.posix.join(prependPath, value));
1823
1823
  }
1824
1824
  class TSConfckParseError extends Error {
1825
1825
  code;
@@ -1848,12 +1848,12 @@ const DEFAULT_JSCONFIG_COMPILER_OPTIONS = {
1848
1848
  noEmit: true
1849
1849
  };
1850
1850
  function isJSConfig(configFileName) {
1851
- return 'jsconfig.json' === __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(configFileName);
1851
+ return 'jsconfig.json' === external_node_path_default.basename(configFileName);
1852
1852
  }
1853
1853
  async function loadTsconfig(root, tsconfigPath = 'tsconfig.json') {
1854
- const tsconfigFileName = await find((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, tsconfigPath), {
1854
+ const tsconfigFileName = await find(join(root, tsconfigPath), {
1855
1855
  root,
1856
- configName: (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.basename)(tsconfigPath)
1856
+ configName: basename(tsconfigPath)
1857
1857
  });
1858
1858
  if (tsconfigFileName) {
1859
1859
  const { tsconfig } = await parse_parse(tsconfigFileName);
@@ -1864,21 +1864,21 @@ async function loadTsconfig(root, tsconfigPath = 'tsconfig.json') {
1864
1864
  function defineConfig(config) {
1865
1865
  return config;
1866
1866
  }
1867
- const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync);
1867
+ const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(external_node_fs_default.existsSync);
1868
1868
  const resolveConfigPath = (root, customConfig)=>{
1869
1869
  if (customConfig) {
1870
- const customConfigPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.isAbsolute)(customConfig) ? customConfig : (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, customConfig);
1871
- if (__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(customConfigPath)) return customConfigPath;
1872
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`Cannot find config file: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].dim(customConfigPath)}\n`);
1870
+ const customConfigPath = isAbsolute(customConfig) ? customConfig : join(root, customConfig);
1871
+ if (external_node_fs_default.existsSync(customConfigPath)) return customConfigPath;
1872
+ logger.warn(`Cannot find config file: ${index_js_default.dim(customConfigPath)}\n`);
1873
1873
  }
1874
- const configFilePath = findConfig((0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(root, DEFAULT_CONFIG_NAME));
1874
+ const configFilePath = findConfig(join(root, DEFAULT_CONFIG_NAME));
1875
1875
  if (configFilePath) return configFilePath;
1876
1876
  throw new Error(`${DEFAULT_CONFIG_NAME} not found in ${root}`);
1877
1877
  };
1878
1878
  async function loadConfig({ cwd = process.cwd(), path, envMode }) {
1879
1879
  const configFilePath = resolveConfigPath(cwd, path);
1880
1880
  const { content } = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.loadConfig)({
1881
- cwd: (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.dirname)(configFilePath),
1881
+ cwd: dirname(configFilePath),
1882
1882
  path: configFilePath,
1883
1883
  envMode
1884
1884
  });
@@ -1950,7 +1950,7 @@ const composeExternalsWarnConfig = (format, ...externalsArray)=>{
1950
1950
  };
1951
1951
  if (contextInfo.issuer && 'commonjs' === dependencyType) {
1952
1952
  matchUserExternals(externals, request, _callback);
1953
- if (shouldWarn) __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(composeModuleImportWarn(request, contextInfo.issuer));
1953
+ if (shouldWarn) logger.warn(composeModuleImportWarn(request, contextInfo.issuer));
1954
1954
  }
1955
1955
  callback();
1956
1956
  }
@@ -1965,7 +1965,7 @@ const composeAutoExternalConfig = (options)=>{
1965
1965
  const autoExternal = getAutoExternalDefaultValue(format, options.autoExternal);
1966
1966
  if (false === autoExternal) return {};
1967
1967
  if (!pkgJson) {
1968
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn('The `autoExternal` configuration will not be applied due to read package.json failed');
1968
+ logger.warn('The `autoExternal` configuration will not be applied due to read package.json failed');
1969
1969
  return {};
1970
1970
  }
1971
1971
  const userExternalKeys = userExternals && isObject(userExternals) ? Object.keys(userExternals) : [];
@@ -2376,7 +2376,7 @@ const composeShimsConfig = (format, shims)=>{
2376
2376
  enabledShims
2377
2377
  };
2378
2378
  };
2379
- const composeModuleImportWarn = (request, issuer)=>`The externalized commonjs request ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green(`"${request}"`)} from ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green(issuer)} will use ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].blue('"module"')} external type in ESM format. If you want to specify other external type, consider setting the request and type with ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].blue('"output.externals"')}.`;
2379
+ const composeModuleImportWarn = (request, issuer)=>`The externalized commonjs request ${index_js_default.green(`"${request}"`)} from ${index_js_default.green(issuer)} will use ${index_js_default.blue('"module"')} external type in ESM format. If you want to specify other external type, consider setting the request and type with ${index_js_default.blue('"output.externals"')}.`;
2380
2380
  const composeExternalsConfig = (format, externals)=>{
2381
2381
  const externalsTypeMap = {
2382
2382
  esm: 'module-import',
@@ -2432,7 +2432,7 @@ const composeAutoExtensionConfig = (config, format, autoExtension, pkgJson)=>{
2432
2432
  const hash = getHash();
2433
2433
  const defaultJsFilename = `[name]${hash}${jsExtension}`;
2434
2434
  const userJsFilename = config.output?.filename?.js;
2435
- const finalJsExtension = 'string' == typeof userJsFilename && userJsFilename ? (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.extname)(userJsFilename) : jsExtension;
2435
+ const finalJsExtension = 'string' == typeof userJsFilename && userJsFilename ? external_node_path_extname(userJsFilename) : jsExtension;
2436
2436
  const finalConfig = userJsFilename ? {} : {
2437
2437
  output: {
2438
2438
  filename: {
@@ -2483,7 +2483,7 @@ const traverseEntryQuery = (entry, callback)=>{
2483
2483
  }
2484
2484
  return newEntry;
2485
2485
  };
2486
- const resolveEntryPath = (entries, root)=>traverseEntryQuery(entries, (item)=>__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(root, item));
2486
+ const resolveEntryPath = (entries, root)=>traverseEntryQuery(entries, (item)=>external_node_path_default.resolve(root, item));
2487
2487
  const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto, userOutBase)=>{
2488
2488
  let entries = rawEntry;
2489
2489
  if (!entries) {
@@ -2495,18 +2495,18 @@ const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto, userOu
2495
2495
  index: 'src/**'
2496
2496
  };
2497
2497
  }
2498
- if ('object' != typeof entries) throw new Error(`The ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan('source.entry')} configuration should be an object, but received ${typeof entries}: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(entries)}. Checkout ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green('https://rslib.rs/config/rsbuild/source#sourceentry')} for more details.`);
2498
+ if ('object' != typeof entries) throw new Error(`The ${index_js_default.cyan('source.entry')} configuration should be an object, but received ${typeof entries}: ${index_js_default.cyan(entries)}. Checkout ${index_js_default.green('https://rslib.rs/config/rsbuild/source#sourceentry')} for more details.`);
2499
2499
  if (false !== bundle) {
2500
2500
  const entryErrorReasons = [];
2501
2501
  traverseEntryQuery(entries, (entry)=>{
2502
- const entryAbsPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(entry) ? entry : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(root, entry);
2503
- const isDirLike = '' === __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].extname(entryAbsPath);
2504
- const dirError = `Glob pattern ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(`"${entry}"`)} is not supported when "bundle" is "true", considering "bundle" to "false" to use bundleless mode, or specify a file entry to bundle. See ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green('https://rslib.rs/guide/basic/output-structure')} for more details.`;
2505
- if (__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(entryAbsPath)) {
2506
- const stats = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].statSync(entryAbsPath);
2502
+ const entryAbsPath = external_node_path_default.isAbsolute(entry) ? entry : external_node_path_default.resolve(root, entry);
2503
+ const isDirLike = '' === external_node_path_default.extname(entryAbsPath);
2504
+ const dirError = `Glob pattern ${index_js_default.cyan(`"${entry}"`)} is not supported when "bundle" is "true", considering "bundle" to "false" to use bundleless mode, or specify a file entry to bundle. See ${index_js_default.green('https://rslib.rs/guide/basic/output-structure')} for more details.`;
2505
+ if (external_node_fs_default.existsSync(entryAbsPath)) {
2506
+ const stats = external_node_fs_default.statSync(entryAbsPath);
2507
2507
  if (!stats.isFile()) entryErrorReasons.push(dirError);
2508
2508
  } else if (isDirLike) entryErrorReasons.push(dirError);
2509
- else entryErrorReasons.push(`Can't resolve the entry ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(`"${entry}"`)} at the location ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(`${entryAbsPath}`)}. Please ensure that the file exists.`);
2509
+ else entryErrorReasons.push(`Can't resolve the entry ${index_js_default.cyan(`"${entry}"`)} at the location ${index_js_default.cyan(`${entryAbsPath}`)}. Please ensure that the file exists.`);
2510
2510
  return entry;
2511
2511
  });
2512
2512
  if (entryErrorReasons.length) throw new AggregateError(entryErrorReasons.map((reason)=>new Error(reason)));
@@ -2522,7 +2522,7 @@ const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto, userOu
2522
2522
  const scanGlobEntries = async (tryResolveOutBase)=>{
2523
2523
  const resolvedEntries = {};
2524
2524
  const resolveOutBase = async (resolvedEntryFiles)=>{
2525
- if (void 0 !== userOutBase) return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(userOutBase) ? userOutBase : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(root, userOutBase);
2525
+ if (void 0 !== userOutBase) return external_node_path_default.isAbsolute(userOutBase) ? userOutBase : external_node_path_default.resolve(root, userOutBase);
2526
2526
  const lcp = await calcLongestCommonPath(resolvedEntryFiles) ?? root;
2527
2527
  return lcp;
2528
2528
  };
@@ -2532,7 +2532,7 @@ const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto, userOu
2532
2532
  entry
2533
2533
  ] : null;
2534
2534
  if (!entryFiles) throw new Error('Entry can only be a string or an array of strings for now');
2535
- const globEntryFiles = await (0, __WEBPACK_EXTERNAL_MODULE_tinyglobby__.glob)(entryFiles, {
2535
+ const globEntryFiles = await glob(entryFiles, {
2536
2536
  cwd: root,
2537
2537
  absolute: true
2538
2538
  });
@@ -2540,14 +2540,14 @@ const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto, userOu
2540
2540
  if (0 === resolvedEntryFiles.length) throw new Error(`Cannot find ${resolvedEntryFiles}`);
2541
2541
  const outBase = await resolveOutBase(resolvedEntryFiles);
2542
2542
  function getEntryName(file) {
2543
- const { dir, name } = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].parse(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(outBase, file));
2544
- const entryFileName = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(dir, name);
2543
+ const { dir, name } = external_node_path_default.parse(external_node_path_default.relative(outBase, file));
2544
+ const entryFileName = external_node_path_default.join(dir, name);
2545
2545
  if (isCssGlobalFile(file, cssModulesAuto)) return `${RSLIB_CSS_ENTRY_FLAG}/${entryFileName}`;
2546
2546
  return entryFileName;
2547
2547
  }
2548
2548
  for (const file of resolvedEntryFiles){
2549
2549
  const entryName = getEntryName(file);
2550
- if (resolvedEntries[entryName]) tryResolveOutBase && __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.warn(`Duplicate entry ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(entryName)} from ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, file))} and ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(root, resolvedEntries[entryName]))}, which may lead to the incorrect output, please rename the file.`);
2550
+ if (resolvedEntries[entryName]) tryResolveOutBase && logger.warn(`Duplicate entry ${index_js_default.cyan(entryName)} from ${index_js_default.cyan(external_node_path_default.relative(root, file))} and ${index_js_default.cyan(external_node_path_default.relative(root, resolvedEntries[entryName]))}, which may lead to the incorrect output, please rename the file.`);
2551
2551
  resolvedEntries[entryName] = file;
2552
2552
  }
2553
2553
  }
@@ -2609,13 +2609,13 @@ const composeBundlelessExternalConfig = (jsExtension, redirect, cssModulesAuto,
2609
2609
  if ('string' != typeof outBase) throw new Error(`outBase expect to be a string in bundleless mode, but got ${outBase}`);
2610
2610
  const isSubpath = normalizeSlash(resolvedRequest).startsWith(`${normalizeSlash(outBase)}/`);
2611
2611
  if (isSubpath) {
2612
- resolvedRequest = normalizeSlash(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(issuer), resolvedRequest));
2612
+ resolvedRequest = normalizeSlash(external_node_path_default.relative(external_node_path_default.dirname(issuer), resolvedRequest));
2613
2613
  if ('.' !== resolvedRequest[0]) resolvedRequest = `./${resolvedRequest}`;
2614
2614
  return resolvedRequest;
2615
2615
  }
2616
2616
  return;
2617
2617
  } catch (e) {
2618
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.debug(`Failed to resolve module ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green(`"${request}"`)} from ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green(issuer)}. If it's an npm package, consider adding it to dependencies or peerDependencies in package.json to make it externalized.`);
2618
+ logger.debug(`Failed to resolve module ${index_js_default.green(`"${request}"`)} from ${index_js_default.green(issuer)}. If it's an npm package, consider adding it to dependencies or peerDependencies in package.json to make it externalized.`);
2619
2619
  return request;
2620
2620
  }
2621
2621
  }
@@ -2629,7 +2629,7 @@ const composeBundlelessExternalConfig = (jsExtension, redirect, cssModulesAuto,
2629
2629
  resolvedRequest = redirectedPath;
2630
2630
  }
2631
2631
  if (resolvedRequest.startsWith('.')) {
2632
- const ext = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.extname)(resolvedRequest);
2632
+ const ext = external_node_path_extname(resolvedRequest);
2633
2633
  if (ext) {
2634
2634
  if (JS_EXTENSIONS_PATTERN.test(resolvedRequest)) {
2635
2635
  if (jsRedirectExtension) resolvedRequest = resolvedRequest.replace(/\.[^.]+$/, jsExtension);
@@ -2727,7 +2727,7 @@ const composeExternalHelpersConfig = (externalHelpers, pkgJson)=>{
2727
2727
  ...Object.keys(pkgJson?.devDependencies ?? [])
2728
2728
  ];
2729
2729
  if (!deps.includes(SWC_HELPERS)) {
2730
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(`${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].green('externalHelpers')} is enabled, but the ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].blue(SWC_HELPERS)} dependency declaration was not found in package.json.`);
2730
+ logger.error(`${index_js_default.green('externalHelpers')} is enabled, but the ${index_js_default.blue(SWC_HELPERS)} dependency declaration was not found in package.json.`);
2731
2731
  process.exit(1);
2732
2732
  }
2733
2733
  defaultConfig = Object.assign(defaultConfig, {
@@ -2783,7 +2783,7 @@ async function composeLibRsbuildConfig(config, root, sharedPlugins) {
2783
2783
  async function composeCreateRsbuildConfig(rslibConfig) {
2784
2784
  const constantRsbuildConfig = await createConstantRsbuildConfig();
2785
2785
  const { lib: libConfigsArray, mode, root, plugins: sharedPlugins, dev, server, ...sharedRsbuildConfig } = rslibConfig;
2786
- if (!Array.isArray(libConfigsArray) || 0 === libConfigsArray.length) throw new Error(`Expect "lib" field to be a non-empty array, but got: ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].cyan(JSON.stringify(libConfigsArray))}.`);
2786
+ if (!Array.isArray(libConfigsArray) || 0 === libConfigsArray.length) throw new Error(`Expect "lib" field to be a non-empty array, but got: ${index_js_default.cyan(JSON.stringify(libConfigsArray))}.`);
2787
2787
  const libConfigPromises = libConfigsArray.map(async (libConfig)=>{
2788
2788
  const userConfig = (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(sharedRsbuildConfig, libConfig);
2789
2789
  const libRsbuildConfig = await composeLibRsbuildConfig(userConfig, root, sharedPlugins);
@@ -2883,9 +2883,9 @@ const clearConsole = ()=>{
2883
2883
  const beforeRestart = async ({ filePath, clear = true } = {})=>{
2884
2884
  if (clear) clearConsole();
2885
2885
  if (filePath) {
2886
- const filename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(filePath);
2887
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`restart because ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__["default"].yellow(filename)} is changed.\n`);
2888
- } else __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info('restarting...\n');
2886
+ const filename = external_node_path_default.basename(filePath);
2887
+ logger.info(`restart because ${index_js_default.yellow(filename)} is changed.\n`);
2888
+ } else logger.info('restarting...\n');
2889
2889
  for (const cleaner of cleaners)await cleaner();
2890
2890
  cleaners = [];
2891
2891
  };
@@ -2910,7 +2910,7 @@ async function build(config, options = {}) {
2910
2910
  return rsbuildInstance;
2911
2911
  }
2912
2912
  const getEnvDir = (cwd, envDir)=>{
2913
- if (envDir) return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(envDir) ? envDir : __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(cwd, envDir);
2913
+ if (envDir) return external_node_path_default.isAbsolute(envDir) ? envDir : external_node_path_default.resolve(cwd, envDir);
2914
2914
  return cwd;
2915
2915
  };
2916
2916
  async function init(options) {
@@ -3001,7 +3001,7 @@ const applyCommonOptions = (cli)=>{
3001
3001
  function runCli() {
3002
3002
  const cli = dist('rslib');
3003
3003
  cli.help();
3004
- cli.version("0.9.2");
3004
+ cli.version("0.10.0");
3005
3005
  applyCommonOptions(cli);
3006
3006
  const buildCommand = cli.command('build', 'build the library for production');
3007
3007
  const inspectCommand = cli.command('inspect', 'inspect the Rsbuild / Rspack configs of Rslib projects');
@@ -3017,9 +3017,9 @@ function runCli() {
3017
3017
  };
3018
3018
  await cliBuild();
3019
3019
  } catch (err) {
3020
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to build.');
3021
- if (err instanceof AggregateError) for (const error of err.errors)__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(error);
3022
- else __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
3020
+ logger.error('Failed to build.');
3021
+ if (err instanceof AggregateError) for (const error of err.errors)logger.error(error);
3022
+ else logger.error(err);
3023
3023
  process.exit(1);
3024
3024
  }
3025
3025
  });
@@ -3035,8 +3035,8 @@ function runCli() {
3035
3035
  verbose: options.verbose
3036
3036
  });
3037
3037
  } catch (err) {
3038
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to inspect config.');
3039
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
3038
+ logger.error('Failed to inspect config.');
3039
+ logger.error(err);
3040
3040
  process.exit(1);
3041
3041
  }
3042
3042
  });
@@ -3053,14 +3053,13 @@ function runCli() {
3053
3053
  };
3054
3054
  await cliMfDev();
3055
3055
  } catch (err) {
3056
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to start mf-dev.');
3057
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
3056
+ logger.error('Failed to start mf-dev.');
3057
+ logger.error(err);
3058
3058
  process.exit(1);
3059
3059
  }
3060
3060
  });
3061
3061
  cli.parse();
3062
3062
  }
3063
- const src_version = "0.9.2";
3064
- var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger;
3063
+ const src_version = "0.10.0";
3065
3064
  var __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack;
3066
- export { build, defineConfig, inspect, loadConfig, prepareCli, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ as rsbuild, runCli, startMFDevServer, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
3065
+ export { build, defineConfig, inspect, loadConfig, logger, prepareCli, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ as rsbuild, runCli, startMFDevServer, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, src_version as version, __webpack_exports__rspack as rspack };
@@ -1,5 +1,5 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
2
- import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
1
+ import external_node_path_default, { extname as external_node_path_extname } from "node:path";
2
+ import { createRequire } from "node:module";
3
3
  import "@rsbuild/core";
4
4
  const DTS_EXTENSIONS = [
5
5
  'd.ts',
@@ -31,7 +31,7 @@ const CSS_EXTENSIONS = [
31
31
  new RegExp(`\\.(${JS_EXTENSIONS.join('|')})$`);
32
32
  new RegExp(`\\.(${CSS_EXTENSIONS.join('|')})$`);
33
33
  new RegExp(`\\.(${DTS_EXTENSIONS.join('|')})$`);
34
- (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
34
+ createRequire(import.meta.url);
35
35
  const CSS_MODULE_REG = /\.module\.\w+$/i;
36
36
  const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
37
37
  function parsePathQueryFragment(str) {
@@ -43,7 +43,7 @@ function parsePathQueryFragment(str) {
43
43
  };
44
44
  }
45
45
  function cssConfig_isCssModulesFile(filepath, auto) {
46
- const filename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(filepath);
46
+ const filename = external_node_path_default.basename(filepath);
47
47
  if (true === auto) return CSS_MODULE_REG.test(filename);
48
48
  if (auto instanceof RegExp) return auto.test(filepath);
49
49
  if ('function' == typeof auto) {
@@ -152,17 +152,17 @@ const libCssExtractLoader_pitch = function(request, _, _data) {
152
152
  let resultSource = `// extracted by ${libCssExtractLoader_LOADER_NAME}`;
153
153
  let importCssFiles = '';
154
154
  function getRelativePath(from, to) {
155
- let relativePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(from, to);
156
- if (!relativePath.startsWith('./') && !relativePath.startsWith('../') && !__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].isAbsolute(relativePath)) relativePath = `./${relativePath}`;
155
+ let relativePath = external_node_path_default.relative(from, to);
156
+ if (!relativePath.startsWith('./') && !relativePath.startsWith('../') && !external_node_path_default.isAbsolute(relativePath)) relativePath = `./${relativePath}`;
157
157
  return relativePath;
158
158
  }
159
159
  const m = new Map();
160
160
  for (const { content, filepath, sourceMap } of dependencies){
161
161
  let distFilepath = getRelativePath(rootDir, filepath);
162
- const ext = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.extname)(distFilepath);
162
+ const ext = external_node_path_extname(distFilepath);
163
163
  if ('css' !== ext) distFilepath = distFilepath.replace(ext, '.css');
164
164
  if (cssConfig_isCssModulesFile(filepath, auto)) distFilepath = distFilepath.replace(/\.module\.css/, '_module.css');
165
- const cssFilename = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].basename(distFilepath);
165
+ const cssFilename = external_node_path_default.basename(distFilepath);
166
166
  if (content.trim()) {
167
167
  m.get(distFilepath) ? m.set(distFilepath, `${m.get(distFilepath) + content}\n`) : m.set(distFilepath, `${content}\n`);
168
168
  importCssFiles += '\n';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslib/core",
3
- "version": "0.9.2",
3
+ "version": "0.10.0",
4
4
  "description": "The Rsbuild-based library development tool.",
5
5
  "homepage": "https://rslib.rs",
6
6
  "bugs": {
@@ -36,9 +36,9 @@
36
36
  "types.d.ts"
37
37
  ],
38
38
  "dependencies": {
39
- "@rsbuild/core": "1.4.0-beta.2",
39
+ "@rsbuild/core": "1.4.0-beta.3",
40
40
  "tinyglobby": "^0.2.14",
41
- "rsbuild-plugin-dts": "0.9.2"
41
+ "rsbuild-plugin-dts": "0.10.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@module-federation/rsbuild-plugin": "^0.15.0",
@@ -50,7 +50,7 @@
50
50
  "picocolors": "1.1.1",
51
51
  "prebundle": "1.3.3",
52
52
  "rsbuild-plugin-publint": "^0.3.2",
53
- "rslib": "npm:@rslib/core@0.9.1",
53
+ "rslib": "npm:@rslib/core@0.9.2",
54
54
  "rslog": "^1.2.3",
55
55
  "tsconfck": "3.1.6",
56
56
  "typescript": "^5.8.3",