@rslib/core 0.17.0 → 0.17.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.
@@ -1,7 +1,7 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 187: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ 134: (__unused_webpack_module, exports, __nccwpck_require__) => {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.NodeFsHandler =
7
7
  exports.EVENTS =
@@ -803,7 +803,7 @@
803
803
  }
804
804
  exports.NodeFsHandler = NodeFsHandler;
805
805
  },
806
- 300: (__unused_webpack_module, exports, __nccwpck_require__) => {
806
+ 617: (__unused_webpack_module, exports, __nccwpck_require__) => {
807
807
  Object.defineProperty(exports, "__esModule", { value: true });
808
808
  exports.readdirpPromise =
809
809
  exports.readdirp =
@@ -1107,8 +1107,8 @@
1107
1107
  const promises_1 = __nccwpck_require__(943);
1108
1108
  const events_1 = __nccwpck_require__(434);
1109
1109
  const sysPath = __nccwpck_require__(928);
1110
- const readdirp_1 = __nccwpck_require__(300);
1111
- const handler_js_1 = __nccwpck_require__(187);
1110
+ const readdirp_1 = __nccwpck_require__(617);
1111
+ const handler_js_1 = __nccwpck_require__(134);
1112
1112
  const SLASH = "/";
1113
1113
  const SLASH_SLASH = "//";
1114
1114
  const ONE_DOT = ".";
@@ -1,7 +1,7 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
- /***/ 456:
4
+ /***/ 831:
5
5
  /***/ ((module) => {
6
6
 
7
7
  let p = process || {}, argv = p.argv || [], env = p.env || {}
@@ -125,7 +125,7 @@ module.exports.createColors = createColors
125
125
  /******/ // startup
126
126
  /******/ // Load entry module and return exports
127
127
  /******/ // This entry module is referenced by other modules so it can't be inlined
128
- /******/ var __webpack_exports__ = __nccwpck_require__(456);
128
+ /******/ var __webpack_exports__ = __nccwpck_require__(831);
129
129
  /******/ module.exports = __webpack_exports__;
130
130
  /******/
131
131
  /******/ })()
@@ -1,14 +1,14 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
- /***/ 925:
4
+ /***/ 676:
5
5
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
6
6
 
7
7
  "use strict";
8
8
 
9
9
 
10
- const pico = __nccwpck_require__(771);
11
- const utils = __nccwpck_require__(560);
10
+ const pico = __nccwpck_require__(582);
11
+ const utils = __nccwpck_require__(473);
12
12
 
13
13
  function picomatch(glob, options, returnState = false) {
14
14
  // default to os.platform()
@@ -26,7 +26,7 @@ module.exports = picomatch;
26
26
 
27
27
  /***/ }),
28
28
 
29
- /***/ 820:
29
+ /***/ 717:
30
30
  /***/ ((module) => {
31
31
 
32
32
  "use strict";
@@ -214,14 +214,14 @@ module.exports = {
214
214
 
215
215
  /***/ }),
216
216
 
217
- /***/ 26:
217
+ /***/ 339:
218
218
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
219
219
 
220
220
  "use strict";
221
221
 
222
222
 
223
- const constants = __nccwpck_require__(820);
224
- const utils = __nccwpck_require__(560);
223
+ const constants = __nccwpck_require__(717);
224
+ const utils = __nccwpck_require__(473);
225
225
 
226
226
  /**
227
227
  * Constants
@@ -1307,16 +1307,16 @@ module.exports = parse;
1307
1307
 
1308
1308
  /***/ }),
1309
1309
 
1310
- /***/ 771:
1310
+ /***/ 582:
1311
1311
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1312
1312
 
1313
1313
  "use strict";
1314
1314
 
1315
1315
 
1316
- const scan = __nccwpck_require__(712);
1317
- const parse = __nccwpck_require__(26);
1318
- const utils = __nccwpck_require__(560);
1319
- const constants = __nccwpck_require__(820);
1316
+ const scan = __nccwpck_require__(279);
1317
+ const parse = __nccwpck_require__(339);
1318
+ const utils = __nccwpck_require__(473);
1319
+ const constants = __nccwpck_require__(717);
1320
1320
  const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
