@rslib/core 0.1.1 → 0.1.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 +20 -12
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -8,7 +8,6 @@ import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core__ from "@rsbuild/core";
8
8
  import * as __WEBPACK_EXTERNAL_MODULE_tinyglobby__ from "tinyglobby";
9
9
  import * as __WEBPACK_EXTERNAL_MODULE_node_module__ from "node:module";
10
10
  import * as __WEBPACK_EXTERNAL_MODULE_module__ from "module";
11
- import * as __WEBPACK_EXTERNAL_MODULE__compiled_chokidar_index_js__ from "../compiled/chokidar/index.js";
12
11
  /**
13
12
  * Node.js built-in modules.
14
13
  * Copied from https://github.com/webpack/webpack/blob/dd44b206a9c50f4b4cb4d134e1a0bd0387b159a3/lib/node/NodeTargetPlugin.js#L12-L72
@@ -167,7 +166,7 @@ function prepareCli() {
167
166
  // Some package managers automatically output a blank line, some do not.
168
167
  const { npm_execpath } = process.env;
169
168
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
170
- __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.greet(` Rslib v0.1.1\n`);
169
+ __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger.greet(` Rslib v0.1.2\n`);
171
170
  }
172
171
  const DEFAULT_CONFIG_NAME = 'rslib.config';
173
172
  const DEFAULT_CONFIG_EXTENSIONS = [
@@ -1837,6 +1836,18 @@ const composeFormatConfig = ({ format, bundle = true, umdName, pkgJson })=>{
1837
1836
  throw new Error(`Unsupported format: ${format}`);
1838
1837
  }
1839
1838
  };
1839
+ const formatRsbuildPlugin = ()=>({
1840
+ name: 'rsbuild:format',
1841
+ setup (api) {
1842
+ api.modifyBundlerChain((config, { CHAIN_ID })=>{
1843
+ // Fix for https://github.com/web-infra-dev/rslib/issues/499.
1844
+ // Prevent parsing and try bundling `new URL()` in ESM format.
1845
+ config.module.rule(CHAIN_ID.RULE.JS).parser({
1846
+ url: false
1847
+ });
1848
+ });
1849
+ }
1850
+ });
1840
1851
  const composeShimsConfig = (format, shims)=>{
1841
1852
  const resolvedShims = {
1842
1853
  cjs: {
@@ -1872,7 +1883,8 @@ const composeShimsConfig = (format, shims)=>{
1872
1883
  }
1873
1884
  },
1874
1885
  plugins: [
1875
- resolvedShims.esm.require && pluginEsmRequireShim()
1886
+ resolvedShims.esm.require && pluginEsmRequireShim(),
1887
+ formatRsbuildPlugin()
1876
1888
  ].filter(Boolean)
1877
1889
  };
1878
1890
  break;
@@ -2307,15 +2319,11 @@ const pruneEnvironments = (environments, libs)=>{
2307
2319
  };
2308
2320
  async function watchFilesForRestart(files, restart) {
2309
2321
  if (!files.length) return;
2310
- const watcher = __WEBPACK_EXTERNAL_MODULE__compiled_chokidar_index_js__["default"].watch(files, {
2322
+ const chokidar = await import("../compiled/chokidar/index.js");
2323
+ const watcher = chokidar.watch(files, {
2311
2324
  ignoreInitial: true,
2312
2325
  // If watching fails due to read permissions, the errors will be suppressed silently.
2313
- ignorePermissionErrors: true,
2314
- ignored: [
2315
- '**/node_modules/**',
2316
- '**/.git/**',
2317
- '**/.DS_Store/**'
2318
- ]
2326
+ ignorePermissionErrors: true
2319
2327
  });
2320
2328
  const callback = debounce(async (filePath)=>{
2321
2329
  watcher.close();
@@ -2424,7 +2432,7 @@ const repeatableOption = (value, previous)=>(previous ?? []).concat([
2424
2432
  value
2425
2433
  ]);
2426
2434
  function runCli() {
2427
- __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.name('rslib').usage('<command> [options]').version("0.1.1");
2435
+ __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.name('rslib').usage('<command> [options]').version("0.1.2");
2428
2436
  const buildCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('build');
2429
2437
  const inspectCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('inspect');
2430
2438
  const mfDevCommand = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.command('mf dev');
@@ -2488,6 +2496,6 @@ function runCli() {
2488
2496
  });
2489
2497
  __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__.program.parse();
2490
2498
  }
2491
- const src_rslib_entry_version = "0.1.1";
2499
+ const src_rslib_entry_version = "0.1.2";
2492
2500
  var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js__.logger;
2493
2501
  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.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "The Rsbuild-based library development tool.",
5
5
  "homepage": "https://lib.rsbuild.dev",
6
6
  "bugs": {
@@ -32,19 +32,19 @@
32
32
  "compiled"
33
33
  ],
34
34
  "dependencies": {
35
- "@rsbuild/core": "~1.1.6",
35
+ "@rsbuild/core": "~1.1.7",
36
36
  "tinyglobby": "^0.2.10",
37
- "rsbuild-plugin-dts": "0.1.1"
37
+ "rsbuild-plugin-dts": "0.1.2"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/fs-extra": "^11.0.4",
41
41
  "chokidar": "^4.0.1",
42
42
  "commander": "^12.1.0",
43
43
  "fs-extra": "^11.2.0",
44
- "memfs": "^4.14.0",
44
+ "memfs": "^4.14.1",
45
45
  "picocolors": "1.1.1",
46
46
  "prebundle": "1.2.5",
47
- "rslib": "npm:@rslib/core@0.1.0",
47
+ "rslib": "npm:@rslib/core@0.1.1",
48
48
  "rslog": "^1.2.3",
49
49
  "tsconfck": "3.1.4",
50
50
  "typescript": "^5.6.3",