refactor(common): move compiler-interfaces to @keymanapp/developer-utils

This should be the last step in the refactoring.

Fixes: #9665
This commit is contained in:
Marc Durdin 2024-08-02 13:49:59 +07:00
parent cebd4138e6
commit e67aed1606
84 changed files with 194 additions and 175 deletions

View file

@ -9,25 +9,6 @@ export * as KvkFile from './kvk/kvk-file.js';
export * as Constants from './consts/virtual-key-constants.js';
export { defaultCompilerOptions, CompilerBaseOptions, CompilerCallbacks, CompilerOptions, CompilerEvent, CompilerErrorNamespace,
CompilerErrorSeverity, CompilerPathCallbacks, CompilerFileSystemCallbacks, CompilerCallbackOptions,
CompilerError, CompilerMessageSpec, CompilerMessageSpecWithException, compilerErrorSeverity, CompilerErrorMask, CompilerFileCallbacks, compilerErrorSeverityName,
compilerErrorFormatCode, CompilerMessageDef,
compilerLogLevelToSeverity, CompilerLogLevel, compilerEventFormat, ALL_COMPILER_LOG_LEVELS,
ALL_COMPILER_LOG_FORMATS, CompilerLogFormat,
CompilerMessageOverride,
CompilerMessageOverrideMap,
KeymanCompilerArtifact,
KeymanCompilerArtifactOptional,
KeymanCompilerArtifacts,
KeymanCompilerResult,
KeymanCompiler
} from './util/compiler-interfaces.js';
export { CommonTypesMessages } from './util/common-events.js';
export * as TouchLayout from './keyman-touch-layout/keyman-touch-layout-file.js';
export * as KmpJsonFile from './package/kmp-json-file.js';

View file

