Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace NodeJS internal module imports with node: specifier imports #933

Merged
merged 3 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/middleware/node/get-missing-headers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// remove type imports from http for Deno compatibility
// see https://github.com/octokit/octokit.js/issues/24#issuecomment-817361886
// import { IncomingMessage } from "http";
// import type { IncomingMessage } from "node:http";
type IncomingMessage = any;

const WEBHOOK_HEADERS = [
Expand Down
12 changes: 6 additions & 6 deletions src/middleware/node/get-payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import AggregateError from "aggregate-error";

// remove type imports from http for Deno compatibility
// see https://github.com/octokit/octokit.js/issues/24#issuecomment-817361886
// import { IncomingMessage } from "http";
// declare module "http" {
// interface IncomingMessage {
// body?: WebhookEvent | unknown;
// }
// see https://github.com/octokit/octokit.js/issues/2075#issuecomment-817361886
// import type { IncomingMessage } from "node:http";
// declare module "node:http" {
// interface IncomingMessage {
// body?: string;
// }
// }
type IncomingMessage = any;

Expand Down
2 changes: 1 addition & 1 deletion src/middleware/node/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// remove type imports from http for Deno compatibility
// see https://github.com/octokit/octokit.js/issues/2075#issuecomment-817361886
// import { IncomingMessage, ServerResponse } from "http";
// import type { IncomingMessage, ServerResponse } from "node:http";
type IncomingMessage = any;
type ServerResponse = any;

Expand Down
2 changes: 1 addition & 1 deletion src/middleware/node/on-unhandled-request-default.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// remove type imports from http for Deno compatibility
// see https://github.com/octokit/octokit.js/issues/24#issuecomment-817361886
// import { IncomingMessage, ServerResponse } from "http";
// import type { IncomingMessage, ServerResponse } from "node:http";
type IncomingMessage = any;
type ServerResponse = any;

Expand Down
2 changes: 1 addition & 1 deletion test/typescript-validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
WebhookError,
createNodeMiddleware,
} from "../src/index.ts";
import { createServer } from "http";
import { createServer } from "node:http";
import type {
HandlerFunction,
RemoveHandlerFunction,
Expand Down