@lynx-js/react-rsbuild-plugin 0.10.12 → 0.10.13

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,24 @@
1
1
  # @lynx-js/react-rsbuild-plugin
2
2
 
3
+ ## 0.10.13
4
+
5
+ ### Patch Changes
6
+
7
+ - Support using multiple times in different environments. ([#1498](https://github.com/lynx-family/lynx-stack/pull/1498))
8
+
9
+ - Support caching Lynx native events when chunk splitting is enabled. ([#1370](https://github.com/lynx-family/lynx-stack/pull/1370))
10
+
11
+ When `performance.chunkSplit.strategy` is not `all-in-one`, Lynx native events are cached until the BTS chunk is fully loaded and are replayed when that chunk is ready. The `firstScreenSyncTiming` flag will no longer change to `jsReady` anymore.
12
+
13
+ - Updated dependencies [[`f0d483c`](https://github.com/lynx-family/lynx-stack/commit/f0d483ca2d3e208a618727590061b0babc075737), [`e4d116b`](https://github.com/lynx-family/lynx-stack/commit/e4d116b6e5eaf49ced08c505c99f7e878a58dfb1), [`d33c1d2`](https://github.com/lynx-family/lynx-stack/commit/d33c1d27827f5e1ebc553447dabe5080671de94a)]:
14
+ - @lynx-js/react-alias-rsbuild-plugin@0.10.13
15
+ - @lynx-js/template-webpack-plugin@0.8.5
16
+ - @lynx-js/react-webpack-plugin@0.6.20
17
+ - @lynx-js/runtime-wrapper-webpack-plugin@0.1.3
18
+ - @lynx-js/use-sync-external-store@1.5.0
19
+ - @lynx-js/react-refresh-webpack-plugin@0.3.4
20
+ - @lynx-js/css-extract-webpack-plugin@0.6.2
21
+
3
22
  ## 0.10.12
4
23
 
5
24
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -426,7 +426,7 @@ export { LAYERS }
426
426
  *
427
427
  * @public
428
428
  */
429
- export declare function pluginReactLynx(userOptions?: PluginReactLynxOptions): RsbuildPlugin;
429
+ export declare function pluginReactLynx(userOptions?: PluginReactLynxOptions): RsbuildPlugin[];
430
430
 
431
431
  /**
432
432
  * Options of {@link pluginReactLynx}
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE_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
- import { CSSPlugins, LynxEncodePlugin, LynxTemplatePlugin, WebEncodePlugin } from "@lynx-js/template-webpack-plugin";
7
6
  import { RuntimeWrapperWebpackPlugin } from "@lynx-js/runtime-wrapper-webpack-plugin";
7
+ import { LynxEncodePlugin, LynxTemplatePlugin, WebEncodePlugin } from "@lynx-js/template-webpack-plugin";
8
8
  import { ReactRefreshRspackPlugin, ReactRefreshWebpackPlugin } from "@lynx-js/react-refresh-webpack-plugin";
9
9
  var __webpack_modules__ = {
10
10
  "../../../node_modules/.pnpm/typia@9.7.1_typescript@5.9.2/node_modules/typia/lib/internal/_accessExpressionAsString.js": function(__unused_webpack_module, exports) {
@@ -175,13 +175,6 @@ __webpack_require__.m = __webpack_modules__;
175
175
  };
176
176
  })();
177
177
  var react_alias_rsbuild_plugin_ = __webpack_require__("@lynx-js/react-alias-rsbuild-plugin");
178
- function applyAlias(api, lazy) {
179
- return (0, react_alias_rsbuild_plugin_.pluginReactAlias)({
180
- LAYERS: LAYERS,
181
- lazy,
182
- rootPath: api.context.rootPath
183
- }).setup(api);
184
- }
185
178
  var external_node_path_ = __webpack_require__("node:path");
186
179
  var external_node_url_ = __webpack_require__("node:url");
187
180
  const DETECT_IMPORT_ERROR = 'react:detect-import-error';
@@ -248,9 +241,7 @@ function applyCSS(api, options) {
248
241
  enableCSSSelector,
249
242
  enableCSSInvalidation,
250
243
  targetSdkVersion,
251
- cssPlugins: [
252
- CSSPlugins.parserPlugins.removeFunctionWhiteSpace()
253
- ]
244
+ cssPlugins: []
254
245
  }
255
246
  ]).init((_, args)=>new CssExtractPlugin(...args)).end().end();
256
247
  chain.module.when(void 0 === enableRemoveCSSScope, (module)=>module.rule('lynx.css.scoped').test(/\.css$/).resourceQuery({
@@ -353,20 +344,16 @@ function applyEntry(api, options) {
353
344
  removeDescendantSelectorScope,
354
345
  targetSdkVersion,
355
346
  experimental_isLazyBundle,
356
- cssPlugins: [
357
- CSSPlugins.parserPlugins.removeFunctionWhiteSpace()
358
- ]
347
+ cssPlugins: []
359
348
  }
360
349
  ]).end();
361
350
  });
362
351
  const rsbuildConfig = api.getRsbuildConfig();
363
352
  const userConfig = api.getRsbuildConfig('original');
364
353
  const enableChunkSplitting = rsbuildConfig.performance?.chunkSplit?.strategy !== 'all-in-one';
365
- let finalFirstScreenSyncTiming = firstScreenSyncTiming;
366
354
  if (isLynx) {
367
355
  let inlineScripts;
368
356
  inlineScripts = experimental_isLazyBundle ? true : environment.config.output?.inlineScripts ?? !enableChunkSplitting;
369
- if (true !== inlineScripts) finalFirstScreenSyncTiming = 'jsReady';
370
357
  chain.plugin(PLUGIN_NAME_RUNTIME_WRAPPER).use(RuntimeWrapperWebpackPlugin, [
371
358
  {
372
359
  injectVars (vars) {
@@ -400,7 +387,7 @@ function applyEntry(api, options) {
400
387
  chain.plugin(PLUGIN_NAME_REACT).after(PLUGIN_NAME_TEMPLATE).use(ReactWebpackPlugin, [
401
388
  {
402
389
  disableCreateSelectorQueryIncompatibleWarning: compat?.disableCreateSelectorQueryIncompatibleWarning ?? false,
403
- firstScreenSyncTiming: finalFirstScreenSyncTiming,
390
+ firstScreenSyncTiming,
404
391
  enableSSR,
405
392
  mainThreadChunks,
406
393
  extractStr,
@@ -1221,56 +1208,61 @@ function pluginReactLynx(userOptions) {
1221
1208
  targetSdkVersion: engineVersion,
1222
1209
  engineVersion
1223
1210
  });
1224
- return {
1225
- name: 'lynx:react',
1226
- pre: [
1227
- 'lynx:rsbuild:plugin-api'
1228
- ],
1229
- async setup (api) {
1230
- await applyAlias(api, resolvedOptions.experimental_isLazyBundle);
1231
- applyCSS(api, resolvedOptions);
1232
- applyEntry(api, resolvedOptions);
1233
- applyBackgroundOnly(api);
1234
- applyGenerator(api, resolvedOptions);
1235
- applyLoaders(api, resolvedOptions);
1236
- applyRefresh(api);
1237
- applySplitChunksRule(api);
1238
- applySWC(api);
1239
- applyUseSyncExternalStore(api);
1240
- api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
1241
- const userConfig = api.getRsbuildConfig('original');
1242
- if (void 0 === userConfig.source?.include) config = mergeRsbuildConfig(config, {
1243
- source: {
1244
- include: [
1245
- /\.(?:js|mjs|cjs)$/
1246
- ]
1247
- }
1248
- });
1249
- if (void 0 === userConfig.output?.inlineScripts) config = mergeRsbuildConfig(config, {
1250
- output: {
1251
- inlineScripts: true
1252
- }
1253
- });
1254
- config = mergeRsbuildConfig({
1255
- tools: {
1256
- rspack: {
1257
- output: {
1258
- iife: false
1211
+ return [
1212
+ (0, react_alias_rsbuild_plugin_.pluginReactAlias)({
1213
+ lazy: resolvedOptions.experimental_isLazyBundle,
1214
+ LAYERS: LAYERS
1215
+ }),
1216
+ {
1217
+ name: 'lynx:react',
1218
+ pre: [
1219
+ 'lynx:rsbuild:plugin-api'
1220
+ ],
1221
+ setup (api) {
1222
+ applyCSS(api, resolvedOptions);
1223
+ applyEntry(api, resolvedOptions);
1224
+ applyBackgroundOnly(api);
1225
+ applyGenerator(api, resolvedOptions);
1226
+ applyLoaders(api, resolvedOptions);
1227
+ applyRefresh(api);
1228
+ applySplitChunksRule(api);
1229
+ applySWC(api);
1230
+ applyUseSyncExternalStore(api);
1231
+ api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
1232
+ const userConfig = api.getRsbuildConfig('original');
1233
+ if (void 0 === userConfig.source?.include) config = mergeRsbuildConfig(config, {
1234
+ source: {
1235
+ include: [
1236
+ /\.(?:js|mjs|cjs)$/
1237
+ ]
1238
+ }
1239
+ });
1240
+ if (void 0 === userConfig.output?.inlineScripts) config = mergeRsbuildConfig(config, {
1241
+ output: {
1242
+ inlineScripts: true
1243
+ }
1244
+ });
1245
+ config = mergeRsbuildConfig({
1246
+ tools: {
1247
+ rspack: {
1248
+ output: {
1249
+ iife: false
1250
+ }
1259
1251
  }
1260
1252
  }
1261
- }
1262
- }, config);
1263
- return config;
1264
- });
1265
- if (resolvedOptions.experimental_isLazyBundle) applyLazy(api);
1266
- const rspeedyAPIs = api.useExposed(Symbol.for('rspeedy.api'));
1267
- const require = createRequire(import.meta.url);
1268
- const { version } = require('../package.json');
1269
- rspeedyAPIs.debug(()=>{
1270
- const webpackPluginPath = require.resolve('@lynx-js/react-webpack-plugin');
1271
- return `Using @lynx-js/react-webpack-plugin v${version} at ${webpackPluginPath}`;
1272
- });
1253
+ }, config);
1254
+ return config;
1255
+ });
1256
+ if (resolvedOptions.experimental_isLazyBundle) applyLazy(api);
1257
+ const rspeedyAPIs = api.useExposed(Symbol.for('rspeedy.api'));
1258
+ const require = createRequire(import.meta.url);
1259
+ const { version } = require('../package.json');
1260
+ rspeedyAPIs.debug(()=>{
1261
+ const webpackPluginPath = require.resolve('@lynx-js/react-webpack-plugin');
1262
+ return `Using @lynx-js/react-webpack-plugin v${version} at ${webpackPluginPath}`;
1263
+ });
1264
+ }
1273
1265
  }
1274
- };
1266
+ ];
1275
1267
  }
1276
1268
  export { LAYERS, pluginReactLynx };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-rsbuild-plugin",
3
- "version": "0.10.12",
3
+ "version": "0.10.13",
4
4
  "description": "A rsbuild plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -33,27 +33,29 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@lynx-js/css-extract-webpack-plugin": "0.6.2",
36
- "@lynx-js/react-alias-rsbuild-plugin": "0.10.12",
36
+ "@lynx-js/react-alias-rsbuild-plugin": "0.10.13",
37
37
  "@lynx-js/react-refresh-webpack-plugin": "0.3.4",
38
- "@lynx-js/react-webpack-plugin": "0.6.19",
39
- "@lynx-js/runtime-wrapper-webpack-plugin": "0.1.2",
40
- "@lynx-js/template-webpack-plugin": "0.8.4",
38
+ "@lynx-js/react-webpack-plugin": "0.6.20",
39
+ "@lynx-js/runtime-wrapper-webpack-plugin": "0.1.3",
40
+ "@lynx-js/template-webpack-plugin": "0.8.5",
41
41
  "@lynx-js/use-sync-external-store": "1.5.0",
42
42
  "background-only": "^0.0.1"
43
43
  },
44
44
  "devDependencies": {
45
- "@microsoft/api-extractor": "7.52.10",
45
+ "@microsoft/api-extractor": "7.52.11",
46
46
  "@rollup/plugin-typescript": "^12.1.4",
47
47
  "@rsbuild/core": "1.4.15",
48
48
  "@rsbuild/plugin-sass": "1.3.5",
49
49
  "@rsbuild/plugin-typed-css-modules": "1.0.3",
50
+ "rsbuild-plugin-arethetypeswrong": "0.1.1",
51
+ "rsbuild-plugin-publint": "0.3.3",
50
52
  "tailwindcss": "^3.4.17",
51
53
  "type-fest": "^4.41.0",
52
54
  "typia": "9.7.1",
53
55
  "typia-rspack-plugin": "2.2.1",
54
- "@lynx-js/react": "0.112.3",
56
+ "@lynx-js/react": "0.112.4",
55
57
  "@lynx-js/react-transform": "0.2.0",
56
- "@lynx-js/rspeedy": "0.10.7",
58
+ "@lynx-js/rspeedy": "0.10.8",
57
59
  "@lynx-js/vitest-setup": "0.0.0"
58
60
  },
59
61
  "peerDependencies": {