@lynx-js/rspeedy-canary 0.11.0-canary-20250827-bc310a8c → 0.11.0-canary-20250828-86da1623

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.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,13 @@
1
1
  # @lynx-js/rspeedy
2
2
 
3
- ## 0.11.0-canary-20250827124621-bc310a8c9a6242687baffb8d629c4524935be386
3
+ ## 0.11.0-canary-20250828061943-86da1623d0bd2cc5fa6dc1642915e5f43a02d350
4
4
 
5
5
  ### Minor Changes
6
6
 
7
+ - Deprecate `source.alias`, use `resolve.alias` instead. ([#1610](https://github.com/lynx-family/lynx-stack/pull/1610))
8
+
9
+ Note that `resolve.alias` has **lower** priority than the deprecated `source.alias`.
10
+
7
11
  - Bump Rsbuild v1.5.0 with Rspack v1.5.0. ([#1591](https://github.com/lynx-family/lynx-stack/pull/1591))
8
12
 
9
13
  - **BREAKING CHANGE**: Remove the `./register` exports from `@lynx-js/rspeedy`. ([#1547](https://github.com/lynx-family/lynx-stack/pull/1547))
@@ -12,10 +16,12 @@
12
16
 
13
17
  ### Patch Changes
14
18
 
19
+ - Support `resolve.alias`. ([#1610](https://github.com/lynx-family/lynx-stack/pull/1610))
20
+
15
21
  - Support `rspeedy build --watch` ([#1579](https://github.com/lynx-family/lynx-stack/pull/1579))
16
22
 
17
23
  - Updated dependencies [[`1952fc1`](https://github.com/lynx-family/lynx-stack/commit/1952fc1557e5abbdbdf4a2073fd3b6f64dd32c3c)]:
18
- - @lynx-js/chunk-loading-webpack-plugin@0.3.2-canary-20250827124621-bc310a8c9a6242687baffb8d629c4524935be386
24
+ - @lynx-js/chunk-loading-webpack-plugin@0.3.2-canary-20250828061943-86da1623d0bd2cc5fa6dc1642915e5f43a02d350
19
25
  - @lynx-js/cache-events-webpack-plugin@0.0.1
20
26
 
21
27
  ## 0.10.8
package/dist/index.d.ts CHANGED
@@ -414,9 +414,13 @@ export declare interface Config {
414
414
  */
415
415
  output?: Output | undefined;
416
416
  /**
417
- * The {@link Performance} option is used to
417
+ * The {@link Performance} option is used to optimize the build-time and runtime performance.
418
418
  */
419
419
  performance?: Performance | undefined;
420
+ /**
421
+ * The {@link Resolve} option is used to control the resolution behavior of Rspack.
422
+ */
423
+ resolve?: Resolve | undefined;
420
424
  /**
421
425
  * The {@link Server} option changes the behavior of dev-server.
422
426
  */
@@ -2362,6 +2366,94 @@ export declare interface Performance {
2362
2366
  printFileSize?: PerformanceConfig['printFileSize'] | undefined;
2363
2367
  }
2364
2368
 
2369
+ /**
2370
+ * {@inheritdoc Config.resolve}
2371
+ *
2372
+ * @public
2373
+ */
2374
+ export declare interface Resolve {
2375
+ /**
2376
+ * Create aliases to `import` or `require` certain modules more easily.
2377
+ *
2378
+ * @example
2379
+ *
2380
+ * A trailing `$` can also be added to the given object's keys to signify an exact match:
2381
+ *
2382
+ * ```js
2383
+ * import { defineConfig } from '@lynx-js/rspeedy'
2384
+ * export default defineConfig({
2385
+ * resolve: {
2386
+ * alias: {
2387
+ * xyz$: 'path/to/file.js',
2388
+ * },
2389
+ * },
2390
+ * })
2391
+ * ```
2392
+ *
2393
+ * which would yield these results:
2394
+ *
2395
+ * ```js
2396
+ * import Test1 from 'xyz'; // Exact match, so path/to/file.js is resolved and imported
2397
+ * import Test2 from 'xyz/file.js'; // Not an exact match, normal resolution takes place
2398
+ * ```
2399
+ *
2400
+ * @example
2401
+ *
2402
+ * `resolve.alias` is useful to control how a npm package is resolved.
2403
+ *
2404
+ * - Change `react` to `@lynx-js/react`:
2405
+ *
2406
+ * ```js
2407
+ * import { defineConfig } from '@lynx-js/rspeedy'
2408
+ * import { createRequire } from 'module'
2409
+ * const require = createRequire(import.meta.url)
2410
+ * export default defineConfig({
2411
+ * resolve: {
2412
+ * alias: {
2413
+ * react: require.resolve('@lynx-js/react'),
2414
+ * },
2415
+ * },
2416
+ * })
2417
+ * ```
2418
+ *
2419
+ * This allows you to use some third-party libraries that directly uses `react` as dependencies in ReactLynx.
2420
+ *
2421
+ * - Force using the same version of `dayjs`:
2422
+ *
2423
+ * ```js
2424
+ * import { defineConfig } from '@lynx-js/rspeedy'
2425
+ * import { createRequire } from 'module'
2426
+ * const require = createRequire(import.meta.url)
2427
+ * export default defineConfig({
2428
+ * resolve: {
2429
+ * alias: {
2430
+ * dayjs: require.resolve('dayjs'),
2431
+ * },
2432
+ * },
2433
+ * })
2434
+ * ```
2435
+ *
2436
+ * Please note that this is dangerous, since all the `dayjs`(including the dependencies of a dependencies) is resolved to the version in the project.
2437
+ * It may cause both compile-time and runtime errors due to version mismatch.
2438
+ *
2439
+ * @example
2440
+ * Setting `resolve.alias` to `false` will ignore a module.
2441
+ *
2442
+ * ```js
2443
+ * import { defineConfig } from '@lynx-js/rspeedy'
2444
+ * export default defineConfig({
2445
+ * resolve: {
2446
+ * alias: {
2447
+ * 'ignored-module': false,
2448
+ * './ignored-module': false,
2449
+ * },
2450
+ * },
2451
+ * })
2452
+ * ```
2453
+ */
2454
+ alias?: Record<string, string | false | string[]> | undefined;
2455
+ }
2456
+
2365
2457
  export { RsbuildPlugin }
2366
2458
 
2367
2459
  export { RsbuildPluginAPI }
@@ -2484,83 +2576,9 @@ export declare interface Server {
2484
2576
  */
2485
2577
  export declare interface Source {
2486
2578
  /**
2487
- * Create aliases to `import` or `require` certain modules more easily.
2488
- *
2489
- * @example
2490
- *
2491
- * A trailing `$` can also be added to the given object's keys to signify an exact match:
2492
- *
2493
- * ```js
2494
- * import { defineConfig } from '@lynx-js/rspeedy'
2495
- * export default defineConfig({
2496
- * source: {
2497
- * alias: {
2498
- * xyz$: 'path/to/file.js',
2499
- * },
2500
- * },
2501
- * })
2502
- * ```
2503
- *
2504
- * which would yield these results:
2505
- *
2506
- * ```js
2507
- * import Test1 from 'xyz'; // Exact match, so path/to/file.js is resolved and imported
2508
- * import Test2 from 'xyz/file.js'; // Not an exact match, normal resolution takes place
2509
- * ```
2510
- *
2511
- * @example
2512
- *
2513
- * `source.alias` is useful to control how a npm package is resolved.
2514
- *
2515
- * - Change `react` to `@lynx-js/react`:
2516
- *
2517
- * ```js
2518
- * import { defineConfig } from '@lynx-js/rspeedy'
2519
- * import { createRequire } from 'module'
2520
- * const require = createRequire(import.meta.url)
2521
- * export default defineConfig({
2522
- * source: {
2523
- * alias: {
2524
- * react: require.resolve('@lynx-js/react'),
2525
- * },
2526
- * },
2527
- * })
2528
- * ```
2529
- *
2530
- * This allows you to use some third-party libraries that directly uses `react` as dependencies in ReactLynx.
2531
- *
2532
- * - Force using the same version of `dayjs`:
2579
+ * {@inheritdoc Resolve.alias}
2533
2580
  *
2534
- * ```js
2535
- * import { defineConfig } from '@lynx-js/rspeedy'
2536
- * import { createRequire } from 'module'
2537
- * const require = createRequire(import.meta.url)
2538
- * export default defineConfig({
2539
- * source: {
2540
- * alias: {
2541
- * dayjs: require.resolve('dayjs'),
2542
- * },
2543
- * },
2544
- * })
2545
- * ```
2546
- *
2547
- * Please note that this is dangerous, since all the `dayjs`(including the dependencies of a dependencies) is resolved to the version in the project.
2548
- * It may cause both compile-time and runtime errors due to version mismatch.
2549
- *
2550
- * @example
2551
- * Setting `source.alias` to `false` will ignore a module.
2552
- *
2553
- * ```js
2554
- * import { defineConfig } from '@lynx-js/rspeedy'
2555
- * export default defineConfig({
2556
- * source: {
2557
- * alias: {
2558
- * 'ignored-module': false,
2559
- * './ignored-module': false,
2560
- * },
2561
- * },
2562
- * })
2563
- * ```
2581
+ * @deprecated - Use {@link Resolve.alias} instead.
2564
2582
  */
2565
2583
  alias?: Record<string, string | false | string[]> | undefined;
2566
2584
  /**
package/dist/index.js CHANGED
@@ -341,9 +341,10 @@ function toRsbuildConfig(config) {
341
341
  sourceMap: config.output?.sourceMap
342
342
  },
343
343
  resolve: {
344
- alias: config.source?.alias
344
+ alias: config.resolve?.alias
345
345
  },
346
346
  source: {
347
+ alias: config.source?.alias,
347
348
  assetsInclude: config.source?.assetsInclude,
348
349
  decorators: config.source?.decorators,
349
350
  define: config.source?.define,
@@ -321,9 +321,10 @@ export const __webpack_modules__ = {
321
321
  sourceMap: config.output?.sourceMap
322
322
  },
323
323
  resolve: {
324
- alias: config.source?.alias
324
+ alias: config.resolve?.alias
325
325
  },
326
326
  source: {
327
+ alias: config.source?.alias,
327
328
  assetsInclude: config.source?.assetsInclude,
328
329
  decorators: config.source?.decorators,
329
330
  define: config.source?.define,
@@ -313,9 +313,10 @@ export const __webpack_modules__ = {
313
313
  sourceMap: config.output?.sourceMap
314
314
  },
315
315
  resolve: {
316
- alias: config.source?.alias
316
+ alias: config.resolve?.alias
317
317
  },
318
318
  source: {
319
+ alias: config.source?.alias,
319
320
  assetsInclude: config.source?.assetsInclude,
320
321
  decorators: config.source?.decorators,
321
322
  define: config.source?.define,
@@ -259,9 +259,10 @@ export const __webpack_modules__ = {
259
259
  sourceMap: config.output?.sourceMap
260
260
  },
261
261
  resolve: {
262
- alias: config.source?.alias
262
+ alias: config.resolve?.alias
263
263
  },
264
264
  source: {
265
+ alias: config.source?.alias,
265
266
  assetsInclude: config.source?.assetsInclude,
266
267
  decorators: config.source?.decorators,
267
268
  define: config.source?.define,
@@ -261,9 +261,10 @@ export const __webpack_modules__ = {
261
261
  sourceMap: config.output?.sourceMap
262
262
  },
263
263
  resolve: {
264
- alias: config.source?.alias
264
+ alias: config.resolve?.alias
265
265
  },
266
266
  source: {
267
+ alias: config.source?.alias,
267
268
  assetsInclude: config.source?.assetsInclude,
268
269
  decorators: config.source?.decorators,
269
270
  define: config.source?.define,