Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[wasm-opt] `--minify-imports-and-exports-and-modules` does not report module renames.

オープン
#7,657 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
wasm
領域
cli, compilers

調査の方向性

提供された test.wat、wat2wasm コマンド、--minify-imports-and-exports-and-modules フラグを使い、まず wasm-opt バージョン 123 で問題を再現します。フラグのマッピング出力を調べ、wasm2wat の出力と比較します。stdout にモジュールと関数の両方の名前変更が、統合されたモジュール名も含めて報告されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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-opt Version: 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.

主要言語
WebAssembly
スター
8.6k
フォーク
885
平均マージ
2日 4時間
マージ済み PR(30日)
77

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

WebAssembly/binaryen のほかの issue

WebAssembly/binaryen の issue をすべて見る

似ている issue

CLI の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。