Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: octokit/plugin-throttling.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v8.2.0
Choose a base ref
...
head repository: octokit/plugin-throttling.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v9.0.0
Choose a head ref
  • 1 commit
  • 15 files changed
  • 1 contributor

Commits on Feb 25, 2024

  1. feat: package is now ESM (#675)

    BREAKING CHANGE: package is now ESM
    wolfy1339 authored Feb 25, 2024
    Copy the full SHA
    4986fb0 View commit details
121 changes: 57 additions & 64 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 19 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -4,37 +4,38 @@
"publishConfig": {
"access": "public"
},
"type": "module",
"description": "Octokit plugin for GitHub's recommended request throttling",
"scripts": {
"build": "node scripts/build.mjs && tsc -p tsconfig.json",
"lint": "prettier --check '{src,scripts,test}/**/*' '!*/generated/**' README.md package.json",
"lint:fix": "prettier --write '{src,scripts,test}/**/*' '!*/generated/**' README.md package.json",
"pretest": "npm run -s lint",
"test": "jest --coverage",
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" npx jest --coverage",
"update-endpoints": "npm-run-all update-endpoints:*",
"update-endpoints:fetch-json": "node scripts/update-endpoints/fetch-json",
"update-endpoints:code": "node scripts/update-endpoints/code",
"validate:ts": "npm run build && tsc --noEmit --noImplicitAny --target es2020 --esModuleInterop --moduleResolution node test/typescript-validate.ts"
"update-endpoints:fetch-json": "node scripts/update-endpoints/fetch-json.js",
"update-endpoints:code": "node scripts/update-endpoints/code.js",
"validate:ts": "tsc --noEmit --noImplicitAny --target es2022 --esModuleInterop --moduleResolution node16 --module node16 test/typescript-validate.ts"
},
"repository": "github:octokit/plugin-throttling.js",
"author": "Simon Grondin (http://github.com/SGrondin)",
"license": "MIT",
"dependencies": {
"@octokit/types": "^12.2.0",
"@octokit/types": "^12.6.0",
"bottleneck": "^2.15.3"
},
"peerDependencies": {
"@octokit/core": "^5.0.0"
"@octokit/core": "^6.0.0"
},
"devDependencies": {
"@octokit/core": "^5.0.0",
"@octokit/request-error": "^5.0.0",
"@octokit/tsconfig": "^2.0.0",
"@octokit/core": "^6.0.0",
"@octokit/request-error": "^6.0.1",
"@octokit/tsconfig": "^3.0.0",
"@types/fetch-mock": "^7.3.1",
"@types/jest": "^29.0.0",
"@types/node": "^20.0.0",
"esbuild": "^0.20.0",
"fetch-mock": "^9.0.0",
"fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1",
"github-openapi-graphql-query": "^4.0.0",
"glob": "^10.2.6",
"jest": "^29.0.0",
@@ -45,11 +46,15 @@
"typescript": "^5.0.0"
},
"jest": {
"extensionsToTreatAsEsm": [
".ts"
],
"transform": {
"^.+\\.(ts|tsx)$": [
"ts-jest",
{
"tsconfig": "test/tsconfig.test.json"
"tsconfig": "test/tsconfig.test.json",
"useESM": true
}
]
},
@@ -60,6 +65,9 @@
"functions": 100,
"lines": 100
}
},
"moduleNameMapper": {
"^(.+)\\.jsx?$": "$1"
}
},
"release": {
39 changes: 14 additions & 25 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
@@ -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: "node18",
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,
8 changes: 5 additions & 3 deletions scripts/update-endpoints/code.js
Original file line number Diff line number Diff line change
@@ -4,11 +4,13 @@
* trigger notifications. So instead we automatically generate a file that
* only contains these paths when @octokit/openapi has a new release.
*/
const { writeFileSync } = require("fs");
import { writeFileSync, readFileSync } from "node:fs";

const prettier = require("prettier");
import prettier from "prettier";

const ENDPOINTS = require("./generated/endpoints.json");
const ENDPOINTS = JSON.parse(
readFileSync(new URL("./generated/endpoints.json", import.meta.url), "utf-8"),
);
const paths = [];

for (const endpoint of ENDPOINTS) {
Loading