Skip to content

Commit

Permalink
Merge pull request #12135 from keymanapp/refactor/web/12132_keyboard-…
Browse files Browse the repository at this point in the history
…storage

refactor(web): rename `package-cache` → `keyboard-storage` 🏗️
  • Loading branch information
ermshiperete authored Aug 15, 2024
2 parents 3fea601 + 170ac4b commit 43153ad
Show file tree
Hide file tree
Showing 41 changed files with 58 additions and 58 deletions.
6 changes: 3 additions & 3 deletions web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ graph TD;
Device----->WebUtils;
Elements["/web/src/engine/element-wrappers"];
Elements-->JSProc;
KeyboardCache["/web/src/engine/package-cache"];
KeyboardCache-->Interfaces;
KeyboardStorage["/web/src/engine/keyboard-storage"];
KeyboardStorage-->Interfaces;
DomUtils["/web/src/engine/dom-utils"];
DomUtils-->WebUtils;
DomUtils-->KP;
Expand All @@ -133,7 +133,7 @@ graph TD;
OSK-->Interfaces;
CommonEngine["/web/src/engine/main"];
CommonEngine-->Device;
CommonEngine-->KeyboardCache;
CommonEngine-->KeyboardStorage;
CommonEngine-->OSK;
Attachment["/web/src/engine/attachment"];
Attachment-->DomUtils;
Expand Down
8 changes: 4 additions & 4 deletions web/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ builder_describe "Builds engine modules for Keyman Engine for Web (KMW)." \
":engine/element-wrappers Subset used to integrate with website elements" \
":engine/js-processor Build JS processor for KMW" \
":engine/keyboard Builds KMW's keyboard-loading and caching code" \
":engine/keyboard-storage Subset used to collate keyboards and request them from the cloud" \
":engine/main Builds all common code used by KMW's app/-level targets" \
":engine/osk Builds the Web OSK module" \
":engine/package-cache Subset used to collate keyboards and request them from the cloud" \
":engine/interfaces Subset used to configure KMW" \
":samples Builds all needed resources for the KMW sample-page set" \
":tools Builds engine-related development resources" \
Expand Down Expand Up @@ -61,9 +61,9 @@ builder_describe_outputs \
build:engine/element-wrappers "/web/build/engine/element-wrappers/lib/index.mjs" \
build:engine/js-processor "/web/build/engine/js-processor/lib/index.mjs" \
build:engine/keyboard "/web/build/engine/keyboard/lib/index.mjs" \
build:engine/keyboard-storage "/web/build/engine/keyboard-storage/lib/index.mjs" \
build:engine/main "/web/build/engine/main/lib/index.mjs" \
build:engine/osk "/web/build/engine/osk/lib/index.mjs" \
build:engine/package-cache "/web/build/engine/package-cache/lib/index.mjs" \
build:engine/interfaces "/web/build/engine/interfaces/lib/index.mjs" \
build:samples "/web/src/samples/simplest/keymanweb.js" \
build:tools "/web/build/tools/building/sourcemap-root/index.js" \
Expand Down Expand Up @@ -152,9 +152,9 @@ builder_run_child_actions build:engine/osk
builder_run_child_actions build:engine/attachment

# Uses engine/interfaces (due to resource-path config interface)
builder_run_child_actions build:engine/package-cache
builder_run_child_actions build:engine/keyboard-storage

# Uses engine/interfaces, engine/device-detect, engine/package-cache, & engine/osk
# Uses engine/interfaces, engine/device-detect, engine/keyboard-storage, & engine/osk
builder_run_child_actions build:engine/main

