import { KMXPlus, LdmlKeyboardTypes } from '@keymanapp/common-types'; import { CompilerCallbacks, KeymanCompiler, KeymanCompilerResult, KeymanCompilerArtifacts, LDMLKeyboard, LDMLKeyboardTestDataXMLSourceFile, KeymanCompilerArtifactOptional } from "@keymanapp/developer-utils"; import { LdmlCompilerOptions } from './ldml-compiler-options.js'; import { BkspCompiler, TranCompiler } from './tran.js'; import { DispCompiler } from './disp.js'; import { KeysCompiler } from './keys.js'; import { LayrCompiler } from './layr.js'; import { LocaCompiler } from './loca.js'; import { MetaCompiler } from './meta.js'; import { VarsCompiler } from './vars.js'; import { StrsCompiler } from './empty-compiler.js'; import LDMLKeyboardXMLSourceFile = LDMLKeyboard.LDMLKeyboardXMLSourceFile; export declare const SECTION_COMPILERS: (typeof TranCompiler | typeof BkspCompiler | typeof DispCompiler | typeof KeysCompiler | typeof LayrCompiler | typeof LocaCompiler | typeof MetaCompiler | typeof VarsCompiler | typeof StrsCompiler)[]; /** * @public * Internal in-memory build artifacts from a successful compilation */ export interface LdmlKeyboardCompilerArtifacts extends KeymanCompilerArtifacts { /** * Binary keyboard filedata and filename - installable into Keyman desktop * projects */ kmx?: KeymanCompilerArtifactOptional; /** * Binary on screen keyboard filedata and filename - installable into Keyman * desktop projects alongside .kmx */ kvk?: KeymanCompilerArtifactOptional; } export interface LdmlKeyboardCompilerResult extends KeymanCompilerResult { /** * Internal in-memory build artifacts from a successful compilation. Caller * can write these to disk with {@link LdmlKeyboardCompiler.write} */ artifacts: LdmlKeyboardCompilerArtifacts; } /** * @public * Compiles a LDML keyboard .xml file to a .kmx (KMXPlus), .kvk. The * compiler does not read or write from filesystem or network directly, but * relies on callbacks for all external IO. */ export declare class LdmlKeyboardCompiler implements KeymanCompiler { private callbacks; private options; private usetparser?; /** * Initialize the compiler, including loading the WASM host for uset parsing. * 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: LdmlCompilerOptions): Promise; /** * Compiles a LDML keyboard .xml file to .kmx, .kvk files. 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 LdmlKeyboardCompiler.init} function to read any input files by disk. * @param infile - Path to source 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 LdmlKeyboardCompiler.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: * * - .kmx file - binary keyboard used by Keyman on desktop platforms * - .kvk file - binary on screen keyboard used by Keyman on desktop platforms * * @param artifacts - object containing artifact binary data to write out * @returns true on success */ write(artifacts: LdmlKeyboardCompilerArtifacts): Promise; /** * @internal * Construct or return a UnicodeSetParser, aka KmnCompiler * @returns the held UnicodeSetParser */ getUsetParser(): Promise; private buildSections; /** * @internal * Loads a LDML Keyboard xml file and compiles into in-memory xml * structures. * @param filename - input filename, will use callback to load from disk * @returns the source file, or null if invalid */ load(filename: string): LDMLKeyboardXMLSourceFile | null; /** * @internal * Loads a LDML Keyboard test data xml file and compiles into in-memory xml * structures. * @param filename - input filename, will use callback to load from disk * @returns the source file, or null if invalid */ loadTestData(filename: string): LDMLKeyboardTestDataXMLSourceFile | null; /** Materialize the linters against the built datafile */ private buildLinters; /** * Runs any linter steps, adding hints to the callbacks as needed * @internal * @returns true unless there was a linter failure. */ private lint; /** * @internal * Validates that the LDML keyboard source file and lints. * @param source - in-memory representation of LDML keyboard xml file * @returns true if the file validates */ validate(source: LDMLKeyboardXMLSourceFile): Promise; /** * @internal * Transforms in-memory LDML keyboard xml file to an intermediate * representation of a .kmx file. * @param source - in-memory representation of LDML keyboard xml file * @param postValidate - pass true if sections should run a 'validate' phase at the very end. * Set this to true if you aren't calling validate() separately. * @returns KMXPlusFile intermediate file */ compile(source: LDMLKeyboardXMLSourceFile, postValidate?: boolean): Promise; } //# sourceMappingURL=compiler.d.ts.map