@atlaskit/dependency-version-analytics 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
4
  import semver from 'semver';
6
5
  import getPackageVersionHistoryAndTags from '../../util/get-package-version-history';
7
6
  import { createUpgradeEvent, sendAnalytics } from '../../util/analytics';
@@ -36,50 +35,48 @@ export default function populatePackage(_x) {
36
35
  return _populatePackage.apply(this, arguments);
37
36
  }
38
37
  function _populatePackage() {
39
- _populatePackage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(flags) {
38
+ _populatePackage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(flags) {
40
39
  var supportedScopes, packageVersionHistory, analyticsEvents;
41
- return _regeneratorRuntime().wrap(function _callee$(_context) {
42
- while (1) {
43
- switch (_context.prev = _context.next) {
44
- case 0:
45
- supportedScopes = getSupportedScopes(flags.includeRestrictedScopes);
46
- if (isPackageFromSupportedScopes(flags.pkg, supportedScopes)) {
47
- _context.next = 3;
48
- break;
49
- }
50
- throw new Error("Package must start with ".concat(supportedScopes.join(', ')));
51
- case 3:
52
- _context.next = 5;
53
- return getPackageVersionHistoryAndTags(flags.pkg);
54
- case 5:
55
- packageVersionHistory = _context.sent;
56
- if (!(flags.since && Number.isNaN(Number(new Date(flags.since))))) {
57
- _context.next = 8;
58
- break;
59
- }
60
- throw new Error("'since' flag is an invalid date");
61
- case 8:
62
- analyticsEvents = createAnalyticsEvents(flags.pkg, packageVersionHistory, flags.since);
63
- if (!flags.dryRun) {
64
- _context.next = 12;
65
- break;
66
- }
67
- console.log(JSON.stringify(analyticsEvents));
68
- return _context.abrupt("return", analyticsEvents);
69
- case 12:
70
- _context.next = 14;
71
- return sendAnalytics(analyticsEvents, {
72
- dev: flags.dev,
73
- limit: flags.limit,
74
- product: 'atlaskit',
75
- skipPrompt: !flags.interactive
76
- });
77
- case 14:
78
- return _context.abrupt("return", analyticsEvents);
79
- case 15:
80
- case "end":
81
- return _context.stop();
82
- }
40
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
41
+ while (1) switch (_context.prev = _context.next) {
42
+ case 0:
43
+ supportedScopes = getSupportedScopes(flags.includeRestrictedScopes);
44
+ if (isPackageFromSupportedScopes(flags.pkg, supportedScopes)) {
45
+ _context.next = 3;
46
+ break;
47
+ }
48
+ throw new Error("Package must start with ".concat(supportedScopes.join(', ')));
49
+ case 3:
50
+ _context.next = 5;
51
+ return getPackageVersionHistoryAndTags(flags.pkg);
52
+ case 5:
53
+ packageVersionHistory = _context.sent;
54
+ if (!(flags.since && Number.isNaN(Number(new Date(flags.since))))) {
55
+ _context.next = 8;
56
+ break;
57
+ }
58
+ throw new Error("'since' flag is an invalid date");
59
+ case 8:
60
+ analyticsEvents = createAnalyticsEvents(flags.pkg, packageVersionHistory, flags.since);
61
+ if (!flags.dryRun) {
62
+ _context.next = 12;
63
+ break;
64
+ }
65
+ console.log(JSON.stringify(analyticsEvents));
66
+ return _context.abrupt("return", analyticsEvents);
67
+ case 12:
68
+ _context.next = 14;
69
+ return sendAnalytics(analyticsEvents, {
70
+ dev: flags.dev,
71
+ limit: flags.limit,
72
+ product: 'atlaskit',
73
+ skipPrompt: !flags.interactive
74
+ });
75
+ case 14:
76
+ return _context.abrupt("return", analyticsEvents);
77
+ case 15:
78
+ case "end":
79
+ return _context.stop();
83
80
  }
84
81
  }, _callee);
85
82
  }));
@@ -1,8 +1,7 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
5
  import { DEFAULT_TAG } from '../../constants';
7
6
  import chalk from 'chalk';
8
7
  import { createUpgradeEvent, sendAnalytics } from '../../util/analytics';
@@ -11,7 +10,6 @@ import * as statlas from '../../util/statlas';
11
10
  import { generateCSV } from './util/generate-csv';
12
11
  import { assert } from '../../util/assert';
13
12
  import { DependencyStore } from './lib/dependency-store';
14
- import getPackageVersionHistoryAndTags from '../../util/get-package-version-history';
15
13
  import { getSupportedScopes } from './util/allowed-scopes';
16
14
  var getUpgradeEventsFromPkgChange = function getUpgradeEventsFromPkgChange(oldDeps, newDeps, _ref) {
17
15
  var date = _ref.date,
@@ -59,256 +57,214 @@ var getUpgradeEventsFromPkgChange = function getUpgradeEventsFromPkgChange(oldDe
59
57
  return [].concat(_toConsumableArray(addOrUpgradeEvents), _toConsumableArray(removeEvents));
60
58
  };
61
59
  var getEventsFromHistory = /*#__PURE__*/function () {
62
- var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(packageChangesLog, prevRunHash, _ref8, supportedScopes) {
63
- var cwd, allPackageChanges, allUpgradeEvents, dependencyStore, dependencies, i, item, newDependencies, packageChange, upgradeEvents, _allUpgradeEvents;
64
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
65
- while (1) {
66
- switch (_context2.prev = _context2.next) {
67
- case 0:
68
- cwd = _ref8.cwd;
69
- allPackageChanges = [];
70
- allUpgradeEvents = [];
71
- assert(packageChangesLog.all.length > 0, '');
72
- dependencyStore = new DependencyStore(cwd, supportedScopes);
73
- _context2.next = 7;
74
- return dependencyStore.initialise(prevRunHash);
75
- case 7:
76
- dependencies = _context2.sent;
77
- i = 0;
78
- case 9:
79
- if (!(i < packageChangesLog.all.length)) {
80
- _context2.next = 21;
81
- break;
82
- }
83
- item = packageChangesLog.all[i];
84
- if (allPackageChanges.length > 0) {
85
- dependencies = allPackageChanges[allPackageChanges.length - 1].deps;
86
- }
87
- _context2.next = 14;
88
- return dependencyStore.update(item);
89
- case 14:
90
- newDependencies = _context2.sent;
91
- packageChange = {
92
- date: new Date(item.date).toISOString(),
93
- deps: newDependencies
94
- };
95
- upgradeEvents = getUpgradeEventsFromPkgChange(dependencies, newDependencies, {
96
- date: packageChange.date,
97
- commitHash: item.hash
98
- });
99
- if (upgradeEvents.length > 0) {
100
- (_allUpgradeEvents = allUpgradeEvents).push.apply(_allUpgradeEvents, _toConsumableArray(upgradeEvents));
101
- allPackageChanges.push(packageChange);
102
- }
103
- case 18:
104
- i++;
105
- _context2.next = 9;
60
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(packageChangesLog, prevRunHash, _ref8, supportedScopes) {
61
+ var cwd, allPackageChanges, allUpgradeEvents, dependencyStore, dependencies, i, item, newDependencies, packageChange, upgradeEvents;
62
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
63
+ while (1) switch (_context.prev = _context.next) {
64
+ case 0:
65
+ cwd = _ref8.cwd;
66
+ allPackageChanges = [];
67
+ allUpgradeEvents = [];
68
+ assert(packageChangesLog.all.length > 0, '');
69
+ dependencyStore = new DependencyStore(cwd, supportedScopes);
70
+ _context.next = 7;
71
+ return dependencyStore.initialise(prevRunHash);
72
+ case 7:
73
+ dependencies = _context.sent;
74
+ i = 0;
75
+ case 9:
76
+ if (!(i < packageChangesLog.all.length)) {
77
+ _context.next = 21;
106
78
  break;
107
- case 21:
108
- _context2.next = 23;
109
- return Promise.all(allUpgradeEvents.map( /*#__PURE__*/function () {
110
- var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(upgradeEvent) {
111
- var _distTags$hotfix, _distTags$latest, _distTags$next;
112
- var getPackageTags, distTags;
113
- return _regeneratorRuntime().wrap(function _callee$(_context) {
114
- while (1) {
115
- switch (_context.prev = _context.next) {
116
- case 0:
117
- _context.next = 2;
118
- return getPackageVersionHistoryAndTags(upgradeEvent.dependencyName);
119
- case 2:
120
- getPackageTags = _context.sent;
121
- distTags = getPackageTags['dist-tags'];
122
- Object.keys(distTags).forEach(function (key) {
123
- if (key.startsWith('rc')) {
124
- upgradeEvent.rcTag = distTags[key];
125
- }
126
- });
127
- upgradeEvent.hotfixTag = (_distTags$hotfix = distTags['hotfix']) !== null && _distTags$hotfix !== void 0 ? _distTags$hotfix : null;
128
- upgradeEvent.latestTag = (_distTags$latest = distTags['latest']) !== null && _distTags$latest !== void 0 ? _distTags$latest : null;
129
- upgradeEvent.nextTag = (_distTags$next = distTags['next']) !== null && _distTags$next !== void 0 ? _distTags$next : null;
130
- return _context.abrupt("return", upgradeEvent);
131
- case 9:
132
- case "end":
133
- return _context.stop();
134
- }
135
- }
136
- }, _callee);
137
- }));
138
- return function (_x5) {
139
- return _ref10.apply(this, arguments);
140
- };
141
- }()));
142
- case 23:
143
- allUpgradeEvents = _context2.sent;
144
- return _context2.abrupt("return", {
145
- allPackageChanges: allPackageChanges,
146
- allUpgradeEvents: allUpgradeEvents
147
- });
148
- case 25:
149
- case "end":
150
- return _context2.stop();
151
- }
79
+ }
80
+ item = packageChangesLog.all[i];
81
+ if (allPackageChanges.length > 0) {
82
+ dependencies = allPackageChanges[allPackageChanges.length - 1].deps;
83
+ }
84
+ _context.next = 14;
85
+ return dependencyStore.update(item);
86
+ case 14:
87
+ newDependencies = _context.sent;
88
+ packageChange = {
89
+ date: new Date(item.date).toISOString(),
90
+ deps: newDependencies
91
+ };
92
+ upgradeEvents = getUpgradeEventsFromPkgChange(dependencies, newDependencies, {
93
+ date: packageChange.date,
94
+ commitHash: item.hash
95
+ });
96
+ if (upgradeEvents.length > 0) {
97
+ allUpgradeEvents.push.apply(allUpgradeEvents, _toConsumableArray(upgradeEvents));
98
+ allPackageChanges.push(packageChange);
99
+ }
100
+ case 18:
101
+ i++;
102
+ _context.next = 9;
103
+ break;
104
+ case 21:
105
+ return _context.abrupt("return", {
106
+ allPackageChanges: allPackageChanges,
107
+ allUpgradeEvents: allUpgradeEvents
108
+ });
109
+ case 22:
110
+ case "end":
111
+ return _context.stop();
152
112
  }
153
- }, _callee2);
113
+ }, _callee);
154
114
  }));
