deno_core
deno_core copied to clipboard
feat: Add support for source phase imports
Towards https://github.com/denoland/deno/issues/28013
Codecov Report
Attention: Patch coverage is 83.50515% with 16 lines in your changes missing coverage. Please review.
Project coverage is 81.17%. Comparing base (
0c7f83e) to head (5ba0cba). Report is 260 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| core/modules/map.rs | 82.22% | 16 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #1081 +/- ##
==========================================
- Coverage 81.43% 81.17% -0.27%
==========================================
Files 97 101 +4
Lines 23877 28196 +4319
==========================================
+ Hits 19445 22889 +3444
- Misses 4432 5307 +875
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I don't think this is actually ready yet
Walkthrough
The changes introduce infrastructure to store and retrieve WebAssembly module source objects within the module map. A new sources HashMap is added to ModuleMapData to persist module source objects keyed by module ID. The ModuleMap gains a source_callback helper method that resolves import specifiers and returns available source objects. The existing module_source_callback is reworked to throw type errors instead of syntax errors when module sources are unavailable, and now supports parsing static import attributes and resolving referrer names. New test files and updated test cases exercise WASM module imports with source phase semantics.
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
- core/modules/map.rs: Callback refactoring and error handling changes require careful review to ensure proper fallback behavior and attribute parsing correctness
- core/modules/module_map_data.rs: HashMap storage field addition and retrieval logic are straightforward but must verify thread-safety assumptions for
v8::Global<v8::Object> - Test files: Verify that new WASM modules are correctly defined and test cases properly validate module properties and instantiation
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title 'feat: Add support for source phase imports' clearly and directly summarizes the main change in the changeset, which involves adding source phase import functionality to the module system. |
| Description check | ✅ Passed | The description references a specific GitHub issue related to source phase imports, which is directly relevant to the changeset implementing this feature. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
Comment @coderabbitai help to get the list of available commands and usage tips.