@ts-for-gir/lib
Version:
Typescript .d.ts generator from GIR for gjs
52 lines (51 loc) • 2.35 kB
TypeScript
import { Formatter } from "../formatters/formatter.js";
import { DtsGenerator } from "../generators/dts.js";
import { JsonGenerator } from "../generators/json.js";
import { FormatGenerator } from "../generators/generator.js";
import { TwoKeyMap } from "../util.js";
import { GirVisitor } from "../visitor.js";
import { IntrospectedNamespace } from "./namespace.js";
import { ParsedGir } from "../types/parsed-gir.js";
import { GirModule } from "../index.js";
import type { OptionsGeneration, OptionsTransform } from "../types/index.js";
export interface NSLoader {
load(namespace: string, version: string): ParsedGir | null;
loadAll(namespace: string): ParsedGir[];
}
type GeneratorConstructor<T> = {
new (namespace: IntrospectedNamespace, options: OptionsGeneration, ...args: any[]): FormatGenerator<T>;
};
export declare class NSRegistry {
mapping: TwoKeyMap<string, string, IntrospectedNamespace>;
private formatters;
private generators;
c_mapping: Map<string, {
version: string;
name: string;
}[]>;
transformations: GirVisitor[];
subtypes: TwoKeyMap<string, string, TwoKeyMap<string, string, boolean>>;
constructor();
registerTransformation(visitor: GirVisitor): void;
registerFormatter(output: string, formatter: Formatter): void;
getFormatter(output: string): Formatter;
registerGenerator<T>(output: string, generator: {
new (namespace: IntrospectedNamespace, options: OptionsGeneration): FormatGenerator<T>;
}): void;
getGenerator(output: "json"): Promise<{
new (namespace: IntrospectedNamespace, options: OptionsGeneration): JsonGenerator;
}>;
getGenerator(output: "dts"): Promise<{
new (namespace: IntrospectedNamespace, options: OptionsGeneration): DtsGenerator;
}>;
getGenerator<T>(output: string): Promise<GeneratorConstructor<T> | undefined>;
private _transformNamespace;
namespace(name: string, version: string): IntrospectedNamespace | null;
namespacesForPrefix(c_prefix: string): IntrospectedNamespace[];
transform(options: OptionsTransform): void;
defaultVersionOf(name: string): string | null;
assertDefaultVersionOf(name: string): string;
assertNamespace(name: string, version: string): IntrospectedNamespace;
register(namespace: GirModule): IntrospectedNamespace;
}
export {};