@lynx-js/react-rsbuild-plugin-canary 0.10.8 → 0.10.9-canary-20250721-a3ae4c5e

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,16 @@
1
1
  # @lynx-js/react-rsbuild-plugin
2
2
 
3
+ ## 0.10.9-canary-20250721113631-a3ae4c5ebf1d8b44b15a3564b8590d4c6ae7b70b
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix not having profile in development by default. ([#1306](https://github.com/lynx-family/lynx-stack/pull/1306))
8
+
9
+ - Updated dependencies [[`7cd5ea2`](https://github.com/lynx-family/lynx-stack/commit/7cd5ea2cebf12aa982ddc048dec4c5c7ed6bc1d6)]:
10
+ - @lynx-js/react-webpack-plugin@0.6.19-canary-20250721113631-a3ae4c5ebf1d8b44b15a3564b8590d4c6ae7b70b
11
+ - @lynx-js/react-alias-rsbuild-plugin@0.10.9-canary-20250721113631-a3ae4c5ebf1d8b44b15a3564b8590d4c6ae7b70b
12
+ - @lynx-js/react-refresh-webpack-plugin@0.3.4
13
+
3
14
  ## 0.10.8
4
15
 
5
16
  ### Patch Changes
@@ -52,28 +63,28 @@
52
63
 
53
64
  ```ts
54
65
  type InlineChunkTestFunction = (params: {
55
- size: number
56
- name: string
57
- }) => boolean
66
+ size: number;
67
+ name: string;
68
+ }) => boolean;
58
69
 
59
- type InlineChunkTest = RegExp | InlineChunkTestFunction
70
+ type InlineChunkTest = RegExp | InlineChunkTestFunction;
60
71
 
61
72
  type InlineChunkConfig =
62
73
  | boolean
63
74
  | InlineChunkTest
64
- | { enable?: boolean | 'auto', test: InlineChunkTest }
75
+ | { enable?: boolean | "auto"; test: InlineChunkTest };
65
76
  ```
66
77
 
67
78
  ```ts
68
- import { defineConfig } from '@lynx-js/rspeedy'
79
+ import { defineConfig } from "@lynx-js/rspeedy";
69
80
 
70
81
  export default defineConfig({
71
82
  output: {
72
83
  inlineScripts: ({ name, size }) => {
73
- return name.includes('foo') && size < 1000
84
+ return name.includes("foo") && size < 1000;
74
85
  },
75
86
  },
76
- })
87
+ });
77
88
  ```
78
89
 
79
90
  - Updated dependencies [[`51cb73d`](https://github.com/lynx-family/lynx-stack/commit/51cb73dd0b77d35540644cdd2e6c37db856f0e8a), [`69fb042`](https://github.com/lynx-family/lynx-stack/commit/69fb0420e297abf768c889769c95a207c480b3c7), [`a7e8b5b`](https://github.com/lynx-family/lynx-stack/commit/a7e8b5bbbab0490e7cf6f47581130e7b32739abb)]:
@@ -153,13 +164,13 @@
153
164
  example:
154
165
 
155
166
  ```js
156
- import { defineConfig } from '@lynx-js/rspeedy'
167
+ import { defineConfig } from "@lynx-js/rspeedy";
157
168
 
158
169
  export default defineConfig({
159
170
  output: {
160
171
  inlineScripts: false,
161
172
  },
162
- })
173
+ });
163
174
  ```
164
175
 
165
176
  - Support `@lynx-js/react` v0.109.0. ([#840](https://github.com/lynx-family/lynx-stack/pull/840))
@@ -246,7 +257,7 @@
246
257
  Now you can override configuration like `useDefineForClassFields` using `tools.swc`.
247
258
 
248
259
  ```js
249
- import { defineConfig } from '@lynx-js/rspeedy'
260
+ import { defineConfig } from "@lynx-js/rspeedy";
250
261
 
251
262
  export default defineConfig({
252
263
  tools: {
@@ -258,7 +269,7 @@
258
269
  },
259
270
  },
260
271
  },
261
- })
272
+ });
262
273
  ```
263
274
 
264
275
  - Updated dependencies [[`f1ca29b`](https://github.com/lynx-family/lynx-stack/commit/f1ca29bd766377dd46583f15e1e75bca447699cd)]:
@@ -434,7 +445,7 @@
434
445
  You may turn it off using `output.minify.css: false`:
435
446
 
436
447
  ```js
437
- import { defineConfig } from '@lynx-js/rspeedy'
448
+ import { defineConfig } from "@lynx-js/rspeedy";
438
449
 
439
450
  export default defineConfig({
440
451
  output: {
@@ -442,18 +453,18 @@
442
453
  css: false,
443
454
  },
444
455
  },
445
- })
456
+ });
446
457
  ```
447
458
 
448
459
  Or you may use [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) to use `cssnano` as CSS minimizer.
449
460
 
450
461
  ```js
451
- import { defineConfig } from '@lynx-js/rspeedy'
452
- import { pluginCssMinimizer } from '@rsbuild/plugin-css-minimizer'
462
+ import { defineConfig } from "@lynx-js/rspeedy";
463
+ import { pluginCssMinimizer } from "@rsbuild/plugin-css-minimizer";
453
464
 
454
465
  export default defineConfig({
455
466
  plugins: [pluginCssMinimizer()],
456
- })
467
+ });
457
468
  ```
458
469
 
459
470
  ### Patch Changes
@@ -533,18 +544,18 @@
533
544
  - e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
534
545
 
535
546
  ```js
536
- import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
537
- import { defineConfig } from '@lynx-js/rspeedy'
547
+ import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
548
+ import { defineConfig } from "@lynx-js/rspeedy";
538
549
 
539
550
  export default defineConfig({
540
551
  plugins: [
541
552
  pluginReactLynx({
542
553
  defineDCE: {
543
- __SOME_FALSE_DEFINE__: 'false',
554
+ __SOME_FALSE_DEFINE__: "false",
544
555
  },
545
556
  }),
546
557
  ],
547
- })
558
+ });
548
559
  ```
549
560
 
550
561
  Different from `define` provided by bundlers like webpack, `defineDCE` works at transform time and a extra DCE (Dead Code Elimination) pass will be performed.
@@ -552,20 +563,20 @@
552
563
  For example, `import` initialized by dead code will be removed:
553
564
 
554
565
  ```js
555
- import { foo } from 'bar'
566
+ import { foo } from "bar";
556
567
 
557
568
  if (__SOME_FALSE_DEFINE__) {
558
- foo()
559
- console.log('dead code')
569
+ foo();
570
+ console.log("dead code");
560
571
  } else {
561
- console.log('reachable code')
572
+ console.log("reachable code");
562
573
  }
563
574
  ```
564
575
 
565
576
  will be transformed to:
566
577
 
567
578
  ```js
568
- console.log('reachable code')
579
+ console.log("reachable code");
569
580
  ```
570
581
 
571
582
  - Updated dependencies [8dd6cca]
@@ -608,18 +619,18 @@
608
619
  - a30c83d: Add `compat.removeComponentAttrRegex`.
609
620
 
610
621
  ```js
611
- import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
612
- import { defineConfig } from '@lynx-js/rspeedy'
622
+ import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
623
+ import { defineConfig } from "@lynx-js/rspeedy";
613
624
 
614
625
  export default defineConfig({
615
626
  plugins: [
616
627
  pluginReactLynx({
617
628
  compat: {
618
- removeComponentAttrRegex: 'YOUR REGEX',
629
+ removeComponentAttrRegex: "YOUR REGEX",
619
630
  },
620
631
  }),
621
632
  ],
622
- })
633
+ });
623
634
  ```
624
635
 
625
636
  NOTE: This feature is deprecated and will be removed in the future. Use CodeMod instead.
@@ -638,11 +649,11 @@
638
649
 
639
650
  ```javascript
640
651
  // bar.ts
641
- import 'background-only'
652
+ import "background-only";
642
653
 
643
654
  export const bar = () => {
644
- return 'bar'
645
- }
655
+ return "bar";
656
+ };
646
657
  ```
647
658
 
648
659
  If `bar` is called in `main-thread`, build time error will be triggered.
@@ -651,15 +662,15 @@
651
662
 
652
663
  ```tsx
653
664
  // App.tsx
654
- import { bar } from './bar.js'
665
+ import { bar } from "./bar.js";
655
666
 
656
667
  function App() {
657
- bar()
668
+ bar();
658
669
  return (
659
670
  <view>
660
671
  <text>Hello, Lynx x rspeedy</text>
661
672
  </view>
662
- )
673
+ );
663
674
  }
664
675
  ```
665
676
 
package/dist/index.js CHANGED
@@ -390,6 +390,7 @@ function applyEntry(api, options) {
390
390
  }
391
391
  if (isWeb) chain.plugin(PLUGIN_NAME_WEB).use(WebEncodePlugin, []).end();
392
392
  const rsbuildConfig = api.getRsbuildConfig();
393
+ const userConfig = api.getRsbuildConfig('original');
393
394
  let extractStr = originalExtractStr;
394
395
  if (rsbuildConfig.performance?.chunkSplit?.strategy !== 'all-in-one' && originalExtractStr) {
395
396
  logger.warn('`extractStr` is changed to `false` because it is only supported in `all-in-one` chunkSplit strategy, please set `performance.chunkSplit.strategy` to `all-in-one` to use `extractStr.`');
@@ -403,11 +404,23 @@ function applyEntry(api, options) {
403
404
  mainThreadChunks,
404
405
  extractStr,
405
406
  experimental_isLazyBundle,
406
- profile: rsbuildConfig.performance?.profile
407
+ profile: getDefaultProfile()
407
408
  }
408
409
  ]);
410
+ function getDefaultProfile() {
411
+ if (userConfig.performance?.profile !== void 0) return userConfig.performance.profile;
412
+ if (isDebug()) return true;
413
+ }
409
414
  });
410
415
  }
416
+ const isDebug = ()=>{
417
+ if (!process.env['DEBUG']) return false;
418
+ const values = process.env['DEBUG'].toLocaleLowerCase().split(',');
419
+ return [
420
+ 'rspeedy',
421
+ '*'
422
+ ].some((key)=>values.includes(key));
423
+ };
411
424
  function getChunks(entryName, entryValue) {
412
425
  const chunks = [
413
426
  entryName
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-rsbuild-plugin-canary",
3
- "version": "0.10.8",
3
+ "version": "0.10.9-canary-20250721-a3ae4c5e",
4
4
  "description": "A rsbuild plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -33,9 +33,9 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@lynx-js/css-extract-webpack-plugin": "npm:@lynx-js/css-extract-webpack-plugin-canary@0.6.0",
36
- "@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.10.8",
36
+ "@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.10.9-canary-20250721-a3ae4c5e",
37
37
  "@lynx-js/react-refresh-webpack-plugin": "npm:@lynx-js/react-refresh-webpack-plugin-canary@0.3.4",
38
- "@lynx-js/react-webpack-plugin": "npm:@lynx-js/react-webpack-plugin-canary@0.6.18",
38
+ "@lynx-js/react-webpack-plugin": "npm:@lynx-js/react-webpack-plugin-canary@0.6.19-canary-20250721-a3ae4c5e",
39
39
  "@lynx-js/runtime-wrapper-webpack-plugin": "npm:@lynx-js/runtime-wrapper-webpack-plugin-canary@0.1.2",
40
40
  "@lynx-js/template-webpack-plugin": "npm:@lynx-js/template-webpack-plugin-canary@0.8.2",
41
41
  "@lynx-js/use-sync-external-store": "npm:@lynx-js/use-sync-external-store-canary@1.5.0",
@@ -56,7 +56,7 @@
56
56
  "typia-rspack-plugin": "2.1.0",
57
57
  "@lynx-js/react": "npm:@lynx-js/react-canary@0.111.2",
58
58
  "@lynx-js/react-transform": "0.2.0",
59
- "@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.10.2",
59
+ "@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.10.3-canary-20250721-a3ae4c5e",
60
60
  "@lynx-js/vitest-setup": "0.0.0"
61
61
  },
62
62
  "peerDependencies": {