mirror of
https://github.com/denoland/deno.git
synced 2025-09-30 06:04:48 +00:00
BREAKING: remove support for JSON imports (#5037)
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 is contained in:
parent
96fd0f4692
commit
de2c042482
11 changed files with 15 additions and 137 deletions
|
@ -48,13 +48,6 @@ function cache(
|
|||
const sf = SourceFile.get(moduleId);
|
||||
|
||||
if (sf) {
|
||||
// NOTE: If it's a `.json` file we don't want to write it to disk.
|
||||
// JSON files are loaded and used by TS compiler to check types, but we don't want
|
||||
// to emit them to disk because output file is the same as input file.
|
||||
if (sf.mediaType === MediaType.Json) {
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE: JavaScript files are only cached to disk if `checkJs`
|
||||
// option in on
|
||||
if (sf.mediaType === MediaType.JavaScript && !checkJs) {
|
||||
|
@ -65,10 +58,7 @@ function cache(
|
|||
if (emittedFileName.endsWith(".map")) {
|
||||
// Source Map
|
||||
compilerOps.cache(".map", moduleId, contents);
|
||||
} else if (
|
||||
emittedFileName.endsWith(".js") ||
|
||||
emittedFileName.endsWith(".json")
|
||||
) {
|
||||
} else if (emittedFileName.endsWith(".js")) {
|
||||
// Compiled JavaScript
|
||||
compilerOps.cache(".js", moduleId, contents);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue