@rslib/core 0.17.0 → 0.17.2

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/121.js ADDED
@@ -0,0 +1,43 @@
1
+ const DEFAULT_CONFIG_NAME = 'rslib.config';
2
+ const DEFAULT_CONFIG_EXTENSIONS = [
3
+ '.js',
4
+ '.ts',
5
+ '.mjs',
6
+ '.mts',
7
+ '.cjs',
8
+ '.cts'
9
+ ];
10
+ const SWC_HELPERS = '@swc/helpers';
11
+ const SHEBANG_REGEX = /#!.*[\s\n\r]*$/;
12
+ const REACT_DIRECTIVE_REGEX = /^['"]use (client|server)['"](;?)[\s\n\r]*$/;
13
+ const DTS_EXTENSIONS = [
14
+ 'd.ts',
15
+ 'd.mts',
16
+ 'd.cts'
17
+ ];
18
+ const JS_EXTENSIONS = [
19
+ 'js',
20
+ 'mjs',
21
+ 'jsx',
22
+ '(?<!\\.d\\.)ts',
23
+ '(?<!\\.d\\.)mts',
24
+ '(?<!\\.d\\.)cts',
25
+ 'tsx',
26
+ 'cjs',
27
+ 'cjsx',
28
+ 'mjsx',
29
+ 'mtsx',
30
+ 'ctsx'
31
+ ];
32
+ const CSS_EXTENSIONS = [
33
+ 'css',
34
+ 'sass',
35
+ 'scss',
36
+ 'less',
37
+ 'styl',
38
+ 'stylus'
39
+ ];
40
+ const JS_EXTENSIONS_PATTERN = new RegExp(`\\.(${JS_EXTENSIONS.join('|')})$`);
41
+ const CSS_EXTENSIONS_PATTERN = new RegExp(`\\.(${CSS_EXTENSIONS.join('|')})$`);
42
+ const DTS_EXTENSIONS_PATTERN = new RegExp(`\\.(${DTS_EXTENSIONS.join('|')})$`);
43
+ export { CSS_EXTENSIONS_PATTERN, DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, DTS_EXTENSIONS_PATTERN, JS_EXTENSIONS_PATTERN, REACT_DIRECTIVE_REGEX, SHEBANG_REGEX, SWC_HELPERS };
package/dist/800.js ADDED
@@ -0,0 +1,52 @@
1
+ import node_path, { basename, dirname, extname, isAbsolute, join } from "node:path";
2
+ import { CSS_EXTENSIONS_PATTERN } from "./121.js";
3
+ function getUndoPath(filename, outputPathArg, enforceRelative) {
4
+ let depth = -1;
5
+ let append = '';
6
+ let outputPath = outputPathArg.replace(/[\\/]$/, '');
7
+ for (const part of filename.split(/[/\\]+/))if ('..' === part) if (depth > -1) depth--;
8
+ else {
9
+ const i = outputPath.lastIndexOf('/');
10
+ const j = outputPath.lastIndexOf('\\');
11
+ const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j);
12
+ if (pos < 0) return `${outputPath}/`;
13
+ append = `${outputPath.slice(pos + 1)}/${append}`;
14
+ outputPath = outputPath.slice(0, pos);
15
+ }
16
+ else if ('.' !== part) depth++;
17
+ return depth > 0 ? `${'../'.repeat(depth)}${append}` : enforceRelative ? `./${append}` : append;
18
+ }
19
+ function isCssFile(filepath) {
20
+ return CSS_EXTENSIONS_PATTERN.test(filepath);
21
+ }
22
+ const CSS_MODULE_REG = /\.module\.\w+$/i;
23
+ const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
24
+ function parsePathQueryFragment(str) {
25
+ const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
26
+ return {
27
+ path: match?.[1]?.replace(/\u200b(.)/g, '$1') || '',
28
+ query: match?.[2] ? match[2].replace(/\u200b(.)/g, '$1') : '',
29
+ fragment: match?.[3] || ''
30
+ };
31
+ }
32
+ function isCssModulesFile(filepath, auto) {
33
+ const filename = node_path.basename(filepath);
34
+ if (true === auto) return CSS_MODULE_REG.test(filename);
35
+ if (auto instanceof RegExp) return auto.test(filepath);
36
+ if ('function' == typeof auto) {
37
+ const { path, query, fragment } = parsePathQueryFragment(filepath);
38
+ return auto(path, query, fragment);
39
+ }
40
+ return false;
41
+ }
42
+ function isCssGlobalFile(filepath, auto) {
43
+ const isCss = isCssFile(filepath);
44
+ if (!isCss) return false;
45
+ const isCssModules = isCssModulesFile(filepath, auto);
46
+ return !isCssModules;
47
+ }
48
+ const BASE_URI = 'webpack://';
49
+ const AUTO_PUBLIC_PATH = '__mini_css_extract_plugin_public_path_auto__';
50
+ const ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`;
51
+ const SINGLE_DOT_PATH_SEGMENT = '__mini_css_extract_plugin_single_dot_path_segment__';
52
+ export { ABSOLUTE_PUBLIC_PATH, AUTO_PUBLIC_PATH, BASE_URI, SINGLE_DOT_PATH_SEGMENT, basename, dirname, extname, getUndoPath, isAbsolute, isCssFile, isCssGlobalFile, isCssModulesFile, join, node_path };
@@ -1,35 +1,4 @@
1
- const SHEBANG_REGEX = /#!.*[\s\n\r]*$/;
2
- const REACT_DIRECTIVE_REGEX = /^['"]use (client|server)['"](;?)[\s\n\r]*$/;
3
- const DTS_EXTENSIONS = [
4
- 'd.ts',
5
- 'd.mts',
6
- 'd.cts'
7
- ];
8
- const JS_EXTENSIONS = [
9
- 'js',
10
- 'mjs',
11
- 'jsx',
12
- '(?<!\\.d\\.)ts',
13
- '(?<!\\.d\\.)mts',
14
- '(?<!\\.d\\.)cts',
15
- 'tsx',
16
- 'cjs',
17
- 'cjsx',
18
- 'mjsx',
19
- 'mtsx',
20
- 'ctsx'
21
- ];
22
- const CSS_EXTENSIONS = [
23
- 'css',
24
- 'sass',
25
- 'scss',
26
- 'less',
27
- 'styl',
28
- 'stylus'
29
- ];
30
- new RegExp(`\\.(${JS_EXTENSIONS.join('|')})$`);
31
- new RegExp(`\\.(${CSS_EXTENSIONS.join('|')})$`);
32
- new RegExp(`\\.(${DTS_EXTENSIONS.join('|')})$`);
1
+ import { SHEBANG_REGEX, REACT_DIRECTIVE_REGEX } from "./121.js";
33
2
  function splitFromFirstLine(text) {
34
3
  const match = text.match(/(\r\n|\n)/);
35
4
  if (!match) return [
@@ -50,4 +19,4 @@ const entryModuleLoader_loader = function(source) {
50
19
  return result;
51
20
  };
52
21
  const entryModuleLoader = entryModuleLoader_loader;
53
- export { entryModuleLoader as default };
22
+ export default entryModuleLoader;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
1
2
  import node_fs, { chmodSync, promises } from "node:fs";
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";
@@ -8,94 +8,8 @@ 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
10
  import node_util from "node:util";
11
- import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
12
- const DEFAULT_CONFIG_NAME = 'rslib.config';
13
- const DEFAULT_CONFIG_EXTENSIONS = [
14
- '.js',
15
- '.ts',
16
- '.mjs',
17
- '.mts',
18
- '.cjs',
19
- '.cts'
20
- ];
21
- const SWC_HELPERS = '@swc/helpers';
22
- const SHEBANG_REGEX = /#!.*[\s\n\r]*$/;
23
- const REACT_DIRECTIVE_REGEX = /^['"]use (client|server)['"](;?)[\s\n\r]*$/;
24
- const DTS_EXTENSIONS = [
25
- 'd.ts',
26
- 'd.mts',
27
- 'd.cts'
28
- ];
29
- const JS_EXTENSIONS = [
30
- 'js',
31
- 'mjs',
32
- 'jsx',
33
- '(?<!\\.d\\.)ts',
34
- '(?<!\\.d\\.)mts',
35
- '(?<!\\.d\\.)cts',
36
- 'tsx',
37
- 'cjs',
38
- 'cjsx',
39
- 'mjsx',
40
- 'mtsx',
41
- 'ctsx'
42
- ];
43
- const CSS_EXTENSIONS = [
44
- 'css',
45
- 'sass',
46
- 'scss',
47
- 'less',
48
- 'styl',
49
- 'stylus'
50
- ];
51
- const JS_EXTENSIONS_PATTERN = new RegExp(`\\.(${JS_EXTENSIONS.join('|')})$`);
52
- const CSS_EXTENSIONS_PATTERN = new RegExp(`\\.(${CSS_EXTENSIONS.join('|')})$`);
53
- const DTS_EXTENSIONS_PATTERN = new RegExp(`\\.(${DTS_EXTENSIONS.join('|')})$`);
54
- function getUndoPath(filename, outputPathArg, enforceRelative) {
55
- let depth = -1;
56
- let append = '';
57
- let outputPath = outputPathArg.replace(/[\\/]$/, '');
58
- for (const part of filename.split(/[/\\]+/))if ('..' === part) if (depth > -1) depth--;
59
- else {
60
- const i = outputPath.lastIndexOf('/');
61
- const j = outputPath.lastIndexOf('\\');
62
- const pos = i < 0 ? j : j < 0 ? i : Math.max(i, j);
63
- if (pos < 0) return `${outputPath}/`;
64
- append = `${outputPath.slice(pos + 1)}/${append}`;
65
- outputPath = outputPath.slice(0, pos);
66
- }
67
- else if ('.' !== part) depth++;
68
- return depth > 0 ? `${'../'.repeat(depth)}${append}` : enforceRelative ? `./${append}` : append;
69
- }
70
- function isCssFile(filepath) {
71
- return CSS_EXTENSIONS_PATTERN.test(filepath);
72
- }
73
- const CSS_MODULE_REG = /\.module\.\w+$/i;
74
- const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
75
- function parsePathQueryFragment(str) {
76
- const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
77
- return {
78
- path: match?.[1]?.replace(/\u200b(.)/g, '$1') || '',
79
- query: match?.[2] ? match[2].replace(/\u200b(.)/g, '$1') : '',
80
- fragment: match?.[3] || ''
81
- };
82
- }
83
- function isCssModulesFile(filepath, auto) {
84
- const filename = node_path.basename(filepath);
85
- if (true === auto) return CSS_MODULE_REG.test(filename);
86
- if (auto instanceof RegExp) return auto.test(filepath);
87
- if ('function' == typeof auto) {
88
- const { path, query, fragment } = parsePathQueryFragment(filepath);
89
- return auto(path, query, fragment);
90
- }
91
- return false;
92
- }
93
- function isCssGlobalFile(filepath, auto) {
94
- const isCss = isCssFile(filepath);
95
- if (!isCss) return false;
96
- const isCssModules = isCssModulesFile(filepath, auto);
97
- return !isCssModules;
98
- }
11
+ import { basename as external_node_path_basename, node_path, extname, getUndoPath, ABSOLUTE_PUBLIC_PATH, isCssFile, dirname, AUTO_PUBLIC_PATH, join, isAbsolute, SINGLE_DOT_PATH_SEGMENT, isCssGlobalFile, BASE_URI, isCssModulesFile } from "./800.js";
12
+ import { DEFAULT_CONFIG_NAME, SHEBANG_REGEX, DTS_EXTENSIONS_PATTERN, SWC_HELPERS, CSS_EXTENSIONS_PATTERN, JS_EXTENSIONS_PATTERN, DEFAULT_CONFIG_EXTENSIONS, REACT_DIRECTIVE_REGEX } from "./121.js";
99
13
  const LibSvgrPatchPlugin_pluginName = 'LIB_SVGR_PATCH_PLUGIN';
100
14
  const PUBLIC_PATH_PLACEHOLDER = '__RSLIB_SVGR_AUTO_PUBLIC_PATH__';
101
15
  class LibSvgrPatchPlugin {
@@ -238,10 +152,6 @@ const composeAssetConfig = (bundle, format)=>{
238
152
  }
239
153
  return {};
240
154
  };
241
- const BASE_URI = 'webpack://';
242
- const AUTO_PUBLIC_PATH = '__mini_css_extract_plugin_public_path_auto__';
243
- const ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`;
244
- const SINGLE_DOT_PATH_SEGMENT = '__mini_css_extract_plugin_single_dot_path_segment__';
245
155
  const LibCssExtractPlugin_pluginName = 'LIB_CSS_EXTRACT_PLUGIN';
