@nebula.js/stardust 4.3.0 → 4.4.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.
package/core/esm/dev.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v4.3.0
2
+ * @nebula.js/stardust v4.4.0
3
3
  * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -482,7 +482,7 @@ var runtime = {exports: {}};
482
482
  };
483
483
  };
484
484
  function values(iterable) {
485
- if (iterable) {
485
+ if (iterable || iterable === "") {
486
486
  var iteratorMethod = iterable[iteratorSymbol];
487
487
  if (iteratorMethod) {
488
488
  return iteratorMethod.call(iterable);
@@ -507,11 +507,7 @@ var runtime = {exports: {}};
507
507
  return next.next = next;
508
508
  }
509
509
  }
510
-
511
- // Return an iterator with no values.
512
- return {
513
- next: doneResult
514
- };
510
+ throw new TypeError(typeof iterable + " is not iterable");
515
511
  }
516
512
  exports.values = values;
517
513
  function doneResult() {
@@ -1555,26 +1551,6 @@ var ScreenReader_OneSelected = {
1555
1551
  "zh-TW": "有一個選取的值。"
1556
1552
  }
1557
1553
  };
1558
- var ScreenReader_SearchFieldLabel = {
1559
- id: "ScreenReader.SearchFieldLabel",
1560
- locale: {
1561
- "de-DE": "Suchfeld",
1562
- "en-US": "Search Field",
1563
- "es-ES": "Buscar campo",
1564
- "fr-FR": "Champ de recherche",
1565
- "it-IT": "Campo di ricerca",
1566
- "ja-JP": "検索フィールド",
1567
- "ko-KR": "검색 필드",
1568
- "nl-NL": "Zoekveld",
1569
- "pl-PL": "Pole wyszukiwania",
1570
- "pt-BR": "Campo de busca",
1571
- "ru-RU": "Поле поиска",
1572
- "sv-SE": "Sökfält",
1573
- "tr-TR": "Arama Alanı",
1574
- "zh-CN": "搜索字段",
1575
- "zh-TW": "搜尋欄位"
1576
- }
1577
- };
1578
1554
  var ScreenReader_ZeroSelected = {
1579
1555
  id: "ScreenReader.ZeroSelected",
1580
1556
  locale: {
@@ -1989,7 +1965,6 @@ var all = {
1989
1965
  ScreenReader_ManySelected: ScreenReader_ManySelected,
1990
1966
  ScreenReader_OneSearchResult: ScreenReader_OneSearchResult,
1991
1967
  ScreenReader_OneSelected: ScreenReader_OneSelected,
1992
- ScreenReader_SearchFieldLabel: ScreenReader_SearchFieldLabel,
1993
1968
  ScreenReader_ZeroSelected: ScreenReader_ZeroSelected,
1994
1969
  Selection_Cancel: Selection_Cancel,
1995
1970
  Selection_Clear: Selection_Clear,
@@ -4301,7 +4276,7 @@ function resolveProps(defaultProps, props) {
4301
4276
  function composeClasses(slots, getUtilityClass, classes = undefined) {
4302
4277
  const output = {};
4303
4278
  Object.keys(slots).forEach(
4304
- // `Objet.keys(slots)` can't be wider than `T` because we infer `T` from `slots`.
4279
+ // `Object.keys(slots)` can't be wider than `T` because we infer `T` from `slots`.
4305
4280
  // @ts-expect-error https://github.com/microsoft/TypeScript/pull/12253#issuecomment-263132208
4306
4281
  slot => {
4307
4282
  output[slot] = slots[slot].reduce((acc, key) => {
@@ -4570,7 +4545,7 @@ function hash (value, length) {
4570
4545
  * @param {string} value
4571
4546
  * @return {string}
4572
4547
  */
4573
- function trim (value) {
4548
+ function trim$1 (value) {
4574
4549
  return value.trim()
4575
4550
  }
4576
4551
 
@@ -4787,7 +4762,7 @@ function dealloc (value) {
4787
4762
  * @return {string}
4788
4763
  */
4789
4764
  function delimit (type) {
4790
- return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))
4765
+ return trim$1(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))
4791
4766
  }
4792
4767
 
4793
4768
  /**
@@ -4880,7 +4855,7 @@ function identifier (index) {
4880
4855
  * @return {object[]}
4881
4856
  */
4882
4857
  function compile (value) {
4883
- return dealloc(parse$7('', null, null, null, [''], value = alloc(value), 0, [0], value))
4858
+ return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))
4884
4859
  }
4885
4860
 
4886
4861
  /**
@@ -4895,7 +4870,7 @@ function compile (value) {
4895
4870
  * @param {string[]} declarations
4896
4871
  * @return {object}
4897
4872
  */
4898
- function parse$7 (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
4873
+ function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
4899
4874
  var index = 0;
4900
4875
  var offset = 0;
4901
4876
  var length = pseudo;
@@ -4964,15 +4939,15 @@ function parse$7 (value, root, parent, rule, rules, rulesets, pseudo, points, de
4964
4939
 
4965
4940
  if (character === 123)
4966
4941
  if (offset === 0)
4967
- parse$7(characters, root, reference, reference, props, rulesets, length, points, children);
4942
+ parse(characters, root, reference, reference, props, rulesets, length, points, children);
4968
4943
  else
4969
4944
  switch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {
4970
4945
  // d l m s
4971
4946
  case 100: case 108: case 109: case 115:
4972
- parse$7(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children);
4947
+ parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children);
4973
4948
  break
4974
4949
  default:
4975
- parse$7(characters, reference, reference, reference, [''], children, 0, points, children);
4950
+ parse(characters, reference, reference, reference, [''], children, 0, points, children);
4976
4951
  }
4977
4952
  }
4978
4953
 
@@ -5036,7 +5011,7 @@ function ruleset (value, root, parent, index, offset, rules, points, type, props
5036
5011
 
5037
5012
  for (var i = 0, j = 0, k = 0; i < index; ++i)
5038
5013
  for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
5039
- if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x])))
5014
+ if (z = trim$1(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x])))
5040
5015
  props[k++] = z;
5041
5016
 
5042
5017
  return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length)
@@ -6659,6 +6634,8 @@ function unstable_createStyleFunctionSx() {
6659
6634
  if (val == null) {
6660
6635
  return null;
6661
6636
  }
6637
+
6638
+ // TODO v6: remove, see https://github.com/mui/material-ui/pull/38123
6662
6639
  if (themeKey === 'typography' && val === 'inherit') {
6663
6640
  return {
6664
6641
  [prop]: val
@@ -6883,6 +6860,12 @@ function shouldForwardProp(prop) {
6883
6860
  return prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as';
6884
6861
  }
6885
6862
  const systemDefaultTheme = createTheme$1();
6863
+ const lowercaseFirstLetter = string => {
6864
+ if (!string) {
6865
+ return string;
6866
+ }
6867
+ return string.charAt(0).toLowerCase() + string.slice(1);
6868
+ };
6886
6869
  function resolveTheme({
6887
6870
  defaultTheme,
6888
6871
  theme,
@@ -6890,6 +6873,12 @@ function resolveTheme({
6890
6873
  }) {
6891
6874
  return isEmpty$1(theme) ? defaultTheme : theme[themeId] || theme;
6892
6875
  }
6876
+ function defaultOverridesResolver(slot) {
6877
+ if (!slot) {
6878
+ return null;
6879
+ }
6880
+ return (props, styles) => styles[slot];
6881
+ }
6893
6882
  function createStyled(input = {}) {
6894
6883
  const {
6895
6884
  themeId,
@@ -6914,16 +6903,24 @@ function createStyled(input = {}) {
6914
6903
  slot: componentSlot,
6915
6904
  skipVariantsResolver: inputSkipVariantsResolver,
6916
6905
  skipSx: inputSkipSx,
6917
- overridesResolver
6906
+ // TODO v6: remove `lowercaseFirstLetter()` in the next major release
6907
+ // For more details: https://github.com/mui/material-ui/pull/37908
6908
+ overridesResolver = defaultOverridesResolver(lowercaseFirstLetter(componentSlot))
6918
6909
  } = inputOptions,
6919
6910
  options = _objectWithoutPropertiesLoose(inputOptions, _excluded$c);
6920
6911
 
6921
6912
  // if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
6922
- const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver : componentSlot && componentSlot !== 'Root' || false;
6913
+ const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver :
6914
+ // TODO v6: remove `Root` in the next major release
6915
+ // For more details: https://github.com/mui/material-ui/pull/37908
6916
+ componentSlot && componentSlot !== 'Root' && componentSlot !== 'root' || false;
6923
6917
  const skipSx = inputSkipSx || false;
6924
6918
  let label;
6925
6919
  let shouldForwardPropOption = shouldForwardProp;
6926
- if (componentSlot === 'Root') {
6920
+
6921
+ // TODO v6: remove `Root` in the next major release
6922
+ // For more details: https://github.com/mui/material-ui/pull/37908
6923
+ if (componentSlot === 'Root' || componentSlot === 'root') {
6927
6924
  shouldForwardPropOption = rootShouldForwardProp;
6928
6925
  } else if (componentSlot) {
6929
6926
  // any other slot specified
@@ -7905,6 +7902,7 @@ function createTypography(palette, typography) {
7905
7902
  button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),
7906
7903
  caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),
7907
7904
  overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps),
7905
+ // TODO v6: Remove handling of 'inherit' variant from the theme as it is already handled in Material UI's Typography component. Also, remember to remove the associated types.
7908
7906
  inherit: {
7909
7907
  fontFamily: 'inherit',
7910
7908
  fontWeight: 'inherit',
@@ -8451,7 +8449,7 @@ function create$3(definition) {
8451
8449
  return cache[key];
8452
8450
  }
8453
8451
 
8454
- const NEBULA_VERSION_HASH = "c9e4" ;
8452
+ const NEBULA_VERSION_HASH = "9b4b" ;
8455
8453
  ClassNameGenerator$1.configure(componentName => {
8456
8454
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
8457
8455
  });
@@ -8712,7 +8710,7 @@ function boot(_ref2) {
8712
8710
  const appRef = React__default.createRef();
8713
8711
  const element = document.createElement('div');
8714
8712
  element.style.display = 'none';
8715
- element.setAttribute('data-nebulajs-version', "4.3.0" );
8713
+ element.setAttribute('data-nebulajs-version', "4.4.0" );
8716
8714
  element.setAttribute('data-app-id', app.id);
8717
8715
  document.body.appendChild(element);
8718
8716
  if (context) {
@@ -8877,6 +8875,9 @@ function useCurrentSelectionsModel(app) {
8877
8875
  return useSessionModel(definition, app);
8878
8876
  }
8879
8877
 
8878
+ const sleep = delay => new Promise(resolve => {
8879
+ setTimeout(resolve, delay);
8880
+ });
8880
8881
  const rpcReducer = (state, action) => {
8881
8882
  const {
8882
8883
  rpcResultStore,
@@ -8966,7 +8967,9 @@ function useRpc(model, method) {
8966
8967
  });
8967
8968
  }
8968
8969
  try {
8969
- // await sleep(5000);
8970
+ // To avoid possible race condition causing an infinite loop.
8971
+ // Problem has been observed for mocked models appeared after switching to react 18 (reactDOM render -> createRoot).
8972
+ await sleep(0);
8970
8973
  const result = await cache.rpc;
8971
8974
  dispatch({
8972
8975
  type: 'VALID',
@@ -10642,7 +10645,7 @@ const LOC_STATES = {
10642
10645
  };
10643
10646
  function getValueLabel(_ref) {
10644
10647
  let {
10645
- translator,
10648
+ translator: translatorDynamic,
10646
10649
  label,
10647
10650
  qState,
10648
10651
  isSelected,
@@ -10651,15 +10654,15 @@ function getValueLabel(_ref) {
10651
10654
  showSearch
10652
10655
  } = _ref;
10653
10656
  const stateTranslation = LOC_STATES[qState];
10654
- const state = translator.get(stateTranslation);
10657
+ const state = translatorDynamic.get(stateTranslation);
10655
10658
  const srStringArr = [];
10656
10659
  if (isSelected) {
10657
10660
  const navTranslation = showSearch ? 'Listbox.ScreenReader.SearchThenSelectionsMenu.WithAccSelMenu' : 'Listbox.ScreenReader.SelectionMenu.WithAccSelMenu';
10658
- const nav = translator.get(navTranslation);
10661
+ const nav = translatorDynamic.get(navTranslation);
10659
10662
  srStringArr.push(nav);
10660
10663
  }
10661
10664
  const valueString = "".concat(label, " ").concat(state);
10662
- const indexString = translator.get('CurrentSelections.Of', [currentIndex + 1, maxIndex + 1]); // E.g. 3 of 20
10665
+ const indexString = translatorDynamic.get('CurrentSelections.Of', [currentIndex + 1, maxIndex + 1]); // E.g. 3 of 20
10663
10666
  srStringArr.unshift(valueString, indexString);
10664
10667
  const srString = srStringArr.join('. ').trim();
10665
10668
  return srString;
@@ -10678,7 +10681,7 @@ function ScreenReaderForSelections(_ref2) {
10678
10681
  layout
10679
10682
  } = _ref2;
10680
10683
  const {
10681
- translator
10684
+ translator: translatorDynamic
10682
10685
  } = useContext(InstanceContext);
10683
10686
  const {
10684
10687
  qStateCounts: s = {}
@@ -10696,7 +10699,7 @@ function ScreenReaderForSelections(_ref2) {
10696
10699
  t = 'ScreenReader.ManySelected';
10697
10700
  break;
10698
10701
  }
10699
- const text = translator.get(t, [count]);
10702
+ const text = translatorDynamic.get(t, [count]);
10700
10703
  return /*#__PURE__*/React__default.createElement("div", {
10701
10704
  className: "screenReaderOnly",
10702
10705
  "aria-live": "assertive"
@@ -13366,17 +13369,17 @@ function ListBoxDisclaimer(_ref2) {
13366
13369
  tooltip
13367
13370
  } = _ref2;
13368
13371
  const {
13369
- translator
13372
+ translator: translatorDynamic
13370
13373
  } = useContext(InstanceContext);
13371
13374
  return /*#__PURE__*/React__default.createElement(Tooltip, {
13372
- title: tooltip ? translator.get(text) : ''
13375
+ title: tooltip ? translatorDynamic.get(text) : ''
13373
13376
  }, /*#__PURE__*/React__default.createElement(StyledText, {
13374
13377
  width: width,
13375
13378
  dense: dense,
13376
13379
  component: "div",
13377
13380
  variant: "body1",
13378
13381
  py: "12px"
13379
- }, translator.get(text)));
13382
+ }, translatorDynamic.get(text)));
13380
13383
  }
13381
13384
 
13382
13385
  var Close = {};
@@ -13802,7 +13805,7 @@ function ListBox(_ref) {
13802
13805
  isModal
13803
13806
  } = _ref;
13804
13807
  const {
13805
- translator
13808
+ translator: translatorDynamic
13806
13809
  } = useContext(InstanceContext);
13807
13810
  const [initScrollPosIsSet, setInitScrollPosIsSet] = useState$1(false);
13808
13811
  const isSingleSelect = !!(layout && layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne);
@@ -13973,7 +13976,7 @@ function ListBox(_ref) {
13973
13976
  useEffect$1(() => {
13974
13977
  if (inputText) {
13975
13978
  const srText = getScreenReaderSearchText(listCount);
13976
- const srFinalText = translator.get(srText, [listCount]);
13979
+ const srFinalText = translatorDynamic.get(srText, [listCount]);
13977
13980
  setScreenReaderText(srFinalText);
13978
13981
  }
13979
13982
  }, [inputText, listCount]);
@@ -14068,7 +14071,7 @@ function ListBox(_ref) {
14068
14071
  constraints,
14069
14072
  frequencyMax,
14070
14073
  freqIsAllowed,
14071
- translator,
14074
+ translator: translatorDynamic,
14072
14075
  showSearch,
14073
14076
  isModal
14074
14077
  });
@@ -14614,7 +14617,8 @@ function ActionsToolbar(_ref3) {
14614
14617
  focusHandler = null,
14615
14618
  actionsRefMock = null,
14616
14619
  // for testing
14617
- direction = 'ltr'
14620
+ direction = 'ltr',
14621
+ autoConfirm
14618
14622
  } = _ref3;
14619
14623
  const defaultSelectionActions = useDefaultSelectionActions(selections);
14620
14624
  const {
@@ -14660,6 +14664,16 @@ function ActionsToolbar(_ref3) {
14660
14664
  focusHandler.on('focus_toolbar_first', focusFirst);
14661
14665
  focusHandler.on('focus_toolbar_last', focusLast);
14662
14666
  }, []);
14667
+ if (autoConfirm) {
14668
+ const canConfirm = selections.show;
14669
+ if (canConfirm) {
14670
+ const confirm = defaultSelectionActions.find(o => o.key === 'confirm') || {
14671
+ action: () => {}
14672
+ };
14673
+ confirm.action();
14674
+ }
14675
+ return null;
14676
+ }
14663
14677
  let moreEnabled = more$1.enabled;
14664
14678
  let moreActions = more$1.actions;
14665
14679
  const moreAlignTo = more$1.alignTo || moreRef;
@@ -14972,7 +14986,7 @@ function ListBoxSearch(_ref3) {
14972
14986
  textAlign: "".concat(inpuTextAlign)
14973
14987
  },
14974
14988
  'data-testid': 'search-input-field',
14975
- 'aria-label': translator.get('ScreenReader.SearchFieldLabel')
14989
+ 'aria-label': translator.get('Listbox.Search.ScreenReaderInstructions')
14976
14990
  }
14977
14991
  });
14978
14992
  }
@@ -16994,9 +17008,11 @@ function getListboxActionProps(_ref) {
16994
17008
  isLocked,
16995
17009
  listboxSelectionToolbarItems,
16996
17010
  selections,
16997
- keyboard
17011
+ keyboard,
17012
+ autoConfirm
16998
17013
  } = _ref;
16999
17014
  return {
17015
+ autoConfirm,
17000
17016
  show: showToolbar && !isDetached,
17001
17017
  popover: {
17002
17018
  show: showToolbar && isDetached,
@@ -17038,9 +17054,9 @@ function ListBoxError(_ref) {
17038
17054
  text
17039
17055
  } = _ref;
17040
17056
  const {
17041
- translator
17057
+ translator: translatorDynamic
17042
17058
  } = useContext(InstanceContext);
17043
- return /*#__PURE__*/React__default.createElement(StyledDiv, null, translator.get(text));
17059
+ return /*#__PURE__*/React__default.createElement(StyledDiv, null, translatorDynamic.get(text));
17044
17060
  }
17045
17061
 
17046
17062
  function isDirectQueryEnabled(_ref) {
@@ -17264,6 +17280,7 @@ function ListBoxInline(_ref4) {
17264
17280
  const {
17265
17281
  wildCardSearch,
17266
17282
  searchEnabled,
17283
+ autoConfirm = false,
17267
17284
  layoutOptions = {}
17268
17285
  } = layout !== null && layout !== void 0 ? layout : {};
17269
17286
  const showSearchIcon = searchEnabled !== false && search === 'toggle';
@@ -17325,7 +17342,8 @@ function ListBoxInline(_ref4) {
17325
17342
  isLocked,
17326
17343
  listboxSelectionToolbarItems,
17327
17344
  selections,
17328
- keyboard
17345
+ keyboard,
17346
+ autoConfirm
17329
17347
  });
17330
17348
  const shouldAutoFocus = searchVisible && search === 'toggle';
17331
17349
 
@@ -17395,7 +17413,8 @@ function ListBoxInline(_ref4) {
17395
17413
  containerRef.current = el;
17396
17414
  containerRectRef(el);
17397
17415
  },
17398
- isGridMode: isGridMode
17416
+ isGridMode: isGridMode,
17417
+ "aria-label": keyboard.active ? translator.get('Listbox.ScreenReaderInstructions') : ''
17399
17418
  }, showToolbarWithTitle && /*#__PURE__*/React__default.createElement(Grid, {
17400
17419
  item: true,
17401
17420
  container: true,
@@ -17446,9 +17465,7 @@ function ListBoxInline(_ref4) {
17446
17465
  }, /*#__PURE__*/React__default.createElement(Grid, {
17447
17466
  item: true,
17448
17467
  ref: searchContainerRef
17449
- }, /*#__PURE__*/React__default.createElement("div", {
17450
- className: classes$4.screenReaderOnly
17451
- }, translator.get('Listbox.Search.ScreenReaderInstructions')), /*#__PURE__*/React__default.createElement(ListBoxSearch, {
17468
+ }, /*#__PURE__*/React__default.createElement(ListBoxSearch, {
17452
17469
  selections: selections,
17453
17470
  selectionState: selectionState$1,
17454
17471
  model: model,
@@ -17465,9 +17482,7 @@ function ListBoxInline(_ref4) {
17465
17482
  item: true,
17466
17483
  xs: true,
17467
17484
  className: classes$4.listboxWrapper
17468
- }, /*#__PURE__*/React__default.createElement("div", {
17469
- className: classes$4.screenReaderOnly
17470
- }, translator.get('Listbox.ScreenReaderInstructions')), isInvalid ? /*#__PURE__*/React__default.createElement(ListBoxError, {
17485
+ }, isInvalid ? /*#__PURE__*/React__default.createElement(ListBoxError, {
17471
17486
  text: errorText
17472
17487
  }) : /*#__PURE__*/React__default.createElement(AutoSizer, null, _ref5 => {
17473
17488
  let {
@@ -17657,6 +17672,12 @@ const listdef = {
17657
17672
  * @default
17658
17673
  */
17659
17674
  wildCardSearch: false,
17675
+ /**
17676
+ * Automatically confirm selections without showing the selections toolbar.
17677
+ * @type {boolean=}
17678
+ * @default
17679
+ */
17680
+ autoConfirm: false,
17660
17681
  /**
17661
17682
  * Layout settings.
17662
17683
  * @type {object=}
@@ -21608,14 +21629,14 @@ function emptyObject(obj) {
21608
21629
  * @param {Object} a The second object to compare
21609
21630
  * @returns {Boolean} Whether the objects are identical
21610
21631
  */
21611
- function compare$c(a, b) {
21632
+ function compare$7(a, b) {
21612
21633
  let isIdentical = true;
21613
21634
  if (isObject(a) && isObject(b)) {
21614
21635
  if (Object.keys(a).length !== Object.keys(b).length) {
21615
21636
  return false;
21616
21637
  }
21617
21638
  Object.keys(a).forEach(key => {
21618
- if (!compare$c(a[key], b[key])) {
21639
+ if (!compare$7(a[key], b[key])) {
21619
21640
  isIdentical = false;
21620
21641
  }
21621
21642
  });
@@ -21626,7 +21647,7 @@ function compare$c(a, b) {
21626
21647
  return false;
21627
21648
  }
21628
21649
  for (let i = 0, l = a.length; i < l; i += 1) {
21629
- if (!compare$c(a[i], b[i])) {
21650
+ if (!compare$7(a[i], b[i])) {
21630
21651
  return false;
21631
21652
  }
21632
21653
  }
@@ -21662,7 +21683,7 @@ function patchArray(original, newA, basePath) {
21662
21683
  }
21663
21684
  return -1;
21664
21685
  }
21665
- if (compare$c(newA, oldA)) {
21686
+ if (compare$7(newA, oldA)) {
21666
21687
  // array is unchanged
21667
21688
  return patches;
21668
21689
  }
@@ -21729,7 +21750,7 @@ JSONPatch.generate = function generate(original, newData, basePath) {
21729
21750
  const val = generateValue(newData[key]);
21730
21751
  const oldVal = original[key];
21731
21752
  const tmpPath = "".concat(basePath, "/").concat(key);
21732
- if (compare$c(val, oldVal) || isSpecialProperty(newData, key)) {
21753
+ if (compare$7(val, oldVal) || isSpecialProperty(newData, key)) {
21733
21754
  return;
21734
21755
  }
21735
21756
  if (isUndef(oldVal)) {
@@ -23722,1957 +23743,1292 @@ function generatorFn(UserSN, galaxy) {
23722
23743
  return generator;
23723
23744
  }
23724
23745
 
23725
- var re$2 = {exports: {}};
23746
+ var iterator;
23747
+ var hasRequiredIterator;
23726
23748
 
23727
- // Note: this is the semver.org version of the spec that it implements
23728
- // Not necessarily the package version of this code.
23729
- const SEMVER_SPEC_VERSION = '2.0.0';
23730
- const MAX_LENGTH$1 = 256;
23731
- const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */9007199254740991;
23749
+ function requireIterator () {
23750
+ if (hasRequiredIterator) return iterator;
23751
+ hasRequiredIterator = 1;
23752
+ iterator = function (Yallist) {
23753
+ Yallist.prototype[Symbol.iterator] = function* () {
23754
+ for (let walker = this.head; walker; walker = walker.next) {
23755
+ yield walker.value;
23756
+ }
23757
+ };
23758
+ };
23759
+ return iterator;
23760
+ }
23732
23761
 
23733
- // Max safe segment length for coercion.
23734
- const MAX_SAFE_COMPONENT_LENGTH = 16;
23762
+ var yallist = Yallist$1;
23735
23763
 
23736
- // Max safe length for a build identifier. The max length minus 6 characters for
23737
- // the shortest version with a build 0.0.0+BUILD.
23738
- const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
23739
- const RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];
23740
- var constants$1 = {
23741
- MAX_LENGTH: MAX_LENGTH$1,
23742
- MAX_SAFE_COMPONENT_LENGTH,
23743
- MAX_SAFE_BUILD_LENGTH,
23744
- MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
23745
- RELEASE_TYPES,
23746
- SEMVER_SPEC_VERSION,
23747
- FLAG_INCLUDE_PRERELEASE: 0b001,
23748
- FLAG_LOOSE: 0b010
23749
- };
23764
+ Yallist$1.Node = Node;
23765
+ Yallist$1.create = Yallist$1;
23750
23766
 
23751
- const debug$1 = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? function () {
23752
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
23753
- args[_key] = arguments[_key];
23767
+ function Yallist$1 (list) {
23768
+ var self = this;
23769
+ if (!(self instanceof Yallist$1)) {
23770
+ self = new Yallist$1();
23754
23771
  }
23755
- return console.error('SEMVER', ...args);
23756
- } : () => {};
23757
- var debug_1 = debug$1;
23758
-
23759
- (function (module, exports) {
23760
- const {
23761
- MAX_SAFE_COMPONENT_LENGTH,
23762
- MAX_SAFE_BUILD_LENGTH,
23763
- MAX_LENGTH
23764
- } = constants$1;
23765
- const debug = debug_1;
23766
- exports = module.exports = {};
23767
23772
 
23768
- // The actual regexps go on exports.re
23769
- const re = exports.re = [];
23770
- const safeRe = exports.safeRe = [];
23771
- const src = exports.src = [];
23772
- const t = exports.t = {};
23773
- let R = 0;
23774
- const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
23773
+ self.tail = null;
23774
+ self.head = null;
23775
+ self.length = 0;
23775
23776
 
23776
- // Replace some greedy regex tokens to prevent regex dos issues. These regex are
23777
- // used internally via the safeRe object since all inputs in this library get
23778
- // normalized first to trim and collapse all extra whitespace. The original
23779
- // regexes are exported for userland consumption and lower level usage. A
23780
- // future breaking change could export the safer regex only with a note that
23781
- // all input should have extra whitespace removed.
23782
- const safeRegexReplacements = [['\\s', 1], ['\\d', MAX_LENGTH], [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]];
23783
- const makeSafeRegex = value => {
23784
- for (const [token, max] of safeRegexReplacements) {
23785
- value = value.split("".concat(token, "*")).join("".concat(token, "{0,").concat(max, "}")).split("".concat(token, "+")).join("".concat(token, "{1,").concat(max, "}"));
23777
+ if (list && typeof list.forEach === 'function') {
23778
+ list.forEach(function (item) {
23779
+ self.push(item);
23780
+ });
23781
+ } else if (arguments.length > 0) {
23782
+ for (var i = 0, l = arguments.length; i < l; i++) {
23783
+ self.push(arguments[i]);
23786
23784
  }
23787
- return value;
23788
- };
23789
- const createToken = (name, value, isGlobal) => {
23790
- const safe = makeSafeRegex(value);
23791
- const index = R++;
23792
- debug(name, index, value);
23793
- t[name] = index;
23794
- src[index] = value;
23795
- re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
23796
- safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
23797
- };
23798
-
23799
- // The following Regular Expressions can be used for tokenizing,
23800
- // validating, and parsing SemVer version strings.
23785
+ }
23801
23786
 
23802
- // ## Numeric Identifier
23803
- // A single `0`, or a non-zero digit followed by zero or more digits.
23787
+ return self
23788
+ }
23804
23789
 
23805
- createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
23806
- createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
23790
+ Yallist$1.prototype.removeNode = function (node) {
23791
+ if (node.list !== this) {
23792
+ throw new Error('removing node which does not belong to this list')
23793
+ }
23807
23794
 
23808
- // ## Non-numeric Identifier
23809
- // Zero or more digits, followed by a letter or hyphen, and then zero or
23810
- // more letters, digits, or hyphens.
23795
+ var next = node.next;
23796
+ var prev = node.prev;
23811
23797
 
23812
- createToken('NONNUMERICIDENTIFIER', "\\d*[a-zA-Z-]".concat(LETTERDASHNUMBER, "*"));
23798
+ if (next) {
23799
+ next.prev = prev;
23800
+ }
23813
23801
 
23814
- // ## Main Version
23815
- // Three dot-separated numeric identifiers.
23802
+ if (prev) {
23803
+ prev.next = next;
23804
+ }
23816
23805
 
23817
- createToken('MAINVERSION', "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")"));
23818
- createToken('MAINVERSIONLOOSE', "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")"));
23806
+ if (node === this.head) {
23807
+ this.head = next;
23808
+ }
23809
+ if (node === this.tail) {
23810
+ this.tail = prev;
23811
+ }
23819
23812
 
23820
- // ## Pre-release Version Identifier
23821
- // A numeric identifier, or a non-numeric identifier.
23813
+ node.list.length--;
23814
+ node.next = null;
23815
+ node.prev = null;
23816
+ node.list = null;
23822
23817
 
23823
- createToken('PRERELEASEIDENTIFIER', "(?:".concat(src[t.NUMERICIDENTIFIER], "|").concat(src[t.NONNUMERICIDENTIFIER], ")"));
23824
- createToken('PRERELEASEIDENTIFIERLOOSE', "(?:".concat(src[t.NUMERICIDENTIFIERLOOSE], "|").concat(src[t.NONNUMERICIDENTIFIER], ")"));
23818
+ return next
23819
+ };
23825
23820
 
23826
- // ## Pre-release Version
23827
- // Hyphen, followed by one or more dot-separated pre-release version
23828
- // identifiers.
23821
+ Yallist$1.prototype.unshiftNode = function (node) {
23822
+ if (node === this.head) {
23823
+ return
23824
+ }
23829
23825
 
23830
- createToken('PRERELEASE', "(?:-(".concat(src[t.PRERELEASEIDENTIFIER], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIER], ")*))"));
23831
- createToken('PRERELEASELOOSE', "(?:-?(".concat(src[t.PRERELEASEIDENTIFIERLOOSE], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIERLOOSE], ")*))"));
23826
+ if (node.list) {
23827
+ node.list.removeNode(node);
23828
+ }
23832
23829
 
23833
- // ## Build Metadata Identifier
23834
- // Any combination of digits, letters, or hyphens.
23830
+ var head = this.head;
23831
+ node.list = this;
23832
+ node.next = head;
23833
+ if (head) {
23834
+ head.prev = node;
23835
+ }
23835
23836
 
23836
- createToken('BUILDIDENTIFIER', "".concat(LETTERDASHNUMBER, "+"));
23837
+ this.head = node;
23838
+ if (!this.tail) {
23839
+ this.tail = node;
23840
+ }
23841
+ this.length++;
23842
+ };
23837
23843
 
23838
- // ## Build Metadata
23839
- // Plus sign, followed by one or more period-separated build metadata
23840
- // identifiers.
23844
+ Yallist$1.prototype.pushNode = function (node) {
23845
+ if (node === this.tail) {
23846
+ return
23847
+ }
23841
23848
 
23842
- createToken('BUILD', "(?:\\+(".concat(src[t.BUILDIDENTIFIER], "(?:\\.").concat(src[t.BUILDIDENTIFIER], ")*))"));
23849
+ if (node.list) {
23850
+ node.list.removeNode(node);
23851
+ }
23843
23852
 
23844
- // ## Full Version String
23845
- // A main version, followed optionally by a pre-release version and
23846
- // build metadata.
23853
+ var tail = this.tail;
23854
+ node.list = this;
23855
+ node.prev = tail;
23856
+ if (tail) {
23857
+ tail.next = node;
23858
+ }
23847
23859
 
23848
- // Note that the only major, minor, patch, and pre-release sections of
23849
- // the version string are capturing groups. The build metadata is not a
23850
- // capturing group, because it should not ever be used in version
23851
- // comparison.
23860
+ this.tail = node;
23861
+ if (!this.head) {
23862
+ this.head = node;
23863
+ }
23864
+ this.length++;
23865
+ };
23852
23866
 
23853
- createToken('FULLPLAIN', "v?".concat(src[t.MAINVERSION]).concat(src[t.PRERELEASE], "?").concat(src[t.BUILD], "?"));
23854
- createToken('FULL', "^".concat(src[t.FULLPLAIN], "$"));
23867
+ Yallist$1.prototype.push = function () {
23868
+ for (var i = 0, l = arguments.length; i < l; i++) {
23869
+ push(this, arguments[i]);
23870
+ }
23871
+ return this.length
23872
+ };
23855
23873
 
23856
- // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
23857
- // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
23858
- // common in the npm registry.
23859
- createToken('LOOSEPLAIN', "[v=\\s]*".concat(src[t.MAINVERSIONLOOSE]).concat(src[t.PRERELEASELOOSE], "?").concat(src[t.BUILD], "?"));
23860
- createToken('LOOSE', "^".concat(src[t.LOOSEPLAIN], "$"));
23861
- createToken('GTLT', '((?:<|>)?=?)');
23874
+ Yallist$1.prototype.unshift = function () {
23875
+ for (var i = 0, l = arguments.length; i < l; i++) {
23876
+ unshift(this, arguments[i]);
23877
+ }
23878
+ return this.length
23879
+ };
23862
23880
 
23863
- // Something like "2.*" or "1.2.x".
23864
- // Note that "x.x" is a valid xRange identifer, meaning "any version"
23865
- // Only the first item is strictly required.
23866
- createToken('XRANGEIDENTIFIERLOOSE', "".concat(src[t.NUMERICIDENTIFIERLOOSE], "|x|X|\\*"));
23867
- createToken('XRANGEIDENTIFIER', "".concat(src[t.NUMERICIDENTIFIER], "|x|X|\\*"));
23868
- createToken('XRANGEPLAIN', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:".concat(src[t.PRERELEASE], ")?").concat(src[t.BUILD], "?") + ")?)?");
23869
- createToken('XRANGEPLAINLOOSE', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:".concat(src[t.PRERELEASELOOSE], ")?").concat(src[t.BUILD], "?") + ")?)?");
23870
- createToken('XRANGE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAIN], "$"));
23871
- createToken('XRANGELOOSE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAINLOOSE], "$"));
23881
+ Yallist$1.prototype.pop = function () {
23882
+ if (!this.tail) {
23883
+ return undefined
23884
+ }
23872
23885
 
23873
- // Coercion.
23874
- // Extract anything that could conceivably be a part of a valid semver
23875
- createToken('COERCE', "".concat('(^|[^\\d])' + '(\\d{1,').concat(MAX_SAFE_COMPONENT_LENGTH, "})") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?") + "(?:$|[^\\d])");
23876
- createToken('COERCERTL', src[t.COERCE], true);
23886
+ var res = this.tail.value;
23887
+ this.tail = this.tail.prev;
23888
+ if (this.tail) {
23889
+ this.tail.next = null;
23890
+ } else {
23891
+ this.head = null;
23892
+ }
23893
+ this.length--;
23894
+ return res
23895
+ };
23877
23896
 
23878
- // Tilde ranges.
23879
- // Meaning is "reasonably at or greater than"
23880
- createToken('LONETILDE', '(?:~>?)');
23881
- createToken('TILDETRIM', "(\\s*)".concat(src[t.LONETILDE], "\\s+"), true);
23882
- exports.tildeTrimReplace = '$1~';
23883
- createToken('TILDE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAIN], "$"));
23884
- createToken('TILDELOOSE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAINLOOSE], "$"));
23897
+ Yallist$1.prototype.shift = function () {
23898
+ if (!this.head) {
23899
+ return undefined
23900
+ }
23885
23901
 
23886
- // Caret ranges.
23887
- // Meaning is "at least and backwards compatible with"
23888
- createToken('LONECARET', '(?:\\^)');
23889
- createToken('CARETTRIM', "(\\s*)".concat(src[t.LONECARET], "\\s+"), true);
23890
- exports.caretTrimReplace = '$1^';
23891
- createToken('CARET', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAIN], "$"));
23892
- createToken('CARETLOOSE', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAINLOOSE], "$"));
23902
+ var res = this.head.value;
23903
+ this.head = this.head.next;
23904
+ if (this.head) {
23905
+ this.head.prev = null;
23906
+ } else {
23907
+ this.tail = null;
23908
+ }
23909
+ this.length--;
23910
+ return res
23911
+ };
23893
23912
 
23894
- // A simple gt/lt/eq thing, or just "" to indicate "any version"
23895
- createToken('COMPARATORLOOSE', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], ")$|^$"));
23896
- createToken('COMPARATOR', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.FULLPLAIN], ")$|^$"));
23913
+ Yallist$1.prototype.forEach = function (fn, thisp) {
23914
+ thisp = thisp || this;
23915
+ for (var walker = this.head, i = 0; walker !== null; i++) {
23916
+ fn.call(thisp, walker.value, i, this);
23917
+ walker = walker.next;
23918
+ }
23919
+ };
23897
23920
 
23898
- // An expression to strip any whitespace between the gtlt and the thing
23899
- // it modifies, so that `> 1.2.3` ==> `>1.2.3`
23900
- createToken('COMPARATORTRIM', "(\\s*)".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], "|").concat(src[t.XRANGEPLAIN], ")"), true);
23901
- exports.comparatorTrimReplace = '$1$2$3';
23921
+ Yallist$1.prototype.forEachReverse = function (fn, thisp) {
23922
+ thisp = thisp || this;
23923
+ for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
23924
+ fn.call(thisp, walker.value, i, this);
23925
+ walker = walker.prev;
23926
+ }
23927
+ };
23902
23928
 
23903
- // Something like `1.2.3 - 1.2.4`
23904
- // Note that these all use the loose form, because they'll be
23905
- // checked against either the strict or loose comparator form
23906
- // later.
23907
- createToken('HYPHENRANGE', "^\\s*(".concat(src[t.XRANGEPLAIN], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAIN], ")") + "\\s*$");
23908
- createToken('HYPHENRANGELOOSE', "^\\s*(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s*$");
23929
+ Yallist$1.prototype.get = function (n) {
23930
+ for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
23931
+ // abort out of the list early if we hit a cycle
23932
+ walker = walker.next;
23933
+ }
23934
+ if (i === n && walker !== null) {
23935
+ return walker.value
23936
+ }
23937
+ };
23909
23938
 
23910
- // Star ranges basically just allow anything at all.
23911
- createToken('STAR', '(<|>)?=?\\s*\\*');
23912
- // >=0.0.0 is like a star
23913
- createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
23914
- createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
23915
- })(re$2, re$2.exports);
23916
- var reExports = re$2.exports;
23939
+ Yallist$1.prototype.getReverse = function (n) {
23940
+ for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
23941
+ // abort out of the list early if we hit a cycle
23942
+ walker = walker.prev;
23943
+ }
23944
+ if (i === n && walker !== null) {
23945
+ return walker.value
23946
+ }
23947
+ };
23917
23948
 
23918
- // parse out just the options we care about
23919
- const looseOption = Object.freeze({
23920
- loose: true
23921
- });
23922
- const emptyOpts = Object.freeze({});
23923
- const parseOptions$1 = options => {
23924
- if (!options) {
23925
- return emptyOpts;
23949
+ Yallist$1.prototype.map = function (fn, thisp) {
23950
+ thisp = thisp || this;
23951
+ var res = new Yallist$1();
23952
+ for (var walker = this.head; walker !== null;) {
23953
+ res.push(fn.call(thisp, walker.value, this));
23954
+ walker = walker.next;
23926
23955
  }
23927
- if (typeof options !== 'object') {
23928
- return looseOption;
23956
+ return res
23957
+ };
23958
+
23959
+ Yallist$1.prototype.mapReverse = function (fn, thisp) {
23960
+ thisp = thisp || this;
23961
+ var res = new Yallist$1();
23962
+ for (var walker = this.tail; walker !== null;) {
23963
+ res.push(fn.call(thisp, walker.value, this));
23964
+ walker = walker.prev;
23929
23965
  }
23930
- return options;
23966
+ return res
23931
23967
  };
23932
- var parseOptions_1 = parseOptions$1;
23933
23968
 
23934
- const numeric = /^[0-9]+$/;
23935
- const compareIdentifiers$1 = (a, b) => {
23936
- const anum = numeric.test(a);
23937
- const bnum = numeric.test(b);
23938
- if (anum && bnum) {
23939
- a = +a;
23940
- b = +b;
23969
+ Yallist$1.prototype.reduce = function (fn, initial) {
23970
+ var acc;
23971
+ var walker = this.head;
23972
+ if (arguments.length > 1) {
23973
+ acc = initial;
23974
+ } else if (this.head) {
23975
+ walker = this.head.next;
23976
+ acc = this.head.value;
23977
+ } else {
23978
+ throw new TypeError('Reduce of empty list with no initial value')
23941
23979
  }
23942
- return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
23980
+
23981
+ for (var i = 0; walker !== null; i++) {
23982
+ acc = fn(acc, walker.value, i);
23983
+ walker = walker.next;
23984
+ }
23985
+
23986
+ return acc
23943
23987
  };
23944
- const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
23945
- var identifiers$1 = {
23946
- compareIdentifiers: compareIdentifiers$1,
23947
- rcompareIdentifiers
23988
+
23989
+ Yallist$1.prototype.reduceReverse = function (fn, initial) {
23990
+ var acc;
23991
+ var walker = this.tail;
23992
+ if (arguments.length > 1) {
23993
+ acc = initial;
23994
+ } else if (this.tail) {
23995
+ walker = this.tail.prev;
23996
+ acc = this.tail.value;
23997
+ } else {
23998
+ throw new TypeError('Reduce of empty list with no initial value')
23999
+ }
24000
+
24001
+ for (var i = this.length - 1; walker !== null; i--) {
24002
+ acc = fn(acc, walker.value, i);
24003
+ walker = walker.prev;
24004
+ }
24005
+
24006
+ return acc
23948
24007
  };
23949
24008
 
23950
- const debug = debug_1;
23951
- const {
23952
- MAX_LENGTH,
23953
- MAX_SAFE_INTEGER
23954
- } = constants$1;
23955
- const {
23956
- safeRe: re$1,
23957
- t: t$1
23958
- } = reExports;
23959
- const parseOptions = parseOptions_1;
23960
- const {
23961
- compareIdentifiers
23962
- } = identifiers$1;
23963
- let SemVer$d = class SemVer {
23964
- constructor(version, options) {
23965
- options = parseOptions(options);
23966
- if (version instanceof SemVer) {
23967
- if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
23968
- return version;
23969
- } else {
23970
- version = version.version;
23971
- }
23972
- } else if (typeof version !== 'string') {
23973
- throw new TypeError("Invalid version. Must be a string. Got type \"".concat(typeof version, "\"."));
23974
- }
23975
- if (version.length > MAX_LENGTH) {
23976
- throw new TypeError("version is longer than ".concat(MAX_LENGTH, " characters"));
23977
- }
23978
- debug('SemVer', version, options);
23979
- this.options = options;
23980
- this.loose = !!options.loose;
23981
- // this isn't actually relevant for versions, but keep it so that we
23982
- // don't run into trouble passing this.options around.
23983
- this.includePrerelease = !!options.includePrerelease;
23984
- const m = version.trim().match(options.loose ? re$1[t$1.LOOSE] : re$1[t$1.FULL]);
23985
- if (!m) {
23986
- throw new TypeError("Invalid Version: ".concat(version));
23987
- }
23988
- this.raw = version;
24009
+ Yallist$1.prototype.toArray = function () {
24010
+ var arr = new Array(this.length);
24011
+ for (var i = 0, walker = this.head; walker !== null; i++) {
24012
+ arr[i] = walker.value;
24013
+ walker = walker.next;
24014
+ }
24015
+ return arr
24016
+ };
23989
24017
 
23990
- // these are actually numbers
23991
- this.major = +m[1];
23992
- this.minor = +m[2];
23993
- this.patch = +m[3];
23994
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
23995
- throw new TypeError('Invalid major version');
23996
- }
23997
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
23998
- throw new TypeError('Invalid minor version');
23999
- }
24000
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
24001
- throw new TypeError('Invalid patch version');
24002
- }
24018
+ Yallist$1.prototype.toArrayReverse = function () {
24019
+ var arr = new Array(this.length);
24020
+ for (var i = 0, walker = this.tail; walker !== null; i++) {
24021
+ arr[i] = walker.value;
24022
+ walker = walker.prev;
24023
+ }
24024
+ return arr
24025
+ };
24003
24026
 
24004
- // numberify any prerelease numeric ids
24005
- if (!m[4]) {
24006
- this.prerelease = [];
24007
- } else {
24008
- this.prerelease = m[4].split('.').map(id => {
24009
- if (/^[0-9]+$/.test(id)) {
24010
- const num = +id;
24011
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
24012
- return num;
24013
- }
24014
- }
24015
- return id;
24027
+ Yallist$1.prototype.slice = function (from, to) {
24028
+ to = to || this.length;
24029
+ if (to < 0) {
24030
+ to += this.length;
24031
+ }
24032
+ from = from || 0;
24033
+ if (from < 0) {
24034
+ from += this.length;
24035
+ }
24036
+ var ret = new Yallist$1();
24037
+ if (to < from || to < 0) {
24038
+ return ret
24039
+ }
24040
+ if (from < 0) {
24041
+ from = 0;
24042
+ }
24043
+ if (to > this.length) {
24044
+ to = this.length;
24045
+ }
24046
+ for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
24047
+ walker = walker.next;
24048
+ }
24049
+ for (; walker !== null && i < to; i++, walker = walker.next) {
24050
+ ret.push(walker.value);
24051
+ }
24052
+ return ret
24053
+ };
24054
+
24055
+ Yallist$1.prototype.sliceReverse = function (from, to) {
24056
+ to = to || this.length;
24057
+ if (to < 0) {
24058
+ to += this.length;
24059
+ }
24060
+ from = from || 0;
24061
+ if (from < 0) {
24062
+ from += this.length;
24063
+ }
24064
+ var ret = new Yallist$1();
24065
+ if (to < from || to < 0) {
24066
+ return ret
24067
+ }
24068
+ if (from < 0) {
24069
+ from = 0;
24070
+ }
24071
+ if (to > this.length) {
24072
+ to = this.length;
24073
+ }
24074
+ for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
24075
+ walker = walker.prev;
24076
+ }
24077
+ for (; walker !== null && i > from; i--, walker = walker.prev) {
24078
+ ret.push(walker.value);
24079
+ }
24080
+ return ret
24081
+ };
24082
+
24083
+ Yallist$1.prototype.splice = function (start, deleteCount, ...nodes) {
24084
+ if (start > this.length) {
24085
+ start = this.length - 1;
24086
+ }
24087
+ if (start < 0) {
24088
+ start = this.length + start;
24089
+ }
24090
+
24091
+ for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
24092
+ walker = walker.next;
24093
+ }
24094
+
24095
+ var ret = [];
24096
+ for (var i = 0; walker && i < deleteCount; i++) {
24097
+ ret.push(walker.value);
24098
+ walker = this.removeNode(walker);
24099
+ }
24100
+ if (walker === null) {
24101
+ walker = this.tail;
24102
+ }
24103
+
24104
+ if (walker !== this.head && walker !== this.tail) {
24105
+ walker = walker.prev;
24106
+ }
24107
+
24108
+ for (var i = 0; i < nodes.length; i++) {
24109
+ walker = insert(this, walker, nodes[i]);
24110
+ }
24111
+ return ret;
24112
+ };
24113
+
24114
+ Yallist$1.prototype.reverse = function () {
24115
+ var head = this.head;
24116
+ var tail = this.tail;
24117
+ for (var walker = head; walker !== null; walker = walker.prev) {
24118
+ var p = walker.prev;
24119
+ walker.prev = walker.next;
24120
+ walker.next = p;
24121
+ }
24122
+ this.head = tail;
24123
+ this.tail = head;
24124
+ return this
24125
+ };
24126
+
24127
+ function insert (self, node, value) {
24128
+ var inserted = node === self.head ?
24129
+ new Node(value, null, node, self) :
24130
+ new Node(value, node, node.next, self);
24131
+
24132
+ if (inserted.next === null) {
24133
+ self.tail = inserted;
24134
+ }
24135
+ if (inserted.prev === null) {
24136
+ self.head = inserted;
24137
+ }
24138
+
24139
+ self.length++;
24140
+
24141
+ return inserted
24142
+ }
24143
+
24144
+ function push (self, item) {
24145
+ self.tail = new Node(item, self.tail, null, self);
24146
+ if (!self.head) {
24147
+ self.head = self.tail;
24148
+ }
24149
+ self.length++;
24150
+ }
24151
+
24152
+ function unshift (self, item) {
24153
+ self.head = new Node(item, null, self.head, self);
24154
+ if (!self.tail) {
24155
+ self.tail = self.head;
24156
+ }
24157
+ self.length++;
24158
+ }
24159
+
24160
+ function Node (value, prev, next, list) {
24161
+ if (!(this instanceof Node)) {
24162
+ return new Node(value, prev, next, list)
24163
+ }
24164
+
24165
+ this.list = list;
24166
+ this.value = value;
24167
+
24168
+ if (prev) {
24169
+ prev.next = this;
24170
+ this.prev = prev;
24171
+ } else {
24172
+ this.prev = null;
24173
+ }
24174
+
24175
+ if (next) {
24176
+ next.prev = this;
24177
+ this.next = next;
24178
+ } else {
24179
+ this.next = null;
24180
+ }
24181
+ }
24182
+
24183
+ try {
24184
+ // add if support for Symbol.iterator is present
24185
+ requireIterator()(Yallist$1);
24186
+ } catch (er) {}
24187
+
24188
+ // A linked list to keep track of recently-used-ness
24189
+ const Yallist = yallist;
24190
+ const MAX = Symbol('max');
24191
+ const LENGTH = Symbol('length');
24192
+ const LENGTH_CALCULATOR = Symbol('lengthCalculator');
24193
+ const ALLOW_STALE = Symbol('allowStale');
24194
+ const MAX_AGE = Symbol('maxAge');
24195
+ const DISPOSE = Symbol('dispose');
24196
+ const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
24197
+ const LRU_LIST = Symbol('lruList');
24198
+ const CACHE = Symbol('cache');
24199
+ const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
24200
+ const naiveLength = () => 1;
24201
+
24202
+ // lruList is a yallist where the head is the youngest
24203
+ // item, and the tail is the oldest. the list contains the Hit
24204
+ // objects as the entries.
24205
+ // Each Hit object has a reference to its Yallist.Node. This
24206
+ // never changes.
24207
+ //
24208
+ // cache is a Map (or PseudoMap) that matches the keys to
24209
+ // the Yallist.Node object.
24210
+ class LRUCache {
24211
+ constructor(options) {
24212
+ if (typeof options === 'number') options = {
24213
+ max: options
24214
+ };
24215
+ if (!options) options = {};
24216
+ if (options.max && (typeof options.max !== 'number' || options.max < 0)) throw new TypeError('max must be a non-negative number');
24217
+ // Kind of weird to have a default max of Infinity, but oh well.
24218
+ this[MAX] = options.max || Infinity;
24219
+ const lc = options.length || naiveLength;
24220
+ this[LENGTH_CALCULATOR] = typeof lc !== 'function' ? naiveLength : lc;
24221
+ this[ALLOW_STALE] = options.stale || false;
24222
+ if (options.maxAge && typeof options.maxAge !== 'number') throw new TypeError('maxAge must be a number');
24223
+ this[MAX_AGE] = options.maxAge || 0;
24224
+ this[DISPOSE] = options.dispose;
24225
+ this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
24226
+ this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
24227
+ this.reset();
24228
+ }
24229
+
24230
+ // resize the cache when the max changes.
24231
+ set max(mL) {
24232
+ if (typeof mL !== 'number' || mL < 0) throw new TypeError('max must be a non-negative number');
24233
+ this[MAX] = mL || Infinity;
24234
+ trim(this);
24235
+ }
24236
+ get max() {
24237
+ return this[MAX];
24238
+ }
24239
+ set allowStale(allowStale) {
24240
+ this[ALLOW_STALE] = !!allowStale;
24241
+ }
24242
+ get allowStale() {
24243
+ return this[ALLOW_STALE];
24244
+ }
24245
+ set maxAge(mA) {
24246
+ if (typeof mA !== 'number') throw new TypeError('maxAge must be a non-negative number');
24247
+ this[MAX_AGE] = mA;
24248
+ trim(this);
24249
+ }
24250
+ get maxAge() {
24251
+ return this[MAX_AGE];
24252
+ }
24253
+
24254
+ // resize the cache when the lengthCalculator changes.
24255
+ set lengthCalculator(lC) {
24256
+ if (typeof lC !== 'function') lC = naiveLength;
24257
+ if (lC !== this[LENGTH_CALCULATOR]) {
24258
+ this[LENGTH_CALCULATOR] = lC;
24259
+ this[LENGTH] = 0;
24260
+ this[LRU_LIST].forEach(hit => {
24261
+ hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
24262
+ this[LENGTH] += hit.length;
24016
24263
  });
24017
24264
  }
24018
- this.build = m[5] ? m[5].split('.') : [];
24019
- this.format();
24265
+ trim(this);
24020
24266
  }
24021
- format() {
24022
- this.version = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch);
24023
- if (this.prerelease.length) {
24024
- this.version += "-".concat(this.prerelease.join('.'));
24025
- }
24026
- return this.version;
24267
+ get lengthCalculator() {
24268
+ return this[LENGTH_CALCULATOR];
24027
24269
  }
24028
- toString() {
24029
- return this.version;
24270
+ get length() {
24271
+ return this[LENGTH];
24030
24272
  }
24031
- compare(other) {
24032
- debug('SemVer.compare', this.version, this.options, other);
24033
- if (!(other instanceof SemVer)) {
24034
- if (typeof other === 'string' && other === this.version) {
24035
- return 0;
24036
- }
24037
- other = new SemVer(other, this.options);
24273
+ get itemCount() {
24274
+ return this[LRU_LIST].length;
24275
+ }
24276
+ rforEach(fn, thisp) {
24277
+ thisp = thisp || this;
24278
+ for (let walker = this[LRU_LIST].tail; walker !== null;) {
24279
+ const prev = walker.prev;
24280
+ forEachStep(this, fn, walker, thisp);
24281
+ walker = prev;
24038
24282
  }
24039
- if (other.version === this.version) {
24040
- return 0;
24283
+ }
24284
+ forEach(fn, thisp) {
24285
+ thisp = thisp || this;
24286
+ for (let walker = this[LRU_LIST].head; walker !== null;) {
24287
+ const next = walker.next;
24288
+ forEachStep(this, fn, walker, thisp);
24289
+ walker = next;
24041
24290
  }
24042
- return this.compareMain(other) || this.comparePre(other);
24043
24291
  }
24044
- compareMain(other) {
24045
- if (!(other instanceof SemVer)) {
24046
- other = new SemVer(other, this.options);
24292
+ keys() {
24293
+ return this[LRU_LIST].toArray().map(k => k.key);
24294
+ }
24295
+ values() {
24296
+ return this[LRU_LIST].toArray().map(k => k.value);
24297
+ }
24298
+ reset() {
24299
+ if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
24300
+ this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
24047
24301
  }
24048
- return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
24302
+ this[CACHE] = new Map(); // hash of items by key
24303
+ this[LRU_LIST] = new Yallist(); // list of items in order of use recency
24304
+ this[LENGTH] = 0; // length of items in the list
24049
24305
  }
24050
- comparePre(other) {
24051
- if (!(other instanceof SemVer)) {
24052
- other = new SemVer(other, this.options);
24306
+
24307
+ dump() {
24308
+ return this[LRU_LIST].map(hit => isStale(this, hit) ? false : {
24309
+ k: hit.key,
24310
+ v: hit.value,
24311
+ e: hit.now + (hit.maxAge || 0)
24312
+ }).toArray().filter(h => h);
24313
+ }
24314
+ dumpLru() {
24315
+ return this[LRU_LIST];
24316
+ }
24317
+ set(key, value, maxAge) {
24318
+ maxAge = maxAge || this[MAX_AGE];
24319
+ if (maxAge && typeof maxAge !== 'number') throw new TypeError('maxAge must be a number');
24320
+ const now = maxAge ? Date.now() : 0;
24321
+ const len = this[LENGTH_CALCULATOR](value, key);
24322
+ if (this[CACHE].has(key)) {
24323
+ if (len > this[MAX]) {
24324
+ del(this, this[CACHE].get(key));
24325
+ return false;
24326
+ }
24327
+ const node = this[CACHE].get(key);
24328
+ const item = node.value;
24329
+
24330
+ // dispose of the old one before overwriting
24331
+ // split out into 2 ifs for better coverage tracking
24332
+ if (this[DISPOSE]) {
24333
+ if (!this[NO_DISPOSE_ON_SET]) this[DISPOSE](key, item.value);
24334
+ }
24335
+ item.now = now;
24336
+ item.maxAge = maxAge;
24337
+ item.value = value;
24338
+ this[LENGTH] += len - item.length;
24339
+ item.length = len;
24340
+ this.get(key);
24341
+ trim(this);
24342
+ return true;
24053
24343
  }
24344
+ const hit = new Entry(key, value, len, now, maxAge);
24054
24345
 
24055
- // NOT having a prerelease is > having one
24056
- if (this.prerelease.length && !other.prerelease.length) {
24057
- return -1;
24058
- } else if (!this.prerelease.length && other.prerelease.length) {
24059
- return 1;
24060
- } else if (!this.prerelease.length && !other.prerelease.length) {
24061
- return 0;
24346
+ // oversized objects fall out of cache automatically.
24347
+ if (hit.length > this[MAX]) {
24348
+ if (this[DISPOSE]) this[DISPOSE](key, value);
24349
+ return false;
24062
24350
  }
24063
- let i = 0;
24064
- do {
24065
- const a = this.prerelease[i];
24066
- const b = other.prerelease[i];
24067
- debug('prerelease compare', i, a, b);
24068
- if (a === undefined && b === undefined) {
24069
- return 0;
24070
- } else if (b === undefined) {
24071
- return 1;
24072
- } else if (a === undefined) {
24073
- return -1;
24074
- } else if (a === b) {
24075
- continue;
24076
- } else {
24077
- return compareIdentifiers(a, b);
24078
- }
24079
- } while (++i);
24351
+ this[LENGTH] += hit.length;
24352
+ this[LRU_LIST].unshift(hit);
24353
+ this[CACHE].set(key, this[LRU_LIST].head);
24354
+ trim(this);
24355
+ return true;
24080
24356
  }
24081
- compareBuild(other) {
24082
- if (!(other instanceof SemVer)) {
24083
- other = new SemVer(other, this.options);
24357
+ has(key) {
24358
+ if (!this[CACHE].has(key)) return false;
24359
+ const hit = this[CACHE].get(key).value;
24360
+ return !isStale(this, hit);
24361
+ }
24362
+ get(key) {
24363
+ return get(this, key, true);
24364
+ }
24365
+ peek(key) {
24366
+ return get(this, key, false);
24367
+ }
24368
+ pop() {
24369
+ const node = this[LRU_LIST].tail;
24370
+ if (!node) return null;
24371
+ del(this, node);
24372
+ return node.value;
24373
+ }
24374
+ del(key) {
24375
+ del(this, this[CACHE].get(key));
24376
+ }
24377
+ load(arr) {
24378
+ // reset the cache
24379
+ this.reset();
24380
+ const now = Date.now();
24381
+ // A previous serialized cache has the most recent items first
24382
+ for (let l = arr.length - 1; l >= 0; l--) {
24383
+ const hit = arr[l];
24384
+ const expiresAt = hit.e || 0;
24385
+ if (expiresAt === 0)
24386
+ // the item was created without expiration in a non aged cache
24387
+ this.set(hit.k, hit.v);else {
24388
+ const maxAge = expiresAt - now;
24389
+ // dont add already expired items
24390
+ if (maxAge > 0) {
24391
+ this.set(hit.k, hit.v, maxAge);
24392
+ }
24393
+ }
24084
24394
  }
24085
- let i = 0;
24086
- do {
24087
- const a = this.build[i];
24088
- const b = other.build[i];
24089
- debug('prerelease compare', i, a, b);
24090
- if (a === undefined && b === undefined) {
24091
- return 0;
24092
- } else if (b === undefined) {
24093
- return 1;
24094
- } else if (a === undefined) {
24095
- return -1;
24096
- } else if (a === b) {
24097
- continue;
24098
- } else {
24099
- return compareIdentifiers(a, b);
24395
+ }
24396
+ prune() {
24397
+ this[CACHE].forEach((value, key) => get(this, key, false));
24398
+ }
24399
+ }
24400
+ const get = (self, key, doUse) => {
24401
+ const node = self[CACHE].get(key);
24402
+ if (node) {
24403
+ const hit = node.value;
24404
+ if (isStale(self, hit)) {
24405
+ del(self, node);
24406
+ if (!self[ALLOW_STALE]) return undefined;
24407
+ } else {
24408
+ if (doUse) {
24409
+ if (self[UPDATE_AGE_ON_GET]) node.value.now = Date.now();
24410
+ self[LRU_LIST].unshiftNode(node);
24100
24411
  }
24101
- } while (++i);
24412
+ }
24413
+ return hit.value;
24414
+ }
24415
+ };
24416
+ const isStale = (self, hit) => {
24417
+ if (!hit || !hit.maxAge && !self[MAX_AGE]) return false;
24418
+ const diff = Date.now() - hit.now;
24419
+ return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE];
24420
+ };
24421
+ const trim = self => {
24422
+ if (self[LENGTH] > self[MAX]) {
24423
+ for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) {
24424
+ // We know that we're about to delete this one, and also
24425
+ // what the next least recently used key will be, so just
24426
+ // go ahead and set it now.
24427
+ const prev = walker.prev;
24428
+ del(self, walker);
24429
+ walker = prev;
24430
+ }
24431
+ }
24432
+ };
24433
+ const del = (self, node) => {
24434
+ if (node) {
24435
+ const hit = node.value;
24436
+ if (self[DISPOSE]) self[DISPOSE](hit.key, hit.value);
24437
+ self[LENGTH] -= hit.length;
24438
+ self[CACHE].delete(hit.key);
24439
+ self[LRU_LIST].removeNode(node);
24440
+ }
24441
+ };
24442
+ class Entry {
24443
+ constructor(key, value, length, now, maxAge) {
24444
+ this.key = key;
24445
+ this.value = value;
24446
+ this.length = length;
24447
+ this.now = now;
24448
+ this.maxAge = maxAge || 0;
24449
+ }
24450
+ }
24451
+ const forEachStep = (self, fn, node, thisp) => {
24452
+ let hit = node.value;
24453
+ if (isStale(self, hit)) {
24454
+ del(self, node);
24455
+ if (!self[ALLOW_STALE]) hit = undefined;
24102
24456
  }
24457
+ if (hit) fn.call(thisp, hit.value, hit.key, self);
24458
+ };
24459
+ var lruCache = LRUCache;
24103
24460
 
24104
- // preminor will bump the version up to the next minor release, and immediately
24105
- // down to pre-release. premajor and prepatch work the same way.
24106
- inc(release, identifier, identifierBase) {
24107
- switch (release) {
24108
- case 'premajor':
24109
- this.prerelease.length = 0;
24110
- this.patch = 0;
24111
- this.minor = 0;
24112
- this.major++;
24113
- this.inc('pre', identifier, identifierBase);
24114
- break;
24115
- case 'preminor':
24116
- this.prerelease.length = 0;
24117
- this.patch = 0;
24118
- this.minor++;
24119
- this.inc('pre', identifier, identifierBase);
24120
- break;
24121
- case 'prepatch':
24122
- // If this is already a prerelease, it will bump to the next version
24123
- // drop any prereleases that might already exist, since they are not
24124
- // relevant at this point.
24125
- this.prerelease.length = 0;
24126
- this.inc('patch', identifier, identifierBase);
24127
- this.inc('pre', identifier, identifierBase);
24128
- break;
24129
- // If the input is a non-prerelease version, this acts the same as
24130
- // prepatch.
24131
- case 'prerelease':
24132
- if (this.prerelease.length === 0) {
24133
- this.inc('patch', identifier, identifierBase);
24134
- }
24135
- this.inc('pre', identifier, identifierBase);
24136
- break;
24137
- case 'major':
24138
- // If this is a pre-major version, bump up to the same major version.
24139
- // Otherwise increment major.
24140
- // 1.0.0-5 bumps to 1.0.0
24141
- // 1.1.0 bumps to 2.0.0
24142
- if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
24143
- this.major++;
24144
- }
24145
- this.minor = 0;
24146
- this.patch = 0;
24147
- this.prerelease = [];
24148
- break;
24149
- case 'minor':
24150
- // If this is a pre-minor version, bump up to the same minor version.
24151
- // Otherwise increment minor.
24152
- // 1.2.0-5 bumps to 1.2.0
24153
- // 1.2.1 bumps to 1.3.0
24154
- if (this.patch !== 0 || this.prerelease.length === 0) {
24155
- this.minor++;
24156
- }
24157
- this.patch = 0;
24158
- this.prerelease = [];
24159
- break;
24160
- case 'patch':
24161
- // If this is not a pre-release version, it will increment the patch.
24162
- // If it is a pre-release it will bump up to the same patch version.
24163
- // 1.2.0-5 patches to 1.2.0
24164
- // 1.2.0 patches to 1.2.1
24165
- if (this.prerelease.length === 0) {
24166
- this.patch++;
24167
- }
24168
- this.prerelease = [];
24169
- break;
24170
- // This probably shouldn't be used publicly.
24171
- // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
24172
- case 'pre':
24173
- {
24174
- const base = Number(identifierBase) ? 1 : 0;
24175
- if (!identifier && identifierBase === false) {
24176
- throw new Error('invalid increment argument: identifier is empty');
24177
- }
24178
- if (this.prerelease.length === 0) {
24179
- this.prerelease = [base];
24180
- } else {
24181
- let i = this.prerelease.length;
24182
- while (--i >= 0) {
24183
- if (typeof this.prerelease[i] === 'number') {
24184
- this.prerelease[i]++;
24185
- i = -2;
24186
- }
24187
- }
24188
- if (i === -1) {
24189
- // didn't increment anything
24190
- if (identifier === this.prerelease.join('.') && identifierBase === false) {
24191
- throw new Error('invalid increment argument: identifier already exists');
24192
- }
24193
- this.prerelease.push(base);
24194
- }
24195
- }
24196
- if (identifier) {
24197
- // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
24198
- // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
24199
- let prerelease = [identifier, base];
24200
- if (identifierBase === false) {
24201
- prerelease = [identifier];
24202
- }
24203
- if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
24204
- if (isNaN(this.prerelease[1])) {
24205
- this.prerelease = prerelease;
24206
- }
24207
- } else {
24208
- this.prerelease = prerelease;
24209
- }
24210
- }
24211
- break;
24212
- }
24213
- default:
24214
- throw new Error("invalid increment argument: ".concat(release));
24215
- }
24216
- this.raw = this.format();
24217
- if (this.build.length) {
24218
- this.raw += "+".concat(this.build.join('.'));
24219
- }
24220
- return this;
24221
- }
24222
- };
24223
- var semver$1 = SemVer$d;
24224
-
24225
- const SemVer$c = semver$1;
24226
- const parse$6 = function (version, options) {
24227
- let throwErrors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
24228
- if (version instanceof SemVer$c) {
24229
- return version;
24461
+ // parse out just the options we care about
24462
+ const looseOption = Object.freeze({
24463
+ loose: true
24464
+ });
24465
+ const emptyOpts = Object.freeze({});
24466
+ const parseOptions$1 = options => {
24467
+ if (!options) {
24468
+ return emptyOpts;
24230
24469
  }
24231
- try {
24232
- return new SemVer$c(version, options);
24233
- } catch (er) {
24234
- if (!throwErrors) {
24235
- return null;
24236
- }
24237
- throw er;
24470
+ if (typeof options !== 'object') {
24471
+ return looseOption;
24238
24472
  }
24473
+ return options;
24239
24474
  };
24240
- var parse_1 = parse$6;
24475
+ var parseOptions_1 = parseOptions$1;
24241
24476
 
24242
- const parse$5 = parse_1;
24243
- const valid$2 = (version, options) => {
24244
- const v = parse$5(version, options);
24245
- return v ? v.version : null;
24246
- };
24247
- var valid_1 = valid$2;
24477
+ var re$1 = {exports: {}};
24248
24478
 
24249
- const parse$4 = parse_1;
24250
- const clean$1 = (version, options) => {
24251
- const s = parse$4(version.trim().replace(/^[=v]+/, ''), options);
24252
- return s ? s.version : null;
24253
- };
24254
- var clean_1 = clean$1;
24479
+ // Note: this is the semver.org version of the spec that it implements
24480
+ // Not necessarily the package version of this code.
24481
+ const SEMVER_SPEC_VERSION = '2.0.0';
24482
+ const MAX_LENGTH$1 = 256;
24483
+ const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */9007199254740991;
24255
24484
 
24256
- const SemVer$b = semver$1;
24257
- const inc$1 = (version, release, options, identifier, identifierBase) => {
24258
- if (typeof options === 'string') {
24259
- identifierBase = identifier;
24260
- identifier = options;
24261
- options = undefined;
24262
- }
24263
- try {
24264
- return new SemVer$b(version instanceof SemVer$b ? version.version : version, options).inc(release, identifier, identifierBase).version;
24265
- } catch (er) {
24266
- return null;
24267
- }
24485
+ // Max safe segment length for coercion.
24486
+ const MAX_SAFE_COMPONENT_LENGTH = 16;
24487
+
24488
+ // Max safe length for a build identifier. The max length minus 6 characters for
24489
+ // the shortest version with a build 0.0.0+BUILD.
24490
+ const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
24491
+ const RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];
24492
+ var constants = {
24493
+ MAX_LENGTH: MAX_LENGTH$1,
24494
+ MAX_SAFE_COMPONENT_LENGTH,
24495
+ MAX_SAFE_BUILD_LENGTH,
24496
+ MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
24497
+ RELEASE_TYPES,
24498
+ SEMVER_SPEC_VERSION,
24499
+ FLAG_INCLUDE_PRERELEASE: 0b001,
24500
+ FLAG_LOOSE: 0b010
24268
24501
  };
24269
- var inc_1 = inc$1;
24270
24502
 
24271
- const parse$3 = parse_1;
24272
- const diff$1 = (version1, version2) => {
24273
- const v1 = parse$3(version1, null, true);
24274
- const v2 = parse$3(version2, null, true);
24275
- const comparison = v1.compare(v2);
24276
- if (comparison === 0) {
24277
- return null;
24503
+ const debug$1 = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? function () {
24504
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
24505
+ args[_key] = arguments[_key];
24278
24506
  }
24279
- const v1Higher = comparison > 0;
24280
- const highVersion = v1Higher ? v1 : v2;
24281
- const lowVersion = v1Higher ? v2 : v1;
24282
- const highHasPre = !!highVersion.prerelease.length;
24283
- const lowHasPre = !!lowVersion.prerelease.length;
24284
- if (lowHasPre && !highHasPre) {
24285
- // Going from prerelease -> no prerelease requires some special casing
24507
+ return console.error('SEMVER', ...args);
24508
+ } : () => {};
24509
+ var debug_1 = debug$1;
24286
24510
 
24287
- // If the low version has only a major, then it will always be a major
24288
- // Some examples:
24289
- // 1.0.0-1 -> 1.0.0
24290
- // 1.0.0-1 -> 1.1.1
24291
- // 1.0.0-1 -> 2.0.0
24292
- if (!lowVersion.patch && !lowVersion.minor) {
24293
- return 'major';
24294
- }
24511
+ (function (module, exports) {
24512
+ const {
24513
+ MAX_SAFE_COMPONENT_LENGTH,
24514
+ MAX_SAFE_BUILD_LENGTH,
24515
+ MAX_LENGTH
24516
+ } = constants;
24517
+ const debug = debug_1;
24518
+ exports = module.exports = {};
24295
24519
 
24296
- // Otherwise it can be determined by checking the high version
24520
+ // The actual regexps go on exports.re
24521
+ const re = exports.re = [];
24522
+ const safeRe = exports.safeRe = [];
24523
+ const src = exports.src = [];
24524
+ const t = exports.t = {};
24525
+ let R = 0;
24526
+ const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
24297
24527
 
24298
- if (highVersion.patch) {
24299
- // anything higher than a patch bump would result in the wrong version
24300
- return 'patch';
24301
- }
24302
- if (highVersion.minor) {
24303
- // anything higher than a minor bump would result in the wrong version
24304
- return 'minor';
24528
+ // Replace some greedy regex tokens to prevent regex dos issues. These regex are
24529
+ // used internally via the safeRe object since all inputs in this library get
24530
+ // normalized first to trim and collapse all extra whitespace. The original
24531
+ // regexes are exported for userland consumption and lower level usage. A
24532
+ // future breaking change could export the safer regex only with a note that
24533
+ // all input should have extra whitespace removed.
24534
+ const safeRegexReplacements = [['\\s', 1], ['\\d', MAX_LENGTH], [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]];
24535
+ const makeSafeRegex = value => {
24536
+ for (const [token, max] of safeRegexReplacements) {
24537
+ value = value.split("".concat(token, "*")).join("".concat(token, "{0,").concat(max, "}")).split("".concat(token, "+")).join("".concat(token, "{1,").concat(max, "}"));
24305
24538
  }
24539
+ return value;
24540
+ };
24541
+ const createToken = (name, value, isGlobal) => {
24542
+ const safe = makeSafeRegex(value);
24543
+ const index = R++;
24544
+ debug(name, index, value);
24545
+ t[name] = index;
24546
+ src[index] = value;
24547
+ re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
24548
+ safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
24549
+ };
24306
24550
 
24307
- // bumping major/minor/patch all have same result
24308
- return 'major';
24309
- }
24551
+ // The following Regular Expressions can be used for tokenizing,
24552
+ // validating, and parsing SemVer version strings.
24310
24553
 
24311
- // add the `pre` prefix if we are going to a prerelease version
24312
- const prefix = highHasPre ? 'pre' : '';
24313
- if (v1.major !== v2.major) {
24314
- return prefix + 'major';
24315
- }
24316
- if (v1.minor !== v2.minor) {
24317
- return prefix + 'minor';
24318
- }
24319
- if (v1.patch !== v2.patch) {
24320
- return prefix + 'patch';
24321
- }
24554
+ // ## Numeric Identifier
24555
+ // A single `0`, or a non-zero digit followed by zero or more digits.
24322
24556
 
24323
- // high and low are preleases
24324
- return 'prerelease';
24325
- };
24326
- var diff_1 = diff$1;
24557
+ createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
24558
+ createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
24327
24559
 
24328
- const SemVer$a = semver$1;
24329
- const major$1 = (a, loose) => new SemVer$a(a, loose).major;
24330
- var major_1 = major$1;
24560
+ // ## Non-numeric Identifier
24561
+ // Zero or more digits, followed by a letter or hyphen, and then zero or
24562
+ // more letters, digits, or hyphens.
24331
24563
 
24332
- const SemVer$9 = semver$1;
24333
- const minor$1 = (a, loose) => new SemVer$9(a, loose).minor;
24334
- var minor_1 = minor$1;
24564
+ createToken('NONNUMERICIDENTIFIER', "\\d*[a-zA-Z-]".concat(LETTERDASHNUMBER, "*"));
24335
24565
 
24336
- const SemVer$8 = semver$1;
24337
- const patch$1 = (a, loose) => new SemVer$8(a, loose).patch;
24338
- var patch_1 = patch$1;
24566
+ // ## Main Version
24567
+ // Three dot-separated numeric identifiers.
24339
24568
 
24340
- const parse$2 = parse_1;
24341
- const prerelease$1 = (version, options) => {
24342
- const parsed = parse$2(version, options);
24343
- return parsed && parsed.prerelease.length ? parsed.prerelease : null;
24344
- };
24345
- var prerelease_1 = prerelease$1;
24569
+ createToken('MAINVERSION', "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")"));
24570
+ createToken('MAINVERSIONLOOSE', "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")"));
24346
24571
 
24347
- const SemVer$7 = semver$1;
24348
- const compare$b = (a, b, loose) => new SemVer$7(a, loose).compare(new SemVer$7(b, loose));
24349
- var compare_1 = compare$b;
24572
+ // ## Pre-release Version Identifier
24573
+ // A numeric identifier, or a non-numeric identifier.
24350
24574
 
24351
- const compare$a = compare_1;
24352
- const rcompare$1 = (a, b, loose) => compare$a(b, a, loose);
24353
- var rcompare_1 = rcompare$1;
24575
+ createToken('PRERELEASEIDENTIFIER', "(?:".concat(src[t.NUMERICIDENTIFIER], "|").concat(src[t.NONNUMERICIDENTIFIER], ")"));
24576
+ createToken('PRERELEASEIDENTIFIERLOOSE', "(?:".concat(src[t.NUMERICIDENTIFIERLOOSE], "|").concat(src[t.NONNUMERICIDENTIFIER], ")"));
24354
24577
 
24355
- const compare$9 = compare_1;
24356
- const compareLoose$1 = (a, b) => compare$9(a, b, true);
24357
- var compareLoose_1 = compareLoose$1;
24578
+ // ## Pre-release Version
24579
+ // Hyphen, followed by one or more dot-separated pre-release version
24580
+ // identifiers.
24358
24581
 
24359
- const SemVer$6 = semver$1;
24360
- const compareBuild$3 = (a, b, loose) => {
24361
- const versionA = new SemVer$6(a, loose);
24362
- const versionB = new SemVer$6(b, loose);
24363
- return versionA.compare(versionB) || versionA.compareBuild(versionB);
24364
- };
24365
- var compareBuild_1 = compareBuild$3;
24582
+ createToken('PRERELEASE', "(?:-(".concat(src[t.PRERELEASEIDENTIFIER], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIER], ")*))"));
24583
+ createToken('PRERELEASELOOSE', "(?:-?(".concat(src[t.PRERELEASEIDENTIFIERLOOSE], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIERLOOSE], ")*))"));
24366
24584
 
24367
- const compareBuild$2 = compareBuild_1;
24368
- const sort$1 = (list, loose) => list.sort((a, b) => compareBuild$2(a, b, loose));
24369
- var sort_1 = sort$1;
24585
+ // ## Build Metadata Identifier
24586
+ // Any combination of digits, letters, or hyphens.
24370
24587
 
24371
- const compareBuild$1 = compareBuild_1;
24372
- const rsort$1 = (list, loose) => list.sort((a, b) => compareBuild$1(b, a, loose));
24373
- var rsort_1 = rsort$1;
24588
+ createToken('BUILDIDENTIFIER', "".concat(LETTERDASHNUMBER, "+"));
24374
24589
 
24375
- const compare$8 = compare_1;
24376
- const gt$4 = (a, b, loose) => compare$8(a, b, loose) > 0;
24377
- var gt_1 = gt$4;
24590
+ // ## Build Metadata
24591
+ // Plus sign, followed by one or more period-separated build metadata
24592
+ // identifiers.
24378
24593
 
24379
- const compare$7 = compare_1;
24380
- const lt$3 = (a, b, loose) => compare$7(a, b, loose) < 0;
24381
- var lt_1 = lt$3;
24594
+ createToken('BUILD', "(?:\\+(".concat(src[t.BUILDIDENTIFIER], "(?:\\.").concat(src[t.BUILDIDENTIFIER], ")*))"));
24382
24595
 
24383
- const compare$6 = compare_1;
24384
- const eq$2 = (a, b, loose) => compare$6(a, b, loose) === 0;
24385
- var eq_1 = eq$2;
24596
+ // ## Full Version String
24597
+ // A main version, followed optionally by a pre-release version and
24598
+ // build metadata.
24386
24599
 
24387
- const compare$5 = compare_1;
24388
- const neq$2 = (a, b, loose) => compare$5(a, b, loose) !== 0;
24389
- var neq_1 = neq$2;
24600
+ // Note that the only major, minor, patch, and pre-release sections of
24601
+ // the version string are capturing groups. The build metadata is not a
24602
+ // capturing group, because it should not ever be used in version
24603
+ // comparison.
24390
24604
 
24391
- const compare$4 = compare_1;
24392
- const gte$3 = (a, b, loose) => compare$4(a, b, loose) >= 0;
24393
- var gte_1 = gte$3;
24605
+ createToken('FULLPLAIN', "v?".concat(src[t.MAINVERSION]).concat(src[t.PRERELEASE], "?").concat(src[t.BUILD], "?"));
24606
+ createToken('FULL', "^".concat(src[t.FULLPLAIN], "$"));
24394
24607
 
24395
- const compare$3 = compare_1;
24396
- const lte$3 = (a, b, loose) => compare$3(a, b, loose) <= 0;
24397
- var lte_1 = lte$3;
24398
-
24399
- const eq$1 = eq_1;
24400
- const neq$1 = neq_1;
24401
- const gt$3 = gt_1;
24402
- const gte$2 = gte_1;
24403
- const lt$2 = lt_1;
24404
- const lte$2 = lte_1;
24405
- const cmp$1 = (a, op, b, loose) => {
24406
- switch (op) {
24407
- case '===':
24408
- if (typeof a === 'object') {
24409
- a = a.version;
24410
- }
24411
- if (typeof b === 'object') {
24412
- b = b.version;
24413
- }
24414
- return a === b;
24415
- case '!==':
24416
- if (typeof a === 'object') {
24417
- a = a.version;
24418
- }
24419
- if (typeof b === 'object') {
24420
- b = b.version;
24421
- }
24422
- return a !== b;
24423
- case '':
24424
- case '=':
24425
- case '==':
24426
- return eq$1(a, b, loose);
24427
- case '!=':
24428
- return neq$1(a, b, loose);
24429
- case '>':
24430
- return gt$3(a, b, loose);
24431
- case '>=':
24432
- return gte$2(a, b, loose);
24433
- case '<':
24434
- return lt$2(a, b, loose);
24435
- case '<=':
24436
- return lte$2(a, b, loose);
24437
- default:
24438
- throw new TypeError("Invalid operator: ".concat(op));
24439
- }
24440
- };
24441
- var cmp_1 = cmp$1;
24442
-
24443
- const SemVer$5 = semver$1;
24444
- const parse$1 = parse_1;
24445
- const {
24446
- safeRe: re,
24447
- t
24448
- } = reExports;
24449
- const coerce$1 = (version, options) => {
24450
- if (version instanceof SemVer$5) {
24451
- return version;
24452
- }
24453
- if (typeof version === 'number') {
24454
- version = String(version);
24455
- }
24456
- if (typeof version !== 'string') {
24457
- return null;
24458
- }
24459
- options = options || {};
24460
- let match = null;
24461
- if (!options.rtl) {
24462
- match = version.match(re[t.COERCE]);
24463
- } else {
24464
- // Find the right-most coercible string that does not share
24465
- // a terminus with a more left-ward coercible string.
24466
- // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
24467
- //
24468
- // Walk through the string checking with a /g regexp
24469
- // Manually set the index so as to pick up overlapping matches.
24470
- // Stop when we get a match that ends at the string end, since no
24471
- // coercible string can be more right-ward without the same terminus.
24472
- let next;
24473
- while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) {
24474
- if (!match || next.index + next[0].length !== match.index + match[0].length) {
24475
- match = next;
24476
- }
24477
- re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
24478
- }
24479
- // leave it in a clean state
24480
- re[t.COERCERTL].lastIndex = -1;
24481
- }
24482
- if (match === null) {
24483
- return null;
24484
- }
24485
- return parse$1("".concat(match[2], ".").concat(match[3] || '0', ".").concat(match[4] || '0'), options);
24486
- };
24487
- var coerce_1 = coerce$1;
24488
-
24489
- var iterator;
24490
- var hasRequiredIterator;
24491
-
24492
- function requireIterator () {
24493
- if (hasRequiredIterator) return iterator;
24494
- hasRequiredIterator = 1;
24495
- iterator = function (Yallist) {
24496
- Yallist.prototype[Symbol.iterator] = function* () {
24497
- for (let walker = this.head; walker; walker = walker.next) {
24498
- yield walker.value;
24499
- }
24500
- };
24501
- };
24502
- return iterator;
24503
- }
24504
-
24505
- var yallist;
24506
- var hasRequiredYallist;
24507
-
24508
- function requireYallist () {
24509
- if (hasRequiredYallist) return yallist;
24510
- hasRequiredYallist = 1;
24511
- yallist = Yallist;
24512
-
24513
- Yallist.Node = Node;
24514
- Yallist.create = Yallist;
24515
-
24516
- function Yallist (list) {
24517
- var self = this;
24518
- if (!(self instanceof Yallist)) {
24519
- self = new Yallist();
24520
- }
24521
-
24522
- self.tail = null;
24523
- self.head = null;
24524
- self.length = 0;
24525
-
24526
- if (list && typeof list.forEach === 'function') {
24527
- list.forEach(function (item) {
24528
- self.push(item);
24529
- });
24530
- } else if (arguments.length > 0) {
24531
- for (var i = 0, l = arguments.length; i < l; i++) {
24532
- self.push(arguments[i]);
24533
- }
24534
- }
24535
-
24536
- return self
24537
- }
24538
-
24539
- Yallist.prototype.removeNode = function (node) {
24540
- if (node.list !== this) {
24541
- throw new Error('removing node which does not belong to this list')
24542
- }
24543
-
24544
- var next = node.next;
24545
- var prev = node.prev;
24546
-
24547
- if (next) {
24548
- next.prev = prev;
24549
- }
24550
-
24551
- if (prev) {
24552
- prev.next = next;
24553
- }
24554
-
24555
- if (node === this.head) {
24556
- this.head = next;
24557
- }
24558
- if (node === this.tail) {
24559
- this.tail = prev;
24560
- }
24561
-
24562
- node.list.length--;
24563
- node.next = null;
24564
- node.prev = null;
24565
- node.list = null;
24566
-
24567
- return next
24568
- };
24569
-
24570
- Yallist.prototype.unshiftNode = function (node) {
24571
- if (node === this.head) {
24572
- return
24573
- }
24574
-
24575
- if (node.list) {
24576
- node.list.removeNode(node);
24577
- }
24578
-
24579
- var head = this.head;
24580
- node.list = this;
24581
- node.next = head;
24582
- if (head) {
24583
- head.prev = node;
24584
- }
24585
-
24586
- this.head = node;
24587
- if (!this.tail) {
24588
- this.tail = node;
24589
- }
24590
- this.length++;
24591
- };
24592
-
24593
- Yallist.prototype.pushNode = function (node) {
24594
- if (node === this.tail) {
24595
- return
24596
- }
24597
-
24598
- if (node.list) {
24599
- node.list.removeNode(node);
24600
- }
24601
-
24602
- var tail = this.tail;
24603
- node.list = this;
24604
- node.prev = tail;
24605
- if (tail) {
24606
- tail.next = node;
24607
- }
24608
-
24609
- this.tail = node;
24610
- if (!this.head) {
24611
- this.head = node;
24612
- }
24613
- this.length++;
24614
- };
24615
-
24616
- Yallist.prototype.push = function () {
24617
- for (var i = 0, l = arguments.length; i < l; i++) {
24618
- push(this, arguments[i]);
24619
- }
24620
- return this.length
24621
- };
24622
-
24623
- Yallist.prototype.unshift = function () {
24624
- for (var i = 0, l = arguments.length; i < l; i++) {
24625
- unshift(this, arguments[i]);
24626
- }
24627
- return this.length
24628
- };
24629
-
24630
- Yallist.prototype.pop = function () {
24631
- if (!this.tail) {
24632
- return undefined
24633
- }
24634
-
24635
- var res = this.tail.value;
24636
- this.tail = this.tail.prev;
24637
- if (this.tail) {
24638
- this.tail.next = null;
24639
- } else {
24640
- this.head = null;
24641
- }
24642
- this.length--;
24643
- return res
24644
- };
24645
-
24646
- Yallist.prototype.shift = function () {
24647
- if (!this.head) {
24648
- return undefined
24649
- }
24650
-
24651
- var res = this.head.value;
24652
- this.head = this.head.next;
24653
- if (this.head) {
24654
- this.head.prev = null;
24655
- } else {
24656
- this.tail = null;
24657
- }
24658
- this.length--;
24659
- return res
24660
- };
24661
-
24662
- Yallist.prototype.forEach = function (fn, thisp) {
24663
- thisp = thisp || this;
24664
- for (var walker = this.head, i = 0; walker !== null; i++) {
24665
- fn.call(thisp, walker.value, i, this);
24666
- walker = walker.next;
24667
- }
24668
- };
24669
-
24670
- Yallist.prototype.forEachReverse = function (fn, thisp) {
24671
- thisp = thisp || this;
24672
- for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
24673
- fn.call(thisp, walker.value, i, this);
24674
- walker = walker.prev;
24675
- }
24676
- };
24677
-
24678
- Yallist.prototype.get = function (n) {
24679
- for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
24680
- // abort out of the list early if we hit a cycle
24681
- walker = walker.next;
24682
- }
24683
- if (i === n && walker !== null) {
24684
- return walker.value
24685
- }
24686
- };
24687
-
24688
- Yallist.prototype.getReverse = function (n) {
24689
- for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
24690
- // abort out of the list early if we hit a cycle
24691
- walker = walker.prev;
24692
- }
24693
- if (i === n && walker !== null) {
24694
- return walker.value
24695
- }
24696
- };
24697
-
24698
- Yallist.prototype.map = function (fn, thisp) {
24699
- thisp = thisp || this;
24700
- var res = new Yallist();
24701
- for (var walker = this.head; walker !== null;) {
24702
- res.push(fn.call(thisp, walker.value, this));
24703
- walker = walker.next;
24704
- }
24705
- return res
24706
- };
24707
-
24708
- Yallist.prototype.mapReverse = function (fn, thisp) {
24709
- thisp = thisp || this;
24710
- var res = new Yallist();
24711
- for (var walker = this.tail; walker !== null;) {
24712
- res.push(fn.call(thisp, walker.value, this));
24713
- walker = walker.prev;
24714
- }
24715
- return res
24716
- };
24717
-
24718
- Yallist.prototype.reduce = function (fn, initial) {
24719
- var acc;
24720
- var walker = this.head;
24721
- if (arguments.length > 1) {
24722
- acc = initial;
24723
- } else if (this.head) {
24724
- walker = this.head.next;
24725
- acc = this.head.value;
24726
- } else {
24727
- throw new TypeError('Reduce of empty list with no initial value')
24728
- }
24729
-
24730
- for (var i = 0; walker !== null; i++) {
24731
- acc = fn(acc, walker.value, i);
24732
- walker = walker.next;
24733
- }
24734
-
24735
- return acc
24736
- };
24737
-
24738
- Yallist.prototype.reduceReverse = function (fn, initial) {
24739
- var acc;
24740
- var walker = this.tail;
24741
- if (arguments.length > 1) {
24742
- acc = initial;
24743
- } else if (this.tail) {
24744
- walker = this.tail.prev;
24745
- acc = this.tail.value;
24746
- } else {
24747
- throw new TypeError('Reduce of empty list with no initial value')
24748
- }
24749
-
24750
- for (var i = this.length - 1; walker !== null; i--) {
24751
- acc = fn(acc, walker.value, i);
24752
- walker = walker.prev;
24753
- }
24754
-
24755
- return acc
24756
- };
24757
-
24758
- Yallist.prototype.toArray = function () {
24759
- var arr = new Array(this.length);
24760
- for (var i = 0, walker = this.head; walker !== null; i++) {
24761
- arr[i] = walker.value;
24762
- walker = walker.next;
24763
- }
24764
- return arr
24765
- };
24766
-
24767
- Yallist.prototype.toArrayReverse = function () {
24768
- var arr = new Array(this.length);
24769
- for (var i = 0, walker = this.tail; walker !== null; i++) {
24770
- arr[i] = walker.value;
24771
- walker = walker.prev;
24772
- }
24773
- return arr
24774
- };
24775
-
24776
- Yallist.prototype.slice = function (from, to) {
24777
- to = to || this.length;
24778
- if (to < 0) {
24779
- to += this.length;
24780
- }
24781
- from = from || 0;
24782
- if (from < 0) {
24783
- from += this.length;
24784
- }
24785
- var ret = new Yallist();
24786
- if (to < from || to < 0) {
24787
- return ret
24788
- }
24789
- if (from < 0) {
24790
- from = 0;
24791
- }
24792
- if (to > this.length) {
24793
- to = this.length;
24794
- }
24795
- for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
24796
- walker = walker.next;
24797
- }
24798
- for (; walker !== null && i < to; i++, walker = walker.next) {
24799
- ret.push(walker.value);
24800
- }
24801
- return ret
24802
- };
24803
-
24804
- Yallist.prototype.sliceReverse = function (from, to) {
24805
- to = to || this.length;
24806
- if (to < 0) {
24807
- to += this.length;
24808
- }
24809
- from = from || 0;
24810
- if (from < 0) {
24811
- from += this.length;
24812
- }
24813
- var ret = new Yallist();
24814
- if (to < from || to < 0) {
24815
- return ret
24816
- }
24817
- if (from < 0) {
24818
- from = 0;
24819
- }
24820
- if (to > this.length) {
24821
- to = this.length;
24822
- }
24823
- for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
24824
- walker = walker.prev;
24825
- }
24826
- for (; walker !== null && i > from; i--, walker = walker.prev) {
24827
- ret.push(walker.value);
24828
- }
24829
- return ret
24830
- };
24831
-
24832
- Yallist.prototype.splice = function (start, deleteCount, ...nodes) {
24833
- if (start > this.length) {
24834
- start = this.length - 1;
24835
- }
24836
- if (start < 0) {
24837
- start = this.length + start;
24838
- }
24839
-
24840
- for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
24841
- walker = walker.next;
24842
- }
24843
-
24844
- var ret = [];
24845
- for (var i = 0; walker && i < deleteCount; i++) {
24846
- ret.push(walker.value);
24847
- walker = this.removeNode(walker);
24848
- }
24849
- if (walker === null) {
24850
- walker = this.tail;
24851
- }
24852
-
24853
- if (walker !== this.head && walker !== this.tail) {
24854
- walker = walker.prev;
24855
- }
24856
-
24857
- for (var i = 0; i < nodes.length; i++) {
24858
- walker = insert(this, walker, nodes[i]);
24859
- }
24860
- return ret;
24861
- };
24608
+ // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
24609
+ // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
24610
+ // common in the npm registry.
24611
+ createToken('LOOSEPLAIN', "[v=\\s]*".concat(src[t.MAINVERSIONLOOSE]).concat(src[t.PRERELEASELOOSE], "?").concat(src[t.BUILD], "?"));
24612
+ createToken('LOOSE', "^".concat(src[t.LOOSEPLAIN], "$"));
24613
+ createToken('GTLT', '((?:<|>)?=?)');
24862
24614
 
24863
- Yallist.prototype.reverse = function () {
24864
- var head = this.head;
24865
- var tail = this.tail;
24866
- for (var walker = head; walker !== null; walker = walker.prev) {
24867
- var p = walker.prev;
24868
- walker.prev = walker.next;
24869
- walker.next = p;
24870
- }
24871
- this.head = tail;
24872
- this.tail = head;
24873
- return this
24874
- };
24615
+ // Something like "2.*" or "1.2.x".
24616
+ // Note that "x.x" is a valid xRange identifer, meaning "any version"
24617
+ // Only the first item is strictly required.
24618
+ createToken('XRANGEIDENTIFIERLOOSE', "".concat(src[t.NUMERICIDENTIFIERLOOSE], "|x|X|\\*"));
24619
+ createToken('XRANGEIDENTIFIER', "".concat(src[t.NUMERICIDENTIFIER], "|x|X|\\*"));
24620
+ createToken('XRANGEPLAIN', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:".concat(src[t.PRERELEASE], ")?").concat(src[t.BUILD], "?") + ")?)?");
24621
+ createToken('XRANGEPLAINLOOSE', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:".concat(src[t.PRERELEASELOOSE], ")?").concat(src[t.BUILD], "?") + ")?)?");
24622
+ createToken('XRANGE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAIN], "$"));
24623
+ createToken('XRANGELOOSE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAINLOOSE], "$"));
24875
24624
 
24876
- function insert (self, node, value) {
24877
- var inserted = node === self.head ?
24878
- new Node(value, null, node, self) :
24879
- new Node(value, node, node.next, self);
24625
+ // Coercion.
24626
+ // Extract anything that could conceivably be a part of a valid semver
24627
+ createToken('COERCE', "".concat('(^|[^\\d])' + '(\\d{1,').concat(MAX_SAFE_COMPONENT_LENGTH, "})") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?") + "(?:$|[^\\d])");
24628
+ createToken('COERCERTL', src[t.COERCE], true);
24880
24629
 
24881
- if (inserted.next === null) {
24882
- self.tail = inserted;
24883
- }
24884
- if (inserted.prev === null) {
24885
- self.head = inserted;
24886
- }
24630
+ // Tilde ranges.
24631
+ // Meaning is "reasonably at or greater than"
24632
+ createToken('LONETILDE', '(?:~>?)');
24633
+ createToken('TILDETRIM', "(\\s*)".concat(src[t.LONETILDE], "\\s+"), true);
24634
+ exports.tildeTrimReplace = '$1~';
24635
+ createToken('TILDE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAIN], "$"));
24636
+ createToken('TILDELOOSE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAINLOOSE], "$"));
24887
24637
 
24888
- self.length++;
24638
+ // Caret ranges.
24639
+ // Meaning is "at least and backwards compatible with"
24640
+ createToken('LONECARET', '(?:\\^)');
24641
+ createToken('CARETTRIM', "(\\s*)".concat(src[t.LONECARET], "\\s+"), true);
24642
+ exports.caretTrimReplace = '$1^';
24643
+ createToken('CARET', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAIN], "$"));
24644
+ createToken('CARETLOOSE', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAINLOOSE], "$"));
24889
24645
 
24890
- return inserted
24891
- }
24646
+ // A simple gt/lt/eq thing, or just "" to indicate "any version"
24647
+ createToken('COMPARATORLOOSE', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], ")$|^$"));
24648
+ createToken('COMPARATOR', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.FULLPLAIN], ")$|^$"));
24892
24649
 
24893
- function push (self, item) {
24894
- self.tail = new Node(item, self.tail, null, self);
24895
- if (!self.head) {
24896
- self.head = self.tail;
24897
- }
24898
- self.length++;
24899
- }
24650
+ // An expression to strip any whitespace between the gtlt and the thing
24651
+ // it modifies, so that `> 1.2.3` ==> `>1.2.3`
24652
+ createToken('COMPARATORTRIM', "(\\s*)".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], "|").concat(src[t.XRANGEPLAIN], ")"), true);
24653
+ exports.comparatorTrimReplace = '$1$2$3';
24900
24654
 
24901
- function unshift (self, item) {
24902
- self.head = new Node(item, null, self.head, self);
24903
- if (!self.tail) {
24904
- self.tail = self.head;
24905
- }
24906
- self.length++;
24907
- }
24655
+ // Something like `1.2.3 - 1.2.4`
24656
+ // Note that these all use the loose form, because they'll be
24657
+ // checked against either the strict or loose comparator form
24658
+ // later.
24659
+ createToken('HYPHENRANGE', "^\\s*(".concat(src[t.XRANGEPLAIN], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAIN], ")") + "\\s*$");
24660
+ createToken('HYPHENRANGELOOSE', "^\\s*(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s*$");
24908
24661
 
24909
- function Node (value, prev, next, list) {
24910
- if (!(this instanceof Node)) {
24911
- return new Node(value, prev, next, list)
24912
- }
24913
-
24914
- this.list = list;
24915
- this.value = value;
24916
-
24917
- if (prev) {
24918
- prev.next = this;
24919
- this.prev = prev;
24920
- } else {
24921
- this.prev = null;
24922
- }
24923
-
24924
- if (next) {
24925
- next.prev = this;
24926
- this.next = next;
24927
- } else {
24928
- this.next = null;
24929
- }
24930
- }
24662
+ // Star ranges basically just allow anything at all.
24663
+ createToken('STAR', '(<|>)?=?\\s*\\*');
24664
+ // >=0.0.0 is like a star
24665
+ createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
24666
+ createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
24667
+ })(re$1, re$1.exports);
24668
+ var reExports = re$1.exports;
24931
24669
 
24932
- try {
24933
- // add if support for Symbol.iterator is present
24934
- requireIterator()(Yallist);
24935
- } catch (er) {}
24936
- return yallist;
24937
- }
24938
-
24939
- var lruCache;
24940
- var hasRequiredLruCache;
24941
- function requireLruCache() {
24942
- if (hasRequiredLruCache) return lruCache;
24943
- hasRequiredLruCache = 1;
24944
-
24945
- // A linked list to keep track of recently-used-ness
24946
- const Yallist = requireYallist();
24947
- const MAX = Symbol('max');
24948
- const LENGTH = Symbol('length');
24949
- const LENGTH_CALCULATOR = Symbol('lengthCalculator');
24950
- const ALLOW_STALE = Symbol('allowStale');
24951
- const MAX_AGE = Symbol('maxAge');
24952
- const DISPOSE = Symbol('dispose');
24953
- const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');
24954
- const LRU_LIST = Symbol('lruList');
24955
- const CACHE = Symbol('cache');
24956
- const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');
24957
- const naiveLength = () => 1;
24958
-
24959
- // lruList is a yallist where the head is the youngest
24960
- // item, and the tail is the oldest. the list contains the Hit
24961
- // objects as the entries.
24962
- // Each Hit object has a reference to its Yallist.Node. This
24963
- // never changes.
24964
- //
24965
- // cache is a Map (or PseudoMap) that matches the keys to
24966
- // the Yallist.Node object.
24967
- class LRUCache {
24968
- constructor(options) {
24969
- if (typeof options === 'number') options = {
24970
- max: options
24971
- };
24972
- if (!options) options = {};
24973
- if (options.max && (typeof options.max !== 'number' || options.max < 0)) throw new TypeError('max must be a non-negative number');
24974
- // Kind of weird to have a default max of Infinity, but oh well.
24975
- this[MAX] = options.max || Infinity;
24976
- const lc = options.length || naiveLength;
24977
- this[LENGTH_CALCULATOR] = typeof lc !== 'function' ? naiveLength : lc;
24978
- this[ALLOW_STALE] = options.stale || false;
24979
- if (options.maxAge && typeof options.maxAge !== 'number') throw new TypeError('maxAge must be a number');
24980
- this[MAX_AGE] = options.maxAge || 0;
24981
- this[DISPOSE] = options.dispose;
24982
- this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
24983
- this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
24984
- this.reset();
24985
- }
24986
-
24987
- // resize the cache when the max changes.
24988
- set max(mL) {
24989
- if (typeof mL !== 'number' || mL < 0) throw new TypeError('max must be a non-negative number');
24990
- this[MAX] = mL || Infinity;
24991
- trim(this);
24992
- }
24993
- get max() {
24994
- return this[MAX];
24995
- }
24996
- set allowStale(allowStale) {
24997
- this[ALLOW_STALE] = !!allowStale;
24998
- }
24999
- get allowStale() {
25000
- return this[ALLOW_STALE];
25001
- }
25002
- set maxAge(mA) {
25003
- if (typeof mA !== 'number') throw new TypeError('maxAge must be a non-negative number');
25004
- this[MAX_AGE] = mA;
25005
- trim(this);
25006
- }
25007
- get maxAge() {
25008
- return this[MAX_AGE];
25009
- }
24670
+ const numeric = /^[0-9]+$/;
24671
+ const compareIdentifiers$1 = (a, b) => {
24672
+ const anum = numeric.test(a);
24673
+ const bnum = numeric.test(b);
24674
+ if (anum && bnum) {
24675
+ a = +a;
24676
+ b = +b;
24677
+ }
24678
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
24679
+ };
24680
+ const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
24681
+ var identifiers = {
24682
+ compareIdentifiers: compareIdentifiers$1,
24683
+ rcompareIdentifiers
24684
+ };
25010
24685
 
25011
- // resize the cache when the lengthCalculator changes.
25012
- set lengthCalculator(lC) {
25013
- if (typeof lC !== 'function') lC = naiveLength;
25014
- if (lC !== this[LENGTH_CALCULATOR]) {
25015
- this[LENGTH_CALCULATOR] = lC;
25016
- this[LENGTH] = 0;
25017
- this[LRU_LIST].forEach(hit => {
25018
- hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
25019
- this[LENGTH] += hit.length;
25020
- });
24686
+ const debug = debug_1;
24687
+ const {
24688
+ MAX_LENGTH,
24689
+ MAX_SAFE_INTEGER
24690
+ } = constants;
24691
+ const {
24692
+ safeRe: re,
24693
+ t
24694
+ } = reExports;
24695
+ const parseOptions = parseOptions_1;
24696
+ const {
24697
+ compareIdentifiers
24698
+ } = identifiers;
24699
+ let SemVer$1 = class SemVer {
24700
+ constructor(version, options) {
24701
+ options = parseOptions(options);
24702
+ if (version instanceof SemVer) {
24703
+ if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
24704
+ return version;
24705
+ } else {
24706
+ version = version.version;
25021
24707
  }
25022
- trim(this);
25023
- }
25024
- get lengthCalculator() {
25025
- return this[LENGTH_CALCULATOR];
25026
- }
25027
- get length() {
25028
- return this[LENGTH];
24708
+ } else if (typeof version !== 'string') {
24709
+ throw new TypeError("Invalid version. Must be a string. Got type \"".concat(typeof version, "\"."));
25029
24710
  }
25030
- get itemCount() {
25031
- return this[LRU_LIST].length;
24711
+ if (version.length > MAX_LENGTH) {
24712
+ throw new TypeError("version is longer than ".concat(MAX_LENGTH, " characters"));
25032
24713
  }
25033
- rforEach(fn, thisp) {
25034
- thisp = thisp || this;
25035
- for (let walker = this[LRU_LIST].tail; walker !== null;) {
25036
- const prev = walker.prev;
25037
- forEachStep(this, fn, walker, thisp);
25038
- walker = prev;
25039
- }
24714
+ debug('SemVer', version, options);
24715
+ this.options = options;
24716
+ this.loose = !!options.loose;
24717
+ // this isn't actually relevant for versions, but keep it so that we
24718
+ // don't run into trouble passing this.options around.
24719
+ this.includePrerelease = !!options.includePrerelease;
24720
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
24721
+ if (!m) {
24722
+ throw new TypeError("Invalid Version: ".concat(version));
25040
24723
  }
25041
- forEach(fn, thisp) {
25042
- thisp = thisp || this;
25043
- for (let walker = this[LRU_LIST].head; walker !== null;) {
25044
- const next = walker.next;
25045
- forEachStep(this, fn, walker, thisp);
25046
- walker = next;
25047
- }
24724
+ this.raw = version;
24725
+
24726
+ // these are actually numbers
24727
+ this.major = +m[1];
24728
+ this.minor = +m[2];
24729
+ this.patch = +m[3];
24730
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
24731
+ throw new TypeError('Invalid major version');
25048
24732
  }
25049
- keys() {
25050
- return this[LRU_LIST].toArray().map(k => k.key);
24733
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
24734
+ throw new TypeError('Invalid minor version');
25051
24735
  }
25052
- values() {
25053
- return this[LRU_LIST].toArray().map(k => k.value);
24736
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
24737
+ throw new TypeError('Invalid patch version');
25054
24738
  }
25055
- reset() {
25056
- if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
25057
- this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));
25058
- }
25059
- this[CACHE] = new Map(); // hash of items by key
25060
- this[LRU_LIST] = new Yallist(); // list of items in order of use recency
25061
- this[LENGTH] = 0; // length of items in the list
25062
- }
25063
-
25064
- dump() {
25065
- return this[LRU_LIST].map(hit => isStale(this, hit) ? false : {
25066
- k: hit.key,
25067
- v: hit.value,
25068
- e: hit.now + (hit.maxAge || 0)
25069
- }).toArray().filter(h => h);
25070
- }
25071
- dumpLru() {
25072
- return this[LRU_LIST];
25073
- }
25074
- set(key, value, maxAge) {
25075
- maxAge = maxAge || this[MAX_AGE];
25076
- if (maxAge && typeof maxAge !== 'number') throw new TypeError('maxAge must be a number');
25077
- const now = maxAge ? Date.now() : 0;
25078
- const len = this[LENGTH_CALCULATOR](value, key);
25079
- if (this[CACHE].has(key)) {
25080
- if (len > this[MAX]) {
25081
- del(this, this[CACHE].get(key));
25082
- return false;
25083
- }
25084
- const node = this[CACHE].get(key);
25085
- const item = node.value;
25086
-
25087
- // dispose of the old one before overwriting
25088
- // split out into 2 ifs for better coverage tracking
25089
- if (this[DISPOSE]) {
25090
- if (!this[NO_DISPOSE_ON_SET]) this[DISPOSE](key, item.value);
25091
- }
25092
- item.now = now;
25093
- item.maxAge = maxAge;
25094
- item.value = value;
25095
- this[LENGTH] += len - item.length;
25096
- item.length = len;
25097
- this.get(key);
25098
- trim(this);
25099
- return true;
25100
- }
25101
- const hit = new Entry(key, value, len, now, maxAge);
25102
24739
 
25103
- // oversized objects fall out of cache automatically.
25104
- if (hit.length > this[MAX]) {
25105
- if (this[DISPOSE]) this[DISPOSE](key, value);
25106
- return false;
25107
- }
25108
- this[LENGTH] += hit.length;
25109
- this[LRU_LIST].unshift(hit);
25110
- this[CACHE].set(key, this[LRU_LIST].head);
25111
- trim(this);
25112
- return true;
25113
- }
25114
- has(key) {
25115
- if (!this[CACHE].has(key)) return false;
25116
- const hit = this[CACHE].get(key).value;
25117
- return !isStale(this, hit);
25118
- }
25119
- get(key) {
25120
- return get(this, key, true);
25121
- }
25122
- peek(key) {
25123
- return get(this, key, false);
25124
- }
25125
- pop() {
25126
- const node = this[LRU_LIST].tail;
25127
- if (!node) return null;
25128
- del(this, node);
25129
- return node.value;
25130
- }
25131
- del(key) {
25132
- del(this, this[CACHE].get(key));
25133
- }
25134
- load(arr) {
25135
- // reset the cache
25136
- this.reset();
25137
- const now = Date.now();
25138
- // A previous serialized cache has the most recent items first
25139
- for (let l = arr.length - 1; l >= 0; l--) {
25140
- const hit = arr[l];
25141
- const expiresAt = hit.e || 0;
25142
- if (expiresAt === 0)
25143
- // the item was created without expiration in a non aged cache
25144
- this.set(hit.k, hit.v);else {
25145
- const maxAge = expiresAt - now;
25146
- // dont add already expired items
25147
- if (maxAge > 0) {
25148
- this.set(hit.k, hit.v, maxAge);
24740
+ // numberify any prerelease numeric ids
24741
+ if (!m[4]) {
24742
+ this.prerelease = [];
24743
+ } else {
24744
+ this.prerelease = m[4].split('.').map(id => {
24745
+ if (/^[0-9]+$/.test(id)) {
24746
+ const num = +id;
24747
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
24748
+ return num;
25149
24749
  }
25150
24750
  }
25151
- }
25152
- }
25153
- prune() {
25154
- this[CACHE].forEach((value, key) => get(this, key, false));
24751
+ return id;
24752
+ });
25155
24753
  }
24754
+ this.build = m[5] ? m[5].split('.') : [];
24755
+ this.format();
25156
24756
  }
25157
- const get = (self, key, doUse) => {
25158
- const node = self[CACHE].get(key);
25159
- if (node) {
25160
- const hit = node.value;
25161
- if (isStale(self, hit)) {
25162
- del(self, node);
25163
- if (!self[ALLOW_STALE]) return undefined;
25164
- } else {
25165
- if (doUse) {
25166
- if (self[UPDATE_AGE_ON_GET]) node.value.now = Date.now();
25167
- self[LRU_LIST].unshiftNode(node);
25168
- }
25169
- }
25170
- return hit.value;
24757
+ format() {
24758
+ this.version = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch);
24759
+ if (this.prerelease.length) {
24760
+ this.version += "-".concat(this.prerelease.join('.'));
25171
24761
  }
25172
- };
25173
- const isStale = (self, hit) => {
25174
- if (!hit || !hit.maxAge && !self[MAX_AGE]) return false;
25175
- const diff = Date.now() - hit.now;
25176
- return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE];
25177
- };
25178
- const trim = self => {
25179
- if (self[LENGTH] > self[MAX]) {
25180
- for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) {
25181
- // We know that we're about to delete this one, and also
25182
- // what the next least recently used key will be, so just
25183
- // go ahead and set it now.
25184
- const prev = walker.prev;
25185
- del(self, walker);
25186
- walker = prev;
24762
+ return this.version;
24763
+ }
24764
+ toString() {
24765
+ return this.version;
24766
+ }
24767
+ compare(other) {
24768
+ debug('SemVer.compare', this.version, this.options, other);
24769
+ if (!(other instanceof SemVer)) {
24770
+ if (typeof other === 'string' && other === this.version) {
24771
+ return 0;
25187
24772
  }
24773
+ other = new SemVer(other, this.options);
25188
24774
  }
25189
- };
25190
- const del = (self, node) => {
25191
- if (node) {
25192
- const hit = node.value;
25193
- if (self[DISPOSE]) self[DISPOSE](hit.key, hit.value);
25194
- self[LENGTH] -= hit.length;
25195
- self[CACHE].delete(hit.key);
25196
- self[LRU_LIST].removeNode(node);
24775
+ if (other.version === this.version) {
24776
+ return 0;
25197
24777
  }
25198
- };
25199
- class Entry {
25200
- constructor(key, value, length, now, maxAge) {
25201
- this.key = key;
25202
- this.value = value;
25203
- this.length = length;
25204
- this.now = now;
25205
- this.maxAge = maxAge || 0;
24778
+ return this.compareMain(other) || this.comparePre(other);
24779
+ }
24780
+ compareMain(other) {
24781
+ if (!(other instanceof SemVer)) {
24782
+ other = new SemVer(other, this.options);
25206
24783
  }
24784
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
25207
24785
  }
25208
- const forEachStep = (self, fn, node, thisp) => {
25209
- let hit = node.value;
25210
- if (isStale(self, hit)) {
25211
- del(self, node);
25212
- if (!self[ALLOW_STALE]) hit = undefined;
24786
+ comparePre(other) {
24787
+ if (!(other instanceof SemVer)) {
24788
+ other = new SemVer(other, this.options);
25213
24789
  }
25214
- if (hit) fn.call(thisp, hit.value, hit.key, self);
25215
- };
25216
- lruCache = LRUCache;
25217
- return lruCache;
25218
- }
25219
24790
 
25220
- var range;
25221
- var hasRequiredRange;
25222
- function requireRange() {
25223
- if (hasRequiredRange) return range;
25224
- hasRequiredRange = 1;
25225
- // hoisted class for cyclic dependency
25226
- class Range {
25227
- constructor(range, options) {
25228
- options = parseOptions(options);
25229
- if (range instanceof Range) {
25230
- if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
25231
- return range;
25232
- } else {
25233
- return new Range(range.raw, options);
25234
- }
25235
- }
25236
- if (range instanceof Comparator) {
25237
- // just put it in the set and return
25238
- this.raw = range.value;
25239
- this.set = [[range]];
25240
- this.format();
25241
- return this;
24791
+ // NOT having a prerelease is > having one
24792
+ if (this.prerelease.length && !other.prerelease.length) {
24793
+ return -1;
24794
+ } else if (!this.prerelease.length && other.prerelease.length) {
24795
+ return 1;
24796
+ } else if (!this.prerelease.length && !other.prerelease.length) {
24797
+ return 0;
24798
+ }
24799
+ let i = 0;
24800
+ do {
24801
+ const a = this.prerelease[i];
24802
+ const b = other.prerelease[i];
24803
+ debug('prerelease compare', i, a, b);
24804
+ if (a === undefined && b === undefined) {
24805
+ return 0;
24806
+ } else if (b === undefined) {
24807
+ return 1;
24808
+ } else if (a === undefined) {
24809
+ return -1;
24810
+ } else if (a === b) {
24811
+ continue;
24812
+ } else {
24813
+ return compareIdentifiers(a, b);
25242
24814
  }
25243
- this.options = options;
25244
- this.loose = !!options.loose;
25245
- this.includePrerelease = !!options.includePrerelease;
25246
-
25247
- // First reduce all whitespace as much as possible so we do not have to rely
25248
- // on potentially slow regexes like \s*. This is then stored and used for
25249
- // future error messages as well.
25250
- this.raw = range.trim().split(/\s+/).join(' ');
25251
-
25252
- // First, split on ||
25253
- this.set = this.raw.split('||')
25254
- // map the range to a 2d array of comparators
25255
- .map(r => this.parseRange(r.trim()))
25256
- // throw out any comparator lists that are empty
25257
- // this generally means that it was not a valid range, which is allowed
25258
- // in loose mode, but will still throw if the WHOLE range is invalid.
25259
- .filter(c => c.length);
25260
- if (!this.set.length) {
25261
- throw new TypeError("Invalid SemVer Range: ".concat(this.raw));
24815
+ } while (++i);
24816
+ }
24817
+ compareBuild(other) {
24818
+ if (!(other instanceof SemVer)) {
24819
+ other = new SemVer(other, this.options);
24820
+ }
24821
+ let i = 0;
24822
+ do {
24823
+ const a = this.build[i];
24824
+ const b = other.build[i];
24825
+ debug('prerelease compare', i, a, b);
24826
+ if (a === undefined && b === undefined) {
24827
+ return 0;
24828
+ } else if (b === undefined) {
24829
+ return 1;
24830
+ } else if (a === undefined) {
24831
+ return -1;
24832
+ } else if (a === b) {
24833
+ continue;
24834
+ } else {
24835
+ return compareIdentifiers(a, b);
25262
24836
  }
24837
+ } while (++i);
24838
+ }
25263
24839
 
25264
- // if we have any that are not the null set, throw out null sets.
25265
- if (this.set.length > 1) {
25266
- // keep the first one, in case they're all null sets
25267
- const first = this.set[0];
25268
- this.set = this.set.filter(c => !isNullSet(c[0]));
25269
- if (this.set.length === 0) {
25270
- this.set = [first];
25271
- } else if (this.set.length > 1) {
25272
- // if we have any that are *, then the range is just *
25273
- for (const c of this.set) {
25274
- if (c.length === 1 && isAny(c[0])) {
25275
- this.set = [c];
25276
- break;
24840
+ // preminor will bump the version up to the next minor release, and immediately
24841
+ // down to pre-release. premajor and prepatch work the same way.
24842
+ inc(release, identifier, identifierBase) {
24843
+ switch (release) {
24844
+ case 'premajor':
24845
+ this.prerelease.length = 0;
24846
+ this.patch = 0;
24847
+ this.minor = 0;
24848
+ this.major++;
24849
+ this.inc('pre', identifier, identifierBase);
24850
+ break;
24851
+ case 'preminor':
24852
+ this.prerelease.length = 0;
24853
+ this.patch = 0;
24854
+ this.minor++;
24855
+ this.inc('pre', identifier, identifierBase);
24856
+ break;
24857
+ case 'prepatch':
24858
+ // If this is already a prerelease, it will bump to the next version
24859
+ // drop any prereleases that might already exist, since they are not
24860
+ // relevant at this point.
24861
+ this.prerelease.length = 0;
24862
+ this.inc('patch', identifier, identifierBase);
24863
+ this.inc('pre', identifier, identifierBase);
24864
+ break;
24865
+ // If the input is a non-prerelease version, this acts the same as
24866
+ // prepatch.
24867
+ case 'prerelease':
24868
+ if (this.prerelease.length === 0) {
24869
+ this.inc('patch', identifier, identifierBase);
24870
+ }
24871
+ this.inc('pre', identifier, identifierBase);
24872
+ break;
24873
+ case 'major':
24874
+ // If this is a pre-major version, bump up to the same major version.
24875
+ // Otherwise increment major.
24876
+ // 1.0.0-5 bumps to 1.0.0
24877
+ // 1.1.0 bumps to 2.0.0
24878
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
24879
+ this.major++;
24880
+ }
24881
+ this.minor = 0;
24882
+ this.patch = 0;
24883
+ this.prerelease = [];
24884
+ break;
24885
+ case 'minor':
24886
+ // If this is a pre-minor version, bump up to the same minor version.
24887
+ // Otherwise increment minor.
24888
+ // 1.2.0-5 bumps to 1.2.0
24889
+ // 1.2.1 bumps to 1.3.0
24890
+ if (this.patch !== 0 || this.prerelease.length === 0) {
24891
+ this.minor++;
24892
+ }
24893
+ this.patch = 0;
24894
+ this.prerelease = [];
24895
+ break;
24896
+ case 'patch':
24897
+ // If this is not a pre-release version, it will increment the patch.
24898
+ // If it is a pre-release it will bump up to the same patch version.
24899
+ // 1.2.0-5 patches to 1.2.0
24900
+ // 1.2.0 patches to 1.2.1
24901
+ if (this.prerelease.length === 0) {
24902
+ this.patch++;
24903
+ }
24904
+ this.prerelease = [];
24905
+ break;
24906
+ // This probably shouldn't be used publicly.
24907
+ // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
24908
+ case 'pre':
24909
+ {
24910
+ const base = Number(identifierBase) ? 1 : 0;
24911
+ if (!identifier && identifierBase === false) {
24912
+ throw new Error('invalid increment argument: identifier is empty');
24913
+ }
24914
+ if (this.prerelease.length === 0) {
24915
+ this.prerelease = [base];
24916
+ } else {
24917
+ let i = this.prerelease.length;
24918
+ while (--i >= 0) {
24919
+ if (typeof this.prerelease[i] === 'number') {
24920
+ this.prerelease[i]++;
24921
+ i = -2;
24922
+ }
24923
+ }
24924
+ if (i === -1) {
24925
+ // didn't increment anything
24926
+ if (identifier === this.prerelease.join('.') && identifierBase === false) {
24927
+ throw new Error('invalid increment argument: identifier already exists');
24928
+ }
24929
+ this.prerelease.push(base);
24930
+ }
24931
+ }
24932
+ if (identifier) {
24933
+ // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
24934
+ // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
24935
+ let prerelease = [identifier, base];
24936
+ if (identifierBase === false) {
24937
+ prerelease = [identifier];
24938
+ }
24939
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
24940
+ if (isNaN(this.prerelease[1])) {
24941
+ this.prerelease = prerelease;
24942
+ }
24943
+ } else {
24944
+ this.prerelease = prerelease;
25277
24945
  }
25278
24946
  }
24947
+ break;
25279
24948
  }
25280
- }
25281
- this.format();
24949
+ default:
24950
+ throw new Error("invalid increment argument: ".concat(release));
25282
24951
  }
25283
- format() {
25284
- this.range = this.set.map(comps => comps.join(' ').trim()).join('||').trim();
25285
- return this.range;
25286
- }
25287
- toString() {
25288
- return this.range;
25289
- }
25290
- parseRange(range) {
25291
- // memoize range parsing for performance.
25292
- // this is a very hot path, and fully deterministic.
25293
- const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
25294
- const memoKey = memoOpts + ':' + range;
25295
- const cached = cache.get(memoKey);
25296
- if (cached) {
25297
- return cached;
25298
- }
25299
- const loose = this.options.loose;
25300
- // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
25301
- const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
25302
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
25303
- debug('hyphen replace', range);
25304
-
25305
- // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
25306
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
25307
- debug('comparator trim', range);
25308
-
25309
- // `~ 1.2.3` => `~1.2.3`
25310
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
25311
- debug('tilde trim', range);
25312
-
25313
- // `^ 1.2.3` => `^1.2.3`
25314
- range = range.replace(re[t.CARETTRIM], caretTrimReplace);
25315
- debug('caret trim', range);
25316
-
25317
- // At this point, the range is completely trimmed and
25318
- // ready to be split into comparators.
25319
-
25320
- let rangeList = range.split(' ').map(comp => parseComparator(comp, this.options)).join(' ').split(/\s+/)
25321
- // >=0.0.0 is equivalent to *
25322
- .map(comp => replaceGTE0(comp, this.options));
25323
- if (loose) {
25324
- // in loose mode, throw out any that are not valid comparators
25325
- rangeList = rangeList.filter(comp => {
25326
- debug('loose invalid filter', comp, this.options);
25327
- return !!comp.match(re[t.COMPARATORLOOSE]);
25328
- });
25329
- }
25330
- debug('range list', rangeList);
25331
-
25332
- // if any comparators are the null set, then replace with JUST null set
25333
- // if more than one comparator, remove any * comparators
25334
- // also, don't include the same comparator more than once
25335
- const rangeMap = new Map();
25336
- const comparators = rangeList.map(comp => new Comparator(comp, this.options));
25337
- for (const comp of comparators) {
25338
- if (isNullSet(comp)) {
25339
- return [comp];
25340
- }
25341
- rangeMap.set(comp.value, comp);
25342
- }
25343
- if (rangeMap.size > 1 && rangeMap.has('')) {
25344
- rangeMap.delete('');
25345
- }
25346
- const result = [...rangeMap.values()];
25347
- cache.set(memoKey, result);
25348
- return result;
25349
- }
25350
- intersects(range, options) {
25351
- if (!(range instanceof Range)) {
25352
- throw new TypeError('a Range is required');
25353
- }
25354
- return this.set.some(thisComparators => {
25355
- return isSatisfiable(thisComparators, options) && range.set.some(rangeComparators => {
25356
- return isSatisfiable(rangeComparators, options) && thisComparators.every(thisComparator => {
25357
- return rangeComparators.every(rangeComparator => {
25358
- return thisComparator.intersects(rangeComparator, options);
25359
- });
25360
- });
25361
- });
25362
- });
25363
- }
25364
-
25365
- // if ANY of the sets match ALL of its comparators, then pass
25366
- test(version) {
25367
- if (!version) {
25368
- return false;
25369
- }
25370
- if (typeof version === 'string') {
25371
- try {
25372
- version = new SemVer(version, this.options);
25373
- } catch (er) {
25374
- return false;
25375
- }
25376
- }
25377
- for (let i = 0; i < this.set.length; i++) {
25378
- if (testSet(this.set[i], version, this.options)) {
25379
- return true;
25380
- }
25381
- }
25382
- return false;
24952
+ this.raw = this.format();
24953
+ if (this.build.length) {
24954
+ this.raw += "+".concat(this.build.join('.'));
25383
24955
  }
24956
+ return this;
25384
24957
  }
25385
- range = Range;
25386
- const LRU = requireLruCache();
25387
- const cache = new LRU({
25388
- max: 1000
25389
- });
25390
- const parseOptions = parseOptions_1;
25391
- const Comparator = requireComparator();
25392
- const debug = debug_1;
25393
- const SemVer = semver$1;
25394
- const {
25395
- safeRe: re,
25396
- t,
25397
- comparatorTrimReplace,
25398
- tildeTrimReplace,
25399
- caretTrimReplace
25400
- } = reExports;
25401
- const {
25402
- FLAG_INCLUDE_PRERELEASE,
25403
- FLAG_LOOSE
25404
- } = constants$1;
25405
- const isNullSet = c => c.value === '<0.0.0-0';
25406
- const isAny = c => c.value === '';
24958
+ };
24959
+ var semver = SemVer$1;
25407
24960
 
25408
- // take a set of comparators and determine whether there
25409
- // exists a version which can satisfy it
25410
- const isSatisfiable = (comparators, options) => {
25411
- let result = true;
25412
- const remainingComparators = comparators.slice();
25413
- let testComparator = remainingComparators.pop();
25414
- while (result && remainingComparators.length) {
25415
- result = remainingComparators.every(otherComparator => {
25416
- return testComparator.intersects(otherComparator, options);
25417
- });
25418
- testComparator = remainingComparators.pop();
25419
- }
25420
- return result;
25421
- };
24961
+ const SemVer = semver;
24962
+ const compare$6 = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
24963
+ var compare_1 = compare$6;
25422
24964
 
25423
- // comprised of xranges, tildes, stars, and gtlt's at this point.
25424
- // already replaced the hyphen ranges
25425
- // turn into a set of JUST comparators.
25426
- const parseComparator = (comp, options) => {
25427
- debug('comp', comp, options);
25428
- comp = replaceCarets(comp, options);
25429
- debug('caret', comp);
25430
- comp = replaceTildes(comp, options);
25431
- debug('tildes', comp);
25432
- comp = replaceXRanges(comp, options);
25433
- debug('xrange', comp);
25434
- comp = replaceStars(comp, options);
25435
- debug('stars', comp);
25436
- return comp;
25437
- };
25438
- const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
24965
+ const compare$5 = compare_1;
24966
+ const eq$1 = (a, b, loose) => compare$5(a, b, loose) === 0;
24967
+ var eq_1 = eq$1;
25439
24968
 
25440
- // ~, ~> --> * (any, kinda silly)
25441
- // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
25442
- // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
25443
- // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
25444
- // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
25445
- // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
25446
- // ~0.0.1 --> >=0.0.1 <0.1.0-0
25447
- const replaceTildes = (comp, options) => {
25448
- return comp.trim().split(/\s+/).map(c => replaceTilde(c, options)).join(' ');
25449
- };
25450
- const replaceTilde = (comp, options) => {
25451
- const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
25452
- return comp.replace(r, (_, M, m, p, pr) => {
25453
- debug('tilde', comp, _, M, m, p, pr);
25454
- let ret;
25455
- if (isX(M)) {
25456
- ret = '';
25457
- } else if (isX(m)) {
25458
- ret = ">=".concat(M, ".0.0 <").concat(+M + 1, ".0.0-0");
25459
- } else if (isX(p)) {
25460
- // ~1.2 == >=1.2.0 <1.3.0-0
25461
- ret = ">=".concat(M, ".").concat(m, ".0 <").concat(M, ".").concat(+m + 1, ".0-0");
25462
- } else if (pr) {
25463
- debug('replaceTilde pr', pr);
25464
- ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
25465
- } else {
25466
- // ~1.2.3 == >=1.2.3 <1.3.0-0
25467
- ret = ">=".concat(M, ".").concat(m, ".").concat(p, " <").concat(M, ".").concat(+m + 1, ".0-0");
25468
- }
25469
- debug('tilde return', ret);
25470
- return ret;
25471
- });
25472
- };
24969
+ const compare$4 = compare_1;
24970
+ const neq$1 = (a, b, loose) => compare$4(a, b, loose) !== 0;
24971
+ var neq_1 = neq$1;
25473
24972
 
25474
- // ^ --> * (any, kinda silly)
25475
- // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
25476
- // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
25477
- // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
25478
- // ^1.2.3 --> >=1.2.3 <2.0.0-0
25479
- // ^1.2.0 --> >=1.2.0 <2.0.0-0
25480
- // ^0.0.1 --> >=0.0.1 <0.0.2-0
25481
- // ^0.1.0 --> >=0.1.0 <0.2.0-0
25482
- const replaceCarets = (comp, options) => {
25483
- return comp.trim().split(/\s+/).map(c => replaceCaret(c, options)).join(' ');
25484
- };
25485
- const replaceCaret = (comp, options) => {
25486
- debug('caret', comp, options);
25487
- const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
25488
- const z = options.includePrerelease ? '-0' : '';
25489
- return comp.replace(r, (_, M, m, p, pr) => {
25490
- debug('caret', comp, _, M, m, p, pr);
25491
- let ret;
25492
- if (isX(M)) {
25493
- ret = '';
25494
- } else if (isX(m)) {
25495
- ret = ">=".concat(M, ".0.0").concat(z, " <").concat(+M + 1, ".0.0-0");
25496
- } else if (isX(p)) {
25497
- if (M === '0') {
25498
- ret = ">=".concat(M, ".").concat(m, ".0").concat(z, " <").concat(M, ".").concat(+m + 1, ".0-0");
25499
- } else {
25500
- ret = ">=".concat(M, ".").concat(m, ".0").concat(z, " <").concat(+M + 1, ".0.0-0");
25501
- }
25502
- } else if (pr) {
25503
- debug('replaceCaret pr', pr);
25504
- if (M === '0') {
25505
- if (m === '0') {
25506
- ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(m, ".").concat(+p + 1, "-0");
25507
- } else {
25508
- ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
25509
- }
25510
- } else {
25511
- ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(+M + 1, ".0.0-0");
25512
- }
25513
- } else {
25514
- debug('no pr');
25515
- if (M === '0') {
25516
- if (m === '0') {
25517
- ret = ">=".concat(M, ".").concat(m, ".").concat(p).concat(z, " <").concat(M, ".").concat(m, ".").concat(+p + 1, "-0");
25518
- } else {
25519
- ret = ">=".concat(M, ".").concat(m, ".").concat(p).concat(z, " <").concat(M, ".").concat(+m + 1, ".0-0");
25520
- }
25521
- } else {
25522
- ret = ">=".concat(M, ".").concat(m, ".").concat(p, " <").concat(+M + 1, ".0.0-0");
25523
- }
25524
- }
25525
- debug('caret return', ret);
25526
- return ret;
25527
- });
25528
- };
25529
- const replaceXRanges = (comp, options) => {
25530
- debug('replaceXRanges', comp, options);
25531
- return comp.split(/\s+/).map(c => replaceXRange(c, options)).join(' ');
25532
- };
25533
- const replaceXRange = (comp, options) => {
25534
- comp = comp.trim();
25535
- const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
25536
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
25537
- debug('xRange', comp, ret, gtlt, M, m, p, pr);
25538
- const xM = isX(M);
25539
- const xm = xM || isX(m);
25540
- const xp = xm || isX(p);
25541
- const anyX = xp;
25542
- if (gtlt === '=' && anyX) {
25543
- gtlt = '';
25544
- }
24973
+ const compare$3 = compare_1;
24974
+ const gt$1 = (a, b, loose) => compare$3(a, b, loose) > 0;
24975
+ var gt_1 = gt$1;
25545
24976
 
25546
- // if we're including prereleases in the match, then we need
25547
- // to fix this to -0, the lowest possible prerelease value
25548
- pr = options.includePrerelease ? '-0' : '';
25549
- if (xM) {
25550
- if (gtlt === '>' || gtlt === '<') {
25551
- // nothing is allowed
25552
- ret = '<0.0.0-0';
25553
- } else {
25554
- // nothing is forbidden
25555
- ret = '*';
25556
- }
25557
- } else if (gtlt && anyX) {
25558
- // we know patch is an x, because we have any x at all.
25559
- // replace X with 0
25560
- if (xm) {
25561
- m = 0;
25562
- }
25563
- p = 0;
25564
- if (gtlt === '>') {
25565
- // >1 => >=2.0.0
25566
- // >1.2 => >=1.3.0
25567
- gtlt = '>=';
25568
- if (xm) {
25569
- M = +M + 1;
25570
- m = 0;
25571
- p = 0;
25572
- } else {
25573
- m = +m + 1;
25574
- p = 0;
25575
- }
25576
- } else if (gtlt === '<=') {
25577
- // <=0.7.x is actually <0.8.0, since any 0.7.x should
25578
- // pass. Similarly, <=7.x is actually <8.0.0, etc.
25579
- gtlt = '<';
25580
- if (xm) {
25581
- M = +M + 1;
25582
- } else {
25583
- m = +m + 1;
25584
- }
25585
- }
25586
- if (gtlt === '<') {
25587
- pr = '-0';
25588
- }
25589
- ret = "".concat(gtlt + M, ".").concat(m, ".").concat(p).concat(pr);
25590
- } else if (xm) {
25591
- ret = ">=".concat(M, ".0.0").concat(pr, " <").concat(+M + 1, ".0.0-0");
25592
- } else if (xp) {
25593
- ret = ">=".concat(M, ".").concat(m, ".0").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
25594
- }
25595
- debug('xRange return', ret);
25596
- return ret;
25597
- });
25598
- };
24977
+ const compare$2 = compare_1;
24978
+ const gte$1 = (a, b, loose) => compare$2(a, b, loose) >= 0;
24979
+ var gte_1 = gte$1;
25599
24980
 
25600
- // Because * is AND-ed with everything else in the comparator,
25601
- // and '' means "any version", just remove the *s entirely.
25602
- const replaceStars = (comp, options) => {
25603
- debug('replaceStars', comp, options);
25604
- // Looseness is ignored here. star is always as loose as it gets!
25605
- return comp.trim().replace(re[t.STAR], '');
25606
- };
25607
- const replaceGTE0 = (comp, options) => {
25608
- debug('replaceGTE0', comp, options);
25609
- return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '');
25610
- };
24981
+ const compare$1 = compare_1;
24982
+ const lt$1 = (a, b, loose) => compare$1(a, b, loose) < 0;
24983
+ var lt_1 = lt$1;
25611
24984
 
25612
- // This function is passed to string.replace(re[t.HYPHENRANGE])
25613
- // M, m, patch, prerelease, build
25614
- // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
25615
- // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
25616
- // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
25617
- const hyphenReplace = incPr => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
25618
- if (isX(fM)) {
25619
- from = '';
25620
- } else if (isX(fm)) {
25621
- from = ">=".concat(fM, ".0.0").concat(incPr ? '-0' : '');
25622
- } else if (isX(fp)) {
25623
- from = ">=".concat(fM, ".").concat(fm, ".0").concat(incPr ? '-0' : '');
25624
- } else if (fpr) {
25625
- from = ">=".concat(from);
25626
- } else {
25627
- from = ">=".concat(from).concat(incPr ? '-0' : '');
25628
- }
25629
- if (isX(tM)) {
25630
- to = '';
25631
- } else if (isX(tm)) {
25632
- to = "<".concat(+tM + 1, ".0.0-0");
25633
- } else if (isX(tp)) {
25634
- to = "<".concat(tM, ".").concat(+tm + 1, ".0-0");
25635
- } else if (tpr) {
25636
- to = "<=".concat(tM, ".").concat(tm, ".").concat(tp, "-").concat(tpr);
25637
- } else if (incPr) {
25638
- to = "<".concat(tM, ".").concat(tm, ".").concat(+tp + 1, "-0");
25639
- } else {
25640
- to = "<=".concat(to);
25641
- }
25642
- return "".concat(from, " ").concat(to).trim();
25643
- };
25644
- const testSet = (set, version, options) => {
25645
- for (let i = 0; i < set.length; i++) {
25646
- if (!set[i].test(version)) {
25647
- return false;
25648
- }
25649
- }
25650
- if (version.prerelease.length && !options.includePrerelease) {
25651
- // Find the set of versions that are allowed to have prereleases
25652
- // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
25653
- // That should allow `1.2.3-pr.2` to pass.
25654
- // However, `1.2.4-alpha.notready` should NOT be allowed,
25655
- // even though it's within the range set by the comparators.
25656
- for (let i = 0; i < set.length; i++) {
25657
- debug(set[i].semver);
25658
- if (set[i].semver === Comparator.ANY) {
25659
- continue;
25660
- }
25661
- if (set[i].semver.prerelease.length > 0) {
25662
- const allowed = set[i].semver;
25663
- if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
25664
- return true;
25665
- }
25666
- }
24985
+ const compare = compare_1;
24986
+ const lte$1 = (a, b, loose) => compare(a, b, loose) <= 0;
24987
+ var lte_1 = lte$1;
24988
+
24989
+ const eq = eq_1;
24990
+ const neq = neq_1;
24991
+ const gt = gt_1;
24992
+ const gte = gte_1;
24993
+ const lt = lt_1;
24994
+ const lte = lte_1;
24995
+ const cmp = (a, op, b, loose) => {
24996
+ switch (op) {
24997
+ case '===':
24998
+ if (typeof a === 'object') {
24999
+ a = a.version;
25667
25000
  }
25668
-
25669
- // Version has a -pre, but it's not one of the ones we like.
25670
- return false;
25671
- }
25672
- return true;
25673
- };
25674
- return range;
25675
- }
25001
+ if (typeof b === 'object') {
25002
+ b = b.version;
25003
+ }
25004
+ return a === b;
25005
+ case '!==':
25006
+ if (typeof a === 'object') {
25007
+ a = a.version;
25008
+ }
25009
+ if (typeof b === 'object') {
25010
+ b = b.version;
25011
+ }
25012
+ return a !== b;
25013
+ case '':
25014
+ case '=':
25015
+ case '==':
25016
+ return eq(a, b, loose);
25017
+ case '!=':
25018
+ return neq(a, b, loose);
25019
+ case '>':
25020
+ return gt(a, b, loose);
25021
+ case '>=':
25022
+ return gte(a, b, loose);
25023
+ case '<':
25024
+ return lt(a, b, loose);
25025
+ case '<=':
25026
+ return lte(a, b, loose);
25027
+ default:
25028
+ throw new TypeError("Invalid operator: ".concat(op));
25029
+ }
25030
+ };
25031
+ var cmp_1 = cmp;
25676
25032
 
25677
25033
  var comparator;
25678
25034
  var hasRequiredComparator;
@@ -25694,43 +25050,263 @@ function requireComparator() {
25694
25050
  comp = comp.value;
25695
25051
  }
25696
25052
  }
25697
- comp = comp.trim().split(/\s+/).join(' ');
25698
- debug('comparator', comp, options);
25699
- this.options = options;
25700
- this.loose = !!options.loose;
25701
- this.parse(comp);
25702
- if (this.semver === ANY) {
25703
- this.value = '';
25704
- } else {
25705
- this.value = this.operator + this.semver.version;
25053
+ comp = comp.trim().split(/\s+/).join(' ');
25054
+ debug('comparator', comp, options);
25055
+ this.options = options;
25056
+ this.loose = !!options.loose;
25057
+ this.parse(comp);
25058
+ if (this.semver === ANY) {
25059
+ this.value = '';
25060
+ } else {
25061
+ this.value = this.operator + this.semver.version;
25062
+ }
25063
+ debug('comp', this);
25064
+ }
25065
+ parse(comp) {
25066
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
25067
+ const m = comp.match(r);
25068
+ if (!m) {
25069
+ throw new TypeError("Invalid comparator: ".concat(comp));
25070
+ }
25071
+ this.operator = m[1] !== undefined ? m[1] : '';
25072
+ if (this.operator === '=') {
25073
+ this.operator = '';
25074
+ }
25075
+
25076
+ // if it literally is just '>' or '' then allow anything.
25077
+ if (!m[2]) {
25078
+ this.semver = ANY;
25079
+ } else {
25080
+ this.semver = new SemVer(m[2], this.options.loose);
25081
+ }
25082
+ }
25083
+ toString() {
25084
+ return this.value;
25085
+ }
25086
+ test(version) {
25087
+ debug('Comparator.test', version, this.options.loose);
25088
+ if (this.semver === ANY || version === ANY) {
25089
+ return true;
25090
+ }
25091
+ if (typeof version === 'string') {
25092
+ try {
25093
+ version = new SemVer(version, this.options);
25094
+ } catch (er) {
25095
+ return false;
25096
+ }
25097
+ }
25098
+ return cmp(version, this.operator, this.semver, this.options);
25099
+ }
25100
+ intersects(comp, options) {
25101
+ if (!(comp instanceof Comparator)) {
25102
+ throw new TypeError('a Comparator is required');
25103
+ }
25104
+ if (this.operator === '') {
25105
+ if (this.value === '') {
25106
+ return true;
25107
+ }
25108
+ return new Range(comp.value, options).test(this.value);
25109
+ } else if (comp.operator === '') {
25110
+ if (comp.value === '') {
25111
+ return true;
25112
+ }
25113
+ return new Range(this.value, options).test(comp.semver);
25114
+ }
25115
+ options = parseOptions(options);
25116
+
25117
+ // Special cases where nothing can possibly be lower
25118
+ if (options.includePrerelease && (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
25119
+ return false;
25120
+ }
25121
+ if (!options.includePrerelease && (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
25122
+ return false;
25123
+ }
25124
+
25125
+ // Same direction increasing (> or >=)
25126
+ if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
25127
+ return true;
25128
+ }
25129
+ // Same direction decreasing (< or <=)
25130
+ if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
25131
+ return true;
25132
+ }
25133
+ // same SemVer and both sides are inclusive (<= or >=)
25134
+ if (this.semver.version === comp.semver.version && this.operator.includes('=') && comp.operator.includes('=')) {
25135
+ return true;
25136
+ }
25137
+ // opposite directions less than
25138
+ if (cmp(this.semver, '<', comp.semver, options) && this.operator.startsWith('>') && comp.operator.startsWith('<')) {
25139
+ return true;
25140
+ }
25141
+ // opposite directions greater than
25142
+ if (cmp(this.semver, '>', comp.semver, options) && this.operator.startsWith('<') && comp.operator.startsWith('>')) {
25143
+ return true;
25144
+ }
25145
+ return false;
25146
+ }
25147
+ }
25148
+ comparator = Comparator;
25149
+ const parseOptions = parseOptions_1;
25150
+ const {
25151
+ safeRe: re,
25152
+ t
25153
+ } = reExports;
25154
+ const cmp = cmp_1;
25155
+ const debug = debug_1;
25156
+ const SemVer = semver;
25157
+ const Range = requireRange();
25158
+ return comparator;
25159
+ }
25160
+
25161
+ var range;
25162
+ var hasRequiredRange;
25163
+ function requireRange() {
25164
+ if (hasRequiredRange) return range;
25165
+ hasRequiredRange = 1;
25166
+ // hoisted class for cyclic dependency
25167
+ class Range {
25168
+ constructor(range, options) {
25169
+ options = parseOptions(options);
25170
+ if (range instanceof Range) {
25171
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
25172
+ return range;
25173
+ } else {
25174
+ return new Range(range.raw, options);
25175
+ }
25176
+ }
25177
+ if (range instanceof Comparator) {
25178
+ // just put it in the set and return
25179
+ this.raw = range.value;
25180
+ this.set = [[range]];
25181
+ this.format();
25182
+ return this;
25183
+ }
25184
+ this.options = options;
25185
+ this.loose = !!options.loose;
25186
+ this.includePrerelease = !!options.includePrerelease;
25187
+
25188
+ // First reduce all whitespace as much as possible so we do not have to rely
25189
+ // on potentially slow regexes like \s*. This is then stored and used for
25190
+ // future error messages as well.
25191
+ this.raw = range.trim().split(/\s+/).join(' ');
25192
+
25193
+ // First, split on ||
25194
+ this.set = this.raw.split('||')
25195
+ // map the range to a 2d array of comparators
25196
+ .map(r => this.parseRange(r.trim()))
25197
+ // throw out any comparator lists that are empty
25198
+ // this generally means that it was not a valid range, which is allowed
25199
+ // in loose mode, but will still throw if the WHOLE range is invalid.
25200
+ .filter(c => c.length);
25201
+ if (!this.set.length) {
25202
+ throw new TypeError("Invalid SemVer Range: ".concat(this.raw));
25203
+ }
25204
+
25205
+ // if we have any that are not the null set, throw out null sets.
25206
+ if (this.set.length > 1) {
25207
+ // keep the first one, in case they're all null sets
25208
+ const first = this.set[0];
25209
+ this.set = this.set.filter(c => !isNullSet(c[0]));
25210
+ if (this.set.length === 0) {
25211
+ this.set = [first];
25212
+ } else if (this.set.length > 1) {
25213
+ // if we have any that are *, then the range is just *
25214
+ for (const c of this.set) {
25215
+ if (c.length === 1 && isAny(c[0])) {
25216
+ this.set = [c];
25217
+ break;
25218
+ }
25219
+ }
25220
+ }
25221
+ }
25222
+ this.format();
25223
+ }
25224
+ format() {
25225
+ this.range = this.set.map(comps => comps.join(' ').trim()).join('||').trim();
25226
+ return this.range;
25227
+ }
25228
+ toString() {
25229
+ return this.range;
25230
+ }
25231
+ parseRange(range) {
25232
+ // memoize range parsing for performance.
25233
+ // this is a very hot path, and fully deterministic.
25234
+ const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
25235
+ const memoKey = memoOpts + ':' + range;
25236
+ const cached = cache.get(memoKey);
25237
+ if (cached) {
25238
+ return cached;
25239
+ }
25240
+ const loose = this.options.loose;
25241
+ // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
25242
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
25243
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
25244
+ debug('hyphen replace', range);
25245
+
25246
+ // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
25247
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
25248
+ debug('comparator trim', range);
25249
+
25250
+ // `~ 1.2.3` => `~1.2.3`
25251
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
25252
+ debug('tilde trim', range);
25253
+
25254
+ // `^ 1.2.3` => `^1.2.3`
25255
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
25256
+ debug('caret trim', range);
25257
+
25258
+ // At this point, the range is completely trimmed and
25259
+ // ready to be split into comparators.
25260
+
25261
+ let rangeList = range.split(' ').map(comp => parseComparator(comp, this.options)).join(' ').split(/\s+/)
25262
+ // >=0.0.0 is equivalent to *
25263
+ .map(comp => replaceGTE0(comp, this.options));
25264
+ if (loose) {
25265
+ // in loose mode, throw out any that are not valid comparators
25266
+ rangeList = rangeList.filter(comp => {
25267
+ debug('loose invalid filter', comp, this.options);
25268
+ return !!comp.match(re[t.COMPARATORLOOSE]);
25269
+ });
25270
+ }
25271
+ debug('range list', rangeList);
25272
+
25273
+ // if any comparators are the null set, then replace with JUST null set
25274
+ // if more than one comparator, remove any * comparators
25275
+ // also, don't include the same comparator more than once
25276
+ const rangeMap = new Map();
25277
+ const comparators = rangeList.map(comp => new Comparator(comp, this.options));
25278
+ for (const comp of comparators) {
25279
+ if (isNullSet(comp)) {
25280
+ return [comp];
25281
+ }
25282
+ rangeMap.set(comp.value, comp);
25283
+ }
25284
+ if (rangeMap.size > 1 && rangeMap.has('')) {
25285
+ rangeMap.delete('');
25706
25286
  }
25707
- debug('comp', this);
25287
+ const result = [...rangeMap.values()];
25288
+ cache.set(memoKey, result);
25289
+ return result;
25708
25290
  }
25709
- parse(comp) {
25710
- const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
25711
- const m = comp.match(r);
25712
- if (!m) {
25713
- throw new TypeError("Invalid comparator: ".concat(comp));
25714
- }
25715
- this.operator = m[1] !== undefined ? m[1] : '';
25716
- if (this.operator === '=') {
25717
- this.operator = '';
25718
- }
25719
-
25720
- // if it literally is just '>' or '' then allow anything.
25721
- if (!m[2]) {
25722
- this.semver = ANY;
25723
- } else {
25724
- this.semver = new SemVer(m[2], this.options.loose);
25291
+ intersects(range, options) {
25292
+ if (!(range instanceof Range)) {
25293
+ throw new TypeError('a Range is required');
25725
25294
  }
25295
+ return this.set.some(thisComparators => {
25296
+ return isSatisfiable(thisComparators, options) && range.set.some(rangeComparators => {
25297
+ return isSatisfiable(rangeComparators, options) && thisComparators.every(thisComparator => {
25298
+ return rangeComparators.every(rangeComparator => {
25299
+ return thisComparator.intersects(rangeComparator, options);
25300
+ });
25301
+ });
25302
+ });
25303
+ });
25726
25304
  }
25727
- toString() {
25728
- return this.value;
25729
- }
25305
+
25306
+ // if ANY of the sets match ALL of its comparators, then pass
25730
25307
  test(version) {
25731
- debug('Comparator.test', version, this.options.loose);
25732
- if (this.semver === ANY || version === ANY) {
25733
- return true;
25308
+ if (!version) {
25309
+ return false;
25734
25310
  }
25735
25311
  if (typeof version === 'string') {
25736
25312
  try {
@@ -25739,651 +25315,317 @@ function requireComparator() {
25739
25315
  return false;
25740
25316
  }
25741
25317
  }
25742
- return cmp(version, this.operator, this.semver, this.options);
25743
- }
25744
- intersects(comp, options) {
25745
- if (!(comp instanceof Comparator)) {
25746
- throw new TypeError('a Comparator is required');
25747
- }
25748
- if (this.operator === '') {
25749
- if (this.value === '') {
25750
- return true;
25751
- }
25752
- return new Range(comp.value, options).test(this.value);
25753
- } else if (comp.operator === '') {
25754
- if (comp.value === '') {
25318
+ for (let i = 0; i < this.set.length; i++) {
25319
+ if (testSet(this.set[i], version, this.options)) {
25755
25320
  return true;
25756
25321
  }
25757
- return new Range(this.value, options).test(comp.semver);
25758
- }
25759
- options = parseOptions(options);
25760
-
25761
- // Special cases where nothing can possibly be lower
25762
- if (options.includePrerelease && (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
25763
- return false;
25764
- }
25765
- if (!options.includePrerelease && (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
25766
- return false;
25767
- }
25768
-
25769
- // Same direction increasing (> or >=)
25770
- if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
25771
- return true;
25772
- }
25773
- // Same direction decreasing (< or <=)
25774
- if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
25775
- return true;
25776
- }
25777
- // same SemVer and both sides are inclusive (<= or >=)
25778
- if (this.semver.version === comp.semver.version && this.operator.includes('=') && comp.operator.includes('=')) {
25779
- return true;
25780
- }
25781
- // opposite directions less than
25782
- if (cmp(this.semver, '<', comp.semver, options) && this.operator.startsWith('>') && comp.operator.startsWith('<')) {
25783
- return true;
25784
- }
25785
- // opposite directions greater than
25786
- if (cmp(this.semver, '>', comp.semver, options) && this.operator.startsWith('<') && comp.operator.startsWith('>')) {
25787
- return true;
25788
25322
  }
25789
25323
  return false;
25790
25324
  }
25791
25325
  }
25792
- comparator = Comparator;
25326
+ range = Range;
25327
+ const LRU = lruCache;
25328
+ const cache = new LRU({
25329
+ max: 1000
25330
+ });
25793
25331
  const parseOptions = parseOptions_1;
25332
+ const Comparator = requireComparator();
25333
+ const debug = debug_1;
25334
+ const SemVer = semver;
25794
25335
  const {
25795
25336
  safeRe: re,
25796
- t
25337
+ t,
25338
+ comparatorTrimReplace,
25339
+ tildeTrimReplace,
25340
+ caretTrimReplace
25797
25341
  } = reExports;
25798
- const cmp = cmp_1;
25799
- const debug = debug_1;
25800
- const SemVer = semver$1;
25801
- const Range = requireRange();
25802
- return comparator;
25803
- }
25804
-
25805
- const Range$9 = requireRange();
25806
- const satisfies$4 = (version, range, options) => {
25807
- try {
25808
- range = new Range$9(range, options);
25809
- } catch (er) {
25810
- return false;
25811
- }
25812
- return range.test(version);
25813
- };
25814
- var satisfies_1 = satisfies$4;
25342
+ const {
25343
+ FLAG_INCLUDE_PRERELEASE,
25344
+ FLAG_LOOSE
25345
+ } = constants;
25346
+ const isNullSet = c => c.value === '<0.0.0-0';
25347
+ const isAny = c => c.value === '';
25815
25348
 
25816
- const Range$8 = requireRange();
25349
+ // take a set of comparators and determine whether there
25350
+ // exists a version which can satisfy it
25351
+ const isSatisfiable = (comparators, options) => {
25352
+ let result = true;
25353
+ const remainingComparators = comparators.slice();
25354
+ let testComparator = remainingComparators.pop();
25355
+ while (result && remainingComparators.length) {
25356
+ result = remainingComparators.every(otherComparator => {
25357
+ return testComparator.intersects(otherComparator, options);
25358
+ });
25359
+ testComparator = remainingComparators.pop();
25360
+ }
25361
+ return result;
25362
+ };
25817
25363
 
25818
- // Mostly just for testing and legacy API reasons
25819
- const toComparators$1 = (range, options) => new Range$8(range, options).set.map(comp => comp.map(c => c.value).join(' ').trim().split(' '));
25820
- var toComparators_1 = toComparators$1;
25364
+ // comprised of xranges, tildes, stars, and gtlt's at this point.
25365
+ // already replaced the hyphen ranges
25366
+ // turn into a set of JUST comparators.
25367
+ const parseComparator = (comp, options) => {
25368
+ debug('comp', comp, options);
25369
+ comp = replaceCarets(comp, options);
25370
+ debug('caret', comp);
25371
+ comp = replaceTildes(comp, options);
25372
+ debug('tildes', comp);
25373
+ comp = replaceXRanges(comp, options);
25374
+ debug('xrange', comp);
25375
+ comp = replaceStars(comp, options);
25376
+ debug('stars', comp);
25377
+ return comp;
25378
+ };
25379
+ const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
25821
25380
 
25822
- const SemVer$4 = semver$1;
25823
- const Range$7 = requireRange();
25824
- const maxSatisfying$1 = (versions, range, options) => {
25825
- let max = null;
25826
- let maxSV = null;
25827
- let rangeObj = null;
25828
- try {
25829
- rangeObj = new Range$7(range, options);
25830
- } catch (er) {
25831
- return null;
25832
- }
25833
- versions.forEach(v => {
25834
- if (rangeObj.test(v)) {
25835
- // satisfies(v, range, options)
25836
- if (!max || maxSV.compare(v) === -1) {
25837
- // compare(max, v, true)
25838
- max = v;
25839
- maxSV = new SemVer$4(max, options);
25381
+ // ~, ~> --> * (any, kinda silly)
25382
+ // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
25383
+ // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
25384
+ // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
25385
+ // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
25386
+ // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
25387
+ // ~0.0.1 --> >=0.0.1 <0.1.0-0
25388
+ const replaceTildes = (comp, options) => {
25389
+ return comp.trim().split(/\s+/).map(c => replaceTilde(c, options)).join(' ');
25390
+ };
25391
+ const replaceTilde = (comp, options) => {
25392
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
25393
+ return comp.replace(r, (_, M, m, p, pr) => {
25394
+ debug('tilde', comp, _, M, m, p, pr);
25395
+ let ret;
25396
+ if (isX(M)) {
25397
+ ret = '';
25398
+ } else if (isX(m)) {
25399
+ ret = ">=".concat(M, ".0.0 <").concat(+M + 1, ".0.0-0");
25400
+ } else if (isX(p)) {
25401
+ // ~1.2 == >=1.2.0 <1.3.0-0
25402
+ ret = ">=".concat(M, ".").concat(m, ".0 <").concat(M, ".").concat(+m + 1, ".0-0");
25403
+ } else if (pr) {
25404
+ debug('replaceTilde pr', pr);
25405
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
25406
+ } else {
25407
+ // ~1.2.3 == >=1.2.3 <1.3.0-0
25408
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, " <").concat(M, ".").concat(+m + 1, ".0-0");
25840
25409
  }
25841
- }
25842
- });
25843
- return max;
25844
- };
25845
- var maxSatisfying_1 = maxSatisfying$1;
25410
+ debug('tilde return', ret);
25411
+ return ret;
25412
+ });
25413
+ };
25846
25414
 
25847
- const SemVer$3 = semver$1;
25848
- const Range$6 = requireRange();
25849
- const minSatisfying$1 = (versions, range, options) => {
25850
- let min = null;
25851
- let minSV = null;
25852
- let rangeObj = null;
25853
- try {
25854
- rangeObj = new Range$6(range, options);
25855
- } catch (er) {
25856
- return null;
25857
- }
25858
- versions.forEach(v => {
25859
- if (rangeObj.test(v)) {
25860
- // satisfies(v, range, options)
25861
- if (!min || minSV.compare(v) === 1) {
25862
- // compare(min, v, true)
25863
- min = v;
25864
- minSV = new SemVer$3(min, options);
25865
- }
25866
- }
25867
- });
25868
- return min;
25869
- };
25870
- var minSatisfying_1 = minSatisfying$1;
25871
-
25872
- const SemVer$2 = semver$1;
25873
- const Range$5 = requireRange();
25874
- const gt$2 = gt_1;
25875
- const minVersion$1 = (range, loose) => {
25876
- range = new Range$5(range, loose);
25877
- let minver = new SemVer$2('0.0.0');
25878
- if (range.test(minver)) {
25879
- return minver;
25880
- }
25881
- minver = new SemVer$2('0.0.0-0');
25882
- if (range.test(minver)) {
25883
- return minver;
25884
- }
25885
- minver = null;
25886
- for (let i = 0; i < range.set.length; ++i) {
25887
- const comparators = range.set[i];
25888
- let setMin = null;
25889
- comparators.forEach(comparator => {
25890
- // Clone to avoid manipulating the comparator's semver object.
25891
- const compver = new SemVer$2(comparator.semver.version);
25892
- switch (comparator.operator) {
25893
- case '>':
25894
- if (compver.prerelease.length === 0) {
25895
- compver.patch++;
25415
+ // ^ --> * (any, kinda silly)
25416
+ // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
25417
+ // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
25418
+ // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
25419
+ // ^1.2.3 --> >=1.2.3 <2.0.0-0
25420
+ // ^1.2.0 --> >=1.2.0 <2.0.0-0
25421
+ // ^0.0.1 --> >=0.0.1 <0.0.2-0
25422
+ // ^0.1.0 --> >=0.1.0 <0.2.0-0
25423
+ const replaceCarets = (comp, options) => {
25424
+ return comp.trim().split(/\s+/).map(c => replaceCaret(c, options)).join(' ');
25425
+ };
25426
+ const replaceCaret = (comp, options) => {
25427
+ debug('caret', comp, options);
25428
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
25429
+ const z = options.includePrerelease ? '-0' : '';
25430
+ return comp.replace(r, (_, M, m, p, pr) => {
25431
+ debug('caret', comp, _, M, m, p, pr);
25432
+ let ret;
25433
+ if (isX(M)) {
25434
+ ret = '';
25435
+ } else if (isX(m)) {
25436
+ ret = ">=".concat(M, ".0.0").concat(z, " <").concat(+M + 1, ".0.0-0");
25437
+ } else if (isX(p)) {
25438
+ if (M === '0') {
25439
+ ret = ">=".concat(M, ".").concat(m, ".0").concat(z, " <").concat(M, ".").concat(+m + 1, ".0-0");
25440
+ } else {
25441
+ ret = ">=".concat(M, ".").concat(m, ".0").concat(z, " <").concat(+M + 1, ".0.0-0");
25442
+ }
25443
+ } else if (pr) {
25444
+ debug('replaceCaret pr', pr);
25445
+ if (M === '0') {
25446
+ if (m === '0') {
25447
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(m, ".").concat(+p + 1, "-0");
25448
+ } else {
25449
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
25450
+ }
25451
+ } else {
25452
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(+M + 1, ".0.0-0");
25453
+ }
25454
+ } else {
25455
+ debug('no pr');
25456
+ if (M === '0') {
25457
+ if (m === '0') {
25458
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p).concat(z, " <").concat(M, ".").concat(m, ".").concat(+p + 1, "-0");
25896
25459
  } else {
25897
- compver.prerelease.push(0);
25898
- }
25899
- compver.raw = compver.format();
25900
- /* fallthrough */
25901
- case '':
25902
- case '>=':
25903
- if (!setMin || gt$2(compver, setMin)) {
25904
- setMin = compver;
25460
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p).concat(z, " <").concat(M, ".").concat(+m + 1, ".0-0");
25905
25461
  }
25906
- break;
25907
- case '<':
25908
- case '<=':
25909
- /* Ignore maximum versions */
25910
- break;
25911
- /* istanbul ignore next */
25912
- default:
25913
- throw new Error("Unexpected operation: ".concat(comparator.operator));
25462
+ } else {
25463
+ ret = ">=".concat(M, ".").concat(m, ".").concat(p, " <").concat(+M + 1, ".0.0-0");
25464
+ }
25914
25465
  }
25466
+ debug('caret return', ret);
25467
+ return ret;
25915
25468
  });
25916
- if (setMin && (!minver || gt$2(minver, setMin))) {
25917
- minver = setMin;
25918
- }
25919
- }
25920
- if (minver && range.test(minver)) {
25921
- return minver;
25922
- }
25923
- return null;
25924
- };
25925
- var minVersion_1 = minVersion$1;
25926
-
25927
- const Range$4 = requireRange();
25928
- const validRange$1 = (range, options) => {
25929
- try {
25930
- // Return '*' instead of '' so that truthiness works.
25931
- // This will throw if it's invalid anyway
25932
- return new Range$4(range, options).range || '*';
25933
- } catch (er) {
25934
- return null;
25935
- }
25936
- };
25937
- var valid$1 = validRange$1;
25938
-
25939
- const SemVer$1 = semver$1;
25940
- const Comparator$2 = requireComparator();
25941
- const {
25942
- ANY: ANY$1
25943
- } = Comparator$2;
25944
- const Range$3 = requireRange();
25945
- const satisfies$3 = satisfies_1;
25946
- const gt$1 = gt_1;
25947
- const lt$1 = lt_1;
25948
- const lte$1 = lte_1;
25949
- const gte$1 = gte_1;
25950
- const outside$3 = (version, range, hilo, options) => {
25951
- version = new SemVer$1(version, options);
25952
- range = new Range$3(range, options);
25953
- let gtfn, ltefn, ltfn, comp, ecomp;
25954
- switch (hilo) {
25955
- case '>':
25956
- gtfn = gt$1;
25957
- ltefn = lte$1;
25958
- ltfn = lt$1;
25959
- comp = '>';
25960
- ecomp = '>=';
25961
- break;
25962
- case '<':
25963
- gtfn = lt$1;
25964
- ltefn = gte$1;
25965
- ltfn = gt$1;
25966
- comp = '<';
25967
- ecomp = '<=';
25968
- break;
25969
- default:
25970
- throw new TypeError('Must provide a hilo val of "<" or ">"');
25971
- }
25972
-
25973
- // If it satisfies the range it is not outside
25974
- if (satisfies$3(version, range, options)) {
25975
- return false;
25976
- }
25977
-
25978
- // From now on, variable terms are as if we're in "gtr" mode.
25979
- // but note that everything is flipped for the "ltr" function.
25980
-
25981
- for (let i = 0; i < range.set.length; ++i) {
25982
- const comparators = range.set[i];
25983
- let high = null;
25984
- let low = null;
25985
- comparators.forEach(comparator => {
25986
- if (comparator.semver === ANY$1) {
25987
- comparator = new Comparator$2('>=0.0.0');
25988
- }
25989
- high = high || comparator;
25990
- low = low || comparator;
25991
- if (gtfn(comparator.semver, high.semver, options)) {
25992
- high = comparator;
25993
- } else if (ltfn(comparator.semver, low.semver, options)) {
25994
- low = comparator;
25469
+ };
25470
+ const replaceXRanges = (comp, options) => {
25471
+ debug('replaceXRanges', comp, options);
25472
+ return comp.split(/\s+/).map(c => replaceXRange(c, options)).join(' ');
25473
+ };
25474
+ const replaceXRange = (comp, options) => {
25475
+ comp = comp.trim();
25476
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
25477
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
25478
+ debug('xRange', comp, ret, gtlt, M, m, p, pr);
25479
+ const xM = isX(M);
25480
+ const xm = xM || isX(m);
25481
+ const xp = xm || isX(p);
25482
+ const anyX = xp;
25483
+ if (gtlt === '=' && anyX) {
25484
+ gtlt = '';
25995
25485
  }
25996
- });
25997
-
25998
- // If the edge version comparator has a operator then our version
25999
- // isn't outside it
26000
- if (high.operator === comp || high.operator === ecomp) {
26001
- return false;
26002
- }
26003
-
26004
- // If the lowest version comparator has an operator and our version
26005
- // is less than it then it isn't higher than the range
26006
- if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
26007
- return false;
26008
- } else if (low.operator === ecomp && ltfn(version, low.semver)) {
26009
- return false;
26010
- }
26011
- }
26012
- return true;
26013
- };
26014
- var outside_1 = outside$3;
26015
-
26016
- // Determine if version is greater than all the versions possible in the range.
26017
- const outside$2 = outside_1;
26018
- const gtr$1 = (version, range, options) => outside$2(version, range, '>', options);
26019
- var gtr_1 = gtr$1;
26020
-
26021
- const outside$1 = outside_1;
26022
- // Determine if version is less than all the versions possible in the range
26023
- const ltr$1 = (version, range, options) => outside$1(version, range, '<', options);
26024
- var ltr_1 = ltr$1;
26025
-
26026
- const Range$2 = requireRange();
26027
- const intersects$1 = (r1, r2, options) => {
26028
- r1 = new Range$2(r1, options);
26029
- r2 = new Range$2(r2, options);
26030
- return r1.intersects(r2, options);
26031
- };
26032
- var intersects_1 = intersects$1;
26033
25486
 
26034
- // given a set of versions and a range, create a "simplified" range
26035
- // that includes the same versions that the original range does
26036
- // If the original range is shorter than the simplified one, return that.
26037
- const satisfies$2 = satisfies_1;
26038
- const compare$2 = compare_1;
26039
- var simplify = (versions, range, options) => {
26040
- const set = [];
26041
- let first = null;
26042
- let prev = null;
26043
- const v = versions.sort((a, b) => compare$2(a, b, options));
26044
- for (const version of v) {
26045
- const included = satisfies$2(version, range, options);
26046
- if (included) {
26047
- prev = version;
26048
- if (!first) {
26049
- first = version;
25487
+ // if we're including prereleases in the match, then we need
25488
+ // to fix this to -0, the lowest possible prerelease value
25489
+ pr = options.includePrerelease ? '-0' : '';
25490
+ if (xM) {
25491
+ if (gtlt === '>' || gtlt === '<') {
25492
+ // nothing is allowed
25493
+ ret = '<0.0.0-0';
25494
+ } else {
25495
+ // nothing is forbidden
25496
+ ret = '*';
25497
+ }
25498
+ } else if (gtlt && anyX) {
25499
+ // we know patch is an x, because we have any x at all.
25500
+ // replace X with 0
25501
+ if (xm) {
25502
+ m = 0;
25503
+ }
25504
+ p = 0;
25505
+ if (gtlt === '>') {
25506
+ // >1 => >=2.0.0
25507
+ // >1.2 => >=1.3.0
25508
+ gtlt = '>=';
25509
+ if (xm) {
25510
+ M = +M + 1;
25511
+ m = 0;
25512
+ p = 0;
25513
+ } else {
25514
+ m = +m + 1;
25515
+ p = 0;
25516
+ }
25517
+ } else if (gtlt === '<=') {
25518
+ // <=0.7.x is actually <0.8.0, since any 0.7.x should
25519
+ // pass. Similarly, <=7.x is actually <8.0.0, etc.
25520
+ gtlt = '<';
25521
+ if (xm) {
25522
+ M = +M + 1;
25523
+ } else {
25524
+ m = +m + 1;
25525
+ }
25526
+ }
25527
+ if (gtlt === '<') {
25528
+ pr = '-0';
25529
+ }
25530
+ ret = "".concat(gtlt + M, ".").concat(m, ".").concat(p).concat(pr);
25531
+ } else if (xm) {
25532
+ ret = ">=".concat(M, ".0.0").concat(pr, " <").concat(+M + 1, ".0.0-0");
25533
+ } else if (xp) {
25534
+ ret = ">=".concat(M, ".").concat(m, ".0").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
26050
25535
  }
26051
- } else {
26052
- if (prev) {
26053
- set.push([first, prev]);
26054
- }
26055
- prev = null;
26056
- first = null;
26057
- }
26058
- }
26059
- if (first) {
26060
- set.push([first, null]);
26061
- }
26062
- const ranges = [];
26063
- for (const [min, max] of set) {
26064
- if (min === max) {
26065
- ranges.push(min);
26066
- } else if (!max && min === v[0]) {
26067
- ranges.push('*');
26068
- } else if (!max) {
26069
- ranges.push(">=".concat(min));
26070
- } else if (min === v[0]) {
26071
- ranges.push("<=".concat(max));
26072
- } else {
26073
- ranges.push("".concat(min, " - ").concat(max));
26074
- }
26075
- }
26076
- const simplified = ranges.join(' || ');
26077
- const original = typeof range.raw === 'string' ? range.raw : String(range);
26078
- return simplified.length < original.length ? simplified : range;
26079
- };
25536
+ debug('xRange return', ret);
25537
+ return ret;
25538
+ });
25539
+ };
26080
25540
 
26081
- const Range$1 = requireRange();
26082
- const Comparator$1 = requireComparator();
26083
- const {
26084
- ANY
26085
- } = Comparator$1;
26086
- const satisfies$1 = satisfies_1;
26087
- const compare$1 = compare_1;
25541
+ // Because * is AND-ed with everything else in the comparator,
25542
+ // and '' means "any version", just remove the *s entirely.
25543
+ const replaceStars = (comp, options) => {
25544
+ debug('replaceStars', comp, options);
25545
+ // Looseness is ignored here. star is always as loose as it gets!
25546
+ return comp.trim().replace(re[t.STAR], '');
25547
+ };
25548
+ const replaceGTE0 = (comp, options) => {
25549
+ debug('replaceGTE0', comp, options);
25550
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '');
25551
+ };
26088
25552
 
26089
- // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
26090
- // - Every simple range `r1, r2, ...` is a null set, OR
26091
- // - Every simple range `r1, r2, ...` which is not a null set is a subset of
26092
- // some `R1, R2, ...`
26093
- //
26094
- // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
26095
- // - If c is only the ANY comparator
26096
- // - If C is only the ANY comparator, return true
26097
- // - Else if in prerelease mode, return false
26098
- // - else replace c with `[>=0.0.0]`
26099
- // - If C is only the ANY comparator
26100
- // - if in prerelease mode, return true
26101
- // - else replace C with `[>=0.0.0]`
26102
- // - Let EQ be the set of = comparators in c
26103
- // - If EQ is more than one, return true (null set)
26104
- // - Let GT be the highest > or >= comparator in c
26105
- // - Let LT be the lowest < or <= comparator in c
26106
- // - If GT and LT, and GT.semver > LT.semver, return true (null set)
26107
- // - If any C is a = range, and GT or LT are set, return false
26108
- // - If EQ
26109
- // - If GT, and EQ does not satisfy GT, return true (null set)
26110
- // - If LT, and EQ does not satisfy LT, return true (null set)
26111
- // - If EQ satisfies every C, return true
26112
- // - Else return false
26113
- // - If GT
26114
- // - If GT.semver is lower than any > or >= comp in C, return false
26115
- // - If GT is >=, and GT.semver does not satisfy every C, return false
26116
- // - If GT.semver has a prerelease, and not in prerelease mode
26117
- // - If no C has a prerelease and the GT.semver tuple, return false
26118
- // - If LT
26119
- // - If LT.semver is greater than any < or <= comp in C, return false
26120
- // - If LT is <=, and LT.semver does not satisfy every C, return false
26121
- // - If GT.semver has a prerelease, and not in prerelease mode
26122
- // - If no C has a prerelease and the LT.semver tuple, return false
26123
- // - Else return true
26124
-
26125
- const subset$1 = function (sub, dom) {
26126
- let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
26127
- if (sub === dom) {
26128
- return true;
26129
- }
26130
- sub = new Range$1(sub, options);
26131
- dom = new Range$1(dom, options);
26132
- let sawNonNull = false;
26133
- OUTER: for (const simpleSub of sub.set) {
26134
- for (const simpleDom of dom.set) {
26135
- const isSub = simpleSubset(simpleSub, simpleDom, options);
26136
- sawNonNull = sawNonNull || isSub !== null;
26137
- if (isSub) {
26138
- continue OUTER;
26139
- }
26140
- }
26141
- // the null set is a subset of everything, but null simple ranges in
26142
- // a complex range should be ignored. so if we saw a non-null range,
26143
- // then we know this isn't a subset, but if EVERY simple range was null,
26144
- // then it is a subset.
26145
- if (sawNonNull) {
26146
- return false;
26147
- }
26148
- }
26149
- return true;
26150
- };
26151
- const minimumVersionWithPreRelease = [new Comparator$1('>=0.0.0-0')];
26152
- const minimumVersion = [new Comparator$1('>=0.0.0')];
26153
- const simpleSubset = (sub, dom, options) => {
26154
- if (sub === dom) {
26155
- return true;
26156
- }
26157
- if (sub.length === 1 && sub[0].semver === ANY) {
26158
- if (dom.length === 1 && dom[0].semver === ANY) {
26159
- return true;
26160
- } else if (options.includePrerelease) {
26161
- sub = minimumVersionWithPreRelease;
26162
- } else {
26163
- sub = minimumVersion;
26164
- }
26165
- }
26166
- if (dom.length === 1 && dom[0].semver === ANY) {
26167
- if (options.includePrerelease) {
26168
- return true;
25553
+ // This function is passed to string.replace(re[t.HYPHENRANGE])
25554
+ // M, m, patch, prerelease, build
25555
+ // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
25556
+ // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
25557
+ // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
25558
+ const hyphenReplace = incPr => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
25559
+ if (isX(fM)) {
25560
+ from = '';
25561
+ } else if (isX(fm)) {
25562
+ from = ">=".concat(fM, ".0.0").concat(incPr ? '-0' : '');
25563
+ } else if (isX(fp)) {
25564
+ from = ">=".concat(fM, ".").concat(fm, ".0").concat(incPr ? '-0' : '');
25565
+ } else if (fpr) {
25566
+ from = ">=".concat(from);
26169
25567
  } else {
26170
- dom = minimumVersion;
25568
+ from = ">=".concat(from).concat(incPr ? '-0' : '');
26171
25569
  }
26172
- }
26173
- const eqSet = new Set();
26174
- let gt, lt;
26175
- for (const c of sub) {
26176
- if (c.operator === '>' || c.operator === '>=') {
26177
- gt = higherGT(gt, c, options);
26178
- } else if (c.operator === '<' || c.operator === '<=') {
26179
- lt = lowerLT(lt, c, options);
25570
+ if (isX(tM)) {
25571
+ to = '';
25572
+ } else if (isX(tm)) {
25573
+ to = "<".concat(+tM + 1, ".0.0-0");
25574
+ } else if (isX(tp)) {
25575
+ to = "<".concat(tM, ".").concat(+tm + 1, ".0-0");
25576
+ } else if (tpr) {
25577
+ to = "<=".concat(tM, ".").concat(tm, ".").concat(tp, "-").concat(tpr);
25578
+ } else if (incPr) {
25579
+ to = "<".concat(tM, ".").concat(tm, ".").concat(+tp + 1, "-0");
26180
25580
  } else {
26181
- eqSet.add(c.semver);
26182
- }
26183
- }
26184
- if (eqSet.size > 1) {
26185
- return null;
26186
- }
26187
- let gtltComp;
26188
- if (gt && lt) {
26189
- gtltComp = compare$1(gt.semver, lt.semver, options);
26190
- if (gtltComp > 0) {
26191
- return null;
26192
- } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
26193
- return null;
26194
- }
26195
- }
26196
-
26197
- // will iterate one or zero times
26198
- for (const eq of eqSet) {
26199
- if (gt && !satisfies$1(eq, String(gt), options)) {
26200
- return null;
26201
- }
26202
- if (lt && !satisfies$1(eq, String(lt), options)) {
26203
- return null;
26204
- }
26205
- for (const c of dom) {
26206
- if (!satisfies$1(eq, String(c), options)) {
26207
- return false;
26208
- }
25581
+ to = "<=".concat(to);
26209
25582
  }
26210
- return true;
26211
- }
26212
- let higher, lower;
26213
- let hasDomLT, hasDomGT;
26214
- // if the subset has a prerelease, we need a comparator in the superset
26215
- // with the same tuple and a prerelease, or it's not a subset
26216
- let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
26217
- let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
26218
- // exception: <1.2.3-0 is the same as <1.2.3
26219
- if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
26220
- needDomLTPre = false;
26221
- }
26222
- for (const c of dom) {
26223
- hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=';
26224
- hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=';
26225
- if (gt) {
26226
- if (needDomGTPre) {
26227
- if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
26228
- needDomGTPre = false;
26229
- }
26230
- }
26231
- if (c.operator === '>' || c.operator === '>=') {
26232
- higher = higherGT(gt, c, options);
26233
- if (higher === c && higher !== gt) {
26234
- return false;
26235
- }
26236
- } else if (gt.operator === '>=' && !satisfies$1(gt.semver, String(c), options)) {
25583
+ return "".concat(from, " ").concat(to).trim();
25584
+ };
25585
+ const testSet = (set, version, options) => {
25586
+ for (let i = 0; i < set.length; i++) {
25587
+ if (!set[i].test(version)) {
26237
25588
  return false;
26238
25589
  }
26239
25590
  }
26240
- if (lt) {
26241
- if (needDomLTPre) {
26242
- if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
26243
- needDomLTPre = false;
25591
+ if (version.prerelease.length && !options.includePrerelease) {
25592
+ // Find the set of versions that are allowed to have prereleases
25593
+ // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
25594
+ // That should allow `1.2.3-pr.2` to pass.
25595
+ // However, `1.2.4-alpha.notready` should NOT be allowed,
25596
+ // even though it's within the range set by the comparators.
25597
+ for (let i = 0; i < set.length; i++) {
25598
+ debug(set[i].semver);
25599
+ if (set[i].semver === Comparator.ANY) {
25600
+ continue;
26244
25601
  }
26245
- }
26246
- if (c.operator === '<' || c.operator === '<=') {
26247
- lower = lowerLT(lt, c, options);
26248
- if (lower === c && lower !== lt) {
26249
- return false;
25602
+ if (set[i].semver.prerelease.length > 0) {
25603
+ const allowed = set[i].semver;
25604
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
25605
+ return true;
25606
+ }
26250
25607
  }
26251
- } else if (lt.operator === '<=' && !satisfies$1(lt.semver, String(c), options)) {
26252
- return false;
26253
25608
  }
26254
- }
26255
- if (!c.operator && (lt || gt) && gtltComp !== 0) {
25609
+
25610
+ // Version has a -pre, but it's not one of the ones we like.
26256
25611
  return false;
26257
25612
  }
26258
- }
26259
-
26260
- // if there was a < or >, and nothing in the dom, then must be false
26261
- // UNLESS it was limited by another range in the other direction.
26262
- // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
26263
- if (gt && hasDomLT && !lt && gtltComp !== 0) {
26264
- return false;
26265
- }
26266
- if (lt && hasDomGT && !gt && gtltComp !== 0) {
26267
- return false;
26268
- }
25613
+ return true;
25614
+ };
25615
+ return range;
25616
+ }
26269
25617
 
26270
- // we needed a prerelease range in a specific tuple, but didn't get one
26271
- // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
26272
- // because it includes prereleases in the 1.2.3 tuple
26273
- if (needDomGTPre || needDomLTPre) {
25618
+ const Range = requireRange();
25619
+ const satisfies = (version, range, options) => {
25620
+ try {
25621
+ range = new Range(range, options);
25622
+ } catch (er) {
26274
25623
  return false;
26275
25624
  }
26276
- return true;
26277
- };
26278
-
26279
- // >=1.2.3 is lower than >1.2.3
26280
- const higherGT = (a, b, options) => {
26281
- if (!a) {
26282
- return b;
26283
- }
26284
- const comp = compare$1(a.semver, b.semver, options);
26285
- return comp > 0 ? a : comp < 0 ? b : b.operator === '>' && a.operator === '>=' ? b : a;
26286
- };
26287
-
26288
- // <=1.2.3 is higher than <1.2.3
26289
- const lowerLT = (a, b, options) => {
26290
- if (!a) {
26291
- return b;
26292
- }
26293
- const comp = compare$1(a.semver, b.semver, options);
26294
- return comp < 0 ? a : comp > 0 ? b : b.operator === '<' && a.operator === '<=' ? b : a;
26295
- };
26296
- var subset_1 = subset$1;
26297
-
26298
- // just pre-load all the stuff that index.js lazily exports
26299
- const internalRe = reExports;
26300
- const constants = constants$1;
26301
- const SemVer = semver$1;
26302
- const identifiers = identifiers$1;
26303
- const parse = parse_1;
26304
- const valid = valid_1;
26305
- const clean = clean_1;
26306
- const inc = inc_1;
26307
- const diff = diff_1;
26308
- const major = major_1;
26309
- const minor = minor_1;
26310
- const patch = patch_1;
26311
- const prerelease = prerelease_1;
26312
- const compare = compare_1;
26313
- const rcompare = rcompare_1;
26314
- const compareLoose = compareLoose_1;
26315
- const compareBuild = compareBuild_1;
26316
- const sort = sort_1;
26317
- const rsort = rsort_1;
26318
- const gt = gt_1;
26319
- const lt = lt_1;
26320
- const eq = eq_1;
26321
- const neq = neq_1;
26322
- const gte = gte_1;
26323
- const lte = lte_1;
26324
- const cmp = cmp_1;
26325
- const coerce = coerce_1;
26326
- const Comparator = requireComparator();
26327
- const Range = requireRange();
26328
- const satisfies = satisfies_1;
26329
- const toComparators = toComparators_1;
26330
- const maxSatisfying = maxSatisfying_1;
26331
- const minSatisfying = minSatisfying_1;
26332
- const minVersion = minVersion_1;
26333
- const validRange = valid$1;
26334
- const outside = outside_1;
26335
- const gtr = gtr_1;
26336
- const ltr = ltr_1;
26337
- const intersects = intersects_1;
26338
- const simplifyRange = simplify;
26339
- const subset = subset_1;
26340
- var semver = {
26341
- parse,
26342
- valid,
26343
- clean,
26344
- inc,
26345
- diff,
26346
- major,
26347
- minor,
26348
- patch,
26349
- prerelease,
26350
- compare,
26351
- rcompare,
26352
- compareLoose,
26353
- compareBuild,
26354
- sort,
26355
- rsort,
26356
- gt,
26357
- lt,
26358
- eq,
26359
- neq,
26360
- gte,
26361
- lte,
26362
- cmp,
26363
- coerce,
26364
- Comparator,
26365
- Range,
26366
- satisfies,
26367
- toComparators,
26368
- maxSatisfying,
26369
- minSatisfying,
26370
- minVersion,
26371
- validRange,
26372
- outside,
26373
- gtr,
26374
- ltr,
26375
- intersects,
26376
- simplifyRange,
26377
- subset,
26378
- SemVer,
26379
- re: internalRe.re,
26380
- src: internalRe.src,
26381
- tokens: internalRe.t,
26382
- SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
26383
- RELEASE_TYPES: constants.RELEASE_TYPES,
26384
- compareIdentifiers: identifiers.compareIdentifiers,
26385
- rcompareIdentifiers: identifiers.rcompareIdentifiers
25625
+ return range.test(version);
26386
25626
  };
25627
+ var satisfies_1 = satisfies;
25628
+ var satisfies$1 = /*@__PURE__*/getDefaultExportFromCjs(satisfies_1);
26387
25629
 
26388
25630
  const LOADED = {};
26389
25631
 
@@ -26454,7 +25696,7 @@ function create$1(info, halo) {
26454
25696
  version: info.version,
26455
25697
  supportsPropertiesVersion(v) {
26456
25698
  if (v && meta && meta.deps && meta.deps.properties) {
26457
- return semver.satisfies(v, meta.deps.properties);
25699
+ return satisfies$1(v, meta.deps.properties);
26458
25700
  }
26459
25701
  return true;
26460
25702
  },
@@ -27442,6 +26684,7 @@ function fromGenericObjects(genericObjects) {
27442
26684
  id: "app - ".concat(+Date.now()),
27443
26685
  session,
27444
26686
  createSessionObject,
26687
+ destroySessionObject: async () => {},
27445
26688
  getObject,
27446
26689
  getAppLayout
27447
26690
  };