From 846055cade4781966c2f247fead399c8e699202d Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 28 Oct 2024 17:41:24 -0400 Subject: [PATCH] refactor: deno_graph 0.84 --- Cargo.lock | 12 ++++++------ Cargo.toml | 4 ++-- rs-lib/src/lib.rs | 4 ++-- wasm/src/lib.rs | 9 +++------ 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3b16f28..e9e89a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -281,9 +281,9 @@ dependencies = [ [[package]] name = "deno_ast" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b08d11d9e4086b00d3428650e31153cf5896586411763cb88a6423ce5b18791" +checksum = "d6a41d70fa043b4117c6fea30fdcf2dfee7053363a3cdb45011673ebdb3300d5" dependencies = [ "base64", "deno_media_type", @@ -360,9 +360,9 @@ dependencies = [ [[package]] name = "deno_graph" -version = "0.82.0" +version = "0.84.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "646757b109993751f618d20de9bafc17f8f886fa910fb82c2c89b9e1df220ac6" +checksum = "c9d6c7edec696810563d8002e4330e87b63ecbdd48996a18a94946b9a0f4db50" dependencies = [ "anyhow", "async-trait", @@ -388,9 +388,9 @@ dependencies = [ [[package]] name = "deno_media_type" -version = "0.1.4" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8978229b82552bf8457a0125aa20863f023619cfc21ebb007b1e571d68fd85b" +checksum = "7fcf552fbdedbe81c89705349d7d2485c7051382b000dfddbdbf7fc25931cf83" dependencies = [ "data-url", "serde", diff --git a/Cargo.toml b/Cargo.toml index f430834..a6e42b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,8 @@ members = [ [workspace.dependencies] anyhow = "1.0.44" base64 = "0.21.5" -deno_graph = { version = "0.82.0", default-features = false } -deno_ast = { version = "0.42.0", features = ["bundler", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "visit", "transpiling"] } +deno_graph = { version = "0.84.0", default-features = false } +deno_ast = { version = "0.43.0", features = ["bundler", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "visit", "transpiling"] } url = { version = "2.3.1" } [profile.release] diff --git a/rs-lib/src/lib.rs b/rs-lib/src/lib.rs index fd66e0c..0a3f6e9 100644 --- a/rs-lib/src/lib.rs +++ b/rs-lib/src/lib.rs @@ -65,7 +65,7 @@ pub async fn transpile( maybe_import_map: Option, transpile_options: &TranspileOptions, emit_options: &EmitOptions, -) -> Result>> { +) -> Result> { let analyzer = CapturingModuleAnalyzer::default(); let maybe_import_map = get_import_map_from_input(maybe_import_map)?; let import_map_resolver = ImportMapResolver(maybe_import_map); @@ -94,7 +94,7 @@ pub async fn transpile( .transpile(transpile_options, emit_options)? .into_source(); - map.insert(module.specifier.to_string(), transpiled_source.source); + map.insert(module.specifier.to_string(), transpiled_source.text); if let Some(source_map) = transpiled_source.source_map { map.insert(format!("{}.map", module.specifier.as_str()), source_map); diff --git a/wasm/src/lib.rs b/wasm/src/lib.rs index 5f2d039..ba1a6f9 100644 --- a/wasm/src/lib.rs +++ b/wasm/src/lib.rs @@ -1,7 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. use std::collections::HashMap; -use std::string::FromUtf8Error; use anyhow::anyhow; use deno_emit::BundleOptions; @@ -81,6 +80,7 @@ impl CompilerOptions { precompile_jsx, precompile_jsx_skip_elements: None, precompile_jsx_dynamic_props: None, + verbatim_module_syntax: false, }, EmitOptions { inline_sources: self.inline_sources, @@ -291,11 +291,8 @@ pub async fn transpile( .map_err(|err| JsValue::from(js_sys::Error::new(&format!("{:#}", err))))?; let map = map .into_iter() - .map(|(specifier, source)| { - Ok((specifier.to_string(), String::from_utf8(source)?)) - }) - .collect::, FromUtf8Error>>() - .map_err(|err| JsValue::from(js_sys::Error::new(&format!("{:#}", err))))?; + .map(|(specifier, source)| (specifier.to_string(), source)) + .collect::>(); serde_wasm_bindgen::to_value(&map) .map_err(|err| JsValue::from(js_sys::Error::new(&format!("{:#}", err))))