Skip to content

Commit

Permalink
feat: Support adding npm packages to the eszip (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnauorriols authored Jul 31, 2024
1 parent 7ce25c8 commit 3ff0e07
Show file tree
Hide file tree
Showing 13 changed files with 1,045 additions and 65 deletions.
45 changes: 22 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ default = ["sha256"]

[dependencies]
anyhow = "1"
async-trait = "0.1.68"
base64 = "0.21.0"
deno_ast = { workspace = true }
deno_graph = { workspace = true }
deno_npm = "0.21.0"
deno_semver = "0.5.4"
futures = "0.3.26"
hashlink = "0.8.2"
indexmap = "2"
serde = { workspace = true }
serde_json = "1"
sha2 = {version = "0.10.1", optional = true}
Expand Down
1 change: 1 addition & 0 deletions benches/source_hash_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ async fn build_eszip(mb: usize) -> EszipV2 {
transpile_options: TranspileOptions::default(),
emit_options: EmitOptions::default(),
relative_file_base: None,
npm_packages: None,
})
.unwrap()
}
Expand Down
1 change: 1 addition & 0 deletions lib/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ pub async fn build_eszip(
transpile_options: Default::default(),
emit_options: Default::default(),
relative_file_base: None,
npm_packages: None,
})
.map_err(|e| js_sys::Error::new(&e.to_string()))?;
if let Some((import_map_specifier, import_map_content)) =
Expand Down
1 change: 1 addition & 0 deletions src/examples/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ async fn main() {
transpile_options: TranspileOptions::default(),
emit_options: EmitOptions::default(),
relative_file_base: None,
npm_packages: None,
})
.unwrap();
if let Some((import_map_specifier, import_map_content)) =
Expand Down
1 change: 1 addition & 0 deletions src/testdata/source/child1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./grandchild1.ts";
1 change: 1 addition & 0 deletions src/testdata/source/child2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./grandchild2.ts";
1 change: 1 addition & 0 deletions src/testdata/source/grandchild1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const grandchild1 = "grandchild1";
2 changes: 2 additions & 0 deletions src/testdata/source/grandchild2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

export const grandchild2 = "grandchild2";
4 changes: 4 additions & 0 deletions src/testdata/source/npm_imports_main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import "npm:d/foo";
import "./npm_imports_submodule.ts";
import "npm:other";
import "npm:a@^1.2/foo";
2 changes: 2 additions & 0 deletions src/testdata/source/npm_imports_submodule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import "npm:a@^1.2/bar";
import "npm:other/bar";
2 changes: 2 additions & 0 deletions src/testdata/source/parent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import "./child1.ts";
import "./child2.ts";
Loading

0 comments on commit 3ff0e07

Please sign in to comment.