1321
1321
 
1322
1322
  /**
@@ -1656,13 +1656,13 @@ module.exports = picomatch;
1656
1656
 
1657
1657
  /***/ }),
1658
1658
 
1659
- /***/ 712:
1659
+ /***/ 279:
1660
1660
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
1661
1661
 
1662
1662
  "use strict";
1663
1663
 
1664
1664
 
1665
- const utils = __nccwpck_require__(560);
1665
+ const utils = __nccwpck_require__(473);
1666
1666
  const {
1667
1667
  CHAR_ASTERISK, /* * */
1668
1668
  CHAR_AT, /* @ */
@@ -1679,7 +1679,7 @@ const {
1679
1679
  CHAR_RIGHT_CURLY_BRACE, /* } */
1680
1680
  CHAR_RIGHT_PARENTHESES, /* ) */
1681
1681
  CHAR_RIGHT_SQUARE_BRACKET /* ] */
1682
- } = __nccwpck_require__(820);
1682
+ } = __nccwpck_require__(717);
1683
1683
 
1684
1684
  const isPathSeparator = code => {
1685
1685
  return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
@@ -2055,7 +2055,7 @@ module.exports = scan;
2055
2055
 
2056
2056
  /***/ }),
2057
2057
 
2058
- /***/ 560:
2058
+ /***/ 473:
2059
2059
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
2060
2060
 
2061
2061
  "use strict";
@@ -2067,7 +2067,7 @@ const {
2067
2067
  REGEX_REMOVE_BACKSLASH,
2068
2068
  REGEX_SPECIAL_CHARS,
2069
2069
  REGEX_SPECIAL_CHARS_GLOBAL
2070
- } = __nccwpck_require__(820);
2070
+ } = __nccwpck_require__(717);
2071
2071
 
2072
2072
  exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
2073
2073
  exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
@@ -2151,7 +2151,7 @@ module.exports = require("path");
2151
2151
 
2152
2152
  /***/ }),
2153
2153
 
2154
- /***/ 399:
2154
+ /***/ 278:
2155
2155
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
2156
2156
 
2157
2157
  //#region rolldown:runtime
@@ -2614,8 +2614,8 @@ var APIBuilder = class {
2614
2614
  let pm = null;
2615
2615
  /* c8 ignore next 6 */
2616
2616
  try {
2617
- /*require.resolve*/(925);
2618
- pm = __nccwpck_require__(925);
2617
+ /*require.resolve*/(676);
2618
+ pm = __nccwpck_require__(676);
2619
2619
  } catch {}
2620
2620
  var Builder = class {
2621
2621
  globCache = {};
@@ -2811,8 +2811,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
2811
2811
 
2812
2812
  //#endregion
2813
2813
  const path = __toESM(__nccwpck_require__(928));
2814
- const fdir = __toESM(__nccwpck_require__(399));
2815
- const picomatch = __toESM(__nccwpck_require__(925));
2814
+ const fdir = __toESM(__nccwpck_require__(278));
2815
+ const picomatch = __toESM(__nccwpck_require__(676));
2816
2816
 
2817
2817
  //#region src/utils.ts
2818
2818
  const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
package/dist/index.js CHANGED
@@ -505,17 +505,18 @@ const pluginEsmRequireShim = ()=>({
505
505
  });
506
506
  }
507
507
  });
508
- const isDebug = ()=>{
508
+ const isDebugKey = (keys)=>{
509
509
  if (!process.env.DEBUG) return false;
510
510
  const values = process.env.DEBUG.toLocaleLowerCase().split(',');
511
- return [
511
+ return keys.some((key)=>values.includes(key));
512
+ };
513
+ const isDebug = ()=>isDebugKey([
512
514
  'rslib',
513
515
  'rsbuild',
514
516
  'rs*',
515
517
  'rstack',
516
518
  '*'
517
- ].some((key)=>values.includes(key));
518
- };
519
+ ]);
519
520
  if (isDebug()) logger.level = 'verbose';
