@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 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);
@@ -1,8 +1,10 @@
1
1
  import { CONFIG } from '../config.mjs';
2
- import { APPTYPE, frameworkVersion, isDev, SSR } from '../process-env.mjs';
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 createRouter: string;
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;
@@ -1,8 +1,8 @@
1
- import{CONFIG as e}from"../config.mjs";import{APPTYPE as r,frameworkVersion as t,isDev as a}from"../process-env.mjs";let n=t<18,o="hash"===e.routerMode,c=o?"createHashRouter":"createBrowserRouter",p=`import React, { StrictMode, type ReactElement } from 'react';
2
- import Fallback from '@app/fallback';
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 { RouterProvider, ${c} } from 'react-router-dom';
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
- return (
16
- <${e.strict?"StrictMode":""}>
17
- <RouterProvider
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.${a?"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;"}
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 p;
27
+ export default renderApp;`;export default m;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.31.0",
3
+ "version": "3.32.1",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",