maint(web): cleanup imports

For the files touched in this PR:

- fix the order of the imports according to style guide
- use `node:` prefix for node modules
- add header
This commit is contained in:
Eberhard Beilharz 2026-03-23 15:40:21 +01:00
parent 06f7f22cd0
commit bbad490154
No known key found for this signature in database
GPG key ID: E9140597606020D3
14 changed files with 93 additions and 56 deletions

View file

@ -1,11 +1,14 @@
/*
* Keyman is copyright (C) SIL Global. MIT License.
*/
import { EventEmitter } from 'eventemitter3';
import { PathConfiguration } from 'keyman/engine/interfaces';
import { KeyboardStub, ErrorStub, KeyboardAPISpec } from '../keyboardStub.js';
import { LanguageAPIPropertySpec } from 'keyman/engine/keyboard';
import { CloudRequesterInterface } from './requesterInterface.js';
import { ManagedPromise, Version } from 'keyman/common/web-utils';
import { PathConfiguration } from 'keyman/engine/interfaces';
import { LanguageAPIPropertySpec } from 'keyman/engine/keyboard';
import { ErrorStub, KeyboardAPISpec, KeyboardStub } from '../keyboardStub.js';
import { CloudRequesterInterface } from './requesterInterface.js';
// For when the API call straight-up times out.
export const CLOUD_TIMEOUT_ERR = "The Cloud API request timed out.";

View file

