UNPKG

@lynx-js/react-rsbuild-plugin

Version:
809 lines 72.1 kB
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module"; import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__ from "@lynx-js/react-alias-rsbuild-plugin"; import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__ from "@lynx-js/react-webpack-plugin"; import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path"; import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url"; import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__ from "@lynx-js/template-webpack-plugin"; import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_runtime_wrapper_webpack_plugin_27793081__ from "@lynx-js/runtime-wrapper-webpack-plugin"; import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_web_webpack_plugin_6ba19e5a__ from "@lynx-js/web-webpack-plugin"; import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_react_refresh_webpack_plugin_a01c5e97__ from "@lynx-js/react-refresh-webpack-plugin"; var __webpack_modules__ = { "../../../node_modules/.pnpm/typia@8.1.1_@samchon+openapi@3.2.3_typescript@5.8.2/node_modules/typia/lib/internal/_accessExpressionAsString.js": function(__unused_webpack_module, exports) { exports._accessExpressionAsString = void 0; const _accessExpressionAsString = (str)=>variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`; exports._accessExpressionAsString = _accessExpressionAsString; const variable = (str)=>false === reserved(str) && /^[a-zA-Z_$][a-zA-Z_$0-9]*$/g.test(str); const reserved = (str)=>RESERVED.has(str); const RESERVED = new Set([ "break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "enum", "export", "extends", "false", "finally", "for", "function", "if", "import", "in", "instanceof", "new", "null", "return", "super", "switch", "this", "throw", "true", "try", "typeof", "var", "void", "while", "with" ]); }, "../../../node_modules/.pnpm/typia@8.1.1_@samchon+openapi@3.2.3_typescript@5.8.2/node_modules/typia/lib/internal/_assertGuard.js": function(__unused_webpack_module, exports, __webpack_require__) { exports._assertGuard = void 0; const TypeGuardError_1 = __webpack_require__("../../../node_modules/.pnpm/typia@8.1.1_@samchon+openapi@3.2.3_typescript@5.8.2/node_modules/typia/lib/TypeGuardError.mjs"); const _assertGuard = (exceptionable, props, factory)=>{ if (true === exceptionable) if (factory) throw factory(props); else throw new TypeGuardError_1.TypeGuardError(props); return false; }; exports._assertGuard = _assertGuard; }, "../../../node_modules/.pnpm/typia@8.1.1_@samchon+openapi@3.2.3_typescript@5.8.2/node_modules/typia/lib/TypeGuardError.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, { TypeGuardError: ()=>TypeGuardError }); class TypeGuardError extends Error { method; path; expected; value; fake_expected_typed_value_; constructor(props){ super(props.message || `Error on ${props.method}(): invalid type${props.path ? ` on ${props.path}` : ""}, expect to be ${props.expected}`); const proto = new.target.prototype; if (Object.setPrototypeOf) Object.setPrototypeOf(this, proto); else this.__proto__ = proto; this.method = props.method; this.path = props.path; this.expected = props.expected; this.value = props.value; } } } }; var __webpack_module_cache__ = {}; function __webpack_require__(moduleId) { var cachedModule = __webpack_module_cache__[moduleId]; if (void 0 !== cachedModule) return cachedModule.exports; var module = __webpack_module_cache__[moduleId] = { exports: {} }; __webpack_modules__[moduleId](module, module.exports, __webpack_require__); return module.exports; } (()=>{ __webpack_require__.d = (exports, definition)=>{ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); }; })(); (()=>{ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop); })(); (()=>{ __webpack_require__.r = (exports)=>{ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); Object.defineProperty(exports, '__esModule', { value: true }); }; })(); function applyAlias(api, lazy) { return (0, __WEBPACK_EXTERNAL_MODULE__lynx_js_react_alias_rsbuild_plugin_2a0391db__.pluginReactAlias)({ LAYERS: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS, lazy, rootPath: api.context.rootPath }).setup(api); } const DETECT_IMPORT_ERROR = 'react:detect-import-error'; const ALIAS_BACKGROUND_ONLY_MAIN = 'react:alias-background-only-main'; const ALIAS_BACKGROUND_ONLY_BACKGROUND = 'react:alias-background-only-background'; function applyBackgroundOnly(api) { const __dirname = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(import.meta.url)); api.modifyBundlerChain((chain)=>{ chain.module.rule(ALIAS_BACKGROUND_ONLY_MAIN).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).resolve.alias.set('background-only$', __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(__dirname, 'background-only', 'error.js')); chain.module.rule(ALIAS_BACKGROUND_ONLY_BACKGROUND).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND).resolve.alias.set('background-only$', __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(__dirname, 'background-only', 'empty.js')); chain.module.rule(DETECT_IMPORT_ERROR).test(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(__dirname, 'background-only', 'error.js')).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).use(DETECT_IMPORT_ERROR).loader(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(__dirname, 'loaders/invalid-import-error-loader')).options({ message: '\'background-only\' cannot be imported from a main-thread module.' }); }); } function applyCSS(api, options) { const { enableRemoveCSSScope, enableCSSSelector, enableCSSInvalidation, targetSdkVersion } = options; api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>mergeRsbuildConfig(config, { output: { injectStyles: false } })); const __dirname = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(import.meta.url)); api.modifyBundlerChain(async function(chain, { CHAIN_ID, environment }) { const { CssExtractRspackPlugin, CssExtractWebpackPlugin } = await import("@lynx-js/css-extract-webpack-plugin"); const CssExtractPlugin = 'rspack' === api.context.bundlerType ? CssExtractRspackPlugin : CssExtractWebpackPlugin; const cssRules = [ CHAIN_ID.RULE.CSS, CHAIN_ID.RULE.SASS, CHAIN_ID.RULE.LESS, CHAIN_ID.RULE.STYLUS ]; cssRules.filter((rule)=>chain.module.rules.has(rule)).forEach((ruleName)=>{ const rule = chain.module.rule(ruleName); removeLightningCSS(rule); rule.issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND).use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader(CssExtractPlugin.loader).end(); const uses = rule.uses.entries(); const ruleEntries = rule.entries(); const cssLoaderRule = uses[CHAIN_ID.USE.CSS].entries(); chain.module.rule(`${ruleName}:${__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD}`).merge(ruleEntries).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).use(CHAIN_ID.USE.IGNORE_CSS).loader(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(__dirname, './loaders/ignore-css-loader')).end().uses.merge(uses).delete(CHAIN_ID.USE.MINI_CSS_EXTRACT).delete(CHAIN_ID.USE.LIGHTNINGCSS).delete(CHAIN_ID.USE.CSS).end().use(CHAIN_ID.USE.CSS).after(CHAIN_ID.USE.IGNORE_CSS).merge(cssLoaderRule).options(normalizeCssLoaderOptions(cssLoaderRule.options, true)).end(); }); const inlineCSSRules = [ CHAIN_ID.RULE.CSS_INLINE, CHAIN_ID.RULE.SASS_INLINE, CHAIN_ID.RULE.LESS_INLINE, CHAIN_ID.RULE.STYLUS_INLINE ]; inlineCSSRules.filter((rule)=>rule && chain.module.rules.has(rule)).forEach((ruleName)=>{ const rule = chain.module.rule(ruleName); removeLightningCSS(rule); }); function removeLightningCSS(rule) { if (rule.uses.has(CHAIN_ID.USE.LIGHTNINGCSS) && 'lynx' === environment.name) rule.uses.delete(CHAIN_ID.USE.LIGHTNINGCSS); } chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).tap(([options])=>[ { ...options, enableRemoveCSSScope: enableRemoveCSSScope ?? true, enableCSSSelector, enableCSSInvalidation, targetSdkVersion, cssPlugins: [ __WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__.CSSPlugins.parserPlugins.removeFunctionWhiteSpace() ] } ]).init((_, args)=>new CssExtractPlugin(...args)).end().end(); chain.module.when(void 0 === enableRemoveCSSScope, (module)=>module.rule('lynx.css.scoped').test(/\.css$/).resourceQuery({ and: [ /cssId/ ] }).sideEffects(false)); }); } const normalizeCssLoaderOptions = (options, exportOnlyLocals)=>{ if (options.modules && exportOnlyLocals) { let { modules } = options; modules = true === modules ? { exportOnlyLocals: true } : 'string' == typeof modules ? { mode: modules, exportOnlyLocals: true } : { ...modules, exportOnlyLocals: true }; return { ...options, modules }; } return options; }; const PLUGIN_NAME_REACT = 'lynx:react'; const PLUGIN_NAME_TEMPLATE = 'lynx:template'; const PLUGIN_NAME_RUNTIME_WRAPPER = 'lynx:runtime-wrapper'; const PLUGIN_NAME_WEB = 'lynx:web'; const DEFAULT_DIST_PATH_INTERMEDIATE = '.rspeedy'; const DEFAULT_FILENAME_HASH = '.[contenthash:8]'; const EMPTY_HASH = ''; function applyEntry(api, options) { const { compat, customCSSInheritanceList, debugInfoOutside, defaultDisplayLinear, enableAccessibilityElement, enableICU, enableCSSInheritance, enableCSSInvalidation, enableCSSSelector, enableNewGesture, enableParallelElement, enableRemoveCSSScope, firstScreenSyncTiming, enableSSR, pipelineSchedulerConfig, removeDescendantSelectorScope, targetSdkVersion, extractStr, experimental_isLazyBundle } = options; const { config } = api.useExposed(Symbol.for('rspeedy.api')); api.modifyBundlerChain((chain, { environment, isDev, isProd })=>{ const entries = chain.entryPoints.entries() ?? {}; const isLynx = 'lynx' === environment.name; const isWeb = 'web' === environment.name; chain.entryPoints.clear(); const mainThreadChunks = []; Object.entries(entries).forEach(([entryName, entryPoint])=>{ const { imports } = getChunks(entryName, entryPoint.values()); const templateFilename = ('object' == typeof config.output?.filename ? config.output.filename.bundle ?? config.output.filename.template : config.output?.filename) ?? '[name].[platform].bundle'; const mainThreadEntry = `${entryName}__main-thread`; const mainThreadName = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join(isLynx ? DEFAULT_DIST_PATH_INTERMEDIATE : '', `${entryName}/main-thread.js`); const backgroundName = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join(isLynx ? DEFAULT_DIST_PATH_INTERMEDIATE : '', getBackgroundFilename(entryName, environment.config, isProd)); const backgroundEntry = entryName; mainThreadChunks.push(mainThreadName); chain.entry(mainThreadEntry).add({ layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD, import: imports, filename: mainThreadName }).when(isDev && !isWeb, (entry)=>{ const require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url); entry.add({ layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD, import: require.resolve('@lynx-js/css-extract-webpack-plugin/runtime/hotModuleReplacement.lepus.cjs') }); }).end().entry(backgroundEntry).add({ layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND, import: imports, filename: backgroundName }).when(isDev && !isWeb, (entry)=>{ entry.add({ layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND, import: '@rspack/core/hot/dev-server' }).add({ layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND, import: '@lynx-js/webpack-dev-transport/client' }).add({ layer: __WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND, import: '@lynx-js/react/refresh' }); }).end().plugin(`${PLUGIN_NAME_TEMPLATE}-${entryName}`).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__.LynxTemplatePlugin, [ { dsl: 'react_nodiff', chunks: [ mainThreadEntry, backgroundEntry ], filename: templateFilename.replaceAll('[name]', entryName).replaceAll('[platform]', environment.name), intermediate: __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].posix.join(DEFAULT_DIST_PATH_INTERMEDIATE, entryName), customCSSInheritanceList, debugInfoOutside, defaultDisplayLinear, enableA11y: true, enableAccessibilityElement, enableICU, enableCSSInheritance, enableCSSInvalidation, enableCSSSelector, enableNewGesture, enableParallelElement, enableRemoveCSSScope: enableRemoveCSSScope ?? true, pipelineSchedulerConfig, removeDescendantSelectorScope, targetSdkVersion, experimental_isLazyBundle, cssPlugins: [ __WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__.CSSPlugins.parserPlugins.removeFunctionWhiteSpace() ] } ]).end(); }); if (isLynx) chain.plugin(PLUGIN_NAME_RUNTIME_WRAPPER).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_runtime_wrapper_webpack_plugin_27793081__.RuntimeWrapperWebpackPlugin, [ { injectVars (vars) { return vars.map((name)=>{ if ('Component' === name) return '__Component'; return name; }); }, targetSdkVersion, test: /^(?!.*main-thread(?:\.[A-Fa-f0-9]*)?\.js$).*\.js$/ } ]).end().plugin(`${__WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__.LynxEncodePlugin.name}`).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_template_webpack_plugin_e98d2f08__.LynxEncodePlugin, [ {} ]).end(); if (isWeb) chain.plugin(PLUGIN_NAME_WEB).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_web_webpack_plugin_6ba19e5a__.WebWebpackPlugin, []).end(); chain.plugin(PLUGIN_NAME_REACT).after(PLUGIN_NAME_TEMPLATE).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.ReactWebpackPlugin, [ { disableCreateSelectorQueryIncompatibleWarning: compat?.disableCreateSelectorQueryIncompatibleWarning ?? false, firstScreenSyncTiming, enableSSR, mainThreadChunks, extractStr, experimental_isLazyBundle } ]); }); } function getChunks(entryName, entryValue) { const chunks = [ entryName ]; const imports = []; for (const item of entryValue){ if ('string' == typeof item) { imports.push(item); continue; } if (Array.isArray(item)) { imports.push(...imports); continue; } const { dependOn } = item; if (Array.isArray(item.import)) imports.push(...item.import); else imports.push(item.import); if (dependOn) if ('string' == typeof dependOn) chunks.unshift(dependOn); else chunks.unshift(...dependOn); } return { chunks, imports }; } function getBackgroundFilename(entryName, config, isProd) { const { filename } = config.output; if ('string' == typeof filename.js) return filename.js.replaceAll('[name]', entryName).replaceAll('.js', '/background.js'); return `${entryName}/background${getHash(config, isProd)}.js`; } function getHash(config, isProd) { if ('string' == typeof config.output?.filenameHash) return config.output.filenameHash ? `.[${config.output.filenameHash}]` : EMPTY_HASH; if (config.output?.filenameHash === false) return EMPTY_HASH; if (isProd) return DEFAULT_FILENAME_HASH; return EMPTY_HASH; } function applyGenerator(api) { api.modifyBundlerChain({ order: 'pre', handler: (chain)=>{ chain.module.rule(`json-parse:${__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD}`).issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).test(/\.json$/).type('json').generator({ JSONParse: false }); } }); } function applyLazy(api) { api.modifyBundlerChain((chain)=>{ chain.output.library({ type: 'commonjs' }); }); } function applyLoaders(api, options) { const { compat, enableRemoveCSSScope, jsx, shake, defineDCE, experimental_isLazyBundle } = options; api.modifyBundlerChain((chain, { CHAIN_ID })=>{ const experiments = chain.get('experiments'); chain.experiments({ ...experiments, layers: true }); const rule = chain.module.rules.get(CHAIN_ID.RULE.JS); const uses = rule.uses.entries() ?? {}; const { output } = api.getRsbuildConfig(); const inlineSourcesContent = output?.sourceMap === true || !(output?.sourceMap === false || output?.sourceMap?.js === false || output?.sourceMap?.js?.includes('nosources')); const backgroundRule = rule.oneOf(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND); backgroundRule.issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND).uses.merge(uses).end().use(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND).loader(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.ReactWebpackPlugin.loaders.BACKGROUND).options({ compat, enableRemoveCSSScope, jsx, isDynamicComponent: experimental_isLazyBundle, inlineSourcesContent, defineDCE }).end(); const mainThreadRule = rule.oneOf(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD); mainThreadRule.issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).uses.merge(uses).end().when(void 0 !== uses[CHAIN_ID.USE.SWC], (rule)=>{ rule.uses.delete(CHAIN_ID.USE.SWC); const swcLoaderRule = uses[CHAIN_ID.USE.SWC].entries(); const swcLoaderOptions = swcLoaderRule.options; rule.use(CHAIN_ID.USE.SWC).merge(swcLoaderRule).options({ ...swcLoaderOptions, jsc: { ...swcLoaderOptions.jsc, target: 'es2019' } }); }).use(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.MAIN_THREAD).loader(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.ReactWebpackPlugin.loaders.MAIN_THREAD).options({ compat, enableRemoveCSSScope, jsx, inlineSourcesContent, isDynamicComponent: experimental_isLazyBundle, shake, defineDCE }).end(); rule.uses.clear(); }); } const PLUGIN_NAME_REACT_REFRESH = 'lynx:react:refresh'; const refresh_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url); function applyRefresh(api) { api.modifyWebpackChain((chain, { CHAIN_ID, isProd })=>{ if (!isProd) applyRefreshRules(chain, CHAIN_ID, __WEBPACK_EXTERNAL_MODULE__lynx_js_react_refresh_webpack_plugin_a01c5e97__.ReactRefreshWebpackPlugin); }); api.modifyBundlerChain((chain, { isProd, CHAIN_ID })=>{ if (!isProd) { applyRefreshRules(chain, CHAIN_ID, __WEBPACK_EXTERNAL_MODULE__lynx_js_react_refresh_webpack_plugin_a01c5e97__.ReactRefreshRspackPlugin); chain.resolve.alias.set('@lynx-js/react/refresh$', refresh_require.resolve('@lynx-js/react/refresh')).end(); } }); } function applyRefreshRules(chain, CHAIN_ID, ReactRefreshPlugin) { chain.plugin(PLUGIN_NAME_REACT_REFRESH).before(CHAIN_ID.PLUGIN.HMR).use(ReactRefreshPlugin).end().module.rule('react:refresh').issuerLayer(__WEBPACK_EXTERNAL_MODULE__lynx_js_react_webpack_plugin_1806f3f7__.LAYERS.BACKGROUND).before(CHAIN_ID.RULE.JS).test(/\.[jt]sx$/).exclude.add(/node_modules/).add(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(refresh_require.resolve('@lynx-js/react/package.json'))).add(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(refresh_require.resolve('@lynx-js/react/refresh'))).add(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname(refresh_require.resolve('@lynx-js/react/worklet-runtime'))).add(ReactRefreshPlugin.loader).end().use('ReactRefresh').loader(ReactRefreshPlugin.loader).options({}).end().end().end().end(); } const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj); const applySplitChunksRule = (api)=>{ api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>{ const userConfig = api.getRsbuildConfig('original'); if (!userConfig.performance?.chunkSplit?.strategy) return mergeRsbuildConfig(config, { performance: { chunkSplit: { strategy: 'all-in-one' } } }); return config; }); api.modifyBundlerChain((chain, { environment })=>{ const { config } = environment; if ('split-by-experience' !== config.performance.chunkSplit.strategy) return; const currentConfig = chain.optimization.splitChunks.values(); if (!isPlainObject(currentConfig)) return; const extraGroups = {}; extraGroups['preact'] = { name: 'lib-preact', test: /node_modules[\\/](.*?[\\/])?(?:preact|preact[\\/]compat|preact[\\/]hooks|preact[\\/]jsx-runtime)[\\/]/, priority: 0 }; chain.optimization.splitChunks({ ...currentConfig, cacheGroups: { ...currentConfig.cacheGroups, ...extraGroups } }); }); api.modifyRspackConfig((rspackConfig, { environment })=>{ if ('lynx' !== environment.name) return rspackConfig; if (!rspackConfig.optimization) return rspackConfig; if (!rspackConfig.optimization.splitChunks) return rspackConfig; rspackConfig.optimization.splitChunks.chunks = function(chunk) { return !chunk.name?.includes('__main-thread'); }; return rspackConfig; }); }; function applySWC(api) { api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>mergeRsbuildConfig(config, { tools: { swc (config) { config.jsc ??= {}; config.jsc.transform ??= {}; config.jsc.transform.useDefineForClassFields = false; config.jsc.transform.optimizer ??= {}; config.jsc.transform.optimizer.simplify = true; config.jsc.parser ??= { syntax: "typescript" }; if ("typescript" === config.jsc.parser.syntax) { config.jsc.parser.tsx = false; config.jsc.parser.decorators = true; } return config; } } })); } var _accessExpressionAsString = __webpack_require__("../../../node_modules/.pnpm/typia@8.1.1_@samchon+openapi@3.2.3_typescript@5.8.2/node_modules/typia/lib/internal/_accessExpressionAsString.js"); var _assertGuard = __webpack_require__("../../../node_modules/.pnpm/typia@8.1.1_@samchon+openapi@3.2.3_typescript@5.8.2/node_modules/typia/lib/internal/_assertGuard.js"); const validateConfig = (()=>{ const _io0 = (input, _exceptionable = true)=>(void 0 === input.compat || "object" == typeof input.compat && null !== input.compat && false === Array.isArray(input.compat) && _io1(input.compat, _exceptionable)) && (void 0 === input.customCSSInheritanceList || Array.isArray(input.customCSSInheritanceList) && input.customCSSInheritanceList.every((elem, _index1)=>"string" == typeof elem)) && (void 0 === input.debugInfoOutside || "boolean" == typeof input.debugInfoOutside) && (void 0 === input.defaultDisplayLinear || "boolean" == typeof input.defaultDisplayLinear) && (void 0 === input.enableAccessibilityElement || "boolean" == typeof input.enableAccessibilityElement) && (void 0 === input.enableICU || "boolean" == typeof input.enableICU) && (void 0 === input.enableCSSInheritance || "boolean" == typeof input.enableCSSInheritance) && (void 0 === input.enableCSSInvalidation || "boolean" == typeof input.enableCSSInvalidation) && (void 0 === input.enableCSSSelector || "boolean" == typeof input.enableCSSSelector) && (void 0 === input.enableNewGesture || "boolean" == typeof input.enableNewGesture) && (void 0 === input.enableParallelElement || "boolean" == typeof input.enableParallelElement) && (void 0 === input.enableRemoveCSSScope || "boolean" == typeof input.enableRemoveCSSScope) && (void 0 === input.firstScreenSyncTiming || "immediately" === input.firstScreenSyncTiming || "jsReady" === input.firstScreenSyncTiming) && (void 0 === input.enableSSR || "boolean" == typeof input.enableSSR) && (void 0 === input.jsx || "object" == typeof input.jsx && null !== input.jsx && false === Array.isArray(input.jsx) && _io4(input.jsx, _exceptionable)) && (void 0 === input.pipelineSchedulerConfig || "number" == typeof input.pipelineSchedulerConfig) && (void 0 === input.removeDescendantSelectorScope || "boolean" == typeof input.removeDescendantSelectorScope) && (void 0 === input.shake || "object" == typeof input.shake && null !== input.shake && false === Array.isArray(input.shake) && _io5(input.shake, _exceptionable)) && (void 0 === input.defineDCE || "object" == typeof input.defineDCE && null !== input.defineDCE && false === Array.isArray(input.defineDCE) && _io6(input.defineDCE, _exceptionable)) && (void 0 === input.engineVersion || "string" == typeof input.engineVersion) && (void 0 === input.targetSdkVersion || "string" == typeof input.targetSdkVersion) && null !== input.extractStr && (void 0 === input.extractStr || "boolean" == typeof input.extractStr || "object" == typeof input.extractStr && null !== input.extractStr && false === Array.isArray(input.extractStr) && _io8(input.extractStr, _exceptionable)) && (void 0 === input.experimental_isLazyBundle || "boolean" == typeof input.experimental_isLazyBundle) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{ if ([ "compat", "customCSSInheritanceList", "debugInfoOutside", "defaultDisplayLinear", "enableAccessibilityElement", "enableICU", "enableCSSInheritance", "enableCSSInvalidation", "enableCSSSelector", "enableNewGesture", "enableParallelElement", "enableRemoveCSSScope", "firstScreenSyncTiming", "enableSSR", "jsx", "pipelineSchedulerConfig", "removeDescendantSelectorScope", "shake", "defineDCE", "engineVersion", "targetSdkVersion", "extractStr", "experimental_isLazyBundle" ].some((prop)=>key === prop)) return true; const value = input[key]; if (void 0 === value) return true; return false; })); 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)=>{ if ([ "componentsPkg", "oldRuntimePkg", "newRuntimePkg", "additionalComponentAttributes", "addComponentElement", "simplifyCtorLikeReactLynx2", "removeComponentAttrRegex", "disableDeprecatedWarning", "darkMode", "disableCreateSelectorQueryIncompatibleWarning" ].some((prop)=>key === prop)) return true; const value = input[key]; if (void 0 === value) return true; return false; })); const _io2 = (input, _exceptionable = true)=>"boolean" == typeof input.compilerOnly && (1 === Object.keys(input).length || Object.keys(input).every((key)=>{ if ([ "compilerOnly" ].some((prop)=>key === prop)) return true; const value = input[key]; if (void 0 === value) return true; return false; })); const _io3 = (input, _exceptionable = true)=>"string" == typeof input.themeExpr && (1 === Object.keys(input).length || Object.keys(input).every((key)=>{ if ([ "themeExpr" ].some((prop)=>key === prop)) return true; const value = input[key]; if (void 0 === value) return true; return false; })); const _io4 = (input, _exceptionable = true)=>(void 0 === input.preserveJsx || "boolean" == typeof input.preserveJsx) && (void 0 === input.runtimePkg || "string" == typeof input.runtimePkg) && (void 0 === input.jsxImportSource || "string" == typeof input.jsxImportSource) && (void 0 === input.filename || "string" == typeof input.filename) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{ if ([ "preserveJsx", "runtimePkg", "jsxImportSource", "filename" ].some((prop)=>key === prop)) return true; const value = input[key]; if (void 0 === value) return true; return false; })); const _io5 = (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)=>{ if ([ "pkgName", "retainProp", "removeCallParams" ].some((prop)=>key === prop)) return true; const value = input[key]; if (void 0 === value) return true; return false; })); const _io6 = (input, _exceptionable = true)=>(void 0 === input.define || "object" == typeof input.define && null !== input.define && false === Array.isArray(input.define) && _io7(input.define, _exceptionable)) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{ if ([ "define" ].some((prop)=>key === prop)) return true; const value = input[key]; if (void 0 === value) return true; return false; })); const _io7 = (input, _exceptionable = true)=>Object.keys(input).every((key)=>{ const value = input[key]; if (void 0 === value) return true; return "string" == typeof value; }); const _io8 = (input, _exceptionable = true)=>(void 0 === input.strLength || "number" == typeof input.strLength) && (0 === Object.keys(input).length || Object.keys(input).every((key)=>{ if ([ "strLength" ].some((prop)=>key === prop)) return true; const value = input[key]; if (void 0 === value) return true; return false; })); 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, { method: "typia.createAssertEquals", path: _path + ".compat", expected: "(Partial<CompatVisitorConfig> & { disableCreateSelectorQueryIncompatibleWarning?: boolean; } | undefined)", value: input.compat }, _errorFactory)) && _ao1(input.compat, _path + ".compat", _exceptionable) || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".compat", expected: "(Partial<CompatVisitorConfig> & { disableCreateSelectorQueryIncompatibleWarning?: boolean; } | undefined)", value: input.compat }, _errorFactory)) && (void 0 === input.customCSSInheritanceList || (Array.isArray(input.customCSSInheritanceList) || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".customCSSInheritanceList", expected: "(Array<string> | undefined)", value: input.customCSSInheritanceList }, _errorFactory)) && input.customCSSInheritanceList.every((elem, _index8)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".customCSSInheritanceList[" + _index8 + "]", expected: "string", value: elem }, _errorFactory)) || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".customCSSInheritanceList", expected: "(Array<string> | undefined)", value: input.customCSSInheritanceList }, _errorFactory)) && (void 0 === input.debugInfoOutside || "boolean" == typeof input.debugInfoOutside || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".debugInfoOutside", expected: "(boolean | undefined)", value: input.debugInfoOutside }, _errorFactory)) && (void 0 === input.defaultDisplayLinear || "boolean" == typeof input.defaultDisplayLinear || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".defaultDisplayLinear", expected: "(boolean | undefined)", value: input.defaultDisplayLinear }, _errorFactory)) && (void 0 === input.enableAccessibilityElement || "boolean" == typeof input.enableAccessibilityElement || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".enableAccessibilityElement", expected: "(boolean | undefined)", value: input.enableAccessibilityElement }, _errorFactory)) && (void 0 === input.enableICU || "boolean" == typeof input.enableICU || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".enableICU", expected: "(boolean | undefined)", value: input.enableICU }, _errorFactory)) && (void 0 === input.enableCSSInheritance || "boolean" == typeof input.enableCSSInheritance || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".enableCSSInheritance", expected: "(boolean | undefined)", value: input.enableCSSInheritance }, _errorFactory)) && (void 0 === input.enableCSSInvalidation || "boolean" == typeof input.enableCSSInvalidation || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".enableCSSInvalidation", expected: "(boolean | undefined)", value: input.enableCSSInvalidation }, _errorFactory)) && (void 0 === input.enableCSSSelector || "boolean" == typeof input.enableCSSSelector || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".enableCSSSelector", expected: "(boolean | undefined)", value: input.enableCSSSelector }, _errorFactory)) && (void 0 === input.enableNewGesture || "boolean" == typeof input.enableNewGesture || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".enableNewGesture", expected: "(boolean | undefined)", value: input.enableNewGesture }, _errorFactory)) && (void 0 === input.enableParallelElement || "boolean" == typeof input.enableParallelElement || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".enableParallelElement", expected: "(boolean | undefined)", value: input.enableParallelElement }, _errorFactory)) && (void 0 === input.enableRemoveCSSScope || "boolean" == typeof input.enableRemoveCSSScope || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".enableRemoveCSSScope", expected: "(boolean | undefined)", value: input.enableRemoveCSSScope }, _errorFactory)) && (void 0 === input.firstScreenSyncTiming || "immediately" === input.firstScreenSyncTiming || "jsReady" === input.firstScreenSyncTiming || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".firstScreenSyncTiming", expected: "(\"immediately\" | \"jsReady\" | undefined)", value: input.firstScreenSyncTiming }, _errorFactory)) && (void 0 === input.enableSSR || "boolean" == typeof input.enableSSR || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".enableSSR", expected: "(boolean | undefined)", value: input.enableSSR }, _errorFactory)) && (void 0 === input.jsx || ("object" == typeof input.jsx && null !== input.jsx && false === Array.isArray(input.jsx) || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".jsx", expected: "(Partial<JsxTransformerConfig> | undefined)", value: input.jsx }, _errorFactory)) && _ao4(input.jsx, _path + ".jsx", _exceptionable) || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".jsx", expected: "(Partial<JsxTransformerConfig> | undefined)", value: input.jsx }, _errorFactory)) && (void 0 === input.pipelineSchedulerConfig || "number" == typeof input.pipelineSchedulerConfig || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".pipelineSchedulerConfig", expected: "(number | undefined)", value: input.pipelineSchedulerConfig }, _errorFactory)) && (void 0 === input.removeDescendantSelectorScope || "boolean" == typeof input.removeDescendantSelectorScope || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".removeDescendantSelectorScope", expected: "(boolean | undefined)", value: input.removeDescendantSelectorScope }, _errorFactory)) && (void 0 === input.shake || ("object" == typeof input.shake && null !== input.shake && false === Array.isArray(input.shake) || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".shake", expected: "(Partial<ShakeVisitorConfig> | undefined)", value: input.shake }, _errorFactory)) && _ao5(input.shake, _path + ".shake", _exceptionable) || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".shake", expected: "(Partial<ShakeVisitorConfig> | undefined)", value: input.shake }, _errorFactory)) && (void 0 === input.defineDCE || ("object" == typeof input.defineDCE && null !== input.defineDCE && false === Array.isArray(input.defineDCE) || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".defineDCE", expected: "(Partial<DefineDceVisitorConfig> | undefined)", value: input.defineDCE }, _errorFactory)) && _ao6(input.defineDCE, _path + ".defineDCE", _exceptionable) || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".defineDCE", expected: "(Partial<DefineDceVisitorConfig> | undefined)", value: input.defineDCE }, _errorFactory)) && (void 0 === input.engineVersion || "string" == typeof input.engineVersion || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".engineVersion", expected: "(string | undefined)", value: input.engineVersion }, _errorFactory)) && (void 0 === input.targetSdkVersion || "string" == typeof input.targetSdkVersion || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".targetSdkVersion", expected: "(string | undefined)", value: input.targetSdkVersion }, _errorFactory)) && (null !== input.extractStr || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".extractStr", expected: "(Partial<ExtractStrConfig> | boolean | undefined)", value: input.extractStr }, _errorFactory)) && (void 0 === input.extractStr || "boolean" == typeof input.extractStr || ("object" == typeof input.extractStr && null !== input.extractStr && false === Array.isArray(input.extractStr) || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".extractStr", expected: "(Partial<ExtractStrConfig> | boolean | undefined)", value: input.extractStr }, _errorFactory)) && _ao8(input.extractStr, _path + ".extractStr", _exceptionable) || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".extractStr", expected: "(Partial<ExtractStrConfig> | boolean | undefined)", value: input.extractStr }, _errorFactory)) && (void 0 === input.experimental_isLazyBundle || "boolean" == typeof input.experimental_isLazyBundle || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".experimental_isLazyBundle", expected: "(boolean | undefined)", value: input.experimental_isLazyBundle }, _errorFactory)) && (0 === Object.keys(input).length || false === _exceptionable || Object.keys(input).every((key)=>{ if ([ "compat", "customCSSInheritanceList", "debugInfoOutside", "defaultDisplayLinear", "enableAccessibilityElement", "enableICU", "enableCSSInheritance", "enableCSSInvalidation", "enableCSSSelector", "enableNewGesture", "enableParallelElement", "enableRemoveCSSScope", "firstScreenSyncTiming", "enableSSR", "jsx", "pipelineSchedulerConfig", "removeDescendantSelectorScope", "shake", "defineDCE", "engineVersion", "targetSdkVersion", "extractStr", "experimental_isLazyBundle" ].some((prop)=>key === prop)) return true; const value = input[key]; if (void 0 === value) return true; return _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + _accessExpressionAsString._accessExpressionAsString(key), expected: "undefined", value: value }, _errorFactory); })); const _ao1 = (input, _path, _exceptionable = true)=>(void 0 === input.componentsPkg || (Array.isArray(input.componentsPkg) || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".componentsPkg", expected: "(Array<string> | undefined)", value: input.componentsPkg }, _errorFactory)) && input.componentsPkg.every((elem, _index9)=>"string" == typeof elem || _assertGuard._assertGuard(_exceptionable, { method: "typia.createAssertEquals", path: _path + ".componentsPkg[" + _index9 + "]", expected: "string", val