mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
72 lines
1.5 KiB
TypeScript
72 lines
1.5 KiB
TypeScript
import { SourceMap } from "magic-string";
|
|
import { TaglibLookup } from "@marko/babel-utils";
|
|
import * as types from "./babel-types";
|
|
import Config from "./config";
|
|
export { type Config, types };
|
|
|
|
type Dep = {
|
|
type: string;
|
|
code: string;
|
|
path: string;
|
|
startPos?: number;
|
|
endPos?: number;
|
|
require?: boolean;
|
|
virtualPath?: string;
|
|
[x: string]: unknown;
|
|
};
|
|
|
|
export type MarkoMeta = {
|
|
id: string;
|
|
component?: string;
|
|
watchFiles: string[];
|
|
tags?: string[];
|
|
deps: Array<string | Dep>;
|
|
};
|
|
|
|
export type CompileResult = {
|
|
ast: types.File;
|
|
code: string;
|
|
map: SourceMap;
|
|
meta: MarkoMeta;
|
|
};
|
|
|
|
export function configure(config: Config): void;
|
|
|
|
export function compile(
|
|
src: string,
|
|
filename: string,
|
|
config?: Config
|
|
): Promise<CompileResult>;
|
|
|
|
export function compileSync(
|
|
src: string,
|
|
filename: string,
|
|
config?: Config
|
|
): CompileResult;
|
|
|
|
export function compileFile(
|
|
filename: string,
|
|
config?: Config
|
|
): Promise<CompileResult>;
|
|
|
|
export function compileFileSync(
|
|
filename: string,
|
|
config?: Config
|
|
): CompileResult;
|
|
|
|
export function getRuntimeEntryFiles(
|
|
output: string,
|
|
translator?: string | undefined
|
|
): string[];
|
|
|
|
export namespace taglib {
|
|
export function excludeDir(dirname: string): void;
|
|
export function excludePackage(packageName: string): void;
|
|
export function register(id: string, props: { [x: string]: unknown }): void;
|
|
export function buildLookup(
|
|
dirname: string,
|
|
translator?: unknown
|
|
): TaglibLookup;
|
|
export function clearCaches(): void;
|
|
}
|