Repository navigation
fix(DateTime): avoid top-level liftThrowable so AOT compilers prune Intl - #10906
Merged
Merged
Conversation
Closes #10900 Closes EFF-4273 Co-authored-by: Quino Terrasa <[email protected]>
🦋 Changeset detectedLatest commit: 2e402e9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 40 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
tim-smart
enabled auto-merge (squash)
November 25, 2026 00:50
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
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.
Summary
Rewrites
makeZonedandzoneMakeNamedinpackages/effect/src/internal/dateTime.tsas plain functions withtry/catchinstead of top-levelOption.liftThrowable(...)calls.Root cause
Effectreachesinternal/dateTime.tsviainternal/schedule.ts -> Schedule.ts -> Cron.ts -> internal/dateTime.ts. AOT compilers such asscriptctreat any function passed to a call in a module's top-level initializer as reachable (even when annotated/*#__PURE__*/and never called). PassingmakeZonedUnsafeandzoneMakeNamedUnsafetoOption.liftThrowableat module scope causednew Intl.DateTimeFormat(...)to be treated as reachable wheneverinternal/dateTime.tsloaded, failing builds on runtimes without ICU.Rewriting those two helpers as ordinary functions preserves the exact public API and runtime behavior while allowing per-function pruning to omit
Intlwhen time zones / cron schedules are not used.Verification
packages/effect/test/DateTime.test.ts(132 passed, 1 skipped)packages/effect/test/Cron.test.ts(51 passed)packages/effect/test/Schedule.test.ts(36 passed)pnpm --filter effect check),oxlint, anddprint checkpass.[email protected]onlinux-x64-gnuafter removing theicuarchive andicudt78l.datfrom@scriptc/runtime-linux-x64-gnu/runtime-pack.json(so linkingscr_intl.ofails withSC3004undefined ICU symbols, exercising the same Intl-reachability condition asSC3002on macOS):import { runSync, succeed } from "effect/Effect"SC3004, linksscr_intl.o)exit 0, noscr_intl.o)import { Effect } from "effect"SC3004, linksscr_intl.o)exit 0, noscr_intl.o)Effect.retry(..., Schedule.recurs(2))SC3004, linksscr_intl.o)exit 0, noscr_intl.o)Schedule.cron("* * * * *")SC3004, linksscr_intl.o)SC3004, linksscr_intl.o, expected)Closes #10900
Closes EFF-4273
Co-authored-by: Quino Terrasa [email protected]