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

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.5
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: add enableCSSInvalidation for encodeCSS of css HMR, this will fix pseudo-class (such as `:active`) not working in HMR. ([#435](https://github.com/lynx-family/lynx-stack/pull/435))
8
+
9
+ - Disable `module.generator.json.JSONParse` option as it increases the bundle size of `main-thread.js`. For more detail, please see this [issue](https://github.com/webpack/webpack/issues/19319). ([#402](https://github.com/lynx-family/lynx-stack/pull/402))
10
+
11
+ - Updated dependencies [[`3e7988f`](https://github.com/lynx-family/lynx-stack/commit/3e7988f3af4b4f460eaf5add29cca19537dc1a6b), [`7243242`](https://github.com/lynx-family/lynx-stack/commit/7243242801e3a8ca0213c0ef642f69a22c39960e)]:
12
+ - @lynx-js/css-extract-webpack-plugin@0.5.3
13
+ - @lynx-js/template-webpack-plugin@0.6.8
14
+ - @lynx-js/react-alias-rsbuild-plugin@0.9.5
15
+ - @lynx-js/react-refresh-webpack-plugin@0.3.2
16
+ - @lynx-js/react-webpack-plugin@0.6.10
17
+ - @lynx-js/web-webpack-plugin@0.6.3
18
+
3
19
  ## 0.9.4
4
20
 
5
21
  ### Patch Changes
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPluginAPI } from '@rsbuild/core';
2
+ export declare function applyGenerator(api: RsbuildPluginAPI): void;
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_runtime_wrapper_webpack_plugin_27
8
8
  import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_web_webpack_plugin_6ba19e5a__ from "@lynx-js/web-webpack-plugin";
9
9
  import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_react_refresh_webpack_plugin_a01c5e97__ from "@lynx-js/react-refresh-webpack-plugin";
10
10
  var __webpack_modules__ = {
11
- "../../../node_modules/.pnpm/typia@7.6.4_@samchon+openapi@2.4.2_typescript@5.7.3/node_modules/typia/lib/internal/_accessExpressionAsString.js": function(__unused_webpack_module, exports) {
11
+ "../../../node_modules/.pnpm/typia@8.1.1_@samchon+openapi@3.2.3_typescript@5.8.2/node_modules/typia/lib/internal/_accessExpressionAsString.js": function(__unused_webpack_module, exports) {
12
12
  exports._accessExpressionAsString = void 0;
13
13
  const _accessExpressionAsString = (str)=>variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`;
14
14
  exports._accessExpressionAsString = _accessExpressionAsString;
@@ -53,9 +53,9 @@ var __webpack_modules__ = {
53
53
  "with"
54
54
  ]);
55
55
  },
56
- "../../../node_modules/.pnpm/typia@7.6.4_@samchon+openapi@2.4.2_typescript@5.7.3/node_modules/typia/lib/internal/_assertGuard.js": function(__unused_webpack_module, exports, __webpack_require__) {
56
+ "../../../node_modules/.pnpm/typia@8.1.1_@samchon+openapi@3.2.3_typescript@5.8.2/node_modules/typia/lib/internal/_assertGuard.js": function(__unused_webpack_module, exports, __webpack_require__) {
57
57
  exports._assertGuard = void 0;
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");
58
+ const TypeGuardError_1 = __webpack_require__("../../../node_modules/.pnpm/typia@8.1.1_@samchon+openapi@3.2.3_typescript@5.8.2/node_modules/typia/lib/TypeGuardError.mjs");
59
59
  const _assertGuard = (exceptionable, props, factory)=>{
60
60
  if (true === exceptionable) if (factory) throw factory(props);
61
61
  else throw new TypeGuardError_1.TypeGuardError(props);
@@ -63,7 +63,7 @@ var __webpack_modules__ = {
63
63
  };
64
64
  exports._assertGuard = _assertGuard;
65
65
  },
66
- "../../../node_modules/.pnpm/typia@7.6.4_@samchon+openapi@2.4.2_typescript@5.7.3/node_modules/typia/lib/TypeGuardError.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
66
+ "../../../node_modules/.pnpm/typia@8.1.1_@samchon+openapi@3.2.3_typescript@5.8.2/node_modules/typia/lib/TypeGuardError.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
67
67
  __webpack_require__.r(__webpack_exports__);
68
68
  __webpack_require__.d(__webpack_exports__, {
69
69
  TypeGuardError: ()=>TypeGuardError
@@ -139,7 +139,7 @@ function applyBackgroundOnly(api) {
139
139
  });
140
140
  }
141
141
  function applyCSS(api, options) {
142
- const { enableRemoveCSSScope, enableCSSSelector, targetSdkVersion } = options;
142
+ const { enableRemoveCSSScope, enableCSSSelector, enableCSSInvalidation, targetSdkVersion } = options;
143
143
  api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>mergeRsbuildConfig(config, {
144
144
  output: {
145
145
  injectStyles: false
@@ -157,18 +157,32 @@ function applyCSS(api, options) {
157
157
  ];
158
158
  cssRules.filter((rule)=>chain.module.rules.has(rule)).forEach((ruleName)=>{
159
159
  const rule = chain.module.rule(ruleName);
160
- if (rule.uses.has(CHAIN_ID.USE.LIGHTNINGCSS) && 'lynx' === environment.name) rule.uses.delete(CHAIN_ID.USE.LIGHTNINGCSS);
160
+ removeLightningCSS(rule);
161
161
  rule.issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND).use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader(CssExtractPlugin.loader).end();
162
162
  const uses = rule.uses.entries();
163
163
  const ruleEntries = rule.entries();
164
164
  const cssLoaderRule = uses[CHAIN_ID.USE.CSS].entries();
165
165
  chain.module.rule(`${ruleName}:${__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD}`).merge(ruleEntries).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).use(CHAIN_ID.USE.IGNORE_CSS).loader(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(__dirname, './loaders/ignore-css-loader')).end().uses.merge(uses).delete(CHAIN_ID.USE.MINI_CSS_EXTRACT).delete(CHAIN_ID.USE.LIGHTNINGCSS).delete(CHAIN_ID.USE.CSS).end().use(CHAIN_ID.USE.CSS).after(CHAIN_ID.USE.IGNORE_CSS).merge(cssLoaderRule).options(normalizeCssLoaderOptions(cssLoaderRule.options, true)).end();
166
166
  });
167
+ const inlineCSSRules = [
168
+ CHAIN_ID.RULE.CSS_INLINE,
169
+ CHAIN_ID.RULE.SASS_INLINE,
170
+ CHAIN_ID.RULE.LESS_INLINE,
171
+ CHAIN_ID.RULE.STYLUS_INLINE
172
+ ];
173
+ inlineCSSRules.filter((rule)=>rule && chain.module.rules.has(rule)).forEach((ruleName)=>{
174
+ const rule = chain.module.rule(ruleName);
175
+ removeLightningCSS(rule);
176
+ });
177
+ function removeLightningCSS(rule) {
178
+ if (rule.uses.has(CHAIN_ID.USE.LIGHTNINGCSS) && 'lynx' === environment.name) rule.uses.delete(CHAIN_ID.USE.LIGHTNINGCSS);
179
+ }
167
180
  chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).tap(([options])=>[
168
181
  {
169
182
  ...options,
170
183
  enableRemoveCSSScope: enableRemoveCSSScope ?? true,
171
184
  enableCSSSelector,
185
+ enableCSSInvalidation,
172
186
  targetSdkVersion,
173
187
  cssPlugins: [
174
188
  __WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__.CSSPlugins.parserPlugins.removeFunctionWhiteSpace()
@@ -344,6 +358,16 @@ function getHash(config, isProd) {
344
358
  if (isProd) return DEFAULT_FILENAME_HASH;
345
359
  return EMPTY_HASH;
346
360
  }
361
+ function applyGenerator(api) {
362
+ api.modifyBundlerChain({
363
+ order: 'pre',
364
+ handler: (chain)=>{
365
+ chain.module.rule(`json-parse:${__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD}`).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).test(/\.json$/).type('json').generator({
366
+ JSONParse: false
367
+ });
368
+ }
369
+ });
370
+ }
347
371
  function applyLazy(api) {
348
372
  api.modifyBundlerChain((chain)=>{
349
373
  chain.output.library({
@@ -475,8 +499,8 @@ function applySWC(api) {
475
499
  }
476
500
  }));
477
501
  }
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");
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");
502
+ var _accessExpressionAsString = __webpack_require__("../../../node_modules/.pnpm/typia@8.1.1_@samchon+openapi@3.2.3_typescript@5.8.2/node_modules/typia/lib/internal/_accessExpressionAsString.js");
503
+ var _assertGuard = __webpack_require__("../../../node_modules/.pnpm/typia@8.1.1_@samchon+openapi@3.2.3_typescript@5.8.2/node_modules/typia/lib/internal/_assertGuard.js");
480
504
  const validateConfig = (()=>{
481
505
  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)=>{
482
506
  if ([
@@ -1154,6 +1178,7 @@ function pluginReactLynx(userOptions) {
1154
1178
  applyCSS(api, resolvedOptions);
1155
1179
  applyEntry(api, resolvedOptions);
1156
1180
  applyBackgroundOnly(api);
1181
+ applyGenerator(api);
1157
1182
  applyLoaders(api, resolvedOptions);
1158
1183
  applyRefresh(api);
1159
1184
  applySplitChunksRule(api);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/react-rsbuild-plugin",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "description": "A rsbuild plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -32,28 +32,29 @@
32
32
  "README.md"
33
33
  ],
34
34
  "dependencies": {
35
- "@lynx-js/css-extract-webpack-plugin": "0.5.2",
36
- "@lynx-js/react-alias-rsbuild-plugin": "0.9.4",
35
+ "@lynx-js/css-extract-webpack-plugin": "0.5.3",
36
+ "@lynx-js/react-alias-rsbuild-plugin": "0.9.5",
37
37
  "@lynx-js/react-refresh-webpack-plugin": "0.3.2",
38
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.7",
40
+ "@lynx-js/template-webpack-plugin": "0.6.8",
41
41
  "@lynx-js/web-webpack-plugin": "0.6.3"
42
42
  },
43
43
  "devDependencies": {
44
- "@microsoft/api-extractor": "7.51.1",
44
+ "@microsoft/api-extractor": "7.52.2",
45
45
  "@rollup/plugin-typescript": "^12.1.2",
46
- "@rsbuild/core": "1.2.19",
47
- "@rsbuild/plugin-sass": "1.2.2",
46
+ "@rsbuild/core": "1.3.2",
47
+ "@rsbuild/plugin-sass": "1.3.1",
48
48
  "@rsbuild/plugin-typed-css-modules": "1.0.2",
49
- "@rsbuild/plugin-webpack-swc": "1.0.12",
50
- "@rsbuild/webpack": "1.2.3",
49
+ "@rsbuild/plugin-webpack-swc": "1.1.0",
50
+ "@rsbuild/webpack": "1.3.0",
51
+ "@samchon/openapi": "3.2.3",
51
52
  "tailwindcss": "^3.4.17",
52
- "type-fest": "^4.38.0",
53
- "typia": "7.6.4",
54
- "typia-rspack-plugin": "^1.0.2",
55
- "@lynx-js/react": "0.106.2",
56
- "@lynx-js/rspeedy": "0.8.7",
53
+ "type-fest": "^4.39.0",
54
+ "typia": "8.1.1",
55
+ "typia-rspack-plugin": "2.0.0",
56
+ "@lynx-js/react": "0.106.3",
57
+ "@lynx-js/rspeedy": "0.9.0",
57
58
  "@lynx-js/vitest-setup": "0.0.0"
58
59
  },
59
60
  "peerDependencies": {