@teambit/snapping 1.0.383 → 1.0.384

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.
@@ -319,6 +319,20 @@ function _application() {
319
319
  };
320
320
  return data;
321
321
  }
322
+ function _legacy2() {
323
+ const data = require("@teambit/legacy.scope-api");
324
+ _legacy2 = function () {
325
+ return data;
326
+ };
327
+ return data;
328
+ }
329
+ function _lanesModules() {
330
+ const data = require("@teambit/lanes.modules.create-lane");
331
+ _lanesModules = function () {
332
+ return data;
333
+ };
334
+ return data;
335
+ }
322
336
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
323
337
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
324
338
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -551,7 +565,13 @@ if you're willing to lose the history from the head to the specified version, us
551
565
  const laneIdStr = params.lane;
552
566
  if (laneIdStr) {
553
567
  const laneId = _laneId().LaneId.parse(laneIdStr);
554
- lane = await this.importer.importLaneObject(laneId);
568
+ try {
569
+ lane = await this.importer.importLaneObject(laneId);
570
+ } catch (err) {
571
+ if (err.constructor.name !== _legacy2().LaneNotFound.name) throw err;
572
+ // if the lane is not found, it's probably because it's new. create a new lane.
573
+ lane = await (0, _lanesModules().createLaneInScope)(laneId.name, this.scope, laneId.scope);
574
+ }
555
575
  // this is critical. otherwise, later on, when loading aspects and isolating capsules, we'll try to fetch dists
556
576
  // from the original scope instead of the lane-scope.
557
577
  this.scope.legacyScope.setCurrentLaneId(laneId);