Skip to content

Commit

Permalink
fix: remove old polyfills
Browse files Browse the repository at this point in the history
Remove `node-fetch` as we only support NodeJS v18+
Remove `fromentries` as support for `Object.fromEntries()` was added in NodeJS v12
  • Loading branch information
wolfy1339 committed Jun 17, 2023
1 parent c43e5e4 commit 009ef0e
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 153 deletions.
120 changes: 0 additions & 120 deletions package-lock.json

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

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,18 @@
"@octokit/oauth-authorization-url": "^6.0.2",
"@octokit/oauth-methods": "^3.0.1",
"@types/aws-lambda": "^8.10.83",
"fromentries": "^1.3.1",
"universal-user-agent": "^6.0.0"
},
"devDependencies": {
"@octokit/tsconfig": "^2.0.0",
"@types/jest": "^29.0.0",
"@types/node": "^18.0.0",
"@types/node-fetch": "^2.5.4",
"esbuild": "^0.18.0",
"express": "^4.17.1",
"fetch-mock": "^9.0.0",
"glob": "^10.2.5",
"jest": "^29.0.0",
"nock": "^13.0.0",
"node-fetch": "^2.6.0",
"prettier": "2.8.8",
"semantic-release-plugin-update-version-in-files": "^1.0.0",
"ts-jest": "^29.0.0",
Expand Down
4 changes: 1 addition & 3 deletions src/middleware/handle-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { OAuthApp } from "../index";
import { unknownRouteResponse } from "./unknown-route-response";
import type { HandlerOptions, OctokitRequest, OctokitResponse } from "./types";
import type { ClientType, Options } from "../types";
// @ts-ignore - requires esModuleInterop flag
import fromEntries from "fromentries";

export async function handleRequest(
app: OAuthApp<Options<ClientType>>,
Expand Down Expand Up @@ -65,7 +63,7 @@ export async function handleRequest(
};
}
const { searchParams } = new URL(request.url as string, "http://localhost");
const query = fromEntries(searchParams) as {
const query = Object.fromEntries(searchParams) as {
state?: string;
scopes?: string;
code?: string;
Expand Down
14 changes: 0 additions & 14 deletions test/deprecations.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
import * as nodeFetch from "node-fetch";
import fromEntries from "fromentries";

describe("deprecations", () => {
beforeAll(() => {
Object.fromEntries ||= fromEntries;
(global as any).Request = nodeFetch.Request;
(global as any).Response = nodeFetch.Response;
});

afterAll(() => {
delete (global as any).Request;
delete (global as any).Response;
});

it("has no deprecations currently", async () => {});
});
13 changes: 0 additions & 13 deletions test/web-worker-handler.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
import { URL } from "url";
import * as nodeFetch from "node-fetch";
import fromEntries from "fromentries";
import { createWebWorkerHandler, OAuthApp } from "../src";

describe("createWebWorkerHandler(app)", () => {
beforeAll(() => {
Object.fromEntries ||= fromEntries;
(global as any).Request = nodeFetch.Request;
(global as any).Response = nodeFetch.Response;
});

afterAll(() => {
delete (global as any).Request;
delete (global as any).Response;
});

it("support both oauth-app and github-app", () => {
const oauthApp = new OAuthApp({
clientType: "oauth-app",
Expand Down

0 comments on commit 009ef0e

Please sign in to comment.