Skip to content

Commit d0bfeed

Browse files
fix: tests, arg order for splice bindings
1 parent b9b55ec commit d0bfeed

6 files changed

Lines changed: 10 additions & 9 deletions

File tree

crates/spidermonkey-embedding-splicer/src/bin/splicer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ fn main() -> Result<()> {
124124
.collect::<Result<Vec<_>>>()?;
125125

126126
let result =
127-
splice::splice_bindings(engine, features, world_name, wit_path_str, None, debug)
127+
splice::splice_bindings(engine, features, None, wit_path_str, world_name, debug)
128128
.map_err(|e| anyhow::anyhow!(e))?;
129129

130130
fs::write(&out_dir.join("component.wasm"), result.wasm).with_context(|| {

crates/spidermonkey-embedding-splicer/src/splice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ use crate::{bindgen, map_core_fn, parse_wit, splice};
3333
pub fn splice_bindings(
3434
engine: Vec<u8>,
3535
features: Vec<Features>,
36-
world_name: Option<String>,
37-
wit_path: Option<String>,
3836
wit_source: Option<String>,
37+
wit_path: Option<String>,
38+
world_name: Option<String>,
3939
debug: bool,
4040
) -> Result<SpliceResult, String> {
4141
let (mut resolve, id) = match (wit_source, wit_path) {

crates/spidermonkey-embedding-splicer/src/wit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ impl std::str::FromStr for Features {
1616
"clocks" => Ok(Features::Clocks),
1717
"random" => Ok(Features::Random),
1818
"http" => Ok(Features::Http),
19+
"fetch-event" => Ok(Features::FetchEvent),
1920
_ => bail!("unrecognized feature string [{s}]"),
2021
}
2122
}

crates/splicer-component/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ impl Guest for SpidermonkeyEmbeddingSplicerComponent {
1919
fn splice_bindings(
2020
engine: Vec<u8>,
2121
features: Vec<Features>,
22-
world_name: Option<String>,
23-
wit_path: Option<String>,
2422
wit_source: Option<String>,
23+
wit_path: Option<String>,
24+
world_name: Option<String>,
2525
debug: bool,
2626
) -> Result<SpliceResult, String> {
27-
splice::splice_bindings(engine, features, world_name, wit_path, wit_source, debug)
27+
splice::splice_bindings(engine, features, wit_source, wit_path, world_name, debug)
2828
}
2929
}
3030

src/componentize.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ export async function componentize(
137137
// manual implementation of wasi:http/incoming-handler, so we should
138138
// disable fetch-event
139139
if (
140-
features.includes('http-server') &&
141-
detectedExports.contains('incomingHandler')
140+
features.includes('http') &&
141+
detectedExports.includes('incomingHandler')
142142
) {
143143
console.error(
144144
'Detected `incomingHandler` export, disabling fetch-event...',

test/cases/fetch-event-server/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export async function test(instance) {
1515
try {
1616
const resp = await fetch(`http://localhost:${port}`);
1717
const text = await resp.text();
18-
strictEqual(text, 'Hello world!');
18+
strictEqual(text, 'Hello World');
1919
} finally {
2020
server.stop();
2121
}

0 commit comments

Comments
 (0)