Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
475 changes: 393 additions & 82 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ license = "MIT"
members = ["lib"]

[workspace.dependencies]
deno_graph = { version = "0.84.0", default-features = false }
deno_ast = { version = "0.43.0", features = ["transpiling"] }
import_map = "0.20.0"
deno_graph = { version = "0.86.0", default-features = false }
deno_ast = { version = "0.44.0", features = ["transpiling"] }
import_map = "0.21.0"
serde = "1"

[profile.release]
Expand Down Expand Up @@ -49,15 +49,15 @@ async-trait = "0.1.68"
base64 = "0.21.0"
deno_ast = { workspace = true }
deno_graph = { workspace = true }
deno_npm = "0.25.0"
deno_semver = "0.5.11"
deno_npm = "0.26.0"
deno_semver = "0.6.0"
futures = "0.3.26"
hashlink = "0.8.2"
indexmap = "2"
serde = { workspace = true }
serde_json = "1"
sha2 = {version = "0.10.1", optional = true}
thiserror = "1.0.30"
thiserror = "2"
url = "2.2.2"
xxhash-rust = { version = "0.8", 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 @@ -179,6 +179,7 @@ async fn build_eszip(mb: usize) -> EszipV2 {
graph.valid().unwrap();
EszipV2::from_graph(eszip::FromGraphOptions {
graph,
module_kind_resolver: Default::default(),
parser: analyzer.as_capturing_parser(),
transpile_options: TranspileOptions::default(),
emit_options: EmitOptions::default(),
Expand Down
3 changes: 2 additions & 1 deletion lib/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ pub async fn build_eszip(
.map_err(|e| js_sys::Error::new(&e.to_string()))?;
let mut eszip = eszip::EszipV2::from_graph(eszip::FromGraphOptions {
graph,
module_kind_resolver: Default::default(),
parser: analyzer.as_capturing_parser(),
transpile_options: Default::default(),
emit_options: Default::default(),
Expand Down Expand Up @@ -427,7 +428,7 @@ impl Resolver for GraphResolver {
&self,
specifier: &str,
referrer_range: &deno_graph::Range,
_mode: deno_graph::source::ResolutionMode,
_kind: deno_graph::source::ResolutionKind,
) -> Result<deno_graph::ModuleSpecifier, ResolveError> {
if let Some(import_map) = &self.0 {
import_map
Expand Down
3 changes: 2 additions & 1 deletion src/examples/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ async fn main() {
let mut eszip = eszip::EszipV2::from_graph(eszip::FromGraphOptions {
graph,
parser: analyzer.as_capturing_parser(),
module_kind_resolver: Default::default(),
transpile_options: TranspileOptions::default(),
emit_options: EmitOptions::default(),
relative_file_base: None,
Expand Down Expand Up @@ -106,7 +107,7 @@ impl deno_graph::source::Resolver for Resolver {
&self,
specifier: &str,
referrer_range: &deno_graph::Range,
_mode: deno_graph::source::ResolutionMode,
_kind: deno_graph::source::ResolutionKind,
) -> Result<deno_graph::ModuleSpecifier, ResolveError> {
if let Some(import_map) = &self.0 {
import_map
Expand Down
10 changes: 8 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

#![deny(clippy::print_stderr)]
#![deny(clippy::print_stdout)]
#![deny(clippy::unused_async)]

mod error;
pub mod v1;
pub mod v2;
Expand All @@ -14,6 +18,7 @@ use futures::io::AsyncReadExt;
use serde::Deserialize;
use serde::Serialize;
use v2::EszipV2Modules;
use v2::EszipVersion;

pub use crate::error::ParseError;
pub use crate::v1::EszipV1;
Expand Down Expand Up @@ -47,8 +52,8 @@ impl Eszip {
let mut reader = futures::io::BufReader::new(reader);
let mut magic = [0; 8];
reader.read_exact(&mut magic).await?;
if EszipV2::has_magic(&magic) {
let (eszip, fut) = EszipV2::parse_with_magic(&magic, reader).await?;
if let Some(version) = EszipVersion::from_magic(&magic) {
let (eszip, fut) = EszipV2::parse_with_version(version, reader).await?;
Ok((Eszip::V2(eszip), Box::pin(fut)))
} else {
let mut buffer = Vec::new();
Expand Down Expand Up @@ -212,6 +217,7 @@ pub enum ModuleKind {
Json = 1,
Jsonc = 2,
OpaqueData = 3,
Wasm = 4,
}

#[cfg(test)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ expression: bytes
80,
50,
46,
50,
51,
0,
0,
0,
Expand Down
2 changes: 1 addition & 1 deletion src/snapshots/eszip__v2__tests__npm_empty_snapshot.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ expression: bytes
80,
50,
46,
50,
51,
0,
0,
0,
Expand Down
2 changes: 1 addition & 1 deletion src/snapshots/eszip__v2__tests__npm_packages.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ expression: bytes
80,
50,
46,
50,
51,
0,
0,
0,
Expand Down
2 changes: 1 addition & 1 deletion src/snapshots/eszip__v2__tests__opaque_data.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ expression: bytes
80,
50,
46,
50,
51,
0,
0,
0,
Expand Down
Binary file added src/testdata/source/math.wasm
Binary file not shown.
2 changes: 2 additions & 0 deletions src/testdata/source/wasm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { add } from "./math.wasm";
console.log(add(1, 2));
Binary file added src/testdata/wasm.eszip2_3
Binary file not shown.
Loading