diff --git a/README.md b/README.md index 07acbd10..95b62de8 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,7 @@ Node Install with npm install @octokit/endpoint ```js -const { endpoint } = require("@octokit/endpoint"); -// or: import { endpoint } from "@octokit/endpoint"; +import { endpoint } from "@octokit/endpoint"; ``` diff --git a/package-lock.json b/package-lock.json index 8f8c4e6d..de108649 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,10 +10,10 @@ "license": "MIT", "dependencies": { "@octokit/types": "^12.0.0", - "universal-user-agent": "^6.0.0" + "universal-user-agent": "^7.0.2" }, "devDependencies": { - "@octokit/tsconfig": "^2.0.0", + "@octokit/tsconfig": "^3.0.0", "@types/jest": "^29.0.0", "@types/node": "^20.10.0", "esbuild": "^0.20.0", @@ -1580,6 +1580,12 @@ "@octokit/openapi-types": "^18.0.0" } }, + "node_modules/@octokit/core/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": "7.0.6", "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-7.0.6.tgz", @@ -1603,6 +1609,12 @@ "@octokit/openapi-types": "^18.0.0" } }, + "node_modules/@octokit/endpoint/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/graphql": { "version": "5.0.6", "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.6.tgz", @@ -1626,6 +1638,12 @@ "@octokit/openapi-types": "^18.0.0" } }, + "node_modules/@octokit/graphql/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/openapi-types": { "version": "18.0.0", "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-18.0.0.tgz", @@ -1648,6 +1666,12 @@ "@octokit/core": ">=4" } }, + "node_modules/@octokit/plugin-paginate-rest/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==", + "dev": true + }, "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": { "version": "9.3.2", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-9.3.2.tgz", @@ -1771,10 +1795,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": { @@ -10851,9 +10881,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/universalify": { "version": "2.0.0", diff --git a/package.json b/package.json index d393e8e5..2b8a6ed3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "@octokit/endpoint", "version": "0.0.0-development", + "type": "module", "publishConfig": { "access": "public" }, @@ -10,7 +11,7 @@ "lint": "prettier --check '{scripts,src,test}/**/*' README.md package.json", "lint:fix": "prettier --write '{scripts,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/endpoint.js", "keywords": [ @@ -22,7 +23,7 @@ "author": "Gregor Martynus (https://github.com/gr2m)", "license": "MIT", "devDependencies": { - "@octokit/tsconfig": "^2.0.0", + "@octokit/tsconfig": "^3.0.0", "@types/jest": "^29.0.0", "@types/node": "^20.10.0", "esbuild": "^0.20.0", @@ -36,7 +37,7 @@ }, "dependencies": { "@octokit/types": "^12.0.0", - "universal-user-agent": "^6.0.0" + "universal-user-agent": "^7.0.2" }, "release": { "branches": [ @@ -71,11 +72,15 @@ ] }, "jest": { + "extensionsToTreatAsEsm": [ + ".ts" + ], "transform": { "^.+\\.(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 862e23a5..2ab52f7c 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -43,7 +43,7 @@ async function main() { bundle: true, platform: "node", target: "node18", - format: "cjs", + format: "esm", ...sharedOptions, }), // Build an ESM browser bundle @@ -74,10 +74,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-src/index.js", + }, + }, sideEffects: false, }, null, diff --git a/test/tsconfig.test.json b/test/tsconfig.test.json index 5e8dc248..cf1f2005 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/**/*"]