246
156
  class LibCssExtractPlugin {
247
157
  name = LibCssExtractPlugin_pluginName;
@@ -505,17 +415,18 @@ const pluginEsmRequireShim = ()=>({
505
415
  });
506
416
  }
507
417
  });
508
- const isDebug = ()=>{
418
+ const isDebugKey = (keys)=>{
509
419
  if (!process.env.DEBUG) return false;
510
420
  const values = process.env.DEBUG.toLocaleLowerCase().split(',');
511
- return [
421
+ return keys.some((key)=>values.includes(key));
422
+ };
423
+ const isDebug = ()=>isDebugKey([
512
424
  'rslib',
513
425
  'rsbuild',
514
426
  'rs*',
515
427
  'rstack',
516
428
  '*'
517
- ].some((key)=>values.includes(key));
518
- };
429
+ ]);
519
430
  if (isDebug()) logger.level = 'verbose';
520
431
  function getTime() {
521
432
  const now = new Date();
@@ -861,13 +772,13 @@ const TS_EXTENSIONS = [
861
772
  '.mts',
862
773
  '.cts'
863
774
  ];
864
- const util_JS_EXTENSIONS = [
775
+ const JS_EXTENSIONS = [
865
776
  '.js',
866
777
  '.jsx',
867
778
  '.mjs',
868
779
  '.cjs'
869
780
  ];
870
- const TSJS_EXTENSIONS = TS_EXTENSIONS.concat(util_JS_EXTENSIONS);
781
+ const TSJS_EXTENSIONS = TS_EXTENSIONS.concat(JS_EXTENSIONS);
871
782
  const TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext)=>ext.substring(1)).join('|')})`;
872
783
  const TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext)=>ext.substring(1)).join('|')})`;
