@moneko/core 3.28.7 → 3.28.9
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/lib/index.d.mts +2 -0
- package/lib/loader/css-in-js-minify.cjs +1 -1
- package/lib/loader/css-in-js-minify.d.cts +15 -7
- package/lib/loader/react-compiler.cjs +1 -1
- package/lib/loader/react-compiler.d.cts +16 -2
- package/lib/module.config.mjs +2 -2
- package/package.json +2 -1
- package/typings/global.d.ts +9 -8
- package/lib/bin/convert.d.mts +0 -36
- package/lib/bin/convert.mjs +0 -0
- package/lib/entry/react.d.mts +0 -13
- package/lib/entry/react.mjs +0 -41
package/lib/index.d.mts
CHANGED
|
@@ -6,6 +6,8 @@ export { default as require } from './commom/require.mjs';
|
|
|
6
6
|
export { default as Rule } from './commom/rule.mjs';
|
|
7
7
|
export { type MockConfiguration, type ProxyFuncType, type RequestFormData, yApiMock, type YApiOption, type YApiOptionBySchema, yApiSchemaMock } from './dev/mock.mjs';
|
|
8
8
|
export type { ProxyConfig } from './dev/proxy.mjs';
|
|
9
|
+
export type { CssInJsMinifyOption } from './loader/css-in-js-minify.cjs';
|
|
10
|
+
export type { ReactCompilerOption } from './loader/react-compiler.cjs';
|
|
9
11
|
export { type JsxDomExpressions, default as jsxDomExpressions } from './options/jsx-dom-expressions.mjs';
|
|
10
12
|
export { type OptimizationSplitChunksOptions, default as splitChunk } from './options/split-chunk.mjs';
|
|
11
13
|
export type { HtmlMeta, HtmlPluginOption } from './plugin/html-plugin.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return
|
|
1
|
+
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return i}});const t=require("@swc/core"),r=require("stylis"),n=(e=require("../commom/log.mjs"))&&e.__esModule?e:{default:e};function l(e){return{type:"iTemplateElement",span:{start:0,end:0,ctxt:0},tail:!1,cooked:e,raw:e}}function a(e,t){if("Identifier"===e.tag.type&&t.includes(e.tag.value)){let t=e.template,n=function(e){let t=e.quasis.map(e=>e.cooked);return t.reduce((e,r,n)=>(e.push(r),n!==t.length-1&&e.push(`xxx${n}:xxx`),e),[]).join("").trim()}(t),a=function e(t){return t.map(t=>{switch(t.type){case"import":case"decl":return t.value;case"comm":return"/"===t.props&&t.value.includes("@")?t.value:"";case"rule":return`${t.value.replace(/&\f/g,"&")}{${e(t.children)}}`;default:return`${t.value}{${e(t.children)}}`}}).join("")}(function e(t,r){for(let n=0;n<t.length;n++){let l=t[n],a=l.parent,i=l.children;a?!function(e){var t;return"rule"===e.type&&e.parent&&(t=e.parent,e.line===t.line&&e.column===t.column)}(l)&&a.children.push(l):r.push(l),Array.isArray(i)&&(l.children=[],e(i,r))}return r}((0,r.compile)(n),[])),i=function(e,t){let r=function(e){let t;let r=/xxx(\d+):xxx/gm,n=[];for(;null!==(t=r.exec(e));)n.push({value:t[0],p1:parseInt(t[1],10),index:t.index});return n}(e);if(0===r.length)return""===e?[]:[l(e)];let n=[],a=[],i=0;return r.forEach(({value:s,p1:u,index:p},o)=>{let c=e.substring(i,p);i=i+c.length+s.length,c||0!==o?n.push(l(c)):n.push(l("")),a.push(t[u]),o===r.length-1&&n.push(l(e.substring(p+s.length)))}),a.reduce((e,t,r)=>e.concat([t],n[r+1]),[n[0]]).filter(e=>""!==e.raw)}(a,t.expressions);if(a.length>1){let e=[],r=[];i.forEach((t,n)=>{"iTemplateElement"===t.type?e.push({...t,type:"TemplateElement",tail:n===i.length-1}):r.push(t)}),t.quasis=e,t.expressions=r}}}async function i(e){let r=this.async(),{moduleName:l,allowFuncs:i}=this.getOptions()||{};this.cacheable&&this.cacheable();try{let n=await (0,t.parse)(e,{syntax:"ecmascript"}),s=[];n.body.forEach(e=>{"ImportDeclaration"===e.type&&e.source.value===l&&e.specifiers.forEach(e=>{"ImportSpecifier"===e.type&&(e.imported&&i.includes(e.imported.value)?s.push(e.local.value):i.includes(e.local.value)&&s.push(e.local.value))})}),n.body.forEach(e=>{!function(e){if("ExportDeclaration"===e.type||"ExpressionStatement"===e.type){let t="declaration"in e?e.declaration:e.expression;t&&"CallExpression"===t.type&&t.arguments.forEach(e=>{e.expression&&"TaggedTemplateExpression"===e.expression.type&&a(e.expression,s)}),t&&"VariableDeclaration"===t.type&&t.declarations.forEach(e=>{e.init?.type==="TaggedTemplateExpression"&&a(e.init,s)})}else"CallExpression"===e.type&&e.arguments.forEach(e=>{e.expression&&"TaggedTemplateExpression"===e.expression.type&&a(e.expression,s)})}(e)});let{code:u}=await (0,t.print)(n);r(null,u)}catch(e){r(e),(0,n.default)(e)}}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import { type Expression, type
|
|
1
|
+
import { type Expression, type ModuleItem, parse, print, type TaggedTemplateExpression, type TemplateElement, type TemplateLiteral } from '@swc/core';
|
|
2
2
|
import { compile, type Element } from 'stylis';
|
|
3
3
|
import type { LoaderContext } from 'webpack';
|
|
4
4
|
import log from '../commom/log.mjs';
|
|
5
5
|
export interface CssInJsMinifyOption {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
allowFuncs?: string[];
|
|
6
|
+
moduleName: string;
|
|
7
|
+
allowFuncs: string[];
|
|
9
8
|
}
|
|
10
|
-
declare function
|
|
11
|
-
declare function
|
|
9
|
+
declare function haveSameLocation(element1: Element, element2: Element);
|
|
10
|
+
declare function isAutoInsertedRule(element: Element);
|
|
11
|
+
declare function toInputTree(elements: Element[], tree: Element[]);
|
|
12
|
+
declare function stringifyTree(elements: Element[]);
|
|
12
13
|
declare function getDynamicMatches(str: string);
|
|
13
|
-
declare function
|
|
14
|
+
declare function interleave(strings: (ITemplateElement | Expression)[], interpolations: Expression[]);
|
|
15
|
+
declare function createRawStringFromTemplateLiteral(template: TemplateLiteral);
|
|
16
|
+
interface ITemplateElement extends Omit<TemplateElement, 'type'> {
|
|
17
|
+
type: 'iTemplateElement';
|
|
18
|
+
}
|
|
19
|
+
declare function createTemplateElement(raw: string): ITemplateElement;
|
|
20
|
+
declare function replacePlaceholdersWithExpressions(str: string, expressions: Expression[]);
|
|
21
|
+
declare function transform(expression: TaggedTemplateExpression, names: string[]);
|
|
14
22
|
export default async function cssInJsMinifyLoader(this: LoaderContext<CssInJsMinifyOption>, sourceCode: string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return o}});const e=require("@babel/core"),r=u(require("babel-plugin-react-compiler")),t=u(require("../commom/log.mjs"));function u(e){return e&&e.__esModule?e:{default:e}}async function o(u){let o=this.async();this.cacheable&&this.cacheable(),(0,e.transform)(u,{filename:this.resourcePath,sourceMaps:this.sourceMap,plugins:[[r.default,this.getOptions()]]},(e,r)=>{if(e){(0,t.default)(e),o(e,u);return}if(null===r){o(Error(`Failed to transform "${this.resourcePath}"`));return}o(null,r.code||"",null===r.map?void 0:r.map)})}
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { transform } from '@babel/core';
|
|
2
2
|
import BabelPluginReactCompiler from 'babel-plugin-react-compiler';
|
|
3
3
|
import type { LoaderContext } from 'webpack';
|
|
4
|
+
import log from '../commom/log.mjs';
|
|
4
5
|
export interface ReactCompilerOption {
|
|
5
|
-
|
|
6
|
+
target?: '17' | '18' | '19';
|
|
7
|
+
sources?(filename: string): boolean;
|
|
8
|
+
compilationMode?: 'annotation' | 'infer' | 'syntax' | 'all';
|
|
9
|
+
logger?: {
|
|
10
|
+
logEvent?: (fileName: string, event: MessageEvent) => void;
|
|
11
|
+
};
|
|
12
|
+
noEmit?: boolean;
|
|
13
|
+
flowSuppressions?: boolean;
|
|
14
|
+
ignoreUseNoForget?: boolean;
|
|
15
|
+
enableReanimatedCheck?: boolean;
|
|
16
|
+
panicThreshold?: string;
|
|
17
|
+
environment?: unknown;
|
|
18
|
+
gating?: null;
|
|
19
|
+
eslintSuppressionRules?: Record<string, string | boolean | number>;
|
|
6
20
|
}
|
|
7
21
|
export default async function reactCompilerLoader(this: LoaderContext<ReactCompilerOption>, sourceCode: string);
|
package/lib/module.config.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
let e;import{join as
|
|
2
|
-
`)}:void 0},importLoaders:2}},
|
|
1
|
+
let e;import{join as s,sep as o}from"node:path";import{saveFileSync as t}from"@moneko/utils";import r,{CUSTOMCONFIG as a}from"./commom/paths.mjs";import n from"./commom/reactive-object.mjs";import m from"./commom/require.mjs";import i from"./commom/rule.mjs";import l from"./options/css-extract.mjs";import c from"./options/modify-vars.mjs";import d from"./options/reslove.mjs";import p from"./options/swcrc.mjs";import{getLightningCssTargets as u}from"./polyfills/targets.mjs";import{node_modules as f,resolveProgram as j,toCamelCase as h}from"./utils/index.mjs";import y from"./utils/svg-to-data-uri.mjs";import{comment as g,getCommentPath as v}from"./vm/docs.mjs";import x from"./vm/generate-doc.mjs";import{outputConfig as w}from"./common.mjs";import{CONFIG as P}from"./config.mjs";import{FRAMEWORK as L,isDev as M,isLibrary as _}from"./process-env.mjs";let k={loader:s(r.corePath,"/loader/lightning-css/loader.cjs"),options:{sourceMap:!!P.sourceMap,targets:u(),rem:!!P.rem,esModule:!0,modules:{auto(e){if(e){if(e.endsWith(".css")&&!e.endsWith("module.css"))return!1;for(let s=0,o=I.length;s<o;s++)if(e.includes(I[s]))return i.css_module.test(e)}return i.node_modules_css_module.test(e)},localIdentName:"[name][hash]_[local]",namedExport:!0,exportLocalsConvention:"dashesOnly",exportOnlyLocals:!1,getJSON:P.cssModuleDefinition?function(e){q.setData(`${e.resourcePath}.d.ts`,`${e.exports.map(({name:e,value:s})=>`export const ${h(e)}: '${s}';`).join("\n")}
|
|
2
|
+
`)}:void 0},importLoaders:2}},O={loader:d.lessLoader,options:{sourceMap:!!P.sourceMap,lessOptions:{modifyVars:c,javascriptEnabled:!0}}},b=new Map;function C(e){if(b.has(e))return b.get(e);try{let s;let t=m.resolve(e).split(o),r=t.lastIndexOf("node_modules");return s=-1!==r?t.slice(0,r).join(o):t.join(o),b.set(e,s),s}catch{let s=f(e);return b.set(e,s),s}}let I=[...P.cssModules,`@moneko/${L}`,"neko-ui"].map(C),J=["components","example","mock","site","src","server"].map(j);function W(e){return new Promise(s=>{s([...J,r.corePath,...P.rulesInclude?.[e]?.map(C)||[]])})}a&&J.push(j(a)),P.overrideResolve&&P.overrideResolve.override&&J.push(P.overrideResolve.override);let $=await Promise.all([W("css"),W("js"),W("media"),W("wasm"),W("font")]),R=$[0],B=$[1],N=$[2],S=$[3],z=$[4];d.sassLoader&&(e={loader:d.sassLoader,options:{implementation:await import("sass"),sassOptions:{}}});let D=_&&M&&{test:i.tsdoc,include:P.alias["@pkg"],exclude:[/node_modules\/(?!(@app|@moneko)).+/,i.__tests__],enforce:"pre",loader:s(r.corePath,"/loader/ts-doc.cjs"),options:{comment:g,generateDoc:x,getCommentPath:v}},E=w.library?.type==="umd"&&!1===P.htmlPluginOption,Q=[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename(e){let s=e.filename;return s&&s.toLocaleLowerCase().endsWith("wasm?url")?"wasm/[name][ext]":"assets/[name][ext]"}}},{test:i.wasm,type:"webassembly/async",include:S},{test:i.txt,type:"asset/source"},{test:i.image,type:"asset",dependency:{not:["url"]},parser:{dataUrlCondition:E?()=>!0:{maxSize:4096}},generator:{filename:e=>e.filename?.toLocaleLowerCase().endsWith(".svg")?"assets/svg/[name][ext]":"assets/images/[name][ext]",dataUrl:(e,s)=>s.filename.toLocaleLowerCase().endsWith(".svg")?y(e.toString()):e},include:N},{test:i.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:N},{test:i.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:z}],U=P.prefixJsLoader.filter(Boolean)||[];switch(L){case"react":P.reactCompiler&&U.unshift({loader:s(r.corePath,"/loader/react-compiler.cjs"),options:P.reactCompiler});break;case"solid":P.refresh=!1}P.cssInJs&&"object"==typeof P.cssInJs.minify&&U.unshift({loader:s(r.corePath,"/loader/css-in-js-minify.cjs"),options:Object.assign({moduleName:"@moneko/css",allowFuncs:["css","injectGlobal"]},P.cssInJs.minify)});let q=new n({});q.on("change",(e,s)=>{t(e,s)});export default(o=>{let t={loader:d.swcLoader,options:p(o)};return{parser:{javascript:{commonjsMagicComments:!0,dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,importMeta:!0,importMetaContext:!0}},noParse:P.noParse,rules:[!1!==P.htmlPluginOption&&D,{oneOf:[...Q,{test:i.js,use:[...U,t],include:B},{test:i.css,use:[l,k],include:R},e&&{test:i.scss,use:[l,k,e],include:R},{test:i.less,use:[l,k,O],include:R},{test:i.markdown,use:[...U,{loader:s(r.corePath,"/loader/mdx.cjs"),options:P.mdx}],exclude:[/node_modules\/(?!(@app|@moneko)).+/]}].filter(Boolean)},...P.moduleRules].filter(Boolean)}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.28.
|
|
3
|
+
"version": "3.28.9",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"@types/stylis": "4.2.7",
|
|
50
50
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
51
51
|
"@types/webpack-hot-middleware": "2.25.9",
|
|
52
|
+
"babel-plugin-react-compiler": "19.0.0-beta-63e3235-20250105",
|
|
52
53
|
"eslint-config-neko": "3.0.3",
|
|
53
54
|
"sass": "1.83.1",
|
|
54
55
|
"sass-loader": "16.0.4",
|
package/typings/global.d.ts
CHANGED
|
@@ -14,11 +14,13 @@ import type {
|
|
|
14
14
|
} from 'webpack';
|
|
15
15
|
|
|
16
16
|
import type {
|
|
17
|
+
CssInJsMinifyOption,
|
|
17
18
|
HtmlPluginOption,
|
|
18
19
|
JsxDomExpressions,
|
|
19
20
|
OptimizationSplitChunksOptions,
|
|
20
21
|
OverrideResolverOption,
|
|
21
22
|
ProxyConfig,
|
|
23
|
+
ReactCompilerOption,
|
|
22
24
|
VirtualModulePluginOption,
|
|
23
25
|
} from '../lib/index.mjs';
|
|
24
26
|
import type { CopyPluginOption } from '../lib/plugin/copy.mjs';
|
|
@@ -472,7 +474,7 @@ export declare type ConfigType = {
|
|
|
472
474
|
* @description 需要 react 19+
|
|
473
475
|
* @default false
|
|
474
476
|
*/
|
|
475
|
-
reactCompiler?: false |
|
|
477
|
+
reactCompiler?: false | ReactCompilerOption;
|
|
476
478
|
/** stylelint 配置
|
|
477
479
|
* @description 为 false 时关闭
|
|
478
480
|
*/
|
|
@@ -485,15 +487,14 @@ export declare type ConfigType = {
|
|
|
485
487
|
* @default 'tsc'
|
|
486
488
|
*/
|
|
487
489
|
dts?: 'tsc' | 'swc';
|
|
490
|
+
cssInJs?: {
|
|
491
|
+
/**
|
|
492
|
+
* 压缩 css 模版字符串
|
|
493
|
+
*/
|
|
494
|
+
minify?: CssInJsMinifyOption | false;
|
|
495
|
+
};
|
|
488
496
|
};
|
|
489
497
|
|
|
490
|
-
export interface ReactCompilerConfig {
|
|
491
|
-
/** 指定启用 React Compiler 的范围 */
|
|
492
|
-
sources?(filename: string): boolean;
|
|
493
|
-
/** 编译模式 */
|
|
494
|
-
compilationMode?: 'annotation';
|
|
495
|
-
}
|
|
496
|
-
|
|
497
498
|
/**
|
|
498
499
|
* 用于构建 http 资源的选项
|
|
499
500
|
*/
|
package/lib/bin/convert.d.mts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { copyFile, ink, println, scanFolderSync, updateFile } from '@moneko/utils';
|
|
3
|
-
import { JsMinifyOptions, type Options, type Output, transformFile } from '@swc/core';
|
|
4
|
-
declare function getOutfilePath(outDir: string, file: string, outFileExtension?: string);
|
|
5
|
-
interface ConvertOptions {
|
|
6
|
-
outDir: string;
|
|
7
|
-
inputDir: string;
|
|
8
|
-
options: Options;
|
|
9
|
-
ignore?: RegExp[];
|
|
10
|
-
extensions?: string[];
|
|
11
|
-
copy?: boolean;
|
|
12
|
-
quiet?: boolean;
|
|
13
|
-
outputExtension?: string;
|
|
14
|
-
}
|
|
15
|
-
interface ConvertResult {
|
|
16
|
-
duration: number;
|
|
17
|
-
compiled: string[];
|
|
18
|
-
copied: string[];
|
|
19
|
-
failed: string[];
|
|
20
|
-
}
|
|
21
|
-
interface ConvertOutput extends Output {
|
|
22
|
-
output?: string;
|
|
23
|
-
}
|
|
24
|
-
declare const normalizeExtension: Record<string, string>;
|
|
25
|
-
declare const jscMinify: JsMinifyOptions;
|
|
26
|
-
declare async function convert({ ignore = [], quiet = true, copy = true, outDir, outputExtension, inputDir, options, extensions = [
|
|
27
|
-
'.ts',
|
|
28
|
-
'.js',
|
|
29
|
-
'.tsx',
|
|
30
|
-
'.jsx',
|
|
31
|
-
'.mts',
|
|
32
|
-
'.mjs',
|
|
33
|
-
'.cts',
|
|
34
|
-
'.cjs'
|
|
35
|
-
] }: ConvertOptions);
|
|
36
|
-
export default convert;
|
package/lib/bin/convert.mjs
DELETED
|
File without changes
|
package/lib/entry/react.d.mts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { transformSync } from '@swc/core';
|
|
2
|
-
import swcrc, { SwcOption } from '../options/swcrc.mjs';
|
|
3
|
-
import { isDev } from '../process-env.mjs';
|
|
4
|
-
import info from '../vm/info.mjs';
|
|
5
|
-
declare const version: number;
|
|
6
|
-
declare const ReactDomPath: string;
|
|
7
|
-
declare const isHashRouter: boolean;
|
|
8
|
-
declare const v7Future: Record<string, boolean | undefined>;
|
|
9
|
-
declare const createRouter: string;
|
|
10
|
-
declare const code: string;
|
|
11
|
-
declare const swcOption: SwcOption;
|
|
12
|
-
declare const reactRenderApp: string;
|
|
13
|
-
export default reactRenderApp;
|
package/lib/entry/react.mjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import{transformSync as e}from"@swc/core";import r from"../options/swcrc.mjs";import{isDev as t}from"../process-env.mjs";import o from"../vm/info.mjs";let a=parseFloat(o.frameworkVersion),n="hash"===o.routerMode,s=Object.assign({v7_relativeSplatPath:!1},"browser"===o.routerMode?{v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:o.ssr,v7_skipActionErrorRevalidation:!1}:{}),c=n?"createHashRouter":"createBrowserRouter",p=`import React, { StrictMode, useRef, type ReactElement } from 'react';
|
|
2
|
-
import Fallback from '@app/fallback';
|
|
3
|
-
import routes from '@app/routes';
|
|
4
|
-
import ReactDOM from '${a<18?"react-dom":"react-dom/client"}';
|
|
5
|
-
import { RouterProvider, ${c} } from 'react-router-dom';
|
|
6
|
-
|
|
7
|
-
type RenderAppProps = {
|
|
8
|
-
container?: HTMLElement;
|
|
9
|
-
basename?: string;
|
|
10
|
-
fallback?: ReactElement;
|
|
11
|
-
language?: string;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export function App(props: RenderAppProps) {
|
|
15
|
-
const v7Future = useRef(${JSON.stringify(s)});
|
|
16
|
-
return (
|
|
17
|
-
<StrictMode>
|
|
18
|
-
<RouterProvider
|
|
19
|
-
router={${c}(routes, {
|
|
20
|
-
basename: ${n?"/":"props.basename"},
|
|
21
|
-
window: window,
|
|
22
|
-
future: v7Future.current,
|
|
23
|
-
})}
|
|
24
|
-
future={{
|
|
25
|
-
/** 这使用 useTransition 而不是 useState 来更新路由器状态 */
|
|
26
|
-
v7_startTransition: false,
|
|
27
|
-
}}
|
|
28
|
-
fallbackElement={Fallback && <Fallback />}
|
|
29
|
-
/>
|
|
30
|
-
</StrictMode>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function renderApp(props: RenderAppProps = {}) {
|
|
35
|
-
const { container, basename = "${o.base}", language, ...args } = props;
|
|
36
|
-
const _container = container?.querySelector('#root') || document.getElementById('root');
|
|
37
|
-
${"micro"===o.type?"window.mainApp = { ...args, container: _container as HTMLElement };":""}
|
|
38
|
-
${a<18?`ReactDOM.${t?"render":"hydrate"}(<App basename={basename} language={language} />, _container);return () => ReactDOM.unmountComponentAtNode(_container as Element);`:"const instance = ReactDOM.createRoot(_container as HTMLElement);instance.render(<App basename={basename} language={language} />);return instance.unmount;"}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export default renderApp;`,i=r(o.ssr);delete i.sync,delete i.parseMap;let m=e(p,i).code;console.log(m);export default m;
|