# Uses all but engine/element-wrappers and engine/attachment
Expand Down
30 changes: 15 additions & 15 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@
"types": "./build/engine/keyboard/obj/keyboards/loaders/dom-keyboard-loader.d.ts",
"import": "./build/engine/keyboard/obj/keyboards/loaders/dom-keyboard-loader.js"
},
"./engine/package-cache": {
"es6-bundling": "./src/engine/package-cache/src/index.ts",
"types": "./build/engine/package-cache/obj/index.d.ts",
"import": "./build/engine/package-cache/obj/index.js",
"require": "./build/engine/package-cache/obj/index.js"
},
"./engine/package-cache/dom-requester": {
"es6-bundling": "./src/engine/package-cache/src/domCloudRequester.ts",
"types": "./build/engine/package-cache/obj/domCloudRequester.d.ts",
"import": "./build/engine/package-cache/obj/domCloudRequester.js"
},
"./engine/package-cache/node-requester": {
"es6-bundling": "./src/engine/package-cache/src/nodeCloudRequester.ts",
"types": "./build/engine/package-cache/obj/nodeCloudRequester.d.ts",
"import": "./build/engine/package-cache/obj/nodeCloudRequester.js"
"./engine/keyboard-storage": {
"es6-bundling": "./src/engine/keyboard-storage/src/index.ts",
"types": "./build/engine/keyboard-storage/obj/index.d.ts",
"import": "./build/engine/keyboard-storage/obj/index.js",
"require": "./build/engine/keyboard-storage/obj/index.js"
},
"./engine/keyboard-storage/dom-requester": {
"es6-bundling": "./src/engine/keyboard-storage/src/domCloudRequester.ts",
"types": "./build/engine/keyboard-storage/obj/domCloudRequester.d.ts",
"import": "./build/engine/keyboard-storage/obj/domCloudRequester.js"
},
"./engine/keyboard-storage/node-requester": {
"es6-bundling": "./src/engine/keyboard-storage/src/nodeCloudRequester.ts",
"types": "./build/engine/keyboard-storage/obj/nodeCloudRequester.d.ts",
"import": "./build/engine/keyboard-storage/obj/nodeCloudRequester.js"
},
"./engine/main": {
"es6-bundling": "./src/engine/main/src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/browser/src/contextManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Keyboard, KeyboardScriptError } from 'keyman/engine/keyboard';
import { type KeyboardStub } from 'keyman/engine/package-cache';
import { type KeyboardStub } from 'keyman/engine/keyboard-storage';
import { CookieSerializer } from 'keyman/engine/dom-utils';
import { eventOutputTarget, outputTargetForElement, PageContextAttachment } from 'keyman/engine/attachment';
import { DomEventTracker, LegacyEventEmitter } from 'keyman/engine/events';
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/browser/src/keymanEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TwoStateActivator,
VisualKeyboard
} from 'keyman/engine/osk';
import { ErrorStub, KeyboardStub, CloudQueryResult, toPrefixedKeyboardId as prefixed } from 'keyman/engine/package-cache';
import { ErrorStub, KeyboardStub, CloudQueryResult, toPrefixedKeyboardId as prefixed } from 'keyman/engine/keyboard-storage';
import { DeviceSpec, Keyboard, KeyboardObject } from "keyman/engine/keyboard";

import * as views from './viewsAnchorpoint.js';
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/browser/src/languageMenu.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Manages the language selection UI for touch-form factors, which is triggered by an OSK key.
import { getAbsoluteX, landscapeView } from "keyman/engine/dom-utils";
import { KeyboardStub } from "keyman/engine/package-cache";
import { KeyboardStub } from "keyman/engine/keyboard-storage";

import KeymanEngine from "./keymanEngine.js";
import * as util from "./utils/index.js";
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/webview/src/contextManager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Keyboard } from 'keyman/engine/keyboard';
import { Mock, OutputTarget, Transcription, findCommonSubstringEndIndex, isEmptyTransform, TextTransform } from 'keyman/engine/js-processor';
import { KeyboardStub } from 'keyman/engine/package-cache';
import { KeyboardStub } from 'keyman/engine/keyboard-storage';
import { ContextManagerBase } from 'keyman/engine/main';
import { WebviewConfiguration } from './configuration.js';

Expand Down
2 changes: 1 addition & 1 deletion web/src/app/webview/src/keymanEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { RuleBehavior } from 'keyman/engine/js-processor';
import { KeymanEngine as KeymanEngineBase, KeyboardInterface } from 'keyman/engine/main';
import { AnchoredOSKView, ViewConfiguration, StaticActivator } from 'keyman/engine/osk';
import { getAbsoluteX, getAbsoluteY } from 'keyman/engine/dom-utils';
import { toPrefixedKeyboardId, toUnprefixedKeyboardId } from 'keyman/engine/package-cache';
import { toPrefixedKeyboardId, toUnprefixedKeyboardId } from 'keyman/engine/keyboard-storage';

import { WebviewConfiguration, WebviewInitOptionDefaults, WebviewInitOptionSpec } from './configuration.js';
import ContextManager, { ContextHost } from './contextManager.js';
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "${THIS_SCRIPT%/*}/../../../../resources/build/builder.inc.sh"
## END STANDARD BUILD SCRIPT INCLUDE