873
784
  const IS_POSIX = node_path.posix.sep === node_path.sep;
@@ -1651,7 +1562,6 @@ async function createConstantRsbuildConfig() {
1651
1562
  },
1652
1563
  output: {
1653
1564
  target: 'node',
1654
- filenameHash: false,
1655
1565
  distPath: {
1656
1566
  js: './',
1657
1567
  jsAsync: './',
@@ -1690,6 +1600,9 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson, enabledS
1690
1600
  switch(format){
1691
1601
  case 'esm':
1692
1602
  return {
1603
+ output: {
1604
+ filenameHash: false
1605
+ },
1693
1606
  tools: {
1694
1607
  rspack: {
1695
1608
  module: {
@@ -1704,7 +1617,9 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson, enabledS
1704
1617
  optimization: {
1705
1618
  concatenateModules: !experimentalEsmOutput,
1706
1619
  sideEffects: experimentalEsmOutput ? true : 'flag',
1707
- runtimeChunk: experimentalEsmOutput ? 'single' : void 0,
1620
+ runtimeChunk: experimentalEsmOutput ? {
1621
+ name: 'rslib-runtime'
1622
+ } : void 0,
1708
1623
  avoidEntryIife: true,
1709
1624
  splitChunks: {
1710
1625
  chunks: 'async'
@@ -1728,6 +1643,9 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson, enabledS
1728
1643
  };
1729
1644
  case 'cjs':
1730
1645
  return {
1646
+ output: {
1647
+ filenameHash: false
1648
+ },
1731
1649
  tools: {
1732
1650
  rspack: {
1733
1651
  module: {
@@ -1761,6 +1679,9 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson, enabledS
1761
1679
  {
1762
1680
  if (!bundle) throw new Error('When using "umd" format, "bundle" must be set to "true". Since the default value for "bundle" is "true", so you can either explicitly set it to "true" or remove the field entirely.');
1763
1681
  const config = {
1682
+ output: {
1683
+ filenameHash: false
1684
+ },
1764
1685
  tools: {
1765
1686
  rspack: {
1766
1687
  module: {
@@ -1796,6 +1717,7 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson, enabledS
1796
1717
  if (!bundle) throw new Error('When using "iife" format, "bundle" must be set to "true". Since the default value for "bundle" is "true", so you can either explicitly set it to "true" or remove the field entirely.');
1797
1718
  const config = {
1798
1719
  output: {
1720
+ filenameHash: false,
1799
1721
  minify: {
1800
1722
  jsOptions: {
1801
1723
  minimizerOptions: {
@@ -2054,7 +1976,7 @@ const composeOutputFilenameConfig = (config, format, autoExtension, multiCompile
2054
1976
  }
2055
1977
  });
2056
1978
  return {
2057
- config: finalConfig,
1979
+ config: 'mf' === format ? {} : finalConfig,
2058
1980
  jsExtension: finalJsExtension,
2059
1981
  dtsExtension
2060
1982
  };
@@ -2312,6 +2234,9 @@ const composeTargetConfig = (userTarget, format)=>{
2312
2234
  config: {
2313
2235
  tools: {
2314
2236
  rspack: {
2237
+ externalsPresets: {
2238
+ node: false
2239
+ },
2315
2240
  target: [
2316
2241
  'node'
2317
2242
  ]
@@ -2521,7 +2446,7 @@ async function build(config, options = {}) {
2521
2446
  const { environments } = await composeRsbuildEnvironments(config);
2522
2447
  const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
2523
2448
  callerName: 'rslib',
2524
- rsbuildConfig: {
2449
+ config: {
2525
2450
  mode: 'production',
2526
2451
  root: config.root,
2527
2452
  plugins: config.plugins,
@@ -3123,11 +3048,15 @@ async function initConfig(options) {
3123
3048
  ...config.source.define
3124
3049
  };
3125
3050
  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
- })}`);
3051
+ if (isDebugKey([
3052
+ 'rslib'
3053
+ ])) {
3054
+ logger.debug('Rslib config used to generate Rsbuild environments:');
3055
+ logger.debug(`\n${node_util.inspect(config, {
3056
+ depth: null,
3057
+ colors: true
3058
+ })}`);
3059
+ }
3131
3060
  return {
3132
3061
  config,
3133
3062
  configFilePath,
@@ -3141,7 +3070,7 @@ async function inspect(config, options = {}) {
3141
3070
  const { environments } = await composeRsbuildEnvironments(config);
3142
3071
  const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
3143
3072
  callerName: 'rslib',
3144
- rsbuildConfig: {
3073
+ config: {
3145
3074
  mode: 'production',
3146
3075
  root: config.root,
3147
3076
  plugins: config.plugins,
@@ -3177,7 +3106,7 @@ async function initMFRsbuild(config, options = {}) {
3177
3106
  const selectedEnvironments = pruneEnvironments(environments, selectedEnvironmentIds);
3178
3107
  const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
3179
3108
  callerName: 'rslib',
3180
- rsbuildConfig: {
3109
+ config: {
3181
3110
  mode: 'development',
3182
3111
  root: config.root,
3183
3112
  plugins: config.plugins,
@@ -3203,10 +3132,10 @@ const applyCommonOptions = (cli)=>{
3203
3132
  };
3204
3133
  function runCli() {
3205
3134
  const cli = dist('rslib');
3206
- cli.help();
3207
- cli.version("0.17.0");
3135
+ cli.version("0.17.2");
3208
3136
  applyCommonOptions(cli);
3209
- const buildCommand = cli.command('build', 'build the library for production');
3137
+ const buildDescription = `build the library for production ${picocolors.dim('(default if no command is given)')}`;
3138
+ const buildCommand = cli.command('', buildDescription).alias('build');
3210
3139
  const inspectCommand = cli.command('inspect', 'inspect the Rsbuild / Rspack configs of Rslib projects');
3211
3140
  const mfDevCommand = cli.command('mf-dev', 'start Rsbuild dev server of Module Federation format');
3212
3141
  buildCommand.option('-w, --watch', 'turn on watch mode, watch for changes and rebuild').option('--entry <entry>', 'set entry file or pattern (repeatable)', {
@@ -3223,10 +3152,21 @@ function runCli() {
3223
3152
  try {
3224
3153
  const cliBuild = async ()=>{
3225
3154
  const { config, watchFiles } = await initConfig(options);
3155
+ if (options.watch) {
3156
+ config.plugins = config.plugins || [];
3157
+ config.plugins.push({
3158
+ name: 'rslib:on-after-build',
3159
+ setup (api) {
3160
+ api.onAfterBuild(({ isFirstCompile })=>{
3161
+ if (isFirstCompile) logger.success('build complete, watching for changes...');
3162
+ });
3163
+ }
3164
+ });
3165
+ watchFilesForRestart(watchFiles, async ()=>{
3166
+ await cliBuild();
3167
+ });
3168
+ }
3226
3169
  await build(config, options);
3227
- if (options.watch) watchFilesForRestart(watchFiles, async ()=>{
3228
- await cliBuild();
3229
- });
3230
3170
  };
3231
3171
  await cliBuild();
3232
3172
  } catch (err) {
@@ -3271,6 +3211,17 @@ function runCli() {
3271
3211
  process.exit(1);
3272
3212
  }
3273
3213
  });
3214
+ cli.help((sections)=>{
3215
+ sections.shift();
3216
+ for (const section of sections){
3217
+ if ('Usage' === section.title) section.body = section.body.replace('$ rslib', picocolors.yellow('$ rslib [command] [options]'));
3218
+ if ('Commands' === section.title) section.body = section.body.replace(` ${buildDescription}`, `build ${buildDescription}`);
3219
+ if (section.title?.startsWith('For more info')) {
3220
+ section.title = picocolors.dim(' For details on a sub-command, run');
3221
+ section.body = picocolors.dim(' $ rslib <command> -h');
3222
+ } else section.title = picocolors.cyan(section.title);
3223
+ }
3224
+ });
3274
3225
  cli.parse();
3275
3226
  }
3276
3227
  function initNodeEnv() {
@@ -3297,8 +3248,10 @@ function prepareCli() {
3297
3248
  setupLogLevel();
3298
3249
  const { npm_execpath } = process.env;
3299
3250
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger.log();
3300
- logger.greet(` Rslib v0.17.0\n`);
3251
+ logger.greet(` Rslib v0.17.2\n`);
3301
3252
  }
3302
- const src_version = "0.17.0";
3303
- var __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack;
3304
- 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 };
3253
+ const src_version = "0.17.2";
3254
+ export * as rsbuild from "@rsbuild/core";
3255
+ export { logger } from "../compiled/rslog/index.js";
3256
+ export { rspack } from "@rsbuild/core";
3257
+ export { build, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, defineConfig, inspect, loadConfig, prepareCli, runCli, src_version as version, startMFDevServer };
@@ -1,58 +1,4 @@
1
- import node_path, { extname } from "node:path";
2
- const BASE_URI = 'webpack://';
3
- const AUTO_PUBLIC_PATH = '__mini_css_extract_plugin_public_path_auto__';
4
- const ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`;
5
- const SINGLE_DOT_PATH_SEGMENT = '__mini_css_extract_plugin_single_dot_path_segment__';
6
- const DTS_EXTENSIONS = [
7
- 'd.ts',
8
- 'd.mts',
9
- 'd.cts'
10
- ];
11
- const JS_EXTENSIONS = [
12
- 'js',
13
- 'mjs',
14
- 'jsx',
15
- '(?<!\\.d\\.)ts',
16
- '(?<!\\.d\\.)mts',
17
- '(?<!\\.d\\.)cts',
18
- 'tsx',
19
- 'cjs',
20
- 'cjsx',
21
- 'mjsx',
22
- 'mtsx',
23
- 'ctsx'
24
- ];
25
- const CSS_EXTENSIONS = [
26
- 'css',
27
- 'sass',
28
- 'scss',
29
- 'less',
30
- 'styl',
31
- 'stylus'
32
- ];
33
- new RegExp(`\\.(${JS_EXTENSIONS.join('|')})$`);
34
- new RegExp(`\\.(${CSS_EXTENSIONS.join('|')})$`);
35
- new RegExp(`\\.(${DTS_EXTENSIONS.join('|')})$`);
36
- const CSS_MODULE_REG = /\.module\.\w+$/i;
37
- const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
38
- function parsePathQueryFragment(str) {
39
- const match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
40
- return {
41
- path: match?.[1]?.replace(/\u200b(.)/g, '$1') || '',
42
- query: match?.[2] ? match[2].replace(/\u200b(.)/g, '$1') : '',
43
- fragment: match?.[3] || ''
44
- };
45
- }
46
- function isCssModulesFile(filepath, auto) {
47
- const filename = node_path.basename(filepath);
48
- if (true === auto) return CSS_MODULE_REG.test(filename);
49
- if (auto instanceof RegExp) return auto.test(filepath);
50
- if ('function' == typeof auto) {
51
- const { path, query, fragment } = parsePathQueryFragment(filepath);
52
- return auto(path, query, fragment);
53
- }
54
- return false;
55
- }
1
+ import { isCssModulesFile, node_path, extname, ABSOLUTE_PUBLIC_PATH, SINGLE_DOT_PATH_SEGMENT, BASE_URI, AUTO_PUBLIC_PATH } from "./800.js";
56
2
  const LOADER_NAME = 'LIB_CSS_EXTRACT_LOADER';
57
3
  function stringifyLocal(value) {
58
4
  return 'function' == typeof value ? value.toString() : JSON.stringify(value);
@@ -190,4 +136,5 @@ const pitch = function(request, _, _data) {
190
136
  });
191
137
  };
192
138
  const libCssExtractLoader = libCssExtractLoader_loader;
193
- export { libCssExtractLoader as default, pitch };
139
+ export default libCssExtractLoader;
140
+ export { pitch };
@@ -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.2",
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.6",
40
+ "rsbuild-plugin-dts": "0.17.2"
41
41
  },
42
42
  "devDependencies": {
43
- "@module-federation/rsbuild-plugin": "^0.21.1",
43
+ "@module-federation/rsbuild-plugin": "^0.21.3",
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.1",
54
54
  "rslog": "^1.3.0",
55
55
  "tinyglobby": "0.2.14",
56
56
  "tsconfck": "3.1.6",