JezK
Edit File: yarn-version.js
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.getInstallationMethod = getInstallationMethod; exports.version = void 0; function _regenerator() { var data = _interopRequireDefault(require("@babel/runtime/regenerator")); _regenerator = function _regenerator() { return data; }; return data; } function _asyncToGenerator2() { var data = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); _asyncToGenerator2 = function _asyncToGenerator2() { return data; }; return data; } function _fs() { var data = require("./fs"); _fs = function _fs() { return data; }; return data; } function _fs2() { var data = _interopRequireDefault(require("fs")); _fs2 = function _fs2() { return data; }; return data; } function _path() { var data = _interopRequireDefault(require("path")); _path = function _path() { return data; }; return data; } /** * Determines the current version of Yarn itself. * */ // This will be bundled directly in the .js file for production builds var _require = require('../../package.json'), version = _require.version, originalInstallationMethod = _require.installationMethod; exports.version = version; function getInstallationMethod() { return _getInstallationMethod.apply(this, arguments); } function _getInstallationMethod() { _getInstallationMethod = (0, _asyncToGenerator2()["default"])( /*#__PURE__*/_regenerator()["default"].mark(function _callee() { var installationMethod, manifestPath, manifest; return _regenerator()["default"].wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: installationMethod = originalInstallationMethod; // If there's a package.json in the parent directory, it could have an // override for the installation method, so we should prefer that over // whatever was originally in Yarn's package.json. This is the case with // systems such as Homebrew, which take the tarball and modify the // installation method so we're aware of the fact that Yarn was installed via // Homebrew (so things like update notifications can point out the correct // command to upgrade). _context.prev = 1; manifestPath = _path()["default"].join(__dirname, '..', 'package.json'); if (!_fs2()["default"].existsSync(manifestPath)) { _context.next = 8; break; } _context.next = 6; return (0, _fs().readJson)(manifestPath); case 6: manifest = _context.sent; if (manifest.installationMethod) { installationMethod = manifest.installationMethod; } case 8: _context.next = 12; break; case 10: _context.prev = 10; _context.t0 = _context["catch"](1); case 12: return _context.abrupt("return", installationMethod); case 13: case "end": return _context.stop(); } }, _callee, null, [[1, 10]]); })); return _getInstallationMethod.apply(this, arguments); } //# sourceMappingURL=yarn-version.js.map