Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): rename core.js to km-core.js 🎼 #12558

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ mock_files = files(
if cpp_compiler.get_id() == 'emscripten'
host_links = ['--whole-archive', '-sALLOW_MEMORY_GROWTH=1', '-sMODULARIZE=1',
'-sEXPORT_ES6', '-sENVIRONMENT=web,webview',
'--emit-tsd', 'core-interface.d.ts', '-sERROR_ON_UNDEFINED_SYMBOLS=0']
'--emit-tsd', 'km-core-interface.d.ts', '-sERROR_ON_UNDEFINED_SYMBOLS=0']

links += ['-sEXPORTED_RUNTIME_METHODS=[\'UTF8ToString\',\'stringToNewUTF8\',\'wasmExports\']',
# Forcing inclusion of debug symbols
Expand Down Expand Up @@ -174,7 +174,7 @@ pkg.generate(

if cpp_compiler.get_id() == 'emscripten'
# Build an executable
host = executable('core',
host = executable('km-core',
cpp_args: defns,
include_directories: inc,
link_args: links + host_links,
Expand Down
4 changes: 2 additions & 2 deletions web/src/app/browser/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ compile_and_copy() {
cp -R "$KEYMAN_ROOT/web/src/resources/osk/." "$KEYMAN_ROOT/web/build/app/resources/osk/"

# Copy Keyman Core build artifacts for local reference
cp "${KEYMAN_ROOT}/web/build/engine/core-processor/obj/import/core/"core.{js,wasm} "${KEYMAN_ROOT}/web/build/app/browser/debug/"
cp "${KEYMAN_ROOT}/web/build/engine/core-processor/obj/import/core/"core.{js,wasm} "${KEYMAN_ROOT}/web/build/app/browser/release/"
cp "${KEYMAN_ROOT}/web/build/engine/core-processor/obj/import/core/"km-core.{js,wasm} "${KEYMAN_ROOT}/web/build/app/browser/debug/"
cp "${KEYMAN_ROOT}/web/build/engine/core-processor/obj/import/core/"km-core.{js,wasm} "${KEYMAN_ROOT}/web/build/app/browser/release/"

# Update the build/publish copy of our build artifacts
prepare
Expand Down
8 changes: 4 additions & 4 deletions web/src/app/webview/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ compile_and_copy() {
cp -R "$KEYMAN_ROOT/web/src/resources/osk/." "$KEYMAN_ROOT/web/build/app/resources/osk/"

# Copy Keyman Core build artifacts for local reference
cp "${KEYMAN_ROOT}/web/build/engine/core-processor/obj/import/core/"core.{js,wasm} "${KEYMAN_ROOT}/web/build/app/webview/debug/"
cp "${KEYMAN_ROOT}/web/build/engine/core-processor/obj/import/core/"core.{js,wasm} "${KEYMAN_ROOT}/web/build/app/webview/release/"
cp "${KEYMAN_ROOT}/web/build/engine/core-processor/obj/import/core/"km-core.{js,wasm} "${KEYMAN_ROOT}/web/build/app/webview/debug/"
cp "${KEYMAN_ROOT}/web/build/engine/core-processor/obj/import/core/"km-core.{js,wasm} "${KEYMAN_ROOT}/web/build/app/webview/release/"

# Clean the sourcemaps of .. and . components
for script in "$KEYMAN_ROOT/web/build/$SUBPROJECT_NAME/debug/"*.js; do
if [[ "${script}" == *"/core.js" ]]; then
if [[ "${script}" == *"/km-core.js" ]]; then
continue
fi

Expand All @@ -78,7 +78,7 @@ compile_and_copy() {
# Do NOT inline sourcemaps for release builds - we don't want them to affect
# load time.
for script in "$KEYMAN_ROOT/web/build/$SUBPROJECT_NAME/release/"*.js; do
if [[ "${script}" == *"/core.js" ]]; then
if [[ "${script}" == *"/km-core.js" ]]; then
continue
fi
sourcemap="$script.map"
Expand Down
7 changes: 4 additions & 3 deletions web/src/engine/core-processor/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ builder_describe "Keyman Core WASM integration" \
"--ci+ Set to utilize CI-based test configurations & reporting."

builder_describe_outputs \
configure "/web/src/engine/core-processor/src/import/core/core-interface.d.ts" \
configure "/web/src/engine/core-processor/src/import/core/km-core-interface.d.ts" \
build "/web/build/${SUBPROJECT_NAME}/lib/index.mjs"

builder_parse "$@"
Expand All @@ -41,12 +41,13 @@ do_configure() {
mkdir -p "src/import/core/"
# we don't need this file for release builds, but it's nice to have
# for reference and auto-completion
cp "${KEYMAN_ROOT}/core/build/wasm/${BUILDER_CONFIGURATION}/src/core-interface.d.ts" "src/import/core/"
cp "${KEYMAN_ROOT}/core/build/wasm/${BUILDER_CONFIGURATION}/src/km-core-interface.d.ts" "src/import/core/"
}

copy_deps() {
mkdir -p "${KEYMAN_ROOT}/web/build/${SUBPROJECT_NAME}/obj/import/core/"
cp "${KEYMAN_ROOT}/core/build/wasm/${BUILDER_CONFIGURATION}/src/"core{.js,.wasm,-interface.d.ts} "${KEYMAN_ROOT}/web/build/${SUBPROJECT_NAME}/obj/import/core/"
cp "${KEYMAN_ROOT}/core/build/wasm/${BUILDER_CONFIGURATION}/src/"km-core-interface.d.ts "${KEYMAN_ROOT}/web/build/${SUBPROJECT_NAME}/obj/import/core/"
cp "${KEYMAN_ROOT}/core/build/wasm/${BUILDER_CONFIGURATION}/src/"km-core{.js,.wasm} "${KEYMAN_ROOT}/web/build/${SUBPROJECT_NAME}/obj/import/core/"
}

do_build () {
Expand Down
10 changes: 5 additions & 5 deletions web/src/engine/core-processor/src/core-processor.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
type km_core_attr = import('./import/core/core-interface.js').km_core_attr;
type km_core_attr = import('./import/core/km-core-interface.js').km_core_attr;

export class CoreProcessor {
private instance: any;

/**
* Initialize Core Processor
* @param baseurl - The url where core.js is located
*/
* Initialize Core Processor
* @param baseurl - The url where km-core.js is located
*/
public async init(baseurl: string): Promise<boolean> {

if (!this.instance) {
try {
const module = await import(baseurl + '/core.js');
const module = await import(baseurl + '/km-core.js');
this.instance = await module.default({
locateFile: function (path: string, scriptDirectory: string) {
return baseurl + '/' + path;
Expand Down
2 changes: 1 addition & 1 deletion web/src/engine/core-processor/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"rootDir": "./src"
},

"include": [ "**/*.ts", "src/import/core/core.js" ],
"include": [ "**/*.ts", "src/import/core/km-core.js" ],
}
2 changes: 1 addition & 1 deletion web/src/test/auto/dom/cases/core-processor/basic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assert } from 'chai';
import { CoreProcessor } from 'keyman/engine/core-processor';

const coreurl = '/web/build/engine/core-processor/obj/import/core/';
const coreurl = '/web/build/engine/core-processor/obj/import/core';

// Test the CoreProcessor interface.
describe('CoreProcessor', function () {
Expand Down
Loading