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

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,62 @@
1
1
  # @lynx-js/react-rsbuild-plugin
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - **BREAKING CHANGE**: Require `@lynx-js/rspeedy` 0.12.0. ([#1951](https://github.com/lynx-family/lynx-stack/pull/1951))
8
+
9
+ ### Patch Changes
10
+
11
+ - Support Yarn Plug'n'Play. ([#1964](https://github.com/lynx-family/lynx-stack/pull/1964))
12
+
13
+ - Updated dependencies [[`738d44d`](https://github.com/lynx-family/lynx-stack/commit/738d44d685870d7c3f64a1be7139e8d7af498feb), [`5bbb439`](https://github.com/lynx-family/lynx-stack/commit/5bbb43981580f917f59819cd4ff7972b9737a341), [`3692a16`](https://github.com/lynx-family/lynx-stack/commit/3692a169ae443124de0e9f7a288318f5dfba13b0), [`d2e290b`](https://github.com/lynx-family/lynx-stack/commit/d2e290b67971ead5bedbcc1e34dd7f3bf4a6f5f3), [`738d44d`](https://github.com/lynx-family/lynx-stack/commit/738d44d685870d7c3f64a1be7139e8d7af498feb)]:
14
+ - @lynx-js/react-alias-rsbuild-plugin@0.12.0
15
+ - @lynx-js/css-extract-webpack-plugin@0.6.5
16
+ - @lynx-js/template-webpack-plugin@0.9.2
17
+ - @lynx-js/use-sync-external-store@1.5.0
18
+ - @lynx-js/react-refresh-webpack-plugin@0.3.4
19
+ - @lynx-js/react-webpack-plugin@0.7.2
20
+
21
+ ## 0.11.4
22
+
23
+ ### Patch Changes
24
+
25
+ - When engineVersion is greater than or equal to 3.1, use `__SetAttribute` to set text attribute for text node instead of creating a raw text node. ([#1880](https://github.com/lynx-family/lynx-stack/pull/1880))
26
+
27
+ - Add `react-compiler-runtime` to `resolve.dedupe`. ([#1269](https://github.com/lynx-family/lynx-stack/pull/1269))
28
+
29
+ With this change you can setup [React Compiler](https://react.dev/learn/react-compiler) for ReactLynx by `pluginBabel`:
30
+
31
+ ```js
32
+ import { defineConfig } from '@lynx-js/rspeedy'
33
+ import { pluginBabel } from '@rsbuild/plugin-babel'
34
+
35
+ export default defineConfig({
36
+ plugins: [
37
+ pluginBabel({
38
+ include: /\.(?:jsx|tsx)$/,
39
+ babelLoaderOptions(opts) {
40
+ opts.plugins?.unshift([
41
+ 'babel-plugin-react-compiler',
42
+ // See https://react.dev/reference/react-compiler/configuration for config
43
+ {
44
+ // ReactLynx only supports target to version 17
45
+ target: '17',
46
+ },
47
+ ])
48
+ },
49
+ }),
50
+ ],
51
+ })
52
+ ```
53
+
54
+ - Updated dependencies [[`e7d186a`](https://github.com/lynx-family/lynx-stack/commit/e7d186a6fcf08fecf18b5ab82b004b955bb1a2b3), [`0d7a4c3`](https://github.com/lynx-family/lynx-stack/commit/0d7a4c3d49d63e30d5f05c372ef99ee5cf2fcadd)]:
55
+ - @lynx-js/react-webpack-plugin@0.7.2
56
+ - @lynx-js/react-alias-rsbuild-plugin@0.11.4
57
+ - @lynx-js/use-sync-external-store@1.5.0
58
+ - @lynx-js/react-refresh-webpack-plugin@0.3.4
59
+
3
60
  ## 0.11.3
4
61
 
5
62
  ### Patch Changes
package/dist/300.js ADDED
@@ -0,0 +1,34 @@
1
+ export const __webpack_id__ = "300";
2
+ export const __webpack_ids__ = [
3
+ "300"
4
+ ];
5
+ export const __webpack_modules__ = {
6
+ "./src/resolve.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.d(__webpack_exports__, {
8
+ getImportResolver: ()=>getImportResolver,
9
+ getMainThreadResolver: ()=>getMainThreadResolver
10
+ });
11
+ var node_path__rspack_import_0 = __webpack_require__("node:path");
12
+ var node_url__rspack_import_1 = __webpack_require__("node:url");
13
+ var _lynx_js_react_alias_rsbuild_plugin__rspack_import_2 = __webpack_require__("@lynx-js/react-alias-rsbuild-plugin");
14
+ const __dirname = node_path__rspack_import_0["default"].dirname((0, node_url__rspack_import_1.fileURLToPath)(import.meta.url));
15
+ const getImportResolver = (()=>{
16
+ let resolver = null;
17
+ return (rspack)=>{
18
+ resolver ??= (0, _lynx_js_react_alias_rsbuild_plugin__rspack_import_2.createLazyResolver)(rspack, __dirname, [
19
+ 'import'
20
+ ]);
21
+ return resolver;
22
+ };
23
+ })();
24
+ const getMainThreadResolver = (()=>{
25
+ let resolver = null;
26
+ return (rspack)=>{
27
+ resolver ??= (0, _lynx_js_react_alias_rsbuild_plugin__rspack_import_2.createLazyResolver)(rspack, __dirname, [
28
+ 'lepus'
29
+ ]);
30
+ return resolver;
31
+ };
32
+ })();
33
+ }
34
+ };
package/dist/index.d.ts CHANGED
@@ -441,7 +441,7 @@ export declare interface PluginReactLynxOptions {
441
441
  *
442
442
  * These options should only be used for migrating from ReactLynx2.0.
443
443
  */
444
- compat?: (Partial<CompatVisitorConfig> & {
444
+ compat?: Partial<CompatVisitorConfig> & {
445
445
  /**
446
446
  * Whether disable runtime warnings about using ReactLynx2.0-incompatible `SelectorQuery` APIs.
447
447
  *
@@ -458,7 +458,7 @@ export declare interface PluginReactLynxOptions {
458
458
  * @defaultValue `false`
459
459
  */
460
460
  disableCreateSelectorQueryIncompatibleWarning?: boolean;
461
- }) | undefined;
461
+ } | undefined;
462
462
  /**
463
463
  * When {@link PluginReactLynxOptions.enableCSSInheritance} is enabled, `customCSSInheritanceList` can control which properties are inheritable, not just the default ones.
464
464
  *
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__ from "@lynx-js/react-alias-rsbuild-plugin";
2
- import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
3
- import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
1
+ import * as __rspack_external__lynx_js_react_alias_rsbuild_plugin_2a0391db from "@lynx-js/react-alias-rsbuild-plugin";
2
+ import * as __rspack_external_node_path_c5b9b54f from "node:path";
3
+ import * as __rspack_external_node_url_e96de089 from "node:url";
4
4
  import { createRequire } from "node:module";
5
5
  import { LAYERS, ReactWebpackPlugin } from "@lynx-js/react-webpack-plugin";
6
6
  import { RuntimeWrapperWebpackPlugin } from "@lynx-js/runtime-wrapper-webpack-plugin";
@@ -63,13 +63,13 @@ var __webpack_modules__ = {
63
63
  exports._assertGuard = _assertGuard;
64
64
  },
65
65
  "@lynx-js/react-alias-rsbuild-plugin": function(module) {
66
- module.exports = __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__;
66
+ module.exports = __rspack_external__lynx_js_react_alias_rsbuild_plugin_2a0391db;
67
67
  },
68
68
  "node:path": function(module) {
69
- module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
69
+ module.exports = __rspack_external_node_path_c5b9b54f;
70
70
  },
71
71
  "node:url": function(module) {
72
- module.exports = __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__;
72
+ module.exports = __rspack_external_node_url_e96de089;
73
73
  },
74
74
  "../../../node_modules/.pnpm/typia@9.7.2_typescript@5.9.3/node_modules/typia/lib/TypeGuardError.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
75
75
  __webpack_require__.r(__webpack_exports__);
@@ -187,9 +187,11 @@ const DETECT_IMPORT_ERROR = 'react:detect-import-error';
187
187
  const ALIAS_BACKGROUND_ONLY_MAIN = 'react:alias-background-only-main';
188
188
  const ALIAS_BACKGROUND_ONLY_BACKGROUND = 'react:alias-background-only-background';
189
189
  function applyBackgroundOnly(api) {
190
- api.modifyBundlerChain(async (chain)=>{
190
+ api.modifyBundlerChain(async (chain, { rspack })=>{
191
191
  const __dirname = external_node_path_["default"].dirname((0, external_node_url_.fileURLToPath)(import.meta.url));
192
- const { resolve, resolveMainThread } = await __webpack_require__.e("856").then(__webpack_require__.bind(__webpack_require__, "./src/resolve.ts"));
192
+ const { getImportResolver, getMainThreadResolver } = await __webpack_require__.e("300").then(__webpack_require__.bind(__webpack_require__, "./src/resolve.ts"));
193
+ const resolve = getImportResolver(rspack);
194
+ const resolveMainThread = getMainThreadResolver(rspack);
193
195
  const [backgroundOnly, backgroundOnlyMainThread] = await Promise.all([
194
196
  resolve('background-only'),
195
197
  resolveMainThread('background-only')
@@ -469,13 +471,8 @@ function applyLazy(api) {
469
471
  });
470
472
  }
471
473
  function applyLoaders(api, options) {
472
- const { compat, enableRemoveCSSScope, shake, defineDCE, experimental_isLazyBundle } = options;
474
+ const { compat, enableRemoveCSSScope, shake, defineDCE, engineVersion, experimental_isLazyBundle } = options;
473
475
  api.modifyBundlerChain((chain, { CHAIN_ID })=>{
474
- const experiments = chain.get('experiments');
475
- chain.experiments({
476
- ...experiments,
477
- layers: true
478
- });
479
476
  const rule = chain.module.rules.get(CHAIN_ID.RULE.JS);
480
477
  const uses = rule.uses.entries() ?? {};
481
478
  const { output } = api.getRsbuildConfig();
@@ -486,7 +483,8 @@ function applyLoaders(api, options) {
486
483
  enableRemoveCSSScope,
487
484
  isDynamicComponent: experimental_isLazyBundle,
488
485
  inlineSourcesContent,
489
- defineDCE
486
+ defineDCE,
487
+ engineVersion
490
488
  }).end();
491
489
  const mainThreadRule = rule.oneOf(LAYERS.MAIN_THREAD);
492
490
  mainThreadRule.issuerLayer(LAYERS.MAIN_THREAD).uses.merge(uses).end().when(void 0 !== uses[CHAIN_ID.USE.SWC], (rule)=>{
@@ -505,6 +503,7 @@ function applyLoaders(api, options) {
505
503
  enableRemoveCSSScope,
506
504
  inlineSourcesContent,
507
505
  isDynamicComponent: experimental_isLazyBundle,
506
+ engineVersion,
508
507
  shake,
509
508
  defineDCE
510
509
  }).end();
@@ -600,8 +599,9 @@ function applySWC(api) {
600
599
  }, config));
601
600
  }
602
601
  function applyUseSyncExternalStore(api) {
603
- api.modifyBundlerChain(async (chain)=>{
604
- const { resolve } = await __webpack_require__.e("856").then(__webpack_require__.bind(__webpack_require__, "./src/resolve.ts"));
602
+ api.modifyBundlerChain(async (chain, { rspack })=>{
603
+ const { getImportResolver } = await __webpack_require__.e("300").then(__webpack_require__.bind(__webpack_require__, "./src/resolve.ts"));
604
+ const resolve = getImportResolver(rspack);
605
605
  const useSyncExternalStoreEntries = [
606
606
  'use-sync-external-store',
607
607
  'use-sync-external-store/with-selector',
@@ -1227,11 +1227,6 @@ function pluginReactLynx(userOptions) {
1227
1227
  ]
1228
1228
  }
1229
1229
  });
1230
- if (void 0 === userConfig.output?.inlineScripts) config = mergeRsbuildConfig(config, {
1231
- output: {
1232
- inlineScripts: true
1233
- }
1234
- });
1235
1230
  config = mergeRsbuildConfig({
1236
1231
  tools: {
1237
1232
  rspack: {
@@ -1241,6 +1236,13 @@ function pluginReactLynx(userOptions) {
1241
1236
  }
1242
1237
  }
1243
1238
  }, config);
1239
+ config = mergeRsbuildConfig({
1240
+ resolve: {
1241
+ dedupe: [
1242
+ 'react-compiler-runtime'
1243
+ ]
1244
+ }
1245
+ }, config);
1244
1246
  return config;
1245
1247
  });
1246
1248
  if (resolvedOptions.experimental_isLazyBundle) applyLazy(api);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-rsbuild-plugin",
3
- "version": "0.11.3",
3
+ "version": "0.12.0",
4
4
  "description": "A rsbuild plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -32,34 +32,35 @@
32
32
  "README.md"
33
33
  ],
34
34
  "dependencies": {
35
- "@lynx-js/css-extract-webpack-plugin": "0.6.4",
36
- "@lynx-js/react-alias-rsbuild-plugin": "0.11.3",
35
+ "@lynx-js/css-extract-webpack-plugin": "0.6.5",
36
+ "@lynx-js/react-alias-rsbuild-plugin": "0.12.0",
37
37
  "@lynx-js/react-refresh-webpack-plugin": "0.3.4",
38
- "@lynx-js/react-webpack-plugin": "0.7.1",
38
+ "@lynx-js/react-webpack-plugin": "0.7.2",
39
39
  "@lynx-js/runtime-wrapper-webpack-plugin": "0.1.3",
40
- "@lynx-js/template-webpack-plugin": "0.9.1",
40
+ "@lynx-js/template-webpack-plugin": "0.9.2",
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.17",
47
+ "@rsbuild/core": "1.6.9",
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
+ "source-map": "^0.7.6",
52
53
  "tailwindcss": "^3.4.17",
53
54
  "type-fest": "^5.0.1",
54
55
  "typia": "9.7.2",
55
56
  "typia-rspack-plugin": "2.2.2",
56
- "@lynx-js/react": "0.114.3",
57
+ "@lynx-js/react": "0.115.0",
57
58
  "@lynx-js/react-transform": "0.2.0",
58
- "@lynx-js/rspeedy": "0.11.8",
59
+ "@lynx-js/rspeedy": "0.12.1",
59
60
  "@lynx-js/vitest-setup": "0.0.0"
60
61
  },
61
62
  "peerDependencies": {
62
- "@lynx-js/react": "^0.103.0 || ^0.104.0 || ^0.105.0 || ^0.106.0 || ^0.107.0 || ^0.108.0 || ^0.109.0 || ^0.110.0 || ^0.111.0 || ^0.112.0 || ^0.113.0 || ^0.114.0"
63
+ "@lynx-js/react": "^0.103.0 || ^0.104.0 || ^0.105.0 || ^0.106.0 || ^0.107.0 || ^0.108.0 || ^0.109.0 || ^0.110.0 || ^0.111.0 || ^0.112.0 || ^0.113.0 || ^0.114.0 || ^0.115.0"
63
64
  },
64
65
  "peerDependenciesMeta": {
65
66
  "@lynx-js/react": {
package/dist/856.js DELETED
@@ -1,22 +0,0 @@
1
- export const __webpack_id__ = "856";
2
- export const __webpack_ids__ = [
3
- "856"
4
- ];
5
- export const __webpack_modules__ = {
6
- "./src/resolve.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
- __webpack_require__.d(__webpack_exports__, {
8
- resolve: ()=>resolve,
9
- resolveMainThread: ()=>resolveMainThread
10
- });
11
- var node_path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:path");
12
- var node_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("node:url");
13
- var _lynx_js_react_alias_rsbuild_plugin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("@lynx-js/react-alias-rsbuild-plugin");
14
- const __dirname = node_path__WEBPACK_IMPORTED_MODULE_0__["default"].dirname((0, node_url__WEBPACK_IMPORTED_MODULE_1__.fileURLToPath)(import.meta.url));
15
- const resolve = (0, _lynx_js_react_alias_rsbuild_plugin__WEBPACK_IMPORTED_MODULE_2__.createLazyResolver)(__dirname, [
16
- 'import'
17
- ]);
18
- const resolveMainThread = (0, _lynx_js_react_alias_rsbuild_plugin__WEBPACK_IMPORTED_MODULE_2__.createLazyResolver)(__dirname, [
19
- 'lepus'
20
- ]);
21
- }
22
- };