@rslib/core 0.5.2 → 0.5.3

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 +18 -13
  2. package/package.json +6 -6
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.5.2\n`);
163
+ __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rslib v0.5.3\n`);
164
164
  }
165
165
  const DEFAULT_CONFIG_NAME = 'rslib.config';
166
166
  const DEFAULT_CONFIG_EXTENSIONS = [
@@ -315,8 +315,16 @@ const pluginLibAsset = ({ bundle })=>({
315
315
  });
316
316
  config.plugin(LibSvgrPatchPlugin.name).use(LibSvgrPatchPlugin, []);
317
317
  }
318
- if (!bundle) {
319
- if (isUsingSvgr) {
318
+ if (isUsingSvgr) {
319
+ if (bundle) {
320
+ const rule = config.module.rule(CHAIN_ID.RULE.SVG).oneOf(CHAIN_ID.ONE_OF.SVG_URL);
321
+ const originalGeneratorOptions = rule.get('generator');
322
+ const generatorOptions = isUserSetPublicPath ? originalGeneratorOptions : {
323
+ ...originalGeneratorOptions,
324
+ importMode: 'preserve'
325
+ };
326
+ rule.generator(generatorOptions);
327
+ } else {
320
328
  const rule = config.module.rule(CHAIN_ID.RULE.SVG).oneOf(CHAIN_ID.ONE_OF.SVG);
321
329
  rule.issuer([]);
322
330
  }
@@ -369,14 +377,6 @@ class LibCssExtractPlugin {
369
377
  this.options = options ?? {};
370
378
  }
371
379
  apply(compiler) {
372
- compiler.hooks.thisCompilation.tap(LibCssExtractPlugin_pluginName, (compilation)=>{
373
- compilation.hooks.chunkAsset.tap(LibCssExtractPlugin_pluginName, (_chunk, filename)=>{
374
- const asset = compilation.getAsset(filename);
375
- if (!asset) return;
376
- const needRemove = Boolean(asset.name.match(RSLIB_CSS_ENTRY_FLAG));
377
- if (needRemove) compilation.deleteAsset(filename);
378
- });
379
- });
380
380
  compiler.hooks.make.tap(LibCssExtractPlugin_pluginName, (compilation)=>{
381
381
  compilation.hooks.processAssets.tap(LibCssExtractPlugin_pluginName, (assets)=>{
382
382
  const chunkAsset = Object.keys(assets).filter((name)=>/\.css/.test(name));
@@ -454,6 +454,11 @@ const cssConfig_PLUGIN_NAME = 'rsbuild:lib-css';
454
454
  const pluginLibCss = (rootDir, banner, footer)=>({
455
455
  name: cssConfig_PLUGIN_NAME,
456
456
  setup (api) {
457
+ api.processAssets({
458
+ stage: 'additional'
459
+ }, ({ assets, compilation })=>{
460
+ for (const key of Object.keys(assets))if (key.match(RSLIB_CSS_ENTRY_FLAG)) compilation.deleteAsset(key);
461
+ });
457
462
  api.modifyBundlerChain((config, { CHAIN_ID })=>{
458
463
  let isUsingCssExtract = false;
459
464
  for (const ruleId of [
@@ -2444,7 +2449,7 @@ const repeatableOption = (value, previous)=>(previous ?? []).concat([
2444
2449
  value
2445
2450
  ]);
2446
2451
  function runCli() {
2447
- __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.name('rslib').usage('<command> [options]').version("0.5.2");
2452
+ __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.name('rslib').usage('<command> [options]').version("0.5.3");
2448
2453
  const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('build');
2449
2454
  const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('inspect');
2450
2455
  const mfDevCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.command('mf-dev');
@@ -2505,6 +2510,6 @@ function runCli() {
2505
2510
  });
2506
2511
  __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js_bca3ceaa__.program.parse();
2507
2512
  }
2508
- const src_rslib_entry_version = "0.5.2";
2513
+ const src_rslib_entry_version = "0.5.3";
2509
2514
  var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger;
2510
2515
  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.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "The Rsbuild-based library development tool.",
5
5
  "homepage": "https://lib.rsbuild.dev",
6
6
  "bugs": {
@@ -36,12 +36,12 @@
36
36
  "types.d.ts"
37
37
  ],
38
38
  "dependencies": {
39
- "@rsbuild/core": "~1.2.10",
39
+ "@rsbuild/core": "~1.2.13",
40
40
  "tinyglobby": "^0.2.12",
41
- "rsbuild-plugin-dts": "0.5.2"
41
+ "rsbuild-plugin-dts": "0.5.3"
42
42
  },
43
43
  "devDependencies": {
44
- "@module-federation/rsbuild-plugin": "^0.9.0",
44
+ "@module-federation/rsbuild-plugin": "^0.9.1",
45
45
  "@types/fs-extra": "^11.0.4",
46
46
  "chokidar": "^4.0.3",
47
47
  "commander": "^13.1.0",
@@ -50,10 +50,10 @@
50
50
  "picocolors": "1.1.1",
51
51
  "prebundle": "1.2.7",
52
52
  "rsbuild-plugin-publint": "^0.3.0",
53
- "rslib": "npm:@rslib/core@0.5.1",
53
+ "rslib": "npm:@rslib/core@0.5.2",
54
54
  "rslog": "^1.2.3",
55
55
  "tsconfck": "3.1.5",
56
- "typescript": "^5.7.3",
56
+ "typescript": "^5.8.2",
57
57
  "@rslib/tsconfig": "0.0.1"
58
58
  },
59
59
  "peerDependencies": {