Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Pre-merge checks:
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
commit: |
This was referenced Nov 11, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the proposal in #362. Experimental.
Adds
srvx/scriptc, a smallnode:httpdriver for scriptc, which compiles TypeScript to native executables. It uses scriptc's built-inRequest/Response/URLdirectly. Thesrvx/nodeadapter can't compile under scriptc (see #362), so this is a separate adapter.Changes
src/adapters/scriptc.ts: the new adapter.wrapFetch(middleware),errorPlugin,plugins,resolvePortAndHostandprintListening. Nothing from_node/or_url.ts.FastURLis the nativeURL.FastResponseis a factory that returns a nativeResponse, because scriptc can'tnewthe nativeResponsethrough another binding (constructor is not a constructor). It forwardsjson/redirect/error, andinstanceof FastResponseisfalse.request.signalaborts on client disconnect. Absolute-form request targets are supported, and a badHostheader gets a 400.set-cookieheaders, customstatusText, streamed bodies, HEAD and null-body statuses. Handler errors give a 500 or theerrorhandler's response.server.waitUntil()is written inline, becausecreateWaitUntil()doesn't compile under scriptc.close()waits for pending tasks.package.json: adds a./scriptcexport and a"scriptc"condition in".", before"node". scriptc currently resolves onlyimport/node/default(npm.ts#L14), so the condition takes effect only if scriptc adds one. Until then, users importsrvx/scriptcexplicitly.src/types.ts: adds"scriptc"toServer.runtime.build.config.mjs: adds the adapter to the build entries.docs/1.guide/12.scriptc.md, andsrvx/scriptcadded to the explicit-imports list in the bundler guide.test/scriptc.test.ts: 24 tests run the adapter under Node. An 8-test native suite, enabled by settingSCRIPTC=<path to scriptc>, compiles a sample app with scriptc and checks it over HTTP. It needspnpm buildfirst.Limitations (documented)
request.ip/waitUntil/runtime/context. scriptc can't add properties to a built-inRequest: assignment,Object.defineProperty,extends Requestanddeclare globalaugmentation all fail. Code that relies on them, such as h3, won't work yet.tls,protocolandnodeare ignored, as aregracefulShutdown,trustProxy,maxRequestBodySizeandreusePort.ServerResponsehas nodrainevent.srvxCLI loader.Verification
scriptc coveragereports 99% of statements compile statically, with no deferred sites in the adapter.set-cookieheaders, custom status text, streaming, HEAD and 204. Also middleware and plugins, the error handler, clean 500s,request.signalon disconnect, badHost→ 400, and exiting cleanly afterclose().pnpm lintandpnpm typecheckare clean. The fullvitest runhas 1853 passing and 52 skipped. WithSCRIPTCset, the scriptc suite passes 32/32, native included. The nativeFastResponsetest fails if the oldFastResponse = Responseis put back.oha -c 64, on a shared machine): about 45k req/s for a minimal app, versus about 20k req/s forsrvx/nodeon Node 24 (see Proposal: experimentalsrvx/scriptcadapter (native executables) #362).Notes for review
Apps compile
srvxfrom its published JS, so scriptc warns that the adapter uses untyped values (SC6101), andmiddleware/pluginsarrays become checked-dynamic values (SC6104). In a quick run, two async middlewares dropped throughput to about 18k req/s.Compiling
src/adapters/scriptc.tsitself (rather thandist) currently fails with 2 errors in shared code:src/_utils.ts:100(readFileSynconunknown) andsrc/types.ts:201(node:nethas noListenOptionsin scriptc's types). That only matters if the"scriptc"condition is ever pointed at source.h3 compatibility findings, including whether bundling with the
scriptccondition helps: Proposal: experimentalsrvx/scriptcadapter (native executables) #362 (comment)🤖 Generated with AI assistant