@lynx-js/react-rsbuild-plugin 0.10.11 → 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,38 @@
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
+
22
+ ## 0.10.12
23
+
24
+ ### Patch Changes
25
+
26
+ - `output.inlineScripts` defaults to `false` when chunkSplit strategy is not `'all-in-one'` ([#1504](https://github.com/lynx-family/lynx-stack/pull/1504))
27
+
28
+ - Updated dependencies [[`51a0b19`](https://github.com/lynx-family/lynx-stack/commit/51a0b19078cb18c13f4f3e2ca4f471aa4ddeaa05), [`b391ef5`](https://github.com/lynx-family/lynx-stack/commit/b391ef5c6dd0a0945e68b38f40807df7e1ef672e)]:
29
+ - @lynx-js/template-webpack-plugin@0.8.4
30
+ - @lynx-js/css-extract-webpack-plugin@0.6.2
31
+ - @lynx-js/react-alias-rsbuild-plugin@0.10.12
32
+ - @lynx-js/use-sync-external-store@1.5.0
33
+ - @lynx-js/react-refresh-webpack-plugin@0.3.4
34
+ - @lynx-js/react-webpack-plugin@0.6.19
35
+
3
36
  ## 0.10.11
4
37
 
5
38
  ### 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,11 +3,11 @@ 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
- "../../../node_modules/.pnpm/typia@9.6.1_typescript@5.9.2/node_modules/typia/lib/internal/_accessExpressionAsString.js": function(__unused_webpack_module, exports) {
10
+ "../../../node_modules/.pnpm/typia@9.7.1_typescript@5.9.2/node_modules/typia/lib/internal/_accessExpressionAsString.js": function(__unused_webpack_module, exports) {
11
11
  exports._accessExpressionAsString = void 0;
12
12
  const _accessExpressionAsString = (str)=>variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`;
13
13
  exports._accessExpressionAsString = _accessExpressionAsString;
@@ -52,9 +52,9 @@ var __webpack_modules__ = {
52
52
  "with"
53
53
  ]);
54
54
  },
55
- "../../../node_modules/.pnpm/typia@9.6.1_typescript@5.9.2/node_modules/typia/lib/internal/_assertGuard.js": function(__unused_webpack_module, exports, __webpack_require__) {
55
+ "../../../node_modules/.pnpm/typia@9.7.1_typescript@5.9.2/node_modules/typia/lib/internal/_assertGuard.js": function(__unused_webpack_module, exports, __webpack_require__) {
56
56
  exports._assertGuard = void 0;
57
- const TypeGuardError_1 = __webpack_require__("../../../node_modules/.pnpm/typia@9.6.1_typescript@5.9.2/node_modules/typia/lib/TypeGuardError.mjs");
57
+ const TypeGuardError_1 = __webpack_require__("../../../node_modules/.pnpm/typia@9.7.1_typescript@5.9.2/node_modules/typia/lib/TypeGuardError.mjs");
58
58
  const _assertGuard = (exceptionable, props, factory)=>{
59
59
  if (true === exceptionable) if (factory) throw factory(props);
60
60
  else throw new TypeGuardError_1.TypeGuardError(props);
@@ -71,7 +71,7 @@ var __webpack_modules__ = {
71
71
  "node:url": function(module) {
72
72
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__;
73
73
  },
74
- "../../../node_modules/.pnpm/typia@9.6.1_typescript@5.9.2/node_modules/typia/lib/TypeGuardError.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
74
+ "../../../node_modules/.pnpm/typia@9.7.1_typescript@5.9.2/node_modules/typia/lib/TypeGuardError.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
75
75
  __webpack_require__.r(__webpack_exports__);
76
76
  __webpack_require__.d(__webpack_exports__, {
77
77
  TypeGuardError: ()=>TypeGuardError
@@ -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,17 +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
- let finalFirstScreenSyncTiming = firstScreenSyncTiming;
351
+ const rsbuildConfig = api.getRsbuildConfig();
352
+ const userConfig = api.getRsbuildConfig('original');
353
+ const enableChunkSplitting = rsbuildConfig.performance?.chunkSplit?.strategy !== 'all-in-one';
363
354
  if (isLynx) {
364
355
  let inlineScripts;
365
- inlineScripts = experimental_isLazyBundle ? true : environment.config.output?.inlineScripts ?? true;
366
- if (true !== inlineScripts) finalFirstScreenSyncTiming = 'jsReady';
356
+ inlineScripts = experimental_isLazyBundle ? true : environment.config.output?.inlineScripts ?? !enableChunkSplitting;
367
357
  chain.plugin(PLUGIN_NAME_RUNTIME_WRAPPER).use(RuntimeWrapperWebpackPlugin, [
368
358
  {
369
359
  injectVars (vars) {
@@ -389,17 +379,15 @@ function applyEntry(api, options) {
389
379
  ]).end();
390
380
  }
391
381
  if (isWeb) chain.plugin(PLUGIN_NAME_WEB).use(WebEncodePlugin, []).end();
392
- const rsbuildConfig = api.getRsbuildConfig();
393
- const userConfig = api.getRsbuildConfig('original');
394
382
  let extractStr = originalExtractStr;
395
- if (rsbuildConfig.performance?.chunkSplit?.strategy !== 'all-in-one' && originalExtractStr) {
383
+ if (enableChunkSplitting && originalExtractStr) {
396
384
  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.`');
397
385
  extractStr = false;
398
386
  }
399
387
  chain.plugin(PLUGIN_NAME_REACT).after(PLUGIN_NAME_TEMPLATE).use(ReactWebpackPlugin, [
400
388
  {
401
389
  disableCreateSelectorQueryIncompatibleWarning: compat?.disableCreateSelectorQueryIncompatibleWarning ?? false,
402
- firstScreenSyncTiming: finalFirstScreenSyncTiming,
390
+ firstScreenSyncTiming,
403
391
  enableSSR,
404
392
  mainThreadChunks,
405
393
  extractStr,
@@ -611,8 +599,8 @@ function applyUseSyncExternalStore(api) {
611
599
  })));
612
600
  });
613
601
  }
614
- var _accessExpressionAsString = __webpack_require__("../../../node_modules/.pnpm/typia@9.6.1_typescript@5.9.2/node_modules/typia/lib/internal/_accessExpressionAsString.js");
615
- var _assertGuard = __webpack_require__("../../../node_modules/.pnpm/typia@9.6.1_typescript@5.9.2/node_modules/typia/lib/internal/_assertGuard.js");
602
+ var _accessExpressionAsString = __webpack_require__("../../../node_modules/.pnpm/typia@9.7.1_typescript@5.9.2/node_modules/typia/lib/internal/_accessExpressionAsString.js");
603
+ var _assertGuard = __webpack_require__("../../../node_modules/.pnpm/typia@9.7.1_typescript@5.9.2/node_modules/typia/lib/internal/_assertGuard.js");
616
604
  const validateConfig = (()=>{
617
605
  const _io0 = (input, _exceptionable = true)=>(void 0 === input.compat || "object" == typeof input.compat && null !== input.compat && false === Array.isArray(input.compat) && _io1(input.compat, _exceptionable)) && (void 0 === input.customCSSInheritanceList || Array.isArray(input.customCSSInheritanceList) && input.customCSSInheritanceList.every((elem, _index1)=>"string" == typeof elem)) && (void 0 === input.debugInfoOutside || "boolean" == typeof input.debugInfoOutside) && (void 0 === input.defaultDisplayLinear || "boolean" == typeof input.defaultDisplayLinear) && (void 0 === input.enableAccessibilityElement || "boolean" == typeof input.enableAccessibilityElement) && (void 0 === input.enableICU || "boolean" == typeof input.enableICU) && (void 0 === input.enableCSSInheritance || "boolean" == typeof input.enableCSSInheritance) && (void 0 === input.enableCSSInvalidation || "boolean" == typeof input.enableCSSInvalidation) && (void 0 === input.enableCSSSelector || "boolean" == typeof input.enableCSSSelector) && (void 0 === input.enableNewGesture || "boolean" == typeof input.enableNewGesture) && (void 0 === input.enableParallelElement || "boolean" == typeof input.enableParallelElement) && (void 0 === input.enableRemoveCSSScope || "boolean" == typeof input.enableRemoveCSSScope) && (void 0 === input.firstScreenSyncTiming || "immediately" === input.firstScreenSyncTiming || "jsReady" === input.firstScreenSyncTiming) && (void 0 === input.enableSSR || "boolean" == typeof input.enableSSR) && (void 0 === input.pipelineSchedulerConfig || "number" == typeof input.pipelineSchedulerConfig) && (void 0 === input.removeDescendantSelectorScope || "boolean" == typeof input.removeDescendantSelectorScope) && (void 0 === input.shake || "object" == typeof input.shake && null !== input.shake && false === Array.isArray(input.shake) && _io4(input.shake, _exceptionable)) && (void 0 === input.defineDCE || "object" == typeof input.defineDCE && null !== input.defineDCE && false === Array.isArray(input.defineDCE) && _io5(input.defineDCE, _exceptionable)) && (void 0 === input.engineVersion || "string" == typeof input.engineVersion) && (void 0 === input.targetSdkVersion || "string" == typeof input.targetSdkVersion) && null !== input.extractStr && (void 0 === input.extractStr || "boolean" == typeof input.extractStr || "object" == typeof input.extractStr && null !== input.extractStr && false === Array.isArray(input.extractStr) && _io7(input.extractStr, _exceptionable)) && (void 0 === input.experimental_isLazyBundle || "boolean" == typeof input.experimental_isLazyBundle) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
618
606
  if ([
@@ -1220,56 +1208,61 @@ function pluginReactLynx(userOptions) {
1220
1208
  targetSdkVersion: engineVersion,
1221
1209
  engineVersion
1222
1210
  });
1223
- return {
1224
- name: 'lynx:react',
1225
- pre: [
1226
- 'lynx:rsbuild:plugin-api'
1227
- ],
1228
- async setup (api) {
1229
- await applyAlias(api, resolvedOptions.experimental_isLazyBundle);
1230
- applyCSS(api, resolvedOptions);
1231
- applyEntry(api, resolvedOptions);
1232
- applyBackgroundOnly(api);
1233
- applyGenerator(api, resolvedOptions);
1234
- applyLoaders(api, resolvedOptions);
1235
- applyRefresh(api);
1236
- applySplitChunksRule(api);
1237
- applySWC(api);
1238
- applyUseSyncExternalStore(api);
1239
- api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
1240
- const userConfig = api.getRsbuildConfig('original');
1241
- if (void 0 === userConfig.source?.include) config = mergeRsbuildConfig(config, {
1242
- source: {
1243
- include: [
1244
- /\.(?:js|mjs|cjs)$/
1245
- ]
1246
- }
1247
- });
1248
- if (void 0 === userConfig.output?.inlineScripts) config = mergeRsbuildConfig(config, {
1249
- output: {
1250
- inlineScripts: true
1251
- }
1252
- });
1253
- config = mergeRsbuildConfig({
1254
- tools: {
1255
- rspack: {
1256
- output: {
1257
- 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
+ }
1258
1251
  }
1259
1252
  }
1260
- }
1261
- }, config);
1262
- return config;
1263
- });
1264
- if (resolvedOptions.experimental_isLazyBundle) applyLazy(api);
1265
- const rspeedyAPIs = api.useExposed(Symbol.for('rspeedy.api'));
1266
- const require = createRequire(import.meta.url);
1267
- const { version } = require('../package.json');
1268
- rspeedyAPIs.debug(()=>{
1269
- const webpackPluginPath = require.resolve('@lynx-js/react-webpack-plugin');
1270
- return `Using @lynx-js/react-webpack-plugin v${version} at ${webpackPluginPath}`;
1271
- });
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
+ }
1272
1265
  }
1273
- };
1266
+ ];
1274
1267
  }