SUBPROJECT_NAME=engine/package-cache
SUBPROJECT_NAME=engine/keyboard-storage
. "$KEYMAN_ROOT/web/common.inc.sh"
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

"compilerOptions": {
"baseUrl": "./",
"outDir": "../../../build/engine/package-cache/obj/",
"tsBuildInfoFile": "../../../build/engine/package-cache/obj/tsconfig.tsbuildinfo",
"outDir": "../../../build/engine/keyboard-storage/obj/",
"tsBuildInfoFile": "../../../build/engine/keyboard-storage/obj/tsconfig.tsbuildinfo",
"rootDir": "./src"
},

Expand Down
2 changes: 1 addition & 1 deletion web/src/engine/main/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ builder_describe "Builds the Keyman Engine for Web's common top-level base class
"@/web/src/engine/interfaces build" \
"@/web/src/engine/device-detect build" \
"@/web/src/engine/js-processor build" \
"@/web/src/engine/package-cache build" \
"@/web/src/engine/keyboard-storage build" \
"@/web/src/engine/osk build" \
"@/developer/src/kmc-model test" \
"clean" \
Expand Down
2 changes: 1 addition & 1 deletion web/src/engine/main/src/contextManagerBase.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EventEmitter } from 'eventemitter3';
import { ManagedPromise, type Keyboard } from 'keyman/engine/keyboard';
import { type KeyboardInterface, type OutputTarget } from 'keyman/engine/js-processor';
import { StubAndKeyboardCache, type KeyboardStub } from 'keyman/engine/package-cache';
import { StubAndKeyboardCache, type KeyboardStub } from 'keyman/engine/keyboard-storage';
import { PredictionContext } from 'keyman/engine/interfaces';
import { EngineConfiguration } from './engineConfiguration.js';

Expand Down
2 changes: 1 addition & 1 deletion web/src/engine/main/src/engineConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DeviceSpec, KeyboardProperties, ManagedPromise, physicalKeyDeviceAlias,
import { OutputTarget, RuleBehavior } from 'keyman/engine/js-processor';
import { PathConfiguration, PathOptionDefaults, PathOptionSpec } from "keyman/engine/interfaces";
import { Device } from "keyman/engine/device-detect";
import { KeyboardStub } from "keyman/engine/package-cache";
import { KeyboardStub } from "keyman/engine/keyboard-storage";

interface EventMap {
'spacebartext': (mode: SpacebarText) => void;
Expand Down
2 changes: 1 addition & 1 deletion web/src/engine/main/src/keyboardInterface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { KeyboardObject } from "keyman/engine/keyboard";
import { KeyboardInterface as KeyboardInterfaceBase } from 'keyman/engine/js-processor';
import { KeyboardStub, RawKeyboardStub, toUnprefixedKeyboardId as unprefixed } from 'keyman/engine/package-cache';
import { KeyboardStub, RawKeyboardStub, toUnprefixedKeyboardId as unprefixed } from 'keyman/engine/keyboard-storage';

import { ContextManagerBase } from './contextManagerBase.js';
import { VariableStoreCookieSerializer } from "./variableStoreCookieSerializer.js";
Expand Down
4 changes: 2 additions & 2 deletions web/src/engine/main/src/keymanEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ProcessorInitOptions, RuleBehavior } from 'keyman/engine/js-processor';
import { DOMKeyboardLoader as KeyboardLoader } from "keyman/engine/keyboard/dom-keyboard-loader";
import { InputProcessor } from './headless/inputProcessor.js';
import { OSKView } from "keyman/engine/osk";
import { KeyboardRequisitioner, ModelCache, toUnprefixedKeyboardId as unprefixed } from "keyman/engine/package-cache";
import { KeyboardRequisitioner, ModelCache, toUnprefixedKeyboardId as unprefixed } from "keyman/engine/keyboard-storage";
import { ModelSpec, PredictionContext } from "keyman/engine/interfaces";

import { EngineConfiguration, InitOptionSpec } from "./engineConfiguration.js";
Expand All @@ -12,7 +12,7 @@ import { ContextManagerBase } from "./contextManagerBase.js";
import HardKeyboardBase from "./hardKeyboard.js";
import { LegacyAPIEvents } from "./legacyAPIEvents.js";
import { EventNames, EventListener, LegacyEventEmitter } from "keyman/engine/events";
import DOMCloudRequester from "keyman/engine/package-cache/dom-requester";
import DOMCloudRequester from "keyman/engine/keyboard-storage/dom-requester";
import KEYMAN_VERSION from "@keymanapp/keyman-version";

