@lynx-js/react-rsbuild-plugin-canary 0.12.1 → 0.12.2-canary-20251216-e38e21a1

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,14 @@
1
1
  # @lynx-js/react-rsbuild-plugin
2
2
 
3
+ ## 0.12.2-canary-20251216115050-e38e21a13bc43472da91f99f6cc60266d7e0de8b
4
+
5
+ ### Patch Changes
6
+
7
+ - Support environment variants to enable multiple configurations for the same targets. ([#1969](https://github.com/lynx-family/lynx-stack/pull/1969))
8
+
9
+ - Updated dependencies []:
10
+ - @lynx-js/react-alias-rsbuild-plugin@0.12.2-canary-20251216115050-e38e21a13bc43472da91f99f6cc60266d7e0de8b
11
+
3
12
  ## 0.12.1
4
13
 
5
14
  ### Patch Changes
@@ -43,8 +52,8 @@
43
52
  With this change you can setup [React Compiler](https://react.dev/learn/react-compiler) for ReactLynx by `pluginBabel`:
44
53
 
45
54
  ```js
46
- import { defineConfig } from '@lynx-js/rspeedy'
47
- import { pluginBabel } from '@rsbuild/plugin-babel'
55
+ import { defineConfig } from "@lynx-js/rspeedy";
56
+ import { pluginBabel } from "@rsbuild/plugin-babel";
48
57
 
49
58
  export default defineConfig({
50
59
  plugins: [
@@ -52,17 +61,17 @@
52
61
  include: /\.(?:jsx|tsx)$/,
53
62
  babelLoaderOptions(opts) {
54
63
  opts.plugins?.unshift([
55
- 'babel-plugin-react-compiler',
64
+ "babel-plugin-react-compiler",
56
65
  // See https://react.dev/reference/react-compiler/configuration for config
57
66
  {
58
67
  // ReactLynx only supports target to version 17
59
- target: '17',
68
+ target: "17",
60
69
  },
61
- ])
70
+ ]);
62
71
  },
63
72
  }),
64
73
  ],
65
- })
74
+ });
66
75
  ```
67
76
 
68
77
  - Updated dependencies [[`e7d186a`](https://github.com/lynx-family/lynx-stack/commit/e7d186a6fcf08fecf18b5ab82b004b955bb1a2b3), [`0d7a4c3`](https://github.com/lynx-family/lynx-stack/commit/0d7a4c3d49d63e30d5f05c372ef99ee5cf2fcadd)]:
@@ -265,28 +274,28 @@
265
274
 
266
275
  ```ts
267
276
  type InlineChunkTestFunction = (params: {
268
- size: number
269
- name: string
270
- }) => boolean
277
+ size: number;
278
+ name: string;
279
+ }) => boolean;
271
280
 
272
- type InlineChunkTest = RegExp | InlineChunkTestFunction
281
+ type InlineChunkTest = RegExp | InlineChunkTestFunction;
273
282
 
274
283
  type InlineChunkConfig =
275
284
  | boolean
276
285
  | InlineChunkTest
277
- | { enable?: boolean | 'auto', test: InlineChunkTest }
286
+ | { enable?: boolean | "auto"; test: InlineChunkTest };
278
287
  ```
279
288
 
280
289
  ```ts
281
- import { defineConfig } from '@lynx-js/rspeedy'
290
+ import { defineConfig } from "@lynx-js/rspeedy";
282
291
 
283
292
  export default defineConfig({
284
293
  output: {
285
294
  inlineScripts: ({ name, size }) => {
286
- return name.includes('foo') && size < 1000
295
+ return name.includes("foo") && size < 1000;
287
296
  },
288
297
  },
289
- })
298
+ });
290
299
  ```
291
300
 
292
301
  - 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)]:
@@ -366,13 +375,13 @@
366
375
  example:
367
376
 
368
377
  ```js
369
- import { defineConfig } from '@lynx-js/rspeedy'
378
+ import { defineConfig } from "@lynx-js/rspeedy";
370
379
 
371
380
  export default defineConfig({
372
381
  output: {
373
382
  inlineScripts: false,
374
383
  },
375
- })
384
+ });
376
385
  ```
377
386
 
378
387
  - Support `@lynx-js/react` v0.109.0. ([#840](https://github.com/lynx-family/lynx-stack/pull/840))
@@ -459,7 +468,7 @@
459
468
  Now you can override configuration like `useDefineForClassFields` using `tools.swc`.
460
469
 
461
470
  ```js
462
- import { defineConfig } from '@lynx-js/rspeedy'
471
+ import { defineConfig } from "@lynx-js/rspeedy";
463
472
 
464
473
  export default defineConfig({
465
474
  tools: {
@@ -471,7 +480,7 @@
471
480
  },
472
481
  },
473
482
  },
474
- })
483
+ });
475
484
  ```
476
485
 
477
486
  - Updated dependencies [[`f1ca29b`](https://github.com/lynx-family/lynx-stack/commit/f1ca29bd766377dd46583f15e1e75bca447699cd)]:
@@ -647,7 +656,7 @@
647
656
  You may turn it off using `output.minify.css: false`:
648
657
 
649
658
  ```js
650
- import { defineConfig } from '@lynx-js/rspeedy'
659
+ import { defineConfig } from "@lynx-js/rspeedy";
651
660
 
652
661
  export default defineConfig({
653
662
  output: {
@@ -655,18 +664,18 @@
655
664
  css: false,
656
665
  },
657
666
  },
658
- })
667
+ });
659
668
  ```
660
669
 
661
670
  Or you may use [@rsbuild/plugin-css-minimizer](https://github.com/rspack-contrib/rsbuild-plugin-css-minimizer) to use `cssnano` as CSS minimizer.
662
671
 
663
672
  ```js
664
- import { defineConfig } from '@lynx-js/rspeedy'
665
- import { pluginCssMinimizer } from '@rsbuild/plugin-css-minimizer'
673
+ import { defineConfig } from "@lynx-js/rspeedy";
674
+ import { pluginCssMinimizer } from "@rsbuild/plugin-css-minimizer";
666
675
 
667
676
  export default defineConfig({
668
677
  plugins: [pluginCssMinimizer()],
669
- })
678
+ });
670
679
  ```
671
680
 
672
681
  ### Patch Changes
@@ -746,18 +755,18 @@
746
755
  - e8039f2: Add `defineDCE` in plugin options. Often used to define custom macros.
747
756
 
748
757
  ```js
749
- import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
750
- import { defineConfig } from '@lynx-js/rspeedy'
758
+ import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
759
+ import { defineConfig } from "@lynx-js/rspeedy";
751
760
 
752
761
  export default defineConfig({
753
762
  plugins: [
754
763
  pluginReactLynx({
755
764
  defineDCE: {
756
- __SOME_FALSE_DEFINE__: 'false',
765
+ __SOME_FALSE_DEFINE__: "false",
757
766
  },
758
767
  }),
759
768
  ],
760
- })
769
+ });
761
770
  ```
762
771
 
763
772
  Different from `define` provided by bundlers like webpack, `defineDCE` works at transform time and a extra DCE (Dead Code Elimination) pass will be performed.
@@ -765,20 +774,20 @@
765
774
  For example, `import` initialized by dead code will be removed:
766
775
 
767
776
  ```js
768
- import { foo } from 'bar'
777
+ import { foo } from "bar";
769
778
 
770
779
  if (__SOME_FALSE_DEFINE__) {
771
- foo()
772
- console.log('dead code')
780
+ foo();
781
+ console.log("dead code");
773
782
  } else {
774
- console.log('reachable code')
783
+ console.log("reachable code");
775
784
  }
776
785
  ```
777
786
 
778
787
  will be transformed to:
779
788
 
780
789
  ```js
781
- console.log('reachable code')
790
+ console.log("reachable code");
782
791
  ```
783
792
 
784
793
  - Updated dependencies [8dd6cca]
@@ -821,18 +830,18 @@
821
830
  - a30c83d: Add `compat.removeComponentAttrRegex`.
822
831
 
823
832
  ```js
824
- import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
825
- import { defineConfig } from '@lynx-js/rspeedy'
833
+ import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
834
+ import { defineConfig } from "@lynx-js/rspeedy";
826
835
 
827
836
  export default defineConfig({
828
837
  plugins: [
829
838
  pluginReactLynx({
830
839
  compat: {
831
- removeComponentAttrRegex: 'YOUR REGEX',
840
+ removeComponentAttrRegex: "YOUR REGEX",
832
841
  },
833
842
  }),
834
843
  ],
835
- })
844
+ });
836
845
  ```
837
846
 
838
847
  NOTE: This feature is deprecated and will be removed in the future. Use CodeMod instead.
@@ -851,11 +860,11 @@
851
860
 
852
861
  ```javascript
853
862
  // bar.ts
854
- import 'background-only'
863
+ import "background-only";
855
864
 
856
865
  export const bar = () => {
857
- return 'bar'
858
- }
866
+ return "bar";
867
+ };
859
868
  ```
860
869
 
861
870
  If `bar` is called in `main-thread`, build time error will be triggered.
@@ -864,15 +873,15 @@
864
873
 
865
874
  ```tsx
866
875
  // App.tsx
867
- import { bar } from './bar.js'
876
+ import { bar } from "./bar.js";
868
877
 
869
878
  function App() {
870
- bar()
879
+ bar();
871
880
  return (
872
881
  <view>
873
882
  <text>Hello, Lynx x rspeedy</text>
874
883
  </view>
875
- )
884
+ );
876
885
  }
877
886
  ```
878
887
 
package/dist/index.js CHANGED
@@ -290,8 +290,8 @@ function applyEntry(api, options) {
290
290
  const { config, logger } = api.useExposed(Symbol.for('rspeedy.api'));
291
291
  api.modifyBundlerChain(async (chain, { environment, isDev, isProd })=>{
292
292
  const entries = chain.entryPoints.entries() ?? {};
293
- const isLynx = 'lynx' === environment.name;
294
- const isWeb = 'web' === environment.name;
293
+ const isLynx = 'lynx' === environment.name || environment.name.startsWith('lynx-');
294
+ const isWeb = 'web' === environment.name || environment.name.startsWith('web-');
295
295
  const { hmr, liveReload } = environment.config.dev ?? {};
296
296
  const enabledHMR = isDev && !isWeb && false !== hmr;
297
297
  const enabledLiveReload = isDev && !isWeb && false !== liveReload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-rsbuild-plugin-canary",
3
- "version": "0.12.1",
3
+ "version": "0.12.2-canary-20251216-e38e21a1",
4
4
  "description": "A rsbuild plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -33,7 +33,7 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@lynx-js/css-extract-webpack-plugin": "npm:@lynx-js/css-extract-webpack-plugin-canary@0.7.0",
36
- "@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.12.1",
36
+ "@lynx-js/react-alias-rsbuild-plugin": "npm:@lynx-js/react-alias-rsbuild-plugin-canary@0.12.2-canary-20251216-e38e21a1",
37
37
  "@lynx-js/react-refresh-webpack-plugin": "npm:@lynx-js/react-refresh-webpack-plugin-canary@0.3.4",
38
38
  "@lynx-js/react-webpack-plugin": "npm:@lynx-js/react-webpack-plugin-canary@0.7.3",
39
39
  "@lynx-js/runtime-wrapper-webpack-plugin": "npm:@lynx-js/runtime-wrapper-webpack-plugin-canary@0.1.3",
@@ -54,10 +54,10 @@
54
54
  "type-fest": "^5.0.1",
55
55
  "typia": "9.7.2",
56
56
  "typia-rspack-plugin": "2.2.2",
57
+ "@lynx-js/react": "npm:@lynx-js/react-canary@0.115.1",
57
58
  "@lynx-js/react-transform": "0.2.0",
58
- "@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.12.2",
59
- "@lynx-js/vitest-setup": "0.0.0",
60
- "@lynx-js/react": "npm:@lynx-js/react-canary@0.115.1"
59
+ "@lynx-js/rspeedy": "npm:@lynx-js/rspeedy-canary@0.12.3-canary-20251216-e38e21a1",
60
+ "@lynx-js/vitest-setup": "0.0.0"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@lynx-js/react": "*"