Skip to content

Commit

Permalink
fix #2940: adjust node's values in compat-table
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Feb 21, 2023
1 parent 996d400 commit a5f781e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## Unreleased

* Adjust some feature compatibility tables for node ([#2940](https://github.com/evanw/esbuild/issues/2940))

This release makes the following adjustments to esbuild's internal feature compatibility tables for node, which tell esbuild which versions of node are known to support all aspects of that feature:

* `class-private-brand-checks`: node v16.9+ => node v16.4+ (a decrease)
* `hashbang`: node v12.0+ => node v12.5+ (an increase)
* `optional-chain`: node v16.9+ => node v16.1+ (a decrease)
* `template-literal`: node v4+ => node v10+ (an increase)

Each of these adjustments was identified by comparing against data from the `node-compat-table` package and was manually verified using old node executables downloaded from https://nodejs.org/download/release/.

## 0.17.10

* Update esbuild's handling of CSS nesting to match the latest specification changes ([#1945](https://github.com/evanw/esbuild/issues/1945))
Expand Down
8 changes: 4 additions & 4 deletions internal/compat/js_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
ES: {{start: v{2022, 0, 0}}},
Firefox: {{start: v{90, 0, 0}}},
IOS: {{start: v{15, 0, 0}}},
Node: {{start: v{16, 9, 0}}},
Node: {{start: v{16, 4, 0}}},
Opera: {{start: v{77, 0, 0}}},
Safari: {{start: v{15, 0, 0}}},
},
Expand Down Expand Up @@ -459,7 +459,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
Edge: {{start: v{79, 0, 0}}},
Firefox: {{start: v{67, 0, 0}}},
IOS: {{start: v{13, 4, 0}}},
Node: {{start: v{12, 0, 0}}},
Node: {{start: v{12, 5, 0}}},
Opera: {{start: v{62, 0, 0}}},
Safari: {{start: v{13, 1, 0}}},
},
Expand Down Expand Up @@ -589,7 +589,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
ES: {{start: v{2020, 0, 0}}},
Firefox: {{start: v{74, 0, 0}}},
IOS: {{start: v{13, 4, 0}}},
Node: {{start: v{16, 9, 0}}},
Node: {{start: v{16, 1, 0}}},
Opera: {{start: v{77, 0, 0}}},
Safari: {{start: v{13, 1, 0}}},
},
Expand Down Expand Up @@ -677,7 +677,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
ES: {{start: v{2015, 0, 0}}},
Firefox: {{start: v{34, 0, 0}}},
IOS: {{start: v{9, 0, 0}}},
Node: {{start: v{4, 0, 0}}},
Node: {{start: v{10, 0, 0}}},
Opera: {{start: v{28, 0, 0}}},
Safari: {{start: v{9, 0, 0}}},
},
Expand Down
15 changes: 15 additions & 0 deletions scripts/compat-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,21 @@ for (const feature in features) {
}
}

// Apply some manual overrides from this thread: https://github.com/evanw/esbuild/issues/2940#issuecomment-1437818002
// Each one has been manually checked using past node releases: https://nodejs.org/download/release/
applyManualOverride('ClassPrivateBrandCheck', 'node', [{ start: [16, 9], end: null }], [{ start: [16, 4], end: null }])
applyManualOverride('Hashbang', 'node', [{ start: [12, 0], end: null }], [{ start: [12, 5], end: null }])
applyManualOverride('OptionalChain', 'node', [{ start: [16, 9], end: null }], [{ start: [16, 1], end: null }])
applyManualOverride('TemplateLiteral', 'node', [{ start: [4], end: null }], [{ start: [10], end: null }])

function applyManualOverride(target, engine, expected, changed) {
const observed = JSON.stringify(versions[target][engine])
expected = JSON.stringify(expected)
if (observed !== expected)
throw new Error(`Mismatch for versions.${target}.${engine}: Expected ${observed} to be ${expected}`)
versions[target][engine] = changed
}

function upper(text) {
if (text === 'es' || text === 'ios' || text === 'ie') return text.toUpperCase()
return text[0].toUpperCase() + text.slice(1)
Expand Down

0 comments on commit a5f781e

Please sign in to comment.