import { KmpJsonFile } from '@keymanapp/common-types'; import { CompilerCallbacks, KpsFile, KeymanCompiler, CompilerOptions, KeymanCompilerResult, KeymanCompilerArtifacts, KeymanCompilerArtifact } from '@keymanapp/developer-utils'; /** * @public * Options for the .kps compiler */ export interface KmpCompilerOptions extends CompilerOptions { } /** * @public * Internal in-memory build artifacts from a successful compilation */ export interface KmpCompilerArtifacts extends KeymanCompilerArtifacts { /** * Binary keyboard package filedata and filename - installable into Keyman * desktop and mobile projects */ kmp: KeymanCompilerArtifact; } /** * @public * Build artifacts from the .kps compiler */ export interface KmpCompilerResult extends KeymanCompilerResult { /** * Internal in-memory build artifacts from a successful compilation. Caller * can write these to disk with {@link KmpCompiler.write} */ artifacts: KmpCompilerArtifacts; } /** * @public * Compiles a .kps file to a .kmp archive. The compiler does not read or write * from filesystem or network directly, but relies on callbacks for all external * IO. */ export declare class KmpCompiler implements KeymanCompiler { private callbacks; private options; /** * Initialize the compiler. * Copies options. * @param callbacks - Callbacks for external interfaces, including message * reporting and file io * @param options - Compiler options * @returns false if initialization fails */ init(callbacks: CompilerCallbacks, options: KmpCompilerOptions): Promise; /** * Compiles a .kps file to .kmp file. Returns an object containing binary * artifacts on success. The files are passed in by name, and the compiler * will use callbacks as passed to the {@link KmpCompiler.init} function * to read any input files by disk. * @param infile - Path to source file. Path will be parsed to find relative * references in the .kmn file, such as icon or On Screen * Keyboard file * @param outfile - Path to output file. The file will not be written to, but * will be included in the result for use by * {@link KmpCompiler.write}. * @returns Binary artifacts on success, null on failure. */ run(inputFilename: string, outputFilename?: string): Promise; /** * Write artifacts from a successful compile to disk, via callbacks methods. * The artifacts written may include: * * - .kmp file - binary keyboard package used by Keyman on desktop and touch * platforms * * @param artifacts - object containing artifact binary data to write out * @returns true on success */ write(artifacts: KmpCompilerArtifacts): Promise; /** * @internal */ transformKpsToKmpObject(kpsFilename: string): KmpJsonFile.KmpJsonFile; readonly normalizePath: (path: string) => string; /** * @internal */ transformKpsFileToKmpObject(kpsFilename: string, kps: KpsFile.KpsFile): KmpJsonFile.KmpJsonFile; private kpsInfoToKmpInfo; private kpsLanguagesToKmpLanguages; private stripUndefined; /** * @internal * Returns a Promise to the serialized data which can then be written to a .kmp file. * * @param kpsFilename - Filename of the kps, not read, used only for calculating relative paths * @param kmpJsonData - The kmp.json Object */ buildKmpFile(kpsFilename: string, kmpJsonData: KmpJsonFile.KmpJsonFile): Promise; private buildKmpInf; private getMemberFileData; private setKvkFontData; /** * Legacy .kmp compiler would transform xml-format .kvk files into a binary .kvk file; now * we want that to remain the responsibility of the keyboard compiler. */ private isKvkFileBinary; } //# sourceMappingURL=kmp-compiler.d.ts.map