@ -1,6 +1,10 @@
/*
* Keyman is copyright (C) SIL Global. MIT License.
*/
import { ManagedPromise } from 'keyman/common/web-utils';
import { CLOUD_MALFORMED_OBJECT_ERR, CLOUD_STUB_REGISTRATION_ERR, CLOUD_TIMEOUT_ERR } from './cloud/cloudQueryEngine.js';
import { CloudRequesterInterface } from './cloud/requesterInterface.js';
import { CLOUD_MALFORMED_OBJECT_ERR, CLOUD_TIMEOUT_ERR, CLOUD_STUB_REGISTRATION_ERR } from './cloud/cloudQueryEngine.js';
export class DOMCloudRequester implements CloudRequesterInterface {
private readonly fileLocal: boolean;

View file

@ -1,15 +1,17 @@
/*
* Keyman is copyright (C) SIL Global. MIT License.
*/
import fs from 'node:fs';
import { assert } from 'chai';
import fs from 'fs';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import { MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { JSKeyboardInterface } from 'keyman/engine/js-processor';
import { NodeKeyboardLoader, getKeymanRoot } from 'keyman/test/resources';
import { KeyboardTest, NodeProctor } from '@keymanapp/recorder-core';
import { JSKeyboardInterface } from 'keyman/engine/js-processor';
import { MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { NodeKeyboardLoader, getKeymanRoot } from 'keyman/test/resources';
const require = createRequire(import.meta.url);
const KEYMAN_ROOT = getKeymanRoot();
describe('Engine - Basic Simulation', function() {

View file

@ -1,15 +1,18 @@
/*
* Keyman is copyright (C) SIL Global. MIT License.
*/
import fs from 'node:fs';
import { assert } from 'chai';
import fs from 'fs';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import { MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { JSKeyboardInterface } from 'keyman/engine/js-processor';
import { NodeKeyboardLoader, getKeymanRoot } from 'keyman/test/resources';
import { KeyboardTest, NodeProctor } from '@keymanapp/recorder-core';
import { ModifierKeyConstants } from '@keymanapp/common-types';
import { KeyboardTest, NodeProctor } from '@keymanapp/recorder-core';
import { JSKeyboardInterface } from 'keyman/engine/js-processor';
import { MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { NodeKeyboardLoader, getKeymanRoot } from 'keyman/test/resources';
const require = createRequire(import.meta.url);
const KEYMAN_ROOT = getKeymanRoot();
describe('Engine - Chirality', function() {

View file

@ -1,14 +1,17 @@
import { assert } from 'chai';
import fs from 'fs';
/*
* Keyman is copyright (C) SIL Global. MIT License.
*/
import fs from 'node:fs';
import { assert } from 'chai';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import { MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { JSKeyboardInterface } from 'keyman/engine/js-processor';
import { NodeKeyboardLoader, getKeymanRoot } from 'keyman/test/resources';
import { KeyboardTest, NodeProctor } from '@keymanapp/recorder-core';
const require = createRequire(import.meta.url);
const KEYMAN_ROOT = getKeymanRoot();
describe('Engine - Deadkeys', function() {

View file

@ -1,15 +1,17 @@
/*
* Keyman is copyright (C) SIL Global. MIT License.
*/
import fs from 'node:fs';
import { assert } from 'chai';
import fs from 'fs';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
import { MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { JSKeyboardInterface } from 'keyman/engine/js-processor';
import { NodeKeyboardLoader, getKeymanRoot } from 'keyman/test/resources';
import { KeyboardTest, NodeProctor } from '@keymanapp/recorder-core';
import { JSKeyboardInterface } from 'keyman/engine/js-processor';
import { MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { NodeKeyboardLoader, getKeymanRoot } from 'keyman/test/resources';
const require = createRequire(import.meta.url);
const KEYMAN_ROOT = getKeymanRoot();
describe('Engine - Unmatched Final Groups', function() {

View file

@ -1,9 +1,12 @@
/*
* Keyman is copyright (C) SIL Global. MIT License.
*/
import { assert } from 'chai';
import sinon from 'sinon';
import { ManagedPromise } from 'keyman/common/web-utils';
import { CloudQueryEngine, toPrefixedKeyboardId as prefixed } from 'keyman/engine/keyboard-storage';
import { PathConfiguration } from 'keyman/engine/interfaces';
import { CloudQueryEngine, toPrefixedKeyboardId as prefixed } from 'keyman/engine/keyboard-storage';
import { NodeCloudRequester, getWebTestResourcesPath } from 'keyman/test/resources';
const pathConfig = new PathConfiguration({

View file

@ -1,16 +1,19 @@
/*
* Keyman is copyright (C) SIL Global. MIT License.
*/
import fs from 'node:fs';
import path from 'node:path';
import { assert } from 'chai';
import { createRequire } from 'module';
import sinon from 'sinon';
import fs from 'fs';
import { ManagedPromise } from 'keyman/common/web-utils';
import { KeyboardHarness, MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { NodeKeyboardLoader, NodeCloudRequester, getWebTestResourcesPath } from 'keyman/test/resources';
import { KeyboardRequisitioner, toPrefixedKeyboardId } from 'keyman/engine/keyboard-storage';
import { PathConfiguration } from 'keyman/engine/interfaces';
import { KeyboardHarness, MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { KeyboardRequisitioner, toPrefixedKeyboardId } from 'keyman/engine/keyboard-storage';
import { NodeCloudRequester, NodeKeyboardLoader, getWebTestResourcesPath } from 'keyman/test/resources';
import path from 'path';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
let commonResourcesPackage = '@keymanapp/common-test-resources';

View file

@ -1,3 +1,6 @@
/*
* Keyman is copyright (C) SIL Global. MIT License.
*/
import { assert } from 'chai';
import sinon from 'sinon';

View file

@ -1,3 +1,6 @@
/*
* Keyman is copyright (C) SIL Global. MIT License.
*/
import { assert } from 'chai';
import sinon from 'sinon';

View file

@ -4,6 +4,7 @@
import fs from 'node:fs';
import { pathToFileURL } from 'node:url';
import { getKeymanRoot } from 'keyman/test/resources';
const KEYMAN_ROOT = getKeymanRoot();

View file

@ -1,16 +1,17 @@
import { assert } from 'chai';
import path from 'path';
import { LanguageProcessor, TranscriptionCache } from 'keyman/engine/main';
import { SourcemappedWorker as LMWorker } from "@keymanapp/lexical-model-layer/node";
import { SyntheticTextStore } from 'keyman/engine/keyboard';
/*
* Keyman is copyright (C) SIL Global. MIT License.
*
* Unit tests for the Dummy prediction model.
*/
import path from 'node:path';
import { assert } from 'chai';
import { LexicalModelCompiler } from '@keymanapp/kmc-model';
import { TestCompilerCallbacks } from '@keymanapp/developer-test-helpers';
import { LexicalModelCompiler } from '@keymanapp/kmc-model';
import { SourcemappedWorker as LMWorker } from "@keymanapp/lexical-model-layer/node";
import { SyntheticTextStore } from 'keyman/engine/keyboard';
import { LanguageProcessor, TranscriptionCache } from 'keyman/engine/main';
import { getKeymanRoot } from 'keyman/test/resources';
const KEYMAN_ROOT = getKeymanRoot();

View file

@ -1,12 +1,15 @@
/*
* Keyman is copyright (C) SIL Global. MIT License.
*/
export { assertingPromiseStatus } from './assertingPromiseStatus.js';
export { DEFAULT_PROCESSOR_INIT_OPTIONS } from './defaultProcessorInitOptions.js';
export { NodeKeyboardLoader } from './loader/nodeKeyboardLoader.js';
export { NodeCloudRequester } from './loader/nodeCloudRequester.js';
export { StageReportAssertion, SequenceAssertion, assertGestureSequence } from './sequenceAssertions.js';
export { NodeKeyboardLoader } from './loader/nodeKeyboardLoader.js';
export { assertGestureSequence, SequenceAssertion, StageReportAssertion } from './sequenceAssertions.js';
export { simulateMultiSourceMatcherInput, simulateSelectorInput } from './simulateMultiSourceInput.js';
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
export function getKeymanRoot(): string {
const __dirname = dirname(fileURLToPath(import.meta.url));

View file

@ -1,14 +1,17 @@
import { ManagedPromise } from 'keyman/common/web-utils';
import {
CloudRequesterInterface,
CloudQueryResult,
CloudQueryEngine
} from 'keyman/engine/keyboard-storage';
/*
* Keyman is copyright (C) SIL Global. MIT License.
*/
import fs from 'node:fs';
import https from 'node:https';
import vm from 'node:vm';
import { ManagedPromise } from 'keyman/common/web-utils';
import {
CloudQueryEngine,
CloudQueryResult,
CloudRequesterInterface
} from 'keyman/engine/keyboard-storage';
export class NodeCloudRequester implements CloudRequesterInterface {
private static QUERY_SEED = 1;
private readonly fileLocal: boolean;