Skip to content

Commit

Permalink
refactor: replace NodeJS internal module imports with node: specifi…
Browse files Browse the repository at this point in the history
…er imports (#933)

* refactor: replace NodeJS internal module imports with `node:` specifier imports

* chore: explicitly mark type imports

* revert: change mode back to executable
  • Loading branch information
wolfy1339 committed Nov 28, 2023
1 parent 8423803 commit d2fb4a6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
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

0 comments on commit d2fb4a6

Please sign in to comment.