Skip to content

Commit fe52494

Browse files
fix(jco): add old componentize-js checking for fetch import
1 parent cda47a2 commit fe52494

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/jco/src/cmd/componentize.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,19 @@ async function usesOlderWasiHTTP(witPath, worldName) {
4040
);
4141
});
4242

43-
return exportsOldIncomingHandler;
43+
const importsOldFetch = worldMetadata.imports.some((iface) => {
44+
return (
45+
iface.namespace === "wasi" &&
46+
iface.package === "http" &&
47+
iface.interface === "outgoing-handler" &&
48+
iface.version !== null &&
49+
iface.version.major === 0n &&
50+
iface.version.minor < 3n &&
51+
iface.version.patch < 10n
52+
);
53+
});
54+
55+
return exportsOldIncomingHandler || importsOldFetch;
4456
}
4557
export async function componentize(jsSource, opts) {
4658
const { disableFeatures, enableFeatures } = calculateFeatureSet(opts);

0 commit comments

Comments
 (0)