Background
Introduced in #115. The compiler now records a semantic "needs-SharpTS-at-runtime" signal (EmittedRuntime.RequiredSharpTSRuntimeReasons, surfaced via ILCompiler.RequiredSharpTSRuntimeReasons) so the CLI co-locates SharpTS.dll with compiled output only when a feature genuinely late-binds into the runtime on its normal path (eval, Proxy, Intl, vm, dns, @DotNetType dynamic events).
The gap
AbortSignal.any late-binds to RuntimeTypes.AbortSignalAnyCompiled and so genuinely requires SharpTS at runtime. But its emission is gated only by the coarse RuntimeFeatureSet.UsesAbortController flag — which is also set by ordinary AbortController/fetch(..., { signal }) usage that is pure IL and needs no runtime.
Flagging all UsesAbortController would force an unnecessary SharpTS.dll copy for the common AbortController+fetch case, defeating the "only when needed" goal. So #115 deliberately left AbortSignal.any unflagged — meaning a program that actually uses AbortSignal.any and runs truly standalone will hit graceful degradation (throw) instead of having SharpTS.dll co-located.
Proposed fix
Add a precise feature flag (e.g. UsesAbortSignalAny) set by the RuntimeFeatureDetector only when AbortSignal.any is referenced, then record the runtime reason on that flag (runtime.RequireSharpTSRuntime("AbortSignal.any")) rather than on UsesAbortController. This keeps basic AbortController standalone while correctly co-locating SharpTS.dll for AbortSignal.any.
Acceptance
- A program using only
AbortController (incl. fetch with a signal) → no SharpTS.dll copy.
- A program using
AbortSignal.any([...]) → SharpTS.dll co-located; reason AbortSignal.any reported.
Low priority — AbortSignal.any is rare and degrades gracefully today.
Background
Introduced in #115. The compiler now records a semantic "needs-SharpTS-at-runtime" signal (
EmittedRuntime.RequiredSharpTSRuntimeReasons, surfaced viaILCompiler.RequiredSharpTSRuntimeReasons) so the CLI co-locatesSharpTS.dllwith compiled output only when a feature genuinely late-binds into the runtime on its normal path (eval, Proxy, Intl, vm, dns,@DotNetTypedynamic events).The gap
AbortSignal.anylate-binds toRuntimeTypes.AbortSignalAnyCompiledand so genuinely requires SharpTS at runtime. But its emission is gated only by the coarseRuntimeFeatureSet.UsesAbortControllerflag — which is also set by ordinaryAbortController/fetch(..., { signal })usage that is pure IL and needs no runtime.Flagging all
UsesAbortControllerwould force an unnecessarySharpTS.dllcopy for the common AbortController+fetch case, defeating the "only when needed" goal. So #115 deliberately leftAbortSignal.anyunflagged — meaning a program that actually usesAbortSignal.anyand runs truly standalone will hit graceful degradation (throw) instead of having SharpTS.dll co-located.Proposed fix
Add a precise feature flag (e.g.
UsesAbortSignalAny) set by theRuntimeFeatureDetectoronly whenAbortSignal.anyis referenced, then record the runtime reason on that flag (runtime.RequireSharpTSRuntime("AbortSignal.any")) rather than onUsesAbortController. This keeps basic AbortController standalone while correctly co-locating SharpTS.dll forAbortSignal.any.Acceptance
AbortController(incl.fetchwith a signal) → noSharpTS.dllcopy.AbortSignal.any([...])→SharpTS.dllco-located; reasonAbortSignal.anyreported.Low priority —
AbortSignal.anyis rare and degrades gracefully today.