Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk committed Nov 3, 2021
1 parent 5b36f60 commit 8c81ea1
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 15 deletions.
26 changes: 22 additions & 4 deletions cli/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ async fn load_jsx_import_source(
if let Ok(None) = result {
for add in SEARCH_PATHS {
let next_specifier = append_path(specifier, *add);
let result = to_load_result(
file_fetcher.fetch(&next_specifier, permissions).await,
);
let result =
to_load_result(file_fetcher.fetch(&next_specifier, permissions).await);
match result {
Ok(None) => (),
_ => {
Expand Down Expand Up @@ -256,7 +255,26 @@ impl Loader for FetchCacher {
)
.await
} else {
to_load_result(file_fetcher.fetch(&specifier, &mut permissions).await)
file_fetcher
.fetch(&specifier, &mut permissions)
.await
.map_or_else(
|err| {
if let Some(err) = err.downcast_ref::<std::io::Error>() {
if err.kind() == std::io::ErrorKind::NotFound {
return Ok(None);
}
}
Err(err)
},
|file| {
Ok(Some(LoadResponse {
specifier: file.specifier,
maybe_headers: file.maybe_headers,
content: file.source,
}))
},
)
};

(specifier, load_result)
Expand Down
3 changes: 0 additions & 3 deletions cli/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ pub(crate) fn get_ts_config(
"jsx": "react",
"jsxFactory": "React.createElement",
"jsxFragmentFactory": "React.Fragment",
"jsxImportSource": DEFAULT_JSX_IMPORT_SOURCE,
})),
ConfigType::Check { tsc_emit, lib } => {
let mut ts_config = TsConfig::new(json!({
Expand Down Expand Up @@ -190,7 +189,6 @@ pub(crate) fn get_ts_config(
"jsx": "react",
"jsxFactory": "React.createElement",
"jsxFragmentFactory": "React.Fragment",
"jsxImportSource": DEFAULT_JSX_IMPORT_SOURCE,
})),
ConfigType::RuntimeEmit { tsc_emit } => {
let mut ts_config = TsConfig::new(json!({
Expand All @@ -205,7 +203,6 @@ pub(crate) fn get_ts_config(
"jsx": "react",
"jsxFactory": "React.createElement",
"jsxFragmentFactory": "React.Fragment",
"jsxImportSource": DEFAULT_JSX_IMPORT_SOURCE,
"lib": TypeLib::DenoWindow,
"module": "esnext",
"removeComments": true,
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/integration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ fn basic_auth_tokens() {
eprintln!("{}", stderr_str);

assert!(stderr_str.contains(
"Import 'http://127.0.0.1:4554/001_hello.js' failed: 404 Not Found"
"Import 'http://127.0.0.1:4554/001_hello.js' failed, not found."
));

let output = util::deno_cmd()
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/jsx/deno-js-base-dev.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"jsx": "react-jsxdev",
"jsxImportSource": "http://localhost:4545/jsx/jsx_base"
}
}
}
2 changes: 1 addition & 1 deletion cli/tests/testdata/jsx/deno-js-base.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"jsx": "react-jsx",
"jsxImportSource": "http://localhost:4545/jsx/jsx_base"
}
}
}
2 changes: 1 addition & 1 deletion cli/tests/testdata/jsx/deno-js-flat.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"jsx": "react-jsx",
"jsxImportSource": "http://localhost:4545/jsx/js_flat"
}
}
}
2 changes: 1 addition & 1 deletion cli/tests/testdata/jsx/deno-js.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"jsx": "react-jsx",
"jsxImportSource": "http://localhost:4545/jsx/js"
}
}
}
2 changes: 1 addition & 1 deletion cli/tests/testdata/jsx/deno-ts-flat.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"jsx": "react-jsx",
"jsxImportSource": "http://localhost:4545/jsx/ts_flat"
}
}
}
2 changes: 1 addition & 1 deletion cli/tests/testdata/jsx/deno-ts.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"jsx": "react-jsx",
"jsxImportSource": "http://localhost:4545/jsx/ts"
}
}
}
1 change: 0 additions & 1 deletion cli/tsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ mod tests {
"jsx": "react",
"jsxFactory": "React.createElement",
"jsxFragmentFactory": "React.Fragment",
"jsxImportSource": "https://esm.sh/preact",
"lib": ["deno.window"],
"module": "esnext",
"noEmit": true,
Expand Down

0 comments on commit 8c81ea1

Please sign in to comment.