fix(package): import namespaces dynamically
This commit is contained in:
parent
399627cb65
commit
da5f5080fe
|
|
@ -2,7 +2,6 @@ import { type ConfigEnv, setConfig } from '@/config';
|
|||
import { Handler, Hono } from 'hono';
|
||||
import type { RoutePath } from '@/../assets/build/route-paths';
|
||||
import type { Data, Route, Namespace } from './types';
|
||||
import { namespaces } from './registry';
|
||||
|
||||
export * from '@/types';
|
||||
export { default as ofetch } from '@/utils/ofetch';
|
||||
|
|
@ -35,9 +34,11 @@ export async function request(path: RoutePath | (string & {})) {
|
|||
return res.json() as Promise<Data>;
|
||||
}
|
||||
|
||||
export function registerRoute(namespace: string, route: Route, namespaceConfig?: Namespace) {
|
||||
export async function registerRoute(namespace: string, route: Route, namespaceConfig?: Namespace) {
|
||||
ensureAppInitialized(app);
|
||||
|
||||
const { namespaces } = await import('./registry');
|
||||
|
||||
if (!namespaces[namespace]) {
|
||||
namespaces[namespace] = {
|
||||
...namespaceConfig,
|
||||
|
|
|
|||
Loading…
Reference in New Issue