1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

fix(cache): do not attempt to emit non-emitable files (#15562)

This commit is contained in:
David Sherret 2022-08-23 10:30:14 -04:00 committed by GitHub
parent 86ef743c0f
commit 362af63c6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 9 deletions

View file

@ -30,6 +30,7 @@ use crate::npm::NpmPackageResolver;
use crate::resolver::ImportMapResolver; use crate::resolver::ImportMapResolver;
use crate::resolver::JsxResolver; use crate::resolver::JsxResolver;
use deno_ast::MediaType;
use deno_core::anyhow::anyhow; use deno_core::anyhow::anyhow;
use deno_core::anyhow::bail; use deno_core::anyhow::bail;
use deno_core::anyhow::Context; use deno_core::anyhow::Context;
@ -598,6 +599,15 @@ impl ProcState {
code, media_type, .. code, media_type, ..
} = entry } = entry
{ {
let is_emittable = matches!(
media_type,
MediaType::TypeScript
| MediaType::Mts
| MediaType::Cts
| MediaType::Jsx
| MediaType::Tsx
);
if is_emittable {
emit_parsed_source( emit_parsed_source(
&self.emit_cache, &self.emit_cache,
&self.parsed_source_cache, &self.parsed_source_cache,
@ -609,6 +619,7 @@ impl ProcState {
)?; )?;
} }
} }
}
Ok(()) Ok(())
} }

View file

@ -92,3 +92,8 @@ itest!(check_local_by_default2 {
output: "cache/check_local_by_default2.out", output: "cache/check_local_by_default2.out",
http_server: true, http_server: true,
}); });
itest!(json_import {
// should not error
args: "cache --quiet cache/json_import/main.ts",
});

View file

@ -0,0 +1,2 @@
import asdf from "./test.json" assert { type: "json" };
console.log(asdf);

View file

@ -0,0 +1,5 @@
{
"foo": {
"bar": 1
}
}

View file

@ -1904,6 +1904,8 @@ impl<'a> CheckOutputIntegrationTest<'a> {
let expected = if let Some(s) = self.output_str { let expected = if let Some(s) = self.output_str {
s.to_owned() s.to_owned()
} else if self.output.is_empty() {
String::new()
} else { } else {
let output_path = testdata_dir.join(self.output); let output_path = testdata_dir.join(self.output);
println!("output path {}", output_path.display()); println!("output path {}", output_path.display());