API @deepkit/type-compiler
npm install @deepkit/type-compiler
TypeScript 转换器,用于在运行时提供运行时类型信息。
It can't be more ops than this given number Expands brace patterns like Converts a glob pattern to a regular expression. Supports Returns true if path matches any of the given glob patterns and none of the ignore patterns. Creates a filter function for file ids, compatible with rollup's A file matches if it matches no exclude and at least one include pattern (or include is empty).
Relative glob patterns are resolved against Glob pattern, regular expression, or a list of them. Same as rollup's FilterPattern.Classes
export class Cache {
resolver: ReflectionConfigCache;
sourceFiles: {
[fileName: string]: SourceFile;
};
globalSourceFiles?: SourceFile[];
/**
* Signals the cache to check if it needs to be cleared.
*/
tick();
}
export class ReflectionTransformer implements CustomTransformer {
sourceFile: SourceFile;
constructor(protected context: TransformationContext, protected cache: Cache = new Cache);
forHost(host: CompilerHost): this;
withReflection(config: ReflectionConfig): this;
transformBundle(node: Bundle): Bundle;
getTempResultIdentifier(): Identifier;
transformSourceFile(sourceFile: SourceFile): SourceFile;
attachAdditionalStatements(statements: NodeArray<Statement> | Statement[]): Statement[];
}
export class DeclarationTransformer extends ReflectionTransformer {
transformSourceFile(sourceFile: SourceFile): SourceFile;
}
export class DeepkitLoader {
constructor();
transform(source: string, path: string): string;
}
Const
numbernumberFunctions
(program: Program, opts: {}): { before: import("typescript").CustomTransformerFactory; afterDeclarations: import("typescript").CustomTransformerFactory; }
(ops: ReflectionOp[]): string
(sourceFile: SourceFile, forType: Node, pack: { ops: ReflectionOp[]; stack: PackExpression[]; }): void
CustomTransformerFactory
CustomTransformerFactory
(pattern: string): string[]
{a,b} and {1..3} into a list of patterns.(pattern: string, options?: GlobOptions): RegExp
*, **, ?, [abc], [!abc], [a-z], {a,b}, {1..3}, and backslash escapes.(path: string, patterns: string | string[], ignore?: string[], options?: GlobOptions): boolean
(include?: FilterPattern, exclude?: FilterPattern, options?: { resolve?: string | false | null; }): (id: unknown) => boolean
createFilter.options.resolve (default the current working directory).Types
type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
interface GlobOptions {
/**
* When true, wildcards also match path segments starting with a dot (e.g. `.git`).
*/
dot?: boolean;
}