@lynx-js/react-rsbuild-plugin 0.12.4 → 0.12.6

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/dist/208.js ADDED
@@ -0,0 +1,1213 @@
1
+ import { __webpack_require__ } from "./rslib-runtime.js";
2
+ import { createRequire } from "node:module";
3
+ import { createLazyResolver, pluginReactAlias } from "@lynx-js/react-alias-rsbuild-plugin";
4
+ import { LAYERS, ReactWebpackPlugin } from "@lynx-js/react-webpack-plugin";
5
+ import { LynxEncodePlugin, LynxTemplatePlugin, WebEncodePlugin } from "@lynx-js/template-webpack-plugin";
6
+ import node_path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import { RuntimeWrapperWebpackPlugin } from "@lynx-js/runtime-wrapper-webpack-plugin";
9
+ import { ReactRefreshRspackPlugin, ReactRefreshWebpackPlugin } from "@lynx-js/react-refresh-webpack-plugin";
10
+ __webpack_require__.add({
11
+ "../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_accessExpressionAsString.js" (__unused_rspack_module, exports) {
12
+ exports._accessExpressionAsString = void 0;
13
+ const _accessExpressionAsString = (str)=>variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`;
14
+ exports._accessExpressionAsString = _accessExpressionAsString;
15
+ const variable = (str)=>false === reserved(str) && /^[a-zA-Z_$][a-zA-Z_$0-9]*$/g.test(str);
16
+ const reserved = (str)=>RESERVED.has(str);
17
+ const RESERVED = new Set([
18
+ "break",
19
+ "case",
20
+ "catch",
21
+ "class",
22
+ "const",
23
+ "continue",
24
+ "debugger",
25
+ "default",
26
+ "delete",
27
+ "do",
28
+ "else",
29
+ "enum",
30
+ "export",
31
+ "extends",
32
+ "false",
33
+ "finally",
34
+ "for",
35
+ "function",
36
+ "if",
37
+ "import",
38
+ "in",
39
+ "instanceof",
40
+ "new",
41
+ "null",
42
+ "return",
43
+ "super",
44
+ "switch",
45
+ "this",
46
+ "throw",
47
+ "true",
48
+ "try",
49
+ "typeof",
50
+ "var",
51
+ "void",
52
+ "while",
53
+ "with"
54
+ ]);
55
+ },
56
+ "../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_assertGuard.js" (__unused_rspack_module, exports, __webpack_require__) {
57
+ exports._assertGuard = void 0;
58
+ const TypeGuardError_1 = __webpack_require__("../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/TypeGuardError.mjs");
59
+ const _assertGuard = (exceptionable, props, factory)=>{
60
+ if (true === exceptionable) if (factory) throw factory(props);
61
+ else throw new TypeGuardError_1.TypeGuardError(props);
62
+ return false;
63
+ };
64
+ exports._assertGuard = _assertGuard;
65
+ },
66
+ "../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/TypeGuardError.mjs" (__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
67
+ __webpack_require__.r(__webpack_exports__);
68
+ __webpack_require__.d(__webpack_exports__, {
69
+ TypeGuardError: ()=>TypeGuardError
70
+ });
71
+ class TypeGuardError extends Error {
72
+ method;
73
+ path;
74
+ expected;
75
+ value;
76
+ description;
77
+ fake_expected_typed_value_;
78
+ constructor(props){
79
+ super(props.message || `Error on ${props.method}(): invalid type${props.path ? ` on ${props.path}` : ""}, expect to be ${props.expected}`);
80
+ const proto = new.target.prototype;
81
+ if (Object.setPrototypeOf) Object.setPrototypeOf(this, proto);
82
+ else this.__proto__ = proto;
83
+ this.method = props.method;
84
+ this.path = props.path;
85
+ this.expected = props.expected;
86
+ this.value = props.value;
87
+ if (props.description || void 0 === props.value) this.description = props.description ?? [
88
+ "The value at this path is `undefined`.",
89
+ "",
90
+ `Please fill the \`${props.expected}\` typed value next time.`
91
+ ].join("\n");
92
+ }
93
+ }
94
+ }
95
+ });
96
+ const DETECT_IMPORT_ERROR = 'react:detect-import-error';
97
+ const ALIAS_BACKGROUND_ONLY_MAIN = 'react:alias-background-only-main';
98
+ const ALIAS_BACKGROUND_ONLY_BACKGROUND = 'react:alias-background-only-background';
99
+ function applyBackgroundOnly(api) {
100
+ api.modifyBundlerChain(async (chain, { rspack })=>{
101
+ const __dirname = node_path.dirname(fileURLToPath(import.meta.url));
102
+ const { getImportResolver, getMainThreadResolver } = await import("./300.js").then((mod)=>({
103
+ getImportResolver: mod.getImportResolver,
104
+ getMainThreadResolver: mod.getMainThreadResolver
105
+ }));
106
+ const resolve = getImportResolver(rspack);
107
+ const resolveMainThread = getMainThreadResolver(rspack);
108
+ const [backgroundOnly, backgroundOnlyMainThread] = await Promise.all([
109
+ resolve('background-only'),
110
+ resolveMainThread('background-only')
111
+ ]);
112
+ chain.module.rule(ALIAS_BACKGROUND_ONLY_MAIN).issuerLayer(LAYERS.MAIN_THREAD).resolve.alias.set('background-only$', backgroundOnlyMainThread);
113
+ chain.module.rule(ALIAS_BACKGROUND_ONLY_BACKGROUND).issuerLayer(LAYERS.BACKGROUND).resolve.alias.set('background-only$', backgroundOnly);
114
+ chain.module.rule(DETECT_IMPORT_ERROR).test(backgroundOnlyMainThread).issuerLayer(LAYERS.MAIN_THREAD).use(DETECT_IMPORT_ERROR).loader(node_path.resolve(__dirname, 'loaders/invalid-import-error-loader')).options({
115
+ message: '\'background-only\' cannot be imported from a main-thread module.'
116
+ });
117
+ });
118
+ }
119
+ function applyCSS(api, options) {
120
+ const { enableRemoveCSSScope, enableCSSSelector, enableCSSInvalidation, targetSdkVersion } = options;
121
+ api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>mergeRsbuildConfig(config, {
122
+ output: {
123
+ injectStyles: false
124
+ }
125
+ }));
126
+ const __dirname = node_path.dirname(fileURLToPath(import.meta.url));
127
+ api.modifyBundlerChain(async function(chain, { CHAIN_ID }) {
128
+ const { CssExtractRspackPlugin, CssExtractWebpackPlugin } = await import("@lynx-js/css-extract-webpack-plugin");
129
+ const CssExtractPlugin = 'rspack' === api.context.bundlerType ? CssExtractRspackPlugin : CssExtractWebpackPlugin;
130
+ const cssRules = [
131
+ CHAIN_ID.RULE.CSS,
132
+ CHAIN_ID.RULE.SASS,
133
+ CHAIN_ID.RULE.LESS,
134
+ CHAIN_ID.RULE.STYLUS
135
+ ];
136
+ cssRules.filter((rule)=>chain.module.rules.has(rule)).forEach((ruleName)=>{
137
+ const rule = chain.module.rule(ruleName);
138
+ removeLightningCSS(rule);
139
+ rule.issuerLayer(LAYERS.BACKGROUND).use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader(CssExtractPlugin.loader).end();
140
+ const uses = rule.uses.entries();
141
+ const ruleEntries = rule.entries();
142
+ const cssLoaderRule = uses[CHAIN_ID.USE.CSS].entries();
143
+ chain.module.rule(`${ruleName}:${LAYERS.MAIN_THREAD}`).merge(ruleEntries).issuerLayer(LAYERS.MAIN_THREAD).use(CHAIN_ID.USE.IGNORE_CSS).loader(node_path.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();
144
+ });
145
+ const inlineCSSRules = [
146
+ CHAIN_ID.RULE.CSS_INLINE,
147
+ CHAIN_ID.RULE.SASS_INLINE,
148
+ CHAIN_ID.RULE.LESS_INLINE,
149
+ CHAIN_ID.RULE.STYLUS_INLINE
150
+ ];
151
+ inlineCSSRules.filter((rule)=>rule && chain.module.rules.has(rule)).forEach((ruleName)=>{
152
+ const rule = chain.module.rule(ruleName);
153
+ removeLightningCSS(rule);
154
+ });
155
+ function removeLightningCSS(rule) {
156
+ if (rule.uses.has(CHAIN_ID.USE.LIGHTNINGCSS)) rule.uses.delete(CHAIN_ID.USE.LIGHTNINGCSS);
157
+ }
158
+ chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).tap(([options])=>[
159
+ {
160
+ ...options,
161
+ enableRemoveCSSScope: enableRemoveCSSScope ?? true,
162
+ enableCSSSelector,
163
+ enableCSSInvalidation,
164
+ targetSdkVersion,
165
+ cssPlugins: []
166
+ }
167
+ ]).init((_, args)=>new CssExtractPlugin(...args)).end().end();
168
+ chain.module.when(void 0 === enableRemoveCSSScope, (module)=>module.rule('lynx.css.scoped').test(/\.css$/).resourceQuery({
169
+ and: [
170
+ /cssId/
171
+ ]
172
+ }).sideEffects(false));
173
+ });
174
+ }
175
+ const normalizeCssLoaderOptions = (options, exportOnlyLocals)=>{
176
+ if (options.modules && exportOnlyLocals) {
177
+ let { modules } = options;
178
+ modules = true === modules ? {
179
+ exportOnlyLocals: true
180
+ } : 'string' == typeof modules ? {
181
+ mode: modules,
182
+ exportOnlyLocals: true
183
+ } : {
184
+ ...modules,
185
+ exportOnlyLocals: true
186
+ };
187
+ return {
188
+ ...options,
189
+ modules
190
+ };
191
+ }
192
+ return options;
193
+ };
194
+ const PLUGIN_NAME_REACT = 'lynx:react';
195
+ const PLUGIN_NAME_TEMPLATE = 'lynx:template';
196
+ const PLUGIN_NAME_RUNTIME_WRAPPER = 'lynx:runtime-wrapper';
197
+ const PLUGIN_NAME_WEB = 'lynx:web';
198
+ const DEFAULT_DIST_PATH_INTERMEDIATE = '.rspeedy';
199
+ const DEFAULT_FILENAME_HASH = '.[contenthash:8]';
200
+ const EMPTY_HASH = '';
201
+ function applyEntry(api, options) {
202
+ const { compat, customCSSInheritanceList, debugInfoOutside, defaultDisplayLinear, enableAccessibilityElement, enableCSSInheritance, enableCSSInvalidation, enableCSSSelector, enableNewGesture, enableRemoveCSSScope, firstScreenSyncTiming, enableSSR, removeDescendantSelectorScope, targetSdkVersion, extractStr: originalExtractStr, experimental_isLazyBundle } = options;
203
+ api.modifyBundlerChain(async (chain, { environment, isDev, isProd })=>{
204
+ const mainThreadChunks = [];
205
+ const rsbuildConfig = api.getRsbuildConfig();
206
+ const userConfig = api.getRsbuildConfig('original');
207
+ const enableChunkSplitting = rsbuildConfig.performance?.chunkSplit?.strategy !== 'all-in-one';
208
+ const isRspeedy = 'rspeedy' === api.context.callerName;
209
+ if (isRspeedy) {
210
+ const { config } = api.useExposed(Symbol.for('rspeedy.api'));
211
+ const entries = chain.entryPoints.entries() ?? {};
212
+ const isLynx = 'lynx' === environment.name || environment.name.startsWith('lynx-');
213
+ const isWeb = 'web' === environment.name || environment.name.startsWith('web-');
214
+ const { hmr, liveReload } = environment.config.dev ?? {};
215
+ const enabledHMR = isDev && !isWeb && false !== hmr;
216
+ const enabledLiveReload = isDev && !isWeb && false !== liveReload;
217
+ chain.entryPoints.clear();
218
+ Object.entries(entries).forEach(([entryName, entryPoint])=>{
219
+ const { imports } = getChunks(entryName, entryPoint.values());
220
+ const templateFilename = ('object' == typeof config.output?.filename ? config.output.filename.bundle ?? config.output.filename.template : config.output?.filename) ?? '[name].[platform].bundle';
221
+ const mainThreadEntry = `${entryName}__main-thread`;
222
+ const mainThreadName = node_path.posix.join(isLynx ? DEFAULT_DIST_PATH_INTERMEDIATE : '', `${entryName}/main-thread.js`);
223
+ const backgroundName = node_path.posix.join(isLynx ? DEFAULT_DIST_PATH_INTERMEDIATE : '', getBackgroundFilename(entryName, environment.config, isProd, experimental_isLazyBundle));
224
+ const backgroundEntry = entryName;
225
+ mainThreadChunks.push(mainThreadName);
226
+ chain.entry(mainThreadEntry).add({
227
+ layer: LAYERS.MAIN_THREAD,
228
+ import: imports,
229
+ filename: mainThreadName
230
+ }).when(enabledHMR, (entry)=>{
231
+ const require = createRequire(import.meta.url);
232
+ entry.prepend({
233
+ layer: LAYERS.MAIN_THREAD,
234
+ import: require.resolve('@lynx-js/css-extract-webpack-plugin/runtime/hotModuleReplacement.lepus.cjs')
235
+ });
236
+ }).end().entry(backgroundEntry).add({
237
+ layer: LAYERS.BACKGROUND,
238
+ import: imports,
239
+ filename: backgroundName
240
+ }).when(enabledHMR, (entry)=>{
241
+ entry.prepend({
242
+ layer: LAYERS.BACKGROUND,
243
+ import: '@rspack/core/hot/dev-server'
244
+ }).prepend({
245
+ layer: LAYERS.BACKGROUND,
246
+ import: '@lynx-js/react/refresh'
247
+ });
248
+ }).when(enabledHMR || enabledLiveReload, (entry)=>{
249
+ entry.prepend({
250
+ layer: LAYERS.BACKGROUND,
251
+ import: '@lynx-js/webpack-dev-transport/client'
252
+ });
253
+ }).end().plugin(`${PLUGIN_NAME_TEMPLATE}-${entryName}`).use(LynxTemplatePlugin, [
254
+ {
255
+ dsl: 'react_nodiff',
256
+ chunks: [
257
+ mainThreadEntry,
258
+ backgroundEntry
259
+ ],
260
+ filename: templateFilename.replaceAll('[name]', entryName).replaceAll('[platform]', environment.name),
261
+ intermediate: node_path.posix.join(DEFAULT_DIST_PATH_INTERMEDIATE, entryName),
262
+ customCSSInheritanceList,
263
+ debugInfoOutside,
264
+ defaultDisplayLinear,
265
+ enableA11y: true,
266
+ enableAccessibilityElement,
267
+ enableCSSInheritance,
268
+ enableCSSInvalidation,
269
+ enableCSSSelector,
270
+ enableNewGesture,
271
+ enableRemoveCSSScope: enableRemoveCSSScope ?? true,
272
+ removeDescendantSelectorScope,
273
+ targetSdkVersion,
274
+ experimental_isLazyBundle,
275
+ cssPlugins: []
276
+ }
277
+ ]).end();
278
+ });
279
+ if (isLynx) {
280
+ let inlineScripts;
281
+ inlineScripts = experimental_isLazyBundle ? true : environment.config.output?.inlineScripts ?? !enableChunkSplitting;
282
+ chain.plugin(PLUGIN_NAME_RUNTIME_WRAPPER).use(RuntimeWrapperWebpackPlugin, [
283
+ {
284
+ injectVars (vars) {
285
+ const UNUSED_VARS = new Set([
286
+ 'Card',
287
+ 'Component',
288
+ 'ReactLynx',
289
+ 'Behavior'
290
+ ]);
291
+ return vars.map((name)=>{
292
+ if (UNUSED_VARS.has(name)) return `__${name}`;
293
+ return name;
294
+ });
295
+ },
296
+ targetSdkVersion,
297
+ test: /^(?!.*main-thread(?:\.[A-Fa-f0-9]*)?\.js$).*\.js$/,
298
+ experimental_isLazyBundle
299
+ }
300
+ ]).end().plugin(`${LynxEncodePlugin.name}`).use(LynxEncodePlugin, [
301
+ {
302
+ inlineScripts
303
+ }
304
+ ]).end();
305
+ }
306
+ if (isWeb) chain.plugin(PLUGIN_NAME_WEB).use(WebEncodePlugin, []).end();
307
+ }
308
+ let extractStr = originalExtractStr;
309
+ if (enableChunkSplitting && originalExtractStr) {
310
+ (api.logger ?? console).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.`');
311
+ extractStr = false;
312
+ }
313
+ const { resolve } = api.useExposed(Symbol.for('@lynx-js/react/internal:resolve'));
314
+ chain.plugin(PLUGIN_NAME_REACT).after(PLUGIN_NAME_TEMPLATE).use(ReactWebpackPlugin, [
315
+ {
316
+ disableCreateSelectorQueryIncompatibleWarning: compat?.disableCreateSelectorQueryIncompatibleWarning ?? false,
317
+ firstScreenSyncTiming,
318
+ enableSSR,
319
+ mainThreadChunks,
320
+ extractStr,
321
+ experimental_isLazyBundle,
322
+ profile: getDefaultProfile(),
323
+ workletRuntimePath: await resolve(`@lynx-js/react/${isDev ? 'worklet-dev-runtime' : 'worklet-runtime'}`)
324
+ }
325
+ ]);
326
+ function getDefaultProfile() {
327
+ if (userConfig.performance?.profile !== void 0) return userConfig.performance.profile;
328
+ if (isDebug()) return true;
329
+ }
330
+ });
331
+ }
332
+ const isDebug = ()=>{
333
+ if (!process.env['DEBUG']) return false;
334
+ const values = process.env['DEBUG'].toLocaleLowerCase().split(',');
335
+ return [
336
+ 'rspeedy',
337
+ '*'
338
+ ].some((key)=>values.includes(key));
339
+ };
340
+ function getChunks(entryName, entryValue) {
341
+ const chunks = [
342
+ entryName
343
+ ];
344
+ const imports = [];
345
+ for (const item of entryValue){
346
+ if ('string' == typeof item) {
347
+ imports.push(item);
348
+ continue;
349
+ }
350
+ if (Array.isArray(item)) {
351
+ imports.push(...imports);
352
+ continue;
353
+ }
354
+ const { dependOn } = item;
355
+ if (Array.isArray(item.import)) imports.push(...item.import);
356
+ else imports.push(item.import);
357
+ if (dependOn) if ('string' == typeof dependOn) chunks.unshift(dependOn);
358
+ else chunks.unshift(...dependOn);
359
+ }
360
+ return {
361
+ chunks,
362
+ imports
363
+ };
364
+ }
365
+ function getBackgroundFilename(entryName, config, isProd, experimental_isLazyBundle) {
366
+ const { filename } = config.output;
367
+ if ('string' == typeof filename.js) return filename.js.replaceAll('[name]', entryName).replaceAll('.js', '/background.js');
368
+ return `${entryName}/background${getHash(config, isProd, experimental_isLazyBundle)}.js`;
369
+ }
370
+ function getHash(config, isProd, experimental_isLazyBundle) {
371
+ if ('string' == typeof config.output?.filenameHash) return config.output.filenameHash ? `.[${config.output.filenameHash}]` : EMPTY_HASH;
372
+ if (config.output?.filenameHash === false) return EMPTY_HASH;
373
+ if (isProd || experimental_isLazyBundle) return DEFAULT_FILENAME_HASH;
374
+ return EMPTY_HASH;
375
+ }
376
+ function applyGenerator(api, options) {
377
+ api.modifyBundlerChain({
378
+ order: 'pre',
379
+ handler: (chain)=>{
380
+ const rule = chain.module.rule("react:json-parse").test(/\.json$/).type('json').generator({
381
+ JSONParse: false
382
+ });
383
+ if (!options.extractStr) rule.issuerLayer(LAYERS.MAIN_THREAD);
384
+ }
385
+ });
386
+ }
387
+ function applyLazy(api) {
388
+ api.modifyBundlerChain((chain)=>{
389
+ chain.output.library({
390
+ type: 'commonjs'
391
+ });
392
+ });
393
+ }
394
+ function applyLoaders(api, options) {
395
+ const { compat, enableRemoveCSSScope, shake, defineDCE, engineVersion, experimental_isLazyBundle } = options;
396
+ api.modifyBundlerChain((chain, { CHAIN_ID })=>{
397
+ const rule = chain.module.rules.get(CHAIN_ID.RULE.JS);
398
+ const uses = rule.uses.entries() ?? {};
399
+ const { output } = api.getRsbuildConfig();
400
+ const inlineSourcesContent = output?.sourceMap === true || !(output?.sourceMap === false || output?.sourceMap?.js === false || output?.sourceMap?.js?.includes('nosources'));
401
+ const backgroundRule = rule.oneOf(LAYERS.BACKGROUND);
402
+ backgroundRule.issuerLayer(LAYERS.BACKGROUND).uses.merge(uses).end().use(LAYERS.BACKGROUND).loader(ReactWebpackPlugin.loaders.BACKGROUND).options({
403
+ compat,
404
+ enableRemoveCSSScope,
405
+ isDynamicComponent: experimental_isLazyBundle,
406
+ inlineSourcesContent,
407
+ defineDCE,
408
+ engineVersion
409
+ }).end();
410
+ const mainThreadRule = rule.oneOf(LAYERS.MAIN_THREAD);
411
+ mainThreadRule.issuerLayer(LAYERS.MAIN_THREAD).uses.merge(uses).end().when(void 0 !== uses[CHAIN_ID.USE.SWC], (rule)=>{
412
+ rule.uses.delete(CHAIN_ID.USE.SWC);
413
+ const swcLoaderRule = uses[CHAIN_ID.USE.SWC].entries();
414
+ const swcLoaderOptions = swcLoaderRule.options;
415
+ rule.use(CHAIN_ID.USE.SWC).merge(swcLoaderRule).options({
416
+ ...swcLoaderOptions,
417
+ jsc: {
418
+ ...swcLoaderOptions.jsc,
419
+ target: 'es2019'
420
+ }
421
+ });
422
+ }).use(LAYERS.MAIN_THREAD).loader(ReactWebpackPlugin.loaders.MAIN_THREAD).options({
423
+ compat,
424
+ enableRemoveCSSScope,
425
+ inlineSourcesContent,
426
+ isDynamicComponent: experimental_isLazyBundle,
427
+ engineVersion,
428
+ shake,
429
+ defineDCE
430
+ }).end();
431
+ rule.uses.clear();
432
+ });
433
+ }
434
+ function applyNodeEnv(api) {
435
+ api.modifyEnvironmentConfig((userConfig, { mergeEnvironmentConfig })=>mergeEnvironmentConfig(userConfig, {
436
+ tools: {
437
+ rspack: {
438
+ optimization: {
439
+ nodeEnv: process.env['NODE_ENV'] ?? false
440
+ }
441
+ }
442
+ }
443
+ }));
444
+ }
445
+ const PLUGIN_NAME_REACT_REFRESH = 'lynx:react:refresh';
446
+ function applyRefresh(api) {
447
+ api.modifyWebpackChain(async (chain, { CHAIN_ID, isProd })=>{
448
+ if (!isProd) await applyRefreshRules(api, chain, CHAIN_ID, ReactRefreshWebpackPlugin);
449
+ });
450
+ api.modifyBundlerChain(async (chain, { isProd, CHAIN_ID })=>{
451
+ if (!isProd) {
452
+ const { resolve } = api.useExposed(Symbol.for('@lynx-js/react/internal:resolve'));
453
+ await Promise.all([
454
+ applyRefreshRules(api, chain, CHAIN_ID, ReactRefreshRspackPlugin),
455
+ resolve('@lynx-js/react/refresh').then((refresh)=>{
456
+ chain.resolve.alias.set('@lynx-js/react/refresh$', refresh);
457
+ })
458
+ ]);
459
+ }
460
+ });
461
+ }
462
+ async function applyRefreshRules(api, chain, CHAIN_ID, ReactRefreshPlugin) {
463
+ const { resolve } = api.useExposed(Symbol.for('@lynx-js/react/internal:resolve'));
464
+ const [reactRuntime, refresh, workletRuntime] = await Promise.all([
465
+ resolve('@lynx-js/react/package.json'),
466
+ resolve('@lynx-js/react/refresh'),
467
+ resolve('@lynx-js/react/worklet-runtime')
468
+ ]);
469
+ 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(node_path.dirname(reactRuntime)).add(node_path.dirname(refresh)).add(node_path.dirname(workletRuntime)).add(ReactRefreshPlugin.loader).end().use('ReactRefresh').loader(ReactRefreshPlugin.loader).options({}).end().end().end().end();
470
+ }
471
+ const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj);
472
+ const applySplitChunksRule = (api)=>{
473
+ api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
474
+ const userConfig = api.getRsbuildConfig('original');
475
+ if (!userConfig.performance?.chunkSplit?.strategy) return mergeRsbuildConfig(config, {
476
+ performance: {
477
+ chunkSplit: {
478
+ strategy: 'all-in-one'
479
+ }
480
+ }
481
+ });
482
+ return config;
483
+ });
484
+ api.modifyBundlerChain((chain, { environment })=>{
485
+ const { config } = environment;
486
+ if ('split-by-experience' !== config.performance.chunkSplit.strategy) return;
487
+ const currentConfig = chain.optimization.splitChunks.values();
488
+ if (!isPlainObject(currentConfig)) return;
489
+ const extraGroups = {};
490
+ extraGroups['preact'] = {
491
+ name: 'lib-preact',
492
+ test: /node_modules[\\/](.*?[\\/])?(?:preact|preact[\\/]compat|preact[\\/]hooks|preact[\\/]jsx-runtime)[\\/]/,
493
+ priority: 0
494
+ };
495
+ chain.optimization.splitChunks({
496
+ ...currentConfig,
497
+ cacheGroups: {
498
+ ...currentConfig.cacheGroups,
499
+ ...extraGroups
500
+ }
501
+ });
502
+ });
503
+ api.modifyRspackConfig((rspackConfig)=>{
504
+ if (!rspackConfig.optimization) return rspackConfig;
505
+ if (!rspackConfig.optimization.splitChunks) return rspackConfig;
506
+ rspackConfig.optimization.splitChunks.chunks = function(chunk) {
507
+ return !chunk.name?.includes('__main-thread');
508
+ };
509
+ return rspackConfig;
510
+ });
511
+ };
512
+ function applySWC(api) {
513
+ api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>mergeRsbuildConfig({
514
+ tools: {
515
+ swc: {
516
+ jsc: {
517
+ transform: {
518
+ useDefineForClassFields: false,
519
+ optimizer: {
520
+ simplify: true
521
+ }
522
+ },
523
+ parser: {
524
+ syntax: "typescript",
525
+ tsx: false,
526
+ decorators: true
527
+ }
528
+ }
529
+ }
530
+ }
531
+ }, config, {
532
+ tools: {
533
+ swc (config) {
534
+ delete config.env;
535
+ return config;
536
+ }
537
+ }
538
+ }));
539
+ }
540
+ function applyUseSyncExternalStore(api) {
541
+ api.modifyBundlerChain(async (chain, { rspack })=>{
542
+ const { getImportResolver } = await import("./300.js").then((mod)=>({
543
+ getImportResolver: mod.getImportResolver
544
+ }));
545
+ const resolve = getImportResolver(rspack);
546
+ const useSyncExternalStoreEntries = [
547
+ 'use-sync-external-store',
548
+ 'use-sync-external-store/with-selector',
549
+ 'use-sync-external-store/shim',
550
+ 'use-sync-external-store/shim/with-selector'
551
+ ];
552
+ await Promise.all(useSyncExternalStoreEntries.map((entry)=>resolve(`@lynx-js/${entry}`).then((value)=>{
553
+ chain.resolve.alias.set(`${entry}$`, value);
554
+ })));
555
+ });
556
+ }
557
+ const _assertGuard = __webpack_require__("../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_assertGuard.js");
558
+ const _accessExpressionAsString = __webpack_require__("../../../node_modules/.pnpm/typia@10.1.0_typescript@5.9.3/node_modules/typia/lib/internal/_accessExpressionAsString.js");
559
+ const validateConfig = (()=>{
560
+ 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.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.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.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)=>{
561
+ if ([
562
+ "compat",
563
+ "customCSSInheritanceList",
564
+ "debugInfoOutside",
565
+ "defaultDisplayLinear",
566
+ "enableAccessibilityElement",
567
+ "enableCSSInheritance",
568
+ "enableCSSInvalidation",
569
+ "enableCSSSelector",
570
+ "enableNewGesture",
571
+ "enableRemoveCSSScope",
572
+ "firstScreenSyncTiming",
573
+ "enableSSR",
574
+ "removeDescendantSelectorScope",
575
+ "shake",
576
+ "defineDCE",
577
+ "engineVersion",
578
+ "targetSdkVersion",
579
+ "extractStr",
580
+ "experimental_isLazyBundle"
581
+ ].some((prop)=>key === prop)) return true;
582
+ const value = input[key];
583
+ if (void 0 === value) return true;
584
+ return false;
585
+ }));
586
+ const _io1 = (input, _exceptionable = true)=>(void 0 === input.componentsPkg || Array.isArray(input.componentsPkg) && input.componentsPkg.every((elem, _index2)=>"string" == typeof elem)) && (void 0 === input.oldRuntimePkg || Array.isArray(input.oldRuntimePkg) && input.oldRuntimePkg.every((elem, _index3)=>"string" == typeof elem)) && (void 0 === input.newRuntimePkg || "string" == typeof input.newRuntimePkg) && (void 0 === input.additionalComponentAttributes || Array.isArray(input.additionalComponentAttributes) && input.additionalComponentAttributes.every((elem, _index4)=>"string" == typeof elem)) && null !== input.addComponentElement && (void 0 === input.addComponentElement || "boolean" == typeof input.addComponentElement || "object" == typeof input.addComponentElement && null !== input.addComponentElement && _io2(input.addComponentElement, _exceptionable)) && (void 0 === input.simplifyCtorLikeReactLynx2 || "boolean" == typeof input.simplifyCtorLikeReactLynx2) && (void 0 === input.removeComponentAttrRegex || "string" == typeof input.removeComponentAttrRegex) && (void 0 === input.disableDeprecatedWarning || "boolean" == typeof input.disableDeprecatedWarning) && null !== input.darkMode && (void 0 === input.darkMode || "boolean" == typeof input.darkMode || "object" == typeof input.darkMode && null !== input.darkMode && _io3(input.darkMode, _exceptionable)) && (void 0 === input.disableCreateSelectorQueryIncompatibleWarning || "boolean" == typeof input.disableCreateSelectorQueryIncompatibleWarning) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
587
+ if ([
588
+ "componentsPkg",
589
+ "oldRuntimePkg",
590
+ "newRuntimePkg",
591
+ "additionalComponentAttributes",
592
+ "addComponentElement",
593
+ "simplifyCtorLikeReactLynx2",
594
+ "removeComponentAttrRegex",
595
+ "disableDeprecatedWarning",
596
+ "darkMode",
597
+ "disableCreateSelectorQueryIncompatibleWarning"
598
+ ].some((prop)=>key === prop)) return true;
599
+ const value = input[key];
600
+ if (void 0 === value) return true;
601
+ return false;
602
+ }));
603
+ const _io2 = (input, _exceptionable = true)=>"boolean" == typeof input.compilerOnly && (1 === Object.keys(input).length || Object.keys(input).every((key)=>{
604
+ if ([
605
+ "compilerOnly"
606
+ ].some((prop)=>key === prop)) return true;
607
+ const value = input[key];
608
+ if (void 0 === value) return true;
609
+ return false;
610
+ }));
611
+ const _io3 = (input, _exceptionable = true)=>"string" == typeof input.themeExpr && (1 === Object.keys(input).length || Object.keys(input).every((key)=>{
612
+ if ([
613
+ "themeExpr"
614
+ ].some((prop)=>key === prop)) return true;
615
+ const value = input[key];
616
+ if (void 0 === value) return true;
617
+ return false;
618
+ }));
619
+ const _io4 = (input, _exceptionable = true)=>(void 0 === input.pkgName || Array.isArray(input.pkgName) && input.pkgName.every((elem, _index5)=>"string" == typeof elem)) && (void 0 === input.retainProp || Array.isArray(input.retainProp) && input.retainProp.every((elem, _index6)=>"string" == typeof elem)) && (void 0 === input.removeCallParams || Array.isArray(input.removeCallParams) && input.removeCallParams.every((elem, _index7)=>"string" == typeof elem)) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
620
+ if ([
621
+ "pkgName",
622
+ "retainProp",
623
+ "removeCallParams"
624
+ ].some((prop)=>key === prop)) return true;
625
+ const value = input[key];
626
+ if (void 0 === value) return true;
627
+ return false;
628
+ }));
629
+ const _io5 = (input, _exceptionable = true)=>(void 0 === input.define || "object" == typeof input.define && null !== input.define && false === Array.isArray(input.define) && _io6(input.define, _exceptionable)) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
630
+ if ([
631
+ "define"
632
+ ].some((prop)=>key === prop)) return true;
633
+ const value = input[key];
634
+ if (void 0 === value) return true;
635
+ return false;
636
+ }));
637
+ const _io6 = (input, _exceptionable = true)=>Object.keys(input).every((key)=>{
638
+ const value = input[key];
639
+ if (void 0 === value) return true;
640
+ return "string" == typeof value;
641
+ });
642
+ const _io7 = (input, _exceptionable = true)=>(void 0 === input.strLength || "number" == typeof input.strLength) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{
643
+ if ([
644
+ "strLength"
645
+ ].some((prop)=>key === prop)) return true;
646
+ const value = input[key];
647
+ if (void 0 === value) return true;
648
+ return false;
649
+ }));
650
+ 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, {
651
+ method: "typia.createAssertEquals",
652
+ path: _path + ".compat",
653
+ expected: "(Partial<CompatVisitorConfig> & { disableCreateSelectorQueryIncompatibleWarning?: boolean; } | undefined)",
654
+ value: input.compat
655
+ }, _errorFactory)) && _ao1(input.compat, _path + ".compat", _exceptionable) || _assertGuard._assertGuard(_exceptionable, {
656
+ method: "typia.createAssertEquals",
657
+ path: _path + ".compat",
658
+ expected: "(Partial<CompatVisitorConfig> & { disableCreateSelectorQueryIncompatibleWarning?: boolean; } | undefined)",
659
+ value: input.compat
660
+ }, _errorFactory)) && (void 0 === input.customCSSInheritanceList || (Array.isArray(input.customCSSInheritanceList) || _assertGuard._assertGuard(_exceptionable, {
661
+ method: "typia.createAssertEquals",
662
+ path: _path + ".customCSSInheritanceList",
663
+ expected: "(Array<string> | undefined)",
664
+ value: input.customCSSInheritanceList
665
+ }, _errorFactory)) && input.customCSSInheritanceList.every((elem, _index8)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
666
+ method: "typia.createAssertEquals",
667
+ path: _path + ".customCSSInheritanceList[" + _index8 + "]",
668
+ expected: "string",
669
+ value: elem
670
+ }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
671
+ method: "typia.createAssertEquals",
672
+ path: _path + ".customCSSInheritanceList",
673
+ expected: "(Array<string> | undefined)",
674
+ value: input.customCSSInheritanceList
675
+ }, _errorFactory)) && (void 0 === input.debugInfoOutside || "boolean" == typeof input.debugInfoOutside || _assertGuard._assertGuard(_exceptionable, {
676
+ method: "typia.createAssertEquals",
677
+ path: _path + ".debugInfoOutside",
678
+ expected: "(boolean | undefined)",
679
+ value: input.debugInfoOutside
680
+ }, _errorFactory)) && (void 0 === input.defaultDisplayLinear || "boolean" == typeof input.defaultDisplayLinear || _assertGuard._assertGuard(_exceptionable, {
681
+ method: "typia.createAssertEquals",
682
+ path: _path + ".defaultDisplayLinear",
683
+ expected: "(boolean | undefined)",
684
+ value: input.defaultDisplayLinear
685
+ }, _errorFactory)) && (void 0 === input.enableAccessibilityElement || "boolean" == typeof input.enableAccessibilityElement || _assertGuard._assertGuard(_exceptionable, {
686
+ method: "typia.createAssertEquals",
687
+ path: _path + ".enableAccessibilityElement",
688
+ expected: "(boolean | undefined)",
689
+ value: input.enableAccessibilityElement
690
+ }, _errorFactory)) && (void 0 === input.enableCSSInheritance || "boolean" == typeof input.enableCSSInheritance || _assertGuard._assertGuard(_exceptionable, {
691
+ method: "typia.createAssertEquals",
692
+ path: _path + ".enableCSSInheritance",
693
+ expected: "(boolean | undefined)",
694
+ value: input.enableCSSInheritance
695
+ }, _errorFactory)) && (void 0 === input.enableCSSInvalidation || "boolean" == typeof input.enableCSSInvalidation || _assertGuard._assertGuard(_exceptionable, {
696
+ method: "typia.createAssertEquals",
697
+ path: _path + ".enableCSSInvalidation",
698
+ expected: "(boolean | undefined)",
699
+ value: input.enableCSSInvalidation
700
+ }, _errorFactory)) && (void 0 === input.enableCSSSelector || "boolean" == typeof input.enableCSSSelector || _assertGuard._assertGuard(_exceptionable, {
701
+ method: "typia.createAssertEquals",
702
+ path: _path + ".enableCSSSelector",
703
+ expected: "(boolean | undefined)",
704
+ value: input.enableCSSSelector
705
+ }, _errorFactory)) && (void 0 === input.enableNewGesture || "boolean" == typeof input.enableNewGesture || _assertGuard._assertGuard(_exceptionable, {
706
+ method: "typia.createAssertEquals",
707
+ path: _path + ".enableNewGesture",
708
+ expected: "(boolean | undefined)",
709
+ value: input.enableNewGesture
710
+ }, _errorFactory)) && (void 0 === input.enableRemoveCSSScope || "boolean" == typeof input.enableRemoveCSSScope || _assertGuard._assertGuard(_exceptionable, {
711
+ method: "typia.createAssertEquals",
712
+ path: _path + ".enableRemoveCSSScope",
713
+ expected: "(boolean | undefined)",
714
+ value: input.enableRemoveCSSScope
715
+ }, _errorFactory)) && (void 0 === input.firstScreenSyncTiming || "immediately" === input.firstScreenSyncTiming || "jsReady" === input.firstScreenSyncTiming || _assertGuard._assertGuard(_exceptionable, {
716
+ method: "typia.createAssertEquals",
717
+ path: _path + ".firstScreenSyncTiming",
718
+ expected: "(\"immediately\" | \"jsReady\" | undefined)",
719
+ value: input.firstScreenSyncTiming
720
+ }, _errorFactory)) && (void 0 === input.enableSSR || "boolean" == typeof input.enableSSR || _assertGuard._assertGuard(_exceptionable, {
721
+ method: "typia.createAssertEquals",
722
+ path: _path + ".enableSSR",
723
+ expected: "(boolean | undefined)",
724
+ value: input.enableSSR
725
+ }, _errorFactory)) && (void 0 === input.removeDescendantSelectorScope || "boolean" == typeof input.removeDescendantSelectorScope || _assertGuard._assertGuard(_exceptionable, {
726
+ method: "typia.createAssertEquals",
727
+ path: _path + ".removeDescendantSelectorScope",
728
+ expected: "(boolean | undefined)",
729
+ value: input.removeDescendantSelectorScope
730
+ }, _errorFactory)) && (void 0 === input.shake || ("object" == typeof input.shake && null !== input.shake && false === Array.isArray(input.shake) || _assertGuard._assertGuard(_exceptionable, {
731
+ method: "typia.createAssertEquals",
732
+ path: _path + ".shake",
733
+ expected: "(Partial<ShakeVisitorConfig> | undefined)",
734
+ value: input.shake
735
+ }, _errorFactory)) && _ao4(input.shake, _path + ".shake", _exceptionable) || _assertGuard._assertGuard(_exceptionable, {
736
+ method: "typia.createAssertEquals",
737
+ path: _path + ".shake",
738
+ expected: "(Partial<ShakeVisitorConfig> | undefined)",
739
+ value: input.shake
740
+ }, _errorFactory)) && (void 0 === input.defineDCE || ("object" == typeof input.defineDCE && null !== input.defineDCE && false === Array.isArray(input.defineDCE) || _assertGuard._assertGuard(_exceptionable, {
741
+ method: "typia.createAssertEquals",
742
+ path: _path + ".defineDCE",
743
+ expected: "(Partial<DefineDceVisitorConfig> | undefined)",
744
+ value: input.defineDCE
745
+ }, _errorFactory)) && _ao5(input.defineDCE, _path + ".defineDCE", _exceptionable) || _assertGuard._assertGuard(_exceptionable, {
746
+ method: "typia.createAssertEquals",
747
+ path: _path + ".defineDCE",
748
+ expected: "(Partial<DefineDceVisitorConfig> | undefined)",
749
+ value: input.defineDCE
750
+ }, _errorFactory)) && (void 0 === input.engineVersion || "string" == typeof input.engineVersion || _assertGuard._assertGuard(_exceptionable, {
751
+ method: "typia.createAssertEquals",
752
+ path: _path + ".engineVersion",
753
+ expected: "(string | undefined)",
754
+ value: input.engineVersion
755
+ }, _errorFactory)) && (void 0 === input.targetSdkVersion || "string" == typeof input.targetSdkVersion || _assertGuard._assertGuard(_exceptionable, {
756
+ method: "typia.createAssertEquals",
757
+ path: _path + ".targetSdkVersion",
758
+ expected: "(string | undefined)",
759
+ value: input.targetSdkVersion
760
+ }, _errorFactory)) && (null !== input.extractStr || _assertGuard._assertGuard(_exceptionable, {
761
+ method: "typia.createAssertEquals",
762
+ path: _path + ".extractStr",
763
+ expected: "(Partial<ExtractStrConfig> | boolean | undefined)",
764
+ value: input.extractStr
765
+ }, _errorFactory)) && (void 0 === input.extractStr || "boolean" == typeof input.extractStr || ("object" == typeof input.extractStr && null !== input.extractStr && false === Array.isArray(input.extractStr) || _assertGuard._assertGuard(_exceptionable, {
766
+ method: "typia.createAssertEquals",
767
+ path: _path + ".extractStr",
768
+ expected: "(Partial<ExtractStrConfig> | boolean | undefined)",
769
+ value: input.extractStr
770
+ }, _errorFactory)) && _ao7(input.extractStr, _path + ".extractStr", _exceptionable) || _assertGuard._assertGuard(_exceptionable, {
771
+ method: "typia.createAssertEquals",
772
+ path: _path + ".extractStr",
773
+ expected: "(Partial<ExtractStrConfig> | boolean | undefined)",
774
+ value: input.extractStr
775
+ }, _errorFactory)) && (void 0 === input.experimental_isLazyBundle || "boolean" == typeof input.experimental_isLazyBundle || _assertGuard._assertGuard(_exceptionable, {
776
+ method: "typia.createAssertEquals",
777
+ path: _path + ".experimental_isLazyBundle",
778
+ expected: "(boolean | undefined)",
779
+ value: input.experimental_isLazyBundle
780
+ }, _errorFactory)) && (0 === Object.keys(input).length || false === _exceptionable || Object.keys(input).every((key)=>{
781
+ if ([
782
+ "compat",
783
+ "customCSSInheritanceList",
784
+ "debugInfoOutside",
785
+ "defaultDisplayLinear",
786
+ "enableAccessibilityElement",
787
+ "enableCSSInheritance",
788
+ "enableCSSInvalidation",
789
+ "enableCSSSelector",
790
+ "enableNewGesture",
791
+ "enableRemoveCSSScope",
792
+ "firstScreenSyncTiming",
793
+ "enableSSR",
794
+ "removeDescendantSelectorScope",
795
+ "shake",
796
+ "defineDCE",
797
+ "engineVersion",
798
+ "targetSdkVersion",
799
+ "extractStr",
800
+ "experimental_isLazyBundle"
801
+ ].some((prop)=>key === prop)) return true;
802
+ const value = input[key];
803
+ if (void 0 === value) return true;
804
+ return _assertGuard._assertGuard(_exceptionable, {
805
+ method: "typia.createAssertEquals",
806
+ path: _path + _accessExpressionAsString._accessExpressionAsString(key),
807
+ expected: "undefined",
808
+ value: value
809
+ }, _errorFactory);
810
+ }));
811
+ const _ao1 = (input, _path, _exceptionable = true)=>(void 0 === input.componentsPkg || (Array.isArray(input.componentsPkg) || _assertGuard._assertGuard(_exceptionable, {
812
+ method: "typia.createAssertEquals",
813
+ path: _path + ".componentsPkg",
814
+ expected: "(Array<string> | undefined)",
815
+ value: input.componentsPkg
816
+ }, _errorFactory)) && input.componentsPkg.every((elem, _index9)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
817
+ method: "typia.createAssertEquals",
818
+ path: _path + ".componentsPkg[" + _index9 + "]",
819
+ expected: "string",
820
+ value: elem
821
+ }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
822
+ method: "typia.createAssertEquals",
823
+ path: _path + ".componentsPkg",
824
+ expected: "(Array<string> | undefined)",
825
+ value: input.componentsPkg
826
+ }, _errorFactory)) && (void 0 === input.oldRuntimePkg || (Array.isArray(input.oldRuntimePkg) || _assertGuard._assertGuard(_exceptionable, {
827
+ method: "typia.createAssertEquals",
828
+ path: _path + ".oldRuntimePkg",
829
+ expected: "(Array<string> | undefined)",
830
+ value: input.oldRuntimePkg
831
+ }, _errorFactory)) && input.oldRuntimePkg.every((elem, _index10)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
832
+ method: "typia.createAssertEquals",
833
+ path: _path + ".oldRuntimePkg[" + _index10 + "]",
834
+ expected: "string",
835
+ value: elem
836
+ }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
837
+ method: "typia.createAssertEquals",
838
+ path: _path + ".oldRuntimePkg",
839
+ expected: "(Array<string> | undefined)",
840
+ value: input.oldRuntimePkg
841
+ }, _errorFactory)) && (void 0 === input.newRuntimePkg || "string" == typeof input.newRuntimePkg || _assertGuard._assertGuard(_exceptionable, {
842
+ method: "typia.createAssertEquals",
843
+ path: _path + ".newRuntimePkg",
844
+ expected: "(string | undefined)",
845
+ value: input.newRuntimePkg
846
+ }, _errorFactory)) && (void 0 === input.additionalComponentAttributes || (Array.isArray(input.additionalComponentAttributes) || _assertGuard._assertGuard(_exceptionable, {
847
+ method: "typia.createAssertEquals",
848
+ path: _path + ".additionalComponentAttributes",
849
+ expected: "(Array<string> | undefined)",
850
+ value: input.additionalComponentAttributes
851
+ }, _errorFactory)) && input.additionalComponentAttributes.every((elem, _index11)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
852
+ method: "typia.createAssertEquals",
853
+ path: _path + ".additionalComponentAttributes[" + _index11 + "]",
854
+ expected: "string",
855
+ value: elem
856
+ }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
857
+ method: "typia.createAssertEquals",
858
+ path: _path + ".additionalComponentAttributes",
859
+ expected: "(Array<string> | undefined)",
860
+ value: input.additionalComponentAttributes
861
+ }, _errorFactory)) && (null !== input.addComponentElement || _assertGuard._assertGuard(_exceptionable, {
862
+ method: "typia.createAssertEquals",
863
+ path: _path + ".addComponentElement",
864
+ expected: "(AddComponentElementConfig | boolean | undefined)",
865
+ value: input.addComponentElement
866
+ }, _errorFactory)) && (void 0 === input.addComponentElement || "boolean" == typeof input.addComponentElement || ("object" == typeof input.addComponentElement && null !== input.addComponentElement || _assertGuard._assertGuard(_exceptionable, {
867
+ method: "typia.createAssertEquals",
868
+ path: _path + ".addComponentElement",
869
+ expected: "(AddComponentElementConfig | boolean | undefined)",
870
+ value: input.addComponentElement
871
+ }, _errorFactory)) && _ao2(input.addComponentElement, _path + ".addComponentElement", _exceptionable) || _assertGuard._assertGuard(_exceptionable, {
872
+ method: "typia.createAssertEquals",
873
+ path: _path + ".addComponentElement",
874
+ expected: "(AddComponentElementConfig | boolean | undefined)",
875
+ value: input.addComponentElement
876
+ }, _errorFactory)) && (void 0 === input.simplifyCtorLikeReactLynx2 || "boolean" == typeof input.simplifyCtorLikeReactLynx2 || _assertGuard._assertGuard(_exceptionable, {
877
+ method: "typia.createAssertEquals",
878
+ path: _path + ".simplifyCtorLikeReactLynx2",
879
+ expected: "(boolean | undefined)",
880
+ value: input.simplifyCtorLikeReactLynx2
881
+ }, _errorFactory)) && (void 0 === input.removeComponentAttrRegex || "string" == typeof input.removeComponentAttrRegex || _assertGuard._assertGuard(_exceptionable, {
882
+ method: "typia.createAssertEquals",
883
+ path: _path + ".removeComponentAttrRegex",
884
+ expected: "(string | undefined)",
885
+ value: input.removeComponentAttrRegex
886
+ }, _errorFactory)) && (void 0 === input.disableDeprecatedWarning || "boolean" == typeof input.disableDeprecatedWarning || _assertGuard._assertGuard(_exceptionable, {
887
+ method: "typia.createAssertEquals",
888
+ path: _path + ".disableDeprecatedWarning",
889
+ expected: "(boolean | undefined)",
890
+ value: input.disableDeprecatedWarning
891
+ }, _errorFactory)) && (null !== input.darkMode || _assertGuard._assertGuard(_exceptionable, {
892
+ method: "typia.createAssertEquals",
893
+ path: _path + ".darkMode",
894
+ expected: "(DarkModeConfig | boolean | undefined)",
895
+ value: input.darkMode
896
+ }, _errorFactory)) && (void 0 === input.darkMode || "boolean" == typeof input.darkMode || ("object" == typeof input.darkMode && null !== input.darkMode || _assertGuard._assertGuard(_exceptionable, {
897
+ method: "typia.createAssertEquals",
898
+ path: _path + ".darkMode",
899
+ expected: "(DarkModeConfig | boolean | undefined)",
900
+ value: input.darkMode
901
+ }, _errorFactory)) && _ao3(input.darkMode, _path + ".darkMode", _exceptionable) || _assertGuard._assertGuard(_exceptionable, {
902
+ method: "typia.createAssertEquals",
903
+ path: _path + ".darkMode",
904
+ expected: "(DarkModeConfig | boolean | undefined)",
905
+ value: input.darkMode
906
+ }, _errorFactory)) && (void 0 === input.disableCreateSelectorQueryIncompatibleWarning || "boolean" == typeof input.disableCreateSelectorQueryIncompatibleWarning || _assertGuard._assertGuard(_exceptionable, {
907
+ method: "typia.createAssertEquals",
908
+ path: _path + ".disableCreateSelectorQueryIncompatibleWarning",
909
+ expected: "(boolean | undefined)",
910
+ value: input.disableCreateSelectorQueryIncompatibleWarning
911
+ }, _errorFactory)) && (0 === Object.keys(input).length || false === _exceptionable || Object.keys(input).every((key)=>{
912
+ if ([
913
+ "componentsPkg",
914
+ "oldRuntimePkg",
915
+ "newRuntimePkg",
916
+ "additionalComponentAttributes",
917
+ "addComponentElement",
918
+ "simplifyCtorLikeReactLynx2",
919
+ "removeComponentAttrRegex",
920
+ "disableDeprecatedWarning",
921
+ "darkMode",
922
+ "disableCreateSelectorQueryIncompatibleWarning"
923
+ ].some((prop)=>key === prop)) return true;
924
+ const value = input[key];
925
+ if (void 0 === value) return true;
926
+ return _assertGuard._assertGuard(_exceptionable, {
927
+ method: "typia.createAssertEquals",
928
+ path: _path + _accessExpressionAsString._accessExpressionAsString(key),
929
+ expected: "undefined",
930
+ value: value
931
+ }, _errorFactory);
932
+ }));
933
+ const _ao2 = (input, _path, _exceptionable = true)=>("boolean" == typeof input.compilerOnly || _assertGuard._assertGuard(_exceptionable, {
934
+ method: "typia.createAssertEquals",
935
+ path: _path + ".compilerOnly",
936
+ expected: "boolean",
937
+ value: input.compilerOnly
938
+ }, _errorFactory)) && (1 === Object.keys(input).length || false === _exceptionable || Object.keys(input).every((key)=>{
939
+ if ([
940
+ "compilerOnly"
941
+ ].some((prop)=>key === prop)) return true;
942
+ const value = input[key];
943
+ if (void 0 === value) return true;
944
+ return _assertGuard._assertGuard(_exceptionable, {
945
+ method: "typia.createAssertEquals",
946
+ path: _path + _accessExpressionAsString._accessExpressionAsString(key),
947
+ expected: "undefined",
948
+ value: value
949
+ }, _errorFactory);
950
+ }));
951
+ const _ao3 = (input, _path, _exceptionable = true)=>("string" == typeof input.themeExpr || _assertGuard._assertGuard(_exceptionable, {
952
+ method: "typia.createAssertEquals",
953
+ path: _path + ".themeExpr",
954
+ expected: "string",
955
+ value: input.themeExpr
956
+ }, _errorFactory)) && (1 === Object.keys(input).length || false === _exceptionable || Object.keys(input).every((key)=>{
957
+ if ([
958
+ "themeExpr"
959
+ ].some((prop)=>key === prop)) return true;
960
+ const value = input[key];
961
+ if (void 0 === value) return true;
962
+ return _assertGuard._assertGuard(_exceptionable, {
963
+ method: "typia.createAssertEquals",
964
+ path: _path + _accessExpressionAsString._accessExpressionAsString(key),
965
+ expected: "undefined",
966
+ value: value
967
+ }, _errorFactory);
968
+ }));
969
+ const _ao4 = (input, _path, _exceptionable = true)=>(void 0 === input.pkgName || (Array.isArray(input.pkgName) || _assertGuard._assertGuard(_exceptionable, {
970
+ method: "typia.createAssertEquals",
971
+ path: _path + ".pkgName",
972
+ expected: "(Array<string> | undefined)",
973
+ value: input.pkgName
974
+ }, _errorFactory)) && input.pkgName.every((elem, _index12)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
975
+ method: "typia.createAssertEquals",
976
+ path: _path + ".pkgName[" + _index12 + "]",
977
+ expected: "string",
978
+ value: elem
979
+ }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
980
+ method: "typia.createAssertEquals",
981
+ path: _path + ".pkgName",
982
+ expected: "(Array<string> | undefined)",
983
+ value: input.pkgName
984
+ }, _errorFactory)) && (void 0 === input.retainProp || (Array.isArray(input.retainProp) || _assertGuard._assertGuard(_exceptionable, {
985
+ method: "typia.createAssertEquals",
986
+ path: _path + ".retainProp",
987
+ expected: "(Array<string> | undefined)",
988
+ value: input.retainProp
989
+ }, _errorFactory)) && input.retainProp.every((elem, _index13)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
990
+ method: "typia.createAssertEquals",
991
+ path: _path + ".retainProp[" + _index13 + "]",
992
+ expected: "string",
993
+ value: elem
994
+ }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
995
+ method: "typia.createAssertEquals",
996
+ path: _path + ".retainProp",
997
+ expected: "(Array<string> | undefined)",
998
+ value: input.retainProp
999
+ }, _errorFactory)) && (void 0 === input.removeCallParams || (Array.isArray(input.removeCallParams) || _assertGuard._assertGuard(_exceptionable, {
1000
+ method: "typia.createAssertEquals",
1001
+ path: _path + ".removeCallParams",
1002
+ expected: "(Array<string> | undefined)",
1003
+ value: input.removeCallParams
1004
+ }, _errorFactory)) && input.removeCallParams.every((elem, _index14)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, {
1005
+ method: "typia.createAssertEquals",
1006
+ path: _path + ".removeCallParams[" + _index14 + "]",
1007
+ expected: "string",
1008
+ value: elem
1009
+ }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, {
1010
+ method: "typia.createAssertEquals",
1011
+ path: _path + ".removeCallParams",
1012
+ expected: "(Array<string> | undefined)",
1013
+ value: input.removeCallParams
1014
+ }, _errorFactory)) && (0 === Object.keys(input).length || false === _exceptionable || Object.keys(input).every((key)=>{
1015
+ if ([
1016
+ "pkgName",
1017
+ "retainProp",
1018
+ "removeCallParams"
1019
+ ].some((prop)=>key === prop)) return true;
1020
+ const value = input[key];
1021
+ if (void 0 === value) return true;
1022
+ return _assertGuard._assertGuard(_exceptionable, {
1023
+ method: "typia.createAssertEquals",
1024
+ path: _path + _accessExpressionAsString._accessExpressionAsString(key),
1025
+ expected: "undefined",
1026
+ value: value
1027
+ }, _errorFactory);
1028
+ }));
1029
+ const _ao5 = (input, _path, _exceptionable = true)=>(void 0 === input.define || ("object" == typeof input.define && null !== input.define && false === Array.isArray(input.define) || _assertGuard._assertGuard(_exceptionable, {
1030
+ method: "typia.createAssertEquals",
1031
+ path: _path + ".define",
1032
+ expected: "(Record<string, string> | undefined)",
1033
+ value: input.define
1034
+ }, _errorFactory)) && _ao6(input.define, _path + ".define", _exceptionable) || _assertGuard._assertGuard(_exceptionable, {
1035
+ method: "typia.createAssertEquals",
1036
+ path: _path + ".define",
1037
+ expected: "(Record<string, string> | undefined)",
1038
+ value: input.define
1039
+ }, _errorFactory)) && (0 === Object.keys(input).length || false === _exceptionable || Object.keys(input).every((key)=>{
1040
+ if ([
1041
+ "define"
1042
+ ].some((prop)=>key === prop)) return true;
1043
+ const value = input[key];
1044
+ if (void 0 === value) return true;
1045
+ return _assertGuard._assertGuard(_exceptionable, {
1046
+ method: "typia.createAssertEquals",
1047
+ path: _path + _accessExpressionAsString._accessExpressionAsString(key),
1048
+ expected: "undefined",
1049
+ value: value
1050
+ }, _errorFactory);
1051
+ }));
1052
+ const _ao6 = (input, _path, _exceptionable = true)=>false === _exceptionable || Object.keys(input).every((key)=>{
1053
+ const value = input[key];
1054
+ if (void 0 === value) return true;
1055
+ return "string" == typeof value || _assertGuard._assertGuard(_exceptionable, {
1056
+ method: "typia.createAssertEquals",
1057
+ path: _path + _accessExpressionAsString._accessExpressionAsString(key),
1058
+ expected: "string",
1059
+ value: value
1060
+ }, _errorFactory);
1061
+ });
1062
+ const _ao7 = (input, _path, _exceptionable = true)=>(void 0 === input.strLength || "number" == typeof input.strLength || _assertGuard._assertGuard(_exceptionable, {
1063
+ method: "typia.createAssertEquals",
1064
+ path: _path + ".strLength",
1065
+ expected: "(number | undefined)",
1066
+ value: input.strLength
1067
+ }, _errorFactory)) && (0 === Object.keys(input).length || false === _exceptionable || Object.keys(input).every((key)=>{
1068
+ if ([
1069
+ "strLength"
1070
+ ].some((prop)=>key === prop)) return true;
1071
+ const value = input[key];
1072
+ if (void 0 === value) return true;
1073
+ return _assertGuard._assertGuard(_exceptionable, {
1074
+ method: "typia.createAssertEquals",
1075
+ path: _path + _accessExpressionAsString._accessExpressionAsString(key),
1076
+ expected: "undefined",
1077
+ value: value
1078
+ }, _errorFactory);
1079
+ }));
1080
+ const __is = (input, _exceptionable = true)=>void 0 === input || "object" == typeof input && null !== input && false === Array.isArray(input) && _io0(input, true);
1081
+ let _errorFactory;
1082
+ return (input, errorFactory = ({ path, expected, value })=>{
1083
+ if ('undefined' === expected) {
1084
+ const errorMessage = `Unknown property: \`${path}\` in the configuration of pluginReactLynx`;
1085
+ return new Error(errorMessage);
1086
+ }
1087
+ return new Error([
1088
+ `Invalid config on pluginReactLynx: \`${path}\`.`,
1089
+ ` - Expect to be ${expected}`,
1090
+ ` - Got: ${whatIs(value)}`,
1091
+ ''
1092
+ ].join('\n'));
1093
+ })=>{
1094
+ if (false === __is(input)) {
1095
+ _errorFactory = errorFactory;
1096
+ ((input, _path, _exceptionable = true)=>void 0 === input || ("object" == typeof input && null !== input && false === Array.isArray(input) || _assertGuard._assertGuard(true, {
1097
+ method: "typia.createAssertEquals",
1098
+ path: _path + "",
1099
+ expected: "(PluginReactLynxOptions | undefined)",
1100
+ value: input
1101
+ }, _errorFactory)) && _ao0(input, _path + "", true) || _assertGuard._assertGuard(true, {
1102
+ method: "typia.createAssertEquals",
1103
+ path: _path + "",
1104
+ expected: "(PluginReactLynxOptions | undefined)",
1105
+ value: input
1106
+ }, _errorFactory))(input, "$input", true);
1107
+ }
1108
+ return input;
1109
+ };
1110
+ })();
1111
+ function whatIs(value) {
1112
+ return Object.prototype.toString.call(value).replace(/^\[object\s+([a-z]+)\]$/i, '$1').toLowerCase();
1113
+ }
1114
+ function pluginReactLynx(userOptions) {
1115
+ validateConfig(userOptions);
1116
+ const engineVersion = userOptions?.engineVersion ?? userOptions?.targetSdkVersion ?? '3.2';
1117
+ const defaultOptions = {
1118
+ compat: void 0,
1119
+ customCSSInheritanceList: void 0,
1120
+ debugInfoOutside: true,
1121
+ defaultDisplayLinear: true,
1122
+ enableAccessibilityElement: false,
1123
+ enableCSSInheritance: false,
1124
+ enableCSSInvalidation: true,
1125
+ enableCSSSelector: true,
1126
+ enableNewGesture: false,
1127
+ enableRemoveCSSScope: true,
1128
+ firstScreenSyncTiming: 'immediately',
1129
+ enableSSR: false,
1130
+ removeDescendantSelectorScope: true,
1131
+ shake: void 0,
1132
+ defineDCE: void 0,
1133
+ targetSdkVersion: '',
1134
+ engineVersion: '',
1135
+ extractStr: false,
1136
+ experimental_isLazyBundle: false
1137
+ };
1138
+ const resolvedOptions = Object.assign(defaultOptions, userOptions, {
1139
+ targetSdkVersion: engineVersion,
1140
+ engineVersion
1141
+ });
1142
+ return [
1143
+ pluginReactAlias({
1144
+ lazy: resolvedOptions.experimental_isLazyBundle,
1145
+ LAYERS: LAYERS
1146
+ }),
1147
+ {
1148
+ name: 'lynx:react',
1149
+ pre: [
1150
+ 'lynx:rsbuild:plugin-api',
1151
+ 'lynx:config'
1152
+ ],
1153
+ setup (api) {
1154
+ const isRslib = 'rslib' === api.context.callerName;
1155
+ const exposedConfig = api.useExposed(Symbol.for('lynx.config'));
1156
+ if (exposedConfig) Object.keys(defaultOptions).forEach((key)=>{
1157
+ if (Object.hasOwn(exposedConfig.config, key)) Object.assign(resolvedOptions, {
1158
+ [key]: exposedConfig.config[key]
1159
+ });
1160
+ });
1161
+ if (!isRslib) applyCSS(api, resolvedOptions);
1162
+ applyEntry(api, resolvedOptions);
1163
+ applyBackgroundOnly(api);
1164
+ applyGenerator(api, resolvedOptions);
1165
+ applyLoaders(api, resolvedOptions);
1166
+ applyRefresh(api);
1167
+ applySplitChunksRule(api);
1168
+ applySWC(api);
1169
+ applyUseSyncExternalStore(api);
1170
+ if (isRslib) applyNodeEnv(api);
1171
+ api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{
1172
+ const userConfig = api.getRsbuildConfig('original');
1173
+ if (void 0 === userConfig.source?.include) config = mergeRsbuildConfig(config, {
1174
+ source: {
1175
+ include: [
1176
+ /\.(?:js|mjs|cjs)$/
1177
+ ]
1178
+ }
1179
+ });
1180
+ config = mergeRsbuildConfig({
1181
+ tools: {
1182
+ rspack: {
1183
+ output: {
1184
+ iife: false
1185
+ }
1186
+ }
1187
+ }
1188
+ }, config);
1189
+ config = mergeRsbuildConfig({
1190
+ resolve: {
1191
+ dedupe: [
1192
+ 'react-compiler-runtime'
1193
+ ]
1194
+ }
1195
+ }, config);
1196
+ return config;
1197
+ });
1198
+ if (resolvedOptions.experimental_isLazyBundle) applyLazy(api);
1199
+ api.expose(Symbol.for('LAYERS'), LAYERS);
1200
+ api.expose(Symbol.for('LynxTemplatePlugin'), {
1201
+ LynxTemplatePlugin: {
1202
+ getLynxTemplatePluginHooks: LynxTemplatePlugin.getLynxTemplatePluginHooks.bind(LynxTemplatePlugin)
1203
+ }
1204
+ });
1205
+ const require = createRequire(import.meta.url);
1206
+ const { version } = require('../package.json');
1207
+ const webpackPluginPath = require.resolve('@lynx-js/react-webpack-plugin');
1208
+ api.logger?.debug(`Using @lynx-js/react-webpack-plugin v${version} at ${webpackPluginPath}`);
1209
+ }
1210
+ }
1211
+ ];
1212
+ }
1213
+ export { LAYERS, createLazyResolver, fileURLToPath, node_path, pluginReactLynx };