fix: use semver gte comparison on polyfill version tester#12783
fix: use semver gte comparison on polyfill version tester#12783JLHwung merged 8 commits intobabel:mainfrom
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/40094/ |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 6b8ed33:
|
22387b8 to
94a25f1
Compare
| // semverGte("8.9", "8.9") // true | ||
| // semverGte("9.0", "8.9") // true | ||
| // semverGte("8.9", "8.10") // false | ||
| `((v,w)=>(v=v.split("."),w=w.split("."),+v[0]>+w[0]||v[0]==w[0]&&+v[1]>=+w[1]))`; |
There was a problem hiding this comment.
should this expression be here?
There was a problem hiding this comment.
It was meant for documentation of a stringified function only. 🤦♂️
I didn't figure out how to use @babel/template so it can import the function defined here, but since we only used it twice, I am good with copying this function so far.
| // semverGte("8.9", "8.10") // false | ||
| // TODO: figure out how to inject it to the `@babel/template` usage so we don't need to | ||
| // copy and paste it. | ||
| // `((v,w)=>(v=v.split("."),w=w.split("."),+v[0]>+w[0]||v[0]==w[0]&&+v[1]>=+w[1]))`; |
There was a problem hiding this comment.
You could to
const semverGte = template.ast`(v,w)=>(v=v.split("."),w=w.split("."),+v[0]>+w[0]||v[0]==w[0]&&+v[1]>=+w[1])`And then use it with interpolations in the other templates.
There was a problem hiding this comment.
Ok it looks like I was wrong, because we are not using template.ast here but the version that returns a factory function 😅
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This reverts commit 2db2c3a.
semverGtewith examplesCurrently we use
parseFloat(#12458) to compare node versions and to apply polyfills conditionally, however it will fail, for example, on comparing10.8to10.12, which is the case in #12650.The following affected packages should be republished:
@babel/cli@babel/node@babel/registerWe don't need to republish
@babel/transfrom-runtimesince onlyscriptsis modified and we never build Babel on Node.js 10.