@rslib/core 0.2.0 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.js +22 -30
  2. package/package.json +6 -5
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__.logger.greet(` Rslib v0.2.0\n`);
163
+ __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.greet(` Rslib v0.2.2\n`);
164
164
  }
165
165
  const composeAssetConfig = (bundle, format)=>{
166
166
  if ('esm' === format || 'cjs' === format) {
@@ -1589,15 +1589,20 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson })=>{
1589
1589
  }
1590
1590
  case 'mf':
1591
1591
  return {
1592
+ dev: {
1593
+ writeToDisk: true
1594
+ },
1592
1595
  tools: {
1593
- rspack: {
1594
- output: {
1596
+ rspack: (config, { env })=>{
1597
+ config.output = {
1598
+ ...config.output,
1595
1599
  uniqueName: pkgJson.name
1596
- },
1597
- optimization: {
1598
- nodeEnv: 'production',
1599
- moduleIds: 'deterministic'
1600
- }
1600
+ };
1601
+ config.optimization = {
1602
+ ...config.optimization,
1603
+ nodeEnv: 'development' === env ? 'development' : 'production',
1604
+ moduleIds: 'development' === env ? 'named' : 'deterministic'
1605
+ };
1601
1606
  }
1602
1607
  },
1603
1608
  output: {
@@ -1675,7 +1680,7 @@ const composeShimsConfig = (format, shims)=>{
1675
1680
  enabledShims
1676
1681
  };
1677
1682
  };
1678
- const composeModuleImportWarn = (request)=>`The externalized commonjs request ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js__["default"].green(`"${request}"`)} will use ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js__["default"].blue('"module"')} external type in ESM format. If you want to specify other external type, considering set the request and type with ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js__["default"].blue('"output.externals"')}.`;
1683
+ const composeModuleImportWarn = (request)=>`The externalized commonjs request ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js__["default"].green(`"${request}"`)} will use ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_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 ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js__["default"].blue('"output.externals"')}.`;
1679
1684
  const composeExternalsConfig = (format, externals)=>{
1680
1685
  const externalsTypeMap = {
1681
1686
  esm: 'module-import',
@@ -1835,16 +1840,14 @@ const composeBundlelessExternalConfig = (jsExtension, redirect, cssModulesAuto,
1835
1840
  let resolvedRequest = request;
1836
1841
  const cssExternal = cssExternalHandler(resolvedRequest, callback, jsExtension, cssModulesAuto, isStyleRedirected);
1837
1842
  if (false !== cssExternal) return cssExternal;
1838
- if (jsRedirectPath) {
1839
- try {
1840
- resolvedRequest = await resolver(context, resolvedRequest);
1841
- } catch (e) {
1842
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.debug(`Failed to resolve ${resolvedRequest} with resolver`);
1843
- }
1843
+ if (jsRedirectPath) try {
1844
+ resolvedRequest = await resolver(context, resolvedRequest);
1844
1845
  resolvedRequest = normalizeSlash(__WEBPACK_EXTERNAL_MODULE_node_path__["default"].relative(__WEBPACK_EXTERNAL_MODULE_node_path__["default"].dirname(contextInfo.issuer), resolvedRequest));
1845
1846
  if ('.' !== resolvedRequest[0]) resolvedRequest = `./${resolvedRequest}`;
1847
+ } catch (e) {
1848
+ __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.warn(`Failed to resolve module ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js__["default"].green(`"${resolvedRequest}"`)} from ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js__["default"].green(contextInfo.issuer)}. If it's an npm package, consider adding it to dependencies or peerDependencies in package.json to make it externalized.`);
1846
1849
  }
1847
- if (jsRedirectExtension) {
1850
+ if (jsRedirectExtension && resolvedRequest.startsWith('.')) {
1848
1851
  const ext = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.extname)(resolvedRequest);
1849
1852
  if (ext) {
1850
1853
  if (!JS_EXTENSIONS_PATTERN.test(resolvedRequest)) return callback();
@@ -2187,19 +2190,8 @@ async function initMFRsbuild(config, options = {}) {
2187
2190
  mode: 'development',
2188
2191
  root: config.root,
2189
2192
  plugins: config.plugins,
2190
- dev: {
2191
- ...config.dev ?? {},
2192
- writeToDisk: true
2193
- },
2193
+ dev: config.dev,
2194
2194
  server: config.server,
2195
- tools: {
2196
- rspack: {
2197
- optimization: {
2198
- nodeEnv: 'development',
2199
- moduleIds: 'named'
2200
- }
2201
- }
2202
- },
2203
2195
  environments: selectedEnvironments
2204
2196
  }
2205
2197
  });
@@ -2214,7 +2206,7 @@ const repeatableOption = (value, previous)=>(previous ?? []).concat([
2214
2206
  value
2215
2207
  ]);
2216
2208
  function runCli() {
2217
- __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.name('rslib').usage('<command> [options]').version("0.2.0");
2209
+ __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.name('rslib').usage('<command> [options]').version("0.2.2");
2218
2210
  const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('build');
2219
2211
  const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('inspect');
2220
2212
  const mfDevCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('mf-dev');
@@ -2274,6 +2266,6 @@ function runCli() {
2274
2266
  });
2275
2267
  __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.parse();
2276
2268
  }
2277
- const src_rslib_entry_version = "0.2.0";
2269
+ const src_rslib_entry_version = "0.2.2";
2278
2270
  var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger;
2279
2271
  export { build, defineConfig, inspect, loadConfig, prepareCli, runCli, startMFDevServer, composeCreateRsbuildConfig as unstable_composeCreateRsbuildConfig, src_rslib_entry_version as version, __webpack_exports__logger as logger };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslib/core",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "The Rsbuild-based library development tool.",
5
5
  "homepage": "https://lib.rsbuild.dev",
6
6
  "bugs": {
@@ -32,11 +32,12 @@
32
32
  "compiled"
33
33
  ],
34
34
  "dependencies": {
35
- "@rsbuild/core": "~1.1.12",
35
+ "@rsbuild/core": "~1.1.13",
36
36
  "tinyglobby": "^0.2.10",
37
- "rsbuild-plugin-dts": "0.2.0"
37
+ "rsbuild-plugin-dts": "0.2.2"
38
38
  },
39
39
  "devDependencies": {
40
+ "@module-federation/rsbuild-plugin": "^0.8.5",
40
41
  "@types/fs-extra": "^11.0.4",
41
42
  "chokidar": "^4.0.3",
42
43
  "commander": "^12.1.0",
@@ -45,10 +46,10 @@
45
46
  "picocolors": "1.1.1",
46
47
  "prebundle": "1.2.5",
47
48
  "rsbuild-plugin-publint": "^0.2.1",
48
- "rslib": "npm:@rslib/core@0.1.5",
49
+ "rslib": "npm:@rslib/core@0.2.0",
49
50
  "rslog": "^1.2.3",
50
51
  "tsconfck": "3.1.4",
51
- "typescript": "^5.6.3",
52
+ "typescript": "^5.7.2",
52
53
  "@rslib/tsconfig": "0.0.1"
53
54
  },
54
55
  "peerDependencies": {