From 636ccaaebc04fdf481bb218907b1840a3fa706e3 Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Thu, 15 Feb 2024 14:11:43 +0100 Subject: [PATCH 01/24] Add babel script add-import-extension --- .config/babel/add-import-extension.js | 88 +++++++++++++++++++++++++++ babel.config.js | 4 +- 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 .config/babel/add-import-extension.js diff --git a/.config/babel/add-import-extension.js b/.config/babel/add-import-extension.js new file mode 100644 index 0000000000..e15e387de8 --- /dev/null +++ b/.config/babel/add-import-extension.js @@ -0,0 +1,88 @@ +const { existsSync, lstatSync } = require('fs'); +const { dirname, resolve } = require('path'); +const { types } = require('@babel/core'); +const { declare } = require('@babel/helper-plugin-utils'); + +const VALID_EXTENSIONS = ['js', 'mjs']; + +const hasExtension = moduleName => VALID_EXTENSIONS.some(ext => moduleName.endsWith(`.${ext}`)); +const isCoreJSPolyfill = moduleName => moduleName.startsWith('core-js'); +const isLocalModule = moduleName => moduleName.startsWith('.'); +const isProcessableModule = (moduleName) => { + return !hasExtension(moduleName) && (isCoreJSPolyfill(moduleName) || isLocalModule(moduleName)); +}; + +const createVisitor = ({ declaration, origArgs, extension = 'js' }) => { + return (path, { file }) => { + const { node: { source, exportKind, importKind } } = path; + const { opts: { filename } } = file; + const isTypeOnly = exportKind === 'type' || importKind === 'type'; + + if (!source || isTypeOnly || !isProcessableModule(source.value)) { + return; + } + + const { value: moduleName } = source; + const absoluteFilePath = resolve(dirname(filename), moduleName); + const finalExtension = isCoreJSPolyfill(moduleName) ? 'js' : extension; + + let newModulePath; + + // Resolves a case where "import" points to a module name which exists as a file and + // as a directory. For example in this case: + // ``` + // import { registerPlugin } from 'plugins'; + // ``` + // and with this directory structure: + // |- editors + // |- plugins + // |- filters/ + // |- ... + // +- index.js + // |- plugins.js + // |- ... + // +- index.js + // + // the plugin will rename import declaration to point to the `plugins.js` file. + if (existsSync(`${absoluteFilePath}.js`)) { + newModulePath = `${moduleName}.${finalExtension}`; + + // In a case when the file doesn't exist and the module is a directory it will + // rename to `plugins/index.js`. + } else if (existsSync(absoluteFilePath) && lstatSync(absoluteFilePath).isDirectory()) { + newModulePath = `${moduleName}/index.${finalExtension}`; + + // And for other cases it simply put the extension on the end of the module path + } else { + newModulePath = `${moduleName}.${finalExtension}`; + } + + path.replaceWith(declaration(...origArgs(path), types.stringLiteral(newModulePath))); + }; +}; + +module.exports = declare((api, options) => { + api.assertVersion(7); + + return { + name: 'add-import-extension', + visitor: { + // It covers default and named imports + ImportDeclaration: createVisitor({ + extension: options.extension, + declaration: types.importDeclaration, + origArgs: ({ node: { specifiers } }) => [specifiers], + }), + ExportNamedDeclaration: createVisitor({ + extension: options.extension, + declaration: types.exportNamedDeclaration, + origArgs: ({ node: { declaration, specifiers } }) => [declaration, specifiers], + }), + ExportAllDeclaration: createVisitor({ + extension: options.extension, + declaration: types.exportAllDeclaration, + origArgs: () => [], + }), + } + }; +}); \ No newline at end of file diff --git a/babel.config.js b/babel.config.js index e7a33d37d2..a0e3a56676 100644 --- a/babel.config.js +++ b/babel.config.js @@ -31,7 +31,9 @@ module.exports = { }, // Environment for transpiling files to be compatible with ES Modules. es: { - plugins: [], + plugins: [ + ['./.config/babel/add-import-extension.js', { extension: 'mjs' }], + ], }, }, }; From c09c336809684d98d9eb805c39c92d14a554225d Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Thu, 15 Feb 2024 14:12:21 +0100 Subject: [PATCH 02/24] Adjust check-publish-package script to new way of building ES --- script/check-publish-package.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/check-publish-package.js b/script/check-publish-package.js index 20fa55e28b..1a684f4814 100644 --- a/script/check-publish-package.js +++ b/script/check-publish-package.js @@ -29,12 +29,12 @@ const FILES_CHECKLIST = [ 'commonjs/index.js', 'commonjs/HyperFormula.js', 'dist/hyperformula.js', - 'es/index.js', - 'es/HyperFormula.js', + 'es/index.mjs', + 'es/HyperFormula.mjs', 'typings/index.d.ts', 'typings/HyperFormula.d.ts', 'dist/languages/plPL.js', - 'es/i18n/languages/plPL.js', + 'es/i18n/languages/plPL.mjs', 'commonjs/i18n/languages/plPL.js', ] From 1ba600902a6fec9001092a870ee27894fd3ae8de Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Thu, 15 Feb 2024 14:12:46 +0100 Subject: [PATCH 03/24] Make babel output ES build with mjs extensions --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ec000b1378..41a35cf4ea 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "docs:dev": "npm run typedoc:build-api && vuepress dev docs --silent --no-clear-screen --no-cache", "docs:build": "npm run bundle-all && npm run typedoc:build-api && vuepress build docs", "bundle-all": "cross-env HF_COMPILE=1 npm-run-all clean compile bundle:** verify-bundles", - "bundle:es": "(node script/if-ne-env.js HF_COMPILE=1 || npm run compile) && cross-env-shell BABEL_ENV=es env-cmd -f ht.config.js babel lib --out-dir es", + "bundle:es": "(node script/if-ne-env.js HF_COMPILE=1 || npm run compile) && cross-env-shell BABEL_ENV=es env-cmd -f ht.config.js babel lib --out-file-extension .mjs --out-dir es", "bundle:cjs": "(node script/if-ne-env.js HF_COMPILE=1 || npm run compile) && cross-env-shell BABEL_ENV=commonjs env-cmd -f ht.config.js babel lib --out-dir commonjs", "bundle:development": "(node script/if-ne-env.js HF_COMPILE=1 || npm run compile) && cross-env-shell BABEL_ENV=dist NODE_ENV=development env-cmd -f ht.config.js webpack ./lib/index.js", "bundle:production": "(node script/if-ne-env.js HF_COMPILE=1 || npm run compile) && cross-env-shell BABEL_ENV=dist NODE_ENV=production env-cmd -f ht.config.js webpack ./lib/index.js", From 2dc845f5f99f136971b6ed63f591b6dd8165a46c Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Thu, 15 Feb 2024 14:28:17 +0100 Subject: [PATCH 04/24] Add exports property to package.json --- package.json | 285 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 282 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 41a35cf4ea..19f843b033 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,10 @@ "check:licenses": "license-checker --production --excludePackages=\"hyperformula@0.0.1\" --onlyAllow=\"MIT; Apache-2.0; BSD-3-Clause; BSD-2-Clause; ISC; BSD; Unlicense\"", "tsnode": "ts-node --transpile-only -O {\\\"module\\\":\\\"commonjs\\\"}" }, + "dependencies": { + "chevrotain": "^6.5.0", + "tiny-emitter": "^2.1.0" + }, "devDependencies": { "@babel/cli": "^7.8.4", "@babel/core": "^7.8.4", @@ -154,8 +158,283 @@ "webpack-cli": "^3.3.11", "webpackbar": "^4.0.0" }, - "dependencies": { - "chevrotain": "^6.5.0", - "tiny-emitter": "^2.1.0" + "exports": { + ".": { + "import": "./es/index.mjs", + "require": "./commonjs/index.js", + "types": "./typings/index.d.ts" + }, + "./i18n/csCZ": { + "import": "./es/i18n/languages/csCZ.mjs", + "require": "./commonjs/i18n/languages/csCZ", + "types": "./typings/i18n/languages/csCZ" + }, + "./es/i18n/languages/csCZ": { + "import": "./es/i18n/languages/csCZ.mjs", + "require": "./commonjs/i18n/languages/csCZ", + "types": "./typings/i18n/languages/csCZ" + }, + "./commonjs/i18n/languages/csCZ": { + "import": "./es/i18n/languages/csCZ.mjs", + "require": "./commonjs/i18n/languages/csCZ", + "types": "./typings/i18n/languages/csCZ" + }, + "./hyperformula/dist/languages/csCZ": "./hyperformula/dist/languages/csCZ", + "./i18n/daDK": { + "import": "./es/i18n/languages/daDK.mjs", + "require": "./commonjs/i18n/languages/daDK", + "types": "./typings/i18n/languages/daDK" + }, + "./es/i18n/languages/daDK": { + "import": "./es/i18n/languages/daDK.mjs", + "require": "./commonjs/i18n/languages/daDK", + "types": "./typings/i18n/languages/daDK" + }, + "./commonjs/i18n/languages/daDK": { + "import": "./es/i18n/languages/daDK.mjs", + "require": "./commonjs/i18n/languages/daDK", + "types": "./typings/i18n/languages/daDK" + }, + "./hyperformula/dist/languages/daDK": "./hyperformula/dist/languages/daDK", + "./i18n/deDE": { + "import": "./es/i18n/languages/deDE.mjs", + "require": "./commonjs/i18n/languages/deDE", + "types": "./typings/i18n/languages/deDE" + }, + "./es/i18n/languages/deDE": { + "import": "./es/i18n/languages/deDE.mjs", + "require": "./commonjs/i18n/languages/deDE", + "types": "./typings/i18n/languages/deDE" + }, + "./commonjs/i18n/languages/deDE": { + "import": "./es/i18n/languages/deDE.mjs", + "require": "./commonjs/i18n/languages/deDE", + "types": "./typings/i18n/languages/deDE" + }, + "./hyperformula/dist/languages/deDE": "./hyperformula/dist/languages/deDE", + "./i18n/enGB": { + "import": "./es/i18n/languages/enGB.mjs", + "require": "./commonjs/i18n/languages/enGB", + "types": "./typings/i18n/languages/enGB" + }, + "./es/i18n/languages/enGB": { + "import": "./es/i18n/languages/enGB.mjs", + "require": "./commonjs/i18n/languages/enGB", + "types": "./typings/i18n/languages/enGB" + }, + "./commonjs/i18n/languages/enGB": { + "import": "./es/i18n/languages/enGB.mjs", + "require": "./commonjs/i18n/languages/enGB", + "types": "./typings/i18n/languages/enGB" + }, + "./hyperformula/dist/languages/enGB": "./hyperformula/dist/languages/enGB", + "./i18n/enUS": { + "import": "./es/i18n/languages/enUS.mjs", + "require": "./commonjs/i18n/languages/enUS", + "types": "./typings/i18n/languages/enUS" + }, + "./es/i18n/languages/enUS": { + "import": "./es/i18n/languages/enUS.mjs", + "require": "./commonjs/i18n/languages/enUS", + "types": "./typings/i18n/languages/enUS" + }, + "./commonjs/i18n/languages/enUS": { + "import": "./es/i18n/languages/enUS.mjs", + "require": "./commonjs/i18n/languages/enUS", + "types": "./typings/i18n/languages/enUS" + }, + "./hyperformula/dist/languages/enUS": "./hyperformula/dist/languages/enUS", + "./i18n/esES": { + "import": "./es/i18n/languages/esES.mjs", + "require": "./commonjs/i18n/languages/esES", + "types": "./typings/i18n/languages/esES" + }, + "./es/i18n/languages/esES": { + "import": "./es/i18n/languages/esES.mjs", + "require": "./commonjs/i18n/languages/esES", + "types": "./typings/i18n/languages/esES" + }, + "./commonjs/i18n/languages/esES": { + "import": "./es/i18n/languages/esES.mjs", + "require": "./commonjs/i18n/languages/esES", + "types": "./typings/i18n/languages/esES" + }, + "./hyperformula/dist/languages/esES": "./hyperformula/dist/languages/esES", + "./i18n/fiFI": { + "import": "./es/i18n/languages/fiFI.mjs", + "require": "./commonjs/i18n/languages/fiFI", + "types": "./typings/i18n/languages/fiFI" + }, + "./es/i18n/languages/fiFI": { + "import": "./es/i18n/languages/fiFI.mjs", + "require": "./commonjs/i18n/languages/fiFI", + "types": "./typings/i18n/languages/fiFI" + }, + "./commonjs/i18n/languages/fiFI": { + "import": "./es/i18n/languages/fiFI.mjs", + "require": "./commonjs/i18n/languages/fiFI", + "types": "./typings/i18n/languages/fiFI" + }, + "./hyperformula/dist/languages/fiFI": "./hyperformula/dist/languages/fiFI", + "./i18n/frFR": { + "import": "./es/i18n/languages/frFR.mjs", + "require": "./commonjs/i18n/languages/frFR", + "types": "./typings/i18n/languages/frFR" + }, + "./es/i18n/languages/frFR": { + "import": "./es/i18n/languages/frFR.mjs", + "require": "./commonjs/i18n/languages/frFR", + "types": "./typings/i18n/languages/frFR" + }, + "./commonjs/i18n/languages/frFR": { + "import": "./es/i18n/languages/frFR.mjs", + "require": "./commonjs/i18n/languages/frFR", + "types": "./typings/i18n/languages/frFR" + }, + "./hyperformula/dist/languages/frFR": "./hyperformula/dist/languages/frFR", + "./i18n/huHU": { + "import": "./es/i18n/languages/huHU.mjs", + "require": "./commonjs/i18n/languages/huHU", + "types": "./typings/i18n/languages/huHU" + }, + "./es/i18n/languages/huHU": { + "import": "./es/i18n/languages/huHU.mjs", + "require": "./commonjs/i18n/languages/huHU", + "types": "./typings/i18n/languages/huHU" + }, + "./commonjs/i18n/languages/huHU": { + "import": "./es/i18n/languages/huHU.mjs", + "require": "./commonjs/i18n/languages/huHU", + "types": "./typings/i18n/languages/huHU" + }, + "./hyperformula/dist/languages/huHU": "./hyperformula/dist/languages/huHU", + "./i18n/itIT": { + "import": "./es/i18n/languages/itIT.mjs", + "require": "./commonjs/i18n/languages/itIT", + "types": "./typings/i18n/languages/itIT" + }, + "./es/i18n/languages/itIT": { + "import": "./es/i18n/languages/itIT.mjs", + "require": "./commonjs/i18n/languages/itIT", + "types": "./typings/i18n/languages/itIT" + }, + "./commonjs/i18n/languages/itIT": { + "import": "./es/i18n/languages/itIT.mjs", + "require": "./commonjs/i18n/languages/itIT", + "types": "./typings/i18n/languages/itIT" + }, + "./hyperformula/dist/languages/itIT": "./hyperformula/dist/languages/itIT", + "./i18n/nbNO": { + "import": "./es/i18n/languages/nbNO.mjs", + "require": "./commonjs/i18n/languages/nbNO", + "types": "./typings/i18n/languages/nbNO" + }, + "./es/i18n/languages/nbNO": { + "import": "./es/i18n/languages/nbNO.mjs", + "require": "./commonjs/i18n/languages/nbNO", + "types": "./typings/i18n/languages/nbNO" + }, + "./commonjs/i18n/languages/nbNO": { + "import": "./es/i18n/languages/nbNO.mjs", + "require": "./commonjs/i18n/languages/nbNO", + "types": "./typings/i18n/languages/nbNO" + }, + "./hyperformula/dist/languages/nbNO": "./hyperformula/dist/languages/nbNO", + "./i18n/nlNL": { + "import": "./es/i18n/languages/nlNL.mjs", + "require": "./commonjs/i18n/languages/nlNL", + "types": "./typings/i18n/languages/nlNL" + }, + "./es/i18n/languages/nlNL": { + "import": "./es/i18n/languages/nlNL.mjs", + "require": "./commonjs/i18n/languages/nlNL", + "types": "./typings/i18n/languages/nlNL" + }, + "./commonjs/i18n/languages/nlNL": { + "import": "./es/i18n/languages/nlNL.mjs", + "require": "./commonjs/i18n/languages/nlNL", + "types": "./typings/i18n/languages/nlNL" + }, + "./hyperformula/dist/languages/nlNL": "./hyperformula/dist/languages/nlNL", + "./i18n/plPL": { + "import": "./es/i18n/languages/plPL.mjs", + "require": "./commonjs/i18n/languages/plPL", + "types": "./typings/i18n/languages/plPL" + }, + "./es/i18n/languages/plPL": { + "import": "./es/i18n/languages/plPL.mjs", + "require": "./commonjs/i18n/languages/plPL", + "types": "./typings/i18n/languages/plPL" + }, + "./commonjs/i18n/languages/plPL": { + "import": "./es/i18n/languages/plPL.mjs", + "require": "./commonjs/i18n/languages/plPL", + "types": "./typings/i18n/languages/plPL" + }, + "./hyperformula/dist/languages/plPL": "./hyperformula/dist/languages/plPL", + "./i18n/ptPT": { + "import": "./es/i18n/languages/ptPT.mjs", + "require": "./commonjs/i18n/languages/ptPT", + "types": "./typings/i18n/languages/ptPT" + }, + "./es/i18n/languages/ptPT": { + "import": "./es/i18n/languages/ptPT.mjs", + "require": "./commonjs/i18n/languages/ptPT", + "types": "./typings/i18n/languages/ptPT" + }, + "./commonjs/i18n/languages/ptPT": { + "import": "./es/i18n/languages/ptPT.mjs", + "require": "./commonjs/i18n/languages/ptPT", + "types": "./typings/i18n/languages/ptPT" + }, + "./hyperformula/dist/languages/ptPT": "./hyperformula/dist/languages/ptPT", + "./i18n/ruRU": { + "import": "./es/i18n/languages/ruRU.mjs", + "require": "./commonjs/i18n/languages/ruRU", + "types": "./typings/i18n/languages/ruRU" + }, + "./es/i18n/languages/ruRU": { + "import": "./es/i18n/languages/ruRU.mjs", + "require": "./commonjs/i18n/languages/ruRU", + "types": "./typings/i18n/languages/ruRU" + }, + "./commonjs/i18n/languages/ruRU": { + "import": "./es/i18n/languages/ruRU.mjs", + "require": "./commonjs/i18n/languages/ruRU", + "types": "./typings/i18n/languages/ruRU" + }, + "./hyperformula/dist/languages/ruRU": "./hyperformula/dist/languages/ruRU", + "./i18n/svSE": { + "import": "./es/i18n/languages/svSE.mjs", + "require": "./commonjs/i18n/languages/svSE", + "types": "./typings/i18n/languages/svSE" + }, + "./es/i18n/languages/svSE": { + "import": "./es/i18n/languages/svSE.mjs", + "require": "./commonjs/i18n/languages/svSE", + "types": "./typings/i18n/languages/svSE" + }, + "./commonjs/i18n/languages/svSE": { + "import": "./es/i18n/languages/svSE.mjs", + "require": "./commonjs/i18n/languages/svSE", + "types": "./typings/i18n/languages/svSE" + }, + "./hyperformula/dist/languages/svSE": "./hyperformula/dist/languages/svSE", + "./i18n/trTR": { + "import": "./es/i18n/languages/trTR.mjs", + "require": "./commonjs/i18n/languages/trTR", + "types": "./typings/i18n/languages/trTR" + }, + "./es/i18n/languages/trTR": { + "import": "./es/i18n/languages/trTR.mjs", + "require": "./commonjs/i18n/languages/trTR", + "types": "./typings/i18n/languages/trTR" + }, + "./commonjs/i18n/languages/trTR": { + "import": "./es/i18n/languages/trTR.mjs", + "require": "./commonjs/i18n/languages/trTR", + "types": "./typings/i18n/languages/trTR" + }, + "./hyperformula/dist/languages/trTR": "./hyperformula/dist/languages/trTR" } } From bdbc35e6b65c9c6a8f4c0bca1ceec470d2caad1b Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Thu, 15 Feb 2024 15:01:57 +0100 Subject: [PATCH 05/24] Fix the exports property --- package.json | 238 +++++++++++++++++++++++++-------------------------- 1 file changed, 119 insertions(+), 119 deletions(-) diff --git a/package.json b/package.json index 19f843b033..fe93e2f5e2 100644 --- a/package.json +++ b/package.json @@ -166,275 +166,275 @@ }, "./i18n/csCZ": { "import": "./es/i18n/languages/csCZ.mjs", - "require": "./commonjs/i18n/languages/csCZ", - "types": "./typings/i18n/languages/csCZ" + "require": "./commonjs/i18n/languages/csCZ.js", + "types": "./typings/i18n/languages/csCZ.d.ts" }, "./es/i18n/languages/csCZ": { "import": "./es/i18n/languages/csCZ.mjs", - "require": "./commonjs/i18n/languages/csCZ", - "types": "./typings/i18n/languages/csCZ" + "require": "./commonjs/i18n/languages/csCZ.js", + "types": "./typings/i18n/languages/csCZ.d.ts" }, "./commonjs/i18n/languages/csCZ": { "import": "./es/i18n/languages/csCZ.mjs", - "require": "./commonjs/i18n/languages/csCZ", - "types": "./typings/i18n/languages/csCZ" + "require": "./commonjs/i18n/languages/csCZ.js", + "types": "./typings/i18n/languages/csCZ.d.ts" }, - "./hyperformula/dist/languages/csCZ": "./hyperformula/dist/languages/csCZ", + "./hyperformula/dist/languages/csCZ.js": "./hyperformula/dist/languages/csCZ.js", "./i18n/daDK": { "import": "./es/i18n/languages/daDK.mjs", - "require": "./commonjs/i18n/languages/daDK", - "types": "./typings/i18n/languages/daDK" + "require": "./commonjs/i18n/languages/daDK.js", + "types": "./typings/i18n/languages/daDK.d.ts" }, "./es/i18n/languages/daDK": { "import": "./es/i18n/languages/daDK.mjs", - "require": "./commonjs/i18n/languages/daDK", - "types": "./typings/i18n/languages/daDK" + "require": "./commonjs/i18n/languages/daDK.js", + "types": "./typings/i18n/languages/daDK.d.ts" }, "./commonjs/i18n/languages/daDK": { "import": "./es/i18n/languages/daDK.mjs", - "require": "./commonjs/i18n/languages/daDK", - "types": "./typings/i18n/languages/daDK" + "require": "./commonjs/i18n/languages/daDK.js", + "types": "./typings/i18n/languages/daDK.d.ts" }, - "./hyperformula/dist/languages/daDK": "./hyperformula/dist/languages/daDK", + "./hyperformula/dist/languages/daDK.js": "./hyperformula/dist/languages/daDK.js", "./i18n/deDE": { "import": "./es/i18n/languages/deDE.mjs", - "require": "./commonjs/i18n/languages/deDE", - "types": "./typings/i18n/languages/deDE" + "require": "./commonjs/i18n/languages/deDE.js", + "types": "./typings/i18n/languages/deDE.d.ts" }, "./es/i18n/languages/deDE": { "import": "./es/i18n/languages/deDE.mjs", - "require": "./commonjs/i18n/languages/deDE", - "types": "./typings/i18n/languages/deDE" + "require": "./commonjs/i18n/languages/deDE.js", + "types": "./typings/i18n/languages/deDE.d.ts" }, "./commonjs/i18n/languages/deDE": { "import": "./es/i18n/languages/deDE.mjs", - "require": "./commonjs/i18n/languages/deDE", - "types": "./typings/i18n/languages/deDE" + "require": "./commonjs/i18n/languages/deDE.js", + "types": "./typings/i18n/languages/deDE.d.ts" }, - "./hyperformula/dist/languages/deDE": "./hyperformula/dist/languages/deDE", + "./hyperformula/dist/languages/deDE.js": "./hyperformula/dist/languages/deDE.js", "./i18n/enGB": { "import": "./es/i18n/languages/enGB.mjs", - "require": "./commonjs/i18n/languages/enGB", - "types": "./typings/i18n/languages/enGB" + "require": "./commonjs/i18n/languages/enGB.js", + "types": "./typings/i18n/languages/enGB.d.ts" }, "./es/i18n/languages/enGB": { "import": "./es/i18n/languages/enGB.mjs", - "require": "./commonjs/i18n/languages/enGB", - "types": "./typings/i18n/languages/enGB" + "require": "./commonjs/i18n/languages/enGB.js", + "types": "./typings/i18n/languages/enGB.d.ts" }, "./commonjs/i18n/languages/enGB": { "import": "./es/i18n/languages/enGB.mjs", - "require": "./commonjs/i18n/languages/enGB", - "types": "./typings/i18n/languages/enGB" + "require": "./commonjs/i18n/languages/enGB.js", + "types": "./typings/i18n/languages/enGB.d.ts" }, - "./hyperformula/dist/languages/enGB": "./hyperformula/dist/languages/enGB", + "./hyperformula/dist/languages/enGB.js": "./hyperformula/dist/languages/enGB.js", "./i18n/enUS": { "import": "./es/i18n/languages/enUS.mjs", - "require": "./commonjs/i18n/languages/enUS", - "types": "./typings/i18n/languages/enUS" + "require": "./commonjs/i18n/languages/enUS.js", + "types": "./typings/i18n/languages/enUS.d.ts" }, "./es/i18n/languages/enUS": { "import": "./es/i18n/languages/enUS.mjs", - "require": "./commonjs/i18n/languages/enUS", - "types": "./typings/i18n/languages/enUS" + "require": "./commonjs/i18n/languages/enUS.js", + "types": "./typings/i18n/languages/enUS.d.ts" }, "./commonjs/i18n/languages/enUS": { "import": "./es/i18n/languages/enUS.mjs", - "require": "./commonjs/i18n/languages/enUS", - "types": "./typings/i18n/languages/enUS" + "require": "./commonjs/i18n/languages/enUS.js", + "types": "./typings/i18n/languages/enUS.d.ts" }, - "./hyperformula/dist/languages/enUS": "./hyperformula/dist/languages/enUS", + "./hyperformula/dist/languages/enUS.js": "./hyperformula/dist/languages/enUS.js", "./i18n/esES": { "import": "./es/i18n/languages/esES.mjs", - "require": "./commonjs/i18n/languages/esES", - "types": "./typings/i18n/languages/esES" + "require": "./commonjs/i18n/languages/esES.js", + "types": "./typings/i18n/languages/esES.d.ts" }, "./es/i18n/languages/esES": { "import": "./es/i18n/languages/esES.mjs", - "require": "./commonjs/i18n/languages/esES", - "types": "./typings/i18n/languages/esES" + "require": "./commonjs/i18n/languages/esES.js", + "types": "./typings/i18n/languages/esES.d.ts" }, "./commonjs/i18n/languages/esES": { "import": "./es/i18n/languages/esES.mjs", - "require": "./commonjs/i18n/languages/esES", - "types": "./typings/i18n/languages/esES" + "require": "./commonjs/i18n/languages/esES.js", + "types": "./typings/i18n/languages/esES.d.ts" }, - "./hyperformula/dist/languages/esES": "./hyperformula/dist/languages/esES", + "./hyperformula/dist/languages/esES.js": "./hyperformula/dist/languages/esES.js", "./i18n/fiFI": { "import": "./es/i18n/languages/fiFI.mjs", - "require": "./commonjs/i18n/languages/fiFI", - "types": "./typings/i18n/languages/fiFI" + "require": "./commonjs/i18n/languages/fiFI.js", + "types": "./typings/i18n/languages/fiFI.d.ts" }, "./es/i18n/languages/fiFI": { "import": "./es/i18n/languages/fiFI.mjs", - "require": "./commonjs/i18n/languages/fiFI", - "types": "./typings/i18n/languages/fiFI" + "require": "./commonjs/i18n/languages/fiFI.js", + "types": "./typings/i18n/languages/fiFI.d.ts" }, "./commonjs/i18n/languages/fiFI": { "import": "./es/i18n/languages/fiFI.mjs", - "require": "./commonjs/i18n/languages/fiFI", - "types": "./typings/i18n/languages/fiFI" + "require": "./commonjs/i18n/languages/fiFI.js", + "types": "./typings/i18n/languages/fiFI.d.ts" }, - "./hyperformula/dist/languages/fiFI": "./hyperformula/dist/languages/fiFI", + "./hyperformula/dist/languages/fiFI.js": "./hyperformula/dist/languages/fiFI.js", "./i18n/frFR": { "import": "./es/i18n/languages/frFR.mjs", - "require": "./commonjs/i18n/languages/frFR", - "types": "./typings/i18n/languages/frFR" + "require": "./commonjs/i18n/languages/frFR.js", + "types": "./typings/i18n/languages/frFR.d.ts" }, "./es/i18n/languages/frFR": { "import": "./es/i18n/languages/frFR.mjs", - "require": "./commonjs/i18n/languages/frFR", - "types": "./typings/i18n/languages/frFR" + "require": "./commonjs/i18n/languages/frFR.js", + "types": "./typings/i18n/languages/frFR.d.ts" }, "./commonjs/i18n/languages/frFR": { "import": "./es/i18n/languages/frFR.mjs", - "require": "./commonjs/i18n/languages/frFR", - "types": "./typings/i18n/languages/frFR" + "require": "./commonjs/i18n/languages/frFR.js", + "types": "./typings/i18n/languages/frFR.d.ts" }, - "./hyperformula/dist/languages/frFR": "./hyperformula/dist/languages/frFR", + "./hyperformula/dist/languages/frFR.js": "./hyperformula/dist/languages/frFR.js", "./i18n/huHU": { "import": "./es/i18n/languages/huHU.mjs", - "require": "./commonjs/i18n/languages/huHU", - "types": "./typings/i18n/languages/huHU" + "require": "./commonjs/i18n/languages/huHU.js", + "types": "./typings/i18n/languages/huHU.d.ts" }, "./es/i18n/languages/huHU": { "import": "./es/i18n/languages/huHU.mjs", - "require": "./commonjs/i18n/languages/huHU", - "types": "./typings/i18n/languages/huHU" + "require": "./commonjs/i18n/languages/huHU.js", + "types": "./typings/i18n/languages/huHU.d.ts" }, "./commonjs/i18n/languages/huHU": { "import": "./es/i18n/languages/huHU.mjs", - "require": "./commonjs/i18n/languages/huHU", - "types": "./typings/i18n/languages/huHU" + "require": "./commonjs/i18n/languages/huHU.js", + "types": "./typings/i18n/languages/huHU.d.ts" }, - "./hyperformula/dist/languages/huHU": "./hyperformula/dist/languages/huHU", + "./hyperformula/dist/languages/huHU.js": "./hyperformula/dist/languages/huHU.js", "./i18n/itIT": { "import": "./es/i18n/languages/itIT.mjs", - "require": "./commonjs/i18n/languages/itIT", - "types": "./typings/i18n/languages/itIT" + "require": "./commonjs/i18n/languages/itIT.js", + "types": "./typings/i18n/languages/itIT.d.ts" }, "./es/i18n/languages/itIT": { "import": "./es/i18n/languages/itIT.mjs", - "require": "./commonjs/i18n/languages/itIT", - "types": "./typings/i18n/languages/itIT" + "require": "./commonjs/i18n/languages/itIT.js", + "types": "./typings/i18n/languages/itIT.d.ts" }, "./commonjs/i18n/languages/itIT": { "import": "./es/i18n/languages/itIT.mjs", - "require": "./commonjs/i18n/languages/itIT", - "types": "./typings/i18n/languages/itIT" + "require": "./commonjs/i18n/languages/itIT.js", + "types": "./typings/i18n/languages/itIT.d.ts" }, - "./hyperformula/dist/languages/itIT": "./hyperformula/dist/languages/itIT", + "./hyperformula/dist/languages/itIT.js": "./hyperformula/dist/languages/itIT.js", "./i18n/nbNO": { "import": "./es/i18n/languages/nbNO.mjs", - "require": "./commonjs/i18n/languages/nbNO", - "types": "./typings/i18n/languages/nbNO" + "require": "./commonjs/i18n/languages/nbNO.js", + "types": "./typings/i18n/languages/nbNO.d.ts" }, "./es/i18n/languages/nbNO": { "import": "./es/i18n/languages/nbNO.mjs", - "require": "./commonjs/i18n/languages/nbNO", - "types": "./typings/i18n/languages/nbNO" + "require": "./commonjs/i18n/languages/nbNO.js", + "types": "./typings/i18n/languages/nbNO.d.ts" }, "./commonjs/i18n/languages/nbNO": { "import": "./es/i18n/languages/nbNO.mjs", - "require": "./commonjs/i18n/languages/nbNO", - "types": "./typings/i18n/languages/nbNO" + "require": "./commonjs/i18n/languages/nbNO.js", + "types": "./typings/i18n/languages/nbNO.d.ts" }, - "./hyperformula/dist/languages/nbNO": "./hyperformula/dist/languages/nbNO", + "./hyperformula/dist/languages/nbNO.js": "./hyperformula/dist/languages/nbNO.js", "./i18n/nlNL": { "import": "./es/i18n/languages/nlNL.mjs", - "require": "./commonjs/i18n/languages/nlNL", - "types": "./typings/i18n/languages/nlNL" + "require": "./commonjs/i18n/languages/nlNL.js", + "types": "./typings/i18n/languages/nlNL.d.ts" }, "./es/i18n/languages/nlNL": { "import": "./es/i18n/languages/nlNL.mjs", - "require": "./commonjs/i18n/languages/nlNL", - "types": "./typings/i18n/languages/nlNL" + "require": "./commonjs/i18n/languages/nlNL.js", + "types": "./typings/i18n/languages/nlNL.d.ts" }, "./commonjs/i18n/languages/nlNL": { "import": "./es/i18n/languages/nlNL.mjs", - "require": "./commonjs/i18n/languages/nlNL", - "types": "./typings/i18n/languages/nlNL" + "require": "./commonjs/i18n/languages/nlNL.js", + "types": "./typings/i18n/languages/nlNL.d.ts" }, - "./hyperformula/dist/languages/nlNL": "./hyperformula/dist/languages/nlNL", + "./hyperformula/dist/languages/nlNL.js": "./hyperformula/dist/languages/nlNL.js", "./i18n/plPL": { "import": "./es/i18n/languages/plPL.mjs", - "require": "./commonjs/i18n/languages/plPL", - "types": "./typings/i18n/languages/plPL" + "require": "./commonjs/i18n/languages/plPL.js", + "types": "./typings/i18n/languages/plPL.d.ts" }, "./es/i18n/languages/plPL": { "import": "./es/i18n/languages/plPL.mjs", - "require": "./commonjs/i18n/languages/plPL", - "types": "./typings/i18n/languages/plPL" + "require": "./commonjs/i18n/languages/plPL.js", + "types": "./typings/i18n/languages/plPL.d.ts" }, "./commonjs/i18n/languages/plPL": { "import": "./es/i18n/languages/plPL.mjs", - "require": "./commonjs/i18n/languages/plPL", - "types": "./typings/i18n/languages/plPL" + "require": "./commonjs/i18n/languages/plPL.js", + "types": "./typings/i18n/languages/plPL.d.ts" }, - "./hyperformula/dist/languages/plPL": "./hyperformula/dist/languages/plPL", + "./hyperformula/dist/languages/plPL.js": "./hyperformula/dist/languages/plPL.js", "./i18n/ptPT": { "import": "./es/i18n/languages/ptPT.mjs", - "require": "./commonjs/i18n/languages/ptPT", - "types": "./typings/i18n/languages/ptPT" + "require": "./commonjs/i18n/languages/ptPT.js", + "types": "./typings/i18n/languages/ptPT.d.ts" }, "./es/i18n/languages/ptPT": { "import": "./es/i18n/languages/ptPT.mjs", - "require": "./commonjs/i18n/languages/ptPT", - "types": "./typings/i18n/languages/ptPT" + "require": "./commonjs/i18n/languages/ptPT.js", + "types": "./typings/i18n/languages/ptPT.d.ts" }, "./commonjs/i18n/languages/ptPT": { "import": "./es/i18n/languages/ptPT.mjs", - "require": "./commonjs/i18n/languages/ptPT", - "types": "./typings/i18n/languages/ptPT" + "require": "./commonjs/i18n/languages/ptPT.js", + "types": "./typings/i18n/languages/ptPT.d.ts" }, - "./hyperformula/dist/languages/ptPT": "./hyperformula/dist/languages/ptPT", + "./hyperformula/dist/languages/ptPT.js": "./hyperformula/dist/languages/ptPT.js", "./i18n/ruRU": { "import": "./es/i18n/languages/ruRU.mjs", - "require": "./commonjs/i18n/languages/ruRU", - "types": "./typings/i18n/languages/ruRU" + "require": "./commonjs/i18n/languages/ruRU.js", + "types": "./typings/i18n/languages/ruRU.d.ts" }, "./es/i18n/languages/ruRU": { "import": "./es/i18n/languages/ruRU.mjs", - "require": "./commonjs/i18n/languages/ruRU", - "types": "./typings/i18n/languages/ruRU" + "require": "./commonjs/i18n/languages/ruRU.js", + "types": "./typings/i18n/languages/ruRU.d.ts" }, "./commonjs/i18n/languages/ruRU": { "import": "./es/i18n/languages/ruRU.mjs", - "require": "./commonjs/i18n/languages/ruRU", - "types": "./typings/i18n/languages/ruRU" + "require": "./commonjs/i18n/languages/ruRU.js", + "types": "./typings/i18n/languages/ruRU.d.ts" }, - "./hyperformula/dist/languages/ruRU": "./hyperformula/dist/languages/ruRU", + "./hyperformula/dist/languages/ruRU.js": "./hyperformula/dist/languages/ruRU.js", "./i18n/svSE": { "import": "./es/i18n/languages/svSE.mjs", - "require": "./commonjs/i18n/languages/svSE", - "types": "./typings/i18n/languages/svSE" + "require": "./commonjs/i18n/languages/svSE.js", + "types": "./typings/i18n/languages/svSE.d.ts" }, "./es/i18n/languages/svSE": { "import": "./es/i18n/languages/svSE.mjs", - "require": "./commonjs/i18n/languages/svSE", - "types": "./typings/i18n/languages/svSE" + "require": "./commonjs/i18n/languages/svSE.js", + "types": "./typings/i18n/languages/svSE.d.ts" }, "./commonjs/i18n/languages/svSE": { "import": "./es/i18n/languages/svSE.mjs", - "require": "./commonjs/i18n/languages/svSE", - "types": "./typings/i18n/languages/svSE" + "require": "./commonjs/i18n/languages/svSE.js", + "types": "./typings/i18n/languages/svSE.d.ts" }, - "./hyperformula/dist/languages/svSE": "./hyperformula/dist/languages/svSE", + "./hyperformula/dist/languages/svSE.js": "./hyperformula/dist/languages/svSE.js", "./i18n/trTR": { "import": "./es/i18n/languages/trTR.mjs", - "require": "./commonjs/i18n/languages/trTR", - "types": "./typings/i18n/languages/trTR" + "require": "./commonjs/i18n/languages/trTR.js", + "types": "./typings/i18n/languages/trTR.d.ts" }, "./es/i18n/languages/trTR": { "import": "./es/i18n/languages/trTR.mjs", - "require": "./commonjs/i18n/languages/trTR", - "types": "./typings/i18n/languages/trTR" + "require": "./commonjs/i18n/languages/trTR.js", + "types": "./typings/i18n/languages/trTR.d.ts" }, "./commonjs/i18n/languages/trTR": { "import": "./es/i18n/languages/trTR.mjs", - "require": "./commonjs/i18n/languages/trTR", - "types": "./typings/i18n/languages/trTR" + "require": "./commonjs/i18n/languages/trTR.js", + "types": "./typings/i18n/languages/trTR.d.ts" }, - "./hyperformula/dist/languages/trTR": "./hyperformula/dist/languages/trTR" + "./hyperformula/dist/languages/trTR.js": "./hyperformula/dist/languages/trTR.js" } } From fe9f96e6af1fa5d7d31fa686ddf7b2eec38f116b Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Wed, 21 Feb 2024 15:27:49 +0100 Subject: [PATCH 06/24] Tweaking package.json exports for cjs modules --- .config/babel/add-import-extension.js | 2 +- package.json | 185 +++----------------------- 2 files changed, 16 insertions(+), 171 deletions(-) diff --git a/.config/babel/add-import-extension.js b/.config/babel/add-import-extension.js index e15e387de8..7cda526527 100644 --- a/.config/babel/add-import-extension.js +++ b/.config/babel/add-import-extension.js @@ -85,4 +85,4 @@ module.exports = declare((api, options) => { }), } }; -}); \ No newline at end of file +}); diff --git a/package.json b/package.json index fe93e2f5e2..4cd7854bf7 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "url": "https://github.com/handsontable/hyperformula/issues" }, "author": "Handsoncode ", - "version": "2.6.2", + "version": "2.7.3-esm", "keywords": [ "formula", "spreadsheet", @@ -164,277 +164,122 @@ "require": "./commonjs/index.js", "types": "./typings/index.d.ts" }, - "./i18n/csCZ": { - "import": "./es/i18n/languages/csCZ.mjs", - "require": "./commonjs/i18n/languages/csCZ.js", - "types": "./typings/i18n/languages/csCZ.d.ts" + "./es/i18n/languages": { + "import": "./es/i18n/languages/index.mjs", + "require": "./commonjs/i18n/languages/index.js", + "types": "./typings/i18n/languages/index.d.ts" }, - "./es/i18n/languages/csCZ": { - "import": "./es/i18n/languages/csCZ.mjs", - "require": "./commonjs/i18n/languages/csCZ.js", - "types": "./typings/i18n/languages/csCZ.d.ts" + "./commonjs/i18n/languages": { + "import": "./es/i18n/languages/index.mjs", + "require": "./commonjs/i18n/languages/index.js", + "types": "./typings/i18n/languages/index.d.ts" }, - "./commonjs/i18n/languages/csCZ": { + "./dist/languages": { + "import": "./es/i18n/languages/index.mjs", + "require": "./commonjs/i18n/languages/index.js", + "types": "./typings/i18n/languages/index.d.ts" + }, + "./es/i18n/languages/csCZ": { "import": "./es/i18n/languages/csCZ.mjs", "require": "./commonjs/i18n/languages/csCZ.js", "types": "./typings/i18n/languages/csCZ.d.ts" }, "./hyperformula/dist/languages/csCZ.js": "./hyperformula/dist/languages/csCZ.js", - "./i18n/daDK": { - "import": "./es/i18n/languages/daDK.mjs", - "require": "./commonjs/i18n/languages/daDK.js", - "types": "./typings/i18n/languages/daDK.d.ts" - }, "./es/i18n/languages/daDK": { "import": "./es/i18n/languages/daDK.mjs", "require": "./commonjs/i18n/languages/daDK.js", "types": "./typings/i18n/languages/daDK.d.ts" }, - "./commonjs/i18n/languages/daDK": { - "import": "./es/i18n/languages/daDK.mjs", - "require": "./commonjs/i18n/languages/daDK.js", - "types": "./typings/i18n/languages/daDK.d.ts" - }, "./hyperformula/dist/languages/daDK.js": "./hyperformula/dist/languages/daDK.js", - "./i18n/deDE": { - "import": "./es/i18n/languages/deDE.mjs", - "require": "./commonjs/i18n/languages/deDE.js", - "types": "./typings/i18n/languages/deDE.d.ts" - }, "./es/i18n/languages/deDE": { "import": "./es/i18n/languages/deDE.mjs", "require": "./commonjs/i18n/languages/deDE.js", "types": "./typings/i18n/languages/deDE.d.ts" }, - "./commonjs/i18n/languages/deDE": { - "import": "./es/i18n/languages/deDE.mjs", - "require": "./commonjs/i18n/languages/deDE.js", - "types": "./typings/i18n/languages/deDE.d.ts" - }, "./hyperformula/dist/languages/deDE.js": "./hyperformula/dist/languages/deDE.js", - "./i18n/enGB": { - "import": "./es/i18n/languages/enGB.mjs", - "require": "./commonjs/i18n/languages/enGB.js", - "types": "./typings/i18n/languages/enGB.d.ts" - }, "./es/i18n/languages/enGB": { "import": "./es/i18n/languages/enGB.mjs", "require": "./commonjs/i18n/languages/enGB.js", "types": "./typings/i18n/languages/enGB.d.ts" }, - "./commonjs/i18n/languages/enGB": { - "import": "./es/i18n/languages/enGB.mjs", - "require": "./commonjs/i18n/languages/enGB.js", - "types": "./typings/i18n/languages/enGB.d.ts" - }, "./hyperformula/dist/languages/enGB.js": "./hyperformula/dist/languages/enGB.js", - "./i18n/enUS": { - "import": "./es/i18n/languages/enUS.mjs", - "require": "./commonjs/i18n/languages/enUS.js", - "types": "./typings/i18n/languages/enUS.d.ts" - }, "./es/i18n/languages/enUS": { "import": "./es/i18n/languages/enUS.mjs", "require": "./commonjs/i18n/languages/enUS.js", "types": "./typings/i18n/languages/enUS.d.ts" }, - "./commonjs/i18n/languages/enUS": { - "import": "./es/i18n/languages/enUS.mjs", - "require": "./commonjs/i18n/languages/enUS.js", - "types": "./typings/i18n/languages/enUS.d.ts" - }, "./hyperformula/dist/languages/enUS.js": "./hyperformula/dist/languages/enUS.js", - "./i18n/esES": { - "import": "./es/i18n/languages/esES.mjs", - "require": "./commonjs/i18n/languages/esES.js", - "types": "./typings/i18n/languages/esES.d.ts" - }, "./es/i18n/languages/esES": { "import": "./es/i18n/languages/esES.mjs", "require": "./commonjs/i18n/languages/esES.js", "types": "./typings/i18n/languages/esES.d.ts" }, - "./commonjs/i18n/languages/esES": { - "import": "./es/i18n/languages/esES.mjs", - "require": "./commonjs/i18n/languages/esES.js", - "types": "./typings/i18n/languages/esES.d.ts" - }, "./hyperformula/dist/languages/esES.js": "./hyperformula/dist/languages/esES.js", - "./i18n/fiFI": { - "import": "./es/i18n/languages/fiFI.mjs", - "require": "./commonjs/i18n/languages/fiFI.js", - "types": "./typings/i18n/languages/fiFI.d.ts" - }, "./es/i18n/languages/fiFI": { "import": "./es/i18n/languages/fiFI.mjs", "require": "./commonjs/i18n/languages/fiFI.js", "types": "./typings/i18n/languages/fiFI.d.ts" }, - "./commonjs/i18n/languages/fiFI": { - "import": "./es/i18n/languages/fiFI.mjs", - "require": "./commonjs/i18n/languages/fiFI.js", - "types": "./typings/i18n/languages/fiFI.d.ts" - }, "./hyperformula/dist/languages/fiFI.js": "./hyperformula/dist/languages/fiFI.js", - "./i18n/frFR": { - "import": "./es/i18n/languages/frFR.mjs", - "require": "./commonjs/i18n/languages/frFR.js", - "types": "./typings/i18n/languages/frFR.d.ts" - }, "./es/i18n/languages/frFR": { "import": "./es/i18n/languages/frFR.mjs", "require": "./commonjs/i18n/languages/frFR.js", "types": "./typings/i18n/languages/frFR.d.ts" }, - "./commonjs/i18n/languages/frFR": { - "import": "./es/i18n/languages/frFR.mjs", - "require": "./commonjs/i18n/languages/frFR.js", - "types": "./typings/i18n/languages/frFR.d.ts" - }, "./hyperformula/dist/languages/frFR.js": "./hyperformula/dist/languages/frFR.js", - "./i18n/huHU": { - "import": "./es/i18n/languages/huHU.mjs", - "require": "./commonjs/i18n/languages/huHU.js", - "types": "./typings/i18n/languages/huHU.d.ts" - }, "./es/i18n/languages/huHU": { "import": "./es/i18n/languages/huHU.mjs", "require": "./commonjs/i18n/languages/huHU.js", "types": "./typings/i18n/languages/huHU.d.ts" }, - "./commonjs/i18n/languages/huHU": { - "import": "./es/i18n/languages/huHU.mjs", - "require": "./commonjs/i18n/languages/huHU.js", - "types": "./typings/i18n/languages/huHU.d.ts" - }, "./hyperformula/dist/languages/huHU.js": "./hyperformula/dist/languages/huHU.js", - "./i18n/itIT": { - "import": "./es/i18n/languages/itIT.mjs", - "require": "./commonjs/i18n/languages/itIT.js", - "types": "./typings/i18n/languages/itIT.d.ts" - }, "./es/i18n/languages/itIT": { "import": "./es/i18n/languages/itIT.mjs", "require": "./commonjs/i18n/languages/itIT.js", "types": "./typings/i18n/languages/itIT.d.ts" }, - "./commonjs/i18n/languages/itIT": { - "import": "./es/i18n/languages/itIT.mjs", - "require": "./commonjs/i18n/languages/itIT.js", - "types": "./typings/i18n/languages/itIT.d.ts" - }, "./hyperformula/dist/languages/itIT.js": "./hyperformula/dist/languages/itIT.js", - "./i18n/nbNO": { - "import": "./es/i18n/languages/nbNO.mjs", - "require": "./commonjs/i18n/languages/nbNO.js", - "types": "./typings/i18n/languages/nbNO.d.ts" - }, "./es/i18n/languages/nbNO": { "import": "./es/i18n/languages/nbNO.mjs", "require": "./commonjs/i18n/languages/nbNO.js", "types": "./typings/i18n/languages/nbNO.d.ts" }, - "./commonjs/i18n/languages/nbNO": { - "import": "./es/i18n/languages/nbNO.mjs", - "require": "./commonjs/i18n/languages/nbNO.js", - "types": "./typings/i18n/languages/nbNO.d.ts" - }, "./hyperformula/dist/languages/nbNO.js": "./hyperformula/dist/languages/nbNO.js", - "./i18n/nlNL": { - "import": "./es/i18n/languages/nlNL.mjs", - "require": "./commonjs/i18n/languages/nlNL.js", - "types": "./typings/i18n/languages/nlNL.d.ts" - }, "./es/i18n/languages/nlNL": { "import": "./es/i18n/languages/nlNL.mjs", "require": "./commonjs/i18n/languages/nlNL.js", "types": "./typings/i18n/languages/nlNL.d.ts" }, - "./commonjs/i18n/languages/nlNL": { - "import": "./es/i18n/languages/nlNL.mjs", - "require": "./commonjs/i18n/languages/nlNL.js", - "types": "./typings/i18n/languages/nlNL.d.ts" - }, "./hyperformula/dist/languages/nlNL.js": "./hyperformula/dist/languages/nlNL.js", - "./i18n/plPL": { - "import": "./es/i18n/languages/plPL.mjs", - "require": "./commonjs/i18n/languages/plPL.js", - "types": "./typings/i18n/languages/plPL.d.ts" - }, "./es/i18n/languages/plPL": { "import": "./es/i18n/languages/plPL.mjs", "require": "./commonjs/i18n/languages/plPL.js", "types": "./typings/i18n/languages/plPL.d.ts" }, - "./commonjs/i18n/languages/plPL": { - "import": "./es/i18n/languages/plPL.mjs", - "require": "./commonjs/i18n/languages/plPL.js", - "types": "./typings/i18n/languages/plPL.d.ts" - }, "./hyperformula/dist/languages/plPL.js": "./hyperformula/dist/languages/plPL.js", - "./i18n/ptPT": { - "import": "./es/i18n/languages/ptPT.mjs", - "require": "./commonjs/i18n/languages/ptPT.js", - "types": "./typings/i18n/languages/ptPT.d.ts" - }, "./es/i18n/languages/ptPT": { "import": "./es/i18n/languages/ptPT.mjs", "require": "./commonjs/i18n/languages/ptPT.js", "types": "./typings/i18n/languages/ptPT.d.ts" }, - "./commonjs/i18n/languages/ptPT": { - "import": "./es/i18n/languages/ptPT.mjs", - "require": "./commonjs/i18n/languages/ptPT.js", - "types": "./typings/i18n/languages/ptPT.d.ts" - }, "./hyperformula/dist/languages/ptPT.js": "./hyperformula/dist/languages/ptPT.js", - "./i18n/ruRU": { - "import": "./es/i18n/languages/ruRU.mjs", - "require": "./commonjs/i18n/languages/ruRU.js", - "types": "./typings/i18n/languages/ruRU.d.ts" - }, "./es/i18n/languages/ruRU": { "import": "./es/i18n/languages/ruRU.mjs", "require": "./commonjs/i18n/languages/ruRU.js", "types": "./typings/i18n/languages/ruRU.d.ts" }, - "./commonjs/i18n/languages/ruRU": { - "import": "./es/i18n/languages/ruRU.mjs", - "require": "./commonjs/i18n/languages/ruRU.js", - "types": "./typings/i18n/languages/ruRU.d.ts" - }, "./hyperformula/dist/languages/ruRU.js": "./hyperformula/dist/languages/ruRU.js", - "./i18n/svSE": { - "import": "./es/i18n/languages/svSE.mjs", - "require": "./commonjs/i18n/languages/svSE.js", - "types": "./typings/i18n/languages/svSE.d.ts" - }, "./es/i18n/languages/svSE": { "import": "./es/i18n/languages/svSE.mjs", "require": "./commonjs/i18n/languages/svSE.js", "types": "./typings/i18n/languages/svSE.d.ts" }, - "./commonjs/i18n/languages/svSE": { - "import": "./es/i18n/languages/svSE.mjs", - "require": "./commonjs/i18n/languages/svSE.js", - "types": "./typings/i18n/languages/svSE.d.ts" - }, "./hyperformula/dist/languages/svSE.js": "./hyperformula/dist/languages/svSE.js", - "./i18n/trTR": { - "import": "./es/i18n/languages/trTR.mjs", - "require": "./commonjs/i18n/languages/trTR.js", - "types": "./typings/i18n/languages/trTR.d.ts" - }, "./es/i18n/languages/trTR": { "import": "./es/i18n/languages/trTR.mjs", "require": "./commonjs/i18n/languages/trTR.js", "types": "./typings/i18n/languages/trTR.d.ts" }, - "./commonjs/i18n/languages/trTR": { - "import": "./es/i18n/languages/trTR.mjs", - "require": "./commonjs/i18n/languages/trTR.js", - "types": "./typings/i18n/languages/trTR.d.ts" - }, "./hyperformula/dist/languages/trTR.js": "./hyperformula/dist/languages/trTR.js" } } From d25db4e13666a9f22b5a91ef596f3d8f3e8bcb5b Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Wed, 21 Feb 2024 15:55:57 +0100 Subject: [PATCH 07/24] Adjust package.json exports for individual language files in CJS --- package.json | 109 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 86 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 4cd7854bf7..7aa429efb1 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "url": "https://github.com/handsontable/hyperformula/issues" }, "author": "Handsoncode ", - "version": "2.7.3-esm", + "version": "2.6.2", "keywords": [ "formula", "spreadsheet", @@ -174,112 +174,175 @@ "require": "./commonjs/i18n/languages/index.js", "types": "./typings/i18n/languages/index.d.ts" }, - "./dist/languages": { - "import": "./es/i18n/languages/index.mjs", - "require": "./commonjs/i18n/languages/index.js", - "types": "./typings/i18n/languages/index.d.ts" - }, "./es/i18n/languages/csCZ": { "import": "./es/i18n/languages/csCZ.mjs", "require": "./commonjs/i18n/languages/csCZ.js", "types": "./typings/i18n/languages/csCZ.d.ts" }, - "./hyperformula/dist/languages/csCZ.js": "./hyperformula/dist/languages/csCZ.js", + "./commonjs/i18n/languages/csCZ": { + "import": "./es/i18n/languages/csCZ.mjs", + "require": "./commonjs/i18n/languages/csCZ.js", + "types": "./typings/i18n/languages/csCZ.d.ts" + }, "./es/i18n/languages/daDK": { "import": "./es/i18n/languages/daDK.mjs", "require": "./commonjs/i18n/languages/daDK.js", "types": "./typings/i18n/languages/daDK.d.ts" }, - "./hyperformula/dist/languages/daDK.js": "./hyperformula/dist/languages/daDK.js", + "./commonjs/i18n/languages/daDK": { + "import": "./es/i18n/languages/daDK.mjs", + "require": "./commonjs/i18n/languages/daDK.js", + "types": "./typings/i18n/languages/daDK.d.ts" + }, "./es/i18n/languages/deDE": { "import": "./es/i18n/languages/deDE.mjs", "require": "./commonjs/i18n/languages/deDE.js", "types": "./typings/i18n/languages/deDE.d.ts" }, - "./hyperformula/dist/languages/deDE.js": "./hyperformula/dist/languages/deDE.js", + "./commonjs/i18n/languages/deDE": { + "import": "./es/i18n/languages/deDE.mjs", + "require": "./commonjs/i18n/languages/deDE.js", + "types": "./typings/i18n/languages/deDE.d.ts" + }, "./es/i18n/languages/enGB": { "import": "./es/i18n/languages/enGB.mjs", "require": "./commonjs/i18n/languages/enGB.js", "types": "./typings/i18n/languages/enGB.d.ts" }, - "./hyperformula/dist/languages/enGB.js": "./hyperformula/dist/languages/enGB.js", + "./commonjs/i18n/languages/enGB": { + "import": "./es/i18n/languages/enGB.mjs", + "require": "./commonjs/i18n/languages/enGB.js", + "types": "./typings/i18n/languages/enGB.d.ts" + }, "./es/i18n/languages/enUS": { "import": "./es/i18n/languages/enUS.mjs", "require": "./commonjs/i18n/languages/enUS.js", "types": "./typings/i18n/languages/enUS.d.ts" }, - "./hyperformula/dist/languages/enUS.js": "./hyperformula/dist/languages/enUS.js", + "./commonjs/i18n/languages/enUS": { + "import": "./es/i18n/languages/enUS.mjs", + "require": "./commonjs/i18n/languages/enUS.js", + "types": "./typings/i18n/languages/enUS.d.ts" + }, "./es/i18n/languages/esES": { "import": "./es/i18n/languages/esES.mjs", "require": "./commonjs/i18n/languages/esES.js", "types": "./typings/i18n/languages/esES.d.ts" }, - "./hyperformula/dist/languages/esES.js": "./hyperformula/dist/languages/esES.js", + "./commonjs/i18n/languages/esES": { + "import": "./es/i18n/languages/esES.mjs", + "require": "./commonjs/i18n/languages/esES.js", + "types": "./typings/i18n/languages/esES.d.ts" + }, "./es/i18n/languages/fiFI": { "import": "./es/i18n/languages/fiFI.mjs", "require": "./commonjs/i18n/languages/fiFI.js", "types": "./typings/i18n/languages/fiFI.d.ts" }, - "./hyperformula/dist/languages/fiFI.js": "./hyperformula/dist/languages/fiFI.js", + "./commonjs/i18n/languages/fiFI": { + "import": "./es/i18n/languages/fiFI.mjs", + "require": "./commonjs/i18n/languages/fiFI.js", + "types": "./typings/i18n/languages/fiFI.d.ts" + }, "./es/i18n/languages/frFR": { "import": "./es/i18n/languages/frFR.mjs", "require": "./commonjs/i18n/languages/frFR.js", "types": "./typings/i18n/languages/frFR.d.ts" }, - "./hyperformula/dist/languages/frFR.js": "./hyperformula/dist/languages/frFR.js", + "./commonjs/i18n/languages/frFR": { + "import": "./es/i18n/languages/frFR.mjs", + "require": "./commonjs/i18n/languages/frFR.js", + "types": "./typings/i18n/languages/frFR.d.ts" + }, "./es/i18n/languages/huHU": { "import": "./es/i18n/languages/huHU.mjs", "require": "./commonjs/i18n/languages/huHU.js", "types": "./typings/i18n/languages/huHU.d.ts" }, - "./hyperformula/dist/languages/huHU.js": "./hyperformula/dist/languages/huHU.js", + "./commonjs/i18n/languages/huHU": { + "import": "./es/i18n/languages/huHU.mjs", + "require": "./commonjs/i18n/languages/huHU.js", + "types": "./typings/i18n/languages/huHU.d.ts" + }, "./es/i18n/languages/itIT": { "import": "./es/i18n/languages/itIT.mjs", "require": "./commonjs/i18n/languages/itIT.js", "types": "./typings/i18n/languages/itIT.d.ts" }, - "./hyperformula/dist/languages/itIT.js": "./hyperformula/dist/languages/itIT.js", + "./commonjs/i18n/languages/itIT": { + "import": "./es/i18n/languages/itIT.mjs", + "require": "./commonjs/i18n/languages/itIT.js", + "types": "./typings/i18n/languages/itIT.d.ts" + }, "./es/i18n/languages/nbNO": { "import": "./es/i18n/languages/nbNO.mjs", "require": "./commonjs/i18n/languages/nbNO.js", "types": "./typings/i18n/languages/nbNO.d.ts" }, - "./hyperformula/dist/languages/nbNO.js": "./hyperformula/dist/languages/nbNO.js", + "./commonjs/i18n/languages/nbNO": { + "import": "./es/i18n/languages/nbNO.mjs", + "require": "./commonjs/i18n/languages/nbNO.js", + "types": "./typings/i18n/languages/nbNO.d.ts" + }, "./es/i18n/languages/nlNL": { "import": "./es/i18n/languages/nlNL.mjs", "require": "./commonjs/i18n/languages/nlNL.js", "types": "./typings/i18n/languages/nlNL.d.ts" }, - "./hyperformula/dist/languages/nlNL.js": "./hyperformula/dist/languages/nlNL.js", + "./commonjs/i18n/languages/nlNL": { + "import": "./es/i18n/languages/nlNL.mjs", + "require": "./commonjs/i18n/languages/nlNL.js", + "types": "./typings/i18n/languages/nlNL.d.ts" + }, "./es/i18n/languages/plPL": { "import": "./es/i18n/languages/plPL.mjs", "require": "./commonjs/i18n/languages/plPL.js", "types": "./typings/i18n/languages/plPL.d.ts" }, - "./hyperformula/dist/languages/plPL.js": "./hyperformula/dist/languages/plPL.js", + "./commonjs/i18n/languages/plPL": { + "import": "./es/i18n/languages/plPL.mjs", + "require": "./commonjs/i18n/languages/plPL.js", + "types": "./typings/i18n/languages/plPL.d.ts" + }, "./es/i18n/languages/ptPT": { "import": "./es/i18n/languages/ptPT.mjs", "require": "./commonjs/i18n/languages/ptPT.js", "types": "./typings/i18n/languages/ptPT.d.ts" }, - "./hyperformula/dist/languages/ptPT.js": "./hyperformula/dist/languages/ptPT.js", + "./commonjs/i18n/languages/ptPT": { + "import": "./es/i18n/languages/ptPT.mjs", + "require": "./commonjs/i18n/languages/ptPT.js", + "types": "./typings/i18n/languages/ptPT.d.ts" + }, "./es/i18n/languages/ruRU": { "import": "./es/i18n/languages/ruRU.mjs", "require": "./commonjs/i18n/languages/ruRU.js", "types": "./typings/i18n/languages/ruRU.d.ts" }, - "./hyperformula/dist/languages/ruRU.js": "./hyperformula/dist/languages/ruRU.js", + "./commonjs/i18n/languages/ruRU": { + "import": "./es/i18n/languages/ruRU.mjs", + "require": "./commonjs/i18n/languages/ruRU.js", + "types": "./typings/i18n/languages/ruRU.d.ts" + }, "./es/i18n/languages/svSE": { "import": "./es/i18n/languages/svSE.mjs", "require": "./commonjs/i18n/languages/svSE.js", "types": "./typings/i18n/languages/svSE.d.ts" }, - "./hyperformula/dist/languages/svSE.js": "./hyperformula/dist/languages/svSE.js", + "./commonjs/i18n/languages/svSE": { + "import": "./es/i18n/languages/svSE.mjs", + "require": "./commonjs/i18n/languages/svSE.js", + "types": "./typings/i18n/languages/svSE.d.ts" + }, "./es/i18n/languages/trTR": { "import": "./es/i18n/languages/trTR.mjs", "require": "./commonjs/i18n/languages/trTR.js", "types": "./typings/i18n/languages/trTR.d.ts" }, - "./hyperformula/dist/languages/trTR.js": "./hyperformula/dist/languages/trTR.js" + "./commonjs/i18n/languages/trTR": { + "import": "./es/i18n/languages/trTR.mjs", + "require": "./commonjs/i18n/languages/trTR.js", + "types": "./typings/i18n/languages/trTR.d.ts" + } } } From 19622343547d68875edaf5d5195f422090df1b7f Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Wed, 21 Feb 2024 15:58:57 +0100 Subject: [PATCH 08/24] Add info about the source of the add-import-extension babel script --- .config/babel/add-import-extension.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.config/babel/add-import-extension.js b/.config/babel/add-import-extension.js index 7cda526527..81231b760e 100644 --- a/.config/babel/add-import-extension.js +++ b/.config/babel/add-import-extension.js @@ -1,3 +1,5 @@ +// Based on https://github.com/handsontable/handsontable/blob/bd7628544ff83d6e74a9cc949e2c3c38fef74d76/handsontable/.config/plugin/babel/add-import-extension.js + const { existsSync, lstatSync } = require('fs'); const { dirname, resolve } = require('path'); const { types } = require('@babel/core'); From 4bf3f07430cd6a9716c03cfcf790d403119e5c0a Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Wed, 21 Feb 2024 16:08:06 +0100 Subject: [PATCH 09/24] Add changelog entry --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94fbe68fc3..2b1c7f0d69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Fixed + +- Fix ES module build to make importing language files possible in Node environment. [#1344](https://github.com/handsontable/hyperformula/issues/1344) + ## [2.6.2] - 2024-02-15 ### Changed From 36b997e306e69caffbc48b102e4a4212ff3df83c Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Thu, 22 Feb 2024 14:47:20 +0100 Subject: [PATCH 10/24] Move types key to be the first key in JSON object (exports property) --- package.json | 152 +++++++++++++++++++++++++-------------------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/package.json b/package.json index 7aa429efb1..49e08ed083 100644 --- a/package.json +++ b/package.json @@ -47,9 +47,9 @@ "last 2 op_mob versions" ], "license": "GPL-3.0-only", - "module": "es/index.js", + "module": "es/index.mjs", "main": "commonjs/index.js", - "jsnext:main": "es/index.js", + "jsnext:main": "es/index.mjs", "jsdelivr": "dist/hyperformula.min.js", "unpkg": "dist/hyperformula.min.js", "typings": "./typings/index.d.ts", @@ -160,189 +160,189 @@ }, "exports": { ".": { + "types": "./typings/index.d.ts", "import": "./es/index.mjs", - "require": "./commonjs/index.js", - "types": "./typings/index.d.ts" + "require": "./commonjs/index.js" }, "./es/i18n/languages": { + "types": "./typings/i18n/languages/index.d.ts", "import": "./es/i18n/languages/index.mjs", - "require": "./commonjs/i18n/languages/index.js", - "types": "./typings/i18n/languages/index.d.ts" + "require": "./commonjs/i18n/languages/index.js" }, "./commonjs/i18n/languages": { + "types": "./typings/i18n/languages/index.d.ts", "import": "./es/i18n/languages/index.mjs", - "require": "./commonjs/i18n/languages/index.js", - "types": "./typings/i18n/languages/index.d.ts" + "require": "./commonjs/i18n/languages/index.js" }, "./es/i18n/languages/csCZ": { + "types": "./typings/i18n/languages/csCZ.d.ts", "import": "./es/i18n/languages/csCZ.mjs", - "require": "./commonjs/i18n/languages/csCZ.js", - "types": "./typings/i18n/languages/csCZ.d.ts" + "require": "./commonjs/i18n/languages/csCZ.js" }, "./commonjs/i18n/languages/csCZ": { + "types": "./typings/i18n/languages/csCZ.d.ts", "import": "./es/i18n/languages/csCZ.mjs", - "require": "./commonjs/i18n/languages/csCZ.js", - "types": "./typings/i18n/languages/csCZ.d.ts" + "require": "./commonjs/i18n/languages/csCZ.js" }, "./es/i18n/languages/daDK": { + "types": "./typings/i18n/languages/daDK.d.ts", "import": "./es/i18n/languages/daDK.mjs", - "require": "./commonjs/i18n/languages/daDK.js", - "types": "./typings/i18n/languages/daDK.d.ts" + "require": "./commonjs/i18n/languages/daDK.js" }, "./commonjs/i18n/languages/daDK": { + "types": "./typings/i18n/languages/daDK.d.ts", "import": "./es/i18n/languages/daDK.mjs", - "require": "./commonjs/i18n/languages/daDK.js", - "types": "./typings/i18n/languages/daDK.d.ts" + "require": "./commonjs/i18n/languages/daDK.js" }, "./es/i18n/languages/deDE": { + "types": "./typings/i18n/languages/deDE.d.ts", "import": "./es/i18n/languages/deDE.mjs", - "require": "./commonjs/i18n/languages/deDE.js", - "types": "./typings/i18n/languages/deDE.d.ts" + "require": "./commonjs/i18n/languages/deDE.js" }, "./commonjs/i18n/languages/deDE": { + "types": "./typings/i18n/languages/deDE.d.ts", "import": "./es/i18n/languages/deDE.mjs", - "require": "./commonjs/i18n/languages/deDE.js", - "types": "./typings/i18n/languages/deDE.d.ts" + "require": "./commonjs/i18n/languages/deDE.js" }, "./es/i18n/languages/enGB": { + "types": "./typings/i18n/languages/enGB.d.ts", "import": "./es/i18n/languages/enGB.mjs", - "require": "./commonjs/i18n/languages/enGB.js", - "types": "./typings/i18n/languages/enGB.d.ts" + "require": "./commonjs/i18n/languages/enGB.js" }, "./commonjs/i18n/languages/enGB": { + "types": "./typings/i18n/languages/enGB.d.ts", "import": "./es/i18n/languages/enGB.mjs", - "require": "./commonjs/i18n/languages/enGB.js", - "types": "./typings/i18n/languages/enGB.d.ts" + "require": "./commonjs/i18n/languages/enGB.js" }, "./es/i18n/languages/enUS": { + "types": "./typings/i18n/languages/enUS.d.ts", "import": "./es/i18n/languages/enUS.mjs", - "require": "./commonjs/i18n/languages/enUS.js", - "types": "./typings/i18n/languages/enUS.d.ts" + "require": "./commonjs/i18n/languages/enUS.js" }, "./commonjs/i18n/languages/enUS": { + "types": "./typings/i18n/languages/enUS.d.ts", "import": "./es/i18n/languages/enUS.mjs", - "require": "./commonjs/i18n/languages/enUS.js", - "types": "./typings/i18n/languages/enUS.d.ts" + "require": "./commonjs/i18n/languages/enUS.js" }, "./es/i18n/languages/esES": { + "types": "./typings/i18n/languages/esES.d.ts", "import": "./es/i18n/languages/esES.mjs", - "require": "./commonjs/i18n/languages/esES.js", - "types": "./typings/i18n/languages/esES.d.ts" + "require": "./commonjs/i18n/languages/esES.js" }, "./commonjs/i18n/languages/esES": { + "types": "./typings/i18n/languages/esES.d.ts", "import": "./es/i18n/languages/esES.mjs", - "require": "./commonjs/i18n/languages/esES.js", - "types": "./typings/i18n/languages/esES.d.ts" + "require": "./commonjs/i18n/languages/esES.js" }, "./es/i18n/languages/fiFI": { + "types": "./typings/i18n/languages/fiFI.d.ts", "import": "./es/i18n/languages/fiFI.mjs", - "require": "./commonjs/i18n/languages/fiFI.js", - "types": "./typings/i18n/languages/fiFI.d.ts" + "require": "./commonjs/i18n/languages/fiFI.js" }, "./commonjs/i18n/languages/fiFI": { + "types": "./typings/i18n/languages/fiFI.d.ts", "import": "./es/i18n/languages/fiFI.mjs", - "require": "./commonjs/i18n/languages/fiFI.js", - "types": "./typings/i18n/languages/fiFI.d.ts" + "require": "./commonjs/i18n/languages/fiFI.js" }, "./es/i18n/languages/frFR": { + "types": "./typings/i18n/languages/frFR.d.ts", "import": "./es/i18n/languages/frFR.mjs", - "require": "./commonjs/i18n/languages/frFR.js", - "types": "./typings/i18n/languages/frFR.d.ts" + "require": "./commonjs/i18n/languages/frFR.js" }, "./commonjs/i18n/languages/frFR": { + "types": "./typings/i18n/languages/frFR.d.ts", "import": "./es/i18n/languages/frFR.mjs", - "require": "./commonjs/i18n/languages/frFR.js", - "types": "./typings/i18n/languages/frFR.d.ts" + "require": "./commonjs/i18n/languages/frFR.js" }, "./es/i18n/languages/huHU": { + "types": "./typings/i18n/languages/huHU.d.ts", "import": "./es/i18n/languages/huHU.mjs", - "require": "./commonjs/i18n/languages/huHU.js", - "types": "./typings/i18n/languages/huHU.d.ts" + "require": "./commonjs/i18n/languages/huHU.js" }, "./commonjs/i18n/languages/huHU": { + "types": "./typings/i18n/languages/huHU.d.ts", "import": "./es/i18n/languages/huHU.mjs", - "require": "./commonjs/i18n/languages/huHU.js", - "types": "./typings/i18n/languages/huHU.d.ts" + "require": "./commonjs/i18n/languages/huHU.js" }, "./es/i18n/languages/itIT": { + "types": "./typings/i18n/languages/itIT.d.ts", "import": "./es/i18n/languages/itIT.mjs", - "require": "./commonjs/i18n/languages/itIT.js", - "types": "./typings/i18n/languages/itIT.d.ts" + "require": "./commonjs/i18n/languages/itIT.js" }, "./commonjs/i18n/languages/itIT": { + "types": "./typings/i18n/languages/itIT.d.ts", "import": "./es/i18n/languages/itIT.mjs", - "require": "./commonjs/i18n/languages/itIT.js", - "types": "./typings/i18n/languages/itIT.d.ts" + "require": "./commonjs/i18n/languages/itIT.js" }, "./es/i18n/languages/nbNO": { + "types": "./typings/i18n/languages/nbNO.d.ts", "import": "./es/i18n/languages/nbNO.mjs", - "require": "./commonjs/i18n/languages/nbNO.js", - "types": "./typings/i18n/languages/nbNO.d.ts" + "require": "./commonjs/i18n/languages/nbNO.js" }, "./commonjs/i18n/languages/nbNO": { + "types": "./typings/i18n/languages/nbNO.d.ts", "import": "./es/i18n/languages/nbNO.mjs", - "require": "./commonjs/i18n/languages/nbNO.js", - "types": "./typings/i18n/languages/nbNO.d.ts" + "require": "./commonjs/i18n/languages/nbNO.js" }, "./es/i18n/languages/nlNL": { + "types": "./typings/i18n/languages/nlNL.d.ts", "import": "./es/i18n/languages/nlNL.mjs", - "require": "./commonjs/i18n/languages/nlNL.js", - "types": "./typings/i18n/languages/nlNL.d.ts" + "require": "./commonjs/i18n/languages/nlNL.js" }, "./commonjs/i18n/languages/nlNL": { + "types": "./typings/i18n/languages/nlNL.d.ts", "import": "./es/i18n/languages/nlNL.mjs", - "require": "./commonjs/i18n/languages/nlNL.js", - "types": "./typings/i18n/languages/nlNL.d.ts" + "require": "./commonjs/i18n/languages/nlNL.js" }, "./es/i18n/languages/plPL": { + "types": "./typings/i18n/languages/plPL.d.ts", "import": "./es/i18n/languages/plPL.mjs", - "require": "./commonjs/i18n/languages/plPL.js", - "types": "./typings/i18n/languages/plPL.d.ts" + "require": "./commonjs/i18n/languages/plPL.js" }, "./commonjs/i18n/languages/plPL": { + "types": "./typings/i18n/languages/plPL.d.ts", "import": "./es/i18n/languages/plPL.mjs", - "require": "./commonjs/i18n/languages/plPL.js", - "types": "./typings/i18n/languages/plPL.d.ts" + "require": "./commonjs/i18n/languages/plPL.js" }, "./es/i18n/languages/ptPT": { + "types": "./typings/i18n/languages/ptPT.d.ts", "import": "./es/i18n/languages/ptPT.mjs", - "require": "./commonjs/i18n/languages/ptPT.js", - "types": "./typings/i18n/languages/ptPT.d.ts" + "require": "./commonjs/i18n/languages/ptPT.js" }, "./commonjs/i18n/languages/ptPT": { + "types": "./typings/i18n/languages/ptPT.d.ts", "import": "./es/i18n/languages/ptPT.mjs", - "require": "./commonjs/i18n/languages/ptPT.js", - "types": "./typings/i18n/languages/ptPT.d.ts" + "require": "./commonjs/i18n/languages/ptPT.js" }, "./es/i18n/languages/ruRU": { + "types": "./typings/i18n/languages/ruRU.d.ts", "import": "./es/i18n/languages/ruRU.mjs", - "require": "./commonjs/i18n/languages/ruRU.js", - "types": "./typings/i18n/languages/ruRU.d.ts" + "require": "./commonjs/i18n/languages/ruRU.js" }, "./commonjs/i18n/languages/ruRU": { + "types": "./typings/i18n/languages/ruRU.d.ts", "import": "./es/i18n/languages/ruRU.mjs", - "require": "./commonjs/i18n/languages/ruRU.js", - "types": "./typings/i18n/languages/ruRU.d.ts" + "require": "./commonjs/i18n/languages/ruRU.js" }, "./es/i18n/languages/svSE": { + "types": "./typings/i18n/languages/svSE.d.ts", "import": "./es/i18n/languages/svSE.mjs", - "require": "./commonjs/i18n/languages/svSE.js", - "types": "./typings/i18n/languages/svSE.d.ts" + "require": "./commonjs/i18n/languages/svSE.js" }, "./commonjs/i18n/languages/svSE": { + "types": "./typings/i18n/languages/svSE.d.ts", "import": "./es/i18n/languages/svSE.mjs", - "require": "./commonjs/i18n/languages/svSE.js", - "types": "./typings/i18n/languages/svSE.d.ts" + "require": "./commonjs/i18n/languages/svSE.js" }, "./es/i18n/languages/trTR": { + "types": "./typings/i18n/languages/trTR.d.ts", "import": "./es/i18n/languages/trTR.mjs", - "require": "./commonjs/i18n/languages/trTR.js", - "types": "./typings/i18n/languages/trTR.d.ts" + "require": "./commonjs/i18n/languages/trTR.js" }, "./commonjs/i18n/languages/trTR": { + "types": "./typings/i18n/languages/trTR.d.ts", "import": "./es/i18n/languages/trTR.mjs", - "require": "./commonjs/i18n/languages/trTR.js", - "types": "./typings/i18n/languages/trTR.d.ts" + "require": "./commonjs/i18n/languages/trTR.js" } } } From 5348bf71c3e87d70f68d054af8801945f255ca7f Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Thu, 22 Feb 2024 14:53:18 +0100 Subject: [PATCH 11/24] Fix publint suggestions --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 49e08ed083..f4afdb181e 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "last 2 op_mob versions" ], "license": "GPL-3.0-only", + "type": "commonjs", "module": "es/index.mjs", "main": "commonjs/index.js", "jsnext:main": "es/index.mjs", From bccb94537e67eb4a21a522883f1c1d02d792f8f4 Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Wed, 28 Feb 2024 10:14:02 +0100 Subject: [PATCH 12/24] Add paths ./i18n/languages/xxXX to exports property in package.json --- package.json | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/package.json b/package.json index f4afdb181e..c2193060f0 100644 --- a/package.json +++ b/package.json @@ -165,6 +165,11 @@ "import": "./es/index.mjs", "require": "./commonjs/index.js" }, + "./i18n/languages": { + "types": "./typings/i18n/languages/index.d.ts", + "import": "./es/i18n/languages/index.mjs", + "require": "./commonjs/i18n/languages/index.js" + }, "./es/i18n/languages": { "types": "./typings/i18n/languages/index.d.ts", "import": "./es/i18n/languages/index.mjs", @@ -175,6 +180,11 @@ "import": "./es/i18n/languages/index.mjs", "require": "./commonjs/i18n/languages/index.js" }, + "./i18n/languages/csCZ": { + "types": "./typings/i18n/languages/csCZ.d.ts", + "import": "./es/i18n/languages/csCZ.mjs", + "require": "./commonjs/i18n/languages/csCZ.js" + }, "./es/i18n/languages/csCZ": { "types": "./typings/i18n/languages/csCZ.d.ts", "import": "./es/i18n/languages/csCZ.mjs", @@ -185,6 +195,11 @@ "import": "./es/i18n/languages/csCZ.mjs", "require": "./commonjs/i18n/languages/csCZ.js" }, + "./i18n/languages/daDK": { + "types": "./typings/i18n/languages/daDK.d.ts", + "import": "./es/i18n/languages/daDK.mjs", + "require": "./commonjs/i18n/languages/daDK.js" + }, "./es/i18n/languages/daDK": { "types": "./typings/i18n/languages/daDK.d.ts", "import": "./es/i18n/languages/daDK.mjs", @@ -195,6 +210,11 @@ "import": "./es/i18n/languages/daDK.mjs", "require": "./commonjs/i18n/languages/daDK.js" }, + "./i18n/languages/deDE": { + "types": "./typings/i18n/languages/deDE.d.ts", + "import": "./es/i18n/languages/deDE.mjs", + "require": "./commonjs/i18n/languages/deDE.js" + }, "./es/i18n/languages/deDE": { "types": "./typings/i18n/languages/deDE.d.ts", "import": "./es/i18n/languages/deDE.mjs", @@ -205,6 +225,11 @@ "import": "./es/i18n/languages/deDE.mjs", "require": "./commonjs/i18n/languages/deDE.js" }, + "./i18n/languages/enGB": { + "types": "./typings/i18n/languages/enGB.d.ts", + "import": "./es/i18n/languages/enGB.mjs", + "require": "./commonjs/i18n/languages/enGB.js" + }, "./es/i18n/languages/enGB": { "types": "./typings/i18n/languages/enGB.d.ts", "import": "./es/i18n/languages/enGB.mjs", @@ -215,6 +240,11 @@ "import": "./es/i18n/languages/enGB.mjs", "require": "./commonjs/i18n/languages/enGB.js" }, + "./i18n/languages/enUS": { + "types": "./typings/i18n/languages/enUS.d.ts", + "import": "./es/i18n/languages/enUS.mjs", + "require": "./commonjs/i18n/languages/enUS.js" + }, "./es/i18n/languages/enUS": { "types": "./typings/i18n/languages/enUS.d.ts", "import": "./es/i18n/languages/enUS.mjs", @@ -225,6 +255,11 @@ "import": "./es/i18n/languages/enUS.mjs", "require": "./commonjs/i18n/languages/enUS.js" }, + "./i18n/languages/esES": { + "types": "./typings/i18n/languages/esES.d.ts", + "import": "./es/i18n/languages/esES.mjs", + "require": "./commonjs/i18n/languages/esES.js" + }, "./es/i18n/languages/esES": { "types": "./typings/i18n/languages/esES.d.ts", "import": "./es/i18n/languages/esES.mjs", @@ -235,6 +270,11 @@ "import": "./es/i18n/languages/esES.mjs", "require": "./commonjs/i18n/languages/esES.js" }, + "./i18n/languages/fiFI": { + "types": "./typings/i18n/languages/fiFI.d.ts", + "import": "./es/i18n/languages/fiFI.mjs", + "require": "./commonjs/i18n/languages/fiFI.js" + }, "./es/i18n/languages/fiFI": { "types": "./typings/i18n/languages/fiFI.d.ts", "import": "./es/i18n/languages/fiFI.mjs", @@ -245,6 +285,11 @@ "import": "./es/i18n/languages/fiFI.mjs", "require": "./commonjs/i18n/languages/fiFI.js" }, + "./i18n/languages/frFR": { + "types": "./typings/i18n/languages/frFR.d.ts", + "import": "./es/i18n/languages/frFR.mjs", + "require": "./commonjs/i18n/languages/frFR.js" + }, "./es/i18n/languages/frFR": { "types": "./typings/i18n/languages/frFR.d.ts", "import": "./es/i18n/languages/frFR.mjs", @@ -255,6 +300,11 @@ "import": "./es/i18n/languages/frFR.mjs", "require": "./commonjs/i18n/languages/frFR.js" }, + "./i18n/languages/huHU": { + "types": "./typings/i18n/languages/huHU.d.ts", + "import": "./es/i18n/languages/huHU.mjs", + "require": "./commonjs/i18n/languages/huHU.js" + }, "./es/i18n/languages/huHU": { "types": "./typings/i18n/languages/huHU.d.ts", "import": "./es/i18n/languages/huHU.mjs", @@ -265,6 +315,11 @@ "import": "./es/i18n/languages/huHU.mjs", "require": "./commonjs/i18n/languages/huHU.js" }, + "./i18n/languages/itIT": { + "types": "./typings/i18n/languages/itIT.d.ts", + "import": "./es/i18n/languages/itIT.mjs", + "require": "./commonjs/i18n/languages/itIT.js" + }, "./es/i18n/languages/itIT": { "types": "./typings/i18n/languages/itIT.d.ts", "import": "./es/i18n/languages/itIT.mjs", @@ -275,6 +330,11 @@ "import": "./es/i18n/languages/itIT.mjs", "require": "./commonjs/i18n/languages/itIT.js" }, + "./i18n/languages/nbNO": { + "types": "./typings/i18n/languages/nbNO.d.ts", + "import": "./es/i18n/languages/nbNO.mjs", + "require": "./commonjs/i18n/languages/nbNO.js" + }, "./es/i18n/languages/nbNO": { "types": "./typings/i18n/languages/nbNO.d.ts", "import": "./es/i18n/languages/nbNO.mjs", @@ -285,6 +345,11 @@ "import": "./es/i18n/languages/nbNO.mjs", "require": "./commonjs/i18n/languages/nbNO.js" }, + "./i18n/languages/nlNL": { + "types": "./typings/i18n/languages/nlNL.d.ts", + "import": "./es/i18n/languages/nlNL.mjs", + "require": "./commonjs/i18n/languages/nlNL.js" + }, "./es/i18n/languages/nlNL": { "types": "./typings/i18n/languages/nlNL.d.ts", "import": "./es/i18n/languages/nlNL.mjs", @@ -295,6 +360,11 @@ "import": "./es/i18n/languages/nlNL.mjs", "require": "./commonjs/i18n/languages/nlNL.js" }, + "./i18n/languages/plPL": { + "types": "./typings/i18n/languages/plPL.d.ts", + "import": "./es/i18n/languages/plPL.mjs", + "require": "./commonjs/i18n/languages/plPL.js" + }, "./es/i18n/languages/plPL": { "types": "./typings/i18n/languages/plPL.d.ts", "import": "./es/i18n/languages/plPL.mjs", @@ -305,6 +375,11 @@ "import": "./es/i18n/languages/plPL.mjs", "require": "./commonjs/i18n/languages/plPL.js" }, + "./i18n/languages/ptPT": { + "types": "./typings/i18n/languages/ptPT.d.ts", + "import": "./es/i18n/languages/ptPT.mjs", + "require": "./commonjs/i18n/languages/ptPT.js" + }, "./es/i18n/languages/ptPT": { "types": "./typings/i18n/languages/ptPT.d.ts", "import": "./es/i18n/languages/ptPT.mjs", @@ -315,6 +390,11 @@ "import": "./es/i18n/languages/ptPT.mjs", "require": "./commonjs/i18n/languages/ptPT.js" }, + "./i18n/languages/ruRU": { + "types": "./typings/i18n/languages/ruRU.d.ts", + "import": "./es/i18n/languages/ruRU.mjs", + "require": "./commonjs/i18n/languages/ruRU.js" + }, "./es/i18n/languages/ruRU": { "types": "./typings/i18n/languages/ruRU.d.ts", "import": "./es/i18n/languages/ruRU.mjs", @@ -325,6 +405,11 @@ "import": "./es/i18n/languages/ruRU.mjs", "require": "./commonjs/i18n/languages/ruRU.js" }, + "./i18n/languages/svSE": { + "types": "./typings/i18n/languages/svSE.d.ts", + "import": "./es/i18n/languages/svSE.mjs", + "require": "./commonjs/i18n/languages/svSE.js" + }, "./es/i18n/languages/svSE": { "types": "./typings/i18n/languages/svSE.d.ts", "import": "./es/i18n/languages/svSE.mjs", @@ -335,6 +420,11 @@ "import": "./es/i18n/languages/svSE.mjs", "require": "./commonjs/i18n/languages/svSE.js" }, + "./i18n/languages/trTR": { + "types": "./typings/i18n/languages/trTR.d.ts", + "import": "./es/i18n/languages/trTR.mjs", + "require": "./commonjs/i18n/languages/trTR.js" + }, "./es/i18n/languages/trTR": { "types": "./typings/i18n/languages/trTR.d.ts", "import": "./es/i18n/languages/trTR.mjs", From 8a6d1081940da6196eef89165961f8dd9d080c62 Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Wed, 28 Feb 2024 10:15:55 +0100 Subject: [PATCH 13/24] Use path ./i18n/languages/xxXX to import languages in the docs --- docs/guide/localizing-functions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guide/localizing-functions.md b/docs/guide/localizing-functions.md index 3621d4cbed..ca4f8dfdc5 100644 --- a/docs/guide/localizing-functions.md +++ b/docs/guide/localizing-functions.md @@ -9,7 +9,7 @@ register the language like so: ```javascript // import the French language pack -import frFR from 'hyperformula/es/i18n/languages/frFR'; +import frFR from 'hyperformula/i18n/languages/frFR'; // register the language HyperFormula.registerLanguage('frFR', frFR); @@ -17,8 +17,8 @@ HyperFormula.registerLanguage('frFR', frFR); ::: tip To import the language packs, use the module-system-specific dedicated bundles at: -* **ES**: `hyperformula/es/i18n/languages/` -* **CommonJS**: `hyperformula/commonjs/i18n/languages/` +* **ES**: `hyperformula/i18n/languages/` +* **CommonJS**: `hyperformula/i18n/languages/` * **UMD**: `hyperformula/dist/languages/` For the UMD build, the languages are accessible through `HyperFormula.languages`, e.g., `HyperFormula.languages.frFR`. From 0cd4e056a5601c8aaae0c07a648de13332068897 Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Wed, 28 Feb 2024 12:46:40 +0100 Subject: [PATCH 14/24] Add paths with .js extensions to exports in package.json --- package.json | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) diff --git a/package.json b/package.json index c2193060f0..fc8d67a8e5 100644 --- a/package.json +++ b/package.json @@ -190,11 +190,21 @@ "import": "./es/i18n/languages/csCZ.mjs", "require": "./commonjs/i18n/languages/csCZ.js" }, + "./es/i18n/languages/csCZ.js": { + "types": "./typings/i18n/languages/csCZ.d.ts", + "import": "./es/i18n/languages/csCZ.mjs", + "require": "./commonjs/i18n/languages/csCZ.js" + }, "./commonjs/i18n/languages/csCZ": { "types": "./typings/i18n/languages/csCZ.d.ts", "import": "./es/i18n/languages/csCZ.mjs", "require": "./commonjs/i18n/languages/csCZ.js" }, + "./commonjs/i18n/languages/csCZ.js": { + "types": "./typings/i18n/languages/csCZ.d.ts", + "import": "./es/i18n/languages/csCZ.mjs", + "require": "./commonjs/i18n/languages/csCZ.js" + }, "./i18n/languages/daDK": { "types": "./typings/i18n/languages/daDK.d.ts", "import": "./es/i18n/languages/daDK.mjs", @@ -205,11 +215,21 @@ "import": "./es/i18n/languages/daDK.mjs", "require": "./commonjs/i18n/languages/daDK.js" }, + "./es/i18n/languages/daDK.js": { + "types": "./typings/i18n/languages/daDK.d.ts", + "import": "./es/i18n/languages/daDK.mjs", + "require": "./commonjs/i18n/languages/daDK.js" + }, "./commonjs/i18n/languages/daDK": { "types": "./typings/i18n/languages/daDK.d.ts", "import": "./es/i18n/languages/daDK.mjs", "require": "./commonjs/i18n/languages/daDK.js" }, + "./commonjs/i18n/languages/daDK.js": { + "types": "./typings/i18n/languages/daDK.d.ts", + "import": "./es/i18n/languages/daDK.mjs", + "require": "./commonjs/i18n/languages/daDK.js" + }, "./i18n/languages/deDE": { "types": "./typings/i18n/languages/deDE.d.ts", "import": "./es/i18n/languages/deDE.mjs", @@ -220,11 +240,21 @@ "import": "./es/i18n/languages/deDE.mjs", "require": "./commonjs/i18n/languages/deDE.js" }, + "./es/i18n/languages/deDE.js": { + "types": "./typings/i18n/languages/deDE.d.ts", + "import": "./es/i18n/languages/deDE.mjs", + "require": "./commonjs/i18n/languages/deDE.js" + }, "./commonjs/i18n/languages/deDE": { "types": "./typings/i18n/languages/deDE.d.ts", "import": "./es/i18n/languages/deDE.mjs", "require": "./commonjs/i18n/languages/deDE.js" }, + "./commonjs/i18n/languages/deDE.js": { + "types": "./typings/i18n/languages/deDE.d.ts", + "import": "./es/i18n/languages/deDE.mjs", + "require": "./commonjs/i18n/languages/deDE.js" + }, "./i18n/languages/enGB": { "types": "./typings/i18n/languages/enGB.d.ts", "import": "./es/i18n/languages/enGB.mjs", @@ -235,11 +265,21 @@ "import": "./es/i18n/languages/enGB.mjs", "require": "./commonjs/i18n/languages/enGB.js" }, + "./es/i18n/languages/enGB.js": { + "types": "./typings/i18n/languages/enGB.d.ts", + "import": "./es/i18n/languages/enGB.mjs", + "require": "./commonjs/i18n/languages/enGB.js" + }, "./commonjs/i18n/languages/enGB": { "types": "./typings/i18n/languages/enGB.d.ts", "import": "./es/i18n/languages/enGB.mjs", "require": "./commonjs/i18n/languages/enGB.js" }, + "./commonjs/i18n/languages/enGB.js": { + "types": "./typings/i18n/languages/enGB.d.ts", + "import": "./es/i18n/languages/enGB.mjs", + "require": "./commonjs/i18n/languages/enGB.js" + }, "./i18n/languages/enUS": { "types": "./typings/i18n/languages/enUS.d.ts", "import": "./es/i18n/languages/enUS.mjs", @@ -250,11 +290,21 @@ "import": "./es/i18n/languages/enUS.mjs", "require": "./commonjs/i18n/languages/enUS.js" }, + "./es/i18n/languages/enUS.js": { + "types": "./typings/i18n/languages/enUS.d.ts", + "import": "./es/i18n/languages/enUS.mjs", + "require": "./commonjs/i18n/languages/enUS.js" + }, "./commonjs/i18n/languages/enUS": { "types": "./typings/i18n/languages/enUS.d.ts", "import": "./es/i18n/languages/enUS.mjs", "require": "./commonjs/i18n/languages/enUS.js" }, + "./commonjs/i18n/languages/enUS.js": { + "types": "./typings/i18n/languages/enUS.d.ts", + "import": "./es/i18n/languages/enUS.mjs", + "require": "./commonjs/i18n/languages/enUS.js" + }, "./i18n/languages/esES": { "types": "./typings/i18n/languages/esES.d.ts", "import": "./es/i18n/languages/esES.mjs", @@ -265,11 +315,21 @@ "import": "./es/i18n/languages/esES.mjs", "require": "./commonjs/i18n/languages/esES.js" }, + "./es/i18n/languages/esES.js": { + "types": "./typings/i18n/languages/esES.d.ts", + "import": "./es/i18n/languages/esES.mjs", + "require": "./commonjs/i18n/languages/esES.js" + }, "./commonjs/i18n/languages/esES": { "types": "./typings/i18n/languages/esES.d.ts", "import": "./es/i18n/languages/esES.mjs", "require": "./commonjs/i18n/languages/esES.js" }, + "./commonjs/i18n/languages/esES.js": { + "types": "./typings/i18n/languages/esES.d.ts", + "import": "./es/i18n/languages/esES.mjs", + "require": "./commonjs/i18n/languages/esES.js" + }, "./i18n/languages/fiFI": { "types": "./typings/i18n/languages/fiFI.d.ts", "import": "./es/i18n/languages/fiFI.mjs", @@ -280,11 +340,21 @@ "import": "./es/i18n/languages/fiFI.mjs", "require": "./commonjs/i18n/languages/fiFI.js" }, + "./es/i18n/languages/fiFI.js": { + "types": "./typings/i18n/languages/fiFI.d.ts", + "import": "./es/i18n/languages/fiFI.mjs", + "require": "./commonjs/i18n/languages/fiFI.js" + }, "./commonjs/i18n/languages/fiFI": { "types": "./typings/i18n/languages/fiFI.d.ts", "import": "./es/i18n/languages/fiFI.mjs", "require": "./commonjs/i18n/languages/fiFI.js" }, + "./commonjs/i18n/languages/fiFI.js": { + "types": "./typings/i18n/languages/fiFI.d.ts", + "import": "./es/i18n/languages/fiFI.mjs", + "require": "./commonjs/i18n/languages/fiFI.js" + }, "./i18n/languages/frFR": { "types": "./typings/i18n/languages/frFR.d.ts", "import": "./es/i18n/languages/frFR.mjs", @@ -295,11 +365,21 @@ "import": "./es/i18n/languages/frFR.mjs", "require": "./commonjs/i18n/languages/frFR.js" }, + "./es/i18n/languages/frFR.js": { + "types": "./typings/i18n/languages/frFR.d.ts", + "import": "./es/i18n/languages/frFR.mjs", + "require": "./commonjs/i18n/languages/frFR.js" + }, "./commonjs/i18n/languages/frFR": { "types": "./typings/i18n/languages/frFR.d.ts", "import": "./es/i18n/languages/frFR.mjs", "require": "./commonjs/i18n/languages/frFR.js" }, + "./commonjs/i18n/languages/frFR.js": { + "types": "./typings/i18n/languages/frFR.d.ts", + "import": "./es/i18n/languages/frFR.mjs", + "require": "./commonjs/i18n/languages/frFR.js" + }, "./i18n/languages/huHU": { "types": "./typings/i18n/languages/huHU.d.ts", "import": "./es/i18n/languages/huHU.mjs", @@ -310,11 +390,21 @@ "import": "./es/i18n/languages/huHU.mjs", "require": "./commonjs/i18n/languages/huHU.js" }, + "./es/i18n/languages/huHU.js": { + "types": "./typings/i18n/languages/huHU.d.ts", + "import": "./es/i18n/languages/huHU.mjs", + "require": "./commonjs/i18n/languages/huHU.js" + }, "./commonjs/i18n/languages/huHU": { "types": "./typings/i18n/languages/huHU.d.ts", "import": "./es/i18n/languages/huHU.mjs", "require": "./commonjs/i18n/languages/huHU.js" }, + "./commonjs/i18n/languages/huHU.js": { + "types": "./typings/i18n/languages/huHU.d.ts", + "import": "./es/i18n/languages/huHU.mjs", + "require": "./commonjs/i18n/languages/huHU.js" + }, "./i18n/languages/itIT": { "types": "./typings/i18n/languages/itIT.d.ts", "import": "./es/i18n/languages/itIT.mjs", @@ -325,11 +415,21 @@ "import": "./es/i18n/languages/itIT.mjs", "require": "./commonjs/i18n/languages/itIT.js" }, + "./es/i18n/languages/itIT.js": { + "types": "./typings/i18n/languages/itIT.d.ts", + "import": "./es/i18n/languages/itIT.mjs", + "require": "./commonjs/i18n/languages/itIT.js" + }, "./commonjs/i18n/languages/itIT": { "types": "./typings/i18n/languages/itIT.d.ts", "import": "./es/i18n/languages/itIT.mjs", "require": "./commonjs/i18n/languages/itIT.js" }, + "./commonjs/i18n/languages/itIT.js": { + "types": "./typings/i18n/languages/itIT.d.ts", + "import": "./es/i18n/languages/itIT.mjs", + "require": "./commonjs/i18n/languages/itIT.js" + }, "./i18n/languages/nbNO": { "types": "./typings/i18n/languages/nbNO.d.ts", "import": "./es/i18n/languages/nbNO.mjs", @@ -340,11 +440,21 @@ "import": "./es/i18n/languages/nbNO.mjs", "require": "./commonjs/i18n/languages/nbNO.js" }, + "./es/i18n/languages/nbNO.js": { + "types": "./typings/i18n/languages/nbNO.d.ts", + "import": "./es/i18n/languages/nbNO.mjs", + "require": "./commonjs/i18n/languages/nbNO.js" + }, "./commonjs/i18n/languages/nbNO": { "types": "./typings/i18n/languages/nbNO.d.ts", "import": "./es/i18n/languages/nbNO.mjs", "require": "./commonjs/i18n/languages/nbNO.js" }, + "./commonjs/i18n/languages/nbNO.js": { + "types": "./typings/i18n/languages/nbNO.d.ts", + "import": "./es/i18n/languages/nbNO.mjs", + "require": "./commonjs/i18n/languages/nbNO.js" + }, "./i18n/languages/nlNL": { "types": "./typings/i18n/languages/nlNL.d.ts", "import": "./es/i18n/languages/nlNL.mjs", @@ -355,11 +465,21 @@ "import": "./es/i18n/languages/nlNL.mjs", "require": "./commonjs/i18n/languages/nlNL.js" }, + "./es/i18n/languages/nlNL.js": { + "types": "./typings/i18n/languages/nlNL.d.ts", + "import": "./es/i18n/languages/nlNL.mjs", + "require": "./commonjs/i18n/languages/nlNL.js" + }, "./commonjs/i18n/languages/nlNL": { "types": "./typings/i18n/languages/nlNL.d.ts", "import": "./es/i18n/languages/nlNL.mjs", "require": "./commonjs/i18n/languages/nlNL.js" }, + "./commonjs/i18n/languages/nlNL.js": { + "types": "./typings/i18n/languages/nlNL.d.ts", + "import": "./es/i18n/languages/nlNL.mjs", + "require": "./commonjs/i18n/languages/nlNL.js" + }, "./i18n/languages/plPL": { "types": "./typings/i18n/languages/plPL.d.ts", "import": "./es/i18n/languages/plPL.mjs", @@ -370,11 +490,21 @@ "import": "./es/i18n/languages/plPL.mjs", "require": "./commonjs/i18n/languages/plPL.js" }, + "./es/i18n/languages/plPL.js": { + "types": "./typings/i18n/languages/plPL.d.ts", + "import": "./es/i18n/languages/plPL.mjs", + "require": "./commonjs/i18n/languages/plPL.js" + }, "./commonjs/i18n/languages/plPL": { "types": "./typings/i18n/languages/plPL.d.ts", "import": "./es/i18n/languages/plPL.mjs", "require": "./commonjs/i18n/languages/plPL.js" }, + "./commonjs/i18n/languages/plPL.js": { + "types": "./typings/i18n/languages/plPL.d.ts", + "import": "./es/i18n/languages/plPL.mjs", + "require": "./commonjs/i18n/languages/plPL.js" + }, "./i18n/languages/ptPT": { "types": "./typings/i18n/languages/ptPT.d.ts", "import": "./es/i18n/languages/ptPT.mjs", @@ -385,11 +515,21 @@ "import": "./es/i18n/languages/ptPT.mjs", "require": "./commonjs/i18n/languages/ptPT.js" }, + "./es/i18n/languages/ptPT.js": { + "types": "./typings/i18n/languages/ptPT.d.ts", + "import": "./es/i18n/languages/ptPT.mjs", + "require": "./commonjs/i18n/languages/ptPT.js" + }, "./commonjs/i18n/languages/ptPT": { "types": "./typings/i18n/languages/ptPT.d.ts", "import": "./es/i18n/languages/ptPT.mjs", "require": "./commonjs/i18n/languages/ptPT.js" }, + "./commonjs/i18n/languages/ptPT.js": { + "types": "./typings/i18n/languages/ptPT.d.ts", + "import": "./es/i18n/languages/ptPT.mjs", + "require": "./commonjs/i18n/languages/ptPT.js" + }, "./i18n/languages/ruRU": { "types": "./typings/i18n/languages/ruRU.d.ts", "import": "./es/i18n/languages/ruRU.mjs", @@ -400,11 +540,21 @@ "import": "./es/i18n/languages/ruRU.mjs", "require": "./commonjs/i18n/languages/ruRU.js" }, + "./es/i18n/languages/ruRU.js": { + "types": "./typings/i18n/languages/ruRU.d.ts", + "import": "./es/i18n/languages/ruRU.mjs", + "require": "./commonjs/i18n/languages/ruRU.js" + }, "./commonjs/i18n/languages/ruRU": { "types": "./typings/i18n/languages/ruRU.d.ts", "import": "./es/i18n/languages/ruRU.mjs", "require": "./commonjs/i18n/languages/ruRU.js" }, + "./commonjs/i18n/languages/ruRU.js": { + "types": "./typings/i18n/languages/ruRU.d.ts", + "import": "./es/i18n/languages/ruRU.mjs", + "require": "./commonjs/i18n/languages/ruRU.js" + }, "./i18n/languages/svSE": { "types": "./typings/i18n/languages/svSE.d.ts", "import": "./es/i18n/languages/svSE.mjs", @@ -415,11 +565,21 @@ "import": "./es/i18n/languages/svSE.mjs", "require": "./commonjs/i18n/languages/svSE.js" }, + "./es/i18n/languages/svSE.js": { + "types": "./typings/i18n/languages/svSE.d.ts", + "import": "./es/i18n/languages/svSE.mjs", + "require": "./commonjs/i18n/languages/svSE.js" + }, "./commonjs/i18n/languages/svSE": { "types": "./typings/i18n/languages/svSE.d.ts", "import": "./es/i18n/languages/svSE.mjs", "require": "./commonjs/i18n/languages/svSE.js" }, + "./commonjs/i18n/languages/svSE.js": { + "types": "./typings/i18n/languages/svSE.d.ts", + "import": "./es/i18n/languages/svSE.mjs", + "require": "./commonjs/i18n/languages/svSE.js" + }, "./i18n/languages/trTR": { "types": "./typings/i18n/languages/trTR.d.ts", "import": "./es/i18n/languages/trTR.mjs", @@ -430,10 +590,20 @@ "import": "./es/i18n/languages/trTR.mjs", "require": "./commonjs/i18n/languages/trTR.js" }, + "./es/i18n/languages/trTR.js": { + "types": "./typings/i18n/languages/trTR.d.ts", + "import": "./es/i18n/languages/trTR.mjs", + "require": "./commonjs/i18n/languages/trTR.js" + }, "./commonjs/i18n/languages/trTR": { "types": "./typings/i18n/languages/trTR.d.ts", "import": "./es/i18n/languages/trTR.mjs", "require": "./commonjs/i18n/languages/trTR.js" + }, + "./commonjs/i18n/languages/trTR.js": { + "types": "./typings/i18n/languages/trTR.d.ts", + "import": "./es/i18n/languages/trTR.mjs", + "require": "./commonjs/i18n/languages/trTR.js" } } } From 6f328323d460df89aad5de083d1e437b0be5a248 Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Wed, 7 Aug 2024 13:16:31 +0200 Subject: [PATCH 15/24] Add migration guide for 3.0 --- docs/.vuepress/config.js | 3 ++- ...ration-from-1.0-to-2.0.md => migration-from-1.x-to-2.0.md} | 0 docs/guide/migration-from-2.x-to-3.0.md | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) rename docs/guide/{migration-from-1.0-to-2.0.md => migration-from-1.x-to-2.0.md} (100%) create mode 100644 docs/guide/migration-from-2.x-to-3.0.md diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index d966d28666..3e55a442f0 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -265,7 +265,8 @@ module.exports = { children: [ ['/guide/release-notes', 'Release notes'], ['/guide/migration-from-0.6-to-1.0', 'Migrating from 0.6 to 1.0'], - ['/guide/migration-from-1.0-to-2.0', 'Migrating from 1.x to 2.0'], + ['/guide/migration-from-1.x-to-2.0', 'Migrating from 1.x to 2.0'], + ['/guide/migration-from-2.x-to-3.0', 'Migrating from 2.x to 3.0'], ] }, { diff --git a/docs/guide/migration-from-1.0-to-2.0.md b/docs/guide/migration-from-1.x-to-2.0.md similarity index 100% rename from docs/guide/migration-from-1.0-to-2.0.md rename to docs/guide/migration-from-1.x-to-2.0.md diff --git a/docs/guide/migration-from-2.x-to-3.0.md b/docs/guide/migration-from-2.x-to-3.0.md new file mode 100644 index 0000000000..fa7978fe9c --- /dev/null +++ b/docs/guide/migration-from-2.x-to-3.0.md @@ -0,0 +1,4 @@ +# Migrating from 2.x to 3.0 + +To upgrade your HyperFormula version from 2.x.x to 3.0.0, follow this guide. + From 89159a5c15ea439eee17777c223d4265104a4295 Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Thu, 5 Sep 2024 15:32:42 +0200 Subject: [PATCH 16/24] Working on the migration guide --- docs/guide/migration-from-2.x-to-3.0.md | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/guide/migration-from-2.x-to-3.0.md b/docs/guide/migration-from-2.x-to-3.0.md index fa7978fe9c..aa230538d5 100644 --- a/docs/guide/migration-from-2.x-to-3.0.md +++ b/docs/guide/migration-from-2.x-to-3.0.md @@ -2,3 +2,39 @@ To upgrade your HyperFormula version from 2.x.x to 3.0.0, follow this guide. + +## Importing language files + +### Typescript + +``` +"module": "node16", +"moduleResolution": "node16", +``` + +in tsconfig + +### Webpack 4 + +Works but only with legacy paths. Webpack 4 does not support "exports". And requires special configuration for handling mjs files + +I found out that webpack 4 does not support exports, and there seems to be no easy workaround for that. By tweaking the webpack configuration, I managed to make the project import HyperFormula correctly using the legacy paths. Working demo. + +- https://github.com/webpack/webpack/issues/9509#issuecomment-1381896299 +- https://stackoverflow.com/a/74957466 +- https://github.com/handsontable/hyperformula-demos/tree/import-demos/import-demo-esm-webpack-4 + +### Parcel + +parcel does not support "exports" by default, since v2.9 it can be configured to support it + +- https://github.com/parcel-bundler/parcel/issues/4155 +- https://parceljs.org/blog/v2-9-0/#new-resolver + +### Angular + +to be verified + +``` +"moduleResolution": "bundler", +``` From 3c29512564d541f1f6ee1683acd85bad18593247 Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Tue, 29 Oct 2024 15:39:11 +0100 Subject: [PATCH 17/24] Unpolished vershion of the migration guide --- docs/guide/migration-from-2.x-to-3.0.md | 74 +++++++++++++++++++++---- 1 file changed, 62 insertions(+), 12 deletions(-) diff --git a/docs/guide/migration-from-2.x-to-3.0.md b/docs/guide/migration-from-2.x-to-3.0.md index aa230538d5..8395aadc80 100644 --- a/docs/guide/migration-from-2.x-to-3.0.md +++ b/docs/guide/migration-from-2.x-to-3.0.md @@ -2,21 +2,64 @@ To upgrade your HyperFormula version from 2.x.x to 3.0.0, follow this guide. - ## Importing language files -### Typescript +### Projects in Angular framework + +#### Required steps + +1. Upgrade to Typescript 5 +2. In your `tsconfig.json`, set: + +``` +"moduleResolution": "bundler", +``` + +#### Explanation + +TODO + +### Projects in Typescript + +#### Required steps + +1. In your `tsconfig.json`, set: ``` "module": "node16", "moduleResolution": "node16", ``` -in tsconfig +#### Explanation -### Webpack 4 +TODO -Works but only with legacy paths. Webpack 4 does not support "exports". And requires special configuration for handling mjs files +### Projects using Webpack 4 + +#### Required steps + +1. In your `webpack.config.js`, add the following configuration: + +``` +{ + test: /\.m?js$/, + include: /node_modules/, + type: "javascript/auto", + use: { + loader: 'babel-loader', + options: { + cacheDirectory: true, + configFile: path.resolve(ROOT_DIRECTORY, 'config/babel.config.js'), + }, + }, +}, +``` + +#### Explanation + +TODO + +Works but only with legacy paths. Webpack 4 does not support "exports". And requires custom babel-loader for handling mjs files. I found out that webpack 4 does not support exports, and there seems to be no easy workaround for that. By tweaking the webpack configuration, I managed to make the project import HyperFormula correctly using the legacy paths. Working demo. @@ -26,15 +69,22 @@ I found out that webpack 4 does not support exports, and there seems to be no ea ### Parcel +#### Required steps + +1. Upgrade to Parcel 2.9 or newer +2. In your `package.json`, add the following configuration: + +``` +"@parcel/resolver-default": { + "packageExports": true +} +``` + +#### Explanation + parcel does not support "exports" by default, since v2.9 it can be configured to support it - https://github.com/parcel-bundler/parcel/issues/4155 - https://parceljs.org/blog/v2-9-0/#new-resolver -### Angular - -to be verified - -``` -"moduleResolution": "bundler", -``` +// TODO \ No newline at end of file From 4c3d108028f513c417c8b95cc5af9200050a3bd6 Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Tue, 29 Oct 2024 19:49:00 +0100 Subject: [PATCH 18/24] Upgrade migration instructions for Angular projects --- docs/guide/migration-from-2.x-to-3.0.md | 15 +++++++++------ package.json | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/guide/migration-from-2.x-to-3.0.md b/docs/guide/migration-from-2.x-to-3.0.md index 8395aadc80..f015fd7352 100644 --- a/docs/guide/migration-from-2.x-to-3.0.md +++ b/docs/guide/migration-from-2.x-to-3.0.md @@ -4,21 +4,19 @@ To upgrade your HyperFormula version from 2.x.x to 3.0.0, follow this guide. ## Importing language files +TODO: description of a change + ### Projects in Angular framework #### Required steps -1. Upgrade to Typescript 5 +1. Make sure you use Typescript 5 or newer 2. In your `tsconfig.json`, set: ``` "moduleResolution": "bundler", ``` -#### Explanation - -TODO - ### Projects in Typescript #### Required steps @@ -82,9 +80,14 @@ I found out that webpack 4 does not support exports, and there seems to be no ea #### Explanation +TODO + parcel does not support "exports" by default, since v2.9 it can be configured to support it - https://github.com/parcel-bundler/parcel/issues/4155 - https://parceljs.org/blog/v2-9-0/#new-resolver -// TODO \ No newline at end of file +// TODO +- read https://github.com/microsoft/TypeScript/issues/18442 +- read https://github.com/microsoft/TypeScript/issues/49462 +- read https://www.sensedeep.com/blog/posts/2021/how-to-create-single-source-npm-module.html \ No newline at end of file diff --git a/package.json b/package.json index 2528a73f6e..498ad9aa68 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "url": "https://github.com/handsontable/hyperformula/issues" }, "author": "Handsoncode ", - "version": "2.7.1", + "version": "3.0.0-next1", "keywords": [ "formula", "spreadsheet", From f0cea7bc62f8f21db12130edb42c67715dd8f6e6 Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Wed, 30 Oct 2024 08:24:50 +0100 Subject: [PATCH 19/24] Add more explenations to the migration guide --- docs/guide/migration-from-2.x-to-3.0.md | 27 ++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/docs/guide/migration-from-2.x-to-3.0.md b/docs/guide/migration-from-2.x-to-3.0.md index f015fd7352..535d8b40e8 100644 --- a/docs/guide/migration-from-2.x-to-3.0.md +++ b/docs/guide/migration-from-2.x-to-3.0.md @@ -4,9 +4,22 @@ To upgrade your HyperFormula version from 2.x.x to 3.0.0, follow this guide. ## Importing language files -TODO: description of a change +We changed the way of importing language files in ES module system to a more standard way using `mjs` files and `exports` property. This change is required to make HyperFormula compatible with modern ESM configurations in Node and browser environments. -### Projects in Angular framework +The previous import paths became deprecated. For most environments they still work in version 3.0.0, but it will be removed in the future. To avoid any issues, update your code to use the new paths: + +### New import paths for ES and CommonJS module systems + +For ES and CommonJS modules, use the path `hyperformula/i18n/languages`, to import the language files. E.g.: + +```javascript +import { frFR } from "hyperformula/i18n/languages"; // ESM + +const { frFR } = require('hyperformula/i18n/languages'); // CommonJS +``` +If you use the UMD module system, you don't need to change anything. + +### Additional steps for projects in Angular framework #### Required steps @@ -17,7 +30,7 @@ TODO: description of a change "moduleResolution": "bundler", ``` -### Projects in Typescript +### Additional steps for projects in Typescript #### Required steps @@ -32,7 +45,7 @@ TODO: description of a change TODO -### Projects using Webpack 4 +### Additional steps for projects using Webpack 4 #### Required steps @@ -65,7 +78,7 @@ I found out that webpack 4 does not support exports, and there seems to be no ea - https://stackoverflow.com/a/74957466 - https://github.com/handsontable/hyperformula-demos/tree/import-demos/import-demo-esm-webpack-4 -### Parcel +### Additional steps for projects using Parcel #### Required steps @@ -87,6 +100,10 @@ parcel does not support "exports" by default, since v2.9 it can be configured to - https://github.com/parcel-bundler/parcel/issues/4155 - https://parceljs.org/blog/v2-9-0/#new-resolver +### Other projects + +We tested the changes with the most popular bundlers and frameworks. If you use a different configuration, and you encounter any issues, please contact us via GitHub. We will try to make it work for you, although for older versions of bundlers and frameworks, it might be impossible. + // TODO - read https://github.com/microsoft/TypeScript/issues/18442 - read https://github.com/microsoft/TypeScript/issues/49462 From 51732b7d753ada1b6954d701099cd7647eeb136d Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Thu, 31 Oct 2024 10:24:12 +0100 Subject: [PATCH 20/24] Add a fallback option for parcel projects to the migration guide --- docs/guide/migration-from-2.x-to-3.0.md | 85 +++++++++---------------- 1 file changed, 31 insertions(+), 54 deletions(-) diff --git a/docs/guide/migration-from-2.x-to-3.0.md b/docs/guide/migration-from-2.x-to-3.0.md index 535d8b40e8..6e3df467d4 100644 --- a/docs/guide/migration-from-2.x-to-3.0.md +++ b/docs/guide/migration-from-2.x-to-3.0.md @@ -4,9 +4,9 @@ To upgrade your HyperFormula version from 2.x.x to 3.0.0, follow this guide. ## Importing language files -We changed the way of importing language files in ES module system to a more standard way using `mjs` files and `exports` property. This change is required to make HyperFormula compatible with modern ESM configurations in Node and browser environments. +We changed the way of importing language files in ES module system to a more modern way using `mjs` files and `exports` property. This change is required to make HyperFormula compatible with newer ESM configurations in Node and browser environments. -The previous import paths became deprecated. For most environments they still work in version 3.0.0, but it will be removed in the future. To avoid any issues, update your code to use the new paths: +The previous import paths became deprecated. For most environments they still work in version 3.0.0, but it will be removed in the future. To avoid any issues, update your code to use the new paths. ### New import paths for ES and CommonJS module systems @@ -19,9 +19,7 @@ const { frFR } = require('hyperformula/i18n/languages'); // CommonJS ``` If you use the UMD module system, you don't need to change anything. -### Additional steps for projects in Angular framework - -#### Required steps +### Additional steps for projects using Angular 17 or older 1. Make sure you use Typescript 5 or newer 2. In your `tsconfig.json`, set: @@ -30,60 +28,47 @@ If you use the UMD module system, you don't need to change anything. "moduleResolution": "bundler", ``` -### Additional steps for projects in Typescript - -#### Required steps +### Additional steps for projects using Typescript -1. In your `tsconfig.json`, set: +In your `tsconfig.json`, set: ``` "module": "node16", "moduleResolution": "node16", ``` -#### Explanation - -TODO +### Additional steps for projects using Webpack 4 or older -### Additional steps for projects using Webpack 4 +1. In your code, use the legacy paths for importing language files. Unfortunately, Webpack 4 does not support `exports` property. E.g.: -#### Required steps +```javascript +import { frFR } from "hyperformula/es/i18n/languages"; +``` -1. In your `webpack.config.js`, add the following configuration: +2. In your `webpack.config.js`, add the following configuration to handle `.mjs` files properly: -``` -{ - test: /\.m?js$/, - include: /node_modules/, - type: "javascript/auto", - use: { - loader: 'babel-loader', - options: { - cacheDirectory: true, - configFile: path.resolve(ROOT_DIRECTORY, 'config/babel.config.js'), +```javascript +module: { + rules: [ + { + test: /\.m?js$/, + include: /node_modules/, + type: "javascript/auto", }, - }, -}, + ], +} ``` -#### Explanation - -TODO - -Works but only with legacy paths. Webpack 4 does not support "exports". And requires custom babel-loader for handling mjs files. - -I found out that webpack 4 does not support exports, and there seems to be no easy workaround for that. By tweaking the webpack configuration, I managed to make the project import HyperFormula correctly using the legacy paths. Working demo. - -- https://github.com/webpack/webpack/issues/9509#issuecomment-1381896299 -- https://stackoverflow.com/a/74957466 -- https://github.com/handsontable/hyperformula-demos/tree/import-demos/import-demo-esm-webpack-4 - ### Additional steps for projects using Parcel -#### Required steps +1. Make sure you use Parcel 2.9 or newer. Older versions of Parcel do not support `exports` property. +2. Install the `@babel/core` package: + +``` +npm install --save-dev @babel/core +``` -1. Upgrade to Parcel 2.9 or newer -2. In your `package.json`, add the following configuration: +3. In your `package.json`, add the [following configuration](https://parceljs.org/blog/v2-9-0/#new-resolver): ``` "@parcel/resolver-default": { @@ -91,20 +76,12 @@ I found out that webpack 4 does not support exports, and there seems to be no ea } ``` -#### Explanation +If you don't want to upgrade Parcel or install `@babel/core`, you can keep using the legacy import paths for language files. E.g.: -TODO - -parcel does not support "exports" by default, since v2.9 it can be configured to support it - -- https://github.com/parcel-bundler/parcel/issues/4155 -- https://parceljs.org/blog/v2-9-0/#new-resolver +```javascript +import { frFR } from "hyperformula/es/i18n/languages"; +``` ### Other projects We tested the changes with the most popular bundlers and frameworks. If you use a different configuration, and you encounter any issues, please contact us via GitHub. We will try to make it work for you, although for older versions of bundlers and frameworks, it might be impossible. - -// TODO -- read https://github.com/microsoft/TypeScript/issues/18442 -- read https://github.com/microsoft/TypeScript/issues/49462 -- read https://www.sensedeep.com/blog/posts/2021/how-to-create-single-source-npm-module.html \ No newline at end of file From 5128ba37b9c5231c933a8a1691c3bab209224b69 Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Thu, 31 Oct 2024 15:40:40 +0100 Subject: [PATCH 21/24] Undo the version number change in package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 498ad9aa68..2528a73f6e 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "url": "https://github.com/handsontable/hyperformula/issues" }, "author": "Handsoncode ", - "version": "3.0.0-next1", + "version": "2.7.1", "keywords": [ "formula", "spreadsheet", From 152b0dd7c0d165dd6952f39d64d103a133b5b2d4 Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Tue, 5 Nov 2024 11:11:27 +0100 Subject: [PATCH 22/24] Update migration guide --- docs/guide/migration-from-2.x-to-3.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/migration-from-2.x-to-3.0.md b/docs/guide/migration-from-2.x-to-3.0.md index 6e3df467d4..1648e95737 100644 --- a/docs/guide/migration-from-2.x-to-3.0.md +++ b/docs/guide/migration-from-2.x-to-3.0.md @@ -19,7 +19,7 @@ const { frFR } = require('hyperformula/i18n/languages'); // CommonJS ``` If you use the UMD module system, you don't need to change anything. -### Additional steps for projects using Angular 17 or older +### Additional steps for projects using Angular 1. Make sure you use Typescript 5 or newer 2. In your `tsconfig.json`, set: From 44e9d56c2c2ece610f10c8cf75dde41713f509fa Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Thu, 7 Nov 2024 10:09:37 +0100 Subject: [PATCH 23/24] Remove unnsecessary step from the parcel section of the migration guide --- docs/guide/migration-from-2.x-to-3.0.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/docs/guide/migration-from-2.x-to-3.0.md b/docs/guide/migration-from-2.x-to-3.0.md index 1648e95737..dfbf395cb0 100644 --- a/docs/guide/migration-from-2.x-to-3.0.md +++ b/docs/guide/migration-from-2.x-to-3.0.md @@ -62,13 +62,7 @@ module: { ### Additional steps for projects using Parcel 1. Make sure you use Parcel 2.9 or newer. Older versions of Parcel do not support `exports` property. -2. Install the `@babel/core` package: - -``` -npm install --save-dev @babel/core -``` - -3. In your `package.json`, add the [following configuration](https://parceljs.org/blog/v2-9-0/#new-resolver): +2. In your `package.json`, add the [following configuration](https://parceljs.org/blog/v2-9-0/#new-resolver): ``` "@parcel/resolver-default": { @@ -76,7 +70,7 @@ npm install --save-dev @babel/core } ``` -If you don't want to upgrade Parcel or install `@babel/core`, you can keep using the legacy import paths for language files. E.g.: +If you don't want to upgrade Parcel, you can keep using the legacy import paths for language files, but they will be removed in one of the upcoming releases. E.g.: ```javascript import { frFR } from "hyperformula/es/i18n/languages"; From fecd03a4c45e2090e67db7459719e1f7623eeb17 Mon Sep 17 00:00:00 2001 From: Kuba Sekowski Date: Tue, 12 Nov 2024 11:22:28 +0100 Subject: [PATCH 24/24] Rephrase CHANGELOG.md --- CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68b183f664..e7ebe4b488 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Changed +- **Breaking change**: Change ES module build to use `mjs` files and `exports` property in `package.json` to make importing language files possible in Node environment. [#1344](https://github.com/handsontable/hyperformula/issues/1344) - **Breaking change**: Removed the `binarySearchThreshold` configuration option. [#1439](https://github.com/handsontable/hyperformula/issues/1439) -### Fixed - -- **Breaking change**: Fix ES module build to make importing language files possible in Node environment. [#1344](https://github.com/handsontable/hyperformula/issues/1344) - ## [2.7.1] - 2024-07-18 ### Fixed