@mega-apps/vue-addon-loader
Version:
Vue addon loader, for SFCs and components. You can use it for vue component online.
78 lines (77 loc) • 2.82 kB
TypeScript
import { types as t } from "@babel/core";
import { IAbstractPath, ICache, ILoadModuleOptions, IModuleExport, IPathContext, Module, TValueFactoryCreate } from "./types";
export declare const genSourcemap: boolean;
export declare const version: string;
export declare const isProduction: boolean;
/**
* 格式化Error
* @internal
*/
export declare function formatError(message: string, path: string, source: string): string;
/**
* @internal
*/
export declare function formatErrorLineColumn(message: string, path: string, source: string, line?: number, column?: number): string;
/**
* @internal
*/
export declare function formatErrorStartEnd(message: string, path: string, source: string, start: number, end?: number): string;
/**
* @internal
*/
export declare function hash(...valueList: any[]): string;
/**
* Simple cache helper
* preventCache usage: non-fatal error
* @internal
*/
export declare function withCache(cacheInstance: ICache, key: any[], valueFactory: TValueFactoryCreate): Promise<any>;
/**
* @internal
*/
export declare class Loading {
promise: Promise<IModuleExport>;
constructor(promise: Promise<IModuleExport>);
}
/**
* @internal
*/
export declare function interopRequireDefault(obj: any): any;
/**
* import is a reserved keyword, then rename
* @internal
*/
export declare function renameDynamicImport(fileAst: t.File): void;
/**
* @internal
*/
export declare function parseDeps(fileAst: t.File): string[];
export declare const targetBrowserBabelPlugins: {
[key: string]: any;
};
export declare const targetBrowserBabelPluginsHash: string;
/**
* 转义JS代码
* @param source
* @param moduleSourceType
* @param filename
* @param additionalBabelParserPlugins
* @param additionalBabelPlugins
* @param log
*/
export declare function transformJSCode(source: string, moduleSourceType: boolean, filename: IAbstractPath, additionalBabelParserPlugins: ILoadModuleOptions["additionalBabelParserPlugins"], additionalBabelPlugins: ILoadModuleOptions["additionalBabelPlugins"], log: ILoadModuleOptions["log"]): Promise<[string[], string]>;
export declare function loadModuleInternal(pathCx: IPathContext, options: ILoadModuleOptions): Promise<IModuleExport>;
/**
* Create a cjs module
* @internal
*/
export declare function createCJSModule(refPath: IAbstractPath, source: string, options: ILoadModuleOptions): Module;
/**
* @internal
*/
export declare function createJSModule(source: string, moduleSourceType: boolean, filename: IAbstractPath, options: ILoadModuleOptions): Promise<IModuleExport>;
/**
* 只需加载缓存给定的依赖项。
* @internal
*/
export declare function loadDeps(refPath: IAbstractPath, deps: IAbstractPath[], options: ILoadModuleOptions): Promise<void>;