Skip to content

Commit

Permalink
fix(node): add various missing exports (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Jun 18, 2024
1 parent 4daa255 commit c82ed3e
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const envConfig = env(nodeless, vercel, {});
- [node:buffer](https://nodejs.org/api/buffer.html) - ✅ polyfilled all exports
- [node:child_process](https://nodejs.org/api/child_process.html) - ✅ polyfilled all exports
- [node:cluster](https://nodejs.org/api/cluster.html) - ✅ polyfilled all exports
- [node:console](https://nodejs.org/api/console.html) - ✅ polyfilled 23/25 exports
- [node:console](https://nodejs.org/api/console.html) - ✅ polyfilled all exports
- [node:constants](https://nodejs.org/api/constants.html) - ✅ polyfilled all exports
- [node:crypto](https://nodejs.org/api/crypto.html) - ✅ polyfilled all exports
- [node:dgram](https://nodejs.org/api/dgram.html) - ✅ polyfilled all exports
Expand Down Expand Up @@ -167,7 +167,7 @@ const envConfig = env(nodeless, vercel, {});
- [node:stream](https://nodejs.org/api/stream.html) - ✅ polyfilled 17/37 exports
- [node:stream/consumers](https://nodejs.org/api/stream.html) - ✅ polyfilled all exports
- [node:stream/promises](https://nodejs.org/api/stream.html) - ✅ polyfilled all exports
- [node:stream/web](https://nodejs.org/api/stream.html) - ✅ polyfilled 16/17 exports
- [node:stream/web](https://nodejs.org/api/stream.html) - ✅ polyfilled all exports
- [node:string_decoder](https://nodejs.org/api/string_decoder.html) - ✅ polyfilled all exports
- [node:sys](https://nodejs.org/api/sys.html) - ✅ polyfilled all exports
- [node:timers](https://nodejs.org/api/timers.html) - ✅ polyfilled all exports
Expand Down
9 changes: 9 additions & 0 deletions src/runtime/node/console/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export const table: typeof console.table = _console?.table ?? log;
export const error: typeof console.error = _console?.error ?? log;
export const warn: typeof console.warn = _console?.warn ?? error;

// https://developer.chrome.com/docs/devtools/console/api#createtask
export const createTask =
(_console as any).createTask ?? notImplemented("console.createTask");

export const assert: typeof console.assert =
notImplemented<typeof console.assert>("console.assert");

Expand Down Expand Up @@ -46,6 +50,11 @@ export const Console: typeof console.Console =

export { default as _times } from "../../mock/proxy";

export function context() {
// TODO: Should be Console with all the methods
return _console;
}

export {
default as _stdoutErrorHandler,
default as _stderrErrorHandler,
Expand Down
1 change: 1 addition & 0 deletions src/runtime/node/events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export {

export const usingDomains = _EventEmitter.usingDomains;
export const captureRejectionSymbol = _EventEmitter.captureRejectionSymbol;
export const captureRejections = false; // Coverage only
export const errorMonitor = _EventEmitter.errorMonitor;
export const defaultMaxListeners = _EventEmitter.defaultMaxListeners;
export const setMaxListeners = _EventEmitter.setMaxListeners;
Expand Down
1 change: 1 addition & 0 deletions src/runtime/node/path/posix/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "../index";
export { default } from "../index";
1 change: 1 addition & 0 deletions src/runtime/node/path/win32/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "../index";
export { default } from "../index";
4 changes: 4 additions & 0 deletions src/runtime/node/stream/web/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ export const TextDecoderStream =
export const DecompressionStream =
globalThis.DecompressionStream ||
notImplemented("stream.web.DecompressionStream");
export const CompressionStream =
globalThis.DecompressionStream ||
notImplemented("stream.web.CompressionStream");

// @ts-ignore
export default <typeof streamWeb>{
Expand All @@ -68,4 +71,5 @@ export default <typeof streamWeb>{
TextEncoderStream,
TextDecoderStream,
DecompressionStream,
CompressionStream,
};
1 change: 1 addition & 0 deletions src/runtime/node/sys/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "../util";
export { default } from "../util";

0 comments on commit c82ed3e

Please sign in to comment.