@lynx-js/react-rsbuild-plugin 0.9.3 → 0.9.4

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,21 @@
1
1
  # @lynx-js/react-rsbuild-plugin
2
2
 
3
+ ## 0.9.4
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: add extractStr option to pluginReactLynx ([#391](https://github.com/lynx-family/lynx-stack/pull/391))
8
+
9
+ - Convert background-only files from js to ts ([#346](https://github.com/lynx-family/lynx-stack/pull/346))
10
+
11
+ - Updated dependencies [[`f849117`](https://github.com/lynx-family/lynx-stack/commit/f84911731faa4d0f6373d1202b9b2cabb0bafc48), [`d730101`](https://github.com/lynx-family/lynx-stack/commit/d7301017a383b8825cdc813a649ef26ce1c37641), [`42217c2`](https://github.com/lynx-family/lynx-stack/commit/42217c2c77a33e729977fc7108b218a1cb868e6a), [`f03bd4a`](https://github.com/lynx-family/lynx-stack/commit/f03bd4a62f81902ba55caf10df56447c89743e62)]:
12
+ - @lynx-js/react-webpack-plugin@0.6.10
13
+ - @lynx-js/template-webpack-plugin@0.6.7
14
+ - @lynx-js/react-alias-rsbuild-plugin@0.9.4
15
+ - @lynx-js/react-refresh-webpack-plugin@0.3.2
16
+ - @lynx-js/css-extract-webpack-plugin@0.5.2
17
+ - @lynx-js/web-webpack-plugin@0.6.3
18
+
3
19
  ## 0.9.3
4
20
 
5
21
  ### Patch Changes
@@ -311,7 +327,7 @@
311
327
  })
312
328
  ```
313
329
 
314
- NOTE: This feature is deprecated and will be removed in the future. Use codemod instead.
330
+ NOTE: This feature is deprecated and will be removed in the future. Use CodeMod instead.
315
331
 
316
332
  - 5f8d492: **BREAKING CHANGE**: Require `@lynx-js/react` v0.103.0.
317
333
  - 5f8d492: Deprecate `compat.simplifyCtorLikeReactLynx2`
@@ -413,9 +429,9 @@
413
429
 
414
430
  ### Minor Changes
415
431
 
416
- - 91c267b: feat: enable auto publicpath for environment.web
432
+ - 91c267b: feat: enable auto `publicPath` for environment.web
417
433
 
418
- In many case, users cannot set a correct assertprefix configuration. Typically those chunks will be uploaded after chunk dumped. Developers may be not able to know the url before those chunks are uploaded.
434
+ In many case, users cannot set a correct `output.assertPrefix` configuration. Typically those chunks will be uploaded after chunk dumped. Developers may be not able to know the url before those chunks are uploaded.
419
435
 
420
436
  In this commit, we allow webpack to infer the correct public path by the import.meta.url.
421
437
 
package/README.md CHANGED
@@ -40,7 +40,7 @@ Visit [Lynx Website](https://lynxjs.org/api/rspeedy/react-rsbuild-plugin.pluginr
40
40
 
41
41
  ## Contributing
42
42
 
43
- Contributions to Rspeedy are welcome and highly appreciated. However, before you jump right into it, we would like you to review our [Contribution Guidelines](/contributing.md) to make sure you have a smooth experience contributing to this project.
43
+ Contributions to Rspeedy are welcome and highly appreciated. However, before you jump right into it, we would like you to review our [Contribution Guidelines](/CONTRIBUTING.md) to make sure you have a smooth experience contributing to this project.
44
44
 
45
45
  ## License
46
46
 
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js CHANGED
@@ -57,10 +57,8 @@ var __webpack_modules__ = {
57
57
  exports._assertGuard = void 0;
58
58
  const TypeGuardError_1 = __webpack_require__("../../../node_modules/.pnpm/typia@7.6.4_@samchon+openapi@2.4.2_typescript@5.7.3/node_modules/typia/lib/TypeGuardError.mjs");
59
59
  const _assertGuard = (exceptionable, props, factory)=>{
60
- if (true === exceptionable) {
61
- if (factory) throw factory(props);
62
- throw new TypeGuardError_1.TypeGuardError(props);
63
- }
60
+ if (true === exceptionable) if (factory) throw factory(props);
61
+ else throw new TypeGuardError_1.TypeGuardError(props);
64
62
  return false;
65
63
  };
66
64
  exports._assertGuard = _assertGuard;
@@ -211,7 +209,7 @@ const DEFAULT_DIST_PATH_INTERMEDIATE = '.rspeedy';
211
209
  const DEFAULT_FILENAME_HASH = '.[contenthash:8]';
212
210
  const EMPTY_HASH = '';
213
211
  function applyEntry(api, options) {
214
- const { compat, customCSSInheritanceList, debugInfoOutside, defaultDisplayLinear, enableAccessibilityElement, enableICU, enableCSSInheritance, enableCSSInvalidation, enableCSSSelector, enableNewGesture, enableParallelElement, enableRemoveCSSScope, firstScreenSyncTiming, enableSSR, pipelineSchedulerConfig, removeDescendantSelectorScope, targetSdkVersion, experimental_isLazyBundle } = options;
212
+ const { compat, customCSSInheritanceList, debugInfoOutside, defaultDisplayLinear, enableAccessibilityElement, enableICU, enableCSSInheritance, enableCSSInvalidation, enableCSSSelector, enableNewGesture, enableParallelElement, enableRemoveCSSScope, firstScreenSyncTiming, enableSSR, pipelineSchedulerConfig, removeDescendantSelectorScope, targetSdkVersion, extractStr, experimental_isLazyBundle } = options;
215
213
  const { config } = api.useExposed(Symbol.for('rspeedy.api'));
216
214
  api.modifyBundlerChain((chain, { environment, isDev, isProd })=>{
217
215
  const entries = chain.entryPoints.entries() ?? {};
@@ -304,6 +302,7 @@ function applyEntry(api, options) {
304
302
  firstScreenSyncTiming,
305
303
  enableSSR,
306
304
  mainThreadChunks,
305
+ extractStr,
307
306
  experimental_isLazyBundle
308
307
  }
309
308
  ]);
@@ -326,10 +325,8 @@ function getChunks(entryName, entryValue) {
326
325
  const { dependOn } = item;
327
326
  if (Array.isArray(item.import)) imports.push(...item.import);
328
327
  else imports.push(item.import);
329
- if (!!dependOn) {
330
- if ('string' == typeof dependOn) chunks.unshift(dependOn);
331
- else chunks.unshift(...dependOn);
332
- }
328
+ if (dependOn) if ('string' == typeof dependOn) chunks.unshift(dependOn);
329
+ else chunks.unshift(...dependOn);
333
330
  }
334
331
  return {
335
332
  chunks,
@@ -481,7 +478,7 @@ function applySWC(api) {
481
478
  var _accessExpressionAsString = __webpack_require__("../../../node_modules/.pnpm/typia@7.6.4_@samchon+openapi@2.4.2_typescript@5.7.3/node_modules/typia/lib/internal/_accessExpressionAsString.js");
482
479
  var _assertGuard = __webpack_require__("../../../node_modules/.pnpm/typia@7.6.4_@samchon+openapi@2.4.2_typescript@5.7.3/node_modules/typia/lib/internal/_assertGuard.js");
483
480
  const validateConfig = (()=>{
484
- 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.jsx || "object" == typeof input.jsx && null !== input.jsx && false === Array.isArray(input.jsx) && _io4(input.jsx, _exceptionable)) && (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) && _io5(input.shake, _exceptionable)) && (void 0 === input.defineDCE || "object" == typeof input.defineDCE && null !== input.defineDCE && false === Array.isArray(input.defineDCE) && _io6(input.defineDCE, _exceptionable)) && (void 0 === input.engineVersion || "string" == typeof input.engineVersion) && (void 0 === input.targetSdkVersion || "string" == typeof input.targetSdkVersion) && (void 0 === input.experimental_isLazyBundle || "boolean" == typeof input.experimental_isLazyBundle) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
481
+ 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.jsx || "object" == typeof input.jsx && null !== input.jsx && false === Array.isArray(input.jsx) && _io4(input.jsx, _exceptionable)) && (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) && _io5(input.shake, _exceptionable)) && (void 0 === input.defineDCE || "object" == typeof input.defineDCE && null !== input.defineDCE && false === Array.isArray(input.defineDCE) && _io6(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) && _io8(input.extractStr, _exceptionable)) && (void 0 === input.experimental_isLazyBundle || "boolean" == typeof input.experimental_isLazyBundle) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
485
482
  if ([
486
483
  "compat",
487
484
  "customCSSInheritanceList",
@@ -504,6 +501,7 @@ const validateConfig = (()=>{
504
501
  "defineDCE",
505
502
  "engineVersion",
506
503
  "targetSdkVersion",
504
+ "extractStr",
507
505
  "experimental_isLazyBundle"
508
506
  ].some((prop)=>key === prop)) return true;
509
507
  const value = input[key];
@@ -577,6 +575,14 @@ const validateConfig = (()=>{
577
575
  if (void 0 === value) return true;
578
576
  return "string" == typeof value;
579
577
  });
578
+ const _io8 = (input, _exceptionable = true)=>(void 0 === input.strLength || "number" == typeof input.strLength) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
579
+ if ([
580
+ "strLength"
581
+ ].some((prop)=>key === prop)) return true;
582
+ const value = input[key];
583
+ if (void 0 === value) return true;
584
+ return false;
585
+ }));
580
586
  const _ao0 = (input, _path, _exceptionable = true)=>(void 0 === input.compat || ("object" == typeof input.compat && null !== input.compat && false === Array.isArray(input.compat) || _assertGuard._assertGuard(_exceptionable, {
581
587
  method: "typia.createAssertEquals",
582
588
  path: _path + ".compat",
@@ -712,6 +718,21 @@ const validateConfig = (()=>{
712
718
  path: _path + ".targetSdkVersion",
713
719
  expected: "(string | undefined)",
714
720
  value: input.targetSdkVersion
721
+ }, _errorFactory)) && (null !== input.extractStr || _assertGuard._assertGuard(_exceptionable, {
722
+ method: "typia.createAssertEquals",
723
+ path: _path + ".extractStr",
724
+ expected: "(Partial<ExtractStrConfig> | boolean | undefined)",
725
+ value: input.extractStr
726
+ }, _errorFactory)) && (void 0 === input.extractStr || "boolean" == typeof input.extractStr || ("object" == typeof input.extractStr && null !== input.extractStr && false === Array.isArray(input.extractStr) || _assertGuard._assertGuard(_exceptionable, {
727
+ method: "typia.createAssertEquals",
728
+ path: _path + ".extractStr",
729
+ expected: "(Partial<ExtractStrConfig> | boolean | undefined)",
730
+ value: input.extractStr
731
+ }, _errorFactory)) && _ao8(input.extractStr, _path + ".extractStr", _exceptionable) || _assertGuard._assertGuard(_exceptionable, {
732
+ method: "typia.createAssertEquals",
733
+ path: _path + ".extractStr",
734
+ expected: "(Partial<ExtractStrConfig> | boolean | undefined)",
735
+ value: input.extractStr
715
736
  }, _errorFactory)) && (void 0 === input.experimental_isLazyBundle || "boolean" == typeof input.experimental_isLazyBundle || _assertGuard._assertGuard(_exceptionable, {
716
737
  method: "typia.createAssertEquals",
717
738
  path: _path + ".experimental_isLazyBundle",
@@ -740,6 +761,7 @@ const validateConfig = (()=>{
740
761
  "defineDCE",
741
762
  "engineVersion",
742
763
  "targetSdkVersion",
764
+ "extractStr",
743
765
  "experimental_isLazyBundle"
744
766
  ].some((prop)=>key === prop)) return true;
745
767
  const value = input[key];
@@ -1038,6 +1060,24 @@ const validateConfig = (()=>{
1038
1060
  value: value
1039
1061
  }, _errorFactory);
1040
1062
  });
1063
+ const _ao8 = (input, _path, _exceptionable = true)=>(void 0 === input.strLength || "number" == typeof input.strLength || _assertGuard._assertGuard(_exceptionable, {
1064
+ method: "typia.createAssertEquals",
1065
+ path: _path + ".strLength",
1066
+ expected: "(number | undefined)",
1067
+ value: input.strLength
1068
+ }, _errorFactory)) && (0 === Object.keys(input).length || false === _exceptionable || Object.keys(input).every((key)=>{
1069
+ if ([
1070
+ "strLength"
1071
+ ].some((prop)=>key === prop)) return true;
1072
+ const value = input[key];
1073
+ if (void 0 === value) return true;
1074
+ return _assertGuard._assertGuard(_exceptionable, {
1075
+ method: "typia.createAssertEquals",
1076
+ path: _path + _accessExpressionAsString._accessExpressionAsString(key),
1077
+ expected: "undefined",
1078
+ value: value
1079
+ }, _errorFactory);
1080
+ }));
1041
1081
  const __is = (input, _exceptionable = true)=>void 0 === input || "object" == typeof input && null !== input && false === Array.isArray(input) && _io0(input, true);
1042
1082
  let _errorFactory;
1043
1083
  return (input, errorFactory = ({ path, expected, value })=>{
@@ -1097,6 +1137,7 @@ function pluginReactLynx(userOptions) {
1097
1137
  defineDCE: void 0,
1098
1138
  targetSdkVersion: '',
1099
1139
  engineVersion: '',
1140
+ extractStr: false,
1100
1141
  experimental_isLazyBundle: false
1101
1142
  };
1102
1143
  const resolvedOptions = Object.assign(defaultOptions, userOptions, {
@@ -0,0 +1,4 @@
1
+ import type { Rspack } from '@rsbuild/core';
2
+ export default function invalidImportErrorLoader(this: Rspack.LoaderContext<{
3
+ message: string;
4
+ }>): void;
@@ -1,4 +1,5 @@
1
- export default function invalidImportErrorLoader() {
1
+ function invalidImportErrorLoader() {
2
2
  const { message } = this.getOptions();
3
3
  throw new Error(message);
4
4
  }
5
+ export { invalidImportErrorLoader as default };
@@ -1,5 +1,6 @@
1
1
  import type { RsbuildPlugin } from '@rsbuild/core';
2
2
  import type { CompatVisitorConfig, DefineDceVisitorConfig, JsxTransformerConfig, ShakeVisitorConfig } from '@lynx-js/react/transform';
3
+ import type { ExtractStrConfig } from '@lynx-js/react-webpack-plugin';
3
4
  /**
4
5
  * Options of {@link pluginReactLynx}
5
6
  *
@@ -240,6 +241,13 @@ export interface PluginReactLynxOptions {
240
241
  * @deprecated `targetSdkVersion` is now an alias of {@link PluginReactLynxOptions.engineVersion}. Use {@link PluginReactLynxOptions.engineVersion} instead.
241
242
  */
242
243
  targetSdkVersion?: string;
244
+ /**
245
+ * Merge same string literals in JS and Lepus to reduce output bundle size.
246
+ * Set to `false` to disable.
247
+ *
248
+ * @defaultValue false
249
+ */
250
+ extractStr?: Partial<ExtractStrConfig> | boolean;
243
251
  /**
244
252
  * Generate standalone lazy bundle.
245
253
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-rsbuild-plugin",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "A rsbuild plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -33,11 +33,11 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@lynx-js/css-extract-webpack-plugin": "0.5.2",
36
- "@lynx-js/react-alias-rsbuild-plugin": "0.9.3",
37
- "@lynx-js/react-webpack-plugin": "0.6.9",
36
+ "@lynx-js/react-alias-rsbuild-plugin": "0.9.4",
38
37
  "@lynx-js/react-refresh-webpack-plugin": "0.3.2",
38
+ "@lynx-js/react-webpack-plugin": "0.6.10",
39
39
  "@lynx-js/runtime-wrapper-webpack-plugin": "0.0.9",
40
- "@lynx-js/template-webpack-plugin": "0.6.6",
40
+ "@lynx-js/template-webpack-plugin": "0.6.7",
41
41
  "@lynx-js/web-webpack-plugin": "0.6.3"
42
42
  },
43
43
  "devDependencies": {
@@ -49,11 +49,11 @@
49
49
  "@rsbuild/plugin-webpack-swc": "1.0.12",
50
50
  "@rsbuild/webpack": "1.2.3",
51
51
  "tailwindcss": "^3.4.17",
52
- "type-fest": "^4.37.0",
52
+ "type-fest": "^4.38.0",
53
53
  "typia": "7.6.4",
54
54
  "typia-rspack-plugin": "^1.0.2",
55
- "@lynx-js/react": "0.106.0",
56
- "@lynx-js/rspeedy": "0.8.5",
55
+ "@lynx-js/react": "0.106.2",
56
+ "@lynx-js/rspeedy": "0.8.7",
57
57
  "@lynx-js/vitest-setup": "0.0.0"
58
58
  },
59
59
  "peerDependencies": {
File without changes
@@ -1 +0,0 @@
1
- throw new Error("This module cannot be imported from a Main Thread module. It should only be used from a Background Thread.");