feat: classify jsonc and json5 modules#627
Conversation
| // todo(#239): remove this when updating the --json output for 3.0 | ||
| #[serde(rename = "asserted")] |
There was a problem hiding this comment.
I think now might be the time to address this? @dsherret?
There was a problem hiding this comment.
It would be good to move this code out of deno_graph and into the cli crate so it can be made stable there and then we can start doing more drastic changes to deno_graph.
dsherret
left a comment
There was a problem hiding this comment.
LGTM. Maybe we should only support json5 and not bother with having an additional jsonc attribute though?
Also, it would be nice if we changed deno_graph to not load json modules and instead marked them as external similar to bytes and text imports.
| media_type: MediaType::Json5, | ||
| mtime: opts.mtime, | ||
| source, | ||
| }); |
There was a problem hiding this comment.
Seems like we could reduce duplication with the above? For example, something like resolving a json_media_type with Option<MediaType> then return this.
There was a problem hiding this comment.
Maybe after JSON is changed from assert to coerce semantics like these ones, it's not nicely dedupable yet
| /// Support unstable jsonc and json5 imports. | ||
| pub unstable_extended_json_imports: bool, |
There was a problem hiding this comment.
Should we instead have separate options for unstable_jsonc_imports/unstable_json5_imports?
There was a problem hiding this comment.
I think we should just have json5 imports since json5 is a superset of jsonc
jsonc/json5deno#20374This generalises JSON module slots to any 'independent' or dependency-less text modules.