mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 00:15:32 +00:00
fix(developer): updates kmc, web/types module resolution, adds missing type import/exports
This commit is contained in:
parent
0da7ac24be
commit
2439ba4e97
18 changed files with 57 additions and 49 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import Ajv from "ajv";
|
||||
import { default as AjvModule } from 'ajv';
|
||||
const Ajv = AjvModule.default; // The actual expected Ajv type.
|
||||
import { TouchLayoutFile } from "./keyman-touch-layout-file.js";
|
||||
|
||||
export class TouchLayoutFileReader {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import * as xml2js from 'xml2js';
|
||||
import { KPJFile, KPJFileProject } from './kpj-file.js';
|
||||
import Ajv from 'ajv';
|
||||
import { default as AjvModule } from 'ajv';
|
||||
const Ajv = AjvModule.default; // The actual expected Ajv type.
|
||||
import { boxXmlArray } from '../util/util.js';
|
||||
import { KeymanDeveloperProject, KeymanDeveloperProjectFile10, KeymanDeveloperProjectType } from './keyman-developer-project.js';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import * as xml2js from 'xml2js';
|
||||
import KVKSourceFile from './kvks-file.js';
|
||||
import Ajv from 'ajv';
|
||||
import { default as AjvModule } from 'ajv';
|
||||
const Ajv = AjvModule.default; // The actual expected Ajv type.
|
||||
import { boxXmlArray } from '../util/util.js';
|
||||
import { VisualKeyboard, VisualKeyboardHeaderFlags, VisualKeyboardKey, VisualKeyboardKeyFlags, VisualKeyboardLegalShiftStates, VisualKeyboardShiftState } from './visual-keyboard.js';
|
||||
import { USVirtualKeyCodes } from '../consts/virtual-key-constants.js';
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@
|
|||
// Corresponds to .kvk / .kvks file data
|
||||
//
|
||||
|
||||
import { BUILDER_KVK_SHIFT_STATE, BUILDER_KVK_HEADER_FLAGS, BUILDER_KVK_KEY_FLAGS } from "./kvk-file";
|
||||
import { BUILDER_KVK_SHIFT_STATE, BUILDER_KVK_HEADER_FLAGS, BUILDER_KVK_KEY_FLAGS } from "./kvk-file.js";
|
||||
|
||||
export class VisualKeyboard {
|
||||
header: VisualKeyboardHeader = {flags: 0, ansiFont:{}, unicodeFont:{}, underlyingLayout: undefined};
|
||||
keys: VisualKeyboardKey[] = [];
|
||||
};
|
||||
|
||||
export { BUILDER_KVK_HEADER_FLAGS as VisualKeyboardHeaderFlags } from "./kvk-file";
|
||||
export { BUILDER_KVK_HEADER_FLAGS as VisualKeyboardHeaderFlags } from "./kvk-file.js";
|
||||
|
||||
export class VisualKeyboardHeader {
|
||||
version?: number; // 0x0600
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import * as xml2js from 'xml2js';
|
||||
import { LDMLKeyboardXMLSourceFile, LKImport } from './ldml-keyboard-xml.js';
|
||||
import Ajv from 'ajv';
|
||||
import { default as AjvModule } from 'ajv';
|
||||
const Ajv = AjvModule.default; // The actual expected Ajv type.
|
||||
import { boxXmlArray } from '../util/util.js';
|
||||
import { CompilerCallbacks } from '../util/compiler-interfaces.js';
|
||||
import { constants } from '@keymanapp/ldml-keyboard-constants';
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export { default as KvksFileReader } from './kvk/kvks-file-reader.js';
|
|||
export { default as KvkFileWriter } from './kvk/kvk-file-writer.js';
|
||||
|
||||
export * as LDMLKeyboard from './ldml-keyboard/ldml-keyboard-xml.js';
|
||||
export { LDMLKeyboardTestDataXMLSourceFile } from './ldml-keyboard/ldml-keyboard-testdata-xml';
|
||||
export { LDMLKeyboardTestDataXMLSourceFile } from './ldml-keyboard/ldml-keyboard-testdata-xml.js';
|
||||
export { default as LDMLKeyboardXMLSourceFileReader } from './ldml-keyboard/ldml-keyboard-xml-reader.js';
|
||||
|
||||
export * as Constants from './consts/virtual-key-constants.js';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { LKKey } from './../../src/ldml-keyboard/ldml-keyboard-xml';
|
||||
import { LKKey } from './../../src/ldml-keyboard/ldml-keyboard-xml.js';
|
||||
import 'mocha';
|
||||
import {assert} from 'chai';
|
||||
import { CommonTypesMessages } from '../../src/util/common-events.js';
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@
|
|||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import { minKeymanVersion } from "./min-keyman-version.js";
|
||||
// import KmpJsonFile from "@keymanapp/kmc-package/kmp-json-file";
|
||||
import { ModelInfoFile } from "./model-info-file.js";
|
||||
import { type KmpJsonFile } from "@keymanapp/kmc-package";
|
||||
|
||||
export class ModelInfoOptions {
|
||||
/** The identifier for the model */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
interface ModelInfoFile {
|
||||
export interface ModelInfoFile {
|
||||
id?: string;
|
||||
name?: string;
|
||||
authorName?: string;
|
||||
|
|
@ -21,12 +21,12 @@ interface ModelInfoFile {
|
|||
related?: ModelInfoFileRelated[];
|
||||
}
|
||||
|
||||
interface ModelInfoFileLink {
|
||||
export interface ModelInfoFileLink {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
interface ModelInfoFileRelated {
|
||||
export interface ModelInfoFileRelated {
|
||||
deprecates?: string;
|
||||
deprecatedBy?: string;
|
||||
note?: string;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { OverrideScriptDefaults } from "./lexical-model";
|
||||
import { OverrideScriptDefaults } from "./lexical-model.js";
|
||||
|
||||
export function decorateWithScriptOverrides(breaker: WordBreakingFunction, option: OverrideScriptDefaults) {
|
||||
if (option !== 'break-words-at-spaces') {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
/// <reference path="kps-file.ts" />
|
||||
/// <reference path="kmp-json-file.ts" />
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as xml2js from 'xml2js';
|
||||
import JSZip from 'jszip';
|
||||
import KEYMAN_VERSION from "@keymanapp/keyman-version";
|
||||
|
||||
import type { KpsFile, KpsFileContentFile, KpsFileInfo, KpsFileKeyboard, KpsFileLanguage, KpsFileLexicalModel, KpsFileOptions, KpsPackage } from './kps-file.js';
|
||||
import type { KmpJsonFile, KmpJsonFileInfo, KmpJsonFileLanguage, KmpJsonFileOptions } from './kmp-json-file.js';
|
||||
|
||||
export { type KmpJsonFile } from './kmp-json-file.js';
|
||||
|
||||
const FILEVERSION_KMP_JSON = '12.0';
|
||||
|
||||
export default class KmpCompiler {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
interface KmpJsonFile {
|
||||
export interface KmpJsonFile {
|
||||
system: KmpJsonFileSystem;
|
||||
options: KmpJsonFileOptions;
|
||||
info?: KmpJsonFileInfo;
|
||||
|
|
@ -9,12 +9,12 @@ interface KmpJsonFile {
|
|||
strings?: string[];
|
||||
}
|
||||
|
||||
interface KmpJsonFileSystem {
|
||||
export interface KmpJsonFileSystem {
|
||||
keymanDeveloperVersion: string;
|
||||
fileVersion: string;
|
||||
}
|
||||
|
||||
interface KmpJsonFileOptions {
|
||||
export interface KmpJsonFileOptions {
|
||||
readmeFile?: string;
|
||||
graphicFile?: string;
|
||||
executeProgram?: string;
|
||||
|
|
@ -22,7 +22,7 @@ interface KmpJsonFileOptions {
|
|||
msiOptions?: string;
|
||||
}
|
||||
|
||||
interface KmpJsonFileInfo {
|
||||
export interface KmpJsonFileInfo {
|
||||
website?: KmpJsonFileInfoItem;
|
||||
version?: KmpJsonFileInfoItem;
|
||||
name?: KmpJsonFileInfoItem;
|
||||
|
|
@ -30,29 +30,29 @@ interface KmpJsonFileInfo {
|
|||
author?: KmpJsonFileInfoItem;
|
||||
}
|
||||
|
||||
interface KmpJsonFileInfoItem {
|
||||
export interface KmpJsonFileInfoItem {
|
||||
description: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
interface KmpJsonFileContentFile {
|
||||
export interface KmpJsonFileContentFile {
|
||||
name: string;
|
||||
description: string;
|
||||
copyLocation?: number;
|
||||
}
|
||||
|
||||
interface KmpJsonFileLexicalModel {
|
||||
export interface KmpJsonFileLexicalModel {
|
||||
name: string;
|
||||
id: string;
|
||||
languages: KmpJsonFileLanguage[];
|
||||
}
|
||||
|
||||
interface KmpJsonFileLanguage {
|
||||
export interface KmpJsonFileLanguage {
|
||||
name: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
interface KmpJsonFileKeyboard {
|
||||
export interface KmpJsonFileKeyboard {
|
||||
name: string;
|
||||
id: string;
|
||||
version: string;
|
||||
|
|
@ -62,13 +62,13 @@ interface KmpJsonFileKeyboard {
|
|||
languages?: KmpJsonFileLanguage[];
|
||||
}
|
||||
|
||||
interface KmpJsonFileStartMenu {
|
||||
export interface KmpJsonFileStartMenu {
|
||||
folder?: string;
|
||||
addUninstallEntry?: boolean;
|
||||
items?: KmpJsonFileStartMenuItem[];
|
||||
}
|
||||
|
||||
interface KmpJsonFileStartMenuItem {
|
||||
export interface KmpJsonFileStartMenuItem {
|
||||
name: string;
|
||||
filename: string;
|
||||
arguments?: string;
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@
|
|||
// * Strings element is not yet checked to be correct
|
||||
//
|
||||
|
||||
interface KpsPackage {
|
||||
export interface KpsPackage {
|
||||
/**
|
||||
* <Package> -- the root element.
|
||||
*/
|
||||
package: KpsFile;
|
||||
}
|
||||
|
||||
interface KpsFile {
|
||||
export interface KpsFile {
|
||||
system: KpsFileSystem;
|
||||
options: KpsFileOptions;
|
||||
info?: KpsFileInfo;
|
||||
|
|
@ -31,12 +31,12 @@ interface KpsFile {
|
|||
strings?: KpsFileStrings;
|
||||
}
|
||||
|
||||
interface KpsFileSystem {
|
||||
export interface KpsFileSystem {
|
||||
keymanDeveloperVersion: string;
|
||||
fileVersion: string;
|
||||
}
|
||||
|
||||
interface KpsFileOptions {
|
||||
export interface KpsFileOptions {
|
||||
followKeyboardVersion?: string;
|
||||
readMeFile?: string;
|
||||
graphicFile?: string;
|
||||
|
|
@ -45,7 +45,7 @@ interface KpsFileOptions {
|
|||
msiOptions?: string;
|
||||
}
|
||||
|
||||
interface KpsFileInfo {
|
||||
export interface KpsFileInfo {
|
||||
name?: KpsFileInfoItem;
|
||||
copyright?: KpsFileInfoItem;
|
||||
author?: KpsFileInfoItem;
|
||||
|
|
@ -53,42 +53,42 @@ interface KpsFileInfo {
|
|||
version?: KpsFileInfoItem;
|
||||
}
|
||||
|
||||
interface KpsFileInfoItem {
|
||||
export interface KpsFileInfoItem {
|
||||
_: string;
|
||||
$: { URL: string };
|
||||
}
|
||||
|
||||
interface KpsFileContentFiles {
|
||||
export interface KpsFileContentFiles {
|
||||
file: KpsFileContentFile[] | KpsFileContentFile;
|
||||
}
|
||||
|
||||
interface KpsFileContentFile {
|
||||
export interface KpsFileContentFile {
|
||||
name: string;
|
||||
description: string;
|
||||
copyLocation: string;
|
||||
fileType: string;
|
||||
}
|
||||
|
||||
interface KpsFileLexicalModel {
|
||||
export interface KpsFileLexicalModel {
|
||||
name: string;
|
||||
iD: string;
|
||||
languages: KpsFileLanguages;
|
||||
}
|
||||
|
||||
interface KpsFileLexicalModels {
|
||||
export interface KpsFileLexicalModels {
|
||||
lexicalModel: KpsFileLexicalModel[] | KpsFileLexicalModel;
|
||||
}
|
||||
|
||||
interface KpsFileLanguages {
|
||||
export interface KpsFileLanguages {
|
||||
language: KpsFileLanguage[] | KpsFileLanguage;
|
||||
}
|
||||
|
||||
interface KpsFileLanguage {
|
||||
export interface KpsFileLanguage {
|
||||
_: string;
|
||||
$: { ID: string }
|
||||
}
|
||||
|
||||
interface KpsFileKeyboard {
|
||||
export interface KpsFileKeyboard {
|
||||
name: string;
|
||||
iD: string;
|
||||
version: string;
|
||||
|
|
@ -98,17 +98,17 @@ interface KpsFileKeyboard {
|
|||
languages?: KpsFileLanguages;
|
||||
}
|
||||
|
||||
interface KpsFileKeyboards {
|
||||
export interface KpsFileKeyboards {
|
||||
keyboard: KpsFileKeyboard[] | KpsFileKeyboard;
|
||||
}
|
||||
|
||||
interface KpsFileStartMenu {
|
||||
export interface KpsFileStartMenu {
|
||||
folder?: string;
|
||||
addUninstallEntry?: string;
|
||||
items?: KpsFileStartMenuItems;
|
||||
}
|
||||
|
||||
interface KpsFileStartMenuItem {
|
||||
export interface KpsFileStartMenuItem {
|
||||
name: string;
|
||||
filename: string;
|
||||
arguments?: string;
|
||||
|
|
@ -116,11 +116,11 @@ interface KpsFileStartMenuItem {
|
|||
location?: string;
|
||||
}
|
||||
|
||||
interface KpsFileStartMenuItems {
|
||||
export interface KpsFileStartMenuItems {
|
||||
item: KpsFileStartMenuItem[] | KpsFileStartMenuItem;
|
||||
}
|
||||
|
||||
interface KpsFileStrings {
|
||||
export interface KpsFileStrings {
|
||||
//TODO: validate this structure
|
||||
string: string[] | string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import KmpCompiler from '../src/kmp-compiler.js';
|
|||
import {makePathToFixture} from './helpers/index.js';
|
||||
import JSZip from 'jszip';
|
||||
import KEYMAN_VERSION from "@keymanapp/keyman-version";
|
||||
import { type KmpJsonFile } from '../src/kmp-json-file.js';
|
||||
|
||||
describe('KmpCompiler', function () {
|
||||
const MODELS : string[] = [
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
import * as fs from 'fs';
|
||||
import { Command } from 'commander';
|
||||
import { compileModel } from '@keymanapp/kmc-model';
|
||||
import { SysExits } from './util/sysexits';
|
||||
import { SysExits } from './util/sysexits.js';
|
||||
import KEYMAN_VERSION from "@keymanapp/keyman-version";
|
||||
|
||||
let inputFilename: string;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import * as path from 'path';
|
|||
import { Command } from 'commander';
|
||||
import KmpCompiler from '@keymanapp/kmc-package';
|
||||
import { ModelInfoOptions as ModelInfoOptions, writeMergedModelMetadataFile } from '@keymanapp/kmc-model-info';
|
||||
import { SysExits } from './util/sysexits';
|
||||
import { SysExits } from './util/sysexits.js';
|
||||
import KEYMAN_VERSION from "@keymanapp/keyman-version";
|
||||
|
||||
let inputFilename: string;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
import * as fs from 'fs';
|
||||
import { Command } from 'commander';
|
||||
import KmpCompiler from '@keymanapp/kmc-package';
|
||||
import { SysExits } from './util/sysexits';
|
||||
import { SysExits } from './util/sysexits.js';
|
||||
import KEYMAN_VERSION from "@keymanapp/keyman-version";
|
||||
|
||||
let inputFilename: string;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"compilerOptions": {
|
||||
"module": "ES2022",
|
||||
"target": "es2022",
|
||||
"moduleResolution": "Node",
|
||||
"moduleResolution": "Node16",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"sourceMap": true,
|
||||
"alwaysStrict": true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue