@rslib/core 0.15.0 → 0.16.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.
@@ -100,6 +100,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
100
100
  if ('truecolor' === env.COLORTERM) return 3;
101
101
  if ('xterm-kitty' === env.TERM) return 3;
102
102
  if ('xterm-ghostty' === env.TERM) return 3;
103
+ if ('wezterm' === env.TERM) return 3;
103
104
  if ('TERM_PROGRAM' in env) {
104
105
  const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
105
106
  switch(env.TERM_PROGRAM){
@@ -234,6 +235,14 @@ let LOG_TYPES = {
234
235
  color: magenta
235
236
  }
236
237
  };
238
+ const normalizeErrorMessage = (err)=>{
239
+ if (err.stack) {
240
+ let [name, ...rest] = err.stack.split('\n');
241
+ if (name.startsWith('Error: ')) name = name.slice(7);
242
+ return `${name}\n${gray(rest.join('\n'))}`;
243
+ }
244
+ return err.message;
245
+ };
237
246
  let createLogger = (options = {})=>{
238
247
  let maxLevel = options.level || 'info';
239
248
  let log = (type, message, ...args)=>{
@@ -246,12 +255,14 @@ let createLogger = (options = {})=>{
246
255
  label = (logType.label || '').padEnd(7);
247
256
  label = bold(logType.color ? logType.color(label) : label);
248
257
  }
249
- if (message instanceof Error) if (message.stack) {
250
- let [name, ...rest] = message.stack.split('\n');
251
- if (name.startsWith('Error: ')) name = name.slice(7);
252
- text = `${name}\n${gray(rest.join('\n'))}`;
253
- } else text = message.message;
254
- else if ('error' === logType.level && 'string' == typeof message) {
258
+ if (message instanceof Error) {
259
+ text += normalizeErrorMessage(message);
260
+ const { cause } = message;
261
+ if (cause) {
262
+ text += yellow('\n [cause]: ');
263
+ text += cause instanceof Error ? normalizeErrorMessage(cause) : String(cause);
264
+ }
265
+ } else if ('error' === logType.level && 'string' == typeof message) {
255
266
  let lines = message.split('\n');
256
267
  text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
257
268
  } else text = `${message}`;
@@ -1 +1 @@
1
- {"name":"rslog","version":"1.2.11","license":"MIT","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"rslog","version":"1.3.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import node_fs, { chmodSync, promises } from "node:fs";
2
- import node_path, { basename, dirname, extname, isAbsolute, join } from "node:path";
2
+ import node_path, { basename as external_node_path_basename, dirname, extname, isAbsolute, join } from "node:path";
3
3
  import { glob } from "../compiled/tinyglobby/index.js";
4
4
  import { createRequire } from "node:module";
5
5
  import picocolors from "../compiled/picocolors/index.js";
@@ -7,6 +7,7 @@ import { logger } from "../compiled/rslog/index.js";
7
7
  import node_fs_promises from "node:fs/promises";
8
8
  import { createRequire as external_module_createRequire } from "module";
9
9
  import { EventEmitter } from "events";
10
+ import node_util from "node:util";
10
11
  import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
11
12
  const DEFAULT_CONFIG_NAME = 'rslib.config';
12
13
  const DEFAULT_CONFIG_EXTENSIONS = [
@@ -18,7 +19,6 @@ const DEFAULT_CONFIG_EXTENSIONS = [
18
19
  '.cts'
19
20
  ];
20
21
  const SWC_HELPERS = '@swc/helpers';
21
- const SHEBANG_PREFIX = '#!';
22
22
  const SHEBANG_REGEX = /#!.*[\s\n\r]*$/;
23
23
  const REACT_DIRECTIVE_REGEX = /^['"]use (client|server)['"](;?)[\s\n\r]*$/;
24
24
  const DTS_EXTENSIONS = [
@@ -395,7 +395,7 @@ class EntryChunkPlugin {
395
395
  const content = compiler.inputFileSystem.readFileSync(filename, {
396
396
  encoding: 'utf-8'
397
397
  });
398
- if (content.startsWith(SHEBANG_PREFIX)) {
398
+ if (content.startsWith("#!")) {
399
399
  const shebangMatch = matchFirstLine(content, SHEBANG_REGEX);
400
400
  if (shebangMatch) this.shebangEntries[name] = shebangMatch;
401
401
  }
@@ -407,9 +407,9 @@ class EntryChunkPlugin {
407
407
  compilation.hooks.chunkAsset.tap(EntryChunkPlugin_PLUGIN_NAME, (chunk, filename)=>{
408
408
  const isJs = JS_EXTENSIONS_PATTERN.test(filename);
409
409
  if (!isJs) return;
410
+ this.shimsInjectedAssets.add(filename);
410
411
  const name = chunk.name;
411
412
  if (!name) return;
412
- this.shimsInjectedAssets.add(filename);
413
413
  const shebangEntry = this.shebangEntries[name];
414
414
  if (shebangEntry) this.shebangEntries[filename] = shebangEntry;
415
415
  const reactDirective = this.reactDirectives[name];
@@ -742,90 +742,84 @@ const ESX_TO_BROWSERSLIST = {
742
742
  safari: '3.1.0'
743
743
  },
744
744
  es6: {
745
- chrome: '63.0.0',
746
- edge: '79.0.0',
747
- firefox: '67.0.0',
748
- ios: '13.0.0',
749
- node: '13.2.0',
750
- opera: '50.0.0',
751
- safari: '13.0.0'
745
+ chrome: '51.0.0',
746
+ edge: '15.0.0',
747
+ firefox: '54.0.0',
748
+ safari: '10.0.0',
749
+ opera: '38.0.0',
750
+ samsung: '5.0.0'
752
751
  },
753
752
  es2015: {
754
- chrome: '63.0.0',
755
- edge: '79.0.0',
756
- firefox: '67.0.0',
757
- ios: '13.0.0',
758
- node: '13.2.0',
759
- opera: '50.0.0',
760
- safari: '13.0.0'
753
+ chrome: '51.0.0',
754
+ edge: '15.0.0',
755
+ firefox: '54.0.0',
756
+ safari: '10.0.0',
757
+ opera: '38.0.0',
758
+ samsung: '5.0.0'
761
759
  },
762
760
  es2016: {
763
- chrome: '63.0.0',
764
- edge: '79.0.0',
765
- firefox: '67.0.0',
766
- ios: '13.0.0',
767
- node: '13.2.0',
768
- opera: '50.0.0',
769
- safari: '13.0.0'
761
+ chrome: '52.0.0',
762
+ edge: '15.0.0',
763
+ firefox: '54.0.0',
764
+ safari: '10.3.0',
765
+ opera: '39.0.0',
766
+ samsung: '6.2.0'
770
767
  },
771
768
  es2017: {
772
- chrome: '63.0.0',
773
- edge: '79.0.0',
774
- firefox: '67.0.0',
775
- ios: '13.0.0',
776
- node: '13.2.0',
777
- opera: '50.0.0',
778
- safari: '13.0.0'
769
+ chrome: '57.0.0',
770
+ edge: '15.0.0',
771
+ firefox: '54.0.0',
772
+ safari: '11.0.0',
773
+ opera: '44.0.0',
774
+ samsung: '6.2.0'
779
775
  },
780
776
  es2018: {
781
777
  chrome: '64.0.0',
782
778
  edge: '79.0.0',
783
779
  firefox: '78.0.0',
784
- ios: '16.4.0',
785
- node: '13.2.0',
780
+ safari: '16.4.0',
786
781
  opera: '51.0.0',
787
- safari: '16.4.0'
782
+ samsung: '8.2.0'
788
783
  },
789
784
  es2019: {
790
- chrome: '66.0.0',
785
+ chrome: '73.0.0',
791
786
  edge: '79.0.0',
792
787
  firefox: '78.0.0',
793
- ios: '16.4.0',
794
- node: '13.2.0',
795
- opera: '53.0.0',
796
- safari: '16.4.0'
788
+ safari: '17.0.0',
789
+ opera: '60.0.0',
790
+ samsung: '11.1.0'
797
791
  },
798
792
  es2020: {
799
- chrome: '91.0.0',
800
- edge: '91.0.0',
793
+ chrome: '80.0.0',
794
+ edge: '80.0.0',
801
795
  firefox: '80.0.0',
802
- ios: '16.4.0',
803
- node: '16.1.0',
804
- opera: '77.0.0',
805
- safari: '16.4.0'
796
+ safari: '17.0.0',
797
+ opera: '67.0.0',
798
+ samsung: '13.0.0'
806
799
  },
807
800
  es2021: {
808
- chrome: '91.0.0',
809
- edge: '91.0.0',
801
+ chrome: '85.0.0',
802
+ edge: '85.0.0',
810
803
  firefox: '80.0.0',
811
- ios: '16.4.0',
812
- node: '16.1.0',
813
- opera: '77.0.0',
814
- safari: '16.4.0'
804
+ safari: '17.0.0',
805
+ opera: '71.0.0',
806
+ samsung: '14.0.0'
815
807
  },
816
808
  es2022: {
817
- chrome: '91.0.0',
809
+ chrome: '94.0.0',
810
+ edge: '94.0.0',
818
811
  firefox: '93.0.0',
819
- ios: '16.4.0',
820
- node: '16.11.0',
821
- safari: '16.4.0'
812
+ safari: '17.0.0',
813
+ opera: '80.0.0',
814
+ samsung: '17.0.0'
822
815
  },
823
816
  es2023: {
824
- chrome: '91.0.0',
825
- firefox: '93.0.0',
826
- ios: '16.4.0',
827
- node: '16.11.0',
828
- safari: '16.4.0'
817
+ chrome: '110.0.0',
818
+ edge: '110.0.0',
819
+ firefox: '115.0.0',
820
+ safari: '17.0.0',
821
+ opera: '96.0.0',
822
+ samsung: '21.0.0'
829
823
  },
830
824
  es2024: calcEsnextBrowserslistByTarget,
831
825
  esnext: calcEsnextBrowserslistByTarget
@@ -1367,7 +1361,7 @@ function isJSConfig(configFileName) {
1367
1361
  async function loadTsconfig(root, tsconfigPath = 'tsconfig.json') {
1368
1362
  const tsconfigFileName = await find(join(root, tsconfigPath), {
1369
1363
  root,
1370
- configName: basename(tsconfigPath)
1364
+ configName: external_node_path_basename(tsconfigPath)
1371
1365
  });
1372
1366
  if (tsconfigFileName) {
1373
1367
  const { tsconfig } = await parse_parse(tsconfigFileName);
@@ -1387,10 +1381,15 @@ const resolveConfigPath = (root, customConfig)=>{
1387
1381
  }
1388
1382
  const configFilePath = findConfig(join(root, DEFAULT_CONFIG_NAME));
1389
1383
  if (configFilePath) return configFilePath;
1390
- throw new Error(`${DEFAULT_CONFIG_NAME} not found in ${root}`);
1391
1384
  };
1392
1385
  async function loadConfig({ cwd = process.cwd(), path, envMode, loader }) {
1393
1386
  const configFilePath = resolveConfigPath(cwd, path);
1387
+ if (!configFilePath) return {
1388
+ content: {
1389
+ lib: []
1390
+ },
1391
+ filePath: void 0
1392
+ };
1394
1393
  const { content } = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.loadConfig)({
1395
1394
  cwd: dirname(configFilePath),
1396
1395
  path: configFilePath,
@@ -1674,7 +1673,7 @@ async function createConstantRsbuildConfig() {
1674
1673
  }
1675
1674
  });
1676
1675
  }
1677
- const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson })=>{
1676
+ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson, enabledShims })=>{
1678
1677
  const jsParserOptions = {
1679
1678
  cjs: {
1680
1679
  requireResolve: false,
@@ -1683,7 +1682,10 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson })=>{
1683
1682
  },
1684
1683
  esm: {
1685
1684
  importMeta: false,
1686
- importDynamic: false
1685
+ importDynamic: false,
1686
+ commonjs: {
1687
+ exports: 'skipInEsm'
1688
+ }
1687
1689
  },
1688
1690
  others: {
1689
1691
  worker: false
@@ -1691,7 +1693,8 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson })=>{
1691
1693
  };
1692
1694
  const plugins = [
1693
1695
  new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.experiments.RslibPlugin({
1694
- interceptApiPlugin: true
1696
+ interceptApiPlugin: true,
1697
+ forceNodeShims: enabledShims.esm.__dirname || enabledShims.esm.__filename
1695
1698
  })
1696
1699
  ];
1697
1700
  switch(format){
@@ -2379,7 +2382,8 @@ async function composeLibRsbuildConfig(config, multiCompilerIndex, root, sharedP
2379
2382
  format,
2380
2383
  pkgJson: pkgJson,
2381
2384
  bundle,
2382
- umdName
2385
+ umdName,
2386
+ enabledShims
2383
2387
  });
2384
2388
  const externalHelpersConfig = composeExternalHelpersConfig(externalHelpers, pkgJson);
2385
2389
  const userExternalsConfig = composeExternalsConfig(format, config.output?.externals);
@@ -2421,6 +2425,9 @@ async function composeCreateRsbuildConfig(rslibConfig) {
2421
2425
  userConfig.source.entry = {};
2422
2426
  userConfig.output ??= {};
2423
2427
  delete userConfig.output.externals;
2428
+ if (userConfig.output.distPath && 'string' == typeof userConfig.output.distPath) userConfig.output.distPath = {
2429
+ root: userConfig.output.distPath
2430
+ };
2424
2431
  const config = {
2425
2432
  format: libConfig.format ?? 'esm',
2426
2433
  config: (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.mergeRsbuildConfig)(constantRsbuildConfig, libRsbuildConfig, omit(userConfig, {
@@ -3029,7 +3036,77 @@ const getEnvDir = (cwd, envDir)=>{
3029
3036
  if (envDir) return node_path.isAbsolute(envDir) ? envDir : node_path.resolve(cwd, envDir);
3030
3037
  return cwd;
3031
3038
  };
3032
- async function init(options) {
3039
+ const parseEntryOption = (entries)=>{
3040
+ if (!entries?.length) return;
3041
+ const entryList = [];
3042
+ for (const rawEntry of entries){
3043
+ const value = rawEntry?.trim();
3044
+ if (!value) continue;
3045
+ const equalIndex = value.indexOf('=');
3046
+ if (equalIndex > -1) {
3047
+ const name = value.slice(0, equalIndex).trim();
3048
+ const entryPath = value.slice(equalIndex + 1).trim();
3049
+ if (name && entryPath) {
3050
+ entryList.push({
3051
+ key: name,
3052
+ value: entryPath,
3053
+ explicit: true
3054
+ });
3055
+ continue;
3056
+ }
3057
+ }
3058
+ const basename = node_path.basename(value, node_path.extname(value));
3059
+ entryList.push({
3060
+ key: basename,
3061
+ value,
3062
+ explicit: false
3063
+ });
3064
+ }
3065
+ const keyCount = {};
3066
+ for (const { key, explicit } of entryList)if (!explicit) keyCount[key] = (keyCount[key] ?? 0) + 1;
3067
+ const keyIndex = {};
3068
+ const parsed = {};
3069
+ for (const { key, value, explicit } of entryList){
3070
+ const needsIndex = !explicit && (keyCount[key] ?? 0) > 1;
3071
+ const finalKey = needsIndex ? `${key}${keyIndex[key] ?? 0}` : key;
3072
+ if (needsIndex) keyIndex[key] = (keyIndex[key] ?? 0) + 1;
3073
+ parsed[finalKey] = value;
3074
+ }
3075
+ return Object.keys(parsed).length ? parsed : void 0;
3076
+ };
3077
+ const applyCliOptions = (config, options, root)=>{
3078
+ if (options.root) config.root = root;
3079
+ if (options.logLevel) config.logLevel = options.logLevel;
3080
+ for (const lib of config.lib){
3081
+ if (void 0 !== options.format) lib.format = options.format;
3082
+ if (void 0 !== options.bundle) lib.bundle = options.bundle;
3083
+ if (void 0 !== options.tsconfig) {
3084
+ lib.source ||= {};
3085
+ lib.source.tsconfigPath = options.tsconfig;
3086
+ }
3087
+ const entry = parseEntryOption(options.entry);
3088
+ if (void 0 !== entry) {
3089
+ lib.source ||= {};
3090
+ lib.source.entry = entry;
3091
+ }
3092
+ const syntax = options.syntax;
3093
+ if (void 0 !== syntax) lib.syntax = syntax;
3094
+ if (void 0 !== options.dts) lib.dts = options.dts;
3095
+ if (void 0 !== options.autoExtension) lib.autoExtension = options.autoExtension;
3096
+ if (void 0 !== options.autoExternal) lib.autoExternal = options.autoExternal;
3097
+ lib.output ??= {};
3098
+ if (void 0 !== options.target) lib.output.target = options.target;
3099
+ if (void 0 !== options.minify) lib.output.minify = options.minify;
3100
+ if (void 0 !== options.clean) lib.output.cleanDistPath = options.clean;
3101
+ const externals = options.externals?.filter(Boolean) ?? [];
3102
+ if (externals.length > 0) lib.output.externals = externals;
3103
+ if (options.distPath) lib.output.distPath = {
3104
+ ...'object' == typeof lib.output.distPath ? lib.output.distPath : {},
3105
+ root: options.distPath
3106
+ };
3107
+ }
3108
+ };
3109
+ async function initConfig(options) {
3033
3110
  const cwd = process.cwd();
3034
3111
  const root = options.root ? getAbsolutePath(cwd, options.root) : cwd;
3035
3112
  const envs = (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.loadEnv)({
@@ -3043,20 +3120,30 @@ async function init(options) {
3043
3120
  envMode: options.envMode,
3044
3121
  loader: options.configLoader
3045
3122
  });
3123
+ if (void 0 === configFilePath) {
3124
+ config.lib = [
3125
+ {}
3126
+ ];
3127
+ logger.debug('No config file found. Falling back to CLI options for the default library.');
3128
+ }
3046
3129
  config.source ||= {};
3047
3130
  config.source.define = {
3048
3131
  ...envs.publicVars,
3049
3132
  ...config.source.define
3050
3133
  };
3051
- if (options.root) config.root = root;
3052
- if (options.logLevel) config.logLevel = options.logLevel;
3134
+ applyCliOptions(config, options, root);
3135
+ logger.debug('Rslib config used to generate Rsbuild environments:');
3136
+ logger.debug(`\n${node_util.inspect(config, {
3137
+ depth: null,
3138
+ colors: true
3139
+ })}`);
3053
3140
  return {
3054
3141
  config,
3055
3142
  configFilePath,
3056
3143
  watchFiles: [
3057
3144
  configFilePath,
3058
3145
  ...envs.filePaths
3059
- ]
3146
+ ].filter(Boolean)
3060
3147
  };
3061
3148
  }
3062
3149
  async function inspect(config, options = {}) {
@@ -3126,15 +3213,25 @@ const applyCommonOptions = (cli)=>{
3126
3213
  function runCli() {
3127
3214
  const cli = dist('rslib');
3128
3215
  cli.help();
3129
- cli.version("0.15.0");
3216
+ cli.version("0.16.0");
3130
3217
  applyCommonOptions(cli);
3131
3218
  const buildCommand = cli.command('build', 'build the library for production');
3132
3219
  const inspectCommand = cli.command('inspect', 'inspect the Rsbuild / Rspack configs of Rslib projects');
3133
3220
  const mfDevCommand = cli.command('mf-dev', 'start Rsbuild dev server of Module Federation format');
3134
- buildCommand.option('-w, --watch', 'turn on watch mode, watch for changes and rebuild').action(async (options)=>{
3221
+ buildCommand.option('-w, --watch', 'turn on watch mode, watch for changes and rebuild').option('--entry <entry>', 'set entry file or pattern (repeatable)', {
3222
+ type: [
3223
+ String
3224
+ ],
3225
+ default: []
3226
+ }).option('--dist-path <dir>', 'set output directory').option('--bundle', 'enable bundle mode (use --no-bundle to disable)').option('--format <format>', 'specify the output format (esm | cjs | umd | mf | iife)').option('--syntax <syntax>', 'set build syntax target (repeatable)').option('--target <target>', 'set runtime target (web | node)').option('--dts', 'emit declaration files (use --no-dts to disable)').option('--externals <pkg>', 'add package to externals (repeatable)', {
3227
+ type: [
3228
+ String
3229
+ ],
3230
+ default: []
3231
+ }).option('--minify', 'minify output (use --no-minify to disable)').option('--clean', 'clean output directory before build (use --no-clean to disable)').option('--auto-extension', 'control automatic extension redirect (use --no-auto-extension to disable)').option('--auto-external', 'control automatic dependency externalization (use --no-auto-external to disable)').option('--tsconfig <path>', 'use specific tsconfig (relative to project root)').action(async (options)=>{
3135
3232
  try {
3136
3233
  const cliBuild = async ()=>{
3137
- const { config, watchFiles } = await init(options);
3234
+ const { config, watchFiles } = await initConfig(options);
3138
3235
  await build(config, options);
3139
3236
  if (options.watch) watchFilesForRestart(watchFiles, async ()=>{
3140
3237
  await cliBuild();
@@ -3152,7 +3249,7 @@ function runCli() {
3152
3249
  default: '.rsbuild'
3153
3250
  }).option('--verbose', 'show full function definitions in output').action(async (options)=>{
3154
3251
  try {
3155
- const { config } = await init(options);
3252
+ const { config } = await initConfig(options);
3156
3253
  await inspect(config, {
3157
3254
  lib: options.lib,
3158
3255
  mode: options.mode,
@@ -3168,7 +3265,7 @@ function runCli() {
3168
3265
  mfDevCommand.action(async (options)=>{
3169
3266
  try {
3170
3267
  const cliMfDev = async ()=>{
3171
- const { config, watchFiles } = await init(options);
3268
+ const { config, watchFiles } = await initConfig(options);
3172
3269
  await startMFDevServer(config, {
3173
3270
  lib: options.lib
3174
3271
  });
@@ -3209,8 +3306,8 @@ function prepareCli() {
3209
3306
  setupLogLevel();
3210
3307
  const { npm_execpath } = process.env;
3211
3308
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger.log();
3212
- logger.greet(` Rslib v0.15.0\n`);
3309
+ logger.greet(` Rslib v0.16.0\n`);
3213
3310
  }
3214
- const src_version = "0.15.0";
3311
+ const src_version = "0.16.0";
3215
3312
  var __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack;
3216
3313
  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,6 @@
1
1
  import type { LogLevel, RsbuildMode } from '@rsbuild/core';
2
2
  import type { ConfigLoader } from '../config';
3
+ import type { Format, Syntax } from '../types/config';
3
4
  export type CommonOptions = {
4
5
  root?: string;
5
6
  config?: string;
@@ -11,6 +12,19 @@ export type CommonOptions = {
11
12
  };
12
13
  export type BuildOptions = CommonOptions & {
13
14
  watch?: boolean;
15
+ format?: Format;
16
+ entry?: string[];
17
+ distPath?: string;
18
+ bundle?: boolean;
19
+ syntax?: Syntax;
20
+ target?: string;
21
+ dts?: boolean;
22
+ externals?: string[];
23
+ minify?: boolean;
24
+ clean?: boolean;
25
+ autoExtension?: boolean;
26
+ autoExternal?: boolean;
27
+ tsconfig?: string;
14
28
  };
15
29
  export type InspectOptions = CommonOptions & {
16
30
  mode?: RsbuildMode;
@@ -0,0 +1,9 @@
1
+ import type { RslibConfig } from '../types';
2
+ import type { BuildOptions, CommonOptions } from './commands';
3
+ export declare const parseEntryOption: (entries?: string[]) => Record<string, string> | undefined;
4
+ export declare const applyCliOptions: (config: RslibConfig, options: BuildOptions, root: string) => void;
5
+ export declare function initConfig(options: CommonOptions): Promise<{
6
+ config: RslibConfig;
7
+ configFilePath?: string;
8
+ watchFiles: string[];
9
+ }>;
@@ -16,7 +16,7 @@ export declare function loadConfig({ cwd, path, envMode, loader, }: {
16
16
  loader?: ConfigLoader;
17
17
  }): Promise<{
18
18
  content: RslibConfig;
19
- filePath: string;
19
+ filePath?: string;
20
20
  }>;
21
21
  export declare const composeAutoExternalConfig: (options: {
22
22
  bundle: boolean;
@@ -2,11 +2,8 @@ import type { EnvironmentConfig, Rspack } from '@rsbuild/core';
2
2
  import type { FixedEcmaVersions, LatestEcmaVersions, RsbuildConfigOutputTarget, Syntax } from '../types/config';
3
3
  export declare const LATEST_TARGET_VERSIONS: Record<NonNullable<RsbuildConfigOutputTarget>, string[]>;
4
4
  /**
5
- * The esX to browserslist mapping is transformed from esbuild:
6
- * https://github.com/evanw/esbuild/blob/main/internal/compat/js_table.go
7
- * It does not completely align with the browserslist query of Rsbuild now:
5
+ * The esX to browserslist mapping is transformed from
8
6
  * https://github.com/rspack-contrib/browserslist-to-es-version
9
- * TODO: align with Rsbuild, we may should align with SWC
10
7
  */
11
8
  export declare const ESX_TO_BROWSERSLIST: Record<FixedEcmaVersions, Record<string, string>> & Record<LatestEcmaVersions, (target: RsbuildConfigOutputTarget) => string[]>;
12
9
  export declare function transformSyntaxToRspackTarget(syntax: Syntax): Rspack.Configuration['target'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslib/core",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "The Rsbuild-based library development tool.",
5
5
  "homepage": "https://rslib.rs",
6
6
  "bugs": {
@@ -36,25 +36,25 @@
36
36
  "types.d.ts"
37
37
  ],
38
38
  "dependencies": {
39
- "@rsbuild/core": "~1.5.13",
40
- "rsbuild-plugin-dts": "0.15.0"
39
+ "@rsbuild/core": "1.6.0-beta.0",
40
+ "rsbuild-plugin-dts": "0.16.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@module-federation/rsbuild-plugin": "^0.19.1",
43
+ "@module-federation/rsbuild-plugin": "^0.20.0",
44
44
  "@types/fs-extra": "^11.0.4",
45
45
  "cac": "^6.7.14",
46
46
  "chokidar": "^4.0.3",
47
47
  "fs-extra": "^11.3.2",
48
- "memfs": "^4.47.0",
48
+ "memfs": "^4.49.0",
49
49
  "path-serializer": "0.5.1",
50
50
  "picocolors": "1.1.1",
51
51
  "prebundle": "1.4.2",
52
52
  "rsbuild-plugin-publint": "^0.3.3",
53
- "rslib": "npm:@rslib/core@0.14.0",
54
- "rslog": "^1.2.11",
53
+ "rslib": "npm:@rslib/core@0.15.1",
54
+ "rslog": "^1.3.0",
55
55
  "tinyglobby": "0.2.14",
56
56
  "tsconfck": "3.1.6",
57
- "typescript": "^5.9.2",
57
+ "typescript": "^5.9.3",
58
58
  "@rslib/tsconfig": "0.0.1"
59
59
  },
60
60
  "peerDependencies": {
@@ -1,7 +0,0 @@
1
- import type { RslibConfig } from '../types';
2
- import type { CommonOptions } from './commands';
3
- export declare function init(options: CommonOptions): Promise<{
4
- config: RslibConfig;
5
- configFilePath: string;
6
- watchFiles: string[];
7
- }>;