Skip to content

Commit

Permalink
feat: add polyfill for node:https with named exports
Browse files Browse the repository at this point in the history
resolves #92
  • Loading branch information
pi0 committed Nov 22, 2023
1 parent f6f276e commit 5917a50
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Using this preset, we can convert a code that is depending on Node.js to work an
| [node:fs/promises](https://nodejs.org/api/fs/promises.html) | Polyfilled | [unenv/node/fs/promises](./src/runtime/node/fs/promises) |
| [node:http2](https://nodejs.org/api/http2.html) | Mocked | - |
| [node:http](https://nodejs.org/api/http.html) | Polyfilled | [unenv/node/http](./src/runtime/node/http) |
| [node:https](https://nodejs.org/api/https.html) | Mocked | - |
| [node:https](https://nodejs.org/api/https.html) | Polyfilled | [unenv/node/https](./src/runtime/node/https) |
| [node:inspector](https://nodejs.org/api/inspector.html) | Mocked | - |
| [node:module](https://nodejs.org/api/module.html) | Polyfilled | [unenv/node/module](./src/runtime/node/module) - |
| [node:net](https://nodejs.org/api/net.html) | Polyfilled | [unenv/node/net](./src/runtime/node/net) |
Expand Down
27 changes: 27 additions & 0 deletions src/runtime/node/https/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// https://nodejs.org/api/https.html
import type nodeHttps from "node:https";
import { notImplemented, notImplementedClass } from "../../_internal/utils";

export const Server: typeof nodeHttps.Server =
notImplementedClass("https.Server");

export const Agent: typeof nodeHttps.Agent = notImplementedClass("https.Agent");

export const globalAgent = undefined as any as typeof nodeHttps.globalAgent;

export const get: typeof nodeHttps.get = notImplemented("https.get");

export const createServer: typeof nodeHttps.createServer =
notImplemented("https.createServer");

export const request: typeof nodeHttps.request =
notImplemented("https.request");

export default <typeof nodeHttps>{
Server,
Agent,
globalAgent,
get,
createServer,
request,
};

0 comments on commit 5917a50

Please sign in to comment.