Skip to content

Commit

Permalink
feat(BREAKING): no longer map node: specifiers to not have node sch…
Browse files Browse the repository at this point in the history
…eme (#379)
  • Loading branch information
dsherret authored Mar 1, 2024
1 parent b5f0a23 commit 2d1d120
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 42 deletions.
Binary file modified lib/pkg/dnt_wasm_bg.wasm
Binary file not shown.
23 changes: 0 additions & 23 deletions rs-lib/src/loader/specifier_mappers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ pub fn get_all_specifier_mappers() -> Vec<Box<dyn SpecifierMapper>> {
Box::new(SkypackMapper),
Box::new(EsmShMapper),
Box::new(NpmMapper),
Box::new(NodeSpecifierMapper),
]
}

Expand Down Expand Up @@ -186,28 +185,6 @@ impl SpecifierMapper for DenoStdNodeSpecifierMapper {
}
}

struct NodeSpecifierMapper;

impl SpecifierMapper for NodeSpecifierMapper {
fn map(&self, specifier: &ModuleSpecifier) -> Option<PackageMappedSpecifier> {
if specifier.scheme() == "node" {
Some(PackageMappedSpecifier {
// map to without the "node:" prefix for Node < 18
name: specifier
.path()
.strip_prefix('/')
.unwrap_or(specifier.path())
.to_string(),
version: None,
sub_path: None,
peer_dependency: false,
})
} else {
None
}
}
}

#[cfg(test)]
mod test {
use super::*;
Expand Down
19 changes: 0 additions & 19 deletions rs-lib/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,25 +361,6 @@ async fn transform_shim_node_custom_shims() {
]);
}

#[tokio::test]
async fn transform_node_specifiers() {
let result = TestBuilder::new()
.with_loader(|loader| {
loader.add_local_file(
"/mod.ts",
"import fs from 'node:fs'; console.log(fs);",
);
})
.transform()
.await
.unwrap();

assert_files!(
result.main.files,
&[("mod.ts", "import fs from 'fs'; console.log(fs);",)]
);
}

#[tokio::test]
async fn no_transform_deno_ignored() {
assert_identity_transforms(vec!["// dnt-shim-ignore\nDeno.readTextFile();"])
Expand Down

0 comments on commit 2d1d120

Please sign in to comment.