From 19f7e5353bf5e852924dca93b663de8fdae186fe Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Tue, 20 Sep 2022 06:49:56 +1000 Subject: [PATCH 1/2] =?UTF-8?q?chore(core):=20changes=20ldml=20tsconfig=20?= =?UTF-8?q?to=20es2020=20=F0=9F=99=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also splits the root tsconfig.json into tsconfig.cjs.json and tsconfig.esm.json. These are not typically used at present but in theory you could do a `tsc -b ` and build all modules. In practice, we still have some prebuild steps that make that a bit of a pain. --- core/include/ldml/tsconfig.json | 2 +- tsconfig.json => tsconfig.cjs.json | 16 +++------------- tsconfig.esm.json | 24 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 14 deletions(-) rename tsconfig.json => tsconfig.cjs.json (69%) create mode 100644 tsconfig.esm.json diff --git a/core/include/ldml/tsconfig.json b/core/include/ldml/tsconfig.json index f8a56d0687..b89c96a018 100644 --- a/core/include/ldml/tsconfig.json +++ b/core/include/ldml/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "composite": true, "declaration": true, - "module": "CommonJS", + "module": "es2020", "moduleResolution": "node", "rootDir": ".", "outDir": "build/", diff --git a/tsconfig.json b/tsconfig.cjs.json similarity index 69% rename from tsconfig.json rename to tsconfig.cjs.json index 139dbc98b3..1a342edea0 100644 --- a/tsconfig.json +++ b/tsconfig.cjs.json @@ -1,4 +1,7 @@ { + // Lists only CommonJS or 'none' modules; as we move modules from cjs/none to + // esm, we should move them from here into tsconfig.esm.json. Eventually, when + // we have only ES modules, we'll delete this file. "files": [], "include": [], "references": [ @@ -19,18 +22,6 @@ { "path": "./common/predictive-text/testing/two-stage-embedded-webworker/worker/tsconfig.json" }, { "path": "./common/predictive-text/tsconfig.json" }, - //{ "path": "./developer/src/kmc/test/tsconfig.json" }, - { "path": "./developer/src/kmc/tsconfig.json" }, - - { "path": "./developer/src/kmc-keyboard/test/tsconfig.json" }, - { "path": "./developer/src/kmc-keyboard/tsconfig.json" }, - { "path": "./developer/src/kmc-model/test/tsconfig.json" }, - { "path": "./developer/src/kmc-model/tsconfig.json" }, - //{ "path": "./developer/src/kmc-model-info/test/tsconfig.json" }, - { "path": "./developer/src/kmc-model-info/tsconfig.json" }, - { "path": "./developer/src/kmc-package/test/tsconfig.json" }, - { "path": "./developer/src/kmc-package/tsconfig.json" }, - { "path": "./developer/src/server/tsconfig.json" }, { "path": "./resources/build/version/tsconfig.json" }, @@ -44,6 +35,5 @@ { "path": "./common/web/lm-message-types/" }, { "path": "./common/web/lm-worker/" }, { "path": "./common/web/keyman-version/" }, - { "path": "./common/web/keyman-version/tsconfig.esm.json" }, ] } \ No newline at end of file diff --git a/tsconfig.esm.json b/tsconfig.esm.json new file mode 100644 index 0000000000..fa2cf77aeb --- /dev/null +++ b/tsconfig.esm.json @@ -0,0 +1,24 @@ +{ + // Lists only ES modules; as we move modules from cjs/none to esm, we should + // move them from tsconfig.cjs.json to here. Eventually, when we have only ES + // modules, we can rename this to tsconfig.json. + "files": [], + "include": [], + "references": [ + { "path": "./core/include/ldml/tsconfig.json" }, + + //{ "path": "./developer/src/kmc/test/tsconfig.json" }, + { "path": "./developer/src/kmc/tsconfig.json" }, + + { "path": "./developer/src/kmc-keyboard/test/tsconfig.json" }, + { "path": "./developer/src/kmc-keyboard/tsconfig.json" }, + { "path": "./developer/src/kmc-model/test/tsconfig.json" }, + { "path": "./developer/src/kmc-model/tsconfig.json" }, + //{ "path": "./developer/src/kmc-model-info/test/tsconfig.json" }, + { "path": "./developer/src/kmc-model-info/tsconfig.json" }, + { "path": "./developer/src/kmc-package/test/tsconfig.json" }, + { "path": "./developer/src/kmc-package/tsconfig.json" }, + + { "path": "./common/web/keyman-version/tsconfig.esm.json" }, + ] +} \ No newline at end of file From 9af8e1f9c2586d4ed4bed87d522715dd43812530 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Tue, 20 Sep 2022 08:01:22 +1000 Subject: [PATCH 2/2] chore(core): ldml-keyboard-constants module type to esm --- core/include/ldml/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/core/include/ldml/package.json b/core/include/ldml/package.json index 61b71870d9..d74a720d1e 100644 --- a/core/include/ldml/package.json +++ b/core/include/ldml/package.json @@ -8,6 +8,7 @@ "unicode" ], "license": "MIT", + "type": "module", "main": "build/keyboardprocessor_ldml.js", "repository": { "type": "git",