Skip to content

Commit

Permalink
fix: add missing latest node exports
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jan 3, 2023
1 parent 1a1c94b commit dd046a8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/runtime/node/buffer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { Buffer, kMaxLength, INSPECT_MAX_BYTES, SlowBuffer } from "./_buffer";
// @ts-ignore
export { Buffer, kMaxLength, INSPECT_MAX_BYTES, SlowBuffer } from "./_buffer";

export const Blob = globalThis.Blob;
// @ts-expect-eerror https://github.com/unjs/unenv/issues/64
export const Blob = globalThis.Blob as unknown as typeof buffer.Blob;
export const resolveObjectURL = notImplemented("buffer.resolveObjectURL");
export const transcode = notImplemented("buffer.transcode");

Expand Down
2 changes: 2 additions & 0 deletions src/runtime/node/fs/promises/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type fsp from "node:fs/promises";
import { notImplemented } from "../../../_internal/utils";

export { constants } from "../_constants";

export const access: typeof fsp.access = notImplemented("fs.access");
export const copyFile: typeof fsp.copyFile = notImplemented("fs.copyFile");
export const cp: typeof fsp.cp = notImplemented("fs.cp");
Expand Down
10 changes: 10 additions & 0 deletions src/runtime/node/http/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ export const ClientRequest: typeof http.ClientRequest =
export const Agent: typeof http.Agent = mock.__createMock__("http.Agent");
export const globalAgent: typeof http.globalAgent = new Agent();

export const validateHeaderName: typeof http.validateHeaderName =
notImplemented("http.validateHeaderName");
export const validateHeaderValue: typeof http.validateHeaderValue =
notImplemented("http.validateHeaderValue");
export const setMaxIdleHTTPParsers: typeof http.setMaxIdleHTTPParsers =
notImplemented("http.setMaxIdleHTTPParsers");

export default <typeof http>{
...consts,
IncomingMessage: IncomingMessage as any as typeof http.IncomingMessage,
Expand All @@ -36,4 +43,7 @@ export default <typeof http>{
ClientRequest,
Agent,
globalAgent,
validateHeaderName,
validateHeaderValue,
setMaxIdleHTTPParsers,
};
3 changes: 2 additions & 1 deletion src/runtime/node/url/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// https://nodejs.org/api/url.html
import type url from "node:url";

export const URL = globalThis.URL;
// @ts-expect-error https://github.com/unjs/unenv/issues/65
export const URL = globalThis.URL as typeof url.URL;

export const URLSearchParams = globalThis.URLSearchParams;

Expand Down
10 changes: 10 additions & 0 deletions src/runtime/node/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ export const toUSVString: typeof util.toUSVString =
export const stripVTControlCharacters: typeof util.stripVTControlCharacters =
notImplemented("util.stripVTControlCharacters");

export const transferableAbortController: typeof util.transferableAbortController =
notImplemented("util.transferableAbortController");
export const transferableAbortSignal: typeof util.transferableAbortSignal =
notImplemented("util.transferableAbortSignal");
export const parseArgs: typeof util.parseArgs =
notImplemented("util.parseArgs");

export default <typeof util>{
_errnoException,
_exceptionWithHostPort,
Expand All @@ -52,6 +59,9 @@ export default <typeof util>{
TextDecoder,
TextEncoder,
types,
transferableAbortController,
transferableAbortSignal,
parseArgs,
...logUtils,
...legacyTypes,
};

0 comments on commit dd046a8

Please sign in to comment.