@lynx-js/react-rsbuild-plugin-canary 0.12.4-canary-20260104-f4b90f3a → 0.12.5-canary-20260111-d9c9ff98

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