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

Add default node web stream shim #362

Open
dsherret opened this issue Jan 28, 2024 · 1 comment
Open

Add default node web stream shim #362

dsherret opened this issue Jan 28, 2024 · 1 comment

Comments

@dsherret
Copy link
Member

dsherret commented Jan 28, 2024

Something like this, but need to actually go through and figure out what everything is based on https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/stream/web.d.ts#L17 and https://github.com/denoland/deno/blob/7281775381cda79ef61df27820387dc2c74e0384/ext/web/lib.deno_web.d.ts

// in https://github.com/denoland/dnt/blob/main/lib/shims.ts
function getNodeWebStreamsShim(): Shim {
  return {
    package: {
      name: "node:stream/web",
    },
    globalNames: [
      "ReadableStream",
      "WritableStream",
      "TextDecoderStream",
      typeOnly("ReadableStreamController"),
      typeOnly("ReadableStreamDefaultReadValueResult"),
      typeOnly("ReadableStreamDefaultReader"),
      typeOnly("WritableStreamDefaultWriter"),
      typeOnly("QueuingStrategy"),
      {
        name: "PipeOptions",
        exportName: "StreamPipeOptions",
        typeOnly: true,
      },
    ],
  };
}

Then someone could just do: nodeWebStreams: true in their shims.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants