Skip to content

Conversation

@nayeemrmn
Copy link
Collaborator

@nayeemrmn nayeemrmn commented Oct 30, 2025

This generalises JSON module slots to any 'independent' or dependency-less text modules.

Comment on lines 1164 to 1165
// todo(#239): remove this when updating the --json output for 3.0
#[serde(rename = "asserted")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think now might be the time to address this? @dsherret?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we could reduce duplication with the above? For example, something like resolving a json_media_type with Option<MediaType> then return this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe after JSON is changed from assert to coerce semantics like these ones, it's not nicely dedupable yet

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add an unstable option for this:

deno_graph/src/graph.rs

Lines 1655 to 1657 in decafab

pub unstable_bytes_imports: bool,
/// Support unstable text imports.
pub unstable_text_imports: bool,

Comment on lines +1657 to +1658
/// Support unstable jsonc and json5 imports.
pub unstable_extended_json_imports: bool,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we instead have separate options for unstable_jsonc_imports/unstable_json5_imports?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just have json5 imports since json5 is a superset of jsonc

@nayeemrmn nayeemrmn requested a review from dsherret November 17, 2025 06:53
@nayeemrmn
Copy link
Collaborator Author

@nayeemrmn nayeemrmn closed this Dec 2, 2025
@nayeemrmn nayeemrmn deleted the jsonc-json5 branch December 3, 2025 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants