wuchale
Version:
Protobuf-like i18n from normal code
61 lines • 2.32 kB
TypeScript
import { IndexTracker } from "./adapters.js";
import type { Adapter, GlobConf, Catalog } from "./adapters.js";
import { type CompiledElement } from "./compile.js";
import { type Matcher } from 'picomatch';
import PO from "pofile";
import { type ConfigPartial } from "./config.js";
import { type Logger } from './log.js';
export declare function loadPOFile(filename: string): Promise<PO>;
export type Mode = 'dev' | 'prod' | 'extract';
type Compiled = {
hasPlurals: boolean;
items: CompiledElement[];
};
type CompiledCatalog = Record<string, Compiled>;
type GranularState = {
id: string;
compiled: CompiledCatalog;
indexTracker: IndexTracker;
};
export declare class AdapterHandler {
#private;
key: string;
loaderPath: string;
proxyPath: string;
outDir: string;
compiledHead: Record<string, string>;
fileMatches: Matcher;
catalogs: Record<string, Catalog>;
compiled: CompiledCatalog;
granularStateByFile: Record<string, GranularState>;
granularStateByID: Record<string, GranularState>;
catalogPathsToLocales: Record<string, string>;
constructor(adapter: Adapter, key: string | number, config: ConfigPartial, mode: Mode, virtualPrefix: string, projectRoot: string, log: Logger);
getLoaderPaths(): string[];
getLoaderPath(): Promise<{
path: string | null;
empty: boolean;
}>;
/** Get both catalog virtual module names AND HMR event names */
virtModEvent: (locale: string, loadID: string | null) => string;
getProxy(proxyFilePath?: string): string;
getProxySync(proxyFilePath?: string): string;
catalogFileName: (locale: string) => string;
init: () => Promise<void>;
loadCatalogNCompile: (loc: string) => Promise<void>;
loadDataModule: (locale: string, loadID: string) => string;
compile: (loc: string) => Promise<void>;
writeCompiled: (loc: string) => Promise<void>;
writeProxy: () => Promise<void>;
writeTransformed: (filename: string, content: string) => Promise<void>;
globConfToArgs: (conf: GlobConf) => [string[], {
ignore: string[];
}];
savePoAndCompile: (loc: string) => Promise<void>;
transform: (content: string, filename: string) => Promise<{
code?: string;
map?: any;
}>;
}
export {};
//# sourceMappingURL=handler.d.ts.map