@lynx-js/react-rsbuild-plugin 0.11.1 → 0.11.3

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/react-rsbuild-plugin
2
2
 
3
+ ## 0.11.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`96545dd`](https://github.com/lynx-family/lynx-stack/commit/96545dd9f966c07aa64437aefc781a9f3e260861)]:
8
+ - @lynx-js/template-webpack-plugin@0.9.1
9
+ - @lynx-js/css-extract-webpack-plugin@0.6.4
10
+ - @lynx-js/react-webpack-plugin@0.7.1
11
+ - @lynx-js/react-alias-rsbuild-plugin@0.11.3
12
+
13
+ ## 0.11.2
14
+
15
+ ### Patch Changes
16
+
17
+ - Fix using wrong version of `@lynx-js/react/refresh`. ([#1756](https://github.com/lynx-family/lynx-stack/pull/1756))
18
+
19
+ - Updated dependencies []:
20
+ - @lynx-js/react-alias-rsbuild-plugin@0.11.2
21
+ - @lynx-js/use-sync-external-store@1.5.0
22
+ - @lynx-js/react-refresh-webpack-plugin@0.3.4
23
+ - @lynx-js/react-webpack-plugin@0.7.1
24
+
3
25
  ## 0.11.1
4
26
 
5
27
  ### Patch Changes
package/dist/index.js CHANGED
@@ -512,20 +512,30 @@ function applyLoaders(api, options) {
512
512
  });
513
513
  }
514
514
  const PLUGIN_NAME_REACT_REFRESH = 'lynx:react:refresh';
515
- const refresh_require = createRequire(import.meta.url);
516
515
  function applyRefresh(api) {
517
- api.modifyWebpackChain((chain, { CHAIN_ID, isProd })=>{
518
- if (!isProd) applyRefreshRules(chain, CHAIN_ID, ReactRefreshWebpackPlugin);
516
+ api.modifyWebpackChain(async (chain, { CHAIN_ID, isProd })=>{
517
+ if (!isProd) await applyRefreshRules(api, chain, CHAIN_ID, ReactRefreshWebpackPlugin);
519
518
  });
520
- api.modifyBundlerChain((chain, { isProd, CHAIN_ID })=>{
519
+ api.modifyBundlerChain(async (chain, { isProd, CHAIN_ID })=>{
521
520
  if (!isProd) {
522
- applyRefreshRules(chain, CHAIN_ID, ReactRefreshRspackPlugin);
523
- chain.resolve.alias.set('@lynx-js/react/refresh$', refresh_require.resolve('@lynx-js/react/refresh')).end();
521
+ const { resolve } = api.useExposed(Symbol.for('@lynx-js/react/internal:resolve'));
522
+ await Promise.all([
523
+ applyRefreshRules(api, chain, CHAIN_ID, ReactRefreshRspackPlugin),
524
+ resolve('@lynx-js/react/refresh').then((refresh)=>{
525
+ chain.resolve.alias.set('@lynx-js/react/refresh$', refresh);
526
+ })
527
+ ]);
524
528
  }
525
529
  });
526
530
  }
527
- function applyRefreshRules(chain, CHAIN_ID, ReactRefreshPlugin) {
528
- chain.plugin(PLUGIN_NAME_REACT_REFRESH).before(CHAIN_ID.PLUGIN.HMR).use(ReactRefreshPlugin).end().module.rule('react:refresh').issuerLayer(LAYERS.BACKGROUND).before(CHAIN_ID.RULE.JS).test(/\.[jt]sx$/).exclude.add(/node_modules/).add(external_node_path_["default"].dirname(refresh_require.resolve('@lynx-js/react/package.json'))).add(external_node_path_["default"].dirname(refresh_require.resolve('@lynx-js/react/refresh'))).add(external_node_path_["default"].dirname(refresh_require.resolve('@lynx-js/react/worklet-runtime'))).add(ReactRefreshPlugin.loader).end().use('ReactRefresh').loader(ReactRefreshPlugin.loader).options({}).end().end().end().end();
531
+ async function applyRefreshRules(api, chain, CHAIN_ID, ReactRefreshPlugin) {
532
+ const { resolve } = api.useExposed(Symbol.for('@lynx-js/react/internal:resolve'));
533
+ const [reactRuntime, refresh, workletRuntime] = await Promise.all([
534
+ resolve('@lynx-js/react/package.json'),
535
+ resolve('@lynx-js/react/refresh'),
536
+ resolve('@lynx-js/react/worklet-runtime')
537
+ ]);
538
+ chain.plugin(PLUGIN_NAME_REACT_REFRESH).before(CHAIN_ID.PLUGIN.HMR).use(ReactRefreshPlugin).end().module.rule('react:refresh').issuerLayer(LAYERS.BACKGROUND).before(CHAIN_ID.RULE.JS).test(/\.[jt]sx$/).exclude.add(/node_modules/).add(external_node_path_["default"].dirname(reactRuntime)).add(external_node_path_["default"].dirname(refresh)).add(external_node_path_["default"].dirname(workletRuntime)).add(ReactRefreshPlugin.loader).end().use('ReactRefresh').loader(ReactRefreshPlugin.loader).options({}).end().end().end().end();
529
539
  }
530
540
  const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj);
531
541
  const applySplitChunksRule = (api)=>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-rsbuild-plugin",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
4
4
  "description": "A rsbuild plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -33,29 +33,29 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@lynx-js/css-extract-webpack-plugin": "0.6.4",
36
- "@lynx-js/react-alias-rsbuild-plugin": "0.11.1",
36
+ "@lynx-js/react-alias-rsbuild-plugin": "0.11.3",
37
37
  "@lynx-js/react-refresh-webpack-plugin": "0.3.4",
38
38
  "@lynx-js/react-webpack-plugin": "0.7.1",
39
39
  "@lynx-js/runtime-wrapper-webpack-plugin": "0.1.3",
40
- "@lynx-js/template-webpack-plugin": "0.9.0",
40
+ "@lynx-js/template-webpack-plugin": "0.9.1",
41
41
  "@lynx-js/use-sync-external-store": "1.5.0",
42
42
  "background-only": "^0.0.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@microsoft/api-extractor": "7.52.15",
46
46
  "@rollup/plugin-typescript": "^12.1.4",
47
- "@rsbuild/core": "1.5.13",
47
+ "@rsbuild/core": "1.5.17",
48
48
  "@rsbuild/plugin-sass": "1.4.0",
49
49
  "@rsbuild/plugin-typed-css-modules": "1.1.1",
50
50
  "rsbuild-plugin-arethetypeswrong": "0.1.1",
51
51
  "rsbuild-plugin-publint": "0.3.3",
52
52
  "tailwindcss": "^3.4.17",
53
- "type-fest": "^4.41.0",
53
+ "type-fest": "^5.0.1",
54
54
  "typia": "9.7.2",
55
55
  "typia-rspack-plugin": "2.2.2",
56
- "@lynx-js/react": "0.114.1",
56
+ "@lynx-js/react": "0.114.3",
57
57
  "@lynx-js/react-transform": "0.2.0",
58
- "@lynx-js/rspeedy": "0.11.5",
58
+ "@lynx-js/rspeedy": "0.11.8",
59
59
  "@lynx-js/vitest-setup": "0.0.0"
60
60
  },
61
61
  "peerDependencies": {