// From https://stackoverflow.com/a/69328045
Expand Down
2 changes: 1 addition & 1 deletion web/src/engine/main/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"references": [
{ "path": "../device-detect" },
{ "path": "../osk" },
{ "path": "../package-cache" },
{ "path": "../keyboard-storage" },
{ "path": "../interfaces" },
{ "path": "../js-processor" }
]
Expand Down
2 changes: 1 addition & 1 deletion web/src/test/auto/dom/cases/browser/contextManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
outputTargetForElement
} from 'keyman/engine/attachment';
import { LegacyEventEmitter } from 'keyman/engine/events';
import { StubAndKeyboardCache, toPrefixedKeyboardId as prefixed } from 'keyman/engine/package-cache';
import { StubAndKeyboardCache, toPrefixedKeyboardId as prefixed } from 'keyman/engine/keyboard-storage';

import { KeyboardHarness, MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { DOMKeyboardLoader } from 'keyman/engine/keyboard/dom-keyboard-loader';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { assert } from 'chai';
import sinon from 'sinon';

import { CloudQueryEngine, type KeyboardStub } from 'keyman/engine/package-cache';
import { CloudQueryEngine, type KeyboardStub } from 'keyman/engine/keyboard-storage';
import { PathConfiguration } from 'keyman/engine/interfaces';
import DOMCloudRequester from 'keyman/engine/package-cache/dom-requester';
import DOMCloudRequester from 'keyman/engine/keyboard-storage/dom-requester';
import { ManagedPromise } from '@keymanapp/web-utils';

const pathConfig = new PathConfiguration({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assert } from 'chai';
import sinon from 'sinon';

import DOMCloudRequester from 'keyman/engine/package-cache/dom-requester';
import DOMCloudRequester from 'keyman/engine/keyboard-storage/dom-requester';

describe("Mocked cloud query results ('canary' testing)", () => {
function performMockedRequest(mockedResultsPath: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import sinon from 'sinon';
import { KeyboardHarness, MinimalKeymanGlobal } from 'keyman/engine/keyboard';
import { DOMKeyboardLoader } from 'keyman/engine/keyboard/dom-keyboard-loader';
import { PathConfiguration } from 'keyman/engine/interfaces';
import { CloudQueryEngine, KeyboardRequisitioner, type KeyboardStub } from 'keyman/engine/package-cache';
import DOMCloudRequester from 'keyman/engine/package-cache/dom-requester';
import { CloudQueryEngine, KeyboardRequisitioner, type KeyboardStub } from 'keyman/engine/keyboard-storage';
import DOMCloudRequester from 'keyman/engine/keyboard-storage/dom-requester';

const pathConfig = new PathConfiguration({
root: '',
Expand All @@ -14,7 +14,7 @@ const pathConfig = new PathConfiguration({
fonts: '',
// The primary / top-level module here is the keyboard-cache bundle.
// So, we set up our path config based upon that module for verification purposes.
}, 'http://localhost:9876/@keymanapp/keyman/build/engine/package-cache/lib'); // TODO: set up the current path like actual KMW does it.
}, 'http://localhost:9876/@keymanapp/keyman/build/engine/keyboard-storage/lib'); // TODO: set up the current path like actual KMW does it.

/**
* Performs mocking setup to facilitate unit testing for the `CloudQueryEngine` class.
Expand Down
2 changes: 1 addition & 1 deletion web/src/test/auto/dom/kbdLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from 'keyman/engine/keyboard';

import { KeyboardInterface } from 'keyman/engine/js-processor';
import { KeyboardStub } from 'keyman/engine/package-cache';
import { KeyboardStub } from 'keyman/engine/keyboard-storage';

const loader = new DOMKeyboardLoader(new KeyboardInterface(window, MinimalKeymanGlobal));

Expand Down
4 changes: 2 additions & 2 deletions web/src/test/auto/dom/web-test-runner.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ export default {
files: ['build/test/dom/cases/osk/**/*.spec.mjs']
},
{
name: 'engine/package-cache',
name: 'engine/keyboard-storage',
// Relative, from the containing package.json
files: ['build/test/dom/cases/packages/**/*.spec.mjs']
files: ['build/test/dom/cases/keyboard-storage/**/*.spec.mjs']
}
],
middleware: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { assert } from 'chai';
import sinon from 'sinon';

import { ManagedPromise } from '@keymanapp/web-utils';
import { CloudQueryEngine, StubAndKeyboardCache, toPrefixedKeyboardId as prefixed } from 'keyman/engine/package-cache';
import { CloudQueryEngine, StubAndKeyboardCache, toPrefixedKeyboardId as prefixed } from 'keyman/engine/keyboard-storage';
import { PathConfiguration } from 'keyman/engine/interfaces';
import NodeCloudRequester from 'keyman/engine/package-cache/node-requester';
import NodeCloudRequester from 'keyman/engine/keyboard-storage/node-requester';

import path from 'path';
import { fileURLToPath } from 'url';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { NodeKeyboardLoader } from 'keyman/engine/keyboard/node-keyboard-loader'
import {
KeyboardRequisitioner,
toPrefixedKeyboardId as prefixed
} from 'keyman/engine/package-cache';
} from 'keyman/engine/keyboard-storage';
import { PathConfiguration } from 'keyman/engine/interfaces';
import NodeCloudRequester from 'keyman/engine/package-cache/node-requester';
import NodeCloudRequester from 'keyman/engine/keyboard-storage/node-requester';

import path from 'path';
import { fileURLToPath } from 'url';
Expand All @@ -33,7 +33,7 @@ const pathConfig = new PathConfiguration({
// Keyboard paths in fixtures are relative to the repository root.
keyboards: `file:///${resolvedResourcePackage}/../../..`, // the one part NEEDED for unit tests below.
fonts: '',
}, `file:///${path.dirname(require.resolve('keyman/engine/package-cache'))}`);
}, `file:///${path.dirname(require.resolve('keyman/engine/keyboard-storage'))}`);

