@feroomjs/vue-routes
Version:
@feroomjs/vue-routes
130 lines (116 loc) • 3.67 kB
TypeScript
/// <reference types="node" />
import EventEmitter from 'events';
import { Plugin as Plugin_2 } from 'rollup';
declare class FeRegistry<CFG extends object = object> extends EventEmitter {
normalizeModuleData(data: Partial<TModuleData<CFG>>): TModuleData<CFG>;
registerModule(data: Partial<TModuleData<CFG>>): {
files: string[];
id: string;
version: string;
entry: string;
source: string;
config: TFeRoomConfig<CFG>;
activate?: boolean | undefined;
};
registerFromNpm(npmData: TNpmModuleData<CFG>): Promise<"Module alread exists" | {
files: string[];
id: string;
version: string;
entry: string;
source: string;
config: TFeRoomConfig<CFG>;
activate?: boolean | undefined;
}>;
readModule(id: string, version?: string): TModuleData<CFG>;
exists(id: string, version?: string): boolean;
getActiveVersion(id: string): string;
getModulesList(): string[];
getAllModules(): TModuleData<CFG>[];
}
declare interface TFeRoomConfig<EXT extends object = TFeRoomExtionsOptionsAll> {
registerOptions?: TFeRoomRegisterOptions;
buildOptions?: TFeRoomRollupOptions;
extensions?: EXT;
}
declare interface TFeRoomExtionsOptionsAll {
sharedMenu?: object;
vueRoutes?: object[];
}
declare interface TFeRoomRegisterOptions {
id?: string;
entry?: string;
label?: string;
description?: string;
include?: string[];
exclude?: string[];
preloadEntry?: boolean | 'head' | 'body:first' | 'body:last';
preloadScripts?: string | string[];
preloadCss?: string | string[];
appendHead?: string;
appendBody?: string;
globals?: object;
lockDependency?: {
[name: string]: string;
};
importNpmDependencies?: {
[name: string]: TNpmModuleData;
};
}
declare interface TFeRoomRollupOptions {
input?: string;
ts?: boolean | object;
vue?: boolean | object;
css?: string | object;
nodeResolve?: object;
dependencies?: {
bundle?: string[];
lockVersion?: string[];
};
feroomConfPath?: string;
output?: string;
plugins?: Plugin_2[];
}
declare interface TModuleData<EXT extends object = object> {
id: string;
version: string;
files: Record<string, string | {
type: 'Buffer';
data: number[];
}>;
entry: string;
source: string;
config: TFeRoomConfig<EXT>;
activate?: boolean;
}
declare type TNpmModuleData<EXT extends object = object> = {
registry?: string;
name: string;
version?: string;
rebuildIfExists?: boolean;
} & Partial<TModuleData<EXT>>;
export declare interface TRoutesCfg {
vueRoutes?: TVueRoute[];
}
export declare interface TVueRoute {
path: string;
component?: string;
children?: TVueRoute[];
name?: string;
props?: boolean;
}
export declare class VueRoutesController {
protected _registry: FeRegistry;
constructor(_registry: FeRegistry);
getModuleRoutes(module: TModuleData<TRoutesCfg>): TVueRoute[];
renderProp(name: string, value: string, indent?: string): string;
renderFunc(name: string, value: string, indent?: string): string;
renderRoute(route: TVueRoute, indent?: string): string;
routes(): string;
}
export { }
// FeRoom dynamic module "@feroom-dynamic/vue-routes"
declare module '@feroom-dynamic/vue-routes' {
import { RouterOptions } from 'vue-router'
export const vueRoutes: RouterOptions['routes']
export default vueRoutes
}