Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix version checks in .availableHelper and transform-runtime definitions. #8659

Merged
merged 1 commit into from Sep 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/babel-core/src/transformation/file/file.js
Expand Up @@ -166,6 +166,25 @@ export default class File {
return false;
}

// semver.intersects() has some surprising behavior with comparing ranges
// with preprelease versions. We add '^' to ensure that we are always
// comparing ranges with ranges, which sidesteps this logic.
// For example:
//
// semver.intersects(`<7.0.1`, "7.0.0-beta.0") // false - surprising
// semver.intersects(`<7.0.1`, "^7.0.0-beta.0") // true - expected
//
// This is because the first falls back to
//
// semver.satisfies("7.0.0-beta.0", `<7.0.1`) // false - surprising
//
// and this fails because a prerelease version can only satisfy a range
// if it is a prerelease within the same major/minor/patch range.
//
// Note: If this is found to have issues, please also revist the logic in
// transform-runtime's definitions.js file.
if (semver.valid(versionRange)) versionRange = `^${versionRange}`;

return (
typeof versionRange !== "string" ||
(!semver.intersects(`<${minVersion}`, versionRange) &&
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
["proposal-class-properties", { "loose": true }],
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
["proposal-class-properties", { "loose": true }],
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
["proposal-class-properties", { "loose": true }],
"transform-classes",
"transform-block-scoping",
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
["proposal-class-properties", { "loose": true }],
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
["proposal-class-properties", { "loose": true }],
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
["proposal-class-properties", { "loose": true }],
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
["proposal-class-properties", { "loose": true }],
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
["proposal-class-properties", { "loose": true }],
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
["proposal-class-properties", { "loose": true }],
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
"proposal-class-properties",
"transform-classes",
"transform-block-scoping",
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
"proposal-class-properties",
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
"proposal-class-properties",
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
"proposal-class-properties",
"transform-classes",
"transform-block-scoping",
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
"proposal-class-properties",
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
"proposal-class-properties",
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
"proposal-class-properties",
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
"proposal-class-properties",
"transform-block-scoping",
"syntax-class-properties",
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
"proposal-class-properties",
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
"proposal-class-properties",
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
"proposal-class-properties",
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
"proposal-class-properties",
"transform-block-scoping",
"syntax-class-properties"
Expand Down
@@ -1,6 +1,11 @@
{
"plugins": [
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
"proposal-class-properties",
"transform-block-scoping",
"syntax-class-properties"
Expand Down
Expand Up @@ -2,6 +2,11 @@
"plugins": [
["proposal-decorators", { "decoratorsBeforeExport": false }],
"proposal-class-properties",
"external-helpers"
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
]
]
}
Expand Up @@ -2,6 +2,11 @@
"plugins": [
["proposal-decorators", { "decoratorsBeforeExport": false }],
"proposal-class-properties",
"external-helpers"
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
]
]
}
Expand Up @@ -2,6 +2,11 @@
"plugins": [
["proposal-decorators", { "decoratorsBeforeExport": false }],
"proposal-class-properties",
"external-helpers"
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
]
]
}
Expand Up @@ -2,6 +2,11 @@
"plugins": [
["proposal-decorators", { "decoratorsBeforeExport": false }],
"proposal-class-properties",
"external-helpers"
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
]
]
}
Expand Up @@ -2,7 +2,12 @@
"plugins": [
["proposal-decorators", { "decoratorsBeforeExport": false }],
"proposal-class-properties",
"external-helpers",
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
],
"syntax-async-generators"
]
}
Expand Up @@ -2,6 +2,11 @@
"plugins": [
["proposal-decorators", { "decoratorsBeforeExport": false }],
"proposal-class-properties",
"external-helpers"
[
"external-helpers",
{
"helperVersion": "7.0.1"
}
]
]
}