From e538acb4ab894e4c48a8cb9594fbea42fb62ffb1 Mon Sep 17 00:00:00 2001 From: Adriano Raiano Date: Fri, 10 Nov 2023 22:29:28 +0100 Subject: [PATCH] fix: separate cjs and mjs typings --- CHANGELOG.md | 3 +++ index.d.mts | 1 + package.json | 26 +++++++++++++------------- tsconfig.json | 3 ++- 4 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 index.d.mts diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c178f5..3fbcd3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [v3.5.0](https://github.com/i18next/i18next-http-middleware/compare/v3.4.1...v3.5.0) +- fix: separate cjs and mjs typings + ## [v3.4.1](https://github.com/i18next/i18next-http-middleware/compare/v3.4.0...v3.4.1) - fix(languageDetector): handle es-419 special case [#65](https://github.com/i18next/i18next-http-middleware/pull/65) diff --git a/index.d.mts b/index.d.mts new file mode 100644 index 0000000..ee01cc9 --- /dev/null +++ b/index.d.mts @@ -0,0 +1 @@ +export * from './index.js'; diff --git a/package.json b/package.json index 2020d4c..3f74751 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,13 @@ "private": false, "type": "module", "main": "./cjs/index.js", - "types": "./index.d.ts", + "types": "./index.d.mts", "exports": { "./package.json": "./package.json", ".": { "types": { "require": "./cjs/index.d.ts", - "import": "./esm/index.d.ts" + "import": "./esm/index.d.mts" }, "module": "./esm/index.js", "import": "./esm/index.js", @@ -22,31 +22,31 @@ "default": "./cjs/index.js" }, "./esm": { - "types": "./esm/index.d.ts", + "types": "./esm/index.d.mts", "default": "./esm/index.js" } }, "module": "./esm/index.js", "devDependencies": { "@babel/cli": "7.23.0", - "@babel/core": "7.23.0", - "@babel/preset-env": "7.22.20", + "@babel/core": "7.23.3", + "@babel/preset-env": "7.23.3", "@hapi/hapi": "^21.3.2", - "@types/express-serve-static-core": "^4.17.37", - "@koa/router": "12.0.0", + "@types/express-serve-static-core": "^4.17.41", + "@koa/router": "12.0.1", "koa": "2.14.2", "babel-plugin-add-module-exports": "1.0.4", - "eslint": "8.50.0", + "eslint": "8.53.0", "eslint-config-standard": "17.1.0", - "eslint-plugin-import": "2.28.1", - "eslint-plugin-n": "16.1.0", + "eslint-plugin-import": "2.29.0", + "eslint-plugin-n": "16.3.1", "eslint-plugin-promise": "6.1.1", "eslint-plugin-require-path-exists": "1.1.9", "eslint-plugin-standard": "5.0.0", "expect.js": "0.3.1", "express": "4.18.2", - "fastify": "4.23.2", - "i18next": "23.5.1", + "fastify": "4.24.3", + "i18next": "23.7.1", "mocha": "10.2.0", "supertest": "6.3.3", "tsd": "0.29.0", @@ -70,7 +70,7 @@ "license": "MIT", "scripts": { "lint": "eslint .", - "compile:esm": "rm -rf esm && mkdir esm && BABEL_ENV=esm babel lib -d esm && cp index.d.ts esm/index.d.ts", + "compile:esm": "rm -rf esm && mkdir esm && BABEL_ENV=esm babel lib -d esm && cp index.d.ts esm/index.d.ts && cp index.d.mts esm/index.d.mts", "compile:cjs": "rm -rf cjs && mkdir cjs && BABEL_ENV=cjs babel lib -d cjs && cp index.d.ts cjs/index.d.ts && echo '{\"type\":\"commonjs\"}' > cjs/package.json", "compile": "npm run compile:esm && npm run compile:cjs", "build": "npm run compile", diff --git a/tsconfig.json b/tsconfig.json index 8753b69..5a098cb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,6 +11,7 @@ }, "include": [ "test/types/*.test-d.ts", - "*.d.ts" + "*.d.ts", + "*.d.mts" ] } \ No newline at end of file