Mapping of Node.js version to ECMAScript version [closed]
Asked Answered
F

1

28

Is there a mapping somewhere from Node.js version, e.g. 0.10, or 14, to the corresponding ECMAScript version, e.g. ES5, ES2020?

As this question is closed, I can't post the solution I came up with as an answer, so it is here instead.

@bevry/node-versions includes fetchESVersionForNodeVersion(nodeVersion: string): Promise<string> which will fetch the ECMAScript version that was ratified by the time that the Node.js version was released.

Facility answered 26/10, 2020 at 22:39 Comment(6)
node.green. See also e.g. https://mcmap.net/q/216363/-what-version-of-javascript-is-supported-in-node-js/3001761.Astri
There is no such thing as a direct mapping because no single node.js version represents a 100% transition from one version of the ECMAScript specification to a new version. Instead, it is a gradual adding of new language features over time and over many versions. As you've now received two recommendations for, node.green will show you the feature by feature transition between nodejs versions.Alejandroalejo
node.green is not really very useful, I find it very confusing for making a decision on which exmascript version to target given a base nodejs version.Destitution
if you googled here you probably want this: stackoverflow.com/a/57607634Thurifer
The best resource I have found so far is on tsconfig github repo, e.g.: github.com/tsconfig/bases/blob/main/bases/node16.json . Here you can find typescript config files for various node versions including it's corresponding javascript version (look at the target field).Krispin
@VincentPazeller if generating the right scaffolding for the various node versions is your use case, take a look at github.com/bevry/boundation — it's what I coded github.com/bevry/node-versions forFacility
M
13

Which features ship with which Node.js version by default?

The website node.green provides an excellent overview over supported ECMAScript features in various versions of Node.js, based on kangax's compat-table.

Source: https://nodejs.org/en/docs/es6/

Middleoftheroader answered 26/10, 2020 at 22:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.