From 554e66a4cdca922dd8342cbf2289b8a95f29e8ad Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Thu, 19 Oct 2023 09:22:07 +0700 Subject: [PATCH] fix(common): don't use URL in common/web/types Fixes #9788. --- .../web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts | 4 ++-- common/web/types/test/helpers/reader-callback-test.ts | 2 +- developer/src/kmc-ldml/test/helpers/index.ts | 2 +- .../src/kmc/src/commands/buildClasses/BuildLdmlKeyboard.ts | 2 +- developer/src/kmc/src/commands/buildTestData/index.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts b/common/web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts index 879b86de3e..dcde914f68 100644 --- a/common/web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts +++ b/common/web/types/src/ldml-keyboard/ldml-keyboard-xml-reader.ts @@ -26,8 +26,8 @@ export class LDMLKeyboardXMLSourceFileReader { constructor(private options: LDMLKeyboardXMLSourceFileReaderOptions, private callbacks : CompilerCallbacks) { } - static get defaultImportsURL() { - return new URL(`../import/`, import.meta.url); + static get defaultImportsURL(): [string,string] { + return ['../import/', import.meta.url]; } readImportFile(version: string, subpath: string): Uint8Array { diff --git a/common/web/types/test/helpers/reader-callback-test.ts b/common/web/types/test/helpers/reader-callback-test.ts index 86758ad413..907793cdf7 100644 --- a/common/web/types/test/helpers/reader-callback-test.ts +++ b/common/web/types/test/helpers/reader-callback-test.ts @@ -9,7 +9,7 @@ import { TestCompilerCallbacks } from './TestCompilerCallbacks.js'; import { fileURLToPath } from 'url'; const readerOptions: LDMLKeyboardXMLSourceFileReaderOptions = { - importsPath: fileURLToPath(LDMLKeyboardXMLSourceFileReader.defaultImportsURL) + importsPath: fileURLToPath(new URL(...LDMLKeyboardXMLSourceFileReader.defaultImportsURL)) }; export interface CompilationCase { diff --git a/developer/src/kmc-ldml/test/helpers/index.ts b/developer/src/kmc-ldml/test/helpers/index.ts index db0704bf75..c919e729ac 100644 --- a/developer/src/kmc-ldml/test/helpers/index.ts +++ b/developer/src/kmc-ldml/test/helpers/index.ts @@ -37,7 +37,7 @@ export const compilerTestCallbacks = new TestCompilerCallbacks(); export const compilerTestOptions: LdmlCompilerOptions = { readerOptions: { - importsPath: fileURLToPath(LDMLKeyboardXMLSourceFileReader.defaultImportsURL) + importsPath: fileURLToPath(new URL(...LDMLKeyboardXMLSourceFileReader.defaultImportsURL)) } }; diff --git a/developer/src/kmc/src/commands/buildClasses/BuildLdmlKeyboard.ts b/developer/src/kmc/src/commands/buildClasses/BuildLdmlKeyboard.ts index 19db56db99..1b0c2b22e5 100644 --- a/developer/src/kmc/src/commands/buildClasses/BuildLdmlKeyboard.ts +++ b/developer/src/kmc/src/commands/buildClasses/BuildLdmlKeyboard.ts @@ -48,7 +48,7 @@ async function buildLdmlKeyboardToMemory(inputFilename: string, callbacks: Compi ...defaultCompilerOptions, ...options, readerOptions: { - importsPath: fileURLToPath(LDMLKeyboardXMLSourceFileReader.defaultImportsURL) + importsPath: fileURLToPath(new URL(...LDMLKeyboardXMLSourceFileReader.defaultImportsURL)) } }; diff --git a/developer/src/kmc/src/commands/buildTestData/index.ts b/developer/src/kmc/src/commands/buildTestData/index.ts index b50c63c1d6..65e9049edf 100644 --- a/developer/src/kmc/src/commands/buildTestData/index.ts +++ b/developer/src/kmc/src/commands/buildTestData/index.ts @@ -12,7 +12,7 @@ export function buildTestData(infile: string, options: CompilerBaseOptions) { saveDebug: false, shouldAddCompilerVersion: false, readerOptions: { - importsPath: fileURLToPath(LDMLKeyboardXMLSourceFileReader.defaultImportsURL) + importsPath: fileURLToPath(new URL(...LDMLKeyboardXMLSourceFileReader.defaultImportsURL)) } };