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