Skip to content

Commit

Permalink
feat(graalvm): add polyfilled fetch support
Browse files Browse the repository at this point in the history
feat(runtime): add polyfill for `fetch` api
chore(graalvm): rebuild polyfills and modules

Signed-off-by: Sam Gammon <sam@elide.dev>
  • Loading branch information
sgammon committed Feb 23, 2025
1 parent c00e776 commit 1c66a5d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/cli/src/main/kotlin/elide/tool/cli/Elide.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ import elide.tool.io.RuntimeWorkdirManager
NativeEngine.boot(RuntimeWorkdirManager.acquire()) {
listOf(
"elide.js.vm.enableStreams" to "true",
"jdk.httpclient.allowRestrictedHeaders" to "Host,Content-Length", // needed for fetch
"io.netty.allocator.maxOrder" to "3",
"io.netty.serviceThreadPrefix" to "elide-svc",
"io.netty.native.deleteLibAfterLoading" to "true", // reversed bc of bug (actually does not delete)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import org.graalvm.polyglot.HostAccess as PolyglotHostAccess
.allowCreateProcess(true)
.allowHostClassLoading(true)
.allowNativeAccess(true)
.allowHostClassLookup { true }
.engine(engine)

// allow plugins to customize the context on creation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,23 @@ import elide.runtime.plugins.js.JavaScriptVersion.*
"js.string-lazy-substrings",
"js.shadow-realm",
"js.zone-rules-based-time-zones",
// Enabled for use by polyfills or for experimental features:
"js.java-package-globals",
"js.graal-builtin",
"js.polyglot-evalfile",
"js.load",
"js.polyglot-builtin",
)

disableOptions(
"js.console",
"js.graal-builtin",
"js.interop-complete-promises",
"js.java-package-globals",
"js.load",
"js.polyglot-evalfile",
"js.print",
"js.regexp-static-result",
"js.scripting",
"js.syntax-extensions",
// Experimental:
"js.operator-overloading",
"js.polyglot-builtin",
)

setOptions(
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ private const val ENABLE_SUPPRESSIONS = true
"TextDecoderStream", // not yet implemented
"TextEncoderStream", // not yet implemented
"DOMException", // not yet implemented
).plus(
fetchGlobals
)

// Types which are expected to be provided by JS polyfills.
Expand All @@ -255,6 +253,8 @@ private const val ENABLE_SUPPRESSIONS = true
"TransformStreamDefaultController",
"WritableStreamDefaultController",
"WritableStreamDefaultWriter",
).plus(
fetchGlobals
)).toSortedSet()

// Globals which are expected not to be found host-side.
Expand Down
2 changes: 1 addition & 1 deletion runtime

0 comments on commit 1c66a5d

Please sign in to comment.