[DOCS] Document web_register_native_module_id_overrides for web native modules
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- documentation
Hướng nghiên cứu
Bắt đầu với phần web_deps trong docs/docs/core-module.md, sau đó kiểm tra GenerateWebNativeModulePackageFilesProcessor.swift và các khai báo coreutils hiện có để xác nhận ngữ nghĩa ánh xạ của thuộc tính. Tài liệu hóa đường dẫn triển khai web được tạo, ID mô-đun Valdi đã biên dịch, các ánh xạ phân tách bằng dấu phẩy, hướng dẫn về trách nhiệm và ví dụ hoàn chỉnh có ts_project cùng valdi_module. Công việc hoàn tất khi hướng dẫn giải thích cầu nối package được tạo và liên kết đến đó từ tài liệu phát triển web; nếu khả thi, đề xuất thêm mục troubleshooting.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C++
- Star
- 16.4k
- Fork
- 539
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Snapchat/Valdi
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Rust codegen: RustMethodResolver fails to unwrap .nullable on optional interface/module methodsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Snapchat/Valdi
Issue tương tự
-
RTL-SDR: re-enumerating while streaming removes the in-use entry from the device selection dialogCó thể đã có người làm @dpc00 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
throneproj/Throne#2227 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
deepseek-ai/DeepGEMM-Ascend#49 ·
Maintainer thường phản hồi trong vòng 1 ngày