[wasm-opt] `--minify-imports-and-exports-and-modules` does not report module renames.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện sự cố với wasm-opt phiên bản 123 bằng test.wat được cung cấp, lệnh wat2wasm và cờ --minify-imports-and-exports-and-modules. Kiểm tra đầu ra ánh xạ của cờ và so sánh với đầu ra của wasm2wat; được xem là hoàn tất khi stdout báo cáo cả việc đổi tên module lẫn function, bao gồm cả các tên module đã được hợp nhất.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When using wasm-opt with the --minify-imports-and-exports-and-modules flag, the tool correctly minifies both the import module names and the import function names. It often merges multiple import modules into a single new minified name.
However, the mapping printed to stdout is incomplete. It includes the remapping for the function names but completely omits the remapping for the module names. This makes it impossible for tools that rely on this map to correctly patch the host JavaScript environment, breaking the application.
Environment
wasm-optVersion:wasm-opt version 123
Minimal Reproducible Example (MRE)
1. Input .wat file (test.wat):
This file defines a module that imports two functions from two different, uniquely named modules.
(module
(type (;0;) (func))
(import "long_module_name_a" "long_function_name_foo" (func (;0;) (type 0)))
(import "long_module_name_b" "long_function_name_bar" (func (;1;) (type 0)))
)
2. Assemble to .wasm:
wat2wasm test.wat -o test.wasm
3. Run wasm-opt:
wasm-opt test.wasm -o output.wasm --minify-imports-and-exports-and-modules
Results
Actual stdout Output:
The tool only prints the mapping for the function names:
long_function_name_foo => a
long_function_name_bar => b
Actual Contents of output.wasm (decompiled with wasm2wat):
The output Wasm shows that the module names were also minified and merged into "a":
(module
(type (;0;) (func))
(import "a" "a" (func (;0;) (type 0)))
(import "a" "b" (func (;1;) (type 0)))
)
Expected Behavior
The stdout mapping should be complete and reflect all minification operations performed on the import/export interface. A correct and unambiguous output would look something like this:
long_module_name_a => a
long_module_name_b => a
long_function_name_foo => a
long_function_name_bar => b
This would provide all the necessary information for a host environment to correctly wire up the minified module.
- Ngôn ngữ chính
- WebAssembly
- Star
- 8.6k
- Fork
- 885
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 77
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 WebAssembly/binaryen
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
WebAssembly/binaryen#9135 · 1 bình luận ·
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 76/100
WebAssembly/binaryen#9018 · 3 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
WebAssembly/binaryen#9133 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
WebAssembly/binaryen#9123 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
WebAssembly/binaryen#9122 ·
Tất cả issue của WebAssembly/binaryen
Issue tương tự
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/skills#1811 · 1 bình luận ·
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
CachyOS/distribution#587 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
datalayer/mcp-compose#42 ·