@lynx-js/react-rsbuild-plugin 0.10.1 → 0.10.3

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,35 @@
1
1
  # @lynx-js/react-rsbuild-plugin
2
2
 
3
+ ## 0.10.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Better [zustand](https://github.com/pmndrs/zustand) support by creating an alias for `use-sync-external-store`. ([#980](https://github.com/lynx-family/lynx-stack/pull/980))
8
+
9
+ See [lynx-family/lynx-stack#893](https://github.com/lynx-family/lynx-stack/issues/893) for more details.
10
+
11
+ - Updated dependencies [[`acc0d80`](https://github.com/lynx-family/lynx-stack/commit/acc0d80ae45cb5d9b54acec13baf88086b7ba798)]:
12
+ - @lynx-js/runtime-wrapper-webpack-plugin@0.1.1
13
+ - @lynx-js/react-alias-rsbuild-plugin@0.10.3
14
+ - @lynx-js/use-sync-external-store@1.5.0
15
+ - @lynx-js/react-refresh-webpack-plugin@0.3.3
16
+ - @lynx-js/react-webpack-plugin@0.6.15
17
+ - @lynx-js/css-extract-webpack-plugin@0.5.4
18
+ - @lynx-js/template-webpack-plugin@0.7.2
19
+
20
+ ## 0.10.2
21
+
22
+ ### Patch Changes
23
+
24
+ - Fix lazy bundle build failed on Rspeedy v0.9.8 (with `output.iife: true`). ([#972](https://github.com/lynx-family/lynx-stack/pull/972))
25
+
26
+ - Updated dependencies [[`81361f3`](https://github.com/lynx-family/lynx-stack/commit/81361f3c72001ffdf07f2f9f53f8e43d2ff7c961), [`7097f52`](https://github.com/lynx-family/lynx-stack/commit/7097f52a53460527f786e2a8f150c3a907b8e722), [`43cd520`](https://github.com/lynx-family/lynx-stack/commit/43cd520df78c3dc77aeb347a0be8c8f3ff62cc3f)]:
27
+ - @lynx-js/react-webpack-plugin@0.6.15
28
+ - @lynx-js/react-alias-rsbuild-plugin@0.10.2
29
+ - @lynx-js/template-webpack-plugin@0.7.1
30
+ - @lynx-js/react-refresh-webpack-plugin@0.3.3
31
+ - @lynx-js/css-extract-webpack-plugin@0.5.4
32
+
3
33
  ## 0.10.1
4
34
 
5
35
  ### Patch Changes
package/dist/525.js ADDED
@@ -0,0 +1,21 @@
1
+ export const __webpack_ids__ = [
2
+ "525"
3
+ ];
4
+ export const __webpack_modules__ = {
5
+ "./src/resolve.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6
+ __webpack_require__.d(__webpack_exports__, {
7
+ resolve: ()=>resolve,
8
+ resolveMainThread: ()=>resolveMainThread
9
+ });
10
+ var node_path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:path");
11
+ var node_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("node:url");
12
+ var _lynx_js_react_alias_rsbuild_plugin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("@lynx-js/react-alias-rsbuild-plugin");
13
+ const __dirname = node_path__WEBPACK_IMPORTED_MODULE_0__["default"].dirname((0, node_url__WEBPACK_IMPORTED_MODULE_1__.fileURLToPath)(import.meta.url));
14
+ const resolve = (0, _lynx_js_react_alias_rsbuild_plugin__WEBPACK_IMPORTED_MODULE_2__.createLazyResolver)(__dirname, [
15
+ 'import'
16
+ ]);
17
+ const resolveMainThread = (0, _lynx_js_react_alias_rsbuild_plugin__WEBPACK_IMPORTED_MODULE_2__.createLazyResolver)(__dirname, [
18
+ 'lepus'
19
+ ]);
20
+ }
21
+ };
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
2
1
  import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__ from "@lynx-js/react-alias-rsbuild-plugin";
3
- import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__ from "@lynx-js/react-webpack-plugin";
4
2
  import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
5
3
  import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
6
- import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__ from "@lynx-js/template-webpack-plugin";
7
- import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_runtime_wrapper_webpack_plugin_27793081__ from "@lynx-js/runtime-wrapper-webpack-plugin";
8
- import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_react_refresh_webpack_plugin_a01c5e97__ from "@lynx-js/react-refresh-webpack-plugin";
4
+ import { createRequire } from "node:module";
5
+ import { LAYERS, ReactWebpackPlugin } from "@lynx-js/react-webpack-plugin";
6
+ import { CSSPlugins, LynxEncodePlugin, LynxTemplatePlugin, WebEncodePlugin } from "@lynx-js/template-webpack-plugin";
7
+ import { RuntimeWrapperWebpackPlugin } from "@lynx-js/runtime-wrapper-webpack-plugin";
8
+ import { ReactRefreshRspackPlugin, ReactRefreshWebpackPlugin } from "@lynx-js/react-refresh-webpack-plugin";
9
9
  var __webpack_modules__ = {
10
10
  "../../../node_modules/.pnpm/typia@9.3.1_@samchon+openapi@4.3.2_typescript@5.8.3/node_modules/typia/lib/internal/_accessExpressionAsString.js": function(__unused_webpack_module, exports) {
11
11
  exports._accessExpressionAsString = void 0;
@@ -62,6 +62,15 @@ var __webpack_modules__ = {
62
62
  };
63
63
  exports._assertGuard = _assertGuard;
64
64
  },
65
+ "@lynx-js/react-alias-rsbuild-plugin": function(module) {
66
+ module.exports = __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__;
67
+ },
68
+ "node:path": function(module) {
69
+ module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
70
+ },
71
+ "node:url": function(module) {
72
+ module.exports = __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__;
73
+ },
65
74
  "../../../node_modules/.pnpm/typia@9.3.1_@samchon+openapi@4.3.2_typescript@5.8.3/node_modules/typia/lib/TypeGuardError.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
66
75
  __webpack_require__.r(__webpack_exports__);
67
76
  __webpack_require__.d(__webpack_exports__, {
@@ -96,6 +105,7 @@ function __webpack_require__(moduleId) {
96
105
  __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
97
106
  return module.exports;
98
107
  }
108
+ __webpack_require__.m = __webpack_modules__;
99
109
  (()=>{
100
110
  __webpack_require__.d = (exports, definition)=>{
101
111
  for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
@@ -104,6 +114,16 @@ function __webpack_require__(moduleId) {
104
114
  });
105
115
  };
106
116
  })();
117
+ (()=>{
118
+ __webpack_require__.f = {};
119
+ __webpack_require__.e = (chunkId)=>Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key)=>{
120
+ __webpack_require__.f[key](chunkId, promises);
121
+ return promises;
122
+ }, []));
123
+ })();
124
+ (()=>{
125
+ __webpack_require__.u = (chunkId)=>"" + chunkId + ".js";
126
+ })();
107
127
  (()=>{
108
128
  __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
109
129
  })();
@@ -117,32 +137,67 @@ function __webpack_require__(moduleId) {
117
137
  });
118
138
  };
119
139
  })();
140
+ (()=>{
141
+ var installedChunks = {
142
+ 980: 0
143
+ };
144
+ var installChunk = (data)=>{
145
+ var __webpack_ids__ = data.__webpack_ids__;
146
+ var __webpack_modules__ = data.__webpack_modules__;
147
+ var __webpack_runtime__ = data.__webpack_runtime__;
148
+ var moduleId, chunkId, i = 0;
149
+ for(moduleId in __webpack_modules__)if (__webpack_require__.o(__webpack_modules__, moduleId)) __webpack_require__.m[moduleId] = __webpack_modules__[moduleId];
150
+ if (__webpack_runtime__) __webpack_runtime__(__webpack_require__);
151
+ for(; i < __webpack_ids__.length; i++){
152
+ chunkId = __webpack_ids__[i];
153
+ if (__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) installedChunks[chunkId][0]();
154
+ installedChunks[__webpack_ids__[i]] = 0;
155
+ }
156
+ };
157
+ __webpack_require__.f.j = function(chunkId, promises) {
158
+ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : void 0;
159
+ if (0 !== installedChunkData) if (installedChunkData) promises.push(installedChunkData[1]);
160
+ else {
161
+ var promise = import("./" + __webpack_require__.u(chunkId)).then(installChunk, (e)=>{
162
+ if (0 !== installedChunks[chunkId]) installedChunks[chunkId] = void 0;
163
+ throw e;
164
+ });
165
+ var promise = Promise.race([
166
+ promise,
167
+ new Promise((resolve)=>{
168
+ installedChunkData = installedChunks[chunkId] = [
169
+ resolve
170
+ ];
171
+ })
172
+ ]);
173
+ promises.push(installedChunkData[1] = promise);
174
+ }
175
+ };
176
+ })();
177
+ var react_alias_rsbuild_plugin_ = __webpack_require__("@lynx-js/react-alias-rsbuild-plugin");
120
178
  function applyAlias(api, lazy) {
121
- return (0, __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__.pluginReactAlias)({
122
- LAYERS: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS,
179
+ return (0, react_alias_rsbuild_plugin_.pluginReactAlias)({
180
+ LAYERS: LAYERS,
123
181
  lazy,
124
182
  rootPath: api.context.rootPath
125
183
  }).setup(api);
126
184
  }
185
+ var external_node_path_ = __webpack_require__("node:path");
186
+ var external_node_url_ = __webpack_require__("node:url");
127
187
  const DETECT_IMPORT_ERROR = 'react:detect-import-error';
128
188
  const ALIAS_BACKGROUND_ONLY_MAIN = 'react:alias-background-only-main';
129
189
  const ALIAS_BACKGROUND_ONLY_BACKGROUND = 'react:alias-background-only-background';
130
190
  function applyBackgroundOnly(api) {
131
- const __dirname = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(import.meta.url));
132
- const backgroundResolve = (0, __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__.createLazyResolver)(__dirname, [
133
- 'import'
134
- ]);
135
- const mainThreadResolve = (0, __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__.createLazyResolver)(__dirname, [
136
- 'lepus'
137
- ]);
138
191
  api.modifyBundlerChain(async (chain)=>{
139
- const backgroundOnly = {
140
- background: await backgroundResolve('background-only'),
141
- mainThread: await mainThreadResolve('background-only')
142
- };
143
- chain.module.rule(ALIAS_BACKGROUND_ONLY_MAIN).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).resolve.alias.set('background-only$', backgroundOnly.mainThread);
144
- chain.module.rule(ALIAS_BACKGROUND_ONLY_BACKGROUND).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND).resolve.alias.set('background-only$', backgroundOnly.background);
145
- chain.module.rule(DETECT_IMPORT_ERROR).test(backgroundOnly.mainThread).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).use(DETECT_IMPORT_ERROR).loader(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(__dirname, 'loaders/invalid-import-error-loader')).options({
192
+ const __dirname = external_node_path_["default"].dirname((0, external_node_url_.fileURLToPath)(import.meta.url));
193
+ const { resolve, resolveMainThread } = await __webpack_require__.e("525").then(__webpack_require__.bind(__webpack_require__, "./src/resolve.ts"));
194
+ const [backgroundOnly, backgroundOnlyMainThread] = await Promise.all([
195
+ resolve('background-only'),
196
+ resolveMainThread('background-only')
197
+ ]);
198
+ chain.module.rule(ALIAS_BACKGROUND_ONLY_MAIN).issuerLayer(LAYERS.MAIN_THREAD).resolve.alias.set('background-only$', backgroundOnlyMainThread);
199
+ chain.module.rule(ALIAS_BACKGROUND_ONLY_BACKGROUND).issuerLayer(LAYERS.BACKGROUND).resolve.alias.set('background-only$', backgroundOnly);
200
+ chain.module.rule(DETECT_IMPORT_ERROR).test(backgroundOnlyMainThread).issuerLayer(LAYERS.MAIN_THREAD).use(DETECT_IMPORT_ERROR).loader(external_node_path_["default"].resolve(__dirname, 'loaders/invalid-import-error-loader')).options({
146
201
  message: '\'background-only\' cannot be imported from a main-thread module.'
147
202
  });
148
203
  });
@@ -154,7 +209,7 @@ function applyCSS(api, options) {
154
209
  injectStyles: false
155
210
  }
156
211
  }));
