[DOCS] Document web_register_native_module_id_overrides for web native modules
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- documentation
Research direction
Start with the web_deps section in docs/docs/core-module.md, then inspect GenerateWebNativeModulePackageFilesProcessor.swift and existing coreutils declarations to confirm the attribute’s mapping semantics. Document the emitted web implementation path, compiled Valdi module ID, comma-separated mappings, ownership guidance, and a complete ts_project plus valdi_module example. Done means the guide explains the generated package bridge and links to it from the web-development documentation; a troubleshooting entry is suggested if feasible.
Written by the indexing model from the issue text.
Description
What documentation needs improvement?
The valdi_module documentation in docs/docs/core-module.md, particularly the section covering web_deps.
The web-development documentation should also link to this information when describing browser-specific implementations.
What's unclear or missing?
web_deps is documented, but web_register_native_module_id_overrides is not.
When a Valdi module declares a native TypeScript API such as:
import { doSomething } from './ExampleNative';
and provides its browser implementation through a ts_project in web_deps, adding the web dependency alone does not make the compiled source import resolve.
The module must also declare the mapping:
valdi_module(
name = "example",
# ...
web_deps = [":example_web"],
web_register_native_module_id_overrides = {
"example/web/ExampleNative.js": "example/src/ExampleNative",
},
)
Without this mapping, the browser implementation may be included under native/, but no package file is generated at the module ID imported by the compiled Valdi source. Consumers then receive a generic bundler error such as:
Module not found: Can't resolve './ExampleNative.js'
This makes the problem look like a webpack or package-collapse bug, even though Valdi already has a supported mechanism for it.
The behavior is implemented by:
GenerateWebNativeModulePackageFilesProcessor.swiftweb_register_native_module_id_overridesinvaldi_module- Existing modules such as
coreutils
Suggested changes:
-
Add
web_register_native_module_id_overridesimmediately afterweb_depsindocs/docs/core-module.md. -
Document that:
- The key is the emitted web implementation path supplied by
web_deps. - The value is the compiled Valdi module ID that imports the native API.
- Multiple module IDs may be supplied as a comma-separated string.
- The mapping should be declared by the module that owns the web implementation, not by each consuming application.
- The key is the emitted web implementation path supplied by
-
Include a complete
ts_projectplusvaldi_moduleexample. -
Explain that Valdi generates a package bridge similar to:
// AUTO-GENERATED by Valdi. Do not edit. module.exports = require('../../../native/example/web/ExampleNative.js'); -
If feasible, add a compiler diagnostic—or at least a troubleshooting entry—for modules that provide a web-native implementation but omit the mapping.
Additional context:
The intended feature already works correctly once the override is declared. The issue is discoverability: the public documentation currently describes web_deps without explaining the companion attribute required for native-module imports.
- Dominant language
- C++
- Stars
- 16.4k
- Forks
- 539
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Snapchat/Valdi
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
Rust codegen: RustMethodResolver fails to unwrap .nullable on optional interface/module methodsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
deepseek-ai/DeepGEMM-Ascend#49 ·
Maintainers usually reply within 1 day
-
bug needs testing platform:windows topic:buildsystem topic:platforms
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
godotengine/godot#126110 · 1 comment ·
Maintainers usually reply within 1 day
-
comp-s3queue
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
ClickHouse/ClickHouse#137649 ·
Maintainers usually reply within 1 day
-
area/docdb kind/enhancement mvu-pg15-pg19 priority/low
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
yugabyte/yugabyte-db#40355 ·
Maintainers usually reply within 1 day
-
Clear params.inputs in dials.indexPossibly taken @phyy-nx claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
dials/dials#3361 · 1 comment ·
Maintainers usually reply within 1 day