From 8df344f223adc1edd503ead801a0952a1809a555 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Fri, 23 Feb 2024 16:54:22 -0500 Subject: [PATCH 01/11] feat: switch to ESM output BREAKING CHANGE: Output a single ESM bundle --- package-lock.json | 277 +++++++++++++++++++++++++++------------- package.json | 17 ++- scripts/build.mjs | 39 ++---- test/tsconfig.test.json | 1 - 4 files changed, 214 insertions(+), 120 deletions(-) diff --git a/package-lock.json b/package-lock.json index 920d1fcfa..a07bad5a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,14 +9,14 @@ "version": "0.0.0-development", "license": "MIT", "dependencies": { - "@octokit/endpoint": "^9.0.0", - "@octokit/request-error": "^5.0.0", + "@octokit/endpoint": "^10.0.0", + "@octokit/request-error": "^6.0.1", "@octokit/types": "^12.0.0", - "universal-user-agent": "^6.0.0" + "universal-user-agent": "^7.0.2" }, "devDependencies": { "@octokit/auth-app": "^6.0.0", - "@octokit/tsconfig": "^2.0.0", + "@octokit/tsconfig": "^3.0.0", "@types/fetch-mock": "^7.2.4", "@types/jest": "^29.0.0", "@types/lolex": "^5.1.0", @@ -1892,6 +1892,35 @@ "node": ">= 18" } }, + "node_modules/@octokit/auth-app/node_modules/@octokit/request-error": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.0.1.tgz", + "integrity": "sha512-X7pnyTMV7MgtGmiXBwmO6M5kIPrntOXdyKZLigNfQWSEQzVxR4a4vo49vJjTWX70mPndj8KhfT4Dx+2Ng3vnBQ==", + "dev": true, + "dependencies": { + "@octokit/types": "^12.0.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/auth-app/node_modules/@octokit/request-error/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true + }, + "node_modules/@octokit/auth-app/node_modules/@octokit/request-error/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, "node_modules/@octokit/auth-app/node_modules/@octokit/types": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-11.1.0.tgz", @@ -1910,6 +1939,12 @@ "node": "14 || >=16.14" } }, + "node_modules/@octokit/auth-app/node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "dev": true + }, "node_modules/@octokit/auth-oauth-app": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-app/-/auth-oauth-app-7.0.0.tgz", @@ -1937,6 +1972,12 @@ "@octokit/openapi-types": "^18.0.0" } }, + "node_modules/@octokit/auth-oauth-app/node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "dev": true + }, "node_modules/@octokit/auth-oauth-device": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-device/-/auth-oauth-device-6.0.0.tgz", @@ -1961,6 +2002,12 @@ "@octokit/openapi-types": "^18.0.0" } }, + "node_modules/@octokit/auth-oauth-device/node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "dev": true + }, "node_modules/@octokit/auth-oauth-user": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-user/-/auth-oauth-user-4.0.0.tgz", @@ -1987,27 +2034,24 @@ "@octokit/openapi-types": "^18.0.0" } }, + "node_modules/@octokit/auth-oauth-user/node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "dev": true + }, "node_modules/@octokit/endpoint": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.0.tgz", - "integrity": "sha512-szrQhiqJ88gghWY2Htt8MqUDO6++E/EIXqJ2ZEp5ma3uGS46o7LZAzSLt49myB7rT+Hfw5Y6gO3LmOxGzHijAQ==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.0.0.tgz", + "integrity": "sha512-emBcNDxBdC1y3+knJonS5zhUB/CG6TihubxM2U1/pG/Z1y3a4oV0Gzz3lmkCvWWQI6h3tqBAX9MgCBFp+M68Jw==", "dependencies": { - "@octokit/types": "^11.0.0", - "is-plain-object": "^5.0.0", - "universal-user-agent": "^6.0.0" + "@octokit/types": "^12.0.0", + "universal-user-agent": "^7.0.2" }, "engines": { "node": ">= 18" } }, - "node_modules/@octokit/endpoint/node_modules/@octokit/types": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-11.1.0.tgz", - "integrity": "sha512-Fz0+7GyLm/bHt8fwEqgvRBWwIV1S6wRRyq+V6exRKLVWaKGsuy6H9QFYeBVDV7rK6fO3XwHgQOPxv+cLj2zpXQ==", - "dependencies": { - "@octokit/openapi-types": "^18.0.0" - } - }, "node_modules/@octokit/oauth-authorization-url": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/@octokit/oauth-authorization-url/-/oauth-authorization-url-6.0.2.tgz", @@ -2033,6 +2077,35 @@ "node": ">= 18" } }, + "node_modules/@octokit/oauth-methods/node_modules/@octokit/request-error": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.0.1.tgz", + "integrity": "sha512-X7pnyTMV7MgtGmiXBwmO6M5kIPrntOXdyKZLigNfQWSEQzVxR4a4vo49vJjTWX70mPndj8KhfT4Dx+2Ng3vnBQ==", + "dev": true, + "dependencies": { + "@octokit/types": "^12.0.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/oauth-methods/node_modules/@octokit/request-error/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true + }, + "node_modules/@octokit/oauth-methods/node_modules/@octokit/request-error/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, "node_modules/@octokit/oauth-methods/node_modules/@octokit/types": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-11.1.0.tgz", @@ -2045,7 +2118,8 @@ "node_modules/@octokit/openapi-types": { "version": "18.0.0", "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-18.0.0.tgz", - "integrity": "sha512-V8GImKs3TeQRxRtXFpG2wl19V7444NIOTDF24AWuIbmNaNYOQMWRbjcGDXV5B+0n887fgDcuMNOmlul+k+oJtw==" + "integrity": "sha512-V8GImKs3TeQRxRtXFpG2wl19V7444NIOTDF24AWuIbmNaNYOQMWRbjcGDXV5B+0n887fgDcuMNOmlul+k+oJtw==", + "dev": true }, "node_modules/@octokit/request": { "version": "8.0.2", @@ -2064,11 +2138,51 @@ } }, "node_modules/@octokit/request-error": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.0.0.tgz", - "integrity": "sha512-1ue0DH0Lif5iEqT52+Rf/hf0RmGO9NWFjrzmrkArpG9trFfDM/efx00BJHdLGuro4BR/gECxCU2Twf5OKrRFsQ==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.0.1.tgz", + "integrity": "sha512-EPeILOAEGqwmEG6g7dYlbvqkjJ5nWNcZvQpgeLEn1MieIcJ0xK0CJtvVcIMXqzIM8DOWzvI6zL5FQAwjTvk/Tg==", "dependencies": { - "@octokit/types": "^11.0.0", + "@octokit/types": "^12.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/request/node_modules/@octokit/endpoint": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.4.tgz", + "integrity": "sha512-DWPLtr1Kz3tv8L0UvXTDP1fNwM0S+z6EJpRcvH66orY6Eld4XBMCSYsaWp4xIm61jTWxK68BrR7ibO+vSDnZqw==", + "dev": true, + "dependencies": { + "@octokit/types": "^12.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/request/node_modules/@octokit/endpoint/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true + }, + "node_modules/@octokit/request/node_modules/@octokit/endpoint/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/request/node_modules/@octokit/request-error": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.0.1.tgz", + "integrity": "sha512-X7pnyTMV7MgtGmiXBwmO6M5kIPrntOXdyKZLigNfQWSEQzVxR4a4vo49vJjTWX70mPndj8KhfT4Dx+2Ng3vnBQ==", + "dev": true, + "dependencies": { + "@octokit/types": "^12.0.0", "deprecation": "^2.0.0", "once": "^1.4.0" }, @@ -2076,12 +2190,19 @@ "node": ">= 18" } }, - "node_modules/@octokit/request-error/node_modules/@octokit/types": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-11.1.0.tgz", - "integrity": "sha512-Fz0+7GyLm/bHt8fwEqgvRBWwIV1S6wRRyq+V6exRKLVWaKGsuy6H9QFYeBVDV7rK6fO3XwHgQOPxv+cLj2zpXQ==", + "node_modules/@octokit/request/node_modules/@octokit/request-error/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true + }, + "node_modules/@octokit/request/node_modules/@octokit/request-error/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, "dependencies": { - "@octokit/openapi-types": "^18.0.0" + "@octokit/openapi-types": "^20.0.0" } }, "node_modules/@octokit/request/node_modules/@octokit/types": { @@ -2093,10 +2214,16 @@ "@octokit/openapi-types": "^18.0.0" } }, + "node_modules/@octokit/request/node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "dev": true + }, "node_modules/@octokit/tsconfig": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@octokit/tsconfig/-/tsconfig-2.0.0.tgz", - "integrity": "sha512-tWnrai3quGt8+gRN2edzo9fmraWekeryXPeXDomMw2oFSpu/lH3VSWGn/q4V+rwjTRMeeXk/ci623/01Zet4VQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@octokit/tsconfig/-/tsconfig-3.0.0.tgz", + "integrity": "sha512-tQLwgXYfBq9iUbOq26kWCzsJL6DY7qjOLzqcg5tCFQ4ob48H47iX98NudHW7S5OQ/fpSKYJhb3eQehyBNzYjfA==", "dev": true }, "node_modules/@octokit/types": { @@ -2796,7 +2923,8 @@ "node_modules/deprecation": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", - "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", + "dev": true }, "node_modules/detect-newline": { "version": "3.1.0", @@ -3365,6 +3493,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -4922,21 +5051,6 @@ "node": ">=8" } }, - "node_modules/jest-snapshot/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/jest-snapshot/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -5358,21 +5472,6 @@ "npm": ">=6" } }, - "node_modules/jsonwebtoken/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/jwa": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", @@ -5642,6 +5741,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "dependencies": { "wrappy": "1" } @@ -6000,6 +6100,21 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -6294,32 +6409,32 @@ } }, "node_modules/ts-jest": { - "version": "29.0.3", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.0.3.tgz", - "integrity": "sha512-Ibygvmuyq1qp/z3yTh9QTwVVAbFdDy/+4BtIQR2sp6baF2SJU/8CKK/hhnGIDY2L90Az2jIqTwZPnN2p+BweiQ==", + "version": "29.1.2", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", + "integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==", "dev": true, "dependencies": { "bs-logger": "0.x", "fast-json-stable-stringify": "2.x", "jest-util": "^29.0.0", - "json5": "^2.2.1", + "json5": "^2.2.3", "lodash.memoize": "4.x", "make-error": "1.x", - "semver": "7.x", + "semver": "^7.5.3", "yargs-parser": "^21.0.1" }, "bin": { "ts-jest": "cli.js" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.0.0 || >=20.0.0" }, "peerDependencies": { "@babel/core": ">=7.0.0-beta.0 <8", "@jest/types": "^29.0.0", "babel-jest": "^29.0.0", "jest": "^29.0.0", - "typescript": ">=4.3" + "typescript": ">=4.3 <6" }, "peerDependenciesMeta": { "@babel/core": { @@ -6336,21 +6451,6 @@ } } }, - "node_modules/ts-jest/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -6402,9 +6502,9 @@ } }, "node_modules/universal-user-agent": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", - "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.2.tgz", + "integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==" }, "node_modules/update-browserslist-db": { "version": "1.0.10", @@ -6664,7 +6764,8 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true }, "node_modules/write-file-atomic": { "version": "4.0.2", diff --git a/package.json b/package.json index 980bbd218..2b843b950 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "@octokit/request", "version": "0.0.0-development", + "type": "module", "publishConfig": { "access": "public" }, @@ -10,7 +11,7 @@ "lint": "prettier --check '{src,test}/**/*' README.md package.json", "lint:fix": "prettier --write '{src,test}/**/*' README.md package.json", "pretest": "npm run -s lint", - "test": "jest --coverage" + "test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" npx jest --coverage" }, "repository": "github:octokit/request.js", "keywords": [ @@ -22,14 +23,14 @@ "author": "Gregor Martynus (https://github.com/gr2m)", "license": "MIT", "dependencies": { - "@octokit/endpoint": "^9.0.0", - "@octokit/request-error": "^5.0.0", + "@octokit/endpoint": "^10.0.0", + "@octokit/request-error": "^6.0.1", "@octokit/types": "^12.0.0", - "universal-user-agent": "^6.0.0" + "universal-user-agent": "^7.0.2" }, "devDependencies": { "@octokit/auth-app": "^6.0.0", - "@octokit/tsconfig": "^2.0.0", + "@octokit/tsconfig": "^3.0.0", "@types/fetch-mock": "^7.2.4", "@types/jest": "^29.0.0", "@types/lolex": "^5.1.0", @@ -48,10 +49,14 @@ }, "jest": { "transform": { + "extensionsToTreatAsEsm": [ + ".ts" + ], "^.+\\.(ts|tsx)$": [ "ts-jest", { - "tsconfig": "test/tsconfig.test.json" + "tsconfig": "test/tsconfig.test.json", + "useESM": true } ] }, diff --git a/scripts/build.mjs b/scripts/build.mjs index c573f6340..0f4437e90 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -35,27 +35,14 @@ async function main() { const entryPoints = ["./pkg/dist-src/index.js"]; - await Promise.all([ - // Build the a CJS Node.js bundle - esbuild.build({ - entryPoints, - outdir: "pkg/dist-node", - bundle: true, - platform: "node", - target: "node14", - format: "cjs", - ...sharedOptions, - }), - // Build an ESM browser bundle - esbuild.build({ - entryPoints, - outdir: "pkg/dist-web", - bundle: true, - platform: "browser", - format: "esm", - ...sharedOptions, - }), - ]); + await esbuild.build({ + entryPoints, + outdir: "pkg/dist-bundle", + bundle: true, + platform: "neutral", + format: "esm", + ...sharedOptions, + }); // Copy the README, LICENSE to the pkg folder await copyFile("LICENSE", "pkg/LICENSE"); @@ -74,10 +61,12 @@ async function main() { { ...pkg, files: ["dist-*/**", "bin/**"], - main: "dist-node/index.js", - browser: "dist-web/index.js", - types: "dist-types/index.d.ts", - module: "dist-src/index.js", + exports: { + ".": { + types: "./dist-types/index.d.ts", + import: "./dist-bundle/index.js", + }, + }, sideEffects: false, }, null, diff --git a/test/tsconfig.test.json b/test/tsconfig.test.json index 5e8dc2487..cf1f2005d 100644 --- a/test/tsconfig.test.json +++ b/test/tsconfig.test.json @@ -3,7 +3,6 @@ "compilerOptions": { "emitDeclarationOnly": false, "noEmit": true, - "verbatimModuleSyntax": false, "allowImportingTsExtensions": true }, "include": ["src/**/*"] From 718723c308c3dfe229c3418e1b7001a9978ee521 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Fri, 23 Feb 2024 17:31:23 -0500 Subject: [PATCH 02/11] build(lockFile): update typescript --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index a07bad5a3..59ad5e460 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6473,16 +6473,16 @@ } }, "node_modules/typescript": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", - "integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=12.20" + "node": ">=14.17" } }, "node_modules/undici-types": { From 0c23205b7b89167eb74594f42521e5e3c877e7dd Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Fri, 23 Feb 2024 17:31:43 -0500 Subject: [PATCH 03/11] docs(README): replace CJS with ESM imports --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 6f80026f2..81f275f96 100644 --- a/README.md +++ b/README.md @@ -87,8 +87,7 @@ Node Install with npm install @octokit/request ```js -const { request } = require("@octokit/request"); -// or: import { request } from "@octokit/request"; +import { request } from "@octokit/request"; ``` From ca9eb20ba8f7f5f28b906b4f4c8c6739f6b518a7 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Fri, 23 Feb 2024 17:33:19 -0500 Subject: [PATCH 04/11] fix: improve spec compliance The spec defines Header values as strings --- src/fetch-wrapper.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/fetch-wrapper.ts b/src/fetch-wrapper.ts index bf65ba426..f7b789456 100644 --- a/src/fetch-wrapper.ts +++ b/src/fetch-wrapper.ts @@ -39,7 +39,11 @@ export default function fetchWrapper( return fetch(requestOptions.url, { method: requestOptions.method, body: requestOptions.body, - headers: requestOptions.headers as HeadersInit, + // Header values must be `string` + headers: Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value), + ]), signal: requestOptions.request?.signal, // duplex must be set if request.body is ReadableStream or Async Iterables. // See https://fetch.spec.whatwg.org/#dom-requestinit-duplex. From af7617287cd4413a80401d392f39bdcbcc389cb2 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Fri, 23 Feb 2024 17:33:53 -0500 Subject: [PATCH 05/11] build(tsconfig): add `dom` lib to ensure browser compat --- tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tsconfig.json b/tsconfig.json index c684ab8d2..05fb0d8d2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "@octokit/tsconfig", "compilerOptions": { + "lib": ["dom", "DOM.Iterable", "es2023"], "esModuleInterop": true, "declaration": true, "outDir": "pkg/dist-types", From 627e14cd2e104735629117cc9b37f4e0a3249c26 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Fri, 23 Feb 2024 17:39:51 -0500 Subject: [PATCH 06/11] test: fix jest config --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 2b843b950..8d773ad88 100644 --- a/package.json +++ b/package.json @@ -48,10 +48,10 @@ "typescript": "^5.0.0" }, "jest": { + "extensionsToTreatAsEsm": [ + ".ts" + ], "transform": { - "extensionsToTreatAsEsm": [ - ".ts" - ], "^.+\\.(ts|tsx)$": [ "ts-jest", { From 89961ac315dca9a65aeaf314eaba6161c0b4ca2f Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Fri, 23 Feb 2024 17:41:54 -0500 Subject: [PATCH 07/11] test: remove need for `string-to-arraybuffer` --- package-lock.json | 23 ----------------------- package.json | 1 - test/request.test.ts | 4 +++- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index 59ad5e460..485df947c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,6 @@ "lolex": "^6.0.0", "prettier": "3.2.5", "semantic-release-plugin-update-version-in-files": "^1.0.0", - "string-to-arraybuffer": "^1.0.2", "ts-jest": "^29.0.0", "typescript": "^5.0.0" }, @@ -2460,12 +2459,6 @@ "sprintf-js": "~1.0.2" } }, - "node_modules/atob-lite": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz", - "integrity": "sha512-LEeSAWeh2Gfa2FtlQE1shxQ8zi5F9GHarrGKz08TMdODD5T4eH6BMsvtnhbWZ+XQn+Gb6om/917ucvRu7l7ukw==", - "dev": true - }, "node_modules/babel-jest": { "version": "29.3.1", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.3.1.tgz", @@ -3453,12 +3446,6 @@ "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, - "node_modules/is-base64": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-base64/-/is-base64-0.1.0.tgz", - "integrity": "sha512-WRRyllsGXJM7ZN7gPTCCQ/6wNPTRDwiWdPK66l5sJzcU/oOzcIcRRf0Rux8bkpox/1yjt0F6VJRsQOIG2qz5sg==", - "dev": true - }, "node_modules/is-core-module": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", @@ -6216,16 +6203,6 @@ "node": ">=8" } }, - "node_modules/string-to-arraybuffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-to-arraybuffer/-/string-to-arraybuffer-1.0.2.tgz", - "integrity": "sha512-DaGZidzi93dwjQen5I2osxR9ERS/R7B1PFyufNMnzhj+fmlDQAc1DSDIJVJhgI8Oq221efIMbABUBdPHDRt43Q==", - "dev": true, - "dependencies": { - "atob-lite": "^2.0.0", - "is-base64": "^0.1.0" - } - }, "node_modules/string-width-cjs": { "name": "string-width", "version": "4.2.3", diff --git a/package.json b/package.json index 8d773ad88..ecc67697e 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "lolex": "^6.0.0", "prettier": "3.2.5", "semantic-release-plugin-update-version-in-files": "^1.0.0", - "string-to-arraybuffer": "^1.0.2", "ts-jest": "^29.0.0", "typescript": "^5.0.0" }, diff --git a/test/request.test.ts b/test/request.test.ts index bb398a907..7c4341917 100644 --- a/test/request.test.ts +++ b/test/request.test.ts @@ -15,7 +15,9 @@ import type { import { request } from "../src/index.ts"; const userAgent = `octokit-request.js/0.0.0-development ${getUserAgent()}`; -const stringToArrayBuffer = require("string-to-arraybuffer"); +function stringToArrayBuffer(str: string) { + return new TextEncoder().encode(str).buffer; +} describe("request()", () => { it("is a function", () => { From 0e8bfe3bd57ee22b930d4ed48af2746125abf7f7 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Fri, 23 Feb 2024 17:44:58 -0500 Subject: [PATCH 08/11] test: add import for `jest` global --- test/request.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/request.test.ts b/test/request.test.ts index 7c4341917..0483a4f16 100644 --- a/test/request.test.ts +++ b/test/request.test.ts @@ -13,6 +13,7 @@ import type { } from "@octokit/types"; import { request } from "../src/index.ts"; +import { jest } from "@jest/globals"; const userAgent = `octokit-request.js/0.0.0-development ${getUserAgent()}`; function stringToArrayBuffer(str: string) { From ffcd792f43ee0ab137f4f5f087d5485729e33be6 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Fri, 23 Feb 2024 17:47:33 -0500 Subject: [PATCH 09/11] test: add `__filename` polyfill --- test/request.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/request.test.ts b/test/request.test.ts index 0483a4f16..82748d82c 100644 --- a/test/request.test.ts +++ b/test/request.test.ts @@ -16,6 +16,7 @@ import { request } from "../src/index.ts"; import { jest } from "@jest/globals"; const userAgent = `octokit-request.js/0.0.0-development ${getUserAgent()}`; +const __filename = new URL(import.meta.url); function stringToArrayBuffer(str: string) { return new TextEncoder().encode(str).buffer; } From d7387e132d8c7e14347539be3abcfa45fcc15dfd Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Fri, 23 Feb 2024 17:52:11 -0500 Subject: [PATCH 10/11] test: replace `lolex` with `@sinonjs/fake-timers` --- package-lock.json | 51 ++++++++++++++++++++++++++++---------------- package.json | 4 +++- test/request.test.ts | 4 ++-- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 485df947c..f799e5d4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,16 +17,17 @@ "devDependencies": { "@octokit/auth-app": "^6.0.0", "@octokit/tsconfig": "^3.0.0", + "@sinonjs/fake-timers": "^11.2.2", "@types/fetch-mock": "^7.2.4", "@types/jest": "^29.0.0", "@types/lolex": "^5.1.0", "@types/node": "^20.0.0", "@types/once": "^1.4.0", + "@types/sinonjs__fake-timers": "^8.1.5", "esbuild": "^0.20.0", "fetch-mock": "npm:@gr2m/fetch-mock@^9.11.0-pull-request-644.1", "glob": "^10.2.4", "jest": "^29.0.0", - "lolex": "^6.0.0", "prettier": "3.2.5", "semantic-release-plugin-update-version-in-files": "^1.0.0", "ts-jest": "^29.0.0", @@ -1410,6 +1411,24 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/@jest/fake-timers/node_modules/@sinonjs/commons": { + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz", + "integrity": "sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz", + "integrity": "sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^1.7.0" + } + }, "node_modules/@jest/globals": { "version": "29.3.1", "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.3.1.tgz", @@ -2255,21 +2274,21 @@ "dev": true }, "node_modules/@sinonjs/commons": { - "version": "1.8.6", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz", - "integrity": "sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", "dev": true, "dependencies": { "type-detect": "4.0.8" } }, "node_modules/@sinonjs/fake-timers": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz", - "integrity": "sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==", + "version": "11.2.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-11.2.2.tgz", + "integrity": "sha512-G2piCSxQ7oWOxwGSAyFHfPIsyeJGXYtc6mFbnFA+kRXkiEnTl8c/8jul2S329iFBnDI9HGoeWWAZvuvOkZccgw==", "dev": true, "dependencies": { - "@sinonjs/commons": "^1.7.0" + "@sinonjs/commons": "^3.0.0" } }, "node_modules/@types/babel__core": { @@ -2404,6 +2423,12 @@ "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", "dev": true }, + "node_modules/@types/sinonjs__fake-timers": { + "version": "8.1.5", + "resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.5.tgz", + "integrity": "sha512-mQkU2jY8jJEF7YHjHvsQO8+3ughTL1mcnn96igfhONmR+fUPSKIkefQYpSe8bsly2Ep7oQbn/6VG5/9/0qcArQ==", + "dev": true + }, "node_modules/@types/stack-utils": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", @@ -5540,16 +5565,6 @@ "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==", "dev": true }, - "node_modules/lolex": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-6.0.0.tgz", - "integrity": "sha512-ad9IBHbfVJ3bPAotDxnCgJgKcNK5/mrRAfbJzXhY5+PEmuBWP7wyHQlA6L8TfSfPlqlDjY4K7IG6mbzsrIBx1A==", - "deprecated": "lolex has been renamed to @sinonjs/fake-timers. No API changes made. Please use the new package instead", - "dev": true, - "dependencies": { - "@sinonjs/commons": "^1.7.0" - } - }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", diff --git a/package.json b/package.json index ecc67697e..efbe66c28 100644 --- a/package.json +++ b/package.json @@ -36,11 +36,12 @@ "@types/lolex": "^5.1.0", "@types/node": "^20.0.0", "@types/once": "^1.4.0", + "@types/sinonjs__fake-timers": "^8.1.5", + "@sinonjs/fake-timers": "^11.2.2", "esbuild": "^0.20.0", "fetch-mock": "npm:@gr2m/fetch-mock@^9.11.0-pull-request-644.1", "glob": "^10.2.4", "jest": "^29.0.0", - "lolex": "^6.0.0", "prettier": "3.2.5", "semantic-release-plugin-update-version-in-files": "^1.0.0", "ts-jest": "^29.0.0", @@ -70,6 +71,7 @@ "modulePathIgnorePatterns": [ "/pkg" ], + "testEnvironment": "node", "moduleNameMapper": { "^(.+)\\.jsx?$": "$1" } diff --git a/test/request.test.ts b/test/request.test.ts index 82748d82c..fae7d0503 100644 --- a/test/request.test.ts +++ b/test/request.test.ts @@ -5,7 +5,7 @@ import { ReadableStream } from "node:stream/web"; import { getUserAgent } from "universal-user-agent"; import fetchMock from "fetch-mock"; import { createAppAuth } from "@octokit/auth-app"; -import lolex from "lolex"; +import fakeTimers from "@sinonjs/fake-timers"; import type { EndpointOptions, RequestInterface, @@ -73,7 +73,7 @@ describe("request()", () => { }); it("README authentication example", async () => { - const clock = lolex.install({ + const clock = fakeTimers.install({ now: 0, toFake: ["Date"], }); From 6de06fb72c7b23a3bec5e8183ea57107a9217950 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Sat, 24 Feb 2024 13:07:28 -0500 Subject: [PATCH 11/11] maint(fetch-wrapper): transform headers back into an `Object` This fixes the tests, as we are expecting an Object in the fetch-mock matcher functions --- src/fetch-wrapper.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/fetch-wrapper.ts b/src/fetch-wrapper.ts index f7b789456..8139e8df0 100644 --- a/src/fetch-wrapper.ts +++ b/src/fetch-wrapper.ts @@ -40,10 +40,12 @@ export default function fetchWrapper( method: requestOptions.method, body: requestOptions.body, // Header values must be `string` - headers: Object.entries(requestOptions.headers).map(([name, value]) => [ - name, - String(value), - ]), + headers: Object.fromEntries( + Object.entries(requestOptions.headers).map(([name, value]) => [ + name, + String(value), + ]), + ), signal: requestOptions.request?.signal, // duplex must be set if request.body is ReadableStream or Async Iterables. // See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.