/**
* Performs mocking setup to facilitate unit testing for the `CloudQueryEngine` class.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { assert } from 'chai';
import sinon from 'sinon';

import { KeyboardStub } from 'keyman/engine/package-cache';
import NodeCloudRequester from 'keyman/engine/package-cache/node-requester';
import { KeyboardStub } from 'keyman/engine/keyboard-storage';
import NodeCloudRequester from 'keyman/engine/keyboard-storage/node-requester';

import path from 'path';
import { fileURLToPath } from 'url';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assert } from 'chai';
import sinon from 'sinon';

import NodeCloudRequester from 'keyman/engine/package-cache/node-requester';
import NodeCloudRequester from 'keyman/engine/keyboard-storage/node-requester';

import path from 'path';
import { fileURLToPath } from 'url';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { assert } from 'chai';
import sinon from 'sinon';
import fs from 'fs';

import { KeyboardStub, StubAndKeyboardCache } from 'keyman/engine/package-cache';
import { KeyboardStub, StubAndKeyboardCache } from 'keyman/engine/keyboard-storage';

import { NodeKeyboardLoader } from 'keyman/engine/keyboard/node-keyboard-loader';
import { KeyboardHarness, MinimalKeymanGlobal } from 'keyman/engine/keyboard';
Expand Down
2 changes: 1 addition & 1 deletion web/src/test/auto/integrated/cases/engine.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import * as KMWRecorder from '#recorder';

import { type KeymanEngine, type KeyboardInterface } from 'keyman/app/browser';
import { type KeyboardStub } from 'keyman/engine/package-cache';
import { type KeyboardStub } from 'keyman/engine/keyboard-storage';
import { type OSKInputEventSpec } from '#recorder';

type WindowKey = keyof typeof window;
Expand Down
2 changes: 1 addition & 1 deletion web/src/test/auto/integrated/test_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Device from 'keyman/engine/device-detect';
import * as KMWRecorder from '#recorder';
import { type BrowserInitOptionSpec, type KeymanEngine } from 'keyman/app/browser';
import { ErrorStub, type KeyboardAPISpec, type KeyboardStub } from 'keyman/engine/package-cache';
import { ErrorStub, type KeyboardAPISpec, type KeyboardStub } from 'keyman/engine/keyboard-storage';

type WindowKey = keyof typeof window;
const keyman_window = 'keyman' as WindowKey;
Expand Down

0 comments on commit 43153ad

Please sign in to comment.