1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-03 04:48:52 -05:00

fix(npm): handle json files in require (#16125)

This commit is contained in:
Bartek Iwańczuk 2022-10-01 22:21:19 +02:00 committed by GitHub
parent a6618dc01c
commit 048c06f84f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 0 deletions

View file

@ -749,6 +749,14 @@ pub fn translate_cjs_to_esm(
{
return Ok(analysis);
}
if media_type == MediaType::Json {
return Ok(CjsAnalysis {
exports: vec![],
reexports: vec![],
});
}
let parsed_source = deno_ast::parse_script(deno_ast::ParseParams {
specifier: specifier.to_string(),
text_info: deno_ast::SourceTextInfo::new(code.into()),

View file

@ -181,6 +181,13 @@ itest!(nonexistent_file {
exit_code: 1,
});
itest!(require_json {
args: "run --unstable -A --quiet npm/require_json/main.js",
output: "npm/require_json/main.out",
envs: env_vars(),
http_server: true,
});
#[test]
fn parallel_downloading() {
let (out, _err) = util::run_and_collect_output_with_args(

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -0,0 +1,2 @@
import globals from "npm:globals@13.17.0";
console.log(globals);

View file

@ -0,0 +1,3 @@
[WILDCARD]
devtools: {
[WILDCARD]