Skip to content

chore: make the compatibility floor real, ES2020 - #20

Merged
bebrasmell merged 1 commit into
mainfrom
chore/es2020-floor
Aug 15, 2026
Merged

chore: make the compatibility floor real, ES2020#20
bebrasmell merged 1 commit into
mainfrom
chore/es2020-floor

Conversation

@bebrasmell

Copy link
Copy Markdown
Contributor

The ES2015 claim was never achievable: globalThis is read at module scope, and no build target can lower a runtime global. Rather than document that gap, close it and state a floor that holds everywhere.

  • pin the build to target: 'es2020', and write the sources to the same level so the JSR package, which publishes src/ rather than the bundle, asks no more of consumers than npm does
  • rewrite the last two ??= operators (ES2021), which were the only reason JSR sat a level above the bundle
  • stop reaching for performance unguarded. That global only arrived in Node.js 16, so a diagnostic measurement had quietly made 16 the real floor; it now falls back to Date.now() where absent
  • README states ES2020 / Node.js 14+ and lists what sets it

No engine loses support. With no explicit target esbuild had been emitting esnext, so every bundle released so far carried ES2022 class static blocks and this one is strictly more portable than any of them. Leaving ES2017 also brings async injection back to native emit rather than a generator.

The ES2015 claim was never achievable: `globalThis` is read at module
scope, and no build target can lower a runtime global. Rather than
document that gap, close it and state a floor that holds everywhere.

- pin the build to `target: 'es2020'`, and write the sources to the same
  level so the JSR package, which publishes `src/` rather than the
  bundle, asks no more of consumers than npm does
- rewrite the last two `??=` operators (ES2021), which were the only
  reason JSR sat a level above the bundle
- stop reaching for `performance` unguarded. That global only arrived in
  Node.js 16, so a diagnostic measurement had quietly made 16 the real
  floor; it now falls back to `Date.now()` where absent
- README states ES2020 / Node.js 14+ and lists what sets it

No engine loses support. With no explicit target esbuild had been
emitting `esnext`, so every bundle released so far carried ES2022 class
static blocks and this one is strictly more portable than any of them.
Leaving ES2017 also brings async injection back to native emit rather
than a generator.
@bebrasmell
bebrasmell merged commit a4b2694 into main Aug 15, 2026
2 checks passed
@bebrasmell
bebrasmell deleted the chore/es2020-floor branch August 15, 2026 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant