Skip to content

Commit

Permalink
refactor: deno_graph 0.84
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Oct 28, 2024
1 parent a38cc6c commit 846055c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions rs-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub async fn transpile(
maybe_import_map: Option<ImportMapInput>,
transpile_options: &TranspileOptions,
emit_options: &EmitOptions,
) -> Result<HashMap<String, Vec<u8>>> {
) -> Result<HashMap<String, String>> {
let analyzer = CapturingModuleAnalyzer::default();
let maybe_import_map = get_import_map_from_input(maybe_import_map)?;
let import_map_resolver = ImportMapResolver(maybe_import_map);
Expand Down Expand Up @@ -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);
Expand Down
9 changes: 3 additions & 6 deletions wasm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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::<Result<HashMap<String, String>, FromUtf8Error>>()
.map_err(|err| JsValue::from(js_sys::Error::new(&format!("{:#}", err))))?;
.map(|(specifier, source)| (specifier.to_string(), source))
.collect::<HashMap<String, String>>();

serde_wasm_bindgen::to_value(&map)
.map_err(|err| JsValue::from(js_sys::Error::new(&format!("{:#}", err))))
Expand Down

0 comments on commit 846055c

Please sign in to comment.