1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

fix(compat): use mjs extension for stream/promises (#15341)

This commit is contained in:
David Sherret 2022-07-29 15:48:03 -04:00 committed by GitHub
parent 088bc52db0
commit b676cab0b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -93,8 +93,12 @@ pub fn get_node_imports() -> Vec<(Url, Vec<String>)> {
fn try_resolve_builtin_module(specifier: &str) -> Option<Url> {
if SUPPORTED_MODULES.contains(&specifier) {
let ext = match specifier {
"stream/promises" => "mjs",
_ => "ts",
};
let module_url =
format!("{}node/{}.ts", NODE_COMPAT_URL.as_str(), specifier);
format!("{}node/{}.{}", NODE_COMPAT_URL.as_str(), specifier, ext);
Some(Url::parse(&module_url).unwrap())
} else {
None