mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
fix(cli/vendor): handle assert type json during vendoring (#16059)
This commit is contained in:
parent
7a47321b09
commit
9bb3ccbab2
2 changed files with 8 additions and 2 deletions
4
cli/tools/vendor/build.rs
vendored
4
cli/tools/vendor/build.rs
vendored
|
@ -473,7 +473,7 @@ mod test {
|
|||
"/mod.ts",
|
||||
r#"import data from "https://localhost/data.json" assert { type: "json" };"#,
|
||||
)
|
||||
.add("https://localhost/data.json", "{}");
|
||||
.add("https://localhost/data.json", "{ \"a\": \"b\" }");
|
||||
})
|
||||
.build()
|
||||
.await
|
||||
|
@ -489,7 +489,7 @@ mod test {
|
|||
);
|
||||
assert_eq!(
|
||||
output.files,
|
||||
to_file_vec(&[("/vendor/localhost/data.json", "{}"),]),
|
||||
to_file_vec(&[("/vendor/localhost/data.json", "{ \"a\": \"b\" }"),]),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
6
cli/tools/vendor/import_map.rs
vendored
6
cli/tools/vendor/import_map.rs
vendored
|
@ -4,6 +4,7 @@ use deno_ast::LineAndColumnIndex;
|
|||
use deno_ast::ModuleSpecifier;
|
||||
use deno_ast::SourceTextInfo;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_graph::MediaType;
|
||||
use deno_graph::Module;
|
||||
use deno_graph::ModuleGraph;
|
||||
use deno_graph::Position;
|
||||
|
@ -204,6 +205,11 @@ fn visit_modules(
|
|||
parsed_source_cache: &ParsedSourceCache,
|
||||
) -> Result<(), AnyError> {
|
||||
for module in modules {
|
||||
if module.media_type == MediaType::Json {
|
||||
// skip visiting Json modules as they are leaves
|
||||
continue;
|
||||
}
|
||||
|
||||
let text_info =
|
||||
match parsed_source_cache.get_parsed_source_from_module(module)? {
|
||||
Some(source) => source.text_info().clone(),
|
||||
|
|
Loading…
Reference in a new issue