155
115
  return function getEventsFromHistory(_x, _x2, _x3, _x4) {
156
116
  return _ref9.apply(this, arguments);
157
117
  };
158
118
  }();
159
- function getSinceRef(_x6) {
119
+ function getSinceRef(_x5) {
160
120
  return _getSinceRef.apply(this, arguments);
161
121
  }
162
122
  function _getSinceRef() {
163
- _getSinceRef = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(flags) {
123
+ _getSinceRef = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(flags) {
164
124
  var meta, tag, tagExists;
165
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
166
- while (1) {
167
- switch (_context3.prev = _context3.next) {
168
- case 0:
169
- if (!flags.statlas) {
170
- _context3.next = 9;
171
- break;
172
- }
173
- _context3.next = 3;
174
- return statlas.getMeta(flags.product);
175
- case 3:
176
- meta = _context3.sent;
177
- if (!(!meta || !meta.lastRunHash)) {
178
- _context3.next = 6;
179
- break;
180
- }
181
- throw new Error(chalk.red("Missing or invalid metadata file for ".concat(flags.product, ". Must use --reset for populating from start of history")));
182
- case 6:
183
- return _context3.abrupt("return", meta.lastRunHash);
184
- case 9:
185
- tag = flags.tag || DEFAULT_TAG;
186
- _context3.next = 12;
187
- return refetchTag(tag);
188
- case 12:
189
- _context3.next = 14;
190
- return doesTagExist(tag);
191
- case 14:
192
- tagExists = _context3.sent;
193
- if (tagExists) {
194
- _context3.next = 17;
195
- break;
196
- }
197
- throw new Error(chalk.red("Tag '".concat(tag, "' does not exist. Must use --reset for populating from start of history.")));
198
- case 17:
199
- return _context3.abrupt("return", tag);
200
- case 18:
201
- case "end":
202
- return _context3.stop();
203
- }
125
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
126
+ while (1) switch (_context2.prev = _context2.next) {
127
+ case 0:
128
+ if (!flags.statlas) {
129
+ _context2.next = 9;
130
+ break;
131
+ }
132
+ _context2.next = 3;
133
+ return statlas.getMeta(flags.product);
134
+ case 3:
135
+ meta = _context2.sent;
136
+ if (!(!meta || !meta.lastRunHash)) {
137
+ _context2.next = 6;
138
+ break;
139
+ }
140
+ throw new Error(chalk.red("Missing or invalid metadata file for ".concat(flags.product, ". Must use --reset for populating from start of history")));
141
+ case 6:
142
+ return _context2.abrupt("return", meta.lastRunHash);
143
+ case 9:
144
+ tag = flags.tag || DEFAULT_TAG;
145
+ _context2.next = 12;
146
+ return refetchTag(tag);
147
+ case 12:
148
+ _context2.next = 14;
149
+ return doesTagExist(tag);
150
+ case 14:
151
+ tagExists = _context2.sent;
152
+ if (tagExists) {
153
+ _context2.next = 17;
154
+ break;
155
+ }
156
+ throw new Error(chalk.red("Tag '".concat(tag, "' does not exist. Must use --reset for populating from start of history.")));
157
+ case 17:
158
+ return _context2.abrupt("return", tag);
159
+ case 18:
160
+ case "end":
161
+ return _context2.stop();
204
162
  }
205
- }, _callee3);
163
+ }, _callee2);
206
164
  }));