1275
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.11",
3
+ "version": "0.10.13",
4
4
  "description": "A rsbuild plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -32,29 +32,30 @@
32
32
  "README.md"
33
33
  ],
34
34
  "dependencies": {
35
- "@lynx-js/css-extract-webpack-plugin": "0.6.1",
36
- "@lynx-js/react-alias-rsbuild-plugin": "0.10.11",
35
+ "@lynx-js/css-extract-webpack-plugin": "0.6.2",
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.3",
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
- "@rsbuild/plugin-sass": "1.3.3",
49
- "@rsbuild/plugin-typed-css-modules": "1.0.2",
50
- "@rsbuild/plugin-webpack-swc": "1.1.1",
48
+ "@rsbuild/plugin-sass": "1.3.5",
49
+ "@rsbuild/plugin-typed-css-modules": "1.0.3",
50
+ "rsbuild-plugin-arethetypeswrong": "0.1.1",
51
+ "rsbuild-plugin-publint": "0.3.3",
51
52
  "tailwindcss": "^3.4.17",
52
53
  "type-fest": "^4.41.0",
53
- "typia": "9.6.1",
54
- "typia-rspack-plugin": "2.2.0",
55
- "@lynx-js/react": "0.112.2",
54
+ "typia": "9.7.1",
55
+ "typia-rspack-plugin": "2.2.1",
56
+ "@lynx-js/react": "0.112.4",
56
57
  "@lynx-js/react-transform": "0.2.0",
57
- "@lynx-js/rspeedy": "0.10.6",
58
+ "@lynx-js/rspeedy": "0.10.8",
58
59
  "@lynx-js/vitest-setup": "0.0.0"
59
60
  },
60
61
  "peerDependencies": {