@keymanapp/common-types
Version:
Keyman Developer keyboard file types
103 lines • 3.89 kB
TypeScript
/**
* Registered source file types for Keyman. Some of these file types (e.g. .xml)
* may have multiple uses outside Keyman.
*/
export declare const enum Source {
Model = ".model.ts",
Project = ".kpj",
KeymanKeyboard = ".kmn",
LdmlKeyboard = ".xml",// Warning, also other possible uses
Package = ".kps",
VisualKeyboard = ".kvks",
TouchLayout = ".keyman-touch-layout"
}
/**
* List of all registered source file types for Keyman. Some of these file types
* (e.g. .xml) may have multiple uses outside Keyman.
*/
export declare const ALL_SOURCE: ReadonlyArray<Source>;
/**
* Registered binary file types for Keyman. Some of these file types (e.g. .js)
* may have multiple uses outside Keyman.
*/
export declare const enum Binary {
Model = ".model.js",
WebKeyboard = ".js",// Warning, also other possible uses
Keyboard = ".kmx",
Package = ".kmp",
VisualKeyboard = ".kvk",
KeyboardInfo = ".keyboard_info",
ModelInfo = ".model_info"
}
/**
* List of all registered binary file types for Keyman. Some of these file types
* (e.g. .js) may have multiple uses outside Keyman.
*/
export declare const ALL_BINARY: ReadonlyArray<Binary>;
export declare const ALL: readonly (Source | Binary)[];
export type All = Source | Binary;
/**
* Alias for '.*', any file extension, not just Keyman ones.
*/
export type Any = string;
/**
* Standard project file name - history of project in Markdown format
*/
export declare const HISTORY_MD = "HISTORY.md";
/**
* Standard project file name - README in Markdown format
*/
export declare const README_MD = "README.md";
/**
* Standard project file name - LICENSE in Markdown format
*/
export declare const LICENSE_MD = "LICENSE.md";
/**
* Gets the file type based on extension, dealing with multi-part file
* extensions. Does not sniff contents of file or assume file existence. Does
* transform upper-cased file extensions to lower-case.
* @param filename
* @returns file extension, or `""` if no extension. Note that this return value
* differs from the other, more-specific fromFilename functions below,
* which return `null` if a supported extension is not found.
*/
export declare function fromFilename(filename: string): Binary | Source | Any;
/**
* Removes the file extension, include known .model.* patterns, from a filename
* @param filename
* @returns
*/
export declare function removeExtension(filename: string): string;
/**
* Gets the file type based on extension, dealing with multi-part file
* extensions. Does not sniff contents of file or assume file existence.
* Does transform upper-cased file extensions to lower-case.
* @param filename
* @returns file type, or `null` if not found
*/
export declare function sourceOrBinaryTypeFromFilename(filename: string): Binary | Source;
/**
* Gets the source file type based on extension, dealing with multi-part file
* extensions. Does not sniff contents of file or assume file existence. Does
* transform upper-cased file extensions to lower-case.
* @param filename
* @returns file type, or `null` if not found
*/
export declare function sourceTypeFromFilename(filename: string): Source;
/**
* Gets the binary file type based on extension, dealing with multi-part file
* extensions. Does not sniff contents of file or assume file existence. Does
* transform upper-cased file extensions to lower-case.
* @param filename
* @returns file type, or `null` if not found
*/
export declare function binaryTypeFromFilename(filename: string): Binary;
/**
* Returns true if filenmae has a specific file extension. Does transform
* upper-cased file extensions to lower-case.
* @param filename
* @param fileType
* @returns true if file is of type fileType
*/
export declare function filenameIs(filename: string, fileType: Source | Binary): boolean;
//# sourceMappingURL=file-types.d.ts.map