Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Apr 2, 2024
1 parent 9b1b18b commit a5a64b0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 24 deletions.
17 changes: 7 additions & 10 deletions rs-lib/src/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,14 @@ pub fn bundle_graph(
.to_writer(&mut buf)?;
match options.emit_options.source_map {
deno_ast::SourceMapOption::Inline => {

code.push_str("//# sourceMappingURL=data:application/json;base64,");
base64::prelude::BASE64_STANDARD.encode_string(buf, &mut code);
},
code.push_str("//# sourceMappingURL=data:application/json;base64,");
base64::prelude::BASE64_STANDARD.encode_string(buf, &mut code);
}
deno_ast::SourceMapOption::Separate => {

maybe_map = Some(String::from_utf8(buf)?);
},
deno_ast::SourceMapOption::None => {
},
}
maybe_map = Some(String::from_utf8(buf)?);
}
deno_ast::SourceMapOption::None => {}
}
}

Ok(BundleEmit { code, maybe_map })
Expand Down
14 changes: 7 additions & 7 deletions rs-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ pub use emit::BundleType;
pub use emit::TranspileOptions;

pub use deno_ast::EmitOptions;
pub use deno_ast::SourceMapOption;
pub use deno_ast::ImportsNotUsedAsValues;
pub use deno_ast::ModuleSpecifier;
pub use deno_ast::SourceMapOption;
pub use deno_graph::source::CacheSetting;
pub use deno_graph::source::LoadFuture;
pub use deno_graph::source::LoadOptions;
Expand Down Expand Up @@ -94,12 +94,12 @@ pub async fn transpile(

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.to_string(),
);
}
if let Some(source_map) = &transpiled_source.source_map {
map.insert(
format!("{}.map", module.specifier.as_str()),
source_map.to_string(),
);
}
}
}

Expand Down
14 changes: 7 additions & 7 deletions wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ impl From<CompilerOptions> for EmitOptions {
"precompile" => (false, false, false, true),
_ => (false, false, false, false),
};
let source_map = if options.inline_source_map {
SourceMapOption::Inline
} else if options.source_map {
SourceMapOption::Separate
} else {
SourceMapOption::None
};
let source_map = if options.inline_source_map {
SourceMapOption::Inline
} else if options.source_map {
SourceMapOption::Separate
} else {
SourceMapOption::None
};

Self {
use_decorators_proposal: !options.experimental_decorators,
Expand Down

0 comments on commit a5a64b0

Please sign in to comment.