@ -1,5 +1,4 @@
import * as path from "path";
import * as fs from "fs";
import { fileURLToPath } from "url";
/**
@ -12,26 +11,3 @@ import { fileURLToPath } from "url";
export function makePathToFixture(...components: string[]): string {
return fileURLToPath(new URL(path.join('..', '..', '..', 'test', 'fixtures', ...components), import.meta.url));
}
export function loadFile(filename: string | URL): Buffer {
return fs.readFileSync(filename);
}
export function resolveFilename(baseFilename: string, filename: string) {
const basePath =
baseFilename.endsWith('/') || baseFilename.endsWith('\\') ?
baseFilename :
path.dirname(baseFilename);
// Transform separators to platform separators -- we are agnostic
// in our use here but path prefers files may use
// either / or \, although older kps files were always \.
if(path.sep == '/') {
filename = filename.replace(/\\/g, '/');
} else {
filename = filename.replace(/\//g, '\\');
}
if(!path.isAbsolute(filename)) {
filename = path.resolve(basePath, filename);
}
return filename;
}

View file

@ -8,7 +8,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
builder_describe "Keyman Developer unit test helpers" \
"@/common/web/types" \
"@/developer/src/common/web/utils" \
clean configure build test
builder_describe_outputs \

View file

@ -1,6 +1,6 @@
import * as fs from 'fs';
import * as path from 'path';
import { CompilerEvent, CompilerCallbacks, CompilerPathCallbacks, CompilerFileSystemCallbacks, CompilerError } from '@keymanapp/common-types';
import { CompilerEvent, CompilerCallbacks, CompilerPathCallbacks, CompilerFileSystemCallbacks, CompilerError } from '@keymanapp/developer-utils';
export { verifyCompilerMessagesObject } from './verifyCompilerMessagesObject.js';
/**

View file

@ -17,6 +17,6 @@
},
"license": "MIT",
"dependencies": {
"@keymanapp/common-types": "*"
"@keymanapp/developer-utils": "*"
}
}

View file

@ -1,4 +1,4 @@
import { CompilerError, CompilerErrorMask } from '@keymanapp/common-types';
import { CompilerError, CompilerErrorMask } from '@keymanapp/developer-utils';
import {assert, expect} from 'chai';
//

View file

@ -53,7 +53,7 @@ builder_run_action build do_build
if builder_start_action test; then
eslint .
tsc --build test
readonly C8_THRESHOLD=70
readonly C8_THRESHOLD=45
c8 --reporter=lcov --reporter=text --exclude-after-remap --lines $C8_THRESHOLD --statements $C8_THRESHOLD --branches $C8_THRESHOLD --functions $C8_THRESHOLD mocha
builder_echo warning "Coverage thresholds are currently $C8_THRESHOLD%, which is lower than ideal."
builder_echo warning "Please increase threshold in build.sh as test coverage improves."

View file

@ -181,7 +181,7 @@ export class CompilerError {
*/
static severityNameToValue(name: string): CompilerErrorSeverity {
name = name.toLowerCase();
for(let level of CompilerErrorSeverityValues) {
for(const level of CompilerErrorSeverityValues) {
if(errorSeverityName[level].startsWith(name)) {
return level;
}

View file

@ -24,3 +24,22 @@ export { default as KMXPlusBuilder} from './types/kmx/kmx-plus-builder/kmx-plus
export * as LDMLKeyboard from './types/ldml-keyboard/ldml-keyboard-xml.js';
export { LDMLKeyboardTestDataXMLSourceFile } from './types/ldml-keyboard/ldml-keyboard-testdata-xml.js';
export { LDMLKeyboardXMLSourceFileReader, LDMLKeyboardXMLSourceFileReaderOptions } from './types/ldml-keyboard/ldml-keyboard-xml-reader.js';
export { defaultCompilerOptions, CompilerBaseOptions, CompilerCallbacks, CompilerOptions, CompilerEvent, CompilerErrorNamespace,
CompilerErrorSeverity, CompilerPathCallbacks, CompilerFileSystemCallbacks, CompilerCallbackOptions,
CompilerError, CompilerMessageSpec, CompilerMessageSpecWithException, compilerErrorSeverity, CompilerErrorMask, CompilerFileCallbacks, compilerErrorSeverityName,
compilerErrorFormatCode, CompilerMessageDef,
compilerLogLevelToSeverity, CompilerLogLevel, compilerEventFormat, ALL_COMPILER_LOG_LEVELS,
ALL_COMPILER_LOG_FORMATS, CompilerLogFormat,
CompilerMessageOverride,
CompilerMessageOverrideMap,
KeymanCompilerArtifact,
KeymanCompilerArtifactOptional,
KeymanCompilerArtifacts,
KeymanCompilerResult,
KeymanCompiler
} from './compiler-interfaces.js';
export { CommonTypesMessages } from './common-events.js';

View file

@ -2,7 +2,8 @@
// Version 1.0 and 2.0 of Keyman Developer Project .kpj file
//
import { CompilerCallbacks, KeymanFileTypes } from '@keymanapp/common-types';
import { KeymanFileTypes } from '@keymanapp/common-types';
import { CompilerCallbacks } from '../../compiler-interfaces.js';
export class KeymanDeveloperProject {
options: KeymanDeveloperProjectOptions;

View file

@ -2,7 +2,8 @@ import { xml2js } from '@keymanapp/common-types';
import { KPJFile, KPJFileProject } from './kpj-file.js';
import { util } from '@keymanapp/common-types';
import { KeymanDeveloperProject, KeymanDeveloperProjectFile10, KeymanDeveloperProjectType } from './keyman-developer-project.js';
import { CompilerCallbacks, SchemaValidators } from '@keymanapp/common-types';
import { SchemaValidators } from '@keymanapp/common-types';
import { CompilerCallbacks } from '../../compiler-interfaces.js';
export class KPJFileReader {
constructor(private callbacks: CompilerCallbacks) {

View file

@ -1,4 +1,6 @@
import { SchemaValidators, CommonTypesMessages, CompilerCallbacks, util, xml2js } from '@keymanapp/common-types';
import { SchemaValidators, util, xml2js } from '@keymanapp/common-types';
import { CommonTypesMessages } from '../../common-events.js';
import { CompilerCallbacks } from '../../compiler-interfaces.js';
import { LDMLKeyboardXMLSourceFile, LKImport, ImportStatus } from './ldml-keyboard-xml.js';
import { constants } from '@keymanapp/ldml-keyboard-constants';
import { LDMLKeyboardTestDataXMLSourceFile, LKTTest, LKTTests } from './ldml-keyboard-testdata-xml.js';

View file

@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import { loadFile, resolveFilename } from '../helpers/index.js';
import { CompilerCallbacks, CompilerError, CompilerEvent, CompilerFileSystemCallbacks, CompilerPathCallbacks } from '../../src/util/compiler-interfaces.js';
import { loadFile, resolveFilename } from './helpers/index.js';
import { CompilerCallbacks, CompilerError, CompilerEvent, CompilerFileSystemCallbacks, CompilerPathCallbacks } from '../src/compiler-interfaces.js';
// This is related to developer/src/common/web/test-helpers/index.ts but has a slightly different API surface
// as this runs at a lower level than the compiler.
@ -40,7 +40,7 @@ export class TestCompilerCallbacks implements CompilerCallbacks {
return loadFile(filename);
} catch (e) {
if (e.code === 'ENOENT') {
return null;
return <Uint8Array><unknown>null;
} else {
throw e;
}

View file

@ -20,3 +20,22 @@ import { fileURLToPath } from 'url';
export function loadFile(filename: string | URL): Buffer {
return fs.readFileSync(filename);
}
export function resolveFilename(baseFilename: string, filename: string) {
const basePath =
baseFilename.endsWith('/') || baseFilename.endsWith('\\') ?
baseFilename :
path.dirname(baseFilename);
// Transform separators to platform separators -- we are agnostic
// in our use here but path prefers files may use
// either / or \, although older kps files were always \.
if(path.sep == '/') {
filename = filename.replace(/\\/g, '/');
} else {
filename = filename.replace(/\//g, '\\');
}
if(!path.isAbsolute(filename)) {
filename = path.resolve(basePath, filename);
}
return filename;
}

View file

@ -2,7 +2,7 @@ import 'mocha';
import {assert} from 'chai';
import { loadFile, makePathToFixture } from './index.js';
import { LDMLKeyboardXMLSourceFileReader, LDMLKeyboardXMLSourceFileReaderOptions } from '../../src/types/ldml-keyboard/ldml-keyboard-xml-reader.js';
import { CompilerEvent } from '@keymanapp/common-types';
import { CompilerEvent } from '../../src/compiler-interfaces.js';
import { LDMLKeyboardXMLSourceFile } from '../../src/types/ldml-keyboard/ldml-keyboard-xml.js';
import { LDMLKeyboardTestDataXMLSourceFile } from '../../src/types/ldml-keyboard/ldml-keyboard-testdata-xml.js';
import { TestCompilerCallbacks } from '@keymanapp/developer-test-helpers';

View file

@ -1,7 +1,7 @@
import { LKKey, ImportStatus } from '../../src/types/ldml-keyboard/ldml-keyboard-xml.js';
import 'mocha';
import {assert} from 'chai';
import { CommonTypesMessages } from '@keymanapp/common-types';
import { CommonTypesMessages } from '../../src/common-events.js';
import { testReaderCases } from '../helpers/reader-callback-test.js';
import { Constants } from '@keymanapp/common-types';

View file

@ -1,8 +1,7 @@
/// <reference types="@keymanapp/common-types" />
// above is required for now, seemingly https://github.com/microsoft/TypeScript/issues/42873
// probably addressed in ts 5.5.2
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/common-types";
import { KeymanUrls } from "@keymanapp/developer-utils";
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def, CompilerMessageSpecWithException, KeymanUrls } from "@keymanapp/developer-utils";
const Namespace = CompilerErrorNamespace.Analyzer;
const SevInfo = CompilerErrorSeverity.Info | Namespace;

View file

@ -1,6 +1,6 @@
import { CompilerCallbacks, KeymanFileTypes, TouchLayout } from "@keymanapp/common-types";
import { KeymanFileTypes, TouchLayout } from "@keymanapp/common-types";
import { KmnCompilerMessages, Osk } from '@keymanapp/kmc-kmn';
import { escapeMarkdownChar, KvksFile, KvksFileReader, TouchLayoutFileReader } from '@keymanapp/developer-utils';
import { CompilerCallbacks, escapeMarkdownChar, KvksFile, KvksFileReader, TouchLayoutFileReader } from '@keymanapp/developer-utils';
import { getOskFromKmnFile } from "../util/get-osk-from-kmn-file.js";
import { AnalyzerMessages } from "../analyzer-messages.js";

View file

@ -1,5 +1,5 @@
import { CompilerCallbacks, KeymanFileTypes } from "@keymanapp/common-types";
import { KvksFile, KvksFileReader, KvksFileWriter, TouchLayoutFileReader, TouchLayoutFileWriter } from '@keymanapp/developer-utils';
import { KeymanFileTypes } from "@keymanapp/common-types";
import { CompilerCallbacks, KvksFile, KvksFileReader, KvksFileWriter, TouchLayoutFileReader, TouchLayoutFileWriter } from '@keymanapp/developer-utils';
import { KmnCompilerMessages, Osk } from '@keymanapp/kmc-kmn';
import { getOskFromKmnFile } from "../util/get-osk-from-kmn-file.js";
import { AnalyzerMessages } from "../analyzer-messages.js";

View file

@ -1,4 +1,5 @@
import { CompilerCallbacks, KMX, KmxFileReader } from "@keymanapp/common-types";
import { KMX, KmxFileReader } from "@keymanapp/common-types";
import { CompilerCallbacks } from "@keymanapp/developer-utils";
import { KmnCompiler } from "@keymanapp/kmc-kmn";
export async function getOskFromKmnFile(callbacks: CompilerCallbacks, filename: string): Promise<{

View file

@ -1,4 +1,4 @@
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/common-types";
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/developer-utils";
const Namespace = CompilerErrorNamespace.KeyboardInfoCompiler;
// const SevInfo = CompilerErrorSeverity.Info | Namespace;

View file

@ -5,10 +5,10 @@
import { minKeymanVersion } from "./min-keyman-version.js";
import { KeyboardInfoFile, KeyboardInfoFileIncludes, KeyboardInfoFileLanguageFont, KeyboardInfoFilePlatform } from "./keyboard-info-file.js";
import { KeymanFileTypes, CompilerCallbacks, KmpJsonFile, KmxFileReader, KMX, KeymanTargets, KeymanCompiler, CompilerOptions, KeymanCompilerResult, KeymanCompilerArtifacts, KeymanCompilerArtifact } from "@keymanapp/common-types";
import { KeymanFileTypes, KmpJsonFile, KmxFileReader, KMX, KeymanTargets } from "@keymanapp/common-types";
import { KeyboardInfoCompilerMessages } from "./keyboard-info-compiler-messages.js";
import langtags from "./imports/langtags.js";
import { KeymanUrls, isValidEmail, validateMITLicense } from "@keymanapp/developer-utils";
import { CompilerCallbacks, KeymanCompiler, CompilerOptions, KeymanCompilerResult, KeymanCompilerArtifacts, KeymanCompilerArtifact, KeymanUrls, isValidEmail, validateMITLicense } from "@keymanapp/developer-utils";
import { KmpCompiler } from "@keymanapp/kmc-package";
import { SchemaValidators } from "@keymanapp/common-types";

View file

@ -2,7 +2,8 @@ import { assert } from 'chai';
import 'mocha';
import { KeyboardInfoCompilerMessages } from '../src/keyboard-info-compiler-messages.js';
import { TestCompilerCallbacks, verifyCompilerMessagesObject } from '@keymanapp/developer-test-helpers';
import { CompilerErrorNamespace, KmpJsonFile, KeymanFileTypes } from '@keymanapp/common-types';
import { KmpJsonFile, KeymanFileTypes } from '@keymanapp/common-types';
import { CompilerErrorNamespace } from '@keymanapp/developer-utils';
import { makePathToFixture } from './helpers/index.js';
import { KeyboardInfoCompiler, KeyboardInfoCompilerResult } from '../src/keyboard-info-compiler.js';
import { KeyboardInfoFile } from '../src/keyboard-info-file.js';

View file

@ -6,7 +6,8 @@ import { makePathToFixture } from './helpers/index.js';
import { KeyboardInfoCompiler, KeyboardInfoCompilerResult, unitTestEndpoints } from '../src/keyboard-info-compiler.js';
import langtags from "../src/imports/langtags.js";
import { KmpCompiler, KmpCompilerOptions } from '@keymanapp/kmc-package';
import { CompilerCallbacks, KMX, KeymanFileTypes, KeymanTargets, KmpJsonFile } from '@keymanapp/common-types';
import { KMX, KeymanFileTypes, KeymanTargets, KmpJsonFile } from '@keymanapp/common-types';
import { CompilerCallbacks } from '@keymanapp/developer-utils';
import { KeyboardInfoFile, KeyboardInfoFileLanguage, KeyboardInfoFilePlatform } from './keyboard-info-file.js';
const callbacks = new TestCompilerCallbacks();

View file

@ -6,9 +6,11 @@ TODO: implement additional interfaces:
*/
// TODO: rename wasm-host?
import { VisualKeyboard, KvkFileReader, KeymanCompiler, KeymanCompilerArtifacts, KeymanCompilerArtifactOptional, KeymanCompilerResult, KeymanCompilerArtifact } from '@keymanapp/common-types';
import { UnicodeSetParser, UnicodeSet, CompilerCallbacks, CompilerEvent, CompilerOptions, KeymanFileTypes, KvkFileWriter } from '@keymanapp/common-types';
import { KvksFileReader } from '@keymanapp/developer-utils';
import { VisualKeyboard, KvkFileReader, UnicodeSetParser, UnicodeSet, KeymanFileTypes, KvkFileWriter } from '@keymanapp/common-types';
import {
CompilerCallbacks, CompilerEvent, CompilerOptions, KeymanCompiler, KeymanCompilerArtifacts,
KeymanCompilerArtifactOptional, KeymanCompilerResult, KeymanCompilerArtifact, KvksFileReader
} from '@keymanapp/developer-utils';
import * as Osk from './osk.js';
import loadWasmHost from '../import/kmcmplib/wasm-host.js';
import { KmnCompilerMessages, mapErrorFromKmcmplib } from './kmn-compiler-messages.js';

View file

@ -1,6 +1,5 @@
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerEvent, CompilerMessageSpec as m, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/common-types";
import { kmnfile } from "../kmw-compiler/compiler-globals.js";
import { KeymanUrls } from "@keymanapp/developer-utils";
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerEvent, CompilerMessageSpec as m, CompilerMessageDef as def, CompilerMessageSpecWithException, KeymanUrls } from "@keymanapp/developer-utils";
const Namespace = CompilerErrorNamespace.KmnCompiler;
const SevInfo = CompilerErrorSeverity.Info | Namespace;

View file

@ -1,4 +1,5 @@
import { KMX, CompilerCallbacks, CompilerOptions } from "@keymanapp/common-types";
import { KMX } from "@keymanapp/common-types";
import { CompilerCallbacks, CompilerOptions } from "@keymanapp/developer-utils";
import { KmnCompilerResult } from "../compiler/compiler.js";
export let FTabStop: string;

View file

@ -1,5 +1,5 @@
import { KmnCompilerMessages } from "../compiler/kmn-compiler-messages.js";
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerEvent, CompilerMessageDef as def, CompilerMessageSpec } from "@keymanapp/common-types";
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerEvent, CompilerMessageDef as def, CompilerMessageSpec } from "@keymanapp/developer-utils";
import { kmnfile } from "./compiler-globals.js";
const Namespace = CompilerErrorNamespace.KmwCompiler;

View file

@ -1,4 +1,5 @@
import { KMX, CompilerOptions, CompilerCallbacks, KvkFileReader, VisualKeyboard, KmxFileReader, KvkFile } from "@keymanapp/common-types";
import { KMX, KvkFileReader, VisualKeyboard, KmxFileReader, KvkFile } from "@keymanapp/common-types";
import { CompilerOptions, CompilerCallbacks } from "@keymanapp/developer-utils";
import { ExpandSentinel, incxstr, xstrlen } from "./util.js";
import { options, nl, FTabStop, setupGlobals, callbacks, FFix183_LadderLength, FCallFunctions, fk, minimumKeymanVersionToString, isKeyboardVersion10OrLater, isKeyboardVersion17OrLater } from "./compiler-globals.js";
import { JavaScript_ContextMatch, JavaScript_KeyAsString, JavaScript_Name, JavaScript_OutputString, JavaScript_Rules, JavaScript_Shift, JavaScript_ShiftAsString, JavaScript_Store, zeroPadHex } from './javascript-strings.js';

View file

@ -4,7 +4,7 @@ import { KmwCompilerMessages } from '../../src/kmw-compiler/kmw-compiler-message
import { TestCompilerCallbacks, verifyCompilerMessagesObject } from '@keymanapp/developer-test-helpers';
import { makePathToFixture } from '../helpers/index.js';
import { KmnCompiler } from '../../src/main.js';
import { CompilerErrorNamespace } from '@keymanapp/common-types';
import { CompilerErrorNamespace } from '@keymanapp/developer-utils';
describe('KmwCompilerMessages', function () {
const callbacks = new TestCompilerCallbacks();

View file

@ -4,7 +4,7 @@ import { KmnCompilerMessages } from '../src/compiler/kmn-compiler-messages.js';
import { TestCompilerCallbacks, verifyCompilerMessagesObject } from '@keymanapp/developer-test-helpers';
import { makePathToFixture } from './helpers/index.js';
import { KmnCompiler } from '../src/main.js';
import { CompilerErrorNamespace } from '@keymanapp/common-types';
import { CompilerErrorNamespace } from '@keymanapp/developer-utils';
describe('KmnCompilerMessages', function () {
const callbacks = new TestCompilerCallbacks();

View file

@ -3,7 +3,7 @@ import { assert } from 'chai';
import { KmnCompiler } from '../src/main.js';
import { TestCompilerCallbacks } from '@keymanapp/developer-test-helpers';
import { KmnCompilerMessages } from '../src/compiler/kmn-compiler-messages.js';
import { compilerErrorFormatCode } from '@keymanapp/common-types';
import { compilerErrorFormatCode } from '@keymanapp/developer-utils';
describe('Compiler UnicodeSet function', function() {
it('should fixup "short" \\u{} escapes', function () {

View file

@ -1,5 +1,10 @@
import { KMXPlus, UnicodeSetParser, CompilerCallbacks, KeymanCompiler, KeymanCompilerResult, KeymanCompilerArtifacts, defaultCompilerOptions, KvkFileWriter, KeymanCompilerArtifactOptional } from '@keymanapp/common-types';
import { LDMLKeyboardXMLSourceFileReader, LDMLKeyboard, LDMLKeyboardTestDataXMLSourceFile, KMXBuilder, } from "@keymanapp/developer-utils"
import { KMXPlus, UnicodeSetParser, KvkFileWriter } from '@keymanapp/common-types';
import {
CompilerCallbacks, KeymanCompiler, KeymanCompilerResult, KeymanCompilerArtifacts,
defaultCompilerOptions, LDMLKeyboardXMLSourceFileReader, LDMLKeyboard,
LDMLKeyboardTestDataXMLSourceFile, KMXBuilder,
KeymanCompilerArtifactOptional
} from "@keymanapp/developer-utils";
import { LdmlCompilerOptions } from './ldml-compiler-options.js';
import { LdmlCompilerMessages } from './ldml-compiler-messages.js';
import { BkspCompiler, TranCompiler } from './tran.js';
@ -100,7 +105,7 @@ export class LdmlKeyboardCompiler implements KeymanCompiler {
* @returns false if initialization fails
*/
async init(callbacks: CompilerCallbacks, options: LdmlCompilerOptions): Promise<boolean> {
this.options = {...options};
this.options = { ...options };
this.callbacks = callbacks;
return true;
}
@ -179,15 +184,15 @@ export class LdmlKeyboardCompiler implements KeymanCompiler {
* @returns true on success
*/
async write(artifacts: LdmlKeyboardCompilerArtifacts): Promise<boolean> {
if(artifacts.kmx) {
if (artifacts.kmx) {
this.callbacks.fs.writeFileSync(artifacts.kmx.filename, artifacts.kmx.data);
}
if(artifacts.kvk) {
if (artifacts.kvk) {
this.callbacks.fs.writeFileSync(artifacts.kvk.filename, artifacts.kvk.data);
}
if(artifacts.js) {
if (artifacts.js) {
this.callbacks.fs.writeFileSync(artifacts.js.filename, artifacts.js.data);
}
@ -199,7 +204,7 @@ export class LdmlKeyboardCompiler implements KeymanCompiler {
* Construct or return a UnicodeSetParser, aka KmnCompiler
* @returns the held UnicodeSetParser
*/
async getUsetParser() : Promise<UnicodeSetParser> {
async getUsetParser(): Promise<UnicodeSetParser> {
if (this.usetparser === undefined) {
// initialize
const compiler = new KmnCompiler();
@ -229,14 +234,14 @@ export class LdmlKeyboardCompiler implements KeymanCompiler {
const reader = new LDMLKeyboardXMLSourceFileReader(this.options.readerOptions, this.callbacks);
// load the file from disk into a string
const data = this.callbacks.loadFile(filename);
if(!data) {
this.callbacks.reportMessage(LdmlCompilerMessages.Error_InvalidFile({errorText: 'Unable to read XML file'}));
if (!data) {
this.callbacks.reportMessage(LdmlCompilerMessages.Error_InvalidFile({ errorText: 'Unable to read XML file' }));
return null;
}
// parse (load) the string into an object tree
const source = reader.load(data);
if(!source) {
this.callbacks.reportMessage(LdmlCompilerMessages.Error_InvalidFile({errorText: 'Unable to load XML file'}));
if (!source) {
this.callbacks.reportMessage(LdmlCompilerMessages.Error_InvalidFile({ errorText: 'Unable to load XML file' }));
return null;
}
try {
@ -244,8 +249,8 @@ export class LdmlKeyboardCompiler implements KeymanCompiler {
if (!reader.validate(source)) {
return null;
}
} catch(e) {
this.callbacks.reportMessage(LdmlCompilerMessages.Error_InvalidFile({errorText: e.toString()}));
} catch (e) {
this.callbacks.reportMessage(LdmlCompilerMessages.Error_InvalidFile({ errorText: e.toString() }));
return null;
}
@ -262,14 +267,14 @@ export class LdmlKeyboardCompiler implements KeymanCompiler {
public loadTestData(filename: string): LDMLKeyboardTestDataXMLSourceFile | null {
const reader = new LDMLKeyboardXMLSourceFileReader(this.options.readerOptions, this.callbacks);
const data = this.callbacks.loadFile(filename);
if(!data) {
this.callbacks.reportMessage(LdmlCompilerMessages.Error_InvalidFile({errorText: 'Unable to read XML file'}));
if (!data) {
this.callbacks.reportMessage(LdmlCompilerMessages.Error_InvalidFile({ errorText: 'Unable to read XML file' }));
return null;
}
const source = reader.loadTestData(data);
/* c8 ignore next 4 */
if(!source) {
this.callbacks.reportMessage(LdmlCompilerMessages.Error_InvalidFile({errorText: 'Unable to load XML file'}));
if (!source) {
this.callbacks.reportMessage(LdmlCompilerMessages.Error_InvalidFile({ errorText: 'Unable to load XML file' }));
return null;
}
// TODO-LDML: The unboxed data doesn't match the schema anymore. Skipping validation, for now.
@ -295,7 +300,7 @@ export class LdmlKeyboardCompiler implements KeymanCompiler {
* Runs any linter steps
* @internal
*/
private async lint(source: LDMLKeyboardXMLSourceFile, kmx: KMXPlus.KMXPlusFile) : Promise<boolean> {
private async lint(source: LDMLKeyboardXMLSourceFile, kmx: KMXPlus.KMXPlusFile): Promise<boolean> {
// run each of the linters
for (const linter of this.buildLinters(source, kmx)) {
if (!await linter.lint()) {
@ -341,8 +346,8 @@ export class LdmlKeyboardCompiler implements KeymanCompiler {
const kmx = new KMXPlusFile();
for(let section of sections) {
if(!section.validate()) {
for (let section of sections) {
if (!section.validate()) {
// TODO-LDML: coverage
passed = false;
// We'll keep validating other sections anyway, so we get a full set of
@ -350,13 +355,13 @@ export class LdmlKeyboardCompiler implements KeymanCompiler {
continue;
}
// clone
const globalSections : DependencySections = Object.assign({}, kmx.kmxplus);
const globalSections: DependencySections = Object.assign({}, kmx.kmxplus);
// pre-initialize the usetparser
globalSections.usetparser = await this.getUsetParser();
const dependencies = section.dependencies;
let dependencyProblem = false;
Object.keys(constants.section).forEach((sectstr : string) => {
const sectid : SectionIdent = constants.section[<SectionIdent>sectstr];
Object.keys(constants.section).forEach((sectstr: string) => {
const sectid: SectionIdent = constants.section[<SectionIdent>sectstr];
if (dependencies.has(sectid)) {
/* c8 ignore next 4 */
if (!kmx.kmxplus[sectid]) {
@ -380,12 +385,12 @@ export class LdmlKeyboardCompiler implements KeymanCompiler {
}
const sect = section.compile(globalSections);
if(!sect) {
if (!sect) {
passed = false;
continue;
}
/* c8 ignore next 4 */
if(kmx.kmxplus[section.id]) {
if (kmx.kmxplus[section.id]) {
// Internal error useful during section bring-up
throw new Error(`Internal error: section ${section.id} would be assigned twice`);
}
@ -394,8 +399,8 @@ export class LdmlKeyboardCompiler implements KeymanCompiler {
// give all sections a chance to postValidate
if (postValidate) {
for(let section of sections) {
if(!section.postValidate(kmx.kmxplus[section.id])) {
for (let section of sections) {
if (!section.postValidate(kmx.kmxplus[section.id])) {
passed = false;
}
}

View file

@ -1,7 +1,7 @@
import { SectionIdent, constants } from '@keymanapp/ldml-keyboard-constants';
import { SectionCompiler } from "./section-compiler.js";
import { util, KMXPlus, MarkerParser, CompilerCallbacks } from "@keymanapp/common-types";
import { LDMLKeyboard } from "@keymanapp/developer-utils";
import { util, KMXPlus, MarkerParser } from "@keymanapp/common-types";
import { CompilerCallbacks, LDMLKeyboard } from "@keymanapp/developer-utils";
import { VarsCompiler } from './vars.js';
import { LdmlCompilerMessages } from './ldml-compiler-messages.js';

View file

@ -1,5 +1,5 @@
import { CompilerCallbacks, VisualKeyboard, KeymanFileTypes } from "@keymanapp/common-types";
import { LDMLKeyboard, TouchLayoutFileWriter } from "@keymanapp/developer-utils";
import { VisualKeyboard, KeymanFileTypes } from "@keymanapp/common-types";
import { CompilerCallbacks, LDMLKeyboard, TouchLayoutFileWriter } from "@keymanapp/developer-utils";
import { LdmlCompilerOptions } from "./ldml-compiler-options.js";
import { TouchLayoutCompiler } from "./touch-layout-compiler.js";
import { LdmlKeyboardVisualKeyboardCompiler } from "./visual-keyboard-compiler.js";

View file

@ -1,4 +1,5 @@
import { util, CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def } from "@keymanapp/common-types";
import { util } from "@keymanapp/common-types";
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def } from '@keymanapp/developer-utils';
// const SevInfo = CompilerErrorSeverity.Info | CompilerErrorNamespace.LdmlKeyboardCompiler;
const SevHint = CompilerErrorSeverity.Hint | CompilerErrorNamespace.LdmlKeyboardCompiler;
const SevWarn = CompilerErrorSeverity.Warn | CompilerErrorNamespace.LdmlKeyboardCompiler;

View file

@ -1,5 +1,4 @@
import { CompilerOptions } from "@keymanapp/common-types";
import { LDMLKeyboardXMLSourceFileReaderOptions } from "@keymanapp/developer-utils";
import { CompilerOptions, LDMLKeyboardXMLSourceFileReaderOptions } from "@keymanapp/developer-utils";
/**
* @public

View file

@ -1,5 +1,5 @@
import { CompilerCallbacks, KMXPlus } from "@keymanapp/common-types";
import { LDMLKeyboard } from "@keymanapp/developer-utils";
import { KMXPlus } from "@keymanapp/common-types";
import { CompilerCallbacks, LDMLKeyboard } from "@keymanapp/developer-utils";
/** newable interface to Linter c'tor */
export type LinterNew = new (source: LDMLKeyboard.LDMLKeyboardXMLSourceFile, kmx: KMXPlus.KMXPlusFile, callbacks: CompilerCallbacks) => Linter;

View file

@ -1,5 +1,5 @@
import { KMXPlus, CompilerCallbacks } from "@keymanapp/common-types";
import { LDMLKeyboard } from "@keymanapp/developer-utils";
import { KMXPlus } from "@keymanapp/common-types";
import { CompilerCallbacks, LDMLKeyboard } from "@keymanapp/developer-utils";
import { SectionIdent, constants } from '@keymanapp/ldml-keyboard-constants';
/** newable interface to SectionCompiler c'tor */

View file

@ -1,6 +1,6 @@
import { constants, SectionIdent } from "@keymanapp/ldml-keyboard-constants";
import { KMXPlus, VariableParser, MarkerParser, util, CompilerCallbacks } from '@keymanapp/common-types';
import { LDMLKeyboard } from "@keymanapp/developer-utils";
import { KMXPlus, VariableParser, MarkerParser, util } from '@keymanapp/common-types';
import { CompilerCallbacks, LDMLKeyboard } from "@keymanapp/developer-utils";
import { SectionCompiler } from "./section-compiler.js";
import Bksp = KMXPlus.Bksp;

View file

@ -1,6 +1,6 @@
import { SectionIdent, constants } from "@keymanapp/ldml-keyboard-constants";
import { KMXPlus, VariableParser, MarkerParser, CompilerCallbacks } from '@keymanapp/common-types';
import { LDMLKeyboard, } from '@keymanapp/developer-utils';
import { KMXPlus, VariableParser, MarkerParser } from '@keymanapp/common-types';
import { LDMLKeyboard, CompilerCallbacks } from '@keymanapp/developer-utils';
import { SectionCompiler } from "./section-compiler.js";
import Vars = KMXPlus.Vars;
import StringVarItem = KMXPlus.StringVarItem;

View file

@ -1,5 +1,5 @@
import { VisualKeyboard, CompilerCallbacks } from "@keymanapp/common-types";
import { LDMLKeyboard } from "@keymanapp/developer-utils";
import { VisualKeyboard } from "@keymanapp/common-types";
import { LDMLKeyboard, CompilerCallbacks } from "@keymanapp/developer-utils";
import { KeysCompiler } from "./keys.js";
import { LdmlCompilerMessages } from "./ldml-compiler-messages.js";

View file

@ -5,8 +5,8 @@ import 'mocha';
import * as path from 'path';
import { fileURLToPath } from 'url';
import { SectionCompiler, SectionCompilerNew } from '../../src/compiler/section-compiler.js';
import { util, KMXPlus, UnicodeSetParser, VisualKeyboard, CompilerEvent, compilerEventFormat, CompilerCallbacks } from '@keymanapp/common-types';
import { LDMLKeyboardXMLSourceFileReader, LDMLKeyboardTestDataXMLSourceFile, LDMLKeyboard, } from "@keymanapp/developer-utils";
import { util, KMXPlus, UnicodeSetParser, VisualKeyboard } from '@keymanapp/common-types';
import { CompilerEvent, compilerEventFormat, CompilerCallbacks, LDMLKeyboardXMLSourceFileReader, LDMLKeyboardTestDataXMLSourceFile, LDMLKeyboard, } from "@keymanapp/developer-utils";
import { LdmlKeyboardCompiler } from '../../src/main.js'; // make sure main.js compiles
import { assert } from 'chai';
import { KMXPlusMetadataCompiler } from '../../src/compiler/metadata-compiler.js';

View file

@ -1,4 +1,4 @@
import { CompilerEvent } from '@keymanapp/common-types';
import { CompilerEvent } from '@keymanapp/developer-utils';
import 'mocha';
import {assert} from 'chai';
import { CompilerEventOrMatch, matchCompilerEvents } from './helpers/index.js';

View file

@ -1,7 +1,7 @@
import 'mocha';
import { LdmlCompilerMessages } from '../src/compiler/ldml-compiler-messages.js';
import { verifyCompilerMessagesObject } from '@keymanapp/developer-test-helpers';
import { CompilerErrorNamespace } from '@keymanapp/common-types';
import { CompilerErrorNamespace } from '@keymanapp/developer-utils';
describe('LdmlCompilerMessages', function () {
it('should have a valid LdmlCompilerMessages object', function() {

View file

@ -1,4 +1,4 @@
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/common-types";
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/developer-utils";
const Namespace = CompilerErrorNamespace.ModelInfoCompiler;
// const SevInfo = CompilerErrorSeverity.Info | Namespace;

View file

@ -5,9 +5,9 @@
import { minKeymanVersion } from "./min-keyman-version.js";
import { ModelInfoFile } from "./model-info-file.js";
import { CompilerCallbacks, CompilerOptions, KeymanCompiler, KeymanCompilerArtifact, KeymanCompilerArtifacts, KeymanCompilerResult, KmpJsonFile } from "@keymanapp/common-types";
import { KmpJsonFile } from "@keymanapp/common-types";
import { ModelInfoCompilerMessages } from "./model-info-compiler-messages.js";
import { KeymanUrls, isValidEmail, validateMITLicense } from "@keymanapp/developer-utils";
import { CompilerCallbacks, CompilerOptions, KeymanCompiler, KeymanCompilerArtifact, KeymanCompilerArtifacts, KeymanCompilerResult,KeymanUrls, isValidEmail, validateMITLicense } from "@keymanapp/developer-utils";
/* c8 ignore start */
/**

View file

@ -1,7 +1,7 @@
import 'mocha';
import { ModelInfoCompilerMessages } from '../src/model-info-compiler-messages.js';
import { verifyCompilerMessagesObject } from '@keymanapp/developer-test-helpers';
import { CompilerErrorNamespace } from '@keymanapp/common-types';
import { CompilerErrorNamespace } from '@keymanapp/developer-utils';
describe('ModelInfoCompilerMessages', function () {
it('should have a valid ModelInfoCompilerMessages object', function() {

View file

@ -1,4 +1,4 @@
import { CompilerCallbacks } from "@keymanapp/common-types";
import { CompilerCallbacks } from "@keymanapp/developer-utils";
export let callbacks: CompilerCallbacks;

View file

@ -10,7 +10,7 @@ import {decorateWithScriptOverrides} from "./script-overrides-decorator.js";
import { LexicalModelSource, WordBreakerSpec, SimpleWordBreakerSpec } from "./lexical-model.js";
import { ModelCompilerError, ModelCompilerMessageContext, ModelCompilerMessages } from "./model-compiler-messages.js";
import { callbacks, setCompilerCallbacks } from "./compiler-callbacks.js";
import { CompilerCallbacks, CompilerOptions, KeymanCompiler, KeymanCompilerArtifact, KeymanCompilerArtifacts, KeymanCompilerResult } from "@keymanapp/common-types";
import { CompilerCallbacks, CompilerOptions, KeymanCompiler, KeymanCompilerArtifact, KeymanCompilerArtifacts, KeymanCompilerResult } from "@keymanapp/developer-utils";
/**
* An ECMAScript module as emitted by the TypeScript compiler.

View file

@ -1,4 +1,4 @@
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerEvent, CompilerMessageSpec, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/common-types";
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerEvent, CompilerMessageSpec, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/developer-utils";
const Namespace = CompilerErrorNamespace.ModelCompiler;
// const SevInfo = CompilerErrorSeverity.Info | Namespace;

View file

@ -1,7 +1,7 @@
import 'mocha';
import { ModelCompilerMessages } from '../src/model-compiler-messages.js';
import { verifyCompilerMessagesObject } from '@keymanapp/developer-test-helpers';
import { CompilerErrorNamespace } from '@keymanapp/common-types';
import { CompilerErrorNamespace } from '@keymanapp/developer-utils';
describe('ModelCompilerMessages', function () {
it('should have a valid ModelCompilerMessages object', function() {

View file

@ -2,7 +2,8 @@ import { xml2js } from '@keymanapp/common-types';
import JSZip from 'jszip';
import KEYMAN_VERSION from "@keymanapp/keyman-version";
import { KmpJsonFile, SchemaValidators, CompilerCallbacks, KeymanFileTypes, KvkFile, KeymanCompiler, CompilerOptions, KeymanCompilerResult, KeymanCompilerArtifacts, KeymanCompilerArtifact } from '@keymanapp/common-types';
import { KmpJsonFile, SchemaValidators, KeymanFileTypes, KvkFile } from '@keymanapp/common-types';
import { CompilerCallbacks, KpsFile, KeymanCompiler, CompilerOptions, KeymanCompilerResult, KeymanCompilerArtifacts, KeymanCompilerArtifact } from '@keymanapp/developer-utils';
import { PackageCompilerMessages } from './package-compiler-messages.js';
import { PackageMetadataCollector } from './package-metadata-collector.js';
import { KmpInfWriter } from './kmp-inf-writer.js';
@ -12,7 +13,6 @@ import { PackageKeyboardTargetValidator } from './package-keyboard-target-valida
import { PackageMetadataUpdater } from './package-metadata-updater.js';
import { markdownToHTML } from './markdown.js';
import { PackageValidation } from './package-validation.js';
import { KpsFile } from '@keymanapp/developer-utils';
const KMP_JSON_FILENAME = 'kmp.json';
const KMP_INF_FILENAME = 'kmp.inf';

View file

@ -1,4 +1,4 @@
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/common-types";
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/developer-utils";
const Namespace = CompilerErrorNamespace.PackageCompiler;
const SevInfo = CompilerErrorSeverity.Info | Namespace;

View file

@ -1,4 +1,5 @@
import { KeymanTargets, CompilerCallbacks, KmpJsonFile } from "@keymanapp/common-types";
import { KeymanTargets, KmpJsonFile } from "@keymanapp/common-types";
import { CompilerCallbacks } from "@keymanapp/developer-utils";
import { PackageCompilerMessages } from "./package-compiler-messages.js";
import { KeyboardMetadataCollection } from "./package-metadata-collector.js";

View file

@ -1,4 +1,5 @@
import { KmpJsonFile, CompilerCallbacks, KmxFileReader, KmxFileReaderError, KMX, KeymanFileTypes } from '@keymanapp/common-types';
import { KmpJsonFile, KmxFileReader, KmxFileReaderError, KMX, KeymanFileTypes } from '@keymanapp/common-types';
import { CompilerCallbacks } from "@keymanapp/developer-utils";
import { getCompiledKmxKeyboardMetadata } from './kmx-keyboard-metadata.js';
import { PackageCompilerMessages } from './package-compiler-messages.js';
import { getCompiledWebKeyboardMetadata, WebKeyboardMetadata } from './web-keyboard-metadata.js';

View file

@ -1,7 +1,7 @@
import { KmpJsonFile, CompilerCallbacks, CompilerOptions, KeymanFileTypes } from '@keymanapp/common-types';
import { KmpJsonFile, KeymanFileTypes } from '@keymanapp/common-types';
import { PackageCompilerMessages } from './package-compiler-messages.js';
import { keymanEngineForWindowsFiles, keymanForWindowsInstallerFiles, keymanForWindowsRedistFiles } from './redist-files.js';
import { isValidEmail } from '@keymanapp/developer-utils';
import { isValidEmail, CompilerCallbacks, CompilerOptions } from '@keymanapp/developer-utils';
// The keyboard ID SHOULD adhere to this pattern:
const KEYBOARD_ID_PATTERN_PACKAGE = /^[a-z_][a-z0-9_]*\.(kps|kmp)$/;

View file

@ -1,7 +1,7 @@
import { KmpJsonFile, CompilerCallbacks } from '@keymanapp/common-types';
import { KmpJsonFile } from '@keymanapp/common-types';
import { PackageCompilerMessages } from './package-compiler-messages.js';
import { KeyboardMetadataCollection } from './package-metadata-collector.js';
import { KpsFile } from '@keymanapp/developer-utils';
import { KpsFile, CompilerCallbacks } from '@keymanapp/developer-utils';
export const DEFAULT_KEYBOARD_VERSION = '1.0';
export const MIN_LM_FILEVERSION_KMP_JSON = '12.0';

View file

@ -11,11 +11,11 @@
*/
import JSZip from 'jszip';
import { CompilerCallbacks, KeymanCompiler, KeymanCompilerArtifact, KeymanCompilerArtifacts, KeymanCompilerResult, KeymanFileTypes, KmpJsonFile } from "@keymanapp/common-types";
import { KeymanFileTypes, KmpJsonFile } from "@keymanapp/common-types";
import { CompilerCallbacks, KeymanCompiler, KeymanCompilerArtifact, KeymanCompilerArtifacts, KeymanCompilerResult, KpsFile } from '@keymanapp/developer-utils';
import KEYMAN_VERSION from "@keymanapp/keyman-version";
import { KmpCompiler, KmpCompilerOptions } from "./kmp-compiler.js";
import { PackageCompilerMessages } from "./package-compiler-messages.js";
import { KpsFile } from '@keymanapp/developer-utils';
const SETUP_INF_FILENAME = 'setup.inf';
const PRODUCT_NAME = 'Keyman';

View file

@ -4,7 +4,7 @@ import { TestCompilerCallbacks, verifyCompilerMessagesObject } from '@keymanapp/
import { PackageCompilerMessages } from '../src/compiler/package-compiler-messages.js';
import { makePathToFixture } from './helpers/index.js';
import { KmpCompiler } from '../src/compiler/kmp-compiler.js';
import { CompilerErrorNamespace, CompilerOptions } from '@keymanapp/common-types';
import { CompilerErrorNamespace, CompilerOptions } from '@keymanapp/developer-utils';
const debug = false;
const callbacks = new TestCompilerCallbacks();

View file

@ -3,7 +3,7 @@ import * as path from 'path';
import { Command, Option } from 'commander';
import { NodeCompilerCallbacks } from '../util/NodeCompilerCallbacks.js';
import { InfrastructureMessages } from '../messages/infrastructureMessages.js';
import { CompilerCallbacks, CompilerLogLevel } from '@keymanapp/common-types';
import { CompilerCallbacks, CompilerLogLevel } from '@keymanapp/developer-utils';
import { AnalyzeOskCharacterUse, AnalyzeOskRewritePua } from '@keymanapp/kmc-analyze';
import { BaseOptions } from '../util/baseOptions.js';
import { runOnFiles } from '../util/projectRunner.js';

View file

@ -5,7 +5,8 @@ import { buildActivities } from './buildClasses/buildActivities.js';
import { BuildProject } from './buildClasses/BuildProject.js';
import { NodeCompilerCallbacks } from '../util/NodeCompilerCallbacks.js';
import { InfrastructureMessages } from '../messages/infrastructureMessages.js';
import { CompilerFileCallbacks, CompilerOptions, KeymanFileTypes } from '@keymanapp/common-types';
import { KeymanFileTypes } from '@keymanapp/common-types';
import { CompilerOptions, CompilerFileCallbacks } from '@keymanapp/developer-utils';
import { BaseOptions } from '../util/baseOptions.js';
import { expandFileLists } from '../util/fileLists.js';
import { isProject } from '../util/projectLoader.js';

View file

@ -1,6 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import { CompilerCallbacks, CompilerOptions, KeymanCompiler, KeymanFileTypes } from "@keymanapp/common-types";
import { KeymanFileTypes } from "@keymanapp/common-types";
import { CompilerCallbacks, CompilerOptions, KeymanCompiler } from "@keymanapp/developer-utils";
import { InfrastructureMessages } from '../../messages/infrastructureMessages.js';
export abstract class BuildActivity {

View file

@ -1,7 +1,8 @@
import * as fs from 'fs';
import * as path from 'path';
import { BuildActivity } from './BuildActivity.js';
import { CompilerCallbacks, KeymanFileTypes } from '@keymanapp/common-types';
import { KeymanFileTypes } from '@keymanapp/common-types';
import { CompilerCallbacks } from '@keymanapp/developer-utils';
import { KeyboardInfoCompiler } from '@keymanapp/kmc-keyboard-info';
import { loadProject } from '../../util/projectLoader.js';
import { InfrastructureMessages } from '../../messages/infrastructureMessages.js';

View file

@ -1,7 +1,8 @@
import * as path from 'path';
import { platform } from 'os';
import { KmnCompiler } from '@keymanapp/kmc-kmn';
import { CompilerOptions, CompilerCallbacks, KeymanFileTypes } from '@keymanapp/common-types';
import { KeymanFileTypes } from '@keymanapp/common-types';
import { CompilerOptions, CompilerCallbacks } from '@keymanapp/developer-utils';
import { BuildActivity } from './BuildActivity.js';
export class BuildKmnKeyboard extends BuildActivity {

View file

@ -1,5 +1,6 @@
import * as kmcLdml from '@keymanapp/kmc-ldml';
import { CompilerCallbacks, CompilerOptions, KeymanFileTypes } from '@keymanapp/common-types';
import { KeymanFileTypes } from '@keymanapp/common-types';
import { CompilerOptions, CompilerCallbacks } from '@keymanapp/developer-utils';
import { LDMLKeyboardXMLSourceFileReader } from '@keymanapp/developer-utils';
import { BuildActivity } from './BuildActivity.js';
import { fileURLToPath } from 'url';

View file

@ -1,6 +1,7 @@
import { BuildActivity } from './BuildActivity.js';
import { LexicalModelCompiler } from '@keymanapp/kmc-model';
import { CompilerCallbacks, CompilerOptions, KeymanFileTypes } from '@keymanapp/common-types';
import { KeymanFileTypes } from '@keymanapp/common-types';
import { CompilerOptions, CompilerCallbacks } from '@keymanapp/developer-utils';
export class BuildModel extends BuildActivity {
public get name(): string { return 'Lexical model'; }

View file

@ -1,7 +1,8 @@
import * as fs from 'fs';
import * as path from 'path';
import { BuildActivity } from './BuildActivity.js';
import { CompilerCallbacks, KeymanFileTypes } from '@keymanapp/common-types';
import { KeymanFileTypes } from '@keymanapp/common-types';
import { CompilerCallbacks } from '@keymanapp/developer-utils';
import { ModelInfoCompiler } from '@keymanapp/kmc-model-info';
import { KmpCompiler } from '@keymanapp/kmc-package';
import { loadProject } from '../../util/projectLoader.js';

View file

@ -1,5 +1,6 @@
import { BuildActivity } from './BuildActivity.js';
import { CompilerCallbacks, CompilerOptions, KeymanFileTypes } from '@keymanapp/common-types';
import { KeymanFileTypes } from '@keymanapp/common-types';
import { CompilerOptions, CompilerCallbacks } from '@keymanapp/developer-utils';
import { KmpCompiler } from '@keymanapp/kmc-package';
export class BuildPackage extends BuildActivity {

View file

@ -1,6 +1,7 @@
import * as path from 'path';
import * as fs from 'fs';
import { CompilerCallbacks, CompilerFileCallbacks, KeymanFileTypes } from '@keymanapp/common-types';
import { KeymanFileTypes } from '@keymanapp/common-types';
import { CompilerFileCallbacks, CompilerCallbacks } from '@keymanapp/developer-utils';
import { KeymanDeveloperProject, KeymanDeveloperProjectFile, KeymanDeveloperProjectType } from '@keymanapp/developer-utils';
import { BuildActivity } from './BuildActivity.js';
import { buildActivities, buildKeyboardInfoActivity, buildModelInfoActivity } from './buildActivities.js';

View file

@ -1,8 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import * as kmcLdml from '@keymanapp/kmc-ldml';
import { CompilerCallbacks, defaultCompilerOptions } from '@keymanapp/common-types';
import { LDMLKeyboardTestDataXMLSourceFile, LDMLKeyboardXMLSourceFileReader } from '@keymanapp/developer-utils';
import { CompilerCallbacks, defaultCompilerOptions, LDMLKeyboardTestDataXMLSourceFile, LDMLKeyboardXMLSourceFileReader } from '@keymanapp/developer-utils';
import { NodeCompilerCallbacks } from '../../util/NodeCompilerCallbacks.js';
import { fileURLToPath } from 'url';
import { CommandLineBaseOptions } from 'src/util/baseOptions.js';

View file

@ -1,6 +1,6 @@
import * as fs from 'fs';
import * as path from 'path';
import { CompilerCallbacks, defaultCompilerOptions } from '@keymanapp/common-types';
import { CompilerCallbacks, defaultCompilerOptions } from '@keymanapp/developer-utils';
import { NodeCompilerCallbacks } from '../../util/NodeCompilerCallbacks.js';
import { WindowsPackageInstallerCompiler, WindowsPackageInstallerSources } from '@keymanapp/kmc-package';
import { CommandLineBaseOptions } from 'src/util/baseOptions.js';

View file

@ -1,14 +1,13 @@
import * as fs from 'fs';
import * as path from 'path';
import { CompilerBaseOptions, CompilerCallbacks, CompilerError, CompilerErrorNamespace, CompilerEvent } from '@keymanapp/common-types';
import { Command, Option } from 'commander';
import { escapeMarkdownChar, KeymanUrls, CompilerBaseOptions, CompilerCallbacks, CompilerError, CompilerErrorNamespace, CompilerEvent } from '@keymanapp/developer-utils';
import { CompilerMessageSource, messageNamespaceKeys, messageSources } from '../messages/messageNamespaces.js';
import { NodeCompilerCallbacks } from '../util/NodeCompilerCallbacks.js';
import { exitProcess } from '../util/sysexits.js';
import { InfrastructureMessages } from '../messages/infrastructureMessages.js';
import { CompilerMessageDetail, findMessageDetails, findMessagesById, getMessageIdentifiersSorted } from '../util/extendedCompilerOptions.js';
import { escapeMarkdownChar, KeymanUrls } from '@keymanapp/developer-utils';
type MessageFormat = 'text'|'markdown'|'json';

View file

@ -1,4 +1,4 @@
import { CompilerError, CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/common-types";
import { CompilerError, CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/developer-utils";
const Namespace = CompilerErrorNamespace.Infrastructure;
const SevInfo = CompilerErrorSeverity.Info | Namespace;

View file

@ -1,4 +1,4 @@
import { CommonTypesMessages, CompilerErrorNamespace } from '@keymanapp/common-types';
import { CommonTypesMessages, CompilerErrorNamespace } from '@keymanapp/developer-utils';
import { AnalyzerMessages } from '@keymanapp/kmc-analyze';
import { KeyboardInfoCompilerMessages } from '@keymanapp/kmc-keyboard-info';
import { KmnCompilerMessages, KmwCompilerMessages } from '@keymanapp/kmc-kmn';

View file

@ -6,7 +6,7 @@ import { CompilerCallbacks, CompilerEvent,
compilerLogLevelToSeverity, CompilerErrorSeverity,
CompilerError,
CompilerCallbackOptions,
CompilerFileCallbacks} from '@keymanapp/common-types';
CompilerFileCallbacks} from '@keymanapp/developer-utils';
import { InfrastructureMessages } from '../messages/infrastructureMessages.js';
import chalk from 'chalk';
import supportsColor from 'supports-color';

View file

@ -1,4 +1,4 @@
import { ALL_COMPILER_LOG_FORMATS, ALL_COMPILER_LOG_LEVELS, CompilerLogFormat, CompilerLogLevel } from "@keymanapp/common-types";
import { ALL_COMPILER_LOG_FORMATS, ALL_COMPILER_LOG_LEVELS, CompilerLogFormat, CompilerLogLevel } from "@keymanapp/developer-utils";
import { Command, Option } from "commander";
/**

View file

@ -1,4 +1,4 @@
import { CompilerCallbacks, CompilerError, CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageOverride, CompilerMessageOverrideMap, CompilerOptions } from '@keymanapp/common-types';
import { CompilerCallbacks, CompilerError, CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageOverride, CompilerMessageOverrideMap, CompilerOptions } from '@keymanapp/developer-utils';
import { InfrastructureMessages } from '../messages/infrastructureMessages.js';
import { CompilerMessageSource, messageNamespaceKeys, messageSources } from '../messages/messageNamespaces.js';

View file

@ -1,6 +1,6 @@
import * as fs from 'fs';
import * as path from 'path';
import { CompilerCallbacks } from "@keymanapp/common-types";
import { CompilerCallbacks } from "@keymanapp/developer-utils";
import { InfrastructureMessages } from "../messages/infrastructureMessages.js";
/**

View file

@ -1,8 +1,8 @@
import * as path from 'path';
import * as fs from 'fs';
import { CompilerCallbacks, KeymanFileTypes } from "@keymanapp/common-types";
import { KeymanDeveloperProject, KPJFileReader } from "@keymanapp/developer-utils";
import { KeymanFileTypes } from "@keymanapp/common-types";
import { CompilerCallbacks, KeymanDeveloperProject, KPJFileReader } from "@keymanapp/developer-utils";
import { InfrastructureMessages } from "../messages/infrastructureMessages.js";
export const isProject = (filename: string): boolean =>

View file

@ -1,4 +1,5 @@
import { CompilerCallbacks, KeymanFileTypes } from "@keymanapp/common-types";
import { KeymanFileTypes } from '@keymanapp/common-types';
import { CompilerCallbacks } from '@keymanapp/developer-utils';
import { isProject, loadProject } from './projectLoader.js';
async function runProject(callbacks: CompilerCallbacks, filename: string, callback: (filename:string)=>Promise<boolean>): Promise<boolean> {

View file

@ -3,7 +3,7 @@ import { assert } from 'chai';
import 'mocha';
import { unitTestEndpoints } from '../src/util/extendedCompilerOptions.js';
import { InfrastructureMessages } from '../src/messages/infrastructureMessages.js';
import { CompilerError, CompilerMessageOverride, CompilerErrorSeverity } from '@keymanapp/common-types';
import { CompilerError, CompilerMessageOverride, CompilerErrorSeverity } from '@keymanapp/developer-utils';
import { KmnCompilerMessages } from '@keymanapp/kmc-kmn';
interface MessageTest {input: string, result: CompilerMessageOverride};

View file

@ -4,12 +4,12 @@ import { InfrastructureMessages } from '../src/messages/infrastructureMessages.j
import { verifyCompilerMessagesObject } from '@keymanapp/developer-test-helpers';
import { makePathToFixture } from './helpers/index.js';
import { NodeCompilerCallbacks } from '../src/util/NodeCompilerCallbacks.js';
import { CompilerErrorNamespace, CompilerEvent, KeymanFileTypes } from '@keymanapp/common-types';
import { KeymanFileTypes } from '@keymanapp/common-types';
import { unitTestEndpoints } from '../src/commands/build.js';
import { KmnCompilerMessages } from '@keymanapp/kmc-kmn';
import { clearOptions } from '@keymanapp/developer-utils';
import { loadProject } from '../src/util/projectLoader.js';
import { defaultCompilerOptions, CompilerOptions} from '@keymanapp/common-types';
import { CompilerErrorNamespace, CompilerEvent, defaultCompilerOptions, CompilerOptions} from '@keymanapp/developer-utils';
import { analyzeUnitTestEndpoints } from '../src/commands/analyze.js';
import { BuildKeyboardInfo } from '../src/commands/buildClasses/BuildKeyboardInfo.js';
import { BuildModelInfo } from '../src/commands/buildClasses/BuildModelInfo.js';