157
- const __dirname = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(import.meta.url));
212
+ const __dirname = external_node_path_["default"].dirname((0, external_node_url_.fileURLToPath)(import.meta.url));
158
213
  api.modifyBundlerChain(async function(chain, { CHAIN_ID, environment }) {
159
214
  const { CssExtractRspackPlugin, CssExtractWebpackPlugin } = await import("@lynx-js/css-extract-webpack-plugin");
160
215
  const CssExtractPlugin = 'rspack' === api.context.bundlerType ? CssExtractRspackPlugin : CssExtractWebpackPlugin;
@@ -167,11 +222,11 @@ function applyCSS(api, options) {
167
222
  cssRules.filter((rule)=>chain.module.rules.has(rule)).forEach((ruleName)=>{
168
223
  const rule = chain.module.rule(ruleName);
169
224
  removeLightningCSS(rule);
170
- rule.issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND).use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader(CssExtractPlugin.loader).end();
225
+ rule.issuerLayer(LAYERS.BACKGROUND).use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader(CssExtractPlugin.loader).end();
171
226
  const uses = rule.uses.entries();
172
227
  const ruleEntries = rule.entries();
173
228
  const cssLoaderRule = uses[CHAIN_ID.USE.CSS].entries();
174
- 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();
229
+ chain.module.rule(`${ruleName}:${LAYERS.MAIN_THREAD}`).merge(ruleEntries).issuerLayer(LAYERS.MAIN_THREAD).use(CHAIN_ID.USE.IGNORE_CSS).loader(external_node_path_["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();
175
230
  });
176
231
  const inlineCSSRules = [
177
232
  CHAIN_ID.RULE.CSS_INLINE,
@@ -194,7 +249,7 @@ function applyCSS(api, options) {
194
249
  enableCSSInvalidation,
195
250
  targetSdkVersion,
196
251
  cssPlugins: [
197
- __WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__.CSSPlugins.parserPlugins.removeFunctionWhiteSpace()
252
+ CSSPlugins.parserPlugins.removeFunctionWhiteSpace()
198
253
  ]
199
254
  }
200
255
  ]).init((_, args)=>new CssExtractPlugin(...args)).end().end();
@@ -244,36 +299,36 @@ function applyEntry(api, options) {
244
299
  const { imports } = getChunks(entryName, entryPoint.values());
245
300
  const templateFilename = ('object' == typeof config.output?.filename ? config.output.filename.bundle ?? config.output.filename.template : config.output?.filename) ?? '[name].[platform].bundle';
246
301
  const mainThreadEntry = `${entryName}__main-thread`;
247
- const mainThreadName = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join(isLynx ? DEFAULT_DIST_PATH_INTERMEDIATE : '', `${entryName}/main-thread.js`);
248
- const backgroundName = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join(isLynx ? DEFAULT_DIST_PATH_INTERMEDIATE : '', getBackgroundFilename(entryName, environment.config, isProd, experimental_isLazyBundle));
302
+ const mainThreadName = external_node_path_["default"].posix.join(isLynx ? DEFAULT_DIST_PATH_INTERMEDIATE : '', `${entryName}/main-thread.js`);
303
+ const backgroundName = external_node_path_["default"].posix.join(isLynx ? DEFAULT_DIST_PATH_INTERMEDIATE : '', getBackgroundFilename(entryName, environment.config, isProd, experimental_isLazyBundle));
249
304
  const backgroundEntry = entryName;
250
305
  mainThreadChunks.push(mainThreadName);
251
306
  chain.entry(mainThreadEntry).add({
252
- layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD,
307
+ layer: LAYERS.MAIN_THREAD,
253
308
  import: imports,
254
309
  filename: mainThreadName
255
310
  }).when(isDev && !isWeb, (entry)=>{
256
- const require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
311
+ const require = createRequire(import.meta.url);
257
312
  entry.prepend({
258
- layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD,
313
+ layer: LAYERS.MAIN_THREAD,
259
314
  import: require.resolve('@lynx-js/css-extract-webpack-plugin/runtime/hotModuleReplacement.lepus.cjs')
260
315
  });
261
316
  }).end().entry(backgroundEntry).add({
262
- layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND,
317
+ layer: LAYERS.BACKGROUND,
263
318
  import: imports,
264
319
  filename: backgroundName
265
320
  }).when(isDev && !isWeb, (entry)=>{
266
321
  entry.prepend({
267
- layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND,
322
+ layer: LAYERS.BACKGROUND,
268
323
  import: '@rspack/core/hot/dev-server'
269
324
  }).prepend({
270
- layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND,
325
+ layer: LAYERS.BACKGROUND,
271
326
  import: '@lynx-js/webpack-dev-transport/client'
272
327
  }).prepend({
273
- layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND,
328
+ layer: LAYERS.BACKGROUND,
274
329
  import: '@lynx-js/react/refresh'
275
330
  });
276
- }).end().plugin(`${PLUGIN_NAME_TEMPLATE}-${entryName}`).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__.LynxTemplatePlugin, [
331
+ }).end().plugin(`${PLUGIN_NAME_TEMPLATE}-${entryName}`).use(LynxTemplatePlugin, [
277
332
  {
278
333
  dsl: 'react_nodiff',
279
334
  chunks: [
@@ -281,7 +336,7 @@ function applyEntry(api, options) {
281
336
  backgroundEntry
282
337
  ],
283
338
  filename: templateFilename.replaceAll('[name]', entryName).replaceAll('[platform]', environment.name),
284
- intermediate: __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join(DEFAULT_DIST_PATH_INTERMEDIATE, entryName),
339
+ intermediate: external_node_path_["default"].posix.join(DEFAULT_DIST_PATH_INTERMEDIATE, entryName),
285
340
  customCSSInheritanceList,
286
341
  debugInfoOutside,
287
342
  defaultDisplayLinear,
@@ -299,14 +354,14 @@ function applyEntry(api, options) {
299
354
  targetSdkVersion,
300
355
  experimental_isLazyBundle,
301
356
  cssPlugins: [
302
- __WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__.CSSPlugins.parserPlugins.removeFunctionWhiteSpace()
357
+ CSSPlugins.parserPlugins.removeFunctionWhiteSpace()
303
358
  ]
304
359
  }
305
360
  ]).end();
306
361
  });
307
362
  if (isLynx) {
308
363
  const inlineScripts = 'boolean' == typeof environment.config.output?.inlineScripts ? environment.config.output.inlineScripts : true;
309
- chain.plugin(PLUGIN_NAME_RUNTIME_WRAPPER).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_runtime_wrapper_webpack_plugin_27793081__.RuntimeWrapperWebpackPlugin, [
364
+ chain.plugin(PLUGIN_NAME_RUNTIME_WRAPPER).use(RuntimeWrapperWebpackPlugin, [
310
365
  {
311
366
  injectVars (vars) {
312
367
  const UNUSED_VARS = new Set([
@@ -324,15 +379,15 @@ function applyEntry(api, options) {
324
379
  test: /^(?!.*main-thread(?:\.[A-Fa-f0-9]*)?\.js$).*\.js$/,
325
380
  experimental_isLazyBundle
326
381
  }
327
- ]).end().plugin(`${__WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__.LynxEncodePlugin.name}`).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__.LynxEncodePlugin, [
382
+ ]).end().plugin(`${LynxEncodePlugin.name}`).use(LynxEncodePlugin, [
328
383
  {
329
384
  inlineScripts
330
385
  }
331
386
  ]).end();
332
387
  }
333
- if (isWeb) chain.plugin(PLUGIN_NAME_WEB).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__.WebEncodePlugin, []).end();
388
+ if (isWeb) chain.plugin(PLUGIN_NAME_WEB).use(WebEncodePlugin, []).end();
334
389
  const rsbuildConfig = api.getRsbuildConfig();
335
- chain.plugin(PLUGIN_NAME_REACT).after(PLUGIN_NAME_TEMPLATE).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.ReactWebpackPlugin, [
390
+ chain.plugin(PLUGIN_NAME_REACT).after(PLUGIN_NAME_TEMPLATE).use(ReactWebpackPlugin, [
336
391
  {
337
392
  disableCreateSelectorQueryIncompatibleWarning: compat?.disableCreateSelectorQueryIncompatibleWarning ?? false,
338
393
  firstScreenSyncTiming,
@@ -385,7 +440,7 @@ function applyGenerator(api) {
385
440
  api.modifyBundlerChain({
386
441
  order: 'pre',
387
442
  handler: (chain)=>{
388
- 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({
443
+ chain.module.rule(`json-parse:${LAYERS.MAIN_THREAD}`).issuerLayer(LAYERS.MAIN_THREAD).test(/\.json$/).type('json').generator({
389
444
  JSONParse: false
390
445
  });
391
446
  }
@@ -410,16 +465,16 @@ function applyLoaders(api, options) {
410
465
  const uses = rule.uses.entries() ?? {};
411
466
  const { output } = api.getRsbuildConfig();
412
467
  const inlineSourcesContent = output?.sourceMap === true || !(output?.sourceMap === false || output?.sourceMap?.js === false || output?.sourceMap?.js?.includes('nosources'));
413
- const backgroundRule = rule.oneOf(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND);
414
- backgroundRule.issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND).uses.merge(uses).end().use(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND).loader(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.ReactWebpackPlugin.loaders.BACKGROUND).options({
468
+ const backgroundRule = rule.oneOf(LAYERS.BACKGROUND);
469
+ backgroundRule.issuerLayer(LAYERS.BACKGROUND).uses.merge(uses).end().use(LAYERS.BACKGROUND).loader(ReactWebpackPlugin.loaders.BACKGROUND).options({
415
470
  compat,
416
471
  enableRemoveCSSScope,
417
472
  isDynamicComponent: experimental_isLazyBundle,
418
473
  inlineSourcesContent,
419
474
  defineDCE
420
475
  }).end();
421
- const mainThreadRule = rule.oneOf(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD);
422
- mainThreadRule.issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).uses.merge(uses).end().when(void 0 !== uses[CHAIN_ID.USE.SWC], (rule)=>{
476
+ const mainThreadRule = rule.oneOf(LAYERS.MAIN_THREAD);
477
+ mainThreadRule.issuerLayer(LAYERS.MAIN_THREAD).uses.merge(uses).end().when(void 0 !== uses[CHAIN_ID.USE.SWC], (rule)=>{
423
478
  rule.uses.delete(CHAIN_ID.USE.SWC);
424
479
  const swcLoaderRule = uses[CHAIN_ID.USE.SWC].entries();
425
480
  const swcLoaderOptions = swcLoaderRule.options;
@@ -430,7 +485,7 @@ function applyLoaders(api, options) {
430
485
  target: 'es2019'
431
486
  }
432
487
  });
433
- }).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).loader(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.ReactWebpackPlugin.loaders.MAIN_THREAD).options({
488
+ }).use(LAYERS.MAIN_THREAD).loader(ReactWebpackPlugin.loaders.MAIN_THREAD).options({
434
489
  compat,
435
490
  enableRemoveCSSScope,
436
491
  inlineSourcesContent,
@@ -442,20 +497,20 @@ function applyLoaders(api, options) {
442
497
  });
443
498
  }
444
499
  const PLUGIN_NAME_REACT_REFRESH = 'lynx:react:refresh';
445
- const refresh_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
500
+ const refresh_require = createRequire(import.meta.url);
446
501
  function applyRefresh(api) {
447
502
  api.modifyWebpackChain((chain, { CHAIN_ID, isProd })=>{
448
- if (!isProd) applyRefreshRules(chain, CHAIN_ID, __WEBPACK_EXTERNAL_MODULE__lynx_js_react_refresh_webpack_plugin_a01c5e97__.ReactRefreshWebpackPlugin);
503
+ if (!isProd) applyRefreshRules(chain, CHAIN_ID, ReactRefreshWebpackPlugin);
449
504
  });
450
505
  api.modifyBundlerChain((chain, { isProd, CHAIN_ID })=>{
451
506
  if (!isProd) {
452
- applyRefreshRules(chain, CHAIN_ID, __WEBPACK_EXTERNAL_MODULE__lynx_js_react_refresh_webpack_plugin_a01c5e97__.ReactRefreshRspackPlugin);
507
+ applyRefreshRules(chain, CHAIN_ID, ReactRefreshRspackPlugin);
453
508
  chain.resolve.alias.set('@lynx-js/react/refresh$', refresh_require.resolve('@lynx-js/react/refresh')).end();
454
509
  }
455
510
  });
456
511
  }
457
512
  function applyRefreshRules(chain, CHAIN_ID, ReactRefreshPlugin) {
458
- chain.plugin(PLUGIN_NAME_REACT_REFRESH).before(CHAIN_ID.PLUGIN.HMR).use(ReactRefreshPlugin).end().module.rule('react:refresh').issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND).before(CHAIN_ID.RULE.JS).test(/\.[jt]sx$/).exclude.add(/node_modules/).add(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(refresh_require.resolve('@lynx-js/react/package.json'))).add(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(refresh_require.resolve('@lynx-js/react/refresh'))).add(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(refresh_require.resolve('@lynx-js/react/worklet-runtime'))).add(ReactRefreshPlugin.loader).end().use('ReactRefresh').loader(ReactRefreshPlugin.loader).options({}).end().end().end().end();
513
+ chain.plugin(PLUGIN_NAME_REACT_REFRESH).before(CHAIN_ID.PLUGIN.HMR).use(ReactRefreshPlugin).end().module.rule('react:refresh').issuerLayer(LAYERS.BACKGROUND).before(CHAIN_ID.RULE.JS).test(/\.[jt]sx$/).exclude.add(/node_modules/).add(external_node_path_["default"].dirname(refresh_require.resolve('@lynx-js/react/package.json'))).add(external_node_path_["default"].dirname(refresh_require.resolve('@lynx-js/react/refresh'))).add(external_node_path_["default"].dirname(refresh_require.resolve('@lynx-js/react/worklet-runtime'))).add(ReactRefreshPlugin.loader).end().use('ReactRefresh').loader(ReactRefreshPlugin.loader).options({}).end().end().end().end();
459
514
  }
460
515
  const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj);
461
516
  const applySplitChunksRule = (api)=>{
@@ -520,6 +575,20 @@ function applySWC(api) {
520
575
  }
521
576
  }, config));
522
577
  }
578
+ function applyUseSyncExternalStore(api) {
579
+ api.modifyBundlerChain(async (chain)=>{
580
+ const { resolve } = await __webpack_require__.e("525").then(__webpack_require__.bind(__webpack_require__, "./src/resolve.ts"));
581
+ const useSyncExternalStoreEntries = [
582
+ 'use-sync-external-store',
583
+ 'use-sync-external-store/with-selector',
584
+ 'use-sync-external-store/shim',
585
+ 'use-sync-external-store/shim/with-selector'
586
+ ];
587
+ await Promise.all(useSyncExternalStoreEntries.map((entry)=>resolve(`@lynx-js/${entry}`).then((value)=>{
588
+ chain.resolve.alias.set(`${entry}$`, value);
589
+ })));
590
+ });
591
+ }
523
592
  var _accessExpressionAsString = __webpack_require__("../../../node_modules/.pnpm/typia@9.3.1_@samchon+openapi@4.3.2_typescript@5.8.3/node_modules/typia/lib/internal/_accessExpressionAsString.js");
524
593
  var _assertGuard = __webpack_require__("../../../node_modules/.pnpm/typia@9.3.1_@samchon+openapi@4.3.2_typescript@5.8.3/node_modules/typia/lib/internal/_assertGuard.js");
525
594
  const validateConfig = (()=>{
@@ -1144,6 +1213,7 @@ function pluginReactLynx(userOptions) {
1144
1213
  applyRefresh(api);
1145
1214
  applySplitChunksRule(api);
1146
1215
  applySWC(api);
1216
+ applyUseSyncExternalStore(api);
1147
1217
  api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
1148
1218
  const userConfig = api.getRsbuildConfig('original');
1149
1219
  if (void 0 === userConfig.source?.include) config = mergeRsbuildConfig(config, {
@@ -1162,7 +1232,7 @@ function pluginReactLynx(userOptions) {
1162
1232
  });
1163
1233
  if (resolvedOptions.experimental_isLazyBundle) applyLazy(api);
1164
1234
  const rspeedyAPIs = api.useExposed(Symbol.for('rspeedy.api'));
1165
- const require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url);
1235
+ const require = createRequire(import.meta.url);
1166
1236
  const { version } = require('../package.json');
1167
1237
  rspeedyAPIs.debug(()=>{
1168
1238
  const webpackPluginPath = require.resolve('@lynx-js/react-webpack-plugin');
@@ -1171,5 +1241,4 @@ function pluginReactLynx(userOptions) {
1171
1241
  }
1172
1242
  };
1173
1243
  }
1174
- var __webpack_exports__LAYERS = __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS;
1175
- export { pluginReactLynx, __webpack_exports__LAYERS as LAYERS };
1244
+ 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.1",
3
+ "version": "0.10.3",
4
4
  "description": "A rsbuild plugin for ReactLynx",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -33,18 +33,19 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@lynx-js/css-extract-webpack-plugin": "0.5.4",
36
- "@lynx-js/react-alias-rsbuild-plugin": "0.10.1",
36
+ "@lynx-js/react-alias-rsbuild-plugin": "0.10.3",
37
37
  "@lynx-js/react-refresh-webpack-plugin": "0.3.3",
38
- "@lynx-js/react-webpack-plugin": "0.6.14",
39
- "@lynx-js/runtime-wrapper-webpack-plugin": "0.1.0",
40
- "@lynx-js/template-webpack-plugin": "0.7.0",
38
+ "@lynx-js/react-webpack-plugin": "0.6.15",
39
+ "@lynx-js/runtime-wrapper-webpack-plugin": "0.1.1",
40
+ "@lynx-js/template-webpack-plugin": "0.7.2",
41
+ "@lynx-js/use-sync-external-store": "1.5.0",
41
42
  "background-only": "^0.0.1"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@microsoft/api-extractor": "7.52.8",
45
46
  "@rollup/plugin-typescript": "^12.1.2",
46
47
  "@rsbuild/core": "1.3.21",
47
- "@rsbuild/plugin-sass": "1.3.1",
48
+ "@rsbuild/plugin-sass": "1.3.2",
48
49
  "@rsbuild/plugin-typed-css-modules": "1.0.2",
49
50
  "@rsbuild/plugin-webpack-swc": "1.1.1",
50
51
  "@rsbuild/webpack": "1.3.2",
@@ -53,9 +54,9 @@
53
54
  "type-fest": "^4.41.0",
54
55
  "typia": "9.3.1",
55
56
  "typia-rspack-plugin": "2.1.0",
56
- "@lynx-js/react": "0.109.0",
57
+ "@lynx-js/react": "0.109.2",
57
58
  "@lynx-js/react-transform": "0.2.0",
58
- "@lynx-js/rspeedy": "0.9.7",
59
+ "@lynx-js/rspeedy": "0.9.9",
59
60
  "@lynx-js/vitest-setup": "0.0.0"
60
61
  },
61
62
  "peerDependencies": {