Skip to content

Commit

Permalink
Update stage-4 preset to target latest Node.js 10 & 12 and latest sta…
Browse files Browse the repository at this point in the history
…ge-4 updates
  • Loading branch information
novemberborn committed Jan 5, 2020
1 parent 105a62f commit 578822a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 30 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ Install `babel-plugin-webpack-alias-7` as a dev-dependency. Then add the plugin

Aspires to bring [finished ECMAScript proposals](https://github.com/tc39/proposals/blob/master/finished-proposals.md) to AVA's test and helper files.

Efficiently applies the minimum of transforms to run the latest JavaScript syntax on Node.js 8, 10 and 12.
Efficiently applies the minimum of transforms to run the latest JavaScript syntax on Node.js 10 and 12.

Built-ins are not added or extended, so features like Proxies, `Array.prototype.includes` or `String.prototype.padStart` will only be available if the Node.js version running the tests supports it. Consult [node.green] for details.

Expand Down Expand Up @@ -310,13 +310,16 @@ Not all proposals can be supported via Babel transforms, see below for details.
| [`String.prototype.matchAll`][string-matchall] | No
| [`import()`][dynamic-import] | Yes
| [`Promise.allSettled`][promise-allsettled] | No
| [Optional Chaining][chaining] | Yes
| [Nullish coalescing Operator][nullish-coalescing] | Yes

[`@babel/plugin-proposal-async-generator-functions`](https://www.npmjs.com/package/@babel/plugin-proposal-async-generator-functions) relies on `Symbol.asyncIterator`, which AVA does not polyfill for you.

[array-includes]: https://github.com/tc39/Array.prototype.includes
[async-iteration]: https://github.com/tc39/proposal-async-iteration
[atomics]: https://github.com/tc39/ecmascript_sharedmem
[Babel options]: https://babeljs.io/docs/en/options
[chaining]: https://github.com/tc39/proposal-optional-chaining
[dot-all]: https://github.com/tc39/proposal-regexp-dotall-flag
[dynamic-import]: https://github.com/tc39/proposal-dynamic-import
[finally]: https://github.com/tc39/proposal-promise-finally
Expand All @@ -327,6 +330,7 @@ Not all proposals can be supported via Babel transforms, see below for details.
[lookbehind]: https://github.com/tc39/proposal-regexp-lookbehind
[named-groups]: https://github.com/tc39/proposal-regexp-named-groups
[node.green]: http://node.green
[nullish-coalescing]: https://github.com/tc39/proposal-nullish-coalescing
[object-fromentries]: https://github.com/tc39/proposal-object-from-entries
[object-gopds]: https://github.com/ljharb/proposal-object-getownpropertydescriptors
[object-values-entries]: https://github.com/tc39/proposal-object-values-entries
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@
"dependencies": {
"@babel/core": "^7.7.7",
"@babel/generator": "^7.7.7",
"@babel/plugin-proposal-async-generator-functions": "^7.7.4",
"@babel/plugin-proposal-dynamic-import": "^7.7.4",
"@babel/plugin-proposal-optional-catch-binding": "^7.7.4",
"@babel/plugin-transform-dotall-regex": "^7.7.7",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.7.4",
"@babel/plugin-proposal-optional-chaining": "^7.7.5",
"@babel/plugin-transform-modules-commonjs": "^7.7.5",
"babel-plugin-espower": "^3.0.1",
"concordance": "^4.0.0",
Expand Down
14 changes: 5 additions & 9 deletions stage-4-plugins/best-match.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@ const process = require('process'); // eslint-disable-line node/prefer-global/pr

function getClosestVersion() {
if (!process.versions.v8) {
// Assume compatibility with Node.js 8.9.4
return 'v8-6.1';
// Assume compatibility with Node.js 10.18.0
return 'v8-6.8';
}

const v8 = parseFloat(process.versions.v8);
if (v8 >= 6.6) {
return 'v8-6.6';
if (v8 >= 6.8) {
return 'v8-6.8';
}

if (v8 >= 6.2) {
return 'v8-6.2';
}

return 'v8-6.1';
return 'v8-6.8';
}

module.exports = require(`./${getClosestVersion()}.json`);
7 changes: 0 additions & 7 deletions stage-4-plugins/v8-6.1.json

This file was deleted.

6 changes: 0 additions & 6 deletions stage-4-plugins/v8-6.2.json

This file was deleted.

File renamed without changes.
6 changes: 2 additions & 4 deletions test/stage-4.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ function buildsCorrectPreset(t, node, v8, mapping) {
buildsCorrectPreset.title = (_, node) => `builds correct preset for Node.js ${node}`;

for (const [node, v8, mapping] of [
['not-v8-at-all', null, '../stage-4-plugins/v8-6.1.json'],
['8.9.4', '6.1.534.50', '../stage-4-plugins/v8-6.1.json'],
['8.16.0', '6.2.414.77', '../stage-4-plugins/v8-6.2.json'],
['10.0.0', '6.6.346.24-node.5', '../stage-4-plugins/v8-6.6.json']
['not-v8-at-all', null, '../stage-4-plugins/v8-6.8.json'],
['10.18.0', '6.8.275.32-node.54', '../stage-4-plugins/v8-6.8.json']
]) {
test(buildsCorrectPreset, node, v8, mapping);
}
Expand Down

0 comments on commit 578822a

Please sign in to comment.