[wasm-opt] `--minify-imports-and-exports-and-modules` does not report module renames.
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
Comienza reproduciendo el problema con wasm-opt versión 123 usando el test.wat proporcionado, el comando wat2wasm y la opción --minify-imports-and-exports-and-modules. Inspecciona la salida de mapeo de la opción y compárala con la salida de wasm2wat; se considera terminado cuando stdout informa de los renombrados tanto de módulos como de funciones, incluidos los nombres de módulos fusionados.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- WebAssembly
- Estrellas
- 8.6k
- Forks
- 885
- Merge medio
- 2 d 4 h
- PR fusionados (30 d)
- 77
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de WebAssembly/binaryen
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
WebAssembly/binaryen#9135 · 1 comentario ·
-
Dificultad 2/5 Medio día Aptitud para principiantes 76/100
WebAssembly/binaryen#9018 · 3 comentarios ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
WebAssembly/binaryen#9133 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
WebAssembly/binaryen#9123 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
WebAssembly/binaryen#9122 ·
Todos los issues de WebAssembly/binaryen
Issues similares
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
anthropics/skills#1811 · 1 comentario ·
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
CachyOS/distribution#587 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
datalayer/mcp-compose#42 ·