520
521
  function getTime() {
521
522
  const now = new Date();
@@ -1704,7 +1705,9 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson, enabledS
1704
1705
  optimization: {
1705
1706
  concatenateModules: !experimentalEsmOutput,
1706
1707
  sideEffects: experimentalEsmOutput ? true : 'flag',
1707
- runtimeChunk: experimentalEsmOutput ? 'single' : void 0,
1708
+ runtimeChunk: experimentalEsmOutput ? {
1709
+ name: 'rslib-runtime'
1710
+ } : void 0,
1708
1711
  avoidEntryIife: true,
1709
1712
  splitChunks: {
1710
1713
  chunks: 'async'
@@ -2312,6 +2315,9 @@ const composeTargetConfig = (userTarget, format)=>{
2312
2315
  config: {
2313
2316
  tools: {
2314
2317
  rspack: {
2318
+ externalsPresets: {
2319
+ node: false
2320
+ },
2315
2321
  target: [
2316
2322
  'node'
2317
2323
  ]
@@ -2521,7 +2527,7 @@ async function build(config, options = {}) {
2521
2527
  const { environments } = await composeRsbuildEnvironments(config);
2522
2528
  const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
2523
2529
  callerName: 'rslib',
2524
- rsbuildConfig: {
2530
+ config: {
2525
2531
  mode: 'production',
2526
2532
  root: config.root,
2527
2533
  plugins: config.plugins,
@@ -3123,11 +3129,15 @@ async function initConfig(options) {
3123
3129
  ...config.source.define
3124
3130
  };
3125
3131
  applyCliOptions(config, options, root);
3126
- logger.debug('Rslib config used to generate Rsbuild environments:');
3127
- logger.debug(`\n${node_util.inspect(config, {
3128
- depth: null,
3129
- colors: true
3130
- })}`);
3132
+ if (isDebugKey([
3133
+ 'rslib'
3134
+ ])) {
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
+ })}`);
3140
+ }
3131
3141
  return {
3132
3142
  config,
3133
3143
  configFilePath,
@@ -3141,7 +3151,7 @@ async function inspect(config, options = {}) {
3141
3151
  const { environments } = await composeRsbuildEnvironments(config);
3142
3152
  const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
3143
3153
  callerName: 'rslib',
3144
- rsbuildConfig: {
3154
+ config: {
3145
3155
  mode: 'production',
3146
3156
  root: config.root,
3147
3157
  plugins: config.plugins,
@@ -3177,7 +3187,7 @@ async function initMFRsbuild(config, options = {}) {
3177
3187
  const selectedEnvironments = pruneEnvironments(environments, selectedEnvironmentIds);
3178
3188
  const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
3179
3189
  callerName: 'rslib',
3180
- rsbuildConfig: {
3190
+ config: {
3181
3191
  mode: 'development',
3182
3192
  root: config.root,
3183
3193
  plugins: config.plugins,
@@ -3203,10 +3213,10 @@ const applyCommonOptions = (cli)=>{
3203
3213
  };
3204
3214
  function runCli() {
3205
3215
  const cli = dist('rslib');
3206
- cli.help();
3207
- cli.version("0.17.0");
3216
+ cli.version("0.17.1");
3208
3217
  applyCommonOptions(cli);
3209
- const buildCommand = cli.command('build', 'build the library for production');
3218
+ const buildDescription = `build the library for production ${picocolors.dim('(default if no command is given)')}`;
3219
+ const buildCommand = cli.command('', buildDescription).alias('build');
3210
3220
  const inspectCommand = cli.command('inspect', 'inspect the Rsbuild / Rspack configs of Rslib projects');
3211
3221
  const mfDevCommand = cli.command('mf-dev', 'start Rsbuild dev server of Module Federation format');
3212
3222
  buildCommand.option('-w, --watch', 'turn on watch mode, watch for changes and rebuild').option('--entry <entry>', 'set entry file or pattern (repeatable)', {
@@ -3271,6 +3281,17 @@ function runCli() {
3271
3281
  process.exit(1);
3272
3282
  }
3273
3283
  });
3284
+ cli.help((sections)=>{
3285
+ sections.shift();
3286
+ for (const section of sections){
3287
+ if ('Usage' === section.title) section.body = section.body.replace('$ rslib', picocolors.yellow('$ rslib [command] [options]'));
3288
+ if ('Commands' === section.title) section.body = section.body.replace(` ${buildDescription}`, `build ${buildDescription}`);
3289
+ if (section.title?.startsWith('For more info')) {
3290
+ section.title = picocolors.dim(' For details on a sub-command, run');
3291
+ section.body = picocolors.dim(' $ rslib <command> -h');
3292
+ } else section.title = picocolors.cyan(section.title);
3293
+ }
3294
+ });
3274
3295
  cli.parse();
3275
3296
  }
3276
3297
  function initNodeEnv() {
@@ -3297,8 +3318,8 @@ function prepareCli() {
3297
3318
  setupLogLevel();
3298
3319
  const { npm_execpath } = process.env;
3299
3320
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger.log();
3300
- logger.greet(` Rslib v0.17.0\n`);
3321
+ logger.greet(` Rslib v0.17.1\n`);
3301
3322
  }
3302
- const src_version = "0.17.0";
3323
+ const src_version = "0.17.1";
3303
3324
  var __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack;
3304
3325
  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 };
@@ -31,4 +31,5 @@ export type InspectOptions = CommonOptions & {
31
31
  output?: string;
32
32
  verbose?: boolean;
33
33
  };
34
+ export type MfDevOptions = CommonOptions;
34
35
  export declare function runCli(): void;
@@ -7,5 +7,6 @@ export { composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, defi
7
7
  export type * from './types';
8
8
  export { logger } from './utils/logger';
9
9
  export declare const version: string;
10
+ export type * as Rsbuild from '@rsbuild/core';
10
11
  export * as rsbuild from '@rsbuild/core';
11
- export { type Rspack, rspack } from '@rsbuild/core';
12
+ export { type RsbuildPlugin, type Rspack, rspack } from '@rsbuild/core';
@@ -13,6 +13,7 @@
13
13
  * and important alerts that require attention.
14
14
  */
15
15
  import { type Logger, logger } from '../../compiled/rslog';
16
+ export declare const isDebugKey: (keys: string[]) => boolean;
16
17
  export declare const isDebug: () => boolean;
17
18
  export { logger };
18
19
  export type { Logger };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslib/core",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "The Rsbuild-based library development tool.",
5
5
  "homepage": "https://rslib.rs",
6
6
  "bugs": {
@@ -36,21 +36,21 @@
36
36
  "types.d.ts"
37
37
  ],
38
38
  "dependencies": {
39
- "@rsbuild/core": "~1.6.0",
40
- "rsbuild-plugin-dts": "0.17.0"
39
+ "@rsbuild/core": "~1.6.2",
40
+ "rsbuild-plugin-dts": "0.17.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@module-federation/rsbuild-plugin": "^0.21.1",
43
+ "@module-federation/rsbuild-plugin": "^0.21.2",
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.49.0",
48
+ "memfs": "^4.50.0",
49
49
  "path-serializer": "0.5.1",
50
50
  "picocolors": "1.1.1",
51
- "prebundle": "1.4.2",
51
+ "prebundle": "1.5.0",
52
52
  "rsbuild-plugin-publint": "^0.3.3",
53
- "rslib": "npm:@rslib/core@0.16.1",
53
+ "rslib": "npm:@rslib/core@0.17.0",
54
54
  "rslog": "^1.3.0",
55
55
  "tinyglobby": "0.2.14",
56
56
  "tsconfck": "3.1.6",