diff --git a/CHANGELOG.md b/CHANGELOG.md index 80263e7ce1ce..8aeaecf59ead 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ ### Chore & Maintenance +- `[*]` [**BREAKING**] Add `exports` field to all `package.json`s ([#9921](https://github.com/facebook/jest/pull/9921)) + ### Performance ## 26.6.1 diff --git a/packages/babel-jest/package.json b/packages/babel-jest/package.json index 52268dc82315..06609ba5ed7d 100644 --- a/packages/babel-jest/package.json +++ b/packages/babel-jest/package.json @@ -8,8 +8,12 @@ "directory": "packages/babel-jest" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/transform": "^26.6.1", "@jest/types": "^26.6.1", @@ -32,6 +36,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/babel-plugin-jest-hoist/package.json b/packages/babel-plugin-jest-hoist/package.json index 8670cb905ecd..e00fe13111c2 100644 --- a/packages/babel-plugin-jest-hoist/package.json +++ b/packages/babel-plugin-jest-hoist/package.json @@ -10,8 +10,12 @@ "node": ">= 10.14.2" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@babel/template": "^7.3.3", "@babel/types": "^7.3.3", @@ -24,6 +28,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/babel-preset-jest/package.json b/packages/babel-preset-jest/package.json index fab959c1fce4..a7a18455bff8 100644 --- a/packages/babel-preset-jest/package.json +++ b/packages/babel-preset-jest/package.json @@ -7,7 +7,11 @@ "directory": "packages/babel-preset-jest" }, "license": "MIT", - "main": "index.js", + "main": "./index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, "dependencies": { "babel-plugin-jest-hoist": "^26.5.0", "babel-preset-current-node-syntax": "^0.1.3" @@ -20,6 +24,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/diff-sequences/package.json b/packages/diff-sequences/package.json index 3f6785ead7db..9064e2a210fa 100644 --- a/packages/diff-sequences/package.json +++ b/packages/diff-sequences/package.json @@ -18,8 +18,12 @@ "engines": { "node": ">= 10.14.2" }, - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "scripts": { "perf": "node --expose-gc perf/index.js" }, @@ -30,6 +34,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/eslint-config-fb-strict/package.json b/packages/eslint-config-fb-strict/package.json index ced29f6867ef..3d59effd6249 100644 --- a/packages/eslint-config-fb-strict/package.json +++ b/packages/eslint-config-fb-strict/package.json @@ -7,6 +7,11 @@ "directory": "packages/eslint-config-fb-strict" }, "license": "MIT", + "main": "./index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, "dependencies": { "eslint-config-fbjs": "^3.1.1" }, @@ -24,6 +29,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/expect/package.json b/packages/expect/package.json index 101c570772fc..af8363ef1498 100644 --- a/packages/expect/package.json +++ b/packages/expect/package.json @@ -7,8 +7,13 @@ "directory": "packages/expect" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json", + "./build/utils": "./build/utils.js" + }, "dependencies": { "@jest/types": "^26.6.1", "ansi-styles": "^4.0.0", @@ -28,6 +33,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-changed-files/package.json b/packages/jest-changed-files/package.json index 82c73342099b..385c12546f06 100644 --- a/packages/jest-changed-files/package.json +++ b/packages/jest-changed-files/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-changed-files" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/types": "^26.6.1", "execa": "^4.0.0", @@ -19,6 +23,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-circus/package.json b/packages/jest-circus/package.json index 310e94dc9e93..88d445920c0a 100644 --- a/packages/jest-circus/package.json +++ b/packages/jest-circus/package.json @@ -7,8 +7,14 @@ "directory": "packages/jest-circus" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json", + "./runner": "./runner.js", + "./runner.js": "./runner.js" + }, "dependencies": { "@babel/traverse": "^7.1.0", "@jest/environment": "^26.6.1", @@ -49,6 +55,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-cli/package.json b/packages/jest-cli/package.json index 3d878f3dcc56..fda996237adb 100644 --- a/packages/jest-cli/package.json +++ b/packages/jest-cli/package.json @@ -2,8 +2,13 @@ "name": "jest-cli", "description": "Delightful JavaScript Testing.", "version": "26.6.1", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json", + "./bin/jest.js": "./bin/jest.js" + }, "dependencies": { "@jest/core": "^26.6.1", "@jest/test-result": "^26.6.1", @@ -71,6 +76,5 @@ ], "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-config/package.json b/packages/jest-config/package.json index 2fb5d9bfd4c5..bdf4d75436f0 100644 --- a/packages/jest-config/package.json +++ b/packages/jest-config/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-config" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "peerDependencies": { "ts-node": ">=9.0.0" }, @@ -50,6 +54,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-console/package.json b/packages/jest-console/package.json index 84d2d3a510fa..b175aa31cf1d 100644 --- a/packages/jest-console/package.json +++ b/packages/jest-console/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-console" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/types": "^26.6.1", "@types/node": "*", @@ -25,6 +29,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-core/package.json b/packages/jest-core/package.json index 80c4c87ef8ca..c73134b9843c 100644 --- a/packages/jest-core/package.json +++ b/packages/jest-core/package.json @@ -2,8 +2,12 @@ "name": "@jest/core", "description": "Delightful JavaScript Testing.", "version": "26.6.1", - "main": "build/jest.js", - "types": "build/jest.d.ts", + "main": "./build/jest.js", + "types": "./build/jest.d.ts", + "exports": { + ".": "./build/jest.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/console": "^26.6.1", "@jest/reporters": "^26.6.1", @@ -83,6 +87,5 @@ ], "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-create-cache-key-function/package.json b/packages/jest-create-cache-key-function/package.json index 528f1864c606..928b6e082d0b 100644 --- a/packages/jest-create-cache-key-function/package.json +++ b/packages/jest-create-cache-key-function/package.json @@ -13,10 +13,13 @@ "node": ">= 10.14.2" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-diff/package.json b/packages/jest-diff/package.json index f664a6a45380..6b7f10b351fe 100644 --- a/packages/jest-diff/package.json +++ b/packages/jest-diff/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-diff" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "chalk": "^4.0.0", "diff-sequences": "^26.5.0", @@ -24,6 +28,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-docblock/package.json b/packages/jest-docblock/package.json index 49bb6d46c723..2c1f6dcc502b 100644 --- a/packages/jest-docblock/package.json +++ b/packages/jest-docblock/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-docblock" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "detect-newline": "^3.0.0" }, @@ -20,6 +24,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-each/package.json b/packages/jest-each/package.json index 62eed51e5020..7893096a56e9 100644 --- a/packages/jest-each/package.json +++ b/packages/jest-each/package.json @@ -2,8 +2,12 @@ "name": "jest-each", "version": "26.6.1", "description": "Parameterised tests for Jest", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "repository": { "type": "git", "url": "https://github.com/facebook/jest.git", @@ -29,6 +33,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-environment-jsdom/package.json b/packages/jest-environment-jsdom/package.json index 864dd1323b61..e2b0ce38f502 100644 --- a/packages/jest-environment-jsdom/package.json +++ b/packages/jest-environment-jsdom/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-environment-jsdom" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/environment": "^26.6.1", "@jest/fake-timers": "^26.6.1", @@ -26,6 +30,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-environment-node/package.json b/packages/jest-environment-node/package.json index b6b2dcab627e..a2bedd398504 100644 --- a/packages/jest-environment-node/package.json +++ b/packages/jest-environment-node/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-environment-node" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/environment": "^26.6.1", "@jest/fake-timers": "^26.6.1", @@ -22,6 +26,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-environment/package.json b/packages/jest-environment/package.json index 6bd9b2373bbd..333afa339806 100644 --- a/packages/jest-environment/package.json +++ b/packages/jest-environment/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-environment" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/fake-timers": "^26.6.1", "@jest/types": "^26.6.1", @@ -20,6 +24,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-fake-timers/package.json b/packages/jest-fake-timers/package.json index 9b0a320df1e9..206b6d81fcc9 100644 --- a/packages/jest-fake-timers/package.json +++ b/packages/jest-fake-timers/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-fake-timers" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/types": "^26.6.1", "@sinonjs/fake-timers": "^6.0.1", @@ -25,6 +29,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-get-type/package.json b/packages/jest-get-type/package.json index 8f82ed5b44f8..0498eac92f9a 100644 --- a/packages/jest-get-type/package.json +++ b/packages/jest-get-type/package.json @@ -11,10 +11,13 @@ "node": ">= 10.14.2" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-globals/package.json b/packages/jest-globals/package.json index bf43bce78438..b5c8ef59500c 100644 --- a/packages/jest-globals/package.json +++ b/packages/jest-globals/package.json @@ -10,8 +10,12 @@ "node": ">= 10.14.2" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/environment": "^26.6.1", "@jest/types": "^26.6.1", diff --git a/packages/jest-haste-map/package.json b/packages/jest-haste-map/package.json index 2b286efe6375..eb72fe60fb5a 100644 --- a/packages/jest-haste-map/package.json +++ b/packages/jest-haste-map/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-haste-map" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/types": "^26.6.1", "@types/graceful-fs": "^4.1.2", @@ -40,6 +44,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-jasmine2/package.json b/packages/jest-jasmine2/package.json index 78325db682c4..551d735ace1f 100644 --- a/packages/jest-jasmine2/package.json +++ b/packages/jest-jasmine2/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-jasmine2" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@babel/traverse": "^7.1.0", "@jest/environment": "^26.6.1", @@ -38,6 +42,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-leak-detector/package.json b/packages/jest-leak-detector/package.json index e2efc1fc698c..377367ae921a 100644 --- a/packages/jest-leak-detector/package.json +++ b/packages/jest-leak-detector/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-leak-detector" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "jest-get-type": "^26.3.0", "pretty-format": "^26.6.1" @@ -22,6 +26,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-matcher-utils/package.json b/packages/jest-matcher-utils/package.json index d6b41fad6a88..1a2d5a470568 100644 --- a/packages/jest-matcher-utils/package.json +++ b/packages/jest-matcher-utils/package.json @@ -11,8 +11,12 @@ "node": ">= 10.14.2" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "chalk": "^4.0.0", "jest-diff": "^26.6.1", @@ -25,6 +29,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-message-util/package.json b/packages/jest-message-util/package.json index 88332a3c00e3..47f28dc9f014 100644 --- a/packages/jest-message-util/package.json +++ b/packages/jest-message-util/package.json @@ -10,8 +10,12 @@ "node": ">= 10.14.2" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@babel/code-frame": "^7.0.0", "@jest/types": "^26.6.1", @@ -29,6 +33,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-mock/package.json b/packages/jest-mock/package.json index 7deeb25132c7..84d3030cd8d7 100644 --- a/packages/jest-mock/package.json +++ b/packages/jest-mock/package.json @@ -14,10 +14,13 @@ "@types/node": "*" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-phabricator/package.json b/packages/jest-phabricator/package.json index 04d634422e5b..e2eac61c6f31 100644 --- a/packages/jest-phabricator/package.json +++ b/packages/jest-phabricator/package.json @@ -6,7 +6,11 @@ "url": "https://github.com/facebook/jest.git", "directory": "packages/jest-phabricator" }, - "types": "build/index.d.ts", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/test-result": "^26.6.1" }, @@ -14,9 +18,8 @@ "node": ">= 10.14.2" }, "license": "MIT", - "main": "build/index.js", + "main": "./build/index.js", "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-regex-util/package.json b/packages/jest-regex-util/package.json index 0886157f4865..43158cbb15b5 100644 --- a/packages/jest-regex-util/package.json +++ b/packages/jest-regex-util/package.json @@ -13,10 +13,13 @@ "node": ">= 10.14.2" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-repl/package.json b/packages/jest-repl/package.json index c22acc4234c1..b906e1e24c77 100644 --- a/packages/jest-repl/package.json +++ b/packages/jest-repl/package.json @@ -7,8 +7,13 @@ "directory": "packages/jest-repl" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json", + "./bin/jest-repl.js": "./bin/jest-repl.js" + }, "dependencies": { "@jest/transform": "^26.6.1", "@jest/types": "^26.6.1", @@ -28,6 +33,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-reporters/package.json b/packages/jest-reporters/package.json index f3131a1b73c5..c2450c2824c1 100644 --- a/packages/jest-reporters/package.json +++ b/packages/jest-reporters/package.json @@ -2,8 +2,12 @@ "name": "@jest/reporters", "description": "Jest's reporters", "version": "26.6.1", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@bcoe/v8-coverage": "^0.2.3", "@jest/console": "^26.6.1", @@ -61,6 +65,5 @@ "license": "MIT", "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-resolve-dependencies/package.json b/packages/jest-resolve-dependencies/package.json index 17d07289ed01..b086c502b858 100644 --- a/packages/jest-resolve-dependencies/package.json +++ b/packages/jest-resolve-dependencies/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-resolve-dependencies" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/types": "^26.6.1", "jest-regex-util": "^26.0.0", @@ -24,6 +28,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-resolve/package.json b/packages/jest-resolve/package.json index 27019910c544..a1433661ef48 100644 --- a/packages/jest-resolve/package.json +++ b/packages/jest-resolve/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-resolve" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/types": "^26.6.1", "chalk": "^4.0.0", @@ -29,6 +33,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-runner/package.json b/packages/jest-runner/package.json index 8e9760069721..762c22eb2ab0 100644 --- a/packages/jest-runner/package.json +++ b/packages/jest-runner/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-runner" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/console": "^26.6.1", "@jest/environment": "^26.6.1", @@ -42,6 +46,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-runtime/package.json b/packages/jest-runtime/package.json index 61f28a0e58ec..ec61cf0978e9 100644 --- a/packages/jest-runtime/package.json +++ b/packages/jest-runtime/package.json @@ -7,8 +7,13 @@ "directory": "packages/jest-runtime" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json", + "./bin/jest-runtime.js": "./bin/jest-runtime.js" + }, "dependencies": { "@jest/console": "^26.6.1", "@jest/environment": "^26.6.1", @@ -54,6 +59,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-serializer/package.json b/packages/jest-serializer/package.json index 0ab843434e5e..5a675d84d1e5 100644 --- a/packages/jest-serializer/package.json +++ b/packages/jest-serializer/package.json @@ -17,10 +17,13 @@ "node": ">= 10.14.2" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-snapshot/package.json b/packages/jest-snapshot/package.json index c6863b89f0e1..1f699127cf1f 100644 --- a/packages/jest-snapshot/package.json +++ b/packages/jest-snapshot/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-snapshot" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@babel/types": "^7.0.0", "@jest/types": "^26.6.1", @@ -41,6 +45,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-snapshot/src/printSnapshot.ts b/packages/jest-snapshot/src/printSnapshot.ts index ddd5814b0b14..9b17e995601c 100644 --- a/packages/jest-snapshot/src/printSnapshot.ts +++ b/packages/jest-snapshot/src/printSnapshot.ts @@ -11,6 +11,7 @@ import chalk = require('chalk'); // Temporary hack because getObjectSubset has known limitations, // is not in the public interface of the expect package, // and the long-term goal is to use a non-serialization diff. +// Make sure to remove file from `exports` in `expect/package.json`. import {getObjectSubset} from 'expect/build/utils'; import { DIFF_DELETE, diff --git a/packages/jest-source-map/package.json b/packages/jest-source-map/package.json index eff5578779e2..80a2304dd754 100644 --- a/packages/jest-source-map/package.json +++ b/packages/jest-source-map/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-source-map" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "callsites": "^3.0.0", "graceful-fs": "^4.2.4", @@ -22,6 +26,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-test-result/package.json b/packages/jest-test-result/package.json index 18184ac16a6d..1fdca9f1f663 100644 --- a/packages/jest-test-result/package.json +++ b/packages/jest-test-result/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-test-result" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/console": "^26.6.1", "@jest/types": "^26.6.1", @@ -20,6 +24,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-test-sequencer/package.json b/packages/jest-test-sequencer/package.json index 73274feddaf4..d49b90710d4d 100644 --- a/packages/jest-test-sequencer/package.json +++ b/packages/jest-test-sequencer/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-test-sequencer" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/test-result": "^26.6.1", "graceful-fs": "^4.2.4", @@ -24,6 +28,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-transform/package.json b/packages/jest-transform/package.json index e675237f56c7..20f3d9b2919d 100644 --- a/packages/jest-transform/package.json +++ b/packages/jest-transform/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-transform" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@babel/core": "^7.1.0", "@jest/types": "^26.6.1", @@ -41,6 +45,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-types/package.json b/packages/jest-types/package.json index 6e91f418cfef..1433be5796a7 100644 --- a/packages/jest-types/package.json +++ b/packages/jest-types/package.json @@ -10,8 +10,12 @@ "node": ">= 10.14.2" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", @@ -21,6 +25,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-util/package.json b/packages/jest-util/package.json index dc18e25bf045..36753898687b 100644 --- a/packages/jest-util/package.json +++ b/packages/jest-util/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-util" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/types": "^26.6.1", "@types/node": "*", @@ -27,6 +31,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-validate/package.json b/packages/jest-validate/package.json index c8ccf29824b6..5eaf5858f21b 100644 --- a/packages/jest-validate/package.json +++ b/packages/jest-validate/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-validate" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/types": "^26.6.1", "camelcase": "^6.0.0", @@ -25,6 +29,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-watcher/package.json b/packages/jest-watcher/package.json index a77a71cb1422..a473dbdfabfa 100644 --- a/packages/jest-watcher/package.json +++ b/packages/jest-watcher/package.json @@ -2,8 +2,12 @@ "name": "jest-watcher", "description": "Delightful JavaScript Testing.", "version": "26.6.1", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@jest/test-result": "^26.6.1", "@jest/types": "^26.6.1", @@ -28,6 +32,5 @@ "license": "MIT", "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest-worker/package.json b/packages/jest-worker/package.json index db8b377981b3..f0b76232ce5a 100644 --- a/packages/jest-worker/package.json +++ b/packages/jest-worker/package.json @@ -7,8 +7,12 @@ "directory": "packages/jest-worker" }, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@types/node": "*", "merge-stream": "^2.0.0", @@ -25,6 +29,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/jest/package.json b/packages/jest/package.json index 41c2aaae62b6..3f629d6fbe82 100644 --- a/packages/jest/package.json +++ b/packages/jest/package.json @@ -2,8 +2,13 @@ "name": "jest", "description": "Delightful JavaScript Testing.", "version": "26.6.1", - "main": "build/jest.js", - "types": "build/jest.d.ts", + "main": "./build/jest.js", + "types": "./build/jest.d.ts", + "exports": { + ".": "./build/jest.js", + "./package.json": "./package.json", + "./bin/jest.js": "./bin/jest.js" + }, "dependencies": { "@jest/core": "^26.6.1", "import-local": "^3.0.2", @@ -47,6 +52,5 @@ ], "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/pretty-format/package.json b/packages/pretty-format/package.json index 443d14aa266c..d39a7e59593b 100644 --- a/packages/pretty-format/package.json +++ b/packages/pretty-format/package.json @@ -8,8 +8,12 @@ }, "license": "MIT", "description": "Stringify any JavaScript value.", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "author": "James Kyle ", "dependencies": { "@jest/types": "^26.6.1", @@ -32,6 +36,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" + } } diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index 16686dd92ff1..4cde0a703b5d 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -3,8 +3,12 @@ "version": "26.5.0", "private": true, "license": "MIT", - "main": "build/index.js", - "types": "build/index.d.ts", + "main": "./build/index.js", + "types": "./build/index.d.ts", + "exports": { + ".": "./build/index.js", + "./package.json": "./package.json" + }, "dependencies": { "@types/jest": "*", "@types/node": "*", diff --git a/scripts/buildUtils.js b/scripts/buildUtils.js index 979636c24016..82e867e26df9 100644 --- a/scripts/buildUtils.js +++ b/scripts/buildUtils.js @@ -42,6 +42,24 @@ module.exports.getPackages = function getPackages() { : nodeEngineRequirement, `Engine requirement in ${pkg.name} should match root`, ); + + assert.ok(pkg.exports, `Package ${pkg.name} is missing \`exports\` field`); + assert.deepStrictEqual( + pkg.exports, + { + '.': pkg.main, + './package.json': './package.json', + ...Object.values(pkg.bin || {}).reduce( + (mem, curr) => Object.assign(mem, {[curr]: curr}), + {}, + ), + ...(pkg.name === 'jest-circus' + ? {'./runner': './runner.js', './runner.js': './runner.js'} + : {}), + ...(pkg.name === 'expect' ? {'./build/utils': './build/utils.js'} : {}), + }, + `Package ${pkg.name} does not export correct files`, + ); }); return packages;