diff --git a/packages/core/package.json b/packages/core/package.json index 1809ec7819..6948a816a4 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -4,8 +4,8 @@ "description": "Library providing ability to translate messages directly in context of developed application.", "main": "./dist/tolgee.cjs.js", "module": "./dist/tolgee.esm.js", + "svelte": "./dist/tolgee.esm.mjs", "types": "./lib/index.d.ts", - "type": "module", "repository": { "type": "git", "url": "https://github.com/tolgee/tolgee-js" @@ -23,7 +23,7 @@ "exports": { ".": { "require": "./dist/tolgee.cjs.js", - "import": "./dist/tolgee.esm.js" + "import": "./dist/tolgee.esm.mjs" }, "./package.json": "./package.json" }, diff --git a/packages/core/rollup.config.js b/packages/core/rollup.config.js index 9d4d1e38cf..4ae9fd46bc 100644 --- a/packages/core/rollup.config.js +++ b/packages/core/rollup.config.js @@ -24,6 +24,17 @@ export default { format: 'esm', sourcemap: true, }, + { + file: 'dist/tolgee.esm.min.js', + format: 'esm', + plugins: [terser()], + sourcemap: true, + }, + { + file: 'dist/tolgee.esm.mjs', + format: 'esm', + sourcemap: true, + }, { file: 'dist/tolgee.esm.min.mjs', format: 'esm', diff --git a/packages/format-icu/package.json b/packages/format-icu/package.json index dad4bc4685..9a75267eba 100644 --- a/packages/format-icu/package.json +++ b/packages/format-icu/package.json @@ -4,8 +4,8 @@ "description": "Tolgee format-icu plugin.", "main": "./dist/tolgee-format-icu.cjs.js", "module": "./dist/tolgee-format-icu.esm.js", + "svelte": "./dist/tolgee-format-icu.esm.mjs", "types": "./lib/index.d.ts", - "type": "module", "repository": { "type": "git", "url": "https://github.com/tolgee/tolgee-js" @@ -27,7 +27,7 @@ "exports": { ".": { "require": "./dist/tolgee-format-icu.cjs.js", - "import": "./dist/tolgee-format-icu.esm.js" + "import": "./dist/tolgee-format-icu.esm.mjs" }, "./package.json": "./package.json" }, diff --git a/packages/format-icu/rollup.config.js b/packages/format-icu/rollup.config.js index 973bcad147..a52d7326dc 100644 --- a/packages/format-icu/rollup.config.js +++ b/packages/format-icu/rollup.config.js @@ -24,6 +24,17 @@ export default { format: 'esm', sourcemap: true, }, + { + file: 'dist/tolgee-format-icu.esm.mjs', + format: 'esm', + sourcemap: true, + }, + { + file: 'dist/tolgee-format-icu.esm.min.js', + format: 'esm', + plugins: [terser()], + sourcemap: true, + }, { file: 'dist/tolgee-format-icu.esm.min.mjs', format: 'esm', diff --git a/packages/i18next/.gitignore b/packages/i18next/.gitignore index 578391b556..9852f00211 100644 --- a/packages/i18next/.gitignore +++ b/packages/i18next/.gitignore @@ -2,6 +2,7 @@ node_modules /dist /lib +/coverage # local env files diff --git a/packages/i18next/jest.config.js b/packages/i18next/jest.config.mjs similarity index 100% rename from packages/i18next/jest.config.js rename to packages/i18next/jest.config.mjs diff --git a/packages/i18next/package.json b/packages/i18next/package.json index 731251adf1..0a8ae522d3 100644 --- a/packages/i18next/package.json +++ b/packages/i18next/package.json @@ -4,8 +4,8 @@ "description": "Tolgee i18n integration.", "main": "./dist/tolgee-i18next.cjs.js", "module": "./dist/tolgee-i18next.esm.js", + "svelte": "./dist/tolgee-i18next.esm.mjs", "types": "./lib/index.d.ts", - "type": "module", "repository": { "type": "git", "url": "https://github.com/tolgee/tolgee-js" @@ -27,7 +27,7 @@ "scripts": { "build": "rollup -c rollup.config.js && tsc --project tsconfig.prod.json", "clean": "rm -rf build build-e2e dist dist-e2e lib", - "test": "jest --config ./jest.config.js", + "test": "jest --collect-coverage", "develop": "concurrently \"rollup -c rollup.config.js -w\" \"tsc --watch --preserveWatchOutput --project tsconfig.prod.json\" ", "schema": "openapi-typescript http://localhost:8080/v3/api-docs/All%20Internal%20-%20for%20Tolgee%20Web%20application --output ./src/types/apiSchema.generated.ts", "typedoc": "typedoc --entryPointStrategy expand --out docs src/index.ts src/Tolgee.ts src/types.ts src/services/EventEmitter.ts src/services/Subscription.ts" @@ -68,7 +68,7 @@ "exports": { ".": { "require": "./dist/tolgee-i18next.cjs.js", - "import": "./dist/tolgee-i18next.esm.js" + "import": "./dist/tolgee-i18next.esm.mjs" }, "./package.json": "./package.json" }, diff --git a/packages/i18next/rollup.config.js b/packages/i18next/rollup.config.js index a3e2d16109..33407ab027 100644 --- a/packages/i18next/rollup.config.js +++ b/packages/i18next/rollup.config.js @@ -22,6 +22,17 @@ export default { format: 'esm', sourcemap: true, }, + { + file: 'dist/tolgee-i18next.esm.min.js', + format: 'esm', + plugins: [terser()], + sourcemap: true, + }, + { + file: 'dist/tolgee-i18next.esm.mjs', + format: 'esm', + sourcemap: true, + }, { file: 'dist/tolgee-i18next.esm.min.mjs', format: 'esm', diff --git a/packages/react/jest.config.js b/packages/react/jest.config.mjs similarity index 100% rename from packages/react/jest.config.js rename to packages/react/jest.config.mjs diff --git a/packages/react/package.json b/packages/react/package.json index 0419c7b221..5852997f62 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -5,7 +5,6 @@ "main": "./dist/tolgee-react.cjs.js", "module": "./dist/tolgee-react.esm.js", "types": "lib/index.d.ts", - "type": "module", "repository": "https://github.com/tolgee/tolgee-js", "homepage": "https://tolgee.io", "keywords": [ @@ -73,7 +72,7 @@ "exports": { ".": { "require": "./dist/tolgee-react.cjs.js", - "import": "./dist/tolgee-react.esm.js" + "import": "./dist/tolgee-react.esm.mjs" }, "./package.json": "./package.json" }, diff --git a/packages/react/rollup.config.js b/packages/react/rollup.config.js index 059ecfb180..88c7e30f04 100644 --- a/packages/react/rollup.config.js +++ b/packages/react/rollup.config.js @@ -44,6 +44,19 @@ export default { format: 'esm', sourcemap: true, }, + { + name: '@tolgee/react', + file: 'dist/tolgee-react.esm.min.js', + format: 'esm', + sourcemap: true, + plugins: [terser()], + }, + { + name: '@tolgee/react', + file: 'dist/tolgee-react.esm.mjs', + format: 'esm', + sourcemap: true, + }, { name: '@tolgee/react', file: 'dist/tolgee-react.esm.min.mjs', diff --git a/packages/vue/jest.config.js b/packages/vue/jest.config.mjs similarity index 100% rename from packages/vue/jest.config.js rename to packages/vue/jest.config.mjs diff --git a/packages/vue/package.json b/packages/vue/package.json index c23273356a..e1ce14ce72 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -5,7 +5,6 @@ "module": "dist/tolgee-vue.esm.js", "main": "dist/tolgee-vue.cjs.js", "types": "lib/index.d.ts", - "type": "module", "repository": "https://github.com/tolgee/tolgee-js", "homepage": "https://tolgee.io", "keywords": [ @@ -22,10 +21,10 @@ "dist": "dist" }, "scripts": { - "build": "rollup -c rollup.config.js && tsc --project tsconfig.prod.json", + "build": "rollup -c rollup.config.mjs && tsc --project tsconfig.prod.json", "clean": "rm -rf build build-e2e dist dist-e2e lib", "test": "jest --collect-coverage", - "develop": "concurrently \"rollup -c rollup.config.js -w\" \"tsc --watch --preserveWatchOutput --project tsconfig.prod.json\" " + "develop": "concurrently \"rollup -c rollup.config.mjs -w\" \"tsc --watch --preserveWatchOutput --project tsconfig.prod.json\" " }, "author": "JanCizmar", "license": "MIT", @@ -55,7 +54,7 @@ "concurrently": "7.2.2", "jest": "^27.3.1", "jest-fetch-mock": "^3.0.3", - "rollup": "3.15.0", + "rollup": "3.18.0", "rollup-plugin-bundle-size": "^1.0.3", "rollup-plugin-sourcemaps": "^0.6.3", "rollup-plugin-terser": "7.0.2", @@ -67,7 +66,7 @@ "exports": { ".": { "require": "./dist/tolgee-vue.cjs.js", - "import": "./dist/tolgee-vue.esm.js" + "import": "./dist/tolgee-vue.esm.mjs" }, "./package.json": "./package.json" }, diff --git a/packages/vue/rollup.config.js b/packages/vue/rollup.config.mjs similarity index 83% rename from packages/vue/rollup.config.js rename to packages/vue/rollup.config.mjs index 520dcd7110..ec2b611be6 100644 --- a/packages/vue/rollup.config.js +++ b/packages/vue/rollup.config.mjs @@ -24,6 +24,19 @@ export default { format: 'esm', sourcemap: true, }, + { + name: '@tolgee/vue', + file: 'dist/tolgee-vue.esm.min.js', + format: 'esm', + sourcemap: true, + plugins: [terser()], + }, + { + name: '@tolgee/vue', + file: 'dist/tolgee-vue.esm.mjs', + format: 'esm', + sourcemap: true, + }, { name: '@tolgee/vue', file: 'dist/tolgee-vue.esm.min.mjs', diff --git a/packages/web/jest.config.js b/packages/web/jest.config.mjs similarity index 100% rename from packages/web/jest.config.js rename to packages/web/jest.config.mjs diff --git a/packages/web/package.json b/packages/web/package.json index 3b9a52bebc..1365e02405 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -5,23 +5,19 @@ "declaration": true, "main": "./index.js", "types": "./types/index.d.ts", - "type": "module", "exports": { ".": { "production": { "require": "./dist/tolgee-web.production.cjs.js", - "import": "./dist/tolgee-web.production.esm.js", - "svelte": "./dist/tolgee-web.production.esm.js" + "import": "./dist/tolgee-web.production.esm.mjs" }, "require": "./index.js", - "import": "./dist/tolgee-web.development.esm.js", - "svelte": "./dist/tolgee-web.development.esm.js", + "import": "./dist/tolgee-web.development.esm.mjs", "types": "./types/index.d.ts" }, "./tools": { "require": "./dist/tolgee-in-context-tools.cjs.js", - "import": "./dist/tolgee-in-context-tools.esm.js", - "svelte": "./dist/tolgee-in-context-tools.esm.js", + "import": "./dist/tolgee-in-context-tools.esm.mjs", "types": "./types/index.d.ts" }, "./package.json": "./package.json" @@ -33,7 +29,7 @@ "scripts": { "build": "rollup -c rollup.config.js && tsc --project tsconfig.prod.json", "clean": "rm -rf build build-e2e dist dist-e2e lib", - "test": "jest --config ./jest.config.js --collect-coverage", + "test": "jest --collect-coverage", "develop": "concurrently \"rollup -c rollup.dev.js -w\" \"tsc --watch --preserveWatchOutput --project tsconfig.prod.json\" ", "schema": "openapi-typescript http://localhost:8202/v3/api-docs/Accessible%20with%20API%20key --output ./src/ui/client/apiSchema.generated.ts" }, diff --git a/packages/web/tools/package.json b/packages/web/tools/package.json index 58402af0ee..cb0b4000da 100644 --- a/packages/web/tools/package.json +++ b/packages/web/tools/package.json @@ -1,6 +1,15 @@ { "internal": true, "main": "../dist/tolgee-in-context-tools.cjs.js", - "module": "../dist/tolgee-in-context-tools.cjs.js", - "types": "../types/tools.d.ts" + "module": "../dist/tolgee-in-context-tools.esm.js", + "svelte": "../dist/tolgee-in-context-tools.esm.mjs", + "types": "../types/tools.d.ts", + "exports": { + ".": { + "require": "../dist/tolgee-in-context-tools.cjs.js", + "import": "../dist/tolgee-in-context-tools.esm.mjs", + "types": "../types/index.d.ts" + }, + "./package.json": "./package.json" + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index efee27c237..7b917d673d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -418,7 +418,7 @@ importers: concurrently: 7.2.2 jest: ^27.3.1 jest-fetch-mock: ^3.0.3 - rollup: 3.15.0 + rollup: 3.18.0 rollup-plugin-bundle-size: ^1.0.3 rollup-plugin-sourcemaps: ^0.6.3 rollup-plugin-terser: 7.0.2 @@ -429,8 +429,8 @@ importers: dependencies: '@tolgee/web': link:../web devDependencies: - '@rollup/plugin-node-resolve': 15.0.1_rollup@3.15.0 - '@rollup/plugin-typescript': 11.0.0_xswiuafr57fmdlvfpvse52fe3e + '@rollup/plugin-node-resolve': 15.0.1_rollup@3.18.0 + '@rollup/plugin-typescript': 11.0.0_fn2onl6nbsljlgjr3jlzr6w7we '@testing-library/jest-dom': 5.16.5 '@testing-library/vue': 6.6.1_a2ihsjreowava2sm4iorpgwkom '@tolgee/format-icu': link:../format-icu @@ -442,10 +442,10 @@ importers: concurrently: 7.2.2 jest: 27.5.1 jest-fetch-mock: 3.0.3 - rollup: 3.15.0 + rollup: 3.18.0 rollup-plugin-bundle-size: 1.0.3 - rollup-plugin-sourcemaps: 0.6.3_rollup@3.15.0 - rollup-plugin-terser: 7.0.2_rollup@3.15.0 + rollup-plugin-sourcemaps: 0.6.3_rollup@3.18.0 + rollup-plugin-terser: 7.0.2_rollup@3.18.0 rollup-plugin-vue: 6.0.0_@vue+compiler-sfc@3.2.47 ts-jest: 27.1.5_nqiklvmdurtmh4ek44pn72nacu typescript: 4.9.5 @@ -8535,7 +8535,7 @@ packages: rollup: 2.78.1 dev: true - /@rollup/plugin-node-resolve/15.0.1_rollup@3.15.0: + /@rollup/plugin-node-resolve/15.0.1_rollup@3.18.0: resolution: {integrity: sha512-ReY88T7JhJjeRVbfCyNj+NXAG3IIsVMsX9b5/9jC98dRP8/yxlZdz7mHZbHk5zHr24wZZICS5AcXsFZAXYUQEg==} engines: {node: '>=14.0.0'} peerDependencies: @@ -8544,13 +8544,13 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.15.0 + '@rollup/pluginutils': 5.0.2_rollup@3.18.0 '@types/resolve': 1.20.2 deepmerge: 4.3.0 is-builtin-module: 3.2.1 is-module: 1.0.0 resolve: 1.22.1 - rollup: 3.15.0 + rollup: 3.18.0 dev: true /@rollup/plugin-replace/2.4.2_rollup@2.79.1: @@ -8573,7 +8573,7 @@ packages: rollup: 2.79.0 dev: true - /@rollup/plugin-typescript/11.0.0_xswiuafr57fmdlvfpvse52fe3e: + /@rollup/plugin-typescript/11.0.0_fn2onl6nbsljlgjr3jlzr6w7we: resolution: {integrity: sha512-goPyCWBiimk1iJgSTgsehFD5OOFHiAknrRJjqFCudcW8JtWiBlK284Xnn4flqMqg6YAjVG/EE+3aVzrL5qNSzQ==} engines: {node: '>=14.0.0'} peerDependencies: @@ -8586,9 +8586,9 @@ packages: tslib: optional: true dependencies: - '@rollup/pluginutils': 5.0.2_rollup@3.15.0 + '@rollup/pluginutils': 5.0.2_rollup@3.18.0 resolve: 1.22.1 - rollup: 3.15.0 + rollup: 3.18.0 typescript: 4.9.5 dev: true @@ -8697,7 +8697,7 @@ packages: picomatch: 2.3.1 rollup: 2.79.1 - /@rollup/pluginutils/3.1.0_rollup@3.15.0: + /@rollup/pluginutils/3.1.0_rollup@3.18.0: resolution: {integrity: sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==} engines: {node: '>= 8.0.0'} peerDependencies: @@ -8706,10 +8706,10 @@ packages: '@types/estree': 0.0.39 estree-walker: 1.0.1 picomatch: 2.3.1 - rollup: 3.15.0 + rollup: 3.18.0 dev: true - /@rollup/pluginutils/5.0.2_rollup@3.15.0: + /@rollup/pluginutils/5.0.2_rollup@3.18.0: resolution: {integrity: sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==} engines: {node: '>=14.0.0'} peerDependencies: @@ -8721,7 +8721,7 @@ packages: '@types/estree': 1.0.0 estree-walker: 2.0.2 picomatch: 2.3.1 - rollup: 3.15.0 + rollup: 3.18.0 dev: true /@rushstack/eslint-patch/1.2.0: @@ -26721,7 +26721,7 @@ packages: source-map-resolve: 0.6.0 dev: true - /rollup-plugin-sourcemaps/0.6.3_rollup@3.15.0: + /rollup-plugin-sourcemaps/0.6.3_rollup@3.18.0: resolution: {integrity: sha512-paFu+nT1xvuO1tPFYXGe+XnQvg4Hjqv/eIhG8i5EspfYYPBKL57X7iVbfv55aNVASg3dzWvES9dmWsL2KhfByw==} engines: {node: '>=10.0.0'} peerDependencies: @@ -26731,8 +26731,8 @@ packages: '@types/node': optional: true dependencies: - '@rollup/pluginutils': 3.1.0_rollup@3.15.0 - rollup: 3.15.0 + '@rollup/pluginutils': 3.1.0_rollup@3.18.0 + rollup: 3.18.0 source-map-resolve: 0.6.0 dev: true @@ -26803,14 +26803,14 @@ packages: serialize-javascript: 4.0.0 terser: 5.16.3 - /rollup-plugin-terser/7.0.2_rollup@3.15.0: + /rollup-plugin-terser/7.0.2_rollup@3.18.0: resolution: {integrity: sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==} peerDependencies: rollup: ^2.0.0 dependencies: '@babel/code-frame': 7.18.6 jest-worker: 26.6.2 - rollup: 3.15.0 + rollup: 3.18.0 serialize-javascript: 4.0.0 terser: 5.16.3 dev: true @@ -26897,8 +26897,8 @@ packages: fsevents: 2.3.2 dev: true - /rollup/3.15.0: - resolution: {integrity: sha512-F9hrCAhnp5/zx/7HYmftvsNBkMfLfk/dXUh73hPSM2E3CRgap65orDNJbLetoiUFwSAk6iHPLvBrZ5iHYvzqsg==} + /rollup/3.18.0: + resolution: {integrity: sha512-J8C6VfEBjkvYPESMQYxKHxNOh4A5a3FlP+0BETGo34HEcE4eTlgCrO2+eWzlu2a/sHs2QUkZco+wscH7jhhgWg==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} hasBin: true optionalDependencies: diff --git a/scripts/packages.test.ts b/scripts/packages.test.ts index 739488e514..bdd8ae06a1 100644 --- a/scripts/packages.test.ts +++ b/scripts/packages.test.ts @@ -71,7 +71,6 @@ const checkPackage = (filePath) => { assertExpr(f.name?.startsWith('@tolgee/'), 'Has correct name'); assertExpr(f.publishConfig?.access, 'Is public'); assertExpr(f.main || f.module || f.exports, 'Has entry point'); - assertExpr(f.type === 'module', 'Has type: module'); assertExpr( f.exports?.['./package.json'] === './package.json', 'package.json in exports' @@ -79,6 +78,7 @@ const checkPackage = (filePath) => { } assertFileExists(folder, f.main, 'main'); assertFileExists(folder, f.module, 'module'); + assertFileExists(folder, f.svelte, 'svelte'); if (f.module) { // if module field ends with .mjs it causes issues with webpack assertExpr(f.module.endsWith('.js'), ' - module ends with .js');