chore: make the compatibility floor real, ES2020 - #20
Merged
Conversation
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.
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.
The ES2015 claim was never achievable:
globalThisis 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.target: 'es2020', and write the sources to the same level so the JSR package, which publishessrc/rather than the bundle, asks no more of consumers than npm does??=operators (ES2021), which were the only reason JSR sat a level above the bundleperformanceunguarded. That global only arrived in Node.js 16, so a diagnostic measurement had quietly made 16 the real floor; it now falls back toDate.now()where absentNo 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.