diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2021-10-06 01:25:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-06 01:25:13 +0200 |
commit | 37a24c7bdfb7bedfaf95808d370acb70951b7f13 (patch) | |
tree | b1c37d61a0f1c57fb9c017c314642a3a37882386 /cli/compat.rs | |
parent | 3faf75aa883647dfa1f3be2bc13cf7bc463d92e1 (diff) |
feat(compat): add support for node: prefixed built-ins (#12337)
Adds support for "node:" prefix for Node built-ins in "--compat" mode.
As per https://nodejs.org/api/esm.html#esm_node_imports
Diffstat (limited to 'cli/compat.rs')
-rw-r--r-- | cli/compat.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cli/compat.rs b/cli/compat.rs index a3d16538d..eb67f4d12 100644 --- a/cli/compat.rs +++ b/cli/compat.rs @@ -53,7 +53,12 @@ pub fn get_mapped_node_builtins() -> HashMap<String, String> { for module in SUPPORTED_MODULES { // TODO(bartlomieju): this is unversioned, and should be fixed to use latest stable? let module_url = format!("https://deno.land/std/node/{}.ts", module); - mappings.insert(module.to_string(), module_url); + mappings.insert(module.to_string(), module_url.clone()); + + // Support for `node:<module_name>` + // https://nodejs.org/api/esm.html#esm_node_imports + let node_prefixed = format!("node:{}", module); + mappings.insert(node_prefixed, module_url); } mappings |