From ae502cffdbbb6a710cc4ee8b1313d96151a8cea9 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 17 Nov 2021 13:29:47 -0800 Subject: [PATCH 1/3] Add `types` entry in export map Since the presence of an export map overrides any other entrypoint methods. Technically not required, since `./build/jest.d.ts` is adjacent to `./build/jest.js` and will be found via that adjacency, but can be included for completeness, just like the top-level `"types": "./build/jest.d.ts"` entry. --- packages/jest/package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/jest/package.json b/packages/jest/package.json index cdf5cc21e438..56cfad795f03 100644 --- a/packages/jest/package.json +++ b/packages/jest/package.json @@ -5,7 +5,10 @@ "main": "./build/jest.js", "types": "./build/jest.d.ts", "exports": { - ".": "./build/jest.js", + ".": { + "types": "./build/jest.d.ts", + "default": "./build/jest.js" + }, "./package.json": "./package.json", "./bin/jest": "./bin/jest.js" }, From 423682a00e2d8fa1046f7f3f5699835399a70b6a Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Mon, 29 Nov 2021 13:39:22 +0100 Subject: [PATCH 2/3] all others and build script --- packages/babel-jest/package.json | 5 ++++- packages/babel-plugin-jest-hoist/package.json | 5 ++++- packages/diff-sequences/package.json | 5 ++++- packages/expect/package.json | 5 ++++- packages/jest-changed-files/package.json | 5 ++++- packages/jest-circus/package.json | 5 ++++- packages/jest-cli/package.json | 5 ++++- packages/jest-config/package.json | 5 ++++- packages/jest-console/package.json | 5 ++++- packages/jest-core/package.json | 5 ++++- packages/jest-create-cache-key-function/package.json | 5 ++++- packages/jest-diff/package.json | 5 ++++- packages/jest-docblock/package.json | 5 ++++- packages/jest-each/package.json | 5 ++++- packages/jest-environment-jsdom/package.json | 5 ++++- packages/jest-environment-node/package.json | 5 ++++- packages/jest-environment/package.json | 5 ++++- packages/jest-fake-timers/package.json | 5 ++++- packages/jest-get-type/package.json | 5 ++++- packages/jest-globals/package.json | 5 ++++- packages/jest-haste-map/package.json | 5 ++++- packages/jest-jasmine2/package.json | 5 ++++- packages/jest-leak-detector/package.json | 5 ++++- packages/jest-matcher-utils/package.json | 5 ++++- packages/jest-message-util/package.json | 5 ++++- packages/jest-mock/package.json | 5 ++++- packages/jest-phabricator/package.json | 5 ++++- packages/jest-regex-util/package.json | 5 ++++- packages/jest-repl/package.json | 5 ++++- packages/jest-reporters/package.json | 5 ++++- packages/jest-resolve-dependencies/package.json | 5 ++++- packages/jest-resolve/package.json | 5 ++++- packages/jest-runner/package.json | 5 ++++- packages/jest-runtime/package.json | 5 ++++- packages/jest-serializer/package.json | 5 ++++- packages/jest-snapshot/package.json | 5 ++++- packages/jest-source-map/package.json | 5 ++++- packages/jest-test-result/package.json | 5 ++++- packages/jest-test-sequencer/package.json | 5 ++++- packages/jest-transform/package.json | 5 ++++- packages/jest-types/package.json | 5 ++++- packages/jest-util/package.json | 5 ++++- packages/jest-validate/package.json | 5 ++++- packages/jest-watcher/package.json | 5 ++++- packages/jest-worker/package.json | 5 ++++- packages/pretty-format/package.json | 5 ++++- packages/test-utils/package.json | 5 ++++- scripts/buildUtils.js | 9 ++++++++- 48 files changed, 196 insertions(+), 48 deletions(-) diff --git a/packages/babel-jest/package.json b/packages/babel-jest/package.json index 23e6c9ab3716..98136e8d4db5 100644 --- a/packages/babel-jest/package.json +++ b/packages/babel-jest/package.json @@ -11,7 +11,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/babel-plugin-jest-hoist/package.json b/packages/babel-plugin-jest-hoist/package.json index 1b227eddb44f..1cb04397a1b8 100644 --- a/packages/babel-plugin-jest-hoist/package.json +++ b/packages/babel-plugin-jest-hoist/package.json @@ -13,7 +13,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/diff-sequences/package.json b/packages/diff-sequences/package.json index 8f8743346883..11eea0bb540e 100644 --- a/packages/diff-sequences/package.json +++ b/packages/diff-sequences/package.json @@ -21,7 +21,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "scripts": { diff --git a/packages/expect/package.json b/packages/expect/package.json index 606606abea91..eb5443133664 100644 --- a/packages/expect/package.json +++ b/packages/expect/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json", "./build/utils": "./build/utils.js", "./build/matchers": "./build/matchers.js" diff --git a/packages/jest-changed-files/package.json b/packages/jest-changed-files/package.json index a026b1c1f51e..93dcd500c2af 100644 --- a/packages/jest-changed-files/package.json +++ b/packages/jest-changed-files/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-circus/package.json b/packages/jest-circus/package.json index 4d08abe5f428..bd8de950ec52 100644 --- a/packages/jest-circus/package.json +++ b/packages/jest-circus/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json", "./runner": "./runner.js" }, diff --git a/packages/jest-cli/package.json b/packages/jest-cli/package.json index d96fef5807d6..f28a98ab7a71 100644 --- a/packages/jest-cli/package.json +++ b/packages/jest-cli/package.json @@ -5,7 +5,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json", "./bin/jest": "./bin/jest.js" }, diff --git a/packages/jest-config/package.json b/packages/jest-config/package.json index fed06d4f0b5f..ef6d5ce44d78 100644 --- a/packages/jest-config/package.json +++ b/packages/jest-config/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "peerDependencies": { diff --git a/packages/jest-console/package.json b/packages/jest-console/package.json index e1a8ce5601c7..9e5ba4245874 100644 --- a/packages/jest-console/package.json +++ b/packages/jest-console/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-core/package.json b/packages/jest-core/package.json index 5399799e9ec9..7b3057c6569a 100644 --- a/packages/jest-core/package.json +++ b/packages/jest-core/package.json @@ -5,7 +5,10 @@ "main": "./build/jest.js", "types": "./build/jest.d.ts", "exports": { - ".": "./build/jest.js", + ".": { + "types": "./build/jest.d.ts", + "default": "./build/jest.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-create-cache-key-function/package.json b/packages/jest-create-cache-key-function/package.json index d80a2a942c23..40e9cd7d5060 100644 --- a/packages/jest-create-cache-key-function/package.json +++ b/packages/jest-create-cache-key-function/package.json @@ -20,7 +20,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "publishConfig": { diff --git a/packages/jest-diff/package.json b/packages/jest-diff/package.json index 3ca49e7bf9d7..14590f5d89a7 100644 --- a/packages/jest-diff/package.json +++ b/packages/jest-diff/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-docblock/package.json b/packages/jest-docblock/package.json index 86048d40e695..379931154784 100644 --- a/packages/jest-docblock/package.json +++ b/packages/jest-docblock/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-each/package.json b/packages/jest-each/package.json index 70ac8382486e..453ffd103e32 100644 --- a/packages/jest-each/package.json +++ b/packages/jest-each/package.json @@ -5,7 +5,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "repository": { diff --git a/packages/jest-environment-jsdom/package.json b/packages/jest-environment-jsdom/package.json index 99768919155b..9c2e15b60020 100644 --- a/packages/jest-environment-jsdom/package.json +++ b/packages/jest-environment-jsdom/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-environment-node/package.json b/packages/jest-environment-node/package.json index fbc0a6f918c6..d3f9f4604a2a 100644 --- a/packages/jest-environment-node/package.json +++ b/packages/jest-environment-node/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-environment/package.json b/packages/jest-environment/package.json index f630437cd43c..5e000c5f7596 100644 --- a/packages/jest-environment/package.json +++ b/packages/jest-environment/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-fake-timers/package.json b/packages/jest-fake-timers/package.json index 0b1bf4a01364..bfe2e55bda73 100644 --- a/packages/jest-fake-timers/package.json +++ b/packages/jest-fake-timers/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-get-type/package.json b/packages/jest-get-type/package.json index 70ed94ff079d..74da13dbd414 100644 --- a/packages/jest-get-type/package.json +++ b/packages/jest-get-type/package.json @@ -14,7 +14,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "publishConfig": { diff --git a/packages/jest-globals/package.json b/packages/jest-globals/package.json index c74a0e69a14f..1652921333fc 100644 --- a/packages/jest-globals/package.json +++ b/packages/jest-globals/package.json @@ -13,7 +13,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-haste-map/package.json b/packages/jest-haste-map/package.json index 0817340417e4..3e8784df2f66 100644 --- a/packages/jest-haste-map/package.json +++ b/packages/jest-haste-map/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-jasmine2/package.json b/packages/jest-jasmine2/package.json index dd6d95cecd4a..dedd82e29c70 100644 --- a/packages/jest-jasmine2/package.json +++ b/packages/jest-jasmine2/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-leak-detector/package.json b/packages/jest-leak-detector/package.json index 89689845dc71..e3c9b4800f27 100644 --- a/packages/jest-leak-detector/package.json +++ b/packages/jest-leak-detector/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-matcher-utils/package.json b/packages/jest-matcher-utils/package.json index 466895ca8d04..812b54b3a18a 100644 --- a/packages/jest-matcher-utils/package.json +++ b/packages/jest-matcher-utils/package.json @@ -14,7 +14,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-message-util/package.json b/packages/jest-message-util/package.json index 90a5ef6d1bbc..4ce54e0d3102 100644 --- a/packages/jest-message-util/package.json +++ b/packages/jest-message-util/package.json @@ -13,7 +13,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-mock/package.json b/packages/jest-mock/package.json index 020e0881f6fd..b344ac4850ef 100644 --- a/packages/jest-mock/package.json +++ b/packages/jest-mock/package.json @@ -17,7 +17,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "publishConfig": { diff --git a/packages/jest-phabricator/package.json b/packages/jest-phabricator/package.json index 25e51faab1e2..1f47e48dfa36 100644 --- a/packages/jest-phabricator/package.json +++ b/packages/jest-phabricator/package.json @@ -8,7 +8,10 @@ }, "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-regex-util/package.json b/packages/jest-regex-util/package.json index 233654c75ab8..5516cf3c414c 100644 --- a/packages/jest-regex-util/package.json +++ b/packages/jest-regex-util/package.json @@ -16,7 +16,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "publishConfig": { diff --git a/packages/jest-repl/package.json b/packages/jest-repl/package.json index f1115961f3c7..b3782301bf86 100644 --- a/packages/jest-repl/package.json +++ b/packages/jest-repl/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json", "./bin/jest-repl": "./bin/jest-repl.js", "./bin/jest-runtime-cli": "./bin/jest-runtime-cli.js" diff --git a/packages/jest-reporters/package.json b/packages/jest-reporters/package.json index 908ef2d96900..e7064c41a85d 100644 --- a/packages/jest-reporters/package.json +++ b/packages/jest-reporters/package.json @@ -5,7 +5,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-resolve-dependencies/package.json b/packages/jest-resolve-dependencies/package.json index 6b7b1f3070e8..3afa9cdf8ab6 100644 --- a/packages/jest-resolve-dependencies/package.json +++ b/packages/jest-resolve-dependencies/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-resolve/package.json b/packages/jest-resolve/package.json index f9e72e72e963..fbb38b86ad2c 100644 --- a/packages/jest-resolve/package.json +++ b/packages/jest-resolve/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-runner/package.json b/packages/jest-runner/package.json index c252c232c0bb..a7ff2c88ff77 100644 --- a/packages/jest-runner/package.json +++ b/packages/jest-runner/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-runtime/package.json b/packages/jest-runtime/package.json index 0c07f78d5cf8..a3a16f8a64f7 100644 --- a/packages/jest-runtime/package.json +++ b/packages/jest-runtime/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-serializer/package.json b/packages/jest-serializer/package.json index 522821ab2279..31fc776fb796 100644 --- a/packages/jest-serializer/package.json +++ b/packages/jest-serializer/package.json @@ -20,7 +20,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "publishConfig": { diff --git a/packages/jest-snapshot/package.json b/packages/jest-snapshot/package.json index 3fb5b9aa1f72..d395963b99ad 100644 --- a/packages/jest-snapshot/package.json +++ b/packages/jest-snapshot/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-source-map/package.json b/packages/jest-source-map/package.json index 03844b9914e9..dca05151fa4b 100644 --- a/packages/jest-source-map/package.json +++ b/packages/jest-source-map/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-test-result/package.json b/packages/jest-test-result/package.json index 3cc87d09bee3..2903cad57cb9 100644 --- a/packages/jest-test-result/package.json +++ b/packages/jest-test-result/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-test-sequencer/package.json b/packages/jest-test-sequencer/package.json index 9cd635b19a49..162846124663 100644 --- a/packages/jest-test-sequencer/package.json +++ b/packages/jest-test-sequencer/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-transform/package.json b/packages/jest-transform/package.json index 25622d2344c1..af5bfebc9fec 100644 --- a/packages/jest-transform/package.json +++ b/packages/jest-transform/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-types/package.json b/packages/jest-types/package.json index 5568a6ff62b7..72e587128e99 100644 --- a/packages/jest-types/package.json +++ b/packages/jest-types/package.json @@ -13,7 +13,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-util/package.json b/packages/jest-util/package.json index 6d77e8e19335..3eeac3128c18 100644 --- a/packages/jest-util/package.json +++ b/packages/jest-util/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-validate/package.json b/packages/jest-validate/package.json index 8275587c0de1..28767a121232 100644 --- a/packages/jest-validate/package.json +++ b/packages/jest-validate/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-watcher/package.json b/packages/jest-watcher/package.json index 6b51b676f971..fdef4c9f465e 100644 --- a/packages/jest-watcher/package.json +++ b/packages/jest-watcher/package.json @@ -5,7 +5,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/jest-worker/package.json b/packages/jest-worker/package.json index b74bdd6107f1..2ab28b3b3946 100644 --- a/packages/jest-worker/package.json +++ b/packages/jest-worker/package.json @@ -10,7 +10,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/packages/pretty-format/package.json b/packages/pretty-format/package.json index e1f225c347d2..f47da79a0705 100644 --- a/packages/pretty-format/package.json +++ b/packages/pretty-format/package.json @@ -11,7 +11,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "author": "James Kyle ", diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index b6757aed4ab6..fbc3675c38c1 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -6,7 +6,10 @@ "main": "./build/index.js", "types": "./build/index.d.ts", "exports": { - ".": "./build/index.js", + ".": { + "types": "./build/index.d.ts", + "default": "./build/index.js" + }, "./package.json": "./package.json" }, "dependencies": { diff --git a/scripts/buildUtils.js b/scripts/buildUtils.js index 29f286e11f1e..d2ba6ba08fc6 100644 --- a/scripts/buildUtils.js +++ b/scripts/buildUtils.js @@ -44,7 +44,14 @@ module.exports.getPackages = function getPackages() { assert.deepStrictEqual( pkg.exports, { - '.': pkg.main, + '.': + pkg.types == null + ? pkg.main + : { + types: pkg.types, + // eslint-disable-next-line sort-keys + default: pkg.main, + }, './package.json': './package.json', ...Object.values(pkg.bin || {}).reduce( (mem, curr) => From 7e43b7fb0190d8277c6f0ae9eef2d8e034fcc34f Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Mon, 29 Nov 2021 13:40:39 +0100 Subject: [PATCH 3/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc4241aefb77..2877014ce55e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - `[jest-runner]` Add info regarding timers to forcedExit message([#12083](https://github.com/facebook/jest/pull/12083)) - `[*]` Replaced `substr` method with `substring` ([#12066](https://github.com/facebook/jest/pull/12066)) +- `[*]` Add `types` entry to all export maps ([#12073](https://github.com/facebook/jest/pull/12073)) ### Performance