Skip to content

Commit a5f781e

Browse files
committed
fix #2940: adjust node's values in compat-table
1 parent 996d400 commit a5f781e

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
* Adjust some feature compatibility tables for node ([#2940](https://github.com/evanw/esbuild/issues/2940))
6+
7+
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:
8+
9+
* `class-private-brand-checks`: node v16.9+ => node v16.4+ (a decrease)
10+
* `hashbang`: node v12.0+ => node v12.5+ (an increase)
11+
* `optional-chain`: node v16.9+ => node v16.1+ (a decrease)
12+
* `template-literal`: node v4+ => node v10+ (an increase)
13+
14+
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/.
15+
316
## 0.17.10
417

518
* Update esbuild's handling of CSS nesting to match the latest specification changes ([#1945](https://github.com/evanw/esbuild/issues/1945))

internal/compat/js_table.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
276276
ES: {{start: v{2022, 0, 0}}},
277277
Firefox: {{start: v{90, 0, 0}}},
278278
IOS: {{start: v{15, 0, 0}}},
279-
Node: {{start: v{16, 9, 0}}},
279+
Node: {{start: v{16, 4, 0}}},
280280
Opera: {{start: v{77, 0, 0}}},
281281
Safari: {{start: v{15, 0, 0}}},
282282
},
@@ -459,7 +459,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
459459
Edge: {{start: v{79, 0, 0}}},
460460
Firefox: {{start: v{67, 0, 0}}},
461461
IOS: {{start: v{13, 4, 0}}},
462-
Node: {{start: v{12, 0, 0}}},
462+
Node: {{start: v{12, 5, 0}}},
463463
Opera: {{start: v{62, 0, 0}}},
464464
Safari: {{start: v{13, 1, 0}}},
465465
},
@@ -589,7 +589,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
589589
ES: {{start: v{2020, 0, 0}}},
590590
Firefox: {{start: v{74, 0, 0}}},
591591
IOS: {{start: v{13, 4, 0}}},
592-
Node: {{start: v{16, 9, 0}}},
592+
Node: {{start: v{16, 1, 0}}},
593593
Opera: {{start: v{77, 0, 0}}},
594594
Safari: {{start: v{13, 1, 0}}},
595595
},
@@ -677,7 +677,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
677677
ES: {{start: v{2015, 0, 0}}},
678678
Firefox: {{start: v{34, 0, 0}}},
679679
IOS: {{start: v{9, 0, 0}}},
680-
Node: {{start: v{4, 0, 0}}},
680+
Node: {{start: v{10, 0, 0}}},
681681
Opera: {{start: v{28, 0, 0}}},
682682
Safari: {{start: v{9, 0, 0}}},
683683
},

scripts/compat-table.js

+15
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,21 @@ for (const feature in features) {
372372
}
373373
}
374374

375+
// Apply some manual overrides from this thread: https://github.com/evanw/esbuild/issues/2940#issuecomment-1437818002
376+
// Each one has been manually checked using past node releases: https://nodejs.org/download/release/
377+
applyManualOverride('ClassPrivateBrandCheck', 'node', [{ start: [16, 9], end: null }], [{ start: [16, 4], end: null }])
378+
applyManualOverride('Hashbang', 'node', [{ start: [12, 0], end: null }], [{ start: [12, 5], end: null }])
379+
applyManualOverride('OptionalChain', 'node', [{ start: [16, 9], end: null }], [{ start: [16, 1], end: null }])
380+
applyManualOverride('TemplateLiteral', 'node', [{ start: [4], end: null }], [{ start: [10], end: null }])
381+
382+
function applyManualOverride(target, engine, expected, changed) {
383+
const observed = JSON.stringify(versions[target][engine])
384+
expected = JSON.stringify(expected)
385+
if (observed !== expected)
386+
throw new Error(`Mismatch for versions.${target}.${engine}: Expected ${observed} to be ${expected}`)
387+
versions[target][engine] = changed
388+
}
389+
375390
function upper(text) {
376391
if (text === 'es' || text === 'ios' || text === 'ie') return text.toUpperCase()
377392
return text[0].toUpperCase() + text.slice(1)

0 commit comments

Comments
 (0)