Skip to content

Commit 1c9ad29

Browse files
wondengevados-cosmonic
authored andcommitted
fix(bindgen): use IndexMap for deterministic export iteration order
1 parent 2c0daf8 commit 1c9ad29

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/js-component-bindgen/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ all-features = true
2828
anyhow = { workspace = true }
2929
base64 = { workspace = true, features = [ "alloc" ] }
3030
heck = { workspace = true }
31+
indexmap = "2"
3132
log = { workspace = true }
3233
semver = { workspace = true }
3334
wasm-encoder = { workspace = true }

crates/js-component-bindgen/src/core.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
3939
use std::collections::{HashMap, HashSet};
4040

41+
use indexmap::IndexMap;
42+
4143
use anyhow::{Result, bail};
4244
use wasm_encoder::{
4345
CodeSection, EntityType, ExportKind, ExportSection, Function, FunctionSection, ImportSection,
@@ -201,7 +203,7 @@ impl<'a> Translation<'a> {
201203

202204
/// Returns the exports of this module, which are not modified by
203205
/// augmentation.
204-
pub fn exports(&self) -> HashMap<String, EntityIndex> {
206+
pub fn exports(&self) -> IndexMap<String, EntityIndex> {
205207
let (translation, exports) = match self {
206208
Translation::Normal(translation) => (translation, &translation.module.exports),
207209
Translation::Augmented { original, .. } => (original, &original.module.exports),

0 commit comments

Comments
 (0)