@moneko/core 3.32.0 → 3.32.1-beta.0
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/vm/render-app.mjs +4 -7
- package/package.json +2 -2
package/lib/vm/render-app.mjs
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import{CONFIG as e}from"../config.mjs";import{APPTYPE as
|
|
2
|
-
|
|
3
|
-
<App />
|
|
4
|
-
</${c}>
|
|
5
|
-
</${p}>`,m=`import React, { StrictMode, type ReactElement } from 'react';
|
|
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';
|
|
6
3
|
import routes from '@app/routes';
|
|
7
4
|
import ReactDOM from '${n?"react-dom":"react-dom/client"}';
|
|
8
5
|
import { ${c}, useRoutes } from 'react-router-dom';
|
|
@@ -15,7 +12,7 @@ type RenderAppProps = {
|
|
|
15
12
|
};
|
|
16
13
|
|
|
17
14
|
export function App(props: RenderAppProps) {
|
|
18
|
-
const router = useRoutes(routes);
|
|
15
|
+
const router = useRoutes(routes || []);
|
|
19
16
|
|
|
20
17
|
return router;
|
|
21
18
|
}
|
|
@@ -23,7 +20,7 @@ export function App(props: RenderAppProps) {
|
|
|
23
20
|
function renderApp(props: RenderAppProps = {}) {
|
|
24
21
|
const { container, basename = "${e.basename}", language, ...args } = props;
|
|
25
22
|
const _container = container?.querySelector('#root') || document.getElementById('root');
|
|
26
|
-
${"micro"===
|
|
23
|
+
${"micro"===r?"window.mainApp = { ...args, container: _container as HTMLElement };":""}
|
|
27
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;`}
|
|
28
25
|
}
|
|
29
26
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.32.0",
|
|
3
|
+
"version": "3.32.1-beta.0",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"author": "moneko",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@fastify/compress": "
|
|
18
|
+
"@fastify/compress": "6.5.0",
|
|
19
19
|
"@fastify/http-proxy": "9.5.0",
|
|
20
20
|
"@fastify/middie": "8.3.3",
|
|
21
21
|
"@moneko/convert": "1.0.0",
|