207
165
  return _getSinceRef.apply(this, arguments);
208
166
  }
209
- export default function populateProduct(_x7) {
167
+ export default function populateProduct(_x6) {
210
168
  return _populateProduct.apply(this, arguments);
211
169
  }
212
170
  function _populateProduct() {
213
- _populateProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(flags) {
171
+ _populateProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(flags) {
214
172
  var cwd, sinceRef, log, supportedScopes, _yield$getEventsFromH, allPackageChanges, allUpgradeEvents, csv, currentCommit;
215
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
216
- while (1) {
217
- switch (_context4.prev = _context4.next) {
218
- case 0:
219
- cwd = flags.cwd || process.cwd();
220
- if (!flags.reset) {
221
- _context4.next = 5;
222
- break;
223
- }
224
- _context4.t0 = undefined;
225
- _context4.next = 8;
173
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
174
+ while (1) switch (_context3.prev = _context3.next) {
175
+ case 0:
176
+ cwd = flags.cwd || process.cwd();
177
+ if (!flags.reset) {
178
+ _context3.next = 5;
179
+ break;
180
+ }
181
+ _context3.t0 = undefined;
182
+ _context3.next = 8;
183
+ break;
184
+ case 5:
185
+ _context3.next = 7;
186
+ return getSinceRef(flags);
187
+ case 7:
188
+ _context3.t0 = _context3.sent;
189
+ case 8:
190
+ sinceRef = _context3.t0;
191
+ _context3.next = 11;
192
+ return getChangesSince(sinceRef);
193
+ case 11:
194
+ log = _context3.sent;
195
+ supportedScopes = getSupportedScopes(flags.includeRestrictedScopes);
196
+ if (!(log.all.length === 0)) {
197
+ _context3.next = 16;
226
198
  break;
227
- case 5:
228
- _context4.next = 7;
229
- return getSinceRef(flags);
230
- case 7:
231
- _context4.t0 = _context4.sent;
232
- case 8:
233
- sinceRef = _context4.t0;
234
- _context4.next = 11;
235
- return getChangesSince(sinceRef);
236
- case 11:
237
- log = _context4.sent;
238
- supportedScopes = getSupportedScopes(flags.includeRestrictedScopes);
239
- if (!(log.all.length === 0)) {
240
- _context4.next = 16;
241
- break;
242
- }
243
- console.log("No package.json changes found since '".concat(sinceRef, "'."));
244
- return _context4.abrupt("return");
245
- case 16:
246
- _context4.next = 18;
247
- return getEventsFromHistory(log, sinceRef, {
248
- cwd: cwd
249
- }, supportedScopes);
250
- case 18:
251
- _yield$getEventsFromH = _context4.sent;
252
- allPackageChanges = _yield$getEventsFromH.allPackageChanges;
253
- allUpgradeEvents = _yield$getEventsFromH.allUpgradeEvents;
254
- if (!flags.csv) {
255
- _context4.next = 25;
256
- break;
257
- }
258
- csv = generateCSV(allPackageChanges);
259
- console.log(csv);
260
- return _context4.abrupt("return");
261
- case 25:
262
- if (!flags.dryRun) {
263
- _context4.next = 28;
264
- break;
265
- }
266
- console.log(JSON.stringify(allUpgradeEvents));
267
- return _context4.abrupt("return");
268
- case 28:
269
- if (!(allUpgradeEvents.length > 0)) {
270
- _context4.next = 33;
271
- break;
272
- }
273
- _context4.next = 31;
274
- return sendAnalytics(allUpgradeEvents, {
275
- dev: flags.dev,
276
- limit: flags.limit,
277
- product: flags.product,
278
- skipPrompt: !flags.interactive
279
- });
280
- case 31:
281
- _context4.next = 34;
199
+ }
200
+ console.log("No package.json changes found since '".concat(sinceRef, "'."));
201
+ return _context3.abrupt("return");
202
+ case 16:
203
+ _context3.next = 18;
204
+ return getEventsFromHistory(log, sinceRef, {
205
+ cwd: cwd
206
+ }, supportedScopes);
207
+ case 18:
208
+ _yield$getEventsFromH = _context3.sent;
209
+ allPackageChanges = _yield$getEventsFromH.allPackageChanges;
210
+ allUpgradeEvents = _yield$getEventsFromH.allUpgradeEvents;
211
+ if (!flags.csv) {
212
+ _context3.next = 25;
282
213
  break;
283
- case 33:
284
- console.log("Found no dependency changes from supported scopes ".concat(supportedScopes.join(', '), " since last run from ref \"").concat(sinceRef, "\"'"));
285
- case 34:
286
- if (!flags.statlas) {
287
- _context4.next = 43;
288
- break;
289
- }
290
- _context4.next = 37;
291
- return getHash('HEAD');
292
- case 37:
293
- currentCommit = _context4.sent;
294
- _context4.next = 40;
295
- return statlas.uploadMeta(flags.product, currentCommit);
296
- case 40:
297
- console.log('Finished');
298
- _context4.next = 47;
214
+ }
215
+ csv = generateCSV(allPackageChanges);
216
+ console.log(csv);
217
+ return _context3.abrupt("return");
218
+ case 25:
219
+ if (!flags.dryRun) {
220
+ _context3.next = 28;
299
221
  break;
300
- case 43:
301
- console.log('Updating tag to current commit...');
302
- _context4.next = 46;
303
- return tagCommit(DEFAULT_TAG);
304
- case 46:
305
- console.log("Finished. Run 'git push origin tag ".concat(sinceRef, "'."));
306
- case 47:
307
- case "end":
308
- return _context4.stop();
309
- }
222
+ }
223
+ console.log(JSON.stringify(allUpgradeEvents));
224
+ return _context3.abrupt("return");
225
+ case 28:
226
+ if (!(allUpgradeEvents.length > 0)) {
227
+ _context3.next = 33;
228
+ break;
229
+ }
230
+ _context3.next = 31;
231
+ return sendAnalytics(allUpgradeEvents, {
232
+ dev: flags.dev,
233
+ limit: flags.limit,
234
+ product: flags.product,
235
+ skipPrompt: !flags.interactive
236
+ });
237
+ case 31:
238
+ _context3.next = 34;
239
+ break;
240
+ case 33:
241
+ console.log("Found no dependency changes from supported scopes ".concat(supportedScopes.join(', '), " since last run from ref \"").concat(sinceRef, "\"'"));
242
+ case 34:
243
+ if (!flags.statlas) {
244
+ _context3.next = 43;
245
+ break;
246
+ }
247
+ _context3.next = 37;
248
+ return getHash('HEAD');
249
+ case 37:
250
+ currentCommit = _context3.sent;
251
+ _context3.next = 40;
252
+ return statlas.uploadMeta(flags.product, currentCommit);
253
+ case 40:
254
+ console.log('Finished');
255
+ _context3.next = 47;
256
+ break;
257
+ case 43:
258
+ console.log('Updating tag to current commit...');
259
+ _context3.next = 46;
260
+ return tagCommit(DEFAULT_TAG);
261
+ case 46:
262
+ console.log("Finished. Run 'git push origin tag ".concat(sinceRef, "'."));
263
+ case 47:
264
+ case "end":
265
+ return _context3.stop();
310
266
  }
311
- }, _callee4);
267
+ }, _callee3);
312
268
  }));
313
269
  return _populateProduct.apply(this, arguments);
314
270
  }