@rslib/core 0.3.1 → 0.3.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
- 457: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ 187: (__unused_webpack_module, exports, __nccwpck_require__) => {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.NodeFsHandler =
7
7
  exports.EVENTS =
@@ -16,10 +16,10 @@
16
16
  exports.STR_END =
17
17
  exports.STR_DATA =
18
18
  void 0;
19
- const fs_1 = __nccwpck_require__(147);
20
- const promises_1 = __nccwpck_require__(292);
21
- const sysPath = __nccwpck_require__(17);
22
- const os_1 = __nccwpck_require__(37);
19
+ const fs_1 = __nccwpck_require__(896);
20
+ const promises_1 = __nccwpck_require__(943);
21
+ const sysPath = __nccwpck_require__(928);
22
+ const os_1 = __nccwpck_require__(857);
23
23
  exports.STR_DATA = "data";
24
24
  exports.STR_END = "end";
25
25
  exports.STR_CLOSE = "close";
@@ -803,15 +803,15 @@
803
803
  }
804
804
  exports.NodeFsHandler = NodeFsHandler;
805
805
  },
806
- 9: (__unused_webpack_module, exports, __nccwpck_require__) => {
806
+ 300: (__unused_webpack_module, exports, __nccwpck_require__) => {
807
807
  Object.defineProperty(exports, "__esModule", { value: true });
808
808
  exports.readdirpPromise =
809
809
  exports.readdirp =
810
810
  exports.ReaddirpStream =
811
811
  void 0;
812
- const promises_1 = __nccwpck_require__(292);
813
- const stream_1 = __nccwpck_require__(781);
814
- const path_1 = __nccwpck_require__(17);
812
+ const promises_1 = __nccwpck_require__(943);
813
+ const stream_1 = __nccwpck_require__(203);
814
+ const path_1 = __nccwpck_require__(928);
815
815
  function defaultOptions() {
816
816
  return {
817
817
  root: ".",
@@ -1055,22 +1055,22 @@
1055
1055
  exports.readdirpPromise = readdirpPromise;
1056
1056
  exports["default"] = exports.readdirp;
1057
1057
  },
1058
- 361: (module) => {
1058
+ 434: (module) => {
1059
1059
  module.exports = require("events");
1060
1060
  },
1061
- 147: (module) => {
1061
+ 896: (module) => {
1062
1062
  module.exports = require("fs");
1063
1063
  },
1064
- 292: (module) => {
1064
+ 943: (module) => {
1065
1065
  module.exports = require("fs/promises");
1066
1066
  },
1067
- 37: (module) => {
1067
+ 857: (module) => {
1068
1068
  module.exports = require("os");
1069
1069
  },
1070
- 17: (module) => {
1070
+ 928: (module) => {
1071
1071
  module.exports = require("path");
1072
1072
  },
1073
- 781: (module) => {
1073
+ 203: (module) => {
1074
1074
  module.exports = require("stream");
1075
1075
  },
1076
1076
  };
@@ -1103,12 +1103,12 @@
1103
1103
  exports.FSWatcher = exports.WatchHelper = void 0;
1104
1104
  exports.watch = watch;
1105
1105
  /*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */ const fs_1 =
1106
- __nccwpck_require__(147);
1107
- const promises_1 = __nccwpck_require__(292);
1108
- const events_1 = __nccwpck_require__(361);
1109
- const sysPath = __nccwpck_require__(17);
1110
- const readdirp_1 = __nccwpck_require__(9);
1111
- const handler_js_1 = __nccwpck_require__(457);
1106
+ __nccwpck_require__(896);
1107
+ const promises_1 = __nccwpck_require__(943);
1108
+ const events_1 = __nccwpck_require__(434);
1109
+ const sysPath = __nccwpck_require__(928);
1110
+ const readdirp_1 = __nccwpck_require__(300);
1111
+ const handler_js_1 = __nccwpck_require__(187);
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
- /***/ 718:
4
+ /***/ 421:
5
5
  /***/ ((module) => {
6
6
 
7
7
  "use strict";
@@ -9,7 +9,7 @@ module.exports = require("node:child_process");
9
9
 
10
10
  /***/ }),
11
11
 
12
- /***/ 673:
12
+ /***/ 474:
13
13
  /***/ ((module) => {
14
14
 
15
15
  "use strict";
@@ -17,7 +17,7 @@ module.exports = require("node:events");
17
17
 
18
18
  /***/ }),
19
19
 
20
- /***/ 561:
20
+ /***/ 24:
21
21
  /***/ ((module) => {
22
22
 
23
23
  "use strict";
@@ -25,7 +25,7 @@ module.exports = require("node:fs");
25
25
 
26
26
  /***/ }),
27
27
 
28
- /***/ 411:
28
+ /***/ 760:
29
29
  /***/ ((module) => {
30
30
 
31
31
  "use strict";
@@ -33,7 +33,7 @@ module.exports = require("node:path");
33
33
 
34
34
  /***/ }),
35
35
 
36
- /***/ 742:
36
+ /***/ 708:
37
37
  /***/ ((module) => {
38
38
 
39
39
  "use strict";
@@ -41,10 +41,10 @@ module.exports = require("node:process");
41
41
 
42
42
  /***/ }),
43
43
 
44
- /***/ 429:
44
+ /***/ 710:
45
45
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
46
46
 
47
- const { InvalidArgumentError } = __nccwpck_require__(848);
47
+ const { InvalidArgumentError } = __nccwpck_require__(659);
48
48
 
49
49
  class Argument {
50
50
  /**
@@ -197,20 +197,20 @@ exports.humanReadableArgName = humanReadableArgName;
197
197
 
198
198
  /***/ }),
199
199
 
200
- /***/ 745:
200
+ /***/ 672:
201
201
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
202
202
 
203
- const EventEmitter = (__nccwpck_require__(673).EventEmitter);
204
- const childProcess = __nccwpck_require__(718);
205
- const path = __nccwpck_require__(411);
206
- const fs = __nccwpck_require__(561);
207
- const process = __nccwpck_require__(742);
203
+ const EventEmitter = (__nccwpck_require__(474).EventEmitter);
204
+ const childProcess = __nccwpck_require__(421);
205
+ const path = __nccwpck_require__(760);
206
+ const fs = __nccwpck_require__(24);
207
+ const process = __nccwpck_require__(708);
208
208
 
209
- const { Argument, humanReadableArgName } = __nccwpck_require__(429);
210
- const { CommanderError } = __nccwpck_require__(848);
211
- const { Help, stripColor } = __nccwpck_require__(613);
212
- const { Option, DualOptions } = __nccwpck_require__(234);
213
- const { suggestSimilar } = __nccwpck_require__(824);
209
+ const { Argument, humanReadableArgName } = __nccwpck_require__(710);
210
+ const { CommanderError } = __nccwpck_require__(659);
211
+ const { Help, stripColor } = __nccwpck_require__(254);
212
+ const { Option, DualOptions } = __nccwpck_require__(388);
213
+ const { suggestSimilar } = __nccwpck_require__(93);
214
214
 
215
215
  class Command extends EventEmitter {
216
216
  /**
@@ -2866,7 +2866,7 @@ exports.useColor = useColor; // exporting for tests
2866
2866
 
2867
2867
  /***/ }),
2868
2868
 
2869
- /***/ 848:
2869
+ /***/ 659:
2870
2870
  /***/ ((__unused_webpack_module, exports) => {
2871
2871
 
2872
2872
  /**
@@ -2912,10 +2912,10 @@ exports.InvalidArgumentError = InvalidArgumentError;
2912
2912
 
2913
2913
  /***/ }),
2914
2914
 
2915
- /***/ 613:
2915
+ /***/ 254:
2916
2916
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
2917
2917
 
2918
- const { humanReadableArgName } = __nccwpck_require__(429);
2918
+ const { humanReadableArgName } = __nccwpck_require__(710);
2919
2919
 
2920
2920
  /**
2921
2921
  * TypeScript import types for JSDoc, used by Visual Studio Code IntelliSense and `npm run typescript-checkJS`
@@ -3628,10 +3628,10 @@ exports.stripColor = stripColor;
3628
3628
 
3629
3629
  /***/ }),
3630
3630
 
3631
- /***/ 234:
3631
+ /***/ 388:
3632
3632
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
3633
3633
 
3634
- const { InvalidArgumentError } = __nccwpck_require__(848);
3634
+ const { InvalidArgumentError } = __nccwpck_require__(659);
3635
3635
 
3636
3636
  class Option {
3637
3637
  /**
@@ -3983,7 +3983,7 @@ exports.DualOptions = DualOptions;
3983
3983
 
3984
3984
  /***/ }),
3985
3985
 
3986
- /***/ 824:
3986
+ /***/ 93:
3987
3987
  /***/ ((__unused_webpack_module, exports) => {
3988
3988
 
3989
3989
  const maxDistance = 3;
@@ -4130,14 +4130,14 @@ exports.suggestSimilar = suggestSimilar;
4130
4130
  /******/
4131
4131
  /************************************************************************/
4132
4132
  var __webpack_exports__ = {};
4133
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
4133
+ // This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
4134
4134
  (() => {
4135
4135
  var exports = __webpack_exports__;
4136
- const { Argument } = __nccwpck_require__(429);
4137
- const { Command } = __nccwpck_require__(745);
4138
- const { CommanderError, InvalidArgumentError } = __nccwpck_require__(848);
4139
- const { Help } = __nccwpck_require__(613);
4140
- const { Option } = __nccwpck_require__(234);
4136
+ const { Argument } = __nccwpck_require__(710);
4137
+ const { Command } = __nccwpck_require__(672);
4138
+ const { CommanderError, InvalidArgumentError } = __nccwpck_require__(659);
4139
+ const { Help } = __nccwpck_require__(254);
4140
+ const { Option } = __nccwpck_require__(388);
4141
4141
 
4142
4142
  exports.program = new Command();
4143
4143
 
@@ -1,7 +1,7 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
- /***/ 209:
4
+ /***/ 456:
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__(209);
128
+ /******/ var __webpack_exports__ = __nccwpck_require__(456);
129
129
  /******/ module.exports = __webpack_exports__;
130
130
  /******/
131
131
  /******/ })()
package/dist/index.js CHANGED
@@ -160,7 +160,7 @@ function prepareCli() {
160
160
  initNodeEnv();
161
161
  const { npm_execpath } = process.env;
162
162
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
163
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rslib v0.3.1\n`);
163
+ __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rslib v0.3.2\n`);
164
164
  }
165
165
  const composeAssetConfig = (bundle, format)=>{
166
166
  if ('esm' === format || 'cjs' === format) return {
@@ -1781,6 +1781,7 @@ const traverseEntryQuery = (entry, callback)=>{
1781
1781
  return newEntry;
1782
1782
  };
1783
1783
  const appendEntryQuery = (entries)=>traverseEntryQuery(entries, (item)=>`${item}?${RSLIB_ENTRY_QUERY}`);
1784
+ const resolveEntryPath = (entries, root)=>traverseEntryQuery(entries, (item)=>__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(root, item));
1784
1785
  const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto)=>{
1785
1786
  let entries = rawEntry;
1786
1787
  if (!entries) {
@@ -1792,6 +1793,7 @@ const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto)=>{
1792
1793
  index: 'src/**'
1793
1794
  };
1794
1795
  }
1796
+ 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://lib.rsbuild.dev/config/rsbuild/source#sourceentry')} for more details.`);
1795
1797
  if (false !== bundle) {
1796
1798
  const entryErrorReasons = [];
1797
1799
  traverseEntryQuery(entries, (entry)=>{
@@ -1809,7 +1811,7 @@ const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto)=>{
1809
1811
  return {
1810
1812
  entryConfig: {
1811
1813
  source: {
1812
- entry: appendEntryQuery(entries)
1814
+ entry: appendEntryQuery(resolveEntryPath(entries, root))
1813
1815
  }
1814
1816
  },
1815
1817
  lcp: null
@@ -1871,7 +1873,7 @@ const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto)=>{
1871
1873
  lcp
1872
1874
  };
1873
1875
  };
1874
- const composeBundlelessExternalConfig = (jsExtension, redirect, cssModulesAuto, bundle)=>{
1876
+ const composeBundlelessExternalConfig = (jsExtension, redirect, cssModulesAuto, bundle, rootPath)=>{
1875
1877
  if (bundle) return {
1876
1878
  config: {}
1877
1879
  };
@@ -1897,7 +1899,8 @@ const composeBundlelessExternalConfig = (jsExtension, redirect, cssModulesAuto,
1897
1899
  try {
1898
1900
  let resolvedRequest = request;
1899
1901
  resolvedRequest = await resolver(context, resolvedRequest);
1900
- if (!resolvedRequest.includes('node_modules')) {
1902
+ const isSubpath = resolvedRequest.startsWith(rootPath + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep);
1903
+ if (isSubpath) {
1901
1904
  resolvedRequest = normalizeSlash(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].relative(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(issuer), resolvedRequest));
1902
1905
  if ('.' !== resolvedRequest[0]) resolvedRequest = `./${resolvedRequest}`;
1903
1906
  return resolvedRequest;
@@ -2043,7 +2046,7 @@ async function composeLibRsbuildConfig(config, root, sharedPlugins) {
2043
2046
  const externalHelpersConfig = composeExternalHelpersConfig(externalHelpers, pkgJson);
2044
2047
  const userExternalsConfig = composeExternalsConfig(format, config.output?.externals);
2045
2048
  const { config: autoExtensionConfig, jsExtension, dtsExtension } = composeAutoExtensionConfig(config, autoExtension, pkgJson);
2046
- const { config: bundlelessExternalConfig } = composeBundlelessExternalConfig(jsExtension, redirect, cssModulesAuto, bundle);
2049
+ const { config: bundlelessExternalConfig } = composeBundlelessExternalConfig(jsExtension, redirect, cssModulesAuto, bundle, rootPath);
2047
2050
  const { config: targetConfig, externalsConfig: targetExternalsConfig, target } = composeTargetConfig(config.output?.target, format);
2048
2051
  const syntaxConfig = composeSyntaxConfig(target, config?.syntax);
2049
2052
  const autoExternalConfig = composeAutoExternalConfig({
@@ -2280,7 +2283,7 @@ const repeatableOption = (value, previous)=>(previous ?? []).concat([
2280
2283
  value
2281
2284
  ]);
2282
2285
  function runCli() {
2283
- __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.name('rslib').usage('<command> [options]').version("0.3.1");
2286
+ __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.name('rslib').usage('<command> [options]').version("0.3.2");
2284
2287
  const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('build');
2285
2288
  const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('inspect');
2286
2289
  const mfDevCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('mf-dev');
@@ -2341,6 +2344,6 @@ function runCli() {
2341
2344
  });
2342
2345
  __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.parse();
2343
2346
  }
2344
- const src_rslib_entry_version = "0.3.1";
2347
+ const src_rslib_entry_version = "0.3.2";
2345
2348
  var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger;
2346
2349
  export { build, defineConfig, inspect, loadConfig, prepareCli, runCli, startMFDevServer, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, src_rslib_entry_version as version, __webpack_exports__logger as logger };
@@ -29,6 +29,7 @@ export declare function composeDecoratorsConfig(compilerOptions?: Record<string,
29
29
  export declare function createConstantRsbuildConfig(): Promise<EnvironmentConfig>;
30
30
  export declare const composeModuleImportWarn: (request: string) => string;
31
31
  export declare const appendEntryQuery: (entries: RsbuildConfigEntry) => RsbuildEntry;
32
+ export declare const resolveEntryPath: (entries: RsbuildConfigEntry, root: string) => RsbuildEntry;
32
33
  export declare function composeCreateRsbuildConfig(rslibConfig: RslibConfig): Promise<RsbuildConfigWithLibInfo[]>;
33
34
  export declare function composeRsbuildEnvironments(rslibConfig: RslibConfig): Promise<{
34
35
  environments: Record<string, EnvironmentConfig>;
@@ -8,6 +8,6 @@ export declare const LATEST_TARGET_VERSIONS: Record<NonNullable<RsbuildConfigOut
8
8
  * https://github.com/rspack-contrib/browserslist-to-es-version
9
9
  * TODO: align with Rsbuild, we may should align with SWC
10
10
  */
11
- export declare const ESX_TO_BROWSERSLIST: Record<FixedEcmaVersions, Record<string, string | string[]>> & Record<LatestEcmaVersions, (target: RsbuildConfigOutputTarget) => string[]>;
11
+ export declare const ESX_TO_BROWSERSLIST: Record<FixedEcmaVersions, Record<string, string>> & Record<LatestEcmaVersions, (target: RsbuildConfigOutputTarget) => string[]>;
12
12
  export declare function transformSyntaxToRspackTarget(syntax: Syntax): Rspack.Configuration['target'];
13
13
  export declare function transformSyntaxToBrowserslist(syntax: Syntax, target: NonNullable<EnvironmentConfig['output']>['target']): NonNullable<NonNullable<EnvironmentConfig['output']>['overrideBrowserslist']>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslib/core",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "The Rsbuild-based library development tool.",
5
5
  "homepage": "https://lib.rsbuild.dev",
6
6
  "bugs": {
@@ -32,21 +32,21 @@
32
32
  "compiled"
33
33
  ],
34
34
  "dependencies": {
35
- "@rsbuild/core": "1.2.0-beta.0",
35
+ "@rsbuild/core": "1.2.0-beta.1",
36
36
  "tinyglobby": "^0.2.10",
37
- "rsbuild-plugin-dts": "0.3.1"
37
+ "rsbuild-plugin-dts": "0.3.2"
38
38
  },
39
39
  "devDependencies": {
40
- "@module-federation/rsbuild-plugin": "^0.8.8",
40
+ "@module-federation/rsbuild-plugin": "^0.8.9",
41
41
  "@types/fs-extra": "^11.0.4",
42
42
  "chokidar": "^4.0.3",
43
43
  "commander": "^13.0.0",
44
- "fs-extra": "^11.2.0",
45
- "memfs": "^4.15.3",
44
+ "fs-extra": "^11.3.0",
45
+ "memfs": "^4.17.0",
46
46
  "picocolors": "1.1.1",
47
- "prebundle": "1.2.5",
47
+ "prebundle": "1.2.7",
48
48
  "rsbuild-plugin-publint": "^0.2.1",
49
- "rslib": "npm:@rslib/core@0.3.0",
49
+ "rslib": "npm:@rslib/core@0.3.1",
50
50
  "rslog": "^1.2.3",
51
51
  "tsconfck": "3.1.4",
52
52
  "typescript": "^5.7.3",
@@ -75,6 +75,7 @@
75
75
  "scripts": {
76
76
  "build": "rslib build",
77
77
  "dev": "rslib build --watch",
78
- "prebundle": "prebundle"
78
+ "prebundle": "prebundle",
79
+ "type-check": "tsc --noEmit && tsc --noEmit -p tests"
79
80
  }
80
81
  }