@lynx-js/rspeedy-canary 0.11.1 → 0.11.2-canary-20250909-1935050c

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,5 +1,27 @@
1
1
  # @lynx-js/rspeedy
2
2
 
3
+ ## 0.11.2-canary-20250909031742-1935050cfd8ac37cbac6ad792f3aab0eb6b250b8
4
+
5
+ ### Patch Changes
6
+
7
+ - Support `resolve.dedupe`. ([#1671](https://github.com/lynx-family/lynx-stack/pull/1671))
8
+
9
+ This is useful when having multiple duplicated packages in the bundle:
10
+
11
+ ```js
12
+ import { defineConfig } from "@lynx-js/rspeedy";
13
+
14
+ export default defineConfig({
15
+ resolve: {
16
+ dedupe: ["tslib"],
17
+ },
18
+ });
19
+ ```
20
+
21
+ - Updated dependencies [[`d7c5da3`](https://github.com/lynx-family/lynx-stack/commit/d7c5da329caddfb12ed77159fb8b1b8f38717cff)]:
22
+ - @lynx-js/chunk-loading-webpack-plugin@0.3.3-canary-20250909031742-1935050cfd8ac37cbac6ad792f3aab0eb6b250b8
23
+ - @lynx-js/cache-events-webpack-plugin@0.0.2
24
+
3
25
  ## 0.11.1
4
26
 
5
27
  ### Patch Changes
@@ -11,7 +33,7 @@
11
33
  - Add `output.dataUriLimit.*` for fine-grained control of asset inlining. ([#1648](https://github.com/lynx-family/lynx-stack/pull/1648))
12
34
 
13
35
  ```js
14
- import { defineConfig } from '@lynx-js/rspeedy'
36
+ import { defineConfig } from "@lynx-js/rspeedy";
15
37
 
16
38
  export default defineConfig({
17
39
  output: {
@@ -20,7 +42,7 @@
20
42
  media: 0,
21
43
  },
22
44
  },
23
- })
45
+ });
24
46
  ```
25
47
 
26
48
  ## 0.11.0
@@ -140,28 +162,28 @@
140
162
 
141
163
  ```ts
142
164
  type InlineChunkTestFunction = (params: {
143
- size: number
144
- name: string
145
- }) => boolean
165
+ size: number;
166
+ name: string;
167
+ }) => boolean;
146
168
 
147
- type InlineChunkTest = RegExp | InlineChunkTestFunction
169
+ type InlineChunkTest = RegExp | InlineChunkTestFunction;
148
170
 
149
171
  type InlineChunkConfig =
150
172
  | boolean
151
173
  | InlineChunkTest
152
- | { enable?: boolean | 'auto', test: InlineChunkTest }
174
+ | { enable?: boolean | "auto"; test: InlineChunkTest };
153
175
  ```
154
176
 
155
177
  ```ts
156
- import { defineConfig } from '@lynx-js/rspeedy'
178
+ import { defineConfig } from "@lynx-js/rspeedy";
157
179
 
158
180
  export default defineConfig({
159
181
  output: {
160
182
  inlineScripts: ({ name, size }) => {
161
- return name.includes('foo') && size < 1000
183
+ return name.includes("foo") && size < 1000;
162
184
  },
163
185
  },
164
- })
186
+ });
165
187
  ```
166
188
 
167
189
  - docs: remove chunks: 'all' in comments ([#1168](https://github.com/lynx-family/lynx-stack/pull/1168))
@@ -204,13 +226,13 @@
204
226
  example:
205
227
 
206
228
  ```js
207
- import { defineConfig } from '@lynx-js/rspeedy'
229
+ import { defineConfig } from "@lynx-js/rspeedy";
208
230
 
209
231
  export default defineConfig({
210
232
  output: {
211
233
  inlineScripts: false,
212
234
  },
213
- })
235
+ });
214
236
  ```
215
237
 
216
238
  - Bump Rsbuild v1.3.21 with Rspack v1.3.11. ([#863](https://github.com/lynx-family/lynx-stack/pull/863))
@@ -230,12 +252,12 @@
230
252
  example:
231
253
 
232
254
  ```js
233
- import { defineConfig } from '@lynx-js/rspeedy'
255
+ import { defineConfig } from "@lynx-js/rspeedy";
234
256
  export default defineConfig({
235
257
  source: {
236
- preEntry: './src/polyfill.ts',
258
+ preEntry: "./src/polyfill.ts",
237
259
  },
238
- })
260
+ });
239
261
  ```
240
262
 
241
263
  - Bump Rsbuild v1.3.20 with Rspack v1.3.10. ([#799](https://github.com/lynx-family/lynx-stack/pull/799))
@@ -246,17 +268,17 @@
246
268
 
247
269
  ```js
248
270
  export const myPlugin = {
249
- name: 'my-plugin',
271
+ name: "my-plugin",
250
272
  setup(api) {
251
- const { callerName } = api.context
273
+ const { callerName } = api.context;
252
274
 
253
- if (callerName === 'rslib') {
275
+ if (callerName === "rslib") {
254
276
  // ...
255
- } else if (callerName === 'rspeedy') {
277
+ } else if (callerName === "rspeedy") {
256
278
  // ...
257
279
  }
258
280
  },
259
- }
281
+ };
260
282
  ```
261
283
 
262
284
  - Support `performance.buildCache`. ([#766](https://github.com/lynx-family/lynx-stack/pull/766))
@@ -279,7 +301,7 @@
279
301
  Set `tools.rsdoctor.experiments.enableNativePlugin` to `false` to use the old JS plugin.
280
302
 
281
303
  ```js
282
- import { defineConfig } from '@lynx-js/rspeedy'
304
+ import { defineConfig } from "@lynx-js/rspeedy";
283
305
 
284
306
  export default defineConfig({
285
307
  tools: {
@@ -289,7 +311,7 @@
289
311
  },
290
312
  },
291
313
  },
292
- })
314
+ });
293
315
  ```
294
316
 
295
317
  See [Rsdoctor - 1.0](https://rsdoctor.dev/blog/release/release-note-1_0#-faster-analysis) for more details.
@@ -421,12 +443,12 @@
421
443
  example:
422
444
 
423
445
  ```js
424
- import { defineConfig } from '@lynx-js/rspeedy'
446
+ import { defineConfig } from "@lynx-js/rspeedy";
425
447
  export default defineConfig({
426
448
  server: {
427
- base: '/dist',
449
+ base: "/dist",
428
450
  },
429
- })
451
+ });
430
452
  ```
431
453
 
432
454
  - Updated dependencies [[`b026c8b`](https://github.com/lynx-family/lynx-stack/commit/b026c8bdcbf7bdcda73e170477297213b447d876)]:
@@ -479,11 +501,11 @@
479
501
  You can switch to other tools by using:
480
502
 
481
503
  ```js
482
- import { defineConfig } from '@lynx-js/rspeedy'
504
+ import { defineConfig } from "@lynx-js/rspeedy";
483
505
  import {
484
506
  CssMinimizerWebpackPlugin,
485
507
  pluginCssMinimizer,
486
- } from '@rsbuild/plugin-css-minimizer'
508
+ } from "@rsbuild/plugin-css-minimizer";
487
509
 
488
510
  export default defineConfig({
489
511
  plugins: [
@@ -496,7 +518,7 @@
496
518
  },
497
519
  }),
498
520
  ],
499
- })
521
+ });
500
522
  ```
501
523
 
502
524
  See [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) for details.
@@ -506,8 +528,8 @@
506
528
  You can use custom options with [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer):
507
529
 
508
530
  ```js
509
- import { defineConfig } from '@lynx-js/rspeedy'
510
- import { pluginCssMinimizer } from '@rsbuild/plugin-css-minimizer'
531
+ import { defineConfig } from "@lynx-js/rspeedy";
532
+ import { pluginCssMinimizer } from "@rsbuild/plugin-css-minimizer";
511
533
 
512
534
  export default defineConfig({
513
535
  plugins: [
@@ -519,7 +541,7 @@
519
541
  },
520
542
  }),
521
543
  ],
522
- })
544
+ });
523
545
  ```
524
546
 
525
547
  ## 0.7.1
@@ -539,7 +561,7 @@
539
561
  You may turn it off using `output.minify.css: false`:
540
562
 
541
563
  ```js
542
- import { defineConfig } from '@lynx-js/rspeedy'
564
+ import { defineConfig } from "@lynx-js/rspeedy";
543
565
 
544
566
  export default defineConfig({
545
567
  output: {
@@ -547,18 +569,18 @@
547
569
  css: false,
548
570
  },
549
571
  },
550
- })
572
+ });
551
573
  ```
552
574
 
553
575
  Or you may use [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) to use `cssnano` as CSS minimizer.
554
576
 
555
577
  ```js
556
- import { defineConfig } from '@lynx-js/rspeedy'
557
- import { pluginCssMinimizer } from '@rsbuild/plugin-css-minimizer'
578
+ import { defineConfig } from "@lynx-js/rspeedy";
579
+ import { pluginCssMinimizer } from "@rsbuild/plugin-css-minimizer";
558
580
 
559
581
  export default defineConfig({
560
582
  plugins: [pluginCssMinimizer()],
561
- })
583
+ });
562
584
  ```
563
585
 
564
586
  - 525554c: **BREAKING CHANGE**: Bump ts-blank-space to ^0.6.0.
@@ -585,22 +607,22 @@
585
607
  - The new `type: 'reload-server'` will restart the development server when it detects changes in the specified files.
586
608
 
587
609
  ```js
588
- import { defineConfig } from '@lynx-js/rspeedy'
610
+ import { defineConfig } from "@lynx-js/rspeedy";
589
611
 
590
612
  export default defineConfig({
591
613
  dev: {
592
614
  watchFiles: [
593
615
  {
594
- type: 'reload-server',
595
- paths: ['public/**/*.txt'],
616
+ type: "reload-server",
617
+ paths: ["public/**/*.txt"],
596
618
  },
597
619
  {
598
- type: 'reload-page',
599
- paths: ['public/**/*.json'],
620
+ type: "reload-page",
621
+ paths: ["public/**/*.json"],
600
622
  },
601
623
  ],
602
624
  },
603
- })
625
+ });
604
626
  ```
605
627
 
606
628
  - be9b003: Add `source.exclude`.
package/dist/index.d.ts CHANGED
@@ -2470,6 +2470,30 @@ export declare interface Resolve {
2470
2470
  * ```
2471
2471
  */
2472
2472
  alias?: Record<string, string | false | string[]> | undefined;
2473
+ /**
2474
+ * Force to resolve the specified packages from project root, which is useful for deduplicating packages and reducing the bundle size.
2475
+ *
2476
+ * @remarks
2477
+ *
2478
+ * {@link Resolve.dedupe} is implemented based on {@link Resolve.alias}, it will get the path of the specified package through `require.resolve` in the project root directory and set it to the alias.
2479
+ *
2480
+ * The alias generated by {@link Resolve.dedupe} will be merged with the configured {@link Resolve.alias} in the project, and the {@link Resolve.alias} config will take precedence when the keys are the same.
2481
+ *
2482
+ * @example
2483
+ *
2484
+ * Use `tslib` from the project root directory.
2485
+ *
2486
+ * ```js
2487
+ * import { defineConfig } from '@lynx-js/rspeedy'
2488
+ *
2489
+ * export default defineConfig({
2490
+ * resolve: {
2491
+ * dedupe: ['tslib'],
2492
+ * },
2493
+ * })
2494
+ * ```
2495
+ */
2496
+ dedupe?: string[] | undefined;
2473
2497
  }
2474
2498
 
2475
2499
  export { RsbuildPlugin }
package/dist/index.js CHANGED
@@ -342,7 +342,8 @@ function toRsbuildConfig(config) {
342
342
  sourceMap: config.output?.sourceMap
343
343
  },
344
344
  resolve: {
345
- alias: config.resolve?.alias
345
+ alias: config.resolve?.alias,
346
+ dedupe: config.resolve?.dedupe
346
347
  },
347
348
  source: {
348
349
  alias: config.source?.alias,
@@ -322,7 +322,8 @@ export const __webpack_modules__ = {
322
322
  sourceMap: config.output?.sourceMap
323
323
  },
324
324
  resolve: {
325
- alias: config.resolve?.alias
325
+ alias: config.resolve?.alias,
326
+ dedupe: config.resolve?.dedupe
326
327
  },
327
328
  source: {
328
329
  alias: config.source?.alias,
@@ -314,7 +314,8 @@ export const __webpack_modules__ = {
314
314
  sourceMap: config.output?.sourceMap
315
315
  },
316
316
  resolve: {
317
- alias: config.resolve?.alias
317
+ alias: config.resolve?.alias,
318
+ dedupe: config.resolve?.dedupe
318
319
  },
319
320
  source: {
320
321
  alias: config.source?.alias,
@@ -260,7 +260,8 @@ export const __webpack_modules__ = {
260
260
  sourceMap: config.output?.sourceMap
261
261
  },
262
262
  resolve: {
263
- alias: config.resolve?.alias
263
+ alias: config.resolve?.alias,
264
+ dedupe: config.resolve?.dedupe
264
265
  },
265
266
  source: {
266
267
  alias: config.source?.alias,
@@ -262,7 +262,8 @@ export const __webpack_modules__ = {
262
262
  sourceMap: config.output?.sourceMap
263
263
  },
264
264
  resolve: {
265
- alias: config.resolve?.alias
265
+ alias: config.resolve?.alias,
266
+ dedupe: config.resolve?.dedupe
266
267
  },
267
268
  source: {
268
269
  alias: config.source?.alias,