1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

fix: actually add missing node:readline/promises module (#24772)

Closes #24768

(cherry picked from commit 50fa4d7ef5)
This commit is contained in:
David Sherret 2024-07-28 15:41:10 -04:00 committed by crowlkats
parent b5b9904285
commit bcb7e600c0
No known key found for this signature in database
GPG key ID: A82C9D461FC483E8
6 changed files with 28 additions and 2 deletions

View file

@ -612,7 +612,8 @@ impl<TGraphContainer: ModuleGraphContainer>
maybe_referrer: Option<&ModuleSpecifier>,
) -> Result<CodeOrDeferredEmit<'graph>, AnyError> {
if specifier.scheme() == "node" {
unreachable!(); // Node built-in modules should be handled internally.
// Node built-in modules should be handled internally.
unreachable!("Deno bug. {} was misconfigured internally.", specifier);
}
match graph.get(specifier) {

View file

@ -598,6 +598,7 @@ deno_core::extension!(deno_node,
"node:punycode" = "punycode.ts",
"node:querystring" = "querystring.js",
"node:readline" = "readline.ts",
"node:readline/promises" = "readline/promises.ts",
"node:repl" = "repl.ts",
"node:stream" = "stream.ts",
"node:stream/consumers" = "stream/consumers.mjs",

View file

@ -132,7 +132,7 @@ import punycode from "node:punycode";
import process from "node:process";
import querystring from "node:querystring";
import readline from "node:readline";
import readlinePromises from "ext:deno_node/readline/promises.ts";
import readlinePromises from "node:readline/promises";
import repl from "node:repl";
import stream from "node:stream";
import streamConsumers from "node:stream/consumers";

View file

@ -0,0 +1,4 @@
{
"args": "run --allow-read main.ts",
"output": "main.out"
}

View file

@ -0,0 +1,10 @@
import rl from "node:readline/promises";
import fs from "node:fs";
const r = rl.createInterface({
input: fs.createReadStream("main.ts"),
});
for await (const line of r) {
console.log(line);
}

View file

@ -0,0 +1,10 @@
import rl from "node:readline/promises";
import fs from "node:fs";
const r = rl.createInterface({
input: fs.createReadStream("main.ts"),
});
for await (const line of r) {
console.log(line);
}