Skip to content

Commit

Permalink
Fix prerelease checks in .availableHelper and transform-runtime defin…
Browse files Browse the repository at this point in the history
…itions.
  • Loading branch information
loganfsmyth committed Sep 10, 2018
1 parent e372129 commit 61ec957
Show file tree
Hide file tree
Showing 31 changed files with 238 additions and 87 deletions.
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"
}
]
]
}

0 comments on commit 61ec957

Please sign in to comment.