Conversation
There was a problem hiding this comment.
Pull request overview
Makes “sloppy imports” (extension/index resolution) behavior configurable for standalone/eszip module loading, instead of always enabling it.
Changes:
- Adds a
sloppy_importsflag toWorkspaceEszipand gates extension/index fallback lookups behind it. - Plumbs a new
sloppy_importsparameter throughcreate_module_loader_for_eszip/create_module_loader_for_standalone_from_eszip_kind. - Reads
unstableSloppyImportsfrom the runtime context and passes it into the standalone module loader/resolver configuration.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/deno_facade/module_loader/standalone.rs | Adds a sloppy_imports toggle to control extension/index fallback in WorkspaceEszip::get_module, and threads the flag into workspace resolver creation. |
| crates/base/src/runtime/mod.rs | Extracts unstableSloppyImports from runtime context and forwards it into standalone module loader creation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let sloppy_imports = context | ||
| .get("unstableSloppyImports") | ||
| .and_then(|v| v.as_bool()) | ||
| .unwrap_or(false); |
There was a problem hiding this comment.
sloppy_imports is derived only from context["unstableSloppyImports"] and defaults to false, but DenoOptions::unstable_sloppy_imports() falls back to deno.json / workspace unstable flag (has_unstable("sloppy-imports")). This makes runtime module loading inconsistent with the options used to build/resolve the workspace and can disable sloppy imports even when the workspace config enables them. Consider deriving the value from the computed DenoOptions (or otherwise preserving the tri-state) instead of defaulting to false when the context key is absent.
| .unwrap_or(false); | |
| .unwrap_or_else(|| flags.has_unstable("sloppy-imports")); |
| @@ -746,6 +751,7 @@ where | |||
| }), | |||
| Some(base_dir_path.to_string_lossy().as_ref()), | |||
| should_block_fs || flags.restrict_host_fs, | |||
| sloppy_imports, | |||
There was a problem hiding this comment.
The new unstableSloppyImports plumbing changes runtime resolution behavior but doesn’t appear to be covered by the existing tests in this module. Adding a test that verifies imports resolve with/without extensions depending on the context flag (and/or workspace unstable setting) would help prevent regressions.
No description provided.