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:
parent
b5b9904285
commit
bcb7e600c0
6 changed files with 28 additions and 2 deletions
|
@ -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) {
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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";
|
||||
|
|
4
tests/specs/node/readline_promises/__test__.jsonc
Normal file
4
tests/specs/node/readline_promises/__test__.jsonc
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"args": "run --allow-read main.ts",
|
||||
"output": "main.out"
|
||||
}
|
10
tests/specs/node/readline_promises/main.out
Normal file
10
tests/specs/node/readline_promises/main.out
Normal 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);
|
||||
}
|
10
tests/specs/node/readline_promises/main.ts
Normal file
10
tests/specs/node/readline_promises/main.ts
Normal 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);
|
||||
}
|
Loading…
Reference in a new issue