From 1a6d11fdda33a03d280c3603ff39b63ffa53a1e2 Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Tue, 25 Mar 2025 18:16:53 +0900 Subject: [PATCH] fix: add `exports` to `package.json` Add Node.JS export conditions to `package.json`, so that the examples of things like `import '@cypress/code-coverage/support'` continue to work in Node.JS v20.19.0. I believe I've added `package.json` too since it's theoretically possible somebody did `require("@cypress/code-coverage/package.json")`, so we should support that too. See: https://nodejs.org/api/packages.html#exports --- package.json | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 649a0c2d..1d0209bb 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,6 @@ "name": "@cypress/code-coverage", "version": "0.0.0-development", "description": "Saves the code coverage collected during Cypress tests", - "main": "index.js", "scripts": { "start": "parcel serve cypress/index.html", "coverage:verify": "npx nyc report --check-coverage true --lines 80", @@ -24,6 +23,24 @@ "cypress": "*", "webpack": "^4 || ^5" }, + "exports": { + "./common-utils": "./common-utils.js", + "./cypress-config": "./cypress-config.js", + "./middleware/express": "./middleware/express.js", + "./middleware/hapi": "./middleware/hapi.js", + "./middleware/nextjs": "./middleware/nextjs.js", + "./package.json": "./package.json", + "./plugins": "./plugins.js", + "./support-utils": "./support-utils.js", + "./support": "./support.js", + "./task-utils": "./task-utils.js", + "./task": { + "types": "./task.d.ts", + "default": "./task.js" + }, + "./use-babelrc": "./use-babelrc.js", + "./*.js": "./*.js" + }, "repository": { "type": "git", "url": "https://github.com/cypress-io/code-coverage.git"