-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BREAKING: remove support for JSON imports #5037
Conversation
This commit removes support for importing JSON files as modules. This change is dictated by security; browsers rolled back on this support as well.
@@ -118,8 +115,9 @@ impl GlobalState { | |||
let compile_lock = self.compile_lock.lock().await; | |||
|
|||
let compiled_module = match out.media_type { | |||
msg::MediaType::Unknown => state1.js_compiler.compile(out).await, | |||
msg::MediaType::Json => state1.json_compiler.compile(&out).await, | |||
msg::MediaType::Json | msg::MediaType::Unknown => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think MediaType::Json
could now be removed; it'd be handled as MediaType::Unknown
CC @kitsonk |
Closes #3401. |
There may be special handling of json imports in the bundler code base. |
#[test] | ||
fn bundle_json() { | ||
let json_modules = util::root_path().join("cli/tests/020_json_modules.ts"); | ||
assert!(json_modules.is_file()); | ||
let t = TempDir::new().expect("tempdir fail"); | ||
let bundle = t.path().join("020_json_modules.bundle.js"); | ||
let mut deno = util::deno_cmd() | ||
.current_dir(util::root_path()) | ||
.arg("bundle") | ||
.arg(json_modules) | ||
.arg(&bundle) | ||
.spawn() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ry thanks for pointing this out; I guess there should be permission check involved in this case like a regular disk read?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
(cc @MylesBorins)
LGTM |
This commit removes support for importing JSON files as modules. This change is dictated by security; browsers rolled back on this support as well.
This commit removes support for importing JSON files as modules.
This change is dictated by security; browsers rolled back the support.