deno
e0431ffd - fix(core): enforce JSON requests in FsModuleLoader (#36137)

Commit
65 days ago
fix(core): enforce JSON requests in FsModuleLoader (#36137) ## Summary - reject non-JSON files when `FsModuleLoader` receives a JSON module request - return a `TypeError` with the actual module type and specifier - cover JavaScript, extensionless, and valid JSON files ## Details `FsModuleLoader` already rejected JSON files loaded without the JSON import attribute, but it did not enforce the reverse mismatch. A `.js` or extensionless file requested as JSON could therefore be returned as a JavaScript module. The loader now validates the requested and selected module types before reading the source. ## Validation - `./tools/format.js` - `cargo check -p deno_core` - `cargo test -p deno_core fs_module_loader -- --nocapture`
Author
Parents
Loading