[DOCS] Document web_register_native_module_id_overrides for web native modules
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
まず docs/docs/core-module.md の web_deps セクションを確認し、次に GenerateWebNativeModulePackageFilesProcessor.swift と既存の coreutils 宣言を調べて、属性のマッピングの意味を確認してください。生成される Web 実装のパス、コンパイル済み Valdi モジュール ID、カンマ区切りのマッピング、担当に関するガイダンス、ts_project と valdi_module を含む完全な例を文書化してください。ガイドで生成されたパッケージブリッジを説明し、Web 開発ドキュメントからリンクしたら完了です。可能であれば、トラブルシューティング項目の追加も提案します。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C++
- スター
- 16.4k
- フォーク
- 539
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Snapchat/Valdi のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
Rust codegen: RustMethodResolver fails to unwrap .nullable on optional interface/module methodsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
RTL-SDR: re-enumerating while streaming removes the in-use entry from the device selection dialog対応中かも @dpc00 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 3 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
throneproj/Throne#2227 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
deepseek-ai/DeepGEMM-Ascend#49 ·
メンテナーはふだん 1 日以内に返信