Sha256: 7a4da599ebe29246e79e0761fc86516df20326503dd49d94686d9559d5394755

Contents?: true

Size: 1.5 KB

Versions: 11

Compression:

Stored size: 1.5 KB

Contents

"use strict";

exports.__esModule = true;
exports.hasMinVersion = hasMinVersion;

var _semver = _interopRequireDefault(require("semver"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function hasMinVersion(minVersion, runtimeVersion) {
  // If the range is unavailable, we're running the script during Babel's
  // build process, and we want to assume that all versions are satisfied so
  // that the built output will include all definitions.
  if (!runtimeVersion || !minVersion) return true; // 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
  // babel-core's availableHelper() API.

  if (_semver.default.valid(runtimeVersion)) runtimeVersion = `^${runtimeVersion}`;
  return !_semver.default.intersects(`<${minVersion}`, runtimeVersion) && !_semver.default.intersects(`>=8.0.0`, runtimeVersion);
}

Version data entries

11 entries across 10 versions & 3 rubygems

Version Path
disco_app-0.16.1 test/dummy/node_modules/babel-plugin-polyfill-corejs2/lib/helpers.js
disco_app-0.15.2 test/dummy/node_modules/babel-plugin-polyfill-corejs2/lib/helpers.js
disco_app-0.18.4 test/dummy/node_modules/babel-plugin-polyfill-corejs2/lib/helpers.js
disco_app-0.18.1 test/dummy/node_modules/babel-plugin-polyfill-corejs2/lib/helpers.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/babel-plugin-polyfill-corejs2/lib/helpers.js
disco_app-0.14.0 test/dummy/node_modules/babel-plugin-polyfill-corejs2/lib/helpers.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/babel-plugin-polyfill-corejs2/lib/helpers.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/babel-plugin-polyfill-corejs2/lib/helpers.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/babel-plugin-polyfill-corejs2/lib/helpers.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/babel-plugin-polyfill-corejs2/lib/helpers.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/babel-plugin-polyfill-corejs2/lib/helpers.js