@moneko/core 3.31.0 → 3.32.1
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/dev.d.mts +0 -4
- package/lib/vm/render-app.d.mts +4 -2
- package/lib/vm/render-app.mjs +8 -16
- package/package.json +1 -1
package/lib/dev.d.mts
CHANGED
|
@@ -51,9 +51,5 @@ declare const _prev: ConfigType[];
|
|
|
51
51
|
declare let prev: ConfigType;
|
|
52
52
|
declare function watchConfig(filepath: string);
|
|
53
53
|
declare function restart();
|
|
54
|
-
interface Command {
|
|
55
|
-
command: string;
|
|
56
|
-
args: string[];
|
|
57
|
-
}
|
|
58
54
|
declare const isWindow: boolean;
|
|
59
55
|
declare function killPort(port: number);
|
package/lib/vm/render-app.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { CONFIG } from '../config.mjs';
|
|
2
|
-
import { APPTYPE, frameworkVersion, isDev
|
|
2
|
+
import { APPTYPE, frameworkVersion, isDev } from '../process-env.mjs';
|
|
3
3
|
declare const legend: boolean;
|
|
4
4
|
declare const ReactDomPath: string;
|
|
5
5
|
declare const isHashRouter: boolean;
|
|
6
|
-
declare const
|
|
6
|
+
declare const Router: string;
|
|
7
|
+
declare const StrictMode: string;
|
|
8
|
+
declare const Root: string;
|
|
7
9
|
declare const renderApp: string;
|
|
8
10
|
export default renderApp;
|
package/lib/vm/render-app.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{CONFIG as e}from"../config.mjs";import{APPTYPE as r,frameworkVersion as t,isDev as
|
|
2
|
-
import
|
|
1
|
+
import{CONFIG as e}from"../config.mjs";import{APPTYPE as r,frameworkVersion as t,isDev as o}from"../process-env.mjs";let n=t<18,a="hash"===e.routerMode,c=a?"HashRouter":"BrowserRouter",p=e.strict?"StrictMode":"",s=`<${p}><${c} basename={${a?"/":"basename"}} window={window}><ErrorBoundary><App /></ErrorBoundary></${c}></${p}>`,m=`import React, { StrictMode, type ReactElement } from 'react';
|
|
2
|
+
import { ErrorBoundary } from '@moneko/react';
|
|
3
3
|
import routes from '@app/routes';
|
|
4
4
|
import ReactDOM from '${n?"react-dom":"react-dom/client"}';
|
|
5
|
-
import {
|
|
5
|
+
import { ${c}, useRoutes } from 'react-router-dom';
|
|
6
6
|
|
|
7
7
|
type RenderAppProps = {
|
|
8
8
|
container?: HTMLElement;
|
|
@@ -12,24 +12,16 @@ type RenderAppProps = {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export function App(props: RenderAppProps) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
router={${c}(routes, {
|
|
19
|
-
basename: ${o?"/":"props.basename"},
|
|
20
|
-
window: window,
|
|
21
|
-
})}
|
|
22
|
-
fallbackElement={Fallback && <Fallback />}
|
|
23
|
-
/>
|
|
24
|
-
</${e.strict?"StrictMode":""}>
|
|
25
|
-
);
|
|
15
|
+
const router = useRoutes(routes);
|
|
16
|
+
|
|
17
|
+
return router;
|
|
26
18
|
}
|
|
27
19
|
|
|
28
20
|
function renderApp(props: RenderAppProps = {}) {
|
|
29
21
|
const { container, basename = "${e.basename}", language, ...args } = props;
|
|
30
22
|
const _container = container?.querySelector('#root') || document.getElementById('root');
|
|
31
23
|
${"micro"===r?"window.mainApp = { ...args, container: _container as HTMLElement };":""}
|
|
32
|
-
${n?`ReactDOM.${
|
|
24
|
+
${n?`ReactDOM.${o?"render":"hydrate"}(${s}, _container);return () => ReactDOM.unmountComponentAtNode(_container as Element);`:`const instance = ReactDOM.createRoot(_container as HTMLElement);instance.render(${s});return instance.unmount;`}
|
|
33
25
|
}
|
|
34
26
|
|
|
35
|
-
export default renderApp;`;export default
|
|
27
|
+
export default renderApp;`;export default m;
|