@nebula.js/stardust 3.2.1 → 3.3.0-alpha.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 +1964 -1444
- package/core/esm/dev.js.map +1 -1
- package/core/esm/index.js +6 -4
- package/core/esm/index.js.map +1 -1
- package/core/package.json +4 -4
- package/dist/stardust.dev.js +3675 -2219
- package/dist/stardust.dev.js.map +1 -1
- package/dist/stardust.js +16 -14
- package/dist/stardust.js.map +1 -1
- package/package.json +13 -13
- package/types/index.d.ts +1 -1
package/core/esm/dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @nebula.js/stardust v3.
|
|
2
|
+
* @nebula.js/stardust v3.3.0-alpha.0
|
|
3
3
|
* Copyright (c) 2023 QlikTech International AB
|
|
4
4
|
* Released under the MIT license.
|
|
5
5
|
*/
|
|
@@ -3928,6 +3928,7 @@ const globalStateClassesMapping = {
|
|
|
3928
3928
|
checked: 'checked',
|
|
3929
3929
|
completed: 'completed',
|
|
3930
3930
|
disabled: 'disabled',
|
|
3931
|
+
readOnly: 'readOnly',
|
|
3931
3932
|
error: 'error',
|
|
3932
3933
|
expanded: 'expanded',
|
|
3933
3934
|
focused: 'focused',
|
|
@@ -5219,8 +5220,6 @@ var createCache = function createCache(options) {
|
|
|
5219
5220
|
return cache;
|
|
5220
5221
|
};
|
|
5221
5222
|
|
|
5222
|
-
var createCache$1 = createCache;
|
|
5223
|
-
|
|
5224
5223
|
var jsxRuntimeExports$1 = {};
|
|
5225
5224
|
var jsxRuntime = {
|
|
5226
5225
|
get exports(){ return jsxRuntimeExports$1; },
|
|
@@ -5265,23 +5264,28 @@ function requireJsxRuntime () {
|
|
|
5265
5264
|
|
|
5266
5265
|
var jsxRuntimeExports = requireJsxRuntime();
|
|
5267
5266
|
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5267
|
+
let cache$1;
|
|
5268
|
+
if (typeof document === 'object') {
|
|
5269
|
+
cache$1 = createCache({
|
|
5270
|
+
key: 'css',
|
|
5271
|
+
prepend: true
|
|
5272
|
+
});
|
|
5273
|
+
}
|
|
5272
5274
|
function StyledEngineProvider(props) {
|
|
5273
5275
|
const {
|
|
5274
5276
|
injectFirst,
|
|
5275
5277
|
children
|
|
5276
5278
|
} = props;
|
|
5277
|
-
return injectFirst ? /*#__PURE__*/jsxRuntimeExports.jsx(CacheProvider, {
|
|
5279
|
+
return injectFirst && cache$1 ? /*#__PURE__*/jsxRuntimeExports.jsx(CacheProvider, {
|
|
5278
5280
|
value: cache$1,
|
|
5279
5281
|
children: children
|
|
5280
5282
|
}) : children;
|
|
5281
5283
|
}
|
|
5282
5284
|
|
|
5283
|
-
/**
|
|
5285
|
+
/**
|
|
5286
|
+
* @mui/styled-engine v5.11.11
|
|
5284
5287
|
*
|
|
5288
|
+
* @license MIT
|
|
5285
5289
|
* This source code is licensed under the MIT license found in the
|
|
5286
5290
|
* LICENSE file in the root directory of this source tree.
|
|
5287
5291
|
*/
|
|
@@ -7968,7 +7972,7 @@ function create$3(definition) {
|
|
|
7968
7972
|
return cache[key];
|
|
7969
7973
|
}
|
|
7970
7974
|
|
|
7971
|
-
const NEBULA_VERSION_HASH = "
|
|
7975
|
+
const NEBULA_VERSION_HASH = "c721" ;
|
|
7972
7976
|
ClassNameGenerator$1.configure(componentName => {
|
|
7973
7977
|
return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
|
|
7974
7978
|
});
|
|
@@ -8487,7 +8491,7 @@ function boot(_ref2) {
|
|
|
8487
8491
|
const appRef = React__default.createRef();
|
|
8488
8492
|
const element = document.createElement('div');
|
|
8489
8493
|
element.style.display = 'none';
|
|
8490
|
-
element.setAttribute('data-nebulajs-version', "3.
|
|
8494
|
+
element.setAttribute('data-nebulajs-version', "3.3.0-alpha.0" );
|
|
8491
8495
|
element.setAttribute('data-app-id', app.id);
|
|
8492
8496
|
document.body.appendChild(element);
|
|
8493
8497
|
ReactDOM.render( /*#__PURE__*/React__default.createElement(NebulaApp, {
|
|
@@ -8650,7 +8654,7 @@ const lock = props => _objectSpread2(_objectSpread2({}, props), {}, {
|
|
|
8650
8654
|
shapes: [{
|
|
8651
8655
|
type: 'path',
|
|
8652
8656
|
attrs: {
|
|
8653
|
-
d: '
|
|
8657
|
+
d: 'M8 10a1 1 0 0 1 .5 1.866v.634a.5.5 0 0 1-1 0v-.634A1 1 0 0 1 8 10ZM3.625 7.035A2 2 0 0 0 2 9v5a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V9a2 2 0 0 0-1.625-1.965V5.383a4.375 4.375 0 0 0-8.75 0v1.652ZM3 9a1 1 0 0 1 .931-.998h8.138A1 1 0 0 1 13 9v5a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9Zm8.375-3.617V7h-6.75V5.383a3.375 3.375 0 0 1 6.75 0Z'
|
|
8654
8658
|
}
|
|
8655
8659
|
}]
|
|
8656
8660
|
});
|
|
@@ -9533,7 +9537,15 @@ function getFieldKeyboardNavigation(_ref) {
|
|
|
9533
9537
|
}
|
|
9534
9538
|
function getListboxInlineKeyboardNavigation(_ref2) {
|
|
9535
9539
|
let {
|
|
9536
|
-
setKeyboardActive
|
|
9540
|
+
setKeyboardActive,
|
|
9541
|
+
hovering,
|
|
9542
|
+
setHovering,
|
|
9543
|
+
updateKeyScroll,
|
|
9544
|
+
containerRef,
|
|
9545
|
+
currentScrollIndex,
|
|
9546
|
+
app,
|
|
9547
|
+
appSelections,
|
|
9548
|
+
constraints
|
|
9537
9549
|
} = _ref2;
|
|
9538
9550
|
const focusInsideListbox = element => {
|
|
9539
9551
|
const fieldElement = element.querySelector('.search input, .value.selector, .value, .ActionsToolbar-* button');
|
|
@@ -9546,9 +9558,16 @@ function getListboxInlineKeyboardNavigation(_ref2) {
|
|
|
9546
9558
|
setKeyboardActive(false);
|
|
9547
9559
|
element.focus();
|
|
9548
9560
|
};
|
|
9561
|
+
const updateKeyScrollOnHover = newState => {
|
|
9562
|
+
if (hovering) {
|
|
9563
|
+
updateKeyScroll(newState);
|
|
9564
|
+
}
|
|
9565
|
+
};
|
|
9549
9566
|
const handleKeyDown = event => {
|
|
9550
9567
|
const {
|
|
9551
|
-
keyCode
|
|
9568
|
+
keyCode,
|
|
9569
|
+
ctrlKey = false,
|
|
9570
|
+
shiftKey = false
|
|
9552
9571
|
} = event.nativeEvent;
|
|
9553
9572
|
switch (keyCode) {
|
|
9554
9573
|
// case KEYS.TAB: TODO: Focus confirm button using keyboard.focusSelection when we can access the useKeyboard hook.
|
|
@@ -9563,6 +9582,36 @@ function getListboxInlineKeyboardNavigation(_ref2) {
|
|
|
9563
9582
|
case KEYS.ESCAPE:
|
|
9564
9583
|
focusContainer(event.currentTarget);
|
|
9565
9584
|
break;
|
|
9585
|
+
case KEYS.ARROW_UP:
|
|
9586
|
+
updateKeyScrollOnHover({
|
|
9587
|
+
up: 1
|
|
9588
|
+
});
|
|
9589
|
+
break;
|
|
9590
|
+
case KEYS.ARROW_DOWN:
|
|
9591
|
+
updateKeyScrollOnHover({
|
|
9592
|
+
down: 1
|
|
9593
|
+
});
|
|
9594
|
+
break;
|
|
9595
|
+
case KEYS.PAGE_UP:
|
|
9596
|
+
updateKeyScrollOnHover({
|
|
9597
|
+
up: currentScrollIndex.stop - currentScrollIndex.start
|
|
9598
|
+
});
|
|
9599
|
+
break;
|
|
9600
|
+
case KEYS.PAGE_DOWN:
|
|
9601
|
+
updateKeyScrollOnHover({
|
|
9602
|
+
down: currentScrollIndex.stop - currentScrollIndex.start
|
|
9603
|
+
});
|
|
9604
|
+
break;
|
|
9605
|
+
case KEYS.HOME:
|
|
9606
|
+
updateKeyScrollOnHover({
|
|
9607
|
+
scrollPosition: ctrlKey && shiftKey ? 'overflowStart' : 'start'
|
|
9608
|
+
});
|
|
9609
|
+
break;
|
|
9610
|
+
case KEYS.END:
|
|
9611
|
+
updateKeyScrollOnHover({
|
|
9612
|
+
scrollPosition: ctrlKey && shiftKey ? 'overflowEnd' : 'end'
|
|
9613
|
+
});
|
|
9614
|
+
break;
|
|
9566
9615
|
default:
|
|
9567
9616
|
return;
|
|
9568
9617
|
}
|
|
@@ -9571,7 +9620,60 @@ function getListboxInlineKeyboardNavigation(_ref2) {
|
|
|
9571
9620
|
// from handling keydown events.
|
|
9572
9621
|
event.preventDefault();
|
|
9573
9622
|
};
|
|
9574
|
-
|
|
9623
|
+
const focusOnHoverDisabled = () => {
|
|
9624
|
+
var _app$isInModalSelecti, _app$isInModalSelecti2;
|
|
9625
|
+
const selectNotAllowed = (constraints === null || constraints === void 0 ? void 0 : constraints.select) || (constraints === null || constraints === void 0 ? void 0 : constraints.active);
|
|
9626
|
+
const appInModal = (_app$isInModalSelecti = (_app$isInModalSelecti2 = app.isInModalSelection) === null || _app$isInModalSelecti2 === void 0 ? void 0 : _app$isInModalSelecti2.call(app)) !== null && _app$isInModalSelecti !== void 0 ? _app$isInModalSelecti : appSelections.isInModal();
|
|
9627
|
+
return selectNotAllowed || appInModal;
|
|
9628
|
+
};
|
|
9629
|
+
const handleOnMouseEnter = () => {
|
|
9630
|
+
if (!focusOnHoverDisabled()) {
|
|
9631
|
+
var _containerRef$current, _containerRef$current2;
|
|
9632
|
+
setHovering(true);
|
|
9633
|
+
containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : (_containerRef$current2 = _containerRef$current.focus) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.call(_containerRef$current);
|
|
9634
|
+
}
|
|
9635
|
+
};
|
|
9636
|
+
const handleOnMouseLeave = () => {
|
|
9637
|
+
if (hovering) {
|
|
9638
|
+
var _containerRef$current3, _containerRef$current4;
|
|
9639
|
+
setHovering(false);
|
|
9640
|
+
containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : (_containerRef$current4 = _containerRef$current3.blur) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.call(_containerRef$current3);
|
|
9641
|
+
}
|
|
9642
|
+
};
|
|
9643
|
+
return {
|
|
9644
|
+
handleKeyDown,
|
|
9645
|
+
handleOnMouseEnter,
|
|
9646
|
+
handleOnMouseLeave
|
|
9647
|
+
};
|
|
9648
|
+
}
|
|
9649
|
+
|
|
9650
|
+
function getGridItemSizes(_ref) {
|
|
9651
|
+
let {
|
|
9652
|
+
dataLayout,
|
|
9653
|
+
layoutOrder,
|
|
9654
|
+
itemPadding
|
|
9655
|
+
} = _ref;
|
|
9656
|
+
// Simulate margin/padding by making the item smaller than its container.
|
|
9657
|
+
if (dataLayout === 'singleColumn') {
|
|
9658
|
+
return {
|
|
9659
|
+
height: '100%',
|
|
9660
|
+
width: '100%'
|
|
9661
|
+
};
|
|
9662
|
+
}
|
|
9663
|
+
switch (layoutOrder) {
|
|
9664
|
+
case 'row':
|
|
9665
|
+
return {
|
|
9666
|
+
height: "calc(100% - ".concat(itemPadding, "px)"),
|
|
9667
|
+
width: "calc(100% - ".concat(2 * itemPadding, "px)")
|
|
9668
|
+
};
|
|
9669
|
+
case 'column':
|
|
9670
|
+
return {
|
|
9671
|
+
height: "calc(100% - ".concat(itemPadding, "px)"),
|
|
9672
|
+
width: "calc(100% - ".concat(2 * itemPadding, "px)")
|
|
9673
|
+
};
|
|
9674
|
+
default:
|
|
9675
|
+
return {};
|
|
9676
|
+
}
|
|
9575
9677
|
}
|
|
9576
9678
|
|
|
9577
9679
|
const PREFIX$a = 'RowColumn';
|
|
@@ -9615,7 +9717,7 @@ const getSelectedStyle = _ref => {
|
|
|
9615
9717
|
background: theme.palette.selected.main,
|
|
9616
9718
|
color: theme.palette.selected.mainContrastText,
|
|
9617
9719
|
'&:focus': {
|
|
9618
|
-
boxShadow: "inset 0 0 0 2px
|
|
9720
|
+
boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder),
|
|
9619
9721
|
outline: 'none'
|
|
9620
9722
|
},
|
|
9621
9723
|
'& $cell': {
|
|
@@ -9623,36 +9725,53 @@ const getSelectedStyle = _ref => {
|
|
|
9623
9725
|
}
|
|
9624
9726
|
};
|
|
9625
9727
|
};
|
|
9626
|
-
const
|
|
9627
|
-
shouldForwardProp:
|
|
9728
|
+
const ItemGrid = styled$1(Grid, {
|
|
9729
|
+
shouldForwardProp: prop => !['dataLayout', 'layoutOrder', 'itemPadding'].includes(prop)
|
|
9628
9730
|
})(_ref2 => {
|
|
9731
|
+
let {
|
|
9732
|
+
dataLayout,
|
|
9733
|
+
layoutOrder,
|
|
9734
|
+
itemPadding
|
|
9735
|
+
} = _ref2;
|
|
9736
|
+
return {
|
|
9737
|
+
["&.".concat(classes$a.fieldRoot)]: getGridItemSizes({
|
|
9738
|
+
dataLayout,
|
|
9739
|
+
layoutOrder,
|
|
9740
|
+
itemPadding
|
|
9741
|
+
})
|
|
9742
|
+
};
|
|
9743
|
+
});
|
|
9744
|
+
const Root$1 = styled$1('div', {
|
|
9745
|
+
shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense'].includes(prop)
|
|
9746
|
+
})(_ref3 => {
|
|
9629
9747
|
var _theme$listBox$conten, _theme$listBox, _theme$listBox$conten2, _theme$listBox$conten3, _theme$listBox2, _theme$listBox2$conte, _theme$listBox3, _theme$listBox3$conte, _theme$listBox4, _theme$listBox4$conte;
|
|
9630
9748
|
let {
|
|
9631
9749
|
theme,
|
|
9632
9750
|
flexBasisProp,
|
|
9751
|
+
isGridMode,
|
|
9752
|
+
isGridCol,
|
|
9633
9753
|
dense
|
|
9634
|
-
} =
|
|
9754
|
+
} = _ref3;
|
|
9635
9755
|
return {
|
|
9756
|
+
'&:focus': {
|
|
9757
|
+
boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
|
|
9758
|
+
},
|
|
9759
|
+
'&:focus-visible': {
|
|
9760
|
+
outline: 'none'
|
|
9761
|
+
},
|
|
9636
9762
|
["& .".concat(classes$a.row)]: {
|
|
9637
9763
|
flexWrap: 'nowrap',
|
|
9638
9764
|
color: (_theme$listBox$conten = (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : (_theme$listBox$conten2 = _theme$listBox.content) === null || _theme$listBox$conten2 === void 0 ? void 0 : _theme$listBox$conten2.color) !== null && _theme$listBox$conten !== void 0 ? _theme$listBox$conten : theme.palette.text.primary
|
|
9639
9765
|
},
|
|
9640
9766
|
["& .".concat(classes$a.rowBorderBottom)]: {
|
|
9641
|
-
borderBottom: "1px solid ".concat(theme.palette.divider)
|
|
9767
|
+
borderBottom: isGridCol ? 'none' : "1px solid ".concat(theme.palette.divider),
|
|
9768
|
+
borderLeft: isGridCol ? "1px solid ".concat(theme.palette.divider) : 'none'
|
|
9642
9769
|
},
|
|
9643
9770
|
["& .".concat(classes$a.column)]: {
|
|
9644
9771
|
flexWrap: 'nowrap',
|
|
9645
9772
|
borderRight: "1px solid ".concat(theme.palette.divider),
|
|
9646
9773
|
color: (_theme$listBox$conten3 = (_theme$listBox2 = theme.listBox) === null || _theme$listBox2 === void 0 ? void 0 : (_theme$listBox2$conte = _theme$listBox2.content) === null || _theme$listBox2$conte === void 0 ? void 0 : _theme$listBox2$conte.color) !== null && _theme$listBox$conten3 !== void 0 ? _theme$listBox$conten3 : theme.palette.text.primary
|
|
9647
9774
|
},
|
|
9648
|
-
["& .".concat(classes$a.fieldRoot)]: {
|
|
9649
|
-
'&:focus': {
|
|
9650
|
-
boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
|
|
9651
|
-
},
|
|
9652
|
-
'&:focus-visible': {
|
|
9653
|
-
outline: 'none'
|
|
9654
|
-
}
|
|
9655
|
-
},
|
|
9656
9775
|
// The interior wrapper for all field content.
|
|
9657
9776
|
["& .".concat(classes$a.cell)]: {
|
|
9658
9777
|
display: 'flex',
|
|
@@ -9712,22 +9831,27 @@ const Root$1 = styled$1('div', {
|
|
|
9712
9831
|
padding: theme.spacing(1, 1, 1, 0)
|
|
9713
9832
|
},
|
|
9714
9833
|
// Selection styles (S=Selected, XS=ExcludedSelected, A=Available, X=Excluded).
|
|
9715
|
-
["& .".concat(classes$a.S)]: _objectSpread2({}, getSelectedStyle({
|
|
9834
|
+
["& .".concat(classes$a.S)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
|
|
9716
9835
|
theme
|
|
9717
|
-
})),
|
|
9836
|
+
})), {}, {
|
|
9837
|
+
border: isGridMode ? 'none' : undefined
|
|
9838
|
+
}),
|
|
9718
9839
|
["& .".concat(classes$a.XS)]: _objectSpread2(_objectSpread2({}, getSelectedStyle({
|
|
9719
9840
|
theme
|
|
9720
9841
|
})), {}, {
|
|
9721
9842
|
background: theme.palette.selected.excluded,
|
|
9722
|
-
color: theme.palette.selected.mainContrastText
|
|
9843
|
+
color: theme.palette.selected.mainContrastText,
|
|
9844
|
+
border: isGridMode ? 'none' : undefined
|
|
9723
9845
|
}),
|
|
9724
9846
|
["& .".concat(classes$a.A)]: {
|
|
9725
9847
|
background: theme.palette.selected.alternative,
|
|
9726
|
-
color: theme.palette.selected.alternativeContrastText
|
|
9848
|
+
color: theme.palette.selected.alternativeContrastText,
|
|
9849
|
+
border: isGridMode ? 'none' : undefined
|
|
9727
9850
|
},
|
|
9728
9851
|
["& .".concat(classes$a.X)]: {
|
|
9729
9852
|
background: theme.palette.selected.excluded,
|
|
9730
|
-
color: theme.palette.selected.excludedContrastText
|
|
9853
|
+
color: theme.palette.selected.excludedContrastText,
|
|
9854
|
+
border: isGridMode ? 'none' : undefined
|
|
9731
9855
|
},
|
|
9732
9856
|
["& .".concat(classes$a.frequencyCount)]: {
|
|
9733
9857
|
width: '66px',
|
|
@@ -9735,7 +9859,8 @@ const Root$1 = styled$1('div', {
|
|
|
9735
9859
|
},
|
|
9736
9860
|
["&.".concat(classes$a.barContainer)]: {
|
|
9737
9861
|
height: '100%',
|
|
9738
|
-
display: '
|
|
9862
|
+
display: 'flex',
|
|
9863
|
+
alignItems: 'center'
|
|
9739
9864
|
},
|
|
9740
9865
|
["& .".concat(classes$a.bar)]: {
|
|
9741
9866
|
border: "".concat(barBorderWidthPx, "px solid"),
|
|
@@ -9766,14 +9891,15 @@ const Root$1 = styled$1('div', {
|
|
|
9766
9891
|
}
|
|
9767
9892
|
};
|
|
9768
9893
|
});
|
|
9769
|
-
function RowColumn(
|
|
9894
|
+
function RowColumn(_ref4) {
|
|
9895
|
+
var _cell$qText;
|
|
9770
9896
|
let {
|
|
9771
9897
|
index,
|
|
9772
9898
|
rowIndex,
|
|
9773
9899
|
columnIndex,
|
|
9774
9900
|
style,
|
|
9775
9901
|
data
|
|
9776
|
-
} =
|
|
9902
|
+
} = _ref4;
|
|
9777
9903
|
const {
|
|
9778
9904
|
onClick,
|
|
9779
9905
|
onMouseDown,
|
|
@@ -9785,7 +9911,7 @@ function RowColumn(_ref3) {
|
|
|
9785
9911
|
checkboxes = false,
|
|
9786
9912
|
textAlign,
|
|
9787
9913
|
direction,
|
|
9788
|
-
|
|
9914
|
+
layoutOptions = {},
|
|
9789
9915
|
freqIsAllowed,
|
|
9790
9916
|
isSingleSelect,
|
|
9791
9917
|
actions,
|
|
@@ -9795,11 +9921,16 @@ function RowColumn(_ref3) {
|
|
|
9795
9921
|
showGray = true,
|
|
9796
9922
|
columnCount = 1,
|
|
9797
9923
|
rowCount = 1,
|
|
9798
|
-
layoutOrder,
|
|
9799
9924
|
dataOffset,
|
|
9800
9925
|
focusListItems,
|
|
9801
|
-
listCount
|
|
9926
|
+
listCount,
|
|
9927
|
+
itemPadding
|
|
9802
9928
|
} = data;
|
|
9929
|
+
const {
|
|
9930
|
+
dense = false,
|
|
9931
|
+
dataLayout = 'singleColumn',
|
|
9932
|
+
layoutOrder
|
|
9933
|
+
} = layoutOptions;
|
|
9803
9934
|
let cellIndex;
|
|
9804
9935
|
let styles;
|
|
9805
9936
|
const count = {
|
|
@@ -9871,7 +10002,7 @@ function RowColumn(_ref3) {
|
|
|
9871
10002
|
const selected = cell.qState === 'S' || cell.qState === 'XS' || cell.qState === 'L';
|
|
9872
10003
|
setSelected(selected);
|
|
9873
10004
|
const clazzArr = [column ? classes$a.column : classes$a.row];
|
|
9874
|
-
if (!(histogram && dense
|
|
10005
|
+
if (!(histogram && (dense || checkboxes))) clazzArr.push(classes$a.rowBorderBottom);
|
|
9875
10006
|
if (!checkboxes) {
|
|
9876
10007
|
if (cell.qState === 'XS') {
|
|
9877
10008
|
clazzArr.push(showGray ? classes$a.XS : classes$a.S);
|
|
@@ -9903,13 +10034,13 @@ function RowColumn(_ref3) {
|
|
|
9903
10034
|
} else {
|
|
9904
10035
|
valueTextAlign = (textAlign === null || textAlign === void 0 ? void 0 : textAlign.align) || 'left';
|
|
9905
10036
|
}
|
|
9906
|
-
const getValueField =
|
|
10037
|
+
const getValueField = _ref5 => {
|
|
9907
10038
|
let {
|
|
9908
10039
|
lbl,
|
|
9909
10040
|
ix,
|
|
9910
10041
|
color,
|
|
9911
10042
|
highlighted = false
|
|
9912
|
-
} =
|
|
10043
|
+
} = _ref5;
|
|
9913
10044
|
return /*#__PURE__*/React__default.createElement(Typography, {
|
|
9914
10045
|
component: "span",
|
|
9915
10046
|
variant: "body2",
|
|
@@ -9930,17 +10061,19 @@ function RowColumn(_ref3) {
|
|
|
9930
10061
|
}
|
|
9931
10062
|
event.preventDefault();
|
|
9932
10063
|
};
|
|
9933
|
-
const
|
|
10064
|
+
const isGridCol = dataLayout === 'grid' && layoutOrder === 'column';
|
|
10065
|
+
const getCheckboxField = _ref6 => {
|
|
9934
10066
|
let {
|
|
9935
10067
|
lbl,
|
|
9936
10068
|
color,
|
|
9937
10069
|
qElemNumber
|
|
9938
|
-
} =
|
|
10070
|
+
} = _ref6;
|
|
9939
10071
|
const cb = /*#__PURE__*/React__default.createElement(ListboxCheckbox, {
|
|
9940
10072
|
label: lbl,
|
|
9941
10073
|
checked: isSelected,
|
|
9942
10074
|
dense: dense,
|
|
9943
10075
|
excluded: isExcluded(cell),
|
|
10076
|
+
isGridCol: isGridCol,
|
|
9944
10077
|
showGray: showGray
|
|
9945
10078
|
});
|
|
9946
10079
|
const rb = /*#__PURE__*/React__default.createElement(ListBoxRadioButton, {
|
|
@@ -9961,7 +10094,7 @@ function RowColumn(_ref3) {
|
|
|
9961
10094
|
key: qElemNumber
|
|
9962
10095
|
});
|
|
9963
10096
|
};
|
|
9964
|
-
const label = cell ? cell.qText : '';
|
|
10097
|
+
const label = (_cell$qText = cell === null || cell === void 0 ? void 0 : cell.qText) !== null && _cell$qText !== void 0 ? _cell$qText : '';
|
|
9965
10098
|
const getFrequencyText = () => {
|
|
9966
10099
|
if (cell) {
|
|
9967
10100
|
return cell.qFrequency ? cell.qFrequency : frequencyTextNone;
|
|
@@ -9973,12 +10106,12 @@ function RowColumn(_ref3) {
|
|
|
9973
10106
|
const ranges = cell && cell.qHighlightRanges && cell.qHighlightRanges.qRanges.sort((a, b) => a.qCharPos - b.qCharPos) || [];
|
|
9974
10107
|
const labels = getSegmentsFromRanges(label, ranges);
|
|
9975
10108
|
const getField = checkboxes ? getCheckboxField : getValueField;
|
|
9976
|
-
const getFieldWithRanges =
|
|
10109
|
+
const getFieldWithRanges = _ref7 => {
|
|
9977
10110
|
let {
|
|
9978
10111
|
lbls
|
|
9979
|
-
} =
|
|
9980
|
-
const labelsWithRanges = lbls.map((
|
|
9981
|
-
let [lbl, highlighted] =
|
|
10112
|
+
} = _ref7;
|
|
10113
|
+
const labelsWithRanges = lbls.map((_ref8, ix) => {
|
|
10114
|
+
let [lbl, highlighted] = _ref8;
|
|
9982
10115
|
return getValueField({
|
|
9983
10116
|
ix,
|
|
9984
10117
|
highlighted,
|
|
@@ -10018,16 +10151,21 @@ function RowColumn(_ref3) {
|
|
|
10018
10151
|
return /*#__PURE__*/React__default.createElement(Root$1, {
|
|
10019
10152
|
className: classes$a.barContainer,
|
|
10020
10153
|
flexBasisProp: flexBasisVal,
|
|
10154
|
+
style: styles,
|
|
10155
|
+
isGridCol: isGridCol,
|
|
10156
|
+
isGridMode: dataLayout === 'grid',
|
|
10021
10157
|
dense: dense
|
|
10022
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
10158
|
+
}, /*#__PURE__*/React__default.createElement(ItemGrid, {
|
|
10023
10159
|
ref: rowRef,
|
|
10024
10160
|
container: true,
|
|
10161
|
+
dataLayout: dataLayout,
|
|
10162
|
+
layoutOrder: layoutOrder,
|
|
10163
|
+
itemPadding: itemPadding,
|
|
10025
10164
|
gap: 0,
|
|
10026
10165
|
className: joinClassNames(['value', ...classArr]),
|
|
10027
10166
|
classes: {
|
|
10028
10167
|
root: classes$a.fieldRoot
|
|
10029
10168
|
},
|
|
10030
|
-
style: styles,
|
|
10031
10169
|
onClick: onClick,
|
|
10032
10170
|
onMouseDown: onMouseDown,
|
|
10033
10171
|
onMouseUp: onMouseUp,
|
|
@@ -11663,16 +11801,15 @@ function getListBoxComponents(_ref) {
|
|
|
11663
11801
|
listCount,
|
|
11664
11802
|
overflowDisclaimer,
|
|
11665
11803
|
setScrollPosition,
|
|
11666
|
-
focusListItems
|
|
11804
|
+
focusListItems,
|
|
11805
|
+
setCurrentScrollIndex
|
|
11667
11806
|
} = _ref;
|
|
11668
11807
|
const {
|
|
11669
11808
|
layoutOptions = {},
|
|
11670
11809
|
frequencyMax
|
|
11671
11810
|
} = layout || {};
|
|
11672
11811
|
const {
|
|
11673
|
-
|
|
11674
|
-
} = layoutOptions || {};
|
|
11675
|
-
const {
|
|
11812
|
+
itemPadding,
|
|
11676
11813
|
listHeight,
|
|
11677
11814
|
itemSize,
|
|
11678
11815
|
rowCount,
|
|
@@ -11694,7 +11831,7 @@ function getListBoxComponents(_ref) {
|
|
|
11694
11831
|
pages
|
|
11695
11832
|
}, isLocked || selectDisabled() ? {} : interactionEvents), {}, {
|
|
11696
11833
|
checkboxes,
|
|
11697
|
-
|
|
11834
|
+
layoutOptions,
|
|
11698
11835
|
frequencyMode,
|
|
11699
11836
|
freqIsAllowed: getFrequencyAllowed({
|
|
11700
11837
|
width,
|
|
@@ -11703,6 +11840,7 @@ function getListBoxComponents(_ref) {
|
|
|
11703
11840
|
}),
|
|
11704
11841
|
isSingleSelect,
|
|
11705
11842
|
textAlign,
|
|
11843
|
+
itemPadding,
|
|
11706
11844
|
actions: {
|
|
11707
11845
|
select,
|
|
11708
11846
|
confirm: () => selections === null || selections === void 0 ? void 0 : selections.confirm.call(selections),
|
|
@@ -11737,6 +11875,10 @@ function getListBoxComponents(_ref) {
|
|
|
11737
11875
|
itemSize: itemSize,
|
|
11738
11876
|
onItemsRendered: renderProps => {
|
|
11739
11877
|
var _layout$qListObject, _layout$qListObject$q;
|
|
11878
|
+
setCurrentScrollIndex({
|
|
11879
|
+
start: renderProps.visibleStartIndex,
|
|
11880
|
+
stop: renderProps.visibleStopIndex
|
|
11881
|
+
});
|
|
11740
11882
|
if (scrollState) {
|
|
11741
11883
|
scrollState.setScrollPos(renderProps.visibleStopIndex);
|
|
11742
11884
|
}
|
|
@@ -11773,6 +11915,11 @@ function getListBoxComponents(_ref) {
|
|
|
11773
11915
|
local.current.listRef = ref;
|
|
11774
11916
|
const handleGridItemsRendered = renderProps => {
|
|
11775
11917
|
var _layout$qListObject2, _layout$qListObject2$;
|
|
11918
|
+
const isRow = layoutOrder === 'row';
|
|
11919
|
+
setCurrentScrollIndex({
|
|
11920
|
+
start: isRow ? renderProps.visibleRowStartIndex : renderProps.visibleColumnStartIndex,
|
|
11921
|
+
stop: isRow ? renderProps.visibleRowStopIndex : renderProps.visibleColumnStopIndex
|
|
11922
|
+
});
|
|
11776
11923
|
const renderOptions = deriveRenderOptions({
|
|
11777
11924
|
renderProps,
|
|
11778
11925
|
scrollState,
|
|
@@ -11806,8 +11953,7 @@ function getListBoxComponents(_ref) {
|
|
|
11806
11953
|
itemData: _objectSpread2(_objectSpread2({}, commonItemData), {}, {
|
|
11807
11954
|
column: undefined,
|
|
11808
11955
|
columnCount,
|
|
11809
|
-
rowCount
|
|
11810
|
-
layoutOrder
|
|
11956
|
+
rowCount
|
|
11811
11957
|
}),
|
|
11812
11958
|
onItemsRendered: handleGridItemsRendered,
|
|
11813
11959
|
ref: ref
|
|
@@ -11845,8 +11991,17 @@ function getListSizes(_ref) {
|
|
|
11845
11991
|
let columnCount;
|
|
11846
11992
|
let columnWidth;
|
|
11847
11993
|
let rowCount;
|
|
11848
|
-
const
|
|
11849
|
-
const
|
|
11994
|
+
const isGridMode = dataLayout === 'grid';
|
|
11995
|
+
const itemPadding = 4;
|
|
11996
|
+
const denseItemSize = 20;
|
|
11997
|
+
const normalItemSize = isGridMode ? 32 : 29;
|
|
11998
|
+
let itemSize = dense ? denseItemSize : normalItemSize;
|
|
11999
|
+
if (isGridMode) {
|
|
12000
|
+
// Emulate a margin between items using padding, since the list library
|
|
12001
|
+
// needs an explicit row height and cannot handle margins.
|
|
12002
|
+
itemSize += itemPadding;
|
|
12003
|
+
}
|
|
12004
|
+
const listHeight = height !== null && height !== void 0 ? height : 8 * itemSize;
|
|
11850
12005
|
if (layoutOrder) {
|
|
11851
12006
|
if (layoutOrder === 'row') {
|
|
11852
12007
|
overflowStyling = {
|
|
@@ -11896,7 +12051,8 @@ function getListSizes(_ref) {
|
|
|
11896
12051
|
maxCount: {
|
|
11897
12052
|
row: maxRowCount,
|
|
11898
12053
|
column: maxColumnCount
|
|
11899
|
-
}
|
|
12054
|
+
},
|
|
12055
|
+
itemPadding
|
|
11900
12056
|
};
|
|
11901
12057
|
}
|
|
11902
12058
|
|
|
@@ -12412,7 +12568,14 @@ function ListBox(_ref) {
|
|
|
12412
12568
|
keyboard = {},
|
|
12413
12569
|
showGray = true,
|
|
12414
12570
|
scrollState,
|
|
12415
|
-
selectDisabled = () => false
|
|
12571
|
+
selectDisabled = () => false,
|
|
12572
|
+
keyScroll = {
|
|
12573
|
+
state: {},
|
|
12574
|
+
reset: () => {}
|
|
12575
|
+
},
|
|
12576
|
+
currentScrollIndex = {
|
|
12577
|
+
set: () => {}
|
|
12578
|
+
}
|
|
12416
12579
|
} = _ref;
|
|
12417
12580
|
const [initScrollPosIsSet, setInitScrollPosIsSet] = useState$1(false);
|
|
12418
12581
|
const [layout] = useLayout$1(model);
|
|
@@ -12505,8 +12668,12 @@ function ListBox(_ref) {
|
|
|
12505
12668
|
local.current.validPages = false;
|
|
12506
12669
|
if (loaderRef.current) {
|
|
12507
12670
|
loaderRef.current.resetloadMoreItemsCache(true);
|
|
12508
|
-
|
|
12509
|
-
if
|
|
12671
|
+
const isScrollingToEnd = keyScroll.state.scrollPosition === 'overflowEnd';
|
|
12672
|
+
// Skip scrollToItem if we are in selections or if scrolling to the end.
|
|
12673
|
+
if (layout && layout.qSelectionInfo.qInSelections || isScrollingToEnd) {
|
|
12674
|
+
if (isScrollingToEnd) {
|
|
12675
|
+
keyScroll.reset();
|
|
12676
|
+
}
|
|
12510
12677
|
return;
|
|
12511
12678
|
}
|
|
12512
12679
|
local.current.dataOffset = 0;
|
|
@@ -12577,6 +12744,21 @@ function ListBox(_ref) {
|
|
|
12577
12744
|
}
|
|
12578
12745
|
scrollToIndex(scrollIndex);
|
|
12579
12746
|
};
|
|
12747
|
+
useEffect$1(() => {
|
|
12748
|
+
const s = keyScroll.state;
|
|
12749
|
+
if (s.up) {
|
|
12750
|
+
scrollToIndex(currentScrollIndex.state.start - s.up);
|
|
12751
|
+
} else if (s.down) {
|
|
12752
|
+
scrollToIndex(currentScrollIndex.state.stop + s.down);
|
|
12753
|
+
} else if (s.scrollPosition) {
|
|
12754
|
+
setScrollPosition(s.scrollPosition);
|
|
12755
|
+
}
|
|
12756
|
+
if (s.scrollPosition === 'overflowEnd') {
|
|
12757
|
+
return; // Do keyScroll.reset() in fetchData() to avoid scrolling to top.
|
|
12758
|
+
}
|
|
12759
|
+
|
|
12760
|
+
keyScroll.reset();
|
|
12761
|
+
}, [keyScroll.state.up, keyScroll.state.down, keyScroll.state.scrollPosition]);
|
|
12580
12762
|
const {
|
|
12581
12763
|
textAlign
|
|
12582
12764
|
} = (layout === null || layout === void 0 ? void 0 : layout.qListObject.qDimensionInfo) || {};
|
|
@@ -12624,7 +12806,8 @@ function ListBox(_ref) {
|
|
|
12624
12806
|
set: showOverflowDisclaimer
|
|
12625
12807
|
},
|
|
12626
12808
|
setScrollPosition,
|
|
12627
|
-
focusListItems: getFocusState()
|
|
12809
|
+
focusListItems: getFocusState(),
|
|
12810
|
+
setCurrentScrollIndex: currentScrollIndex.set
|
|
12628
12811
|
});
|
|
12629
12812
|
const {
|
|
12630
12813
|
columnWidth,
|
|
@@ -12891,6 +13074,9 @@ function useDefaultSelectionActions(_ref) {
|
|
|
12891
13074
|
}
|
|
12892
13075
|
|
|
12893
13076
|
const PREFIX$8 = 'More';
|
|
13077
|
+
const ActionsToolbarMoreElement = {
|
|
13078
|
+
className: 'njs-action-toolbar-more'
|
|
13079
|
+
};
|
|
12894
13080
|
const classes$8 = {
|
|
12895
13081
|
icon: "".concat(PREFIX$8, "-icon")
|
|
12896
13082
|
};
|
|
@@ -12899,6 +13085,8 @@ const StyledPopover$1 = styled$1(Popover)(_ref => {
|
|
|
12899
13085
|
theme
|
|
12900
13086
|
} = _ref;
|
|
12901
13087
|
return {
|
|
13088
|
+
// Set here to allow clicking through the modals container
|
|
13089
|
+
pointerEvents: 'none',
|
|
12902
13090
|
["& .".concat(classes$8.icon)]: {
|
|
12903
13091
|
color: theme.palette.text.primary
|
|
12904
13092
|
}
|
|
@@ -12947,18 +13135,22 @@ const More$1 = React__default.forwardRef((_ref3, ref) => {
|
|
|
12947
13135
|
open: show,
|
|
12948
13136
|
anchorEl: alignTo.current,
|
|
12949
13137
|
getContentAnchorEl: null,
|
|
13138
|
+
container: alignTo.current,
|
|
13139
|
+
disablePortal: true,
|
|
12950
13140
|
hideBackdrop: true,
|
|
12951
|
-
style: {
|
|
12952
|
-
pointerEvents: 'none'
|
|
12953
|
-
},
|
|
12954
13141
|
transitionDuration: 0,
|
|
13142
|
+
slotProps: {
|
|
13143
|
+
root: {
|
|
13144
|
+
className: ActionsToolbarMoreElement.className
|
|
13145
|
+
}
|
|
13146
|
+
},
|
|
12955
13147
|
anchorOrigin: {
|
|
12956
13148
|
vertical: 'bottom',
|
|
12957
|
-
horizontal: '
|
|
13149
|
+
horizontal: 'right'
|
|
12958
13150
|
},
|
|
12959
13151
|
transformOrigin: {
|
|
12960
13152
|
vertical: 'top',
|
|
12961
|
-
horizontal: '
|
|
13153
|
+
horizontal: 'right'
|
|
12962
13154
|
},
|
|
12963
13155
|
PaperProps: {
|
|
12964
13156
|
style: _objectSpread2({
|
|
@@ -13091,8 +13283,6 @@ function ActionsToolbar(_ref3) {
|
|
|
13091
13283
|
keyboardNavigation
|
|
13092
13284
|
} = useContext(InstanceContext);
|
|
13093
13285
|
const [showMoreItems, setShowMoreItems] = useState$1(false);
|
|
13094
|
-
const [moreEnabled, setMoreEnabled] = useState$1(more$1.enabled);
|
|
13095
|
-
const [moreActions, setMoreActions] = useState$1(more$1.actions);
|
|
13096
13286
|
const moreRef = useRef();
|
|
13097
13287
|
const actionsRef = useRef();
|
|
13098
13288
|
const theme = useTheme$1();
|
|
@@ -13105,10 +13295,9 @@ function ActionsToolbar(_ref3) {
|
|
|
13105
13295
|
const buttons = actionsElement.querySelectorAll('button:not(.Mui-disabled)');
|
|
13106
13296
|
return buttons[last ? buttons.length - 1 : 0];
|
|
13107
13297
|
};
|
|
13108
|
-
useEffect$1(() => () =>
|
|
13109
|
-
|
|
13110
|
-
|
|
13111
|
-
}, [more$1.enabled]);
|
|
13298
|
+
useEffect$1(() => () => {
|
|
13299
|
+
setShowMoreItems(false);
|
|
13300
|
+
}, [popover.show, show, selections.show]);
|
|
13112
13301
|
useEffect$1(() => {
|
|
13113
13302
|
if (!focusHandler) return;
|
|
13114
13303
|
const focusFirst = () => {
|
|
@@ -13122,7 +13311,15 @@ function ActionsToolbar(_ref3) {
|
|
|
13122
13311
|
focusHandler.on('focus_toolbar_first', focusFirst);
|
|
13123
13312
|
focusHandler.on('focus_toolbar_last', focusLast);
|
|
13124
13313
|
}, []);
|
|
13125
|
-
|
|
13314
|
+
let moreEnabled = more$1.enabled;
|
|
13315
|
+
let moreActions = more$1.actions;
|
|
13316
|
+
const moreAlignTo = more$1.alignTo || moreRef;
|
|
13317
|
+
const newActions = actions.filter(a => !a.hidden);
|
|
13318
|
+
if (newActions.length > maxItems) {
|
|
13319
|
+
const newMoreActions = newActions.splice(-(newActions.length - maxItems) - 1);
|
|
13320
|
+
moreEnabled = true;
|
|
13321
|
+
moreActions = [...newMoreActions, ...more$1.actions];
|
|
13322
|
+
}
|
|
13126
13323
|
if (!selections.show && newActions.length === 0) return null;
|
|
13127
13324
|
const handleCloseShowMoreItems = () => {
|
|
13128
13325
|
setShowMoreItems(false);
|
|
@@ -13137,11 +13334,6 @@ function ActionsToolbar(_ref3) {
|
|
|
13137
13334
|
enabled: () => moreEnabled,
|
|
13138
13335
|
action: () => setShowMoreItems(!showMoreItems)
|
|
13139
13336
|
};
|
|
13140
|
-
if (newActions.length > maxItems) {
|
|
13141
|
-
const newMoreActions = newActions.splice(-(newActions.length - maxItems) - 1);
|
|
13142
|
-
setMoreEnabled(true);
|
|
13143
|
-
setMoreActions([...newMoreActions, ...more$1.actions]);
|
|
13144
|
-
}
|
|
13145
13337
|
const tabCallback =
|
|
13146
13338
|
// if keyboardNavigation is true, create a callback to handle tabbing from the first/last button in the toolbar that resets focus on the content
|
|
13147
13339
|
keyboardNavigation && focusHandler && focusHandler.refocusContent ? evt => {
|
|
@@ -13186,7 +13378,7 @@ function ActionsToolbar(_ref3) {
|
|
|
13186
13378
|
}), showMoreItems && /*#__PURE__*/React__default.createElement(More$1, {
|
|
13187
13379
|
show: showMoreItems,
|
|
13188
13380
|
actions: moreActions,
|
|
13189
|
-
alignTo:
|
|
13381
|
+
alignTo: moreAlignTo,
|
|
13190
13382
|
popoverProps: more$1.popoverProps,
|
|
13191
13383
|
popoverPaperStyle: more$1.popoverPaperStyle,
|
|
13192
13384
|
onCloseOrActionClick: handleCloseShowMoreItems
|
|
@@ -13215,7 +13407,7 @@ const search = props => _objectSpread2(_objectSpread2({}, props), {}, {
|
|
|
13215
13407
|
shapes: [{
|
|
13216
13408
|
type: 'path',
|
|
13217
13409
|
attrs: {
|
|
13218
|
-
d: '
|
|
13410
|
+
d: 'M8.588 11.415a6 6 0 1 1 2.828-2.829l4.101 4a1.5 1.5 0 0 1 .014 2.134l-.707.707a1.5 1.5 0 0 1-2.108.014l-4.128-4.026ZM11 6A5 5 0 1 0 1 6a5 5 0 0 0 10 0Zm-1.52 4.888 3.934 3.837a.5.5 0 0 0 .703-.005l.707-.707a.5.5 0 0 0-.005-.711l-3.926-3.829a6.034 6.034 0 0 1-1.413 1.415Z'
|
|
13219
13411
|
}
|
|
13220
13412
|
}]
|
|
13221
13413
|
});
|
|
@@ -13248,7 +13440,8 @@ function ListBoxSearch(_ref3) {
|
|
|
13248
13440
|
keyboard,
|
|
13249
13441
|
dense = false,
|
|
13250
13442
|
visible = true,
|
|
13251
|
-
|
|
13443
|
+
autoFocus = true,
|
|
13444
|
+
wildCardSearch = false,
|
|
13252
13445
|
searchEnabled
|
|
13253
13446
|
} = _ref3;
|
|
13254
13447
|
const {
|
|
@@ -13373,6 +13566,7 @@ function ListBoxSearch(_ref3) {
|
|
|
13373
13566
|
onFocus: handleFocus,
|
|
13374
13567
|
onChange: onChange,
|
|
13375
13568
|
onKeyDown: onKeyDown,
|
|
13569
|
+
autoFocus: autoFocus,
|
|
13376
13570
|
inputProps: {
|
|
13377
13571
|
tabIndex: keyboard && (!keyboard.enabled || keyboard.active) ? 0 : -1
|
|
13378
13572
|
}
|
|
@@ -13567,7 +13761,7 @@ const getClickOutFuncs = _ref3 => {
|
|
|
13567
13761
|
let {
|
|
13568
13762
|
elements,
|
|
13569
13763
|
objectSelections,
|
|
13570
|
-
options
|
|
13764
|
+
options = {}
|
|
13571
13765
|
} = _ref3;
|
|
13572
13766
|
const handler = createHandler({
|
|
13573
13767
|
elements,
|
|
@@ -13577,12 +13771,12 @@ const getClickOutFuncs = _ref3 => {
|
|
|
13577
13771
|
activateClickOut() {
|
|
13578
13772
|
var _options$onSelectionA;
|
|
13579
13773
|
document.addEventListener('mousedown', handler);
|
|
13580
|
-
(_options$onSelectionA = options.onSelectionActivated) === null || _options$onSelectionA === void 0 ? void 0 : _options$onSelectionA.call(options);
|
|
13774
|
+
options === null || options === void 0 ? void 0 : (_options$onSelectionA = options.onSelectionActivated) === null || _options$onSelectionA === void 0 ? void 0 : _options$onSelectionA.call(options);
|
|
13581
13775
|
},
|
|
13582
13776
|
deactivateClickOut() {
|
|
13583
13777
|
var _options$onSelectionD;
|
|
13584
13778
|
document.removeEventListener('mousedown', handler);
|
|
13585
|
-
(_options$onSelectionD = options.onSelectionDeactivated) === null || _options$onSelectionD === void 0 ? void 0 : _options$onSelectionD.call(options);
|
|
13779
|
+
options === null || options === void 0 ? void 0 : (_options$onSelectionD = options.onSelectionDeactivated) === null || _options$onSelectionD === void 0 ? void 0 : _options$onSelectionD.call(options);
|
|
13586
13780
|
}
|
|
13587
13781
|
};
|
|
13588
13782
|
};
|
|
@@ -13655,8 +13849,10 @@ function ListBoxPopover(_ref) {
|
|
|
13655
13849
|
close,
|
|
13656
13850
|
app,
|
|
13657
13851
|
fieldName,
|
|
13658
|
-
stateName = '$'
|
|
13852
|
+
stateName = '$',
|
|
13853
|
+
autoFocus
|
|
13659
13854
|
} = _ref;
|
|
13855
|
+
const isMasterDim = Boolean(fieldName === null || fieldName === void 0 ? void 0 : fieldName.qLibraryId);
|
|
13660
13856
|
const open = show && Boolean(alignTo.current);
|
|
13661
13857
|
const [listCount, setListCount] = useState$1(0);
|
|
13662
13858
|
const theme = useTheme$1();
|
|
@@ -13680,8 +13876,9 @@ function ListBoxPopover(_ref) {
|
|
|
13680
13876
|
qSortByNumeric: 1,
|
|
13681
13877
|
qSortByLoadOrder: 1
|
|
13682
13878
|
}],
|
|
13683
|
-
qFieldDefs: [fieldName]
|
|
13684
|
-
}
|
|
13879
|
+
qFieldDefs: isMasterDim ? undefined : [fieldName]
|
|
13880
|
+
},
|
|
13881
|
+
qLibraryId: isMasterDim ? fieldName.qLibraryId : undefined
|
|
13685
13882
|
}
|
|
13686
13883
|
}, app, fieldName, stateName);
|
|
13687
13884
|
const lock = useCallback(() => {
|
|
@@ -13785,10 +13982,14 @@ function ListBoxPopover(_ref) {
|
|
|
13785
13982
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
13786
13983
|
ref: moreAlignTo
|
|
13787
13984
|
}), /*#__PURE__*/React__default.createElement(ListBoxSearch, {
|
|
13788
|
-
|
|
13985
|
+
visible: true,
|
|
13789
13986
|
model: model,
|
|
13790
13987
|
listCount: listCount,
|
|
13791
|
-
|
|
13988
|
+
selections: selections,
|
|
13989
|
+
keyboard: {
|
|
13990
|
+
enabled: false
|
|
13991
|
+
},
|
|
13992
|
+
autoFocus: autoFocus !== null && autoFocus !== void 0 ? autoFocus : true
|
|
13792
13993
|
}), /*#__PURE__*/React__default.createElement(ListBox, {
|
|
13793
13994
|
model: model,
|
|
13794
13995
|
selections: selections,
|
|
@@ -14303,7 +14504,7 @@ function getItems(layout) {
|
|
|
14303
14504
|
if (layout.alternateStates) {
|
|
14304
14505
|
layout.alternateStates.forEach(s => collect(s.qSelectionObject, fields, s.stateName));
|
|
14305
14506
|
}
|
|
14306
|
-
return Object.keys(fields).map(key => fields[key]);
|
|
14507
|
+
return Object.keys(fields).map(key => fields[key]).filter(f => !f.selections.some(s => s.qIsHidden));
|
|
14307
14508
|
}
|
|
14308
14509
|
function SelectedFields(_ref) {
|
|
14309
14510
|
let {
|
|
@@ -15025,6 +15226,7 @@ const addListboxTheme = themeApi => {
|
|
|
15025
15226
|
};
|
|
15026
15227
|
|
|
15027
15228
|
const PREFIX$4 = 'ListBoxInline';
|
|
15229
|
+
const searchIconWidth = 28;
|
|
15028
15230
|
const classes$4 = {
|
|
15029
15231
|
listBoxHeader: "".concat(PREFIX$4, "-listBoxHeader"),
|
|
15030
15232
|
screenReaderOnly: "".concat(PREFIX$4, "-screenReaderOnly")
|
|
@@ -15038,7 +15240,8 @@ const StyledGrid$3 = styled$1(Grid)(_ref => {
|
|
|
15038
15240
|
backgroundColor: (_theme$listBox$backgr = (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.backgroundColor) !== null && _theme$listBox$backgr !== void 0 ? _theme$listBox$backgr : theme.palette.background.default,
|
|
15039
15241
|
["& .".concat(classes$4.listBoxHeader)]: {
|
|
15040
15242
|
alignSelf: 'center',
|
|
15041
|
-
display: 'inline-flex'
|
|
15243
|
+
display: 'inline-flex',
|
|
15244
|
+
width: "calc(100% - ".concat(searchIconWidth, "px)")
|
|
15042
15245
|
},
|
|
15043
15246
|
["& .".concat(classes$4.screenReaderOnly)]: {
|
|
15044
15247
|
position: 'absolute',
|
|
@@ -15065,6 +15268,7 @@ function ListBoxInline(_ref3) {
|
|
|
15065
15268
|
options = {}
|
|
15066
15269
|
} = _ref3;
|
|
15067
15270
|
const {
|
|
15271
|
+
app,
|
|
15068
15272
|
direction,
|
|
15069
15273
|
frequencyMode,
|
|
15070
15274
|
listLayout,
|
|
@@ -15104,17 +15308,43 @@ function ListBoxInline(_ref3) {
|
|
|
15104
15308
|
const {
|
|
15105
15309
|
translator,
|
|
15106
15310
|
keyboardNavigation,
|
|
15107
|
-
themeApi
|
|
15311
|
+
themeApi,
|
|
15312
|
+
constraints
|
|
15108
15313
|
} = useContext(InstanceContext);
|
|
15109
15314
|
theme.listBox = addListboxTheme(themeApi);
|
|
15110
15315
|
const moreAlignTo = useRef();
|
|
15316
|
+
const containerRef = useRef();
|
|
15111
15317
|
const [searchContainer, searchContainerRef] = useRefWithCallback();
|
|
15112
15318
|
const [layout] = useLayout$1(model);
|
|
15113
15319
|
const [showToolbar, setShowToolbar] = useState$1(false);
|
|
15114
15320
|
const [showSearch, setShowSearch] = useState$1(false);
|
|
15115
15321
|
const [keyboardActive, setKeyboardActive] = useState$1(false);
|
|
15116
|
-
const
|
|
15117
|
-
|
|
15322
|
+
const [hovering, setHovering] = useState$1(false);
|
|
15323
|
+
const [keyScroll, setKeyScroll] = useState$1({
|
|
15324
|
+
down: 0,
|
|
15325
|
+
up: 0,
|
|
15326
|
+
scrollPosition: ''
|
|
15327
|
+
});
|
|
15328
|
+
const updateKeyScroll = newState => setKeyScroll(current => _objectSpread2(_objectSpread2({}, current), newState));
|
|
15329
|
+
const [currentScrollIndex, setCurrentScrollIndex] = useState$1({
|
|
15330
|
+
start: 0,
|
|
15331
|
+
stop: 0
|
|
15332
|
+
});
|
|
15333
|
+
const [appSelections] = useAppSelections(app);
|
|
15334
|
+
const {
|
|
15335
|
+
handleKeyDown,
|
|
15336
|
+
handleOnMouseEnter,
|
|
15337
|
+
handleOnMouseLeave
|
|
15338
|
+
} = getListboxInlineKeyboardNavigation({
|
|
15339
|
+
setKeyboardActive,
|
|
15340
|
+
hovering,
|
|
15341
|
+
setHovering,
|
|
15342
|
+
updateKeyScroll,
|
|
15343
|
+
containerRef,
|
|
15344
|
+
currentScrollIndex,
|
|
15345
|
+
app,
|
|
15346
|
+
appSelections,
|
|
15347
|
+
constraints
|
|
15118
15348
|
});
|
|
15119
15349
|
|
|
15120
15350
|
// Expose the keyboard flags in the same way as the keyboard hook does.
|
|
@@ -15126,16 +15356,17 @@ function ListBoxInline(_ref3) {
|
|
|
15126
15356
|
if ((layout === null || layout === void 0 ? void 0 : layout.toolbar) !== undefined) {
|
|
15127
15357
|
toolbar = layout.toolbar;
|
|
15128
15358
|
}
|
|
15359
|
+
toolbar = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) !== '';
|
|
15129
15360
|
useEffect$1(() => {
|
|
15130
15361
|
const show = () => {
|
|
15131
15362
|
setShowToolbar(true);
|
|
15132
|
-
if (search === '
|
|
15363
|
+
if (search === 'toggle' && toolbar === false) {
|
|
15133
15364
|
setShowSearch(true);
|
|
15134
15365
|
}
|
|
15135
15366
|
};
|
|
15136
15367
|
const hide = () => {
|
|
15137
15368
|
setShowToolbar(false);
|
|
15138
|
-
if (search === 'toggle'
|
|
15369
|
+
if (search === 'toggle') {
|
|
15139
15370
|
setShowSearch(false);
|
|
15140
15371
|
}
|
|
15141
15372
|
};
|
|
@@ -15152,7 +15383,7 @@ function ListBoxInline(_ref3) {
|
|
|
15152
15383
|
selections.removeListener('activated', hide);
|
|
15153
15384
|
}
|
|
15154
15385
|
};
|
|
15155
|
-
}, [selections]);
|
|
15386
|
+
}, [selections, toolbar]);
|
|
15156
15387
|
useEffect$1(() => {
|
|
15157
15388
|
if (!searchContainer || !searchContainer.current) {
|
|
15158
15389
|
return;
|
|
@@ -15172,7 +15403,8 @@ function ListBoxInline(_ref3) {
|
|
|
15172
15403
|
model,
|
|
15173
15404
|
translator
|
|
15174
15405
|
}) : [];
|
|
15175
|
-
const
|
|
15406
|
+
const showSearchToggle = search === 'toggle' && showSearch;
|
|
15407
|
+
const searchVisible = (search === true || showSearchToggle) && !selectDisabled();
|
|
15176
15408
|
const dense = (_layout$layoutOptions = (_layout$layoutOptions2 = layout.layoutOptions) === null || _layout$layoutOptions2 === void 0 ? void 0 : _layout$layoutOptions2.dense) !== null && _layout$layoutOptions !== void 0 ? _layout$layoutOptions : false;
|
|
15177
15409
|
const searchHeight = dense ? 27 : 40;
|
|
15178
15410
|
const extraheight = dense ? 39 : 49;
|
|
@@ -15185,6 +15417,7 @@ function ListBoxInline(_ref3) {
|
|
|
15185
15417
|
const newValue = !showSearch;
|
|
15186
15418
|
setShowSearch(newValue);
|
|
15187
15419
|
};
|
|
15420
|
+
const shouldAutoFocus = searchVisible && search === 'toggle';
|
|
15188
15421
|
return /*#__PURE__*/React__default.createElement(StyledGrid$3, {
|
|
15189
15422
|
className: "listbox-container",
|
|
15190
15423
|
container: true,
|
|
@@ -15196,18 +15429,27 @@ function ListBoxInline(_ref3) {
|
|
|
15196
15429
|
minHeight: "".concat(minHeight, "px"),
|
|
15197
15430
|
flexFlow: 'column nowrap'
|
|
15198
15431
|
},
|
|
15199
|
-
onKeyDown: handleKeyDown
|
|
15200
|
-
|
|
15432
|
+
onKeyDown: handleKeyDown,
|
|
15433
|
+
onMouseEnter: handleOnMouseEnter,
|
|
15434
|
+
onMouseLeave: handleOnMouseLeave,
|
|
15435
|
+
ref: containerRef
|
|
15436
|
+
}, toolbar && /*#__PURE__*/React__default.createElement(Grid, {
|
|
15201
15437
|
item: true,
|
|
15202
15438
|
container: true,
|
|
15203
15439
|
style: {
|
|
15204
15440
|
padding: theme.spacing(1)
|
|
15205
|
-
}
|
|
15441
|
+
},
|
|
15442
|
+
wrap: "nowrap"
|
|
15443
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
15444
|
+
item: true,
|
|
15445
|
+
container: true,
|
|
15446
|
+
wrap: "nowrap"
|
|
15206
15447
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
15207
15448
|
item: true,
|
|
15208
15449
|
sx: {
|
|
15209
15450
|
display: 'flex',
|
|
15210
|
-
alignItems: 'center'
|
|
15451
|
+
alignItems: 'center',
|
|
15452
|
+
width: searchIconWidth
|
|
15211
15453
|
}
|
|
15212
15454
|
}, isLocked ? /*#__PURE__*/React__default.createElement(IconButton, {
|
|
15213
15455
|
tabIndex: -1,
|
|
@@ -15234,7 +15476,7 @@ function ListBoxInline(_ref3) {
|
|
|
15234
15476
|
}, /*#__PURE__*/React__default.createElement(Title, {
|
|
15235
15477
|
variant: "h6",
|
|
15236
15478
|
noWrap: true
|
|
15237
|
-
}, layout.title)), /*#__PURE__*/React__default.createElement(Grid, {
|
|
15479
|
+
}, layout.title))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
15238
15480
|
item: true,
|
|
15239
15481
|
xs: true
|
|
15240
15482
|
}), /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -15268,7 +15510,9 @@ function ListBoxInline(_ref3) {
|
|
|
15268
15510
|
},
|
|
15269
15511
|
role: "region",
|
|
15270
15512
|
"aria-label": translator.get('Listbox.ResultFilterLabel')
|
|
15271
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
15513
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
15514
|
+
ref: moreAlignTo
|
|
15515
|
+
}), /*#__PURE__*/React__default.createElement(Grid, {
|
|
15272
15516
|
item: true,
|
|
15273
15517
|
ref: searchContainerRef
|
|
15274
15518
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -15279,6 +15523,8 @@ function ListBoxInline(_ref3) {
|
|
|
15279
15523
|
dense: dense,
|
|
15280
15524
|
keyboard: keyboard,
|
|
15281
15525
|
visible: searchVisible,
|
|
15526
|
+
search: search,
|
|
15527
|
+
autoFocus: shouldAutoFocus,
|
|
15282
15528
|
searchContainerRef: searchContainerRef,
|
|
15283
15529
|
wildCardSearch: wildCardSearch,
|
|
15284
15530
|
searchEnabled: searchEnabled
|
|
@@ -15286,8 +15532,6 @@ function ListBoxInline(_ref3) {
|
|
|
15286
15532
|
item: true,
|
|
15287
15533
|
xs: true
|
|
15288
15534
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
15289
|
-
ref: moreAlignTo
|
|
15290
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
15291
15535
|
className: classes$4.screenReaderOnly
|
|
15292
15536
|
}, translator.get('Listbox.ScreenReaderInstructions')), /*#__PURE__*/React__default.createElement(AutoSizer, null, _ref4 => {
|
|
15293
15537
|
let {
|
|
@@ -15311,7 +15555,19 @@ function ListBoxInline(_ref3) {
|
|
|
15311
15555
|
selectDisabled: selectDisabled,
|
|
15312
15556
|
keyboard: keyboard,
|
|
15313
15557
|
showGray: showGray,
|
|
15314
|
-
scrollState: scrollState
|
|
15558
|
+
scrollState: scrollState,
|
|
15559
|
+
keyScroll: {
|
|
15560
|
+
state: keyScroll,
|
|
15561
|
+
reset: () => setKeyScroll({
|
|
15562
|
+
up: 0,
|
|
15563
|
+
down: 0,
|
|
15564
|
+
scrollPosition: ''
|
|
15565
|
+
})
|
|
15566
|
+
},
|
|
15567
|
+
currentScrollIndex: {
|
|
15568
|
+
state: currentScrollIndex,
|
|
15569
|
+
set: setCurrentScrollIndex
|
|
15570
|
+
}
|
|
15315
15571
|
});
|
|
15316
15572
|
}))));
|
|
15317
15573
|
}
|
|
@@ -15354,6 +15610,7 @@ function useExistingModel(_ref) {
|
|
|
15354
15610
|
}
|
|
15355
15611
|
|
|
15356
15612
|
function useOnTheFlyModel(_ref) {
|
|
15613
|
+
var _options$title;
|
|
15357
15614
|
let {
|
|
15358
15615
|
app,
|
|
15359
15616
|
fieldIdentifier,
|
|
@@ -15363,11 +15620,14 @@ function useOnTheFlyModel(_ref) {
|
|
|
15363
15620
|
const [fieldDef, setFieldDef] = useState$1('');
|
|
15364
15621
|
const [isFetching, setIsFetching] = useState$1(true);
|
|
15365
15622
|
const [model, setModel] = useState$1();
|
|
15623
|
+
const [fallbackTitle, setFallbackTitle] = useState$1();
|
|
15624
|
+
const title = (_options$title = options.title) !== null && _options$title !== void 0 ? _options$title : fallbackTitle;
|
|
15366
15625
|
useEffect$1(() => {
|
|
15367
15626
|
async function fetchMasterItem() {
|
|
15368
15627
|
try {
|
|
15369
15628
|
const dim = await app.getDimension(fieldIdentifier.qLibraryId);
|
|
15370
15629
|
const dimLayout = await dim.getLayout();
|
|
15630
|
+
setFallbackTitle(dimLayout.qDim.title);
|
|
15371
15631
|
setFieldDef(dimLayout.qDim.qFieldDefs ? dimLayout.qDim.qFieldDefs[0] : '');
|
|
15372
15632
|
setIsFetching(false);
|
|
15373
15633
|
} catch (e) {
|
|
@@ -15384,10 +15644,10 @@ function useOnTheFlyModel(_ref) {
|
|
|
15384
15644
|
fetchMasterItem();
|
|
15385
15645
|
} else {
|
|
15386
15646
|
setIsFetching(false);
|
|
15647
|
+
setFallbackTitle(fieldIdentifier);
|
|
15387
15648
|
}
|
|
15388
15649
|
}, []);
|
|
15389
15650
|
const {
|
|
15390
|
-
title,
|
|
15391
15651
|
dense,
|
|
15392
15652
|
checkboxes,
|
|
15393
15653
|
properties = {}
|
|
@@ -15418,9 +15678,14 @@ function useOnTheFlyModel(_ref) {
|
|
|
15418
15678
|
break;
|
|
15419
15679
|
}
|
|
15420
15680
|
const getListdefFrequencyMode = () => histogram && frequencyMode === 'N' ? 'V' : frequencyMode;
|
|
15681
|
+
const id = useRef();
|
|
15682
|
+
if (!id.current) {
|
|
15683
|
+
id.current = uid();
|
|
15684
|
+
}
|
|
15421
15685
|
const listdef = {
|
|
15422
15686
|
qInfo: {
|
|
15423
|
-
qType: 'njsListbox'
|
|
15687
|
+
qType: 'njsListbox',
|
|
15688
|
+
qId: id.current
|
|
15424
15689
|
},
|
|
15425
15690
|
qListObjectDef: {
|
|
15426
15691
|
qStateName: stateName,
|
|
@@ -15567,13 +15832,14 @@ function ListBoxWrapper(_ref) {
|
|
|
15567
15832
|
options
|
|
15568
15833
|
});
|
|
15569
15834
|
const elementRef = useRef(element);
|
|
15570
|
-
const selections = hasExternalSelectionsApi ? options.selectionsApi : useObjectSelections(app, model, elementRef, options)[0];
|
|
15835
|
+
const selections = hasExternalSelectionsApi ? options.selectionsApi : useObjectSelections(app, model, [elementRef, '.njs-action-toolbar-more'], options)[0];
|
|
15571
15836
|
if (!selections || !model) {
|
|
15572
15837
|
return null;
|
|
15573
15838
|
}
|
|
15574
15839
|
const opts = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
15575
15840
|
selections,
|
|
15576
|
-
model
|
|
15841
|
+
model,
|
|
15842
|
+
app
|
|
15577
15843
|
});
|
|
15578
15844
|
return /*#__PURE__*/React__default.createElement(ListBoxInline, {
|
|
15579
15845
|
options: opts
|
|
@@ -15640,7 +15906,8 @@ function ListBoxPopoverWrapper(_ref) {
|
|
|
15640
15906
|
transformOrigin: options.transformOrigin,
|
|
15641
15907
|
close: handleCloseShowState,
|
|
15642
15908
|
fieldName: fieldIdentifier,
|
|
15643
|
-
stateName: stateName
|
|
15909
|
+
stateName: stateName,
|
|
15910
|
+
autoFocus: options.autoFocus
|
|
15644
15911
|
});
|
|
15645
15912
|
}
|
|
15646
15913
|
|
|
@@ -17558,7 +17825,7 @@ const validateTarget = (translator, layout, properties, def) => {
|
|
|
17558
17825
|
const minD = def.dimensions.min();
|
|
17559
17826
|
const minM = def.measures.min();
|
|
17560
17827
|
const c = def.resolveLayout(layout);
|
|
17561
|
-
const reqDimErrors = validateInfo(minD, getInfo(c.qDimensionInfo), i => def.dimensions.description(properties, i), translator.get('Visualization.Invalid.Dimension'), translator.get('Visualization.UnfulfilledCalculationCondition'));
|
|
17828
|
+
const reqDimErrors = validateInfo(minD, getInfo(c.qDimensionInfo || c.qItems), i => def.dimensions.description(properties, i), translator.get('Visualization.Invalid.Dimension'), translator.get('Visualization.UnfulfilledCalculationCondition'));
|
|
17562
17829
|
const reqMeasErrors = validateInfo(minM, getInfo(c.qMeasureInfo), i => def.measures.description(properties, i), translator.get('Visualization.Invalid.Measure'), translator.get('Visualization.UnfulfilledCalculationCondition'));
|
|
17563
17830
|
return {
|
|
17564
17831
|
reqDimErrors,
|
|
@@ -17577,7 +17844,7 @@ const validateCubes = (translator, targets, layout) => {
|
|
|
17577
17844
|
const minD = def.dimensions.min();
|
|
17578
17845
|
const minM = def.measures.min();
|
|
17579
17846
|
const c = def.resolveLayout(layout);
|
|
17580
|
-
const d = getInfo(c.qDimensionInfo).filter(filterData); // Filter out optional calc conditions
|
|
17847
|
+
const d = getInfo(c.qDimensionInfo || c.qItems).filter(filterData); // Filter out optional calc conditions
|
|
17581
17848
|
const m = getInfo(c.qMeasureInfo).filter(filterData); // Filter out optional calc conditions
|
|
17582
17849
|
aggMinD += minD;
|
|
17583
17850
|
aggMinM += minM;
|
|
@@ -20784,9 +21051,9 @@ const resolveValue = (data, reference, defaultValue) => {
|
|
|
20784
21051
|
function target(def) {
|
|
20785
21052
|
const propertyPath = def.path || '/qHyperCubeDef';
|
|
20786
21053
|
const layoutPath = propertyPath.slice(0, -3);
|
|
20787
|
-
if (/\/(qHyperCube|qListObject)$/.test(layoutPath) === false) {
|
|
21054
|
+
if (/\/(qHyperCube|qListObject|qChildList)$/.test(layoutPath) === false) {
|
|
20788
21055
|
const d = layoutPath.includes('/qHyperCube') ? 'qHyperCubeDef' : 'qListObjectDef';
|
|
20789
|
-
throw new Error("Incorrect definition for ".concat(d, " at ").concat(propertyPath, ". Valid paths include /qHyperCubeDef or /
|
|
21056
|
+
throw new Error("Incorrect definition for ".concat(d, " at ").concat(propertyPath, ". Valid paths include /qHyperCubeDef, /qListObjectDef, or /qChildListDef, e.g. data/qHyperCubeDef"));
|
|
20790
21057
|
}
|
|
20791
21058
|
return {
|
|
20792
21059
|
propertyPath,
|
|
@@ -20906,1350 +21173,1603 @@ var semver = {
|
|
|
20906
21173
|
};
|
|
20907
21174
|
|
|
20908
21175
|
(function (module, exports) {
|
|
20909
|
-
|
|
20910
|
-
|
|
20911
|
-
|
|
20912
|
-
|
|
20913
|
-
|
|
20914
|
-
|
|
20915
|
-
|
|
20916
|
-
|
|
20917
|
-
|
|
20918
|
-
|
|
20919
|
-
|
|
20920
|
-
|
|
21176
|
+
exports = module.exports = SemVer;
|
|
21177
|
+
|
|
21178
|
+
var debug;
|
|
21179
|
+
/* istanbul ignore next */
|
|
21180
|
+
if (typeof process === 'object' &&
|
|
21181
|
+
process.env &&
|
|
21182
|
+
process.env.NODE_DEBUG &&
|
|
21183
|
+
/\bsemver\b/i.test(process.env.NODE_DEBUG)) {
|
|
21184
|
+
debug = function () {
|
|
21185
|
+
var args = Array.prototype.slice.call(arguments, 0);
|
|
21186
|
+
args.unshift('SEMVER');
|
|
21187
|
+
console.log.apply(console, args);
|
|
21188
|
+
};
|
|
21189
|
+
} else {
|
|
21190
|
+
debug = function () {};
|
|
21191
|
+
}
|
|
20921
21192
|
|
|
20922
|
-
|
|
20923
|
-
|
|
20924
|
-
|
|
20925
|
-
var MAX_LENGTH = 256;
|
|
20926
|
-
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */9007199254740991;
|
|
20927
|
-
|
|
20928
|
-
// Max safe segment length for coercion.
|
|
20929
|
-
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
20930
|
-
|
|
20931
|
-
// The actual regexps go on exports.re
|
|
20932
|
-
var re = exports.re = [];
|
|
20933
|
-
var src = exports.src = [];
|
|
20934
|
-
var t = exports.tokens = {};
|
|
20935
|
-
var R = 0;
|
|
20936
|
-
function tok(n) {
|
|
20937
|
-
t[n] = R++;
|
|
20938
|
-
}
|
|
20939
|
-
|
|
20940
|
-
// The following Regular Expressions can be used for tokenizing,
|
|
20941
|
-
// validating, and parsing SemVer version strings.
|
|
20942
|
-
|
|
20943
|
-
// ## Numeric Identifier
|
|
20944
|
-
// A single `0`, or a non-zero digit followed by zero or more digits.
|
|
20945
|
-
|
|
20946
|
-
tok('NUMERICIDENTIFIER');
|
|
20947
|
-
src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*';
|
|
20948
|
-
tok('NUMERICIDENTIFIERLOOSE');
|
|
20949
|
-
src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+';
|
|
20950
|
-
|
|
20951
|
-
// ## Non-numeric Identifier
|
|
20952
|
-
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
|
20953
|
-
// more letters, digits, or hyphens.
|
|
20954
|
-
|
|
20955
|
-
tok('NONNUMERICIDENTIFIER');
|
|
20956
|
-
src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
|
|
20957
|
-
|
|
20958
|
-
// ## Main Version
|
|
20959
|
-
// Three dot-separated numeric identifiers.
|
|
20960
|
-
|
|
20961
|
-
tok('MAINVERSION');
|
|
20962
|
-
src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + '(' + src[t.NUMERICIDENTIFIER] + ')';
|
|
20963
|
-
tok('MAINVERSIONLOOSE');
|
|
20964
|
-
src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')';
|
|
20965
|
-
|
|
20966
|
-
// ## Pre-release Version Identifier
|
|
20967
|
-
// A numeric identifier, or a non-numeric identifier.
|
|
20968
|
-
|
|
20969
|
-
tok('PRERELEASEIDENTIFIER');
|
|
20970
|
-
src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] + '|' + src[t.NONNUMERICIDENTIFIER] + ')';
|
|
20971
|
-
tok('PRERELEASEIDENTIFIERLOOSE');
|
|
20972
|
-
src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] + '|' + src[t.NONNUMERICIDENTIFIER] + ')';
|
|
20973
|
-
|
|
20974
|
-
// ## Pre-release Version
|
|
20975
|
-
// Hyphen, followed by one or more dot-separated pre-release version
|
|
20976
|
-
// identifiers.
|
|
20977
|
-
|
|
20978
|
-
tok('PRERELEASE');
|
|
20979
|
-
src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] + '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))';
|
|
20980
|
-
tok('PRERELEASELOOSE');
|
|
20981
|
-
src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))';
|
|
20982
|
-
|
|
20983
|
-
// ## Build Metadata Identifier
|
|
20984
|
-
// Any combination of digits, letters, or hyphens.
|
|
20985
|
-
|
|
20986
|
-
tok('BUILDIDENTIFIER');
|
|
20987
|
-
src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
|
|
20988
|
-
|
|
20989
|
-
// ## Build Metadata
|
|
20990
|
-
// Plus sign, followed by one or more period-separated build metadata
|
|
20991
|
-
// identifiers.
|
|
20992
|
-
|
|
20993
|
-
tok('BUILD');
|
|
20994
|
-
src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] + '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))';
|
|
20995
|
-
|
|
20996
|
-
// ## Full Version String
|
|
20997
|
-
// A main version, followed optionally by a pre-release version and
|
|
20998
|
-
// build metadata.
|
|
20999
|
-
|
|
21000
|
-
// Note that the only major, minor, patch, and pre-release sections of
|
|
21001
|
-
// the version string are capturing groups. The build metadata is not a
|
|
21002
|
-
// capturing group, because it should not ever be used in version
|
|
21003
|
-
// comparison.
|
|
21004
|
-
|
|
21005
|
-
tok('FULL');
|
|
21006
|
-
tok('FULLPLAIN');
|
|
21007
|
-
src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] + src[t.PRERELEASE] + '?' + src[t.BUILD] + '?';
|
|
21008
|
-
src[t.FULL] = '^' + src[t.FULLPLAIN] + '$';
|
|
21009
|
-
|
|
21010
|
-
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
|
21011
|
-
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
|
21012
|
-
// common in the npm registry.
|
|
21013
|
-
tok('LOOSEPLAIN');
|
|
21014
|
-
src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] + src[t.PRERELEASELOOSE] + '?' + src[t.BUILD] + '?';
|
|
21015
|
-
tok('LOOSE');
|
|
21016
|
-
src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$';
|
|
21017
|
-
tok('GTLT');
|
|
21018
|
-
src[t.GTLT] = '((?:<|>)?=?)';
|
|
21019
|
-
|
|
21020
|
-
// Something like "2.*" or "1.2.x".
|
|
21021
|
-
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
|
21022
|
-
// Only the first item is strictly required.
|
|
21023
|
-
tok('XRANGEIDENTIFIERLOOSE');
|
|
21024
|
-
src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
|
|
21025
|
-
tok('XRANGEIDENTIFIER');
|
|
21026
|
-
src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*';
|
|
21027
|
-
tok('XRANGEPLAIN');
|
|
21028
|
-
src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:' + src[t.PRERELEASE] + ')?' + src[t.BUILD] + '?' + ')?)?';
|
|
21029
|
-
tok('XRANGEPLAINLOOSE');
|
|
21030
|
-
src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:' + src[t.PRERELEASELOOSE] + ')?' + src[t.BUILD] + '?' + ')?)?';
|
|
21031
|
-
tok('XRANGE');
|
|
21032
|
-
src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$';
|
|
21033
|
-
tok('XRANGELOOSE');
|
|
21034
|
-
src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$';
|
|
21035
|
-
|
|
21036
|
-
// Coercion.
|
|
21037
|
-
// Extract anything that could conceivably be a part of a valid semver
|
|
21038
|
-
tok('COERCE');
|
|
21039
|
-
src[t.COERCE] = '(^|[^\\d])' + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:$|[^\\d])';
|
|
21040
|
-
tok('COERCERTL');
|
|
21041
|
-
re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g');
|
|
21042
|
-
|
|
21043
|
-
// Tilde ranges.
|
|
21044
|
-
// Meaning is "reasonably at or greater than"
|
|
21045
|
-
tok('LONETILDE');
|
|
21046
|
-
src[t.LONETILDE] = '(?:~>?)';
|
|
21047
|
-
tok('TILDETRIM');
|
|
21048
|
-
src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+';
|
|
21049
|
-
re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g');
|
|
21050
|
-
var tildeTrimReplace = '$1~';
|
|
21051
|
-
tok('TILDE');
|
|
21052
|
-
src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$';
|
|
21053
|
-
tok('TILDELOOSE');
|
|
21054
|
-
src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$';
|
|
21055
|
-
|
|
21056
|
-
// Caret ranges.
|
|
21057
|
-
// Meaning is "at least and backwards compatible with"
|
|
21058
|
-
tok('LONECARET');
|
|
21059
|
-
src[t.LONECARET] = '(?:\\^)';
|
|
21060
|
-
tok('CARETTRIM');
|
|
21061
|
-
src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+';
|
|
21062
|
-
re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g');
|
|
21063
|
-
var caretTrimReplace = '$1^';
|
|
21064
|
-
tok('CARET');
|
|
21065
|
-
src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$';
|
|
21066
|
-
tok('CARETLOOSE');
|
|
21067
|
-
src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$';
|
|
21068
|
-
|
|
21069
|
-
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
|
21070
|
-
tok('COMPARATORLOOSE');
|
|
21071
|
-
src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$';
|
|
21072
|
-
tok('COMPARATOR');
|
|
21073
|
-
src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$';
|
|
21074
|
-
|
|
21075
|
-
// An expression to strip any whitespace between the gtlt and the thing
|
|
21076
|
-
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
21077
|
-
tok('COMPARATORTRIM');
|
|
21078
|
-
src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')';
|
|
21079
|
-
|
|
21080
|
-
// this one has to use the /g flag
|
|
21081
|
-
re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g');
|
|
21082
|
-
var comparatorTrimReplace = '$1$2$3';
|
|
21083
|
-
|
|
21084
|
-
// Something like `1.2.3 - 1.2.4`
|
|
21085
|
-
// Note that these all use the loose form, because they'll be
|
|
21086
|
-
// checked against either the strict or loose comparator form
|
|
21087
|
-
// later.
|
|
21088
|
-
tok('HYPHENRANGE');
|
|
21089
|
-
src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' + '\\s+-\\s+' + '(' + src[t.XRANGEPLAIN] + ')' + '\\s*$';
|
|
21090
|
-
tok('HYPHENRANGELOOSE');
|
|
21091
|
-
src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' + '\\s+-\\s+' + '(' + src[t.XRANGEPLAINLOOSE] + ')' + '\\s*$';
|
|
21092
|
-
|
|
21093
|
-
// Star ranges basically just allow anything at all.
|
|
21094
|
-
tok('STAR');
|
|
21095
|
-
src[t.STAR] = '(<|>)?=?\\s*\\*';
|
|
21096
|
-
|
|
21097
|
-
// Compile to actual regexp objects.
|
|
21098
|
-
// All are flag-free, unless they were created above with a flag.
|
|
21099
|
-
for (var i = 0; i < R; i++) {
|
|
21100
|
-
debug(i, src[i]);
|
|
21101
|
-
if (!re[i]) {
|
|
21102
|
-
re[i] = new RegExp(src[i]);
|
|
21103
|
-
}
|
|
21104
|
-
}
|
|
21105
|
-
exports.parse = parse;
|
|
21106
|
-
function parse(version, options) {
|
|
21107
|
-
if (!options || typeof options !== 'object') {
|
|
21108
|
-
options = {
|
|
21109
|
-
loose: !!options,
|
|
21110
|
-
includePrerelease: false
|
|
21111
|
-
};
|
|
21112
|
-
}
|
|
21113
|
-
if (version instanceof SemVer) {
|
|
21114
|
-
return version;
|
|
21115
|
-
}
|
|
21116
|
-
if (typeof version !== 'string') {
|
|
21117
|
-
return null;
|
|
21118
|
-
}
|
|
21119
|
-
if (version.length > MAX_LENGTH) {
|
|
21120
|
-
return null;
|
|
21121
|
-
}
|
|
21122
|
-
var r = options.loose ? re[t.LOOSE] : re[t.FULL];
|
|
21123
|
-
if (!r.test(version)) {
|
|
21124
|
-
return null;
|
|
21125
|
-
}
|
|
21126
|
-
try {
|
|
21127
|
-
return new SemVer(version, options);
|
|
21128
|
-
} catch (er) {
|
|
21129
|
-
return null;
|
|
21130
|
-
}
|
|
21131
|
-
}
|
|
21132
|
-
exports.valid = valid;
|
|
21133
|
-
function valid(version, options) {
|
|
21134
|
-
var v = parse(version, options);
|
|
21135
|
-
return v ? v.version : null;
|
|
21136
|
-
}
|
|
21137
|
-
exports.clean = clean;
|
|
21138
|
-
function clean(version, options) {
|
|
21139
|
-
var s = parse(version.trim().replace(/^[=v]+/, ''), options);
|
|
21140
|
-
return s ? s.version : null;
|
|
21141
|
-
}
|
|
21142
|
-
exports.SemVer = SemVer;
|
|
21143
|
-
function SemVer(version, options) {
|
|
21144
|
-
if (!options || typeof options !== 'object') {
|
|
21145
|
-
options = {
|
|
21146
|
-
loose: !!options,
|
|
21147
|
-
includePrerelease: false
|
|
21148
|
-
};
|
|
21149
|
-
}
|
|
21150
|
-
if (version instanceof SemVer) {
|
|
21151
|
-
if (version.loose === options.loose) {
|
|
21152
|
-
return version;
|
|
21153
|
-
} else {
|
|
21154
|
-
version = version.version;
|
|
21155
|
-
}
|
|
21156
|
-
} else if (typeof version !== 'string') {
|
|
21157
|
-
throw new TypeError('Invalid Version: ' + version);
|
|
21158
|
-
}
|
|
21159
|
-
if (version.length > MAX_LENGTH) {
|
|
21160
|
-
throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters');
|
|
21161
|
-
}
|
|
21162
|
-
if (!(this instanceof SemVer)) {
|
|
21163
|
-
return new SemVer(version, options);
|
|
21164
|
-
}
|
|
21165
|
-
debug('SemVer', version, options);
|
|
21166
|
-
this.options = options;
|
|
21167
|
-
this.loose = !!options.loose;
|
|
21168
|
-
var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
21169
|
-
if (!m) {
|
|
21170
|
-
throw new TypeError('Invalid Version: ' + version);
|
|
21171
|
-
}
|
|
21172
|
-
this.raw = version;
|
|
21193
|
+
// Note: this is the semver.org version of the spec that it implements
|
|
21194
|
+
// Not necessarily the package version of this code.
|
|
21195
|
+
exports.SEMVER_SPEC_VERSION = '2.0.0';
|
|
21173
21196
|
|
|
21174
|
-
|
|
21175
|
-
|
|
21176
|
-
|
|
21177
|
-
this.patch = +m[3];
|
|
21178
|
-
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
21179
|
-
throw new TypeError('Invalid major version');
|
|
21180
|
-
}
|
|
21181
|
-
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
21182
|
-
throw new TypeError('Invalid minor version');
|
|
21183
|
-
}
|
|
21184
|
-
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
21185
|
-
throw new TypeError('Invalid patch version');
|
|
21186
|
-
}
|
|
21197
|
+
var MAX_LENGTH = 256;
|
|
21198
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
|
21199
|
+
/* istanbul ignore next */ 9007199254740991;
|
|
21187
21200
|
|
|
21188
|
-
|
|
21189
|
-
|
|
21190
|
-
this.prerelease = [];
|
|
21191
|
-
} else {
|
|
21192
|
-
this.prerelease = m[4].split('.').map(function (id) {
|
|
21193
|
-
if (/^[0-9]+$/.test(id)) {
|
|
21194
|
-
var num = +id;
|
|
21195
|
-
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
21196
|
-
return num;
|
|
21197
|
-
}
|
|
21198
|
-
}
|
|
21199
|
-
return id;
|
|
21200
|
-
});
|
|
21201
|
-
}
|
|
21202
|
-
this.build = m[5] ? m[5].split('.') : [];
|
|
21203
|
-
this.format();
|
|
21204
|
-
}
|
|
21205
|
-
SemVer.prototype.format = function () {
|
|
21206
|
-
this.version = this.major + '.' + this.minor + '.' + this.patch;
|
|
21207
|
-
if (this.prerelease.length) {
|
|
21208
|
-
this.version += '-' + this.prerelease.join('.');
|
|
21209
|
-
}
|
|
21210
|
-
return this.version;
|
|
21211
|
-
};
|
|
21212
|
-
SemVer.prototype.toString = function () {
|
|
21213
|
-
return this.version;
|
|
21214
|
-
};
|
|
21215
|
-
SemVer.prototype.compare = function (other) {
|
|
21216
|
-
debug('SemVer.compare', this.version, this.options, other);
|
|
21217
|
-
if (!(other instanceof SemVer)) {
|
|
21218
|
-
other = new SemVer(other, this.options);
|
|
21219
|
-
}
|
|
21220
|
-
return this.compareMain(other) || this.comparePre(other);
|
|
21221
|
-
};
|
|
21222
|
-
SemVer.prototype.compareMain = function (other) {
|
|
21223
|
-
if (!(other instanceof SemVer)) {
|
|
21224
|
-
other = new SemVer(other, this.options);
|
|
21225
|
-
}
|
|
21226
|
-
return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
|
21227
|
-
};
|
|
21228
|
-
SemVer.prototype.comparePre = function (other) {
|
|
21229
|
-
if (!(other instanceof SemVer)) {
|
|
21230
|
-
other = new SemVer(other, this.options);
|
|
21231
|
-
}
|
|
21232
|
-
|
|
21233
|
-
// NOT having a prerelease is > having one
|
|
21234
|
-
if (this.prerelease.length && !other.prerelease.length) {
|
|
21235
|
-
return -1;
|
|
21236
|
-
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
21237
|
-
return 1;
|
|
21238
|
-
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
21239
|
-
return 0;
|
|
21240
|
-
}
|
|
21241
|
-
var i = 0;
|
|
21242
|
-
do {
|
|
21243
|
-
var a = this.prerelease[i];
|
|
21244
|
-
var b = other.prerelease[i];
|
|
21245
|
-
debug('prerelease compare', i, a, b);
|
|
21246
|
-
if (a === undefined && b === undefined) {
|
|
21247
|
-
return 0;
|
|
21248
|
-
} else if (b === undefined) {
|
|
21249
|
-
return 1;
|
|
21250
|
-
} else if (a === undefined) {
|
|
21251
|
-
return -1;
|
|
21252
|
-
} else if (a === b) {
|
|
21253
|
-
continue;
|
|
21254
|
-
} else {
|
|
21255
|
-
return compareIdentifiers(a, b);
|
|
21256
|
-
}
|
|
21257
|
-
} while (++i);
|
|
21258
|
-
};
|
|
21259
|
-
SemVer.prototype.compareBuild = function (other) {
|
|
21260
|
-
if (!(other instanceof SemVer)) {
|
|
21261
|
-
other = new SemVer(other, this.options);
|
|
21262
|
-
}
|
|
21263
|
-
var i = 0;
|
|
21264
|
-
do {
|
|
21265
|
-
var a = this.build[i];
|
|
21266
|
-
var b = other.build[i];
|
|
21267
|
-
debug('prerelease compare', i, a, b);
|
|
21268
|
-
if (a === undefined && b === undefined) {
|
|
21269
|
-
return 0;
|
|
21270
|
-
} else if (b === undefined) {
|
|
21271
|
-
return 1;
|
|
21272
|
-
} else if (a === undefined) {
|
|
21273
|
-
return -1;
|
|
21274
|
-
} else if (a === b) {
|
|
21275
|
-
continue;
|
|
21276
|
-
} else {
|
|
21277
|
-
return compareIdentifiers(a, b);
|
|
21278
|
-
}
|
|
21279
|
-
} while (++i);
|
|
21280
|
-
};
|
|
21201
|
+
// Max safe segment length for coercion.
|
|
21202
|
+
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
21281
21203
|
|
|
21282
|
-
|
|
21283
|
-
|
|
21284
|
-
|
|
21285
|
-
|
|
21286
|
-
|
|
21287
|
-
this.prerelease.length = 0;
|
|
21288
|
-
this.patch = 0;
|
|
21289
|
-
this.minor = 0;
|
|
21290
|
-
this.major++;
|
|
21291
|
-
this.inc('pre', identifier);
|
|
21292
|
-
break;
|
|
21293
|
-
case 'preminor':
|
|
21294
|
-
this.prerelease.length = 0;
|
|
21295
|
-
this.patch = 0;
|
|
21296
|
-
this.minor++;
|
|
21297
|
-
this.inc('pre', identifier);
|
|
21298
|
-
break;
|
|
21299
|
-
case 'prepatch':
|
|
21300
|
-
// If this is already a prerelease, it will bump to the next version
|
|
21301
|
-
// drop any prereleases that might already exist, since they are not
|
|
21302
|
-
// relevant at this point.
|
|
21303
|
-
this.prerelease.length = 0;
|
|
21304
|
-
this.inc('patch', identifier);
|
|
21305
|
-
this.inc('pre', identifier);
|
|
21306
|
-
break;
|
|
21307
|
-
// If the input is a non-prerelease version, this acts the same as
|
|
21308
|
-
// prepatch.
|
|
21309
|
-
case 'prerelease':
|
|
21310
|
-
if (this.prerelease.length === 0) {
|
|
21311
|
-
this.inc('patch', identifier);
|
|
21312
|
-
}
|
|
21313
|
-
this.inc('pre', identifier);
|
|
21314
|
-
break;
|
|
21315
|
-
case 'major':
|
|
21316
|
-
// If this is a pre-major version, bump up to the same major version.
|
|
21317
|
-
// Otherwise increment major.
|
|
21318
|
-
// 1.0.0-5 bumps to 1.0.0
|
|
21319
|
-
// 1.1.0 bumps to 2.0.0
|
|
21320
|
-
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
21321
|
-
this.major++;
|
|
21322
|
-
}
|
|
21323
|
-
this.minor = 0;
|
|
21324
|
-
this.patch = 0;
|
|
21325
|
-
this.prerelease = [];
|
|
21326
|
-
break;
|
|
21327
|
-
case 'minor':
|
|
21328
|
-
// If this is a pre-minor version, bump up to the same minor version.
|
|
21329
|
-
// Otherwise increment minor.
|
|
21330
|
-
// 1.2.0-5 bumps to 1.2.0
|
|
21331
|
-
// 1.2.1 bumps to 1.3.0
|
|
21332
|
-
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
21333
|
-
this.minor++;
|
|
21334
|
-
}
|
|
21335
|
-
this.patch = 0;
|
|
21336
|
-
this.prerelease = [];
|
|
21337
|
-
break;
|
|
21338
|
-
case 'patch':
|
|
21339
|
-
// If this is not a pre-release version, it will increment the patch.
|
|
21340
|
-
// If it is a pre-release it will bump up to the same patch version.
|
|
21341
|
-
// 1.2.0-5 patches to 1.2.0
|
|
21342
|
-
// 1.2.0 patches to 1.2.1
|
|
21343
|
-
if (this.prerelease.length === 0) {
|
|
21344
|
-
this.patch++;
|
|
21345
|
-
}
|
|
21346
|
-
this.prerelease = [];
|
|
21347
|
-
break;
|
|
21348
|
-
// This probably shouldn't be used publicly.
|
|
21349
|
-
// 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
|
|
21350
|
-
case 'pre':
|
|
21351
|
-
if (this.prerelease.length === 0) {
|
|
21352
|
-
this.prerelease = [0];
|
|
21353
|
-
} else {
|
|
21354
|
-
var i = this.prerelease.length;
|
|
21355
|
-
while (--i >= 0) {
|
|
21356
|
-
if (typeof this.prerelease[i] === 'number') {
|
|
21357
|
-
this.prerelease[i]++;
|
|
21358
|
-
i = -2;
|
|
21359
|
-
}
|
|
21360
|
-
}
|
|
21361
|
-
if (i === -1) {
|
|
21362
|
-
// didn't increment anything
|
|
21363
|
-
this.prerelease.push(0);
|
|
21364
|
-
}
|
|
21365
|
-
}
|
|
21366
|
-
if (identifier) {
|
|
21367
|
-
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
|
21368
|
-
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
|
21369
|
-
if (this.prerelease[0] === identifier) {
|
|
21370
|
-
if (isNaN(this.prerelease[1])) {
|
|
21371
|
-
this.prerelease = [identifier, 0];
|
|
21372
|
-
}
|
|
21373
|
-
} else {
|
|
21374
|
-
this.prerelease = [identifier, 0];
|
|
21375
|
-
}
|
|
21376
|
-
}
|
|
21377
|
-
break;
|
|
21378
|
-
default:
|
|
21379
|
-
throw new Error('invalid increment argument: ' + release);
|
|
21380
|
-
}
|
|
21381
|
-
this.format();
|
|
21382
|
-
this.raw = this.version;
|
|
21383
|
-
return this;
|
|
21384
|
-
};
|
|
21385
|
-
exports.inc = inc;
|
|
21386
|
-
function inc(version, release, loose, identifier) {
|
|
21387
|
-
if (typeof loose === 'string') {
|
|
21388
|
-
identifier = loose;
|
|
21389
|
-
loose = undefined;
|
|
21390
|
-
}
|
|
21391
|
-
try {
|
|
21392
|
-
return new SemVer(version, loose).inc(release, identifier).version;
|
|
21393
|
-
} catch (er) {
|
|
21394
|
-
return null;
|
|
21395
|
-
}
|
|
21396
|
-
}
|
|
21397
|
-
exports.diff = diff;
|
|
21398
|
-
function diff(version1, version2) {
|
|
21399
|
-
if (eq(version1, version2)) {
|
|
21400
|
-
return null;
|
|
21401
|
-
} else {
|
|
21402
|
-
var v1 = parse(version1);
|
|
21403
|
-
var v2 = parse(version2);
|
|
21404
|
-
var prefix = '';
|
|
21405
|
-
if (v1.prerelease.length || v2.prerelease.length) {
|
|
21406
|
-
prefix = 'pre';
|
|
21407
|
-
var defaultResult = 'prerelease';
|
|
21408
|
-
}
|
|
21409
|
-
for (var key in v1) {
|
|
21410
|
-
if (key === 'major' || key === 'minor' || key === 'patch') {
|
|
21411
|
-
if (v1[key] !== v2[key]) {
|
|
21412
|
-
return prefix + key;
|
|
21413
|
-
}
|
|
21414
|
-
}
|
|
21415
|
-
}
|
|
21416
|
-
return defaultResult; // may be undefined
|
|
21417
|
-
}
|
|
21418
|
-
}
|
|
21204
|
+
// The actual regexps go on exports.re
|
|
21205
|
+
var re = exports.re = [];
|
|
21206
|
+
var src = exports.src = [];
|
|
21207
|
+
var t = exports.tokens = {};
|
|
21208
|
+
var R = 0;
|
|
21419
21209
|
|
|
21420
|
-
|
|
21421
|
-
|
|
21422
|
-
|
|
21423
|
-
var anum = numeric.test(a);
|
|
21424
|
-
var bnum = numeric.test(b);
|
|
21425
|
-
if (anum && bnum) {
|
|
21426
|
-
a = +a;
|
|
21427
|
-
b = +b;
|
|
21428
|
-
}
|
|
21429
|
-
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
21430
|
-
}
|
|
21431
|
-
exports.rcompareIdentifiers = rcompareIdentifiers;
|
|
21432
|
-
function rcompareIdentifiers(a, b) {
|
|
21433
|
-
return compareIdentifiers(b, a);
|
|
21434
|
-
}
|
|
21435
|
-
exports.major = major;
|
|
21436
|
-
function major(a, loose) {
|
|
21437
|
-
return new SemVer(a, loose).major;
|
|
21438
|
-
}
|
|
21439
|
-
exports.minor = minor;
|
|
21440
|
-
function minor(a, loose) {
|
|
21441
|
-
return new SemVer(a, loose).minor;
|
|
21442
|
-
}
|
|
21443
|
-
exports.patch = patch;
|
|
21444
|
-
function patch(a, loose) {
|
|
21445
|
-
return new SemVer(a, loose).patch;
|
|
21446
|
-
}
|
|
21447
|
-
exports.compare = compare;
|
|
21448
|
-
function compare(a, b, loose) {
|
|
21449
|
-
return new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
21450
|
-
}
|
|
21451
|
-
exports.compareLoose = compareLoose;
|
|
21452
|
-
function compareLoose(a, b) {
|
|
21453
|
-
return compare(a, b, true);
|
|
21454
|
-
}
|
|
21455
|
-
exports.compareBuild = compareBuild;
|
|
21456
|
-
function compareBuild(a, b, loose) {
|
|
21457
|
-
var versionA = new SemVer(a, loose);
|
|
21458
|
-
var versionB = new SemVer(b, loose);
|
|
21459
|
-
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
21460
|
-
}
|
|
21461
|
-
exports.rcompare = rcompare;
|
|
21462
|
-
function rcompare(a, b, loose) {
|
|
21463
|
-
return compare(b, a, loose);
|
|
21464
|
-
}
|
|
21465
|
-
exports.sort = sort;
|
|
21466
|
-
function sort(list, loose) {
|
|
21467
|
-
return list.sort(function (a, b) {
|
|
21468
|
-
return exports.compareBuild(a, b, loose);
|
|
21469
|
-
});
|
|
21470
|
-
}
|
|
21471
|
-
exports.rsort = rsort;
|
|
21472
|
-
function rsort(list, loose) {
|
|
21473
|
-
return list.sort(function (a, b) {
|
|
21474
|
-
return exports.compareBuild(b, a, loose);
|
|
21475
|
-
});
|
|
21476
|
-
}
|
|
21477
|
-
exports.gt = gt;
|
|
21478
|
-
function gt(a, b, loose) {
|
|
21479
|
-
return compare(a, b, loose) > 0;
|
|
21480
|
-
}
|
|
21481
|
-
exports.lt = lt;
|
|
21482
|
-
function lt(a, b, loose) {
|
|
21483
|
-
return compare(a, b, loose) < 0;
|
|
21484
|
-
}
|
|
21485
|
-
exports.eq = eq;
|
|
21486
|
-
function eq(a, b, loose) {
|
|
21487
|
-
return compare(a, b, loose) === 0;
|
|
21488
|
-
}
|
|
21489
|
-
exports.neq = neq;
|
|
21490
|
-
function neq(a, b, loose) {
|
|
21491
|
-
return compare(a, b, loose) !== 0;
|
|
21492
|
-
}
|
|
21493
|
-
exports.gte = gte;
|
|
21494
|
-
function gte(a, b, loose) {
|
|
21495
|
-
return compare(a, b, loose) >= 0;
|
|
21496
|
-
}
|
|
21497
|
-
exports.lte = lte;
|
|
21498
|
-
function lte(a, b, loose) {
|
|
21499
|
-
return compare(a, b, loose) <= 0;
|
|
21500
|
-
}
|
|
21501
|
-
exports.cmp = cmp;
|
|
21502
|
-
function cmp(a, op, b, loose) {
|
|
21503
|
-
switch (op) {
|
|
21504
|
-
case '===':
|
|
21505
|
-
if (typeof a === 'object') a = a.version;
|
|
21506
|
-
if (typeof b === 'object') b = b.version;
|
|
21507
|
-
return a === b;
|
|
21508
|
-
case '!==':
|
|
21509
|
-
if (typeof a === 'object') a = a.version;
|
|
21510
|
-
if (typeof b === 'object') b = b.version;
|
|
21511
|
-
return a !== b;
|
|
21512
|
-
case '':
|
|
21513
|
-
case '=':
|
|
21514
|
-
case '==':
|
|
21515
|
-
return eq(a, b, loose);
|
|
21516
|
-
case '!=':
|
|
21517
|
-
return neq(a, b, loose);
|
|
21518
|
-
case '>':
|
|
21519
|
-
return gt(a, b, loose);
|
|
21520
|
-
case '>=':
|
|
21521
|
-
return gte(a, b, loose);
|
|
21522
|
-
case '<':
|
|
21523
|
-
return lt(a, b, loose);
|
|
21524
|
-
case '<=':
|
|
21525
|
-
return lte(a, b, loose);
|
|
21526
|
-
default:
|
|
21527
|
-
throw new TypeError('Invalid operator: ' + op);
|
|
21528
|
-
}
|
|
21529
|
-
}
|
|
21530
|
-
exports.Comparator = Comparator;
|
|
21531
|
-
function Comparator(comp, options) {
|
|
21532
|
-
if (!options || typeof options !== 'object') {
|
|
21533
|
-
options = {
|
|
21534
|
-
loose: !!options,
|
|
21535
|
-
includePrerelease: false
|
|
21536
|
-
};
|
|
21537
|
-
}
|
|
21538
|
-
if (comp instanceof Comparator) {
|
|
21539
|
-
if (comp.loose === !!options.loose) {
|
|
21540
|
-
return comp;
|
|
21541
|
-
} else {
|
|
21542
|
-
comp = comp.value;
|
|
21543
|
-
}
|
|
21544
|
-
}
|
|
21545
|
-
if (!(this instanceof Comparator)) {
|
|
21546
|
-
return new Comparator(comp, options);
|
|
21547
|
-
}
|
|
21548
|
-
debug('comparator', comp, options);
|
|
21549
|
-
this.options = options;
|
|
21550
|
-
this.loose = !!options.loose;
|
|
21551
|
-
this.parse(comp);
|
|
21552
|
-
if (this.semver === ANY) {
|
|
21553
|
-
this.value = '';
|
|
21554
|
-
} else {
|
|
21555
|
-
this.value = this.operator + this.semver.version;
|
|
21556
|
-
}
|
|
21557
|
-
debug('comp', this);
|
|
21558
|
-
}
|
|
21559
|
-
var ANY = {};
|
|
21560
|
-
Comparator.prototype.parse = function (comp) {
|
|
21561
|
-
var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
21562
|
-
var m = comp.match(r);
|
|
21563
|
-
if (!m) {
|
|
21564
|
-
throw new TypeError('Invalid comparator: ' + comp);
|
|
21565
|
-
}
|
|
21566
|
-
this.operator = m[1] !== undefined ? m[1] : '';
|
|
21567
|
-
if (this.operator === '=') {
|
|
21568
|
-
this.operator = '';
|
|
21569
|
-
}
|
|
21210
|
+
function tok (n) {
|
|
21211
|
+
t[n] = R++;
|
|
21212
|
+
}
|
|
21570
21213
|
|
|
21571
|
-
|
|
21572
|
-
|
|
21573
|
-
this.semver = ANY;
|
|
21574
|
-
} else {
|
|
21575
|
-
this.semver = new SemVer(m[2], this.options.loose);
|
|
21576
|
-
}
|
|
21577
|
-
};
|
|
21578
|
-
Comparator.prototype.toString = function () {
|
|
21579
|
-
return this.value;
|
|
21580
|
-
};
|
|
21581
|
-
Comparator.prototype.test = function (version) {
|
|
21582
|
-
debug('Comparator.test', version, this.options.loose);
|
|
21583
|
-
if (this.semver === ANY || version === ANY) {
|
|
21584
|
-
return true;
|
|
21585
|
-
}
|
|
21586
|
-
if (typeof version === 'string') {
|
|
21587
|
-
try {
|
|
21588
|
-
version = new SemVer(version, this.options);
|
|
21589
|
-
} catch (er) {
|
|
21590
|
-
return false;
|
|
21591
|
-
}
|
|
21592
|
-
}
|
|
21593
|
-
return cmp(version, this.operator, this.semver, this.options);
|
|
21594
|
-
};
|
|
21595
|
-
Comparator.prototype.intersects = function (comp, options) {
|
|
21596
|
-
if (!(comp instanceof Comparator)) {
|
|
21597
|
-
throw new TypeError('a Comparator is required');
|
|
21598
|
-
}
|
|
21599
|
-
if (!options || typeof options !== 'object') {
|
|
21600
|
-
options = {
|
|
21601
|
-
loose: !!options,
|
|
21602
|
-
includePrerelease: false
|
|
21603
|
-
};
|
|
21604
|
-
}
|
|
21605
|
-
var rangeTmp;
|
|
21606
|
-
if (this.operator === '') {
|
|
21607
|
-
if (this.value === '') {
|
|
21608
|
-
return true;
|
|
21609
|
-
}
|
|
21610
|
-
rangeTmp = new Range(comp.value, options);
|
|
21611
|
-
return satisfies(this.value, rangeTmp, options);
|
|
21612
|
-
} else if (comp.operator === '') {
|
|
21613
|
-
if (comp.value === '') {
|
|
21614
|
-
return true;
|
|
21615
|
-
}
|
|
21616
|
-
rangeTmp = new Range(this.value, options);
|
|
21617
|
-
return satisfies(comp.semver, rangeTmp, options);
|
|
21618
|
-
}
|
|
21619
|
-
var sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>');
|
|
21620
|
-
var sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<');
|
|
21621
|
-
var sameSemVer = this.semver.version === comp.semver.version;
|
|
21622
|
-
var differentDirectionsInclusive = (this.operator === '>=' || this.operator === '<=') && (comp.operator === '>=' || comp.operator === '<=');
|
|
21623
|
-
var oppositeDirectionsLessThan = cmp(this.semver, '<', comp.semver, options) && (this.operator === '>=' || this.operator === '>') && (comp.operator === '<=' || comp.operator === '<');
|
|
21624
|
-
var oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && (this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>');
|
|
21625
|
-
return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
|
|
21626
|
-
};
|
|
21627
|
-
exports.Range = Range;
|
|
21628
|
-
function Range(range, options) {
|
|
21629
|
-
if (!options || typeof options !== 'object') {
|
|
21630
|
-
options = {
|
|
21631
|
-
loose: !!options,
|
|
21632
|
-
includePrerelease: false
|
|
21633
|
-
};
|
|
21634
|
-
}
|
|
21635
|
-
if (range instanceof Range) {
|
|
21636
|
-
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
21637
|
-
return range;
|
|
21638
|
-
} else {
|
|
21639
|
-
return new Range(range.raw, options);
|
|
21640
|
-
}
|
|
21641
|
-
}
|
|
21642
|
-
if (range instanceof Comparator) {
|
|
21643
|
-
return new Range(range.value, options);
|
|
21644
|
-
}
|
|
21645
|
-
if (!(this instanceof Range)) {
|
|
21646
|
-
return new Range(range, options);
|
|
21647
|
-
}
|
|
21648
|
-
this.options = options;
|
|
21649
|
-
this.loose = !!options.loose;
|
|
21650
|
-
this.includePrerelease = !!options.includePrerelease;
|
|
21214
|
+
// The following Regular Expressions can be used for tokenizing,
|
|
21215
|
+
// validating, and parsing SemVer version strings.
|
|
21651
21216
|
|
|
21652
|
-
|
|
21653
|
-
|
|
21654
|
-
this.set = range.split(/\s*\|\|\s*/).map(function (range) {
|
|
21655
|
-
return this.parseRange(range.trim());
|
|
21656
|
-
}, this).filter(function (c) {
|
|
21657
|
-
// throw out any that are not relevant for whatever reason
|
|
21658
|
-
return c.length;
|
|
21659
|
-
});
|
|
21660
|
-
if (!this.set.length) {
|
|
21661
|
-
throw new TypeError('Invalid SemVer Range: ' + range);
|
|
21662
|
-
}
|
|
21663
|
-
this.format();
|
|
21664
|
-
}
|
|
21665
|
-
Range.prototype.format = function () {
|
|
21666
|
-
this.range = this.set.map(function (comps) {
|
|
21667
|
-
return comps.join(' ').trim();
|
|
21668
|
-
}).join('||').trim();
|
|
21669
|
-
return this.range;
|
|
21670
|
-
};
|
|
21671
|
-
Range.prototype.toString = function () {
|
|
21672
|
-
return this.range;
|
|
21673
|
-
};
|
|
21674
|
-
Range.prototype.parseRange = function (range) {
|
|
21675
|
-
var loose = this.options.loose;
|
|
21676
|
-
range = range.trim();
|
|
21677
|
-
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
21678
|
-
var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
21679
|
-
range = range.replace(hr, hyphenReplace);
|
|
21680
|
-
debug('hyphen replace', range);
|
|
21681
|
-
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
|
21682
|
-
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
21683
|
-
debug('comparator trim', range, re[t.COMPARATORTRIM]);
|
|
21684
|
-
|
|
21685
|
-
// `~ 1.2.3` => `~1.2.3`
|
|
21686
|
-
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
21687
|
-
|
|
21688
|
-
// `^ 1.2.3` => `^1.2.3`
|
|
21689
|
-
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
21690
|
-
|
|
21691
|
-
// normalize spaces
|
|
21692
|
-
range = range.split(/\s+/).join(' ');
|
|
21693
|
-
|
|
21694
|
-
// At this point, the range is completely trimmed and
|
|
21695
|
-
// ready to be split into comparators.
|
|
21696
|
-
|
|
21697
|
-
var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
21698
|
-
var set = range.split(' ').map(function (comp) {
|
|
21699
|
-
return parseComparator(comp, this.options);
|
|
21700
|
-
}, this).join(' ').split(/\s+/);
|
|
21701
|
-
if (this.options.loose) {
|
|
21702
|
-
// in loose mode, throw out any that are not valid comparators
|
|
21703
|
-
set = set.filter(function (comp) {
|
|
21704
|
-
return !!comp.match(compRe);
|
|
21705
|
-
});
|
|
21706
|
-
}
|
|
21707
|
-
set = set.map(function (comp) {
|
|
21708
|
-
return new Comparator(comp, this.options);
|
|
21709
|
-
}, this);
|
|
21710
|
-
return set;
|
|
21711
|
-
};
|
|
21712
|
-
Range.prototype.intersects = function (range, options) {
|
|
21713
|
-
if (!(range instanceof Range)) {
|
|
21714
|
-
throw new TypeError('a Range is required');
|
|
21715
|
-
}
|
|
21716
|
-
return this.set.some(function (thisComparators) {
|
|
21717
|
-
return isSatisfiable(thisComparators, options) && range.set.some(function (rangeComparators) {
|
|
21718
|
-
return isSatisfiable(rangeComparators, options) && thisComparators.every(function (thisComparator) {
|
|
21719
|
-
return rangeComparators.every(function (rangeComparator) {
|
|
21720
|
-
return thisComparator.intersects(rangeComparator, options);
|
|
21721
|
-
});
|
|
21722
|
-
});
|
|
21723
|
-
});
|
|
21724
|
-
});
|
|
21725
|
-
};
|
|
21217
|
+
// ## Numeric Identifier
|
|
21218
|
+
// A single `0`, or a non-zero digit followed by zero or more digits.
|
|
21726
21219
|
|
|
21727
|
-
|
|
21728
|
-
|
|
21729
|
-
|
|
21730
|
-
|
|
21731
|
-
|
|
21732
|
-
|
|
21733
|
-
|
|
21734
|
-
|
|
21735
|
-
|
|
21736
|
-
|
|
21737
|
-
|
|
21738
|
-
|
|
21739
|
-
|
|
21740
|
-
|
|
21220
|
+
tok('NUMERICIDENTIFIER');
|
|
21221
|
+
src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*';
|
|
21222
|
+
tok('NUMERICIDENTIFIERLOOSE');
|
|
21223
|
+
src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+';
|
|
21224
|
+
|
|
21225
|
+
// ## Non-numeric Identifier
|
|
21226
|
+
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
|
21227
|
+
// more letters, digits, or hyphens.
|
|
21228
|
+
|
|
21229
|
+
tok('NONNUMERICIDENTIFIER');
|
|
21230
|
+
src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*';
|
|
21231
|
+
|
|
21232
|
+
// ## Main Version
|
|
21233
|
+
// Three dot-separated numeric identifiers.
|
|
21234
|
+
|
|
21235
|
+
tok('MAINVERSION');
|
|
21236
|
+
src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
|
|
21237
|
+
'(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
|
|
21238
|
+
'(' + src[t.NUMERICIDENTIFIER] + ')';
|
|
21239
|
+
|
|
21240
|
+
tok('MAINVERSIONLOOSE');
|
|
21241
|
+
src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
|
21242
|
+
'(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
|
21243
|
+
'(' + src[t.NUMERICIDENTIFIERLOOSE] + ')';
|
|
21244
|
+
|
|
21245
|
+
// ## Pre-release Version Identifier
|
|
21246
|
+
// A numeric identifier, or a non-numeric identifier.
|
|
21247
|
+
|
|
21248
|
+
tok('PRERELEASEIDENTIFIER');
|
|
21249
|
+
src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] +
|
|
21250
|
+
'|' + src[t.NONNUMERICIDENTIFIER] + ')';
|
|
21251
|
+
|
|
21252
|
+
tok('PRERELEASEIDENTIFIERLOOSE');
|
|
21253
|
+
src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] +
|
|
21254
|
+
'|' + src[t.NONNUMERICIDENTIFIER] + ')';
|
|
21255
|
+
|
|
21256
|
+
// ## Pre-release Version
|
|
21257
|
+
// Hyphen, followed by one or more dot-separated pre-release version
|
|
21258
|
+
// identifiers.
|
|
21259
|
+
|
|
21260
|
+
tok('PRERELEASE');
|
|
21261
|
+
src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] +
|
|
21262
|
+
'(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))';
|
|
21263
|
+
|
|
21264
|
+
tok('PRERELEASELOOSE');
|
|
21265
|
+
src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +
|
|
21266
|
+
'(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))';
|
|
21267
|
+
|
|
21268
|
+
// ## Build Metadata Identifier
|
|
21269
|
+
// Any combination of digits, letters, or hyphens.
|
|
21270
|
+
|
|
21271
|
+
tok('BUILDIDENTIFIER');
|
|
21272
|
+
src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+';
|
|
21273
|
+
|
|
21274
|
+
// ## Build Metadata
|
|
21275
|
+
// Plus sign, followed by one or more period-separated build metadata
|
|
21276
|
+
// identifiers.
|
|
21277
|
+
|
|
21278
|
+
tok('BUILD');
|
|
21279
|
+
src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] +
|
|
21280
|
+
'(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))';
|
|
21281
|
+
|
|
21282
|
+
// ## Full Version String
|
|
21283
|
+
// A main version, followed optionally by a pre-release version and
|
|
21284
|
+
// build metadata.
|
|
21285
|
+
|
|
21286
|
+
// Note that the only major, minor, patch, and pre-release sections of
|
|
21287
|
+
// the version string are capturing groups. The build metadata is not a
|
|
21288
|
+
// capturing group, because it should not ever be used in version
|
|
21289
|
+
// comparison.
|
|
21290
|
+
|
|
21291
|
+
tok('FULL');
|
|
21292
|
+
tok('FULLPLAIN');
|
|
21293
|
+
src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] +
|
|
21294
|
+
src[t.PRERELEASE] + '?' +
|
|
21295
|
+
src[t.BUILD] + '?';
|
|
21296
|
+
|
|
21297
|
+
src[t.FULL] = '^' + src[t.FULLPLAIN] + '$';
|
|
21298
|
+
|
|
21299
|
+
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
|
21300
|
+
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
|
21301
|
+
// common in the npm registry.
|
|
21302
|
+
tok('LOOSEPLAIN');
|
|
21303
|
+
src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] +
|
|
21304
|
+
src[t.PRERELEASELOOSE] + '?' +
|
|
21305
|
+
src[t.BUILD] + '?';
|
|
21306
|
+
|
|
21307
|
+
tok('LOOSE');
|
|
21308
|
+
src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$';
|
|
21309
|
+
|
|
21310
|
+
tok('GTLT');
|
|
21311
|
+
src[t.GTLT] = '((?:<|>)?=?)';
|
|
21312
|
+
|
|
21313
|
+
// Something like "2.*" or "1.2.x".
|
|
21314
|
+
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
|
21315
|
+
// Only the first item is strictly required.
|
|
21316
|
+
tok('XRANGEIDENTIFIERLOOSE');
|
|
21317
|
+
src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
|
|
21318
|
+
tok('XRANGEIDENTIFIER');
|
|
21319
|
+
src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*';
|
|
21320
|
+
|
|
21321
|
+
tok('XRANGEPLAIN');
|
|
21322
|
+
src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' +
|
|
21323
|
+
'(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
|
|
21324
|
+
'(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
|
|
21325
|
+
'(?:' + src[t.PRERELEASE] + ')?' +
|
|
21326
|
+
src[t.BUILD] + '?' +
|
|
21327
|
+
')?)?';
|
|
21328
|
+
|
|
21329
|
+
tok('XRANGEPLAINLOOSE');
|
|
21330
|
+
src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
|
21331
|
+
'(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
|
21332
|
+
'(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
|
21333
|
+
'(?:' + src[t.PRERELEASELOOSE] + ')?' +
|
|
21334
|
+
src[t.BUILD] + '?' +
|
|
21335
|
+
')?)?';
|
|
21336
|
+
|
|
21337
|
+
tok('XRANGE');
|
|
21338
|
+
src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$';
|
|
21339
|
+
tok('XRANGELOOSE');
|
|
21340
|
+
src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$';
|
|
21341
|
+
|
|
21342
|
+
// Coercion.
|
|
21343
|
+
// Extract anything that could conceivably be a part of a valid semver
|
|
21344
|
+
tok('COERCE');
|
|
21345
|
+
src[t.COERCE] = '(^|[^\\d])' +
|
|
21346
|
+
'(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
|
|
21347
|
+
'(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
|
|
21348
|
+
'(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
|
|
21349
|
+
'(?:$|[^\\d])';
|
|
21350
|
+
tok('COERCERTL');
|
|
21351
|
+
re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g');
|
|
21352
|
+
|
|
21353
|
+
// Tilde ranges.
|
|
21354
|
+
// Meaning is "reasonably at or greater than"
|
|
21355
|
+
tok('LONETILDE');
|
|
21356
|
+
src[t.LONETILDE] = '(?:~>?)';
|
|
21357
|
+
|
|
21358
|
+
tok('TILDETRIM');
|
|
21359
|
+
src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+';
|
|
21360
|
+
re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g');
|
|
21361
|
+
var tildeTrimReplace = '$1~';
|
|
21362
|
+
|
|
21363
|
+
tok('TILDE');
|
|
21364
|
+
src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$';
|
|
21365
|
+
tok('TILDELOOSE');
|
|
21366
|
+
src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$';
|
|
21367
|
+
|
|
21368
|
+
// Caret ranges.
|
|
21369
|
+
// Meaning is "at least and backwards compatible with"
|
|
21370
|
+
tok('LONECARET');
|
|
21371
|
+
src[t.LONECARET] = '(?:\\^)';
|
|
21372
|
+
|
|
21373
|
+
tok('CARETTRIM');
|
|
21374
|
+
src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+';
|
|
21375
|
+
re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g');
|
|
21376
|
+
var caretTrimReplace = '$1^';
|
|
21377
|
+
|
|
21378
|
+
tok('CARET');
|
|
21379
|
+
src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$';
|
|
21380
|
+
tok('CARETLOOSE');
|
|
21381
|
+
src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$';
|
|
21382
|
+
|
|
21383
|
+
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
|
21384
|
+
tok('COMPARATORLOOSE');
|
|
21385
|
+
src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$';
|
|
21386
|
+
tok('COMPARATOR');
|
|
21387
|
+
src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$';
|
|
21388
|
+
|
|
21389
|
+
// An expression to strip any whitespace between the gtlt and the thing
|
|
21390
|
+
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
21391
|
+
tok('COMPARATORTRIM');
|
|
21392
|
+
src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] +
|
|
21393
|
+
'\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')';
|
|
21394
|
+
|
|
21395
|
+
// this one has to use the /g flag
|
|
21396
|
+
re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g');
|
|
21397
|
+
var comparatorTrimReplace = '$1$2$3';
|
|
21398
|
+
|
|
21399
|
+
// Something like `1.2.3 - 1.2.4`
|
|
21400
|
+
// Note that these all use the loose form, because they'll be
|
|
21401
|
+
// checked against either the strict or loose comparator form
|
|
21402
|
+
// later.
|
|
21403
|
+
tok('HYPHENRANGE');
|
|
21404
|
+
src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' +
|
|
21405
|
+
'\\s+-\\s+' +
|
|
21406
|
+
'(' + src[t.XRANGEPLAIN] + ')' +
|
|
21407
|
+
'\\s*$';
|
|
21408
|
+
|
|
21409
|
+
tok('HYPHENRANGELOOSE');
|
|
21410
|
+
src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' +
|
|
21411
|
+
'\\s+-\\s+' +
|
|
21412
|
+
'(' + src[t.XRANGEPLAINLOOSE] + ')' +
|
|
21413
|
+
'\\s*$';
|
|
21414
|
+
|
|
21415
|
+
// Star ranges basically just allow anything at all.
|
|
21416
|
+
tok('STAR');
|
|
21417
|
+
src[t.STAR] = '(<|>)?=?\\s*\\*';
|
|
21418
|
+
|
|
21419
|
+
// Compile to actual regexp objects.
|
|
21420
|
+
// All are flag-free, unless they were created above with a flag.
|
|
21421
|
+
for (var i = 0; i < R; i++) {
|
|
21422
|
+
debug(i, src[i]);
|
|
21423
|
+
if (!re[i]) {
|
|
21424
|
+
re[i] = new RegExp(src[i]);
|
|
21425
|
+
}
|
|
21426
|
+
}
|
|
21741
21427
|
|
|
21742
|
-
|
|
21743
|
-
|
|
21744
|
-
|
|
21745
|
-
|
|
21746
|
-
|
|
21747
|
-
|
|
21748
|
-
|
|
21749
|
-
|
|
21750
|
-
|
|
21428
|
+
exports.parse = parse;
|
|
21429
|
+
function parse (version, options) {
|
|
21430
|
+
if (!options || typeof options !== 'object') {
|
|
21431
|
+
options = {
|
|
21432
|
+
loose: !!options,
|
|
21433
|
+
includePrerelease: false
|
|
21434
|
+
};
|
|
21435
|
+
}
|
|
21436
|
+
|
|
21437
|
+
if (version instanceof SemVer) {
|
|
21438
|
+
return version
|
|
21439
|
+
}
|
|
21440
|
+
|
|
21441
|
+
if (typeof version !== 'string') {
|
|
21442
|
+
return null
|
|
21443
|
+
}
|
|
21444
|
+
|
|
21445
|
+
if (version.length > MAX_LENGTH) {
|
|
21446
|
+
return null
|
|
21447
|
+
}
|
|
21448
|
+
|
|
21449
|
+
var r = options.loose ? re[t.LOOSE] : re[t.FULL];
|
|
21450
|
+
if (!r.test(version)) {
|
|
21451
|
+
return null
|
|
21452
|
+
}
|
|
21453
|
+
|
|
21454
|
+
try {
|
|
21455
|
+
return new SemVer(version, options)
|
|
21456
|
+
} catch (er) {
|
|
21457
|
+
return null
|
|
21458
|
+
}
|
|
21459
|
+
}
|
|
21751
21460
|
|
|
21752
|
-
|
|
21753
|
-
|
|
21754
|
-
|
|
21755
|
-
|
|
21756
|
-
|
|
21757
|
-
comp = replaceCarets(comp, options);
|
|
21758
|
-
debug('caret', comp);
|
|
21759
|
-
comp = replaceTildes(comp, options);
|
|
21760
|
-
debug('tildes', comp);
|
|
21761
|
-
comp = replaceXRanges(comp, options);
|
|
21762
|
-
debug('xrange', comp);
|
|
21763
|
-
comp = replaceStars(comp, options);
|
|
21764
|
-
debug('stars', comp);
|
|
21765
|
-
return comp;
|
|
21766
|
-
}
|
|
21767
|
-
function isX(id) {
|
|
21768
|
-
return !id || id.toLowerCase() === 'x' || id === '*';
|
|
21769
|
-
}
|
|
21770
|
-
|
|
21771
|
-
// ~, ~> --> * (any, kinda silly)
|
|
21772
|
-
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
|
|
21773
|
-
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
|
|
21774
|
-
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
|
|
21775
|
-
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
|
|
21776
|
-
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
|
|
21777
|
-
function replaceTildes(comp, options) {
|
|
21778
|
-
return comp.trim().split(/\s+/).map(function (comp) {
|
|
21779
|
-
return replaceTilde(comp, options);
|
|
21780
|
-
}).join(' ');
|
|
21781
|
-
}
|
|
21782
|
-
function replaceTilde(comp, options) {
|
|
21783
|
-
var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
21784
|
-
return comp.replace(r, function (_, M, m, p, pr) {
|
|
21785
|
-
debug('tilde', comp, _, M, m, p, pr);
|
|
21786
|
-
var ret;
|
|
21787
|
-
if (isX(M)) {
|
|
21788
|
-
ret = '';
|
|
21789
|
-
} else if (isX(m)) {
|
|
21790
|
-
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
|
|
21791
|
-
} else if (isX(p)) {
|
|
21792
|
-
// ~1.2 == >=1.2.0 <1.3.0
|
|
21793
|
-
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
|
|
21794
|
-
} else if (pr) {
|
|
21795
|
-
debug('replaceTilde pr', pr);
|
|
21796
|
-
ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0';
|
|
21797
|
-
} else {
|
|
21798
|
-
// ~1.2.3 == >=1.2.3 <1.3.0
|
|
21799
|
-
ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0';
|
|
21800
|
-
}
|
|
21801
|
-
debug('tilde return', ret);
|
|
21802
|
-
return ret;
|
|
21803
|
-
});
|
|
21804
|
-
}
|
|
21461
|
+
exports.valid = valid;
|
|
21462
|
+
function valid (version, options) {
|
|
21463
|
+
var v = parse(version, options);
|
|
21464
|
+
return v ? v.version : null
|
|
21465
|
+
}
|
|
21805
21466
|
|
|
21806
|
-
|
|
21807
|
-
|
|
21808
|
-
|
|
21809
|
-
|
|
21810
|
-
|
|
21811
|
-
// ^1.2.0 --> >=1.2.0 <2.0.0
|
|
21812
|
-
function replaceCarets(comp, options) {
|
|
21813
|
-
return comp.trim().split(/\s+/).map(function (comp) {
|
|
21814
|
-
return replaceCaret(comp, options);
|
|
21815
|
-
}).join(' ');
|
|
21816
|
-
}
|
|
21817
|
-
function replaceCaret(comp, options) {
|
|
21818
|
-
debug('caret', comp, options);
|
|
21819
|
-
var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
21820
|
-
return comp.replace(r, function (_, M, m, p, pr) {
|
|
21821
|
-
debug('caret', comp, _, M, m, p, pr);
|
|
21822
|
-
var ret;
|
|
21823
|
-
if (isX(M)) {
|
|
21824
|
-
ret = '';
|
|
21825
|
-
} else if (isX(m)) {
|
|
21826
|
-
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
|
|
21827
|
-
} else if (isX(p)) {
|
|
21828
|
-
if (M === '0') {
|
|
21829
|
-
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
|
|
21830
|
-
} else {
|
|
21831
|
-
ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0';
|
|
21832
|
-
}
|
|
21833
|
-
} else if (pr) {
|
|
21834
|
-
debug('replaceCaret pr', pr);
|
|
21835
|
-
if (M === '0') {
|
|
21836
|
-
if (m === '0') {
|
|
21837
|
-
ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + m + '.' + (+p + 1);
|
|
21838
|
-
} else {
|
|
21839
|
-
ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0';
|
|
21840
|
-
}
|
|
21841
|
-
} else {
|
|
21842
|
-
ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + (+M + 1) + '.0.0';
|
|
21843
|
-
}
|
|
21844
|
-
} else {
|
|
21845
|
-
debug('no pr');
|
|
21846
|
-
if (M === '0') {
|
|
21847
|
-
if (m === '0') {
|
|
21848
|
-
ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + m + '.' + (+p + 1);
|
|
21849
|
-
} else {
|
|
21850
|
-
ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0';
|
|
21851
|
-
}
|
|
21852
|
-
} else {
|
|
21853
|
-
ret = '>=' + M + '.' + m + '.' + p + ' <' + (+M + 1) + '.0.0';
|
|
21854
|
-
}
|
|
21855
|
-
}
|
|
21856
|
-
debug('caret return', ret);
|
|
21857
|
-
return ret;
|
|
21858
|
-
});
|
|
21859
|
-
}
|
|
21860
|
-
function replaceXRanges(comp, options) {
|
|
21861
|
-
debug('replaceXRanges', comp, options);
|
|
21862
|
-
return comp.split(/\s+/).map(function (comp) {
|
|
21863
|
-
return replaceXRange(comp, options);
|
|
21864
|
-
}).join(' ');
|
|
21865
|
-
}
|
|
21866
|
-
function replaceXRange(comp, options) {
|
|
21867
|
-
comp = comp.trim();
|
|
21868
|
-
var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
21869
|
-
return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
|
|
21870
|
-
debug('xRange', comp, ret, gtlt, M, m, p, pr);
|
|
21871
|
-
var xM = isX(M);
|
|
21872
|
-
var xm = xM || isX(m);
|
|
21873
|
-
var xp = xm || isX(p);
|
|
21874
|
-
var anyX = xp;
|
|
21875
|
-
if (gtlt === '=' && anyX) {
|
|
21876
|
-
gtlt = '';
|
|
21877
|
-
}
|
|
21467
|
+
exports.clean = clean;
|
|
21468
|
+
function clean (version, options) {
|
|
21469
|
+
var s = parse(version.trim().replace(/^[=v]+/, ''), options);
|
|
21470
|
+
return s ? s.version : null
|
|
21471
|
+
}
|
|
21878
21472
|
|
|
21879
|
-
|
|
21880
|
-
|
|
21881
|
-
|
|
21882
|
-
|
|
21883
|
-
|
|
21884
|
-
|
|
21885
|
-
|
|
21886
|
-
|
|
21887
|
-
|
|
21888
|
-
|
|
21889
|
-
|
|
21890
|
-
|
|
21891
|
-
|
|
21892
|
-
|
|
21893
|
-
|
|
21894
|
-
|
|
21895
|
-
|
|
21896
|
-
|
|
21897
|
-
|
|
21898
|
-
|
|
21899
|
-
|
|
21900
|
-
|
|
21901
|
-
|
|
21902
|
-
|
|
21903
|
-
|
|
21904
|
-
|
|
21905
|
-
|
|
21906
|
-
|
|
21907
|
-
|
|
21908
|
-
|
|
21909
|
-
|
|
21910
|
-
|
|
21911
|
-
|
|
21912
|
-
|
|
21913
|
-
|
|
21914
|
-
|
|
21915
|
-
|
|
21916
|
-
|
|
21917
|
-
|
|
21918
|
-
|
|
21919
|
-
|
|
21920
|
-
|
|
21921
|
-
|
|
21922
|
-
|
|
21923
|
-
|
|
21924
|
-
|
|
21925
|
-
|
|
21926
|
-
|
|
21927
|
-
|
|
21928
|
-
|
|
21929
|
-
|
|
21473
|
+
exports.SemVer = SemVer;
|
|
21474
|
+
|
|
21475
|
+
function SemVer (version, options) {
|
|
21476
|
+
if (!options || typeof options !== 'object') {
|
|
21477
|
+
options = {
|
|
21478
|
+
loose: !!options,
|
|
21479
|
+
includePrerelease: false
|
|
21480
|
+
};
|
|
21481
|
+
}
|
|
21482
|
+
if (version instanceof SemVer) {
|
|
21483
|
+
if (version.loose === options.loose) {
|
|
21484
|
+
return version
|
|
21485
|
+
} else {
|
|
21486
|
+
version = version.version;
|
|
21487
|
+
}
|
|
21488
|
+
} else if (typeof version !== 'string') {
|
|
21489
|
+
throw new TypeError('Invalid Version: ' + version)
|
|
21490
|
+
}
|
|
21491
|
+
|
|
21492
|
+
if (version.length > MAX_LENGTH) {
|
|
21493
|
+
throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')
|
|
21494
|
+
}
|
|
21495
|
+
|
|
21496
|
+
if (!(this instanceof SemVer)) {
|
|
21497
|
+
return new SemVer(version, options)
|
|
21498
|
+
}
|
|
21499
|
+
|
|
21500
|
+
debug('SemVer', version, options);
|
|
21501
|
+
this.options = options;
|
|
21502
|
+
this.loose = !!options.loose;
|
|
21503
|
+
|
|
21504
|
+
var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
21505
|
+
|
|
21506
|
+
if (!m) {
|
|
21507
|
+
throw new TypeError('Invalid Version: ' + version)
|
|
21508
|
+
}
|
|
21509
|
+
|
|
21510
|
+
this.raw = version;
|
|
21511
|
+
|
|
21512
|
+
// these are actually numbers
|
|
21513
|
+
this.major = +m[1];
|
|
21514
|
+
this.minor = +m[2];
|
|
21515
|
+
this.patch = +m[3];
|
|
21516
|
+
|
|
21517
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
21518
|
+
throw new TypeError('Invalid major version')
|
|
21519
|
+
}
|
|
21520
|
+
|
|
21521
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
21522
|
+
throw new TypeError('Invalid minor version')
|
|
21523
|
+
}
|
|
21524
|
+
|
|
21525
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
21526
|
+
throw new TypeError('Invalid patch version')
|
|
21527
|
+
}
|
|
21528
|
+
|
|
21529
|
+
// numberify any prerelease numeric ids
|
|
21530
|
+
if (!m[4]) {
|
|
21531
|
+
this.prerelease = [];
|
|
21532
|
+
} else {
|
|
21533
|
+
this.prerelease = m[4].split('.').map(function (id) {
|
|
21534
|
+
if (/^[0-9]+$/.test(id)) {
|
|
21535
|
+
var num = +id;
|
|
21536
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
21537
|
+
return num
|
|
21538
|
+
}
|
|
21539
|
+
}
|
|
21540
|
+
return id
|
|
21541
|
+
});
|
|
21542
|
+
}
|
|
21543
|
+
|
|
21544
|
+
this.build = m[5] ? m[5].split('.') : [];
|
|
21545
|
+
this.format();
|
|
21546
|
+
}
|
|
21930
21547
|
|
|
21931
|
-
|
|
21932
|
-
|
|
21933
|
-
|
|
21934
|
-
|
|
21935
|
-
|
|
21936
|
-
|
|
21937
|
-
|
|
21938
|
-
|
|
21939
|
-
|
|
21940
|
-
|
|
21941
|
-
|
|
21942
|
-
|
|
21943
|
-
|
|
21944
|
-
|
|
21945
|
-
|
|
21946
|
-
|
|
21947
|
-
|
|
21948
|
-
|
|
21949
|
-
|
|
21950
|
-
|
|
21951
|
-
|
|
21952
|
-
|
|
21953
|
-
|
|
21954
|
-
|
|
21955
|
-
|
|
21956
|
-
|
|
21957
|
-
|
|
21958
|
-
|
|
21959
|
-
|
|
21960
|
-
|
|
21961
|
-
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
|
|
21965
|
-
|
|
21966
|
-
|
|
21548
|
+
SemVer.prototype.format = function () {
|
|
21549
|
+
this.version = this.major + '.' + this.minor + '.' + this.patch;
|
|
21550
|
+
if (this.prerelease.length) {
|
|
21551
|
+
this.version += '-' + this.prerelease.join('.');
|
|
21552
|
+
}
|
|
21553
|
+
return this.version
|
|
21554
|
+
};
|
|
21555
|
+
|
|
21556
|
+
SemVer.prototype.toString = function () {
|
|
21557
|
+
return this.version
|
|
21558
|
+
};
|
|
21559
|
+
|
|
21560
|
+
SemVer.prototype.compare = function (other) {
|
|
21561
|
+
debug('SemVer.compare', this.version, this.options, other);
|
|
21562
|
+
if (!(other instanceof SemVer)) {
|
|
21563
|
+
other = new SemVer(other, this.options);
|
|
21564
|
+
}
|
|
21565
|
+
|
|
21566
|
+
return this.compareMain(other) || this.comparePre(other)
|
|
21567
|
+
};
|
|
21568
|
+
|
|
21569
|
+
SemVer.prototype.compareMain = function (other) {
|
|
21570
|
+
if (!(other instanceof SemVer)) {
|
|
21571
|
+
other = new SemVer(other, this.options);
|
|
21572
|
+
}
|
|
21573
|
+
|
|
21574
|
+
return compareIdentifiers(this.major, other.major) ||
|
|
21575
|
+
compareIdentifiers(this.minor, other.minor) ||
|
|
21576
|
+
compareIdentifiers(this.patch, other.patch)
|
|
21577
|
+
};
|
|
21578
|
+
|
|
21579
|
+
SemVer.prototype.comparePre = function (other) {
|
|
21580
|
+
if (!(other instanceof SemVer)) {
|
|
21581
|
+
other = new SemVer(other, this.options);
|
|
21582
|
+
}
|
|
21583
|
+
|
|
21584
|
+
// NOT having a prerelease is > having one
|
|
21585
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
21586
|
+
return -1
|
|
21587
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
21588
|
+
return 1
|
|
21589
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
21590
|
+
return 0
|
|
21591
|
+
}
|
|
21592
|
+
|
|
21593
|
+
var i = 0;
|
|
21594
|
+
do {
|
|
21595
|
+
var a = this.prerelease[i];
|
|
21596
|
+
var b = other.prerelease[i];
|
|
21597
|
+
debug('prerelease compare', i, a, b);
|
|
21598
|
+
if (a === undefined && b === undefined) {
|
|
21599
|
+
return 0
|
|
21600
|
+
} else if (b === undefined) {
|
|
21601
|
+
return 1
|
|
21602
|
+
} else if (a === undefined) {
|
|
21603
|
+
return -1
|
|
21604
|
+
} else if (a === b) {
|
|
21605
|
+
continue
|
|
21606
|
+
} else {
|
|
21607
|
+
return compareIdentifiers(a, b)
|
|
21608
|
+
}
|
|
21609
|
+
} while (++i)
|
|
21610
|
+
};
|
|
21611
|
+
|
|
21612
|
+
SemVer.prototype.compareBuild = function (other) {
|
|
21613
|
+
if (!(other instanceof SemVer)) {
|
|
21614
|
+
other = new SemVer(other, this.options);
|
|
21615
|
+
}
|
|
21616
|
+
|
|
21617
|
+
var i = 0;
|
|
21618
|
+
do {
|
|
21619
|
+
var a = this.build[i];
|
|
21620
|
+
var b = other.build[i];
|
|
21621
|
+
debug('prerelease compare', i, a, b);
|
|
21622
|
+
if (a === undefined && b === undefined) {
|
|
21623
|
+
return 0
|
|
21624
|
+
} else if (b === undefined) {
|
|
21625
|
+
return 1
|
|
21626
|
+
} else if (a === undefined) {
|
|
21627
|
+
return -1
|
|
21628
|
+
} else if (a === b) {
|
|
21629
|
+
continue
|
|
21630
|
+
} else {
|
|
21631
|
+
return compareIdentifiers(a, b)
|
|
21632
|
+
}
|
|
21633
|
+
} while (++i)
|
|
21634
|
+
};
|
|
21635
|
+
|
|
21636
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
21637
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
21638
|
+
SemVer.prototype.inc = function (release, identifier) {
|
|
21639
|
+
switch (release) {
|
|
21640
|
+
case 'premajor':
|
|
21641
|
+
this.prerelease.length = 0;
|
|
21642
|
+
this.patch = 0;
|
|
21643
|
+
this.minor = 0;
|
|
21644
|
+
this.major++;
|
|
21645
|
+
this.inc('pre', identifier);
|
|
21646
|
+
break
|
|
21647
|
+
case 'preminor':
|
|
21648
|
+
this.prerelease.length = 0;
|
|
21649
|
+
this.patch = 0;
|
|
21650
|
+
this.minor++;
|
|
21651
|
+
this.inc('pre', identifier);
|
|
21652
|
+
break
|
|
21653
|
+
case 'prepatch':
|
|
21654
|
+
// If this is already a prerelease, it will bump to the next version
|
|
21655
|
+
// drop any prereleases that might already exist, since they are not
|
|
21656
|
+
// relevant at this point.
|
|
21657
|
+
this.prerelease.length = 0;
|
|
21658
|
+
this.inc('patch', identifier);
|
|
21659
|
+
this.inc('pre', identifier);
|
|
21660
|
+
break
|
|
21661
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
21662
|
+
// prepatch.
|
|
21663
|
+
case 'prerelease':
|
|
21664
|
+
if (this.prerelease.length === 0) {
|
|
21665
|
+
this.inc('patch', identifier);
|
|
21666
|
+
}
|
|
21667
|
+
this.inc('pre', identifier);
|
|
21668
|
+
break
|
|
21669
|
+
|
|
21670
|
+
case 'major':
|
|
21671
|
+
// If this is a pre-major version, bump up to the same major version.
|
|
21672
|
+
// Otherwise increment major.
|
|
21673
|
+
// 1.0.0-5 bumps to 1.0.0
|
|
21674
|
+
// 1.1.0 bumps to 2.0.0
|
|
21675
|
+
if (this.minor !== 0 ||
|
|
21676
|
+
this.patch !== 0 ||
|
|
21677
|
+
this.prerelease.length === 0) {
|
|
21678
|
+
this.major++;
|
|
21679
|
+
}
|
|
21680
|
+
this.minor = 0;
|
|
21681
|
+
this.patch = 0;
|
|
21682
|
+
this.prerelease = [];
|
|
21683
|
+
break
|
|
21684
|
+
case 'minor':
|
|
21685
|
+
// If this is a pre-minor version, bump up to the same minor version.
|
|
21686
|
+
// Otherwise increment minor.
|
|
21687
|
+
// 1.2.0-5 bumps to 1.2.0
|
|
21688
|
+
// 1.2.1 bumps to 1.3.0
|
|
21689
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
21690
|
+
this.minor++;
|
|
21691
|
+
}
|
|
21692
|
+
this.patch = 0;
|
|
21693
|
+
this.prerelease = [];
|
|
21694
|
+
break
|
|
21695
|
+
case 'patch':
|
|
21696
|
+
// If this is not a pre-release version, it will increment the patch.
|
|
21697
|
+
// If it is a pre-release it will bump up to the same patch version.
|
|
21698
|
+
// 1.2.0-5 patches to 1.2.0
|
|
21699
|
+
// 1.2.0 patches to 1.2.1
|
|
21700
|
+
if (this.prerelease.length === 0) {
|
|
21701
|
+
this.patch++;
|
|
21702
|
+
}
|
|
21703
|
+
this.prerelease = [];
|
|
21704
|
+
break
|
|
21705
|
+
// This probably shouldn't be used publicly.
|
|
21706
|
+
// 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
|
|
21707
|
+
case 'pre':
|
|
21708
|
+
if (this.prerelease.length === 0) {
|
|
21709
|
+
this.prerelease = [0];
|
|
21710
|
+
} else {
|
|
21711
|
+
var i = this.prerelease.length;
|
|
21712
|
+
while (--i >= 0) {
|
|
21713
|
+
if (typeof this.prerelease[i] === 'number') {
|
|
21714
|
+
this.prerelease[i]++;
|
|
21715
|
+
i = -2;
|
|
21716
|
+
}
|
|
21717
|
+
}
|
|
21718
|
+
if (i === -1) {
|
|
21719
|
+
// didn't increment anything
|
|
21720
|
+
this.prerelease.push(0);
|
|
21721
|
+
}
|
|
21722
|
+
}
|
|
21723
|
+
if (identifier) {
|
|
21724
|
+
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
|
21725
|
+
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
|
21726
|
+
if (this.prerelease[0] === identifier) {
|
|
21727
|
+
if (isNaN(this.prerelease[1])) {
|
|
21728
|
+
this.prerelease = [identifier, 0];
|
|
21729
|
+
}
|
|
21730
|
+
} else {
|
|
21731
|
+
this.prerelease = [identifier, 0];
|
|
21732
|
+
}
|
|
21733
|
+
}
|
|
21734
|
+
break
|
|
21735
|
+
|
|
21736
|
+
default:
|
|
21737
|
+
throw new Error('invalid increment argument: ' + release)
|
|
21738
|
+
}
|
|
21739
|
+
this.format();
|
|
21740
|
+
this.raw = this.version;
|
|
21741
|
+
return this
|
|
21742
|
+
};
|
|
21743
|
+
|
|
21744
|
+
exports.inc = inc;
|
|
21745
|
+
function inc (version, release, loose, identifier) {
|
|
21746
|
+
if (typeof (loose) === 'string') {
|
|
21747
|
+
identifier = loose;
|
|
21748
|
+
loose = undefined;
|
|
21749
|
+
}
|
|
21750
|
+
|
|
21751
|
+
try {
|
|
21752
|
+
return new SemVer(version, loose).inc(release, identifier).version
|
|
21753
|
+
} catch (er) {
|
|
21754
|
+
return null
|
|
21755
|
+
}
|
|
21756
|
+
}
|
|
21967
21757
|
|
|
21968
|
-
|
|
21969
|
-
|
|
21970
|
-
|
|
21971
|
-
|
|
21972
|
-
|
|
21973
|
-
|
|
21974
|
-
|
|
21975
|
-
|
|
21976
|
-
|
|
21977
|
-
|
|
21978
|
-
|
|
21979
|
-
|
|
21980
|
-
|
|
21981
|
-
|
|
21982
|
-
|
|
21983
|
-
|
|
21984
|
-
|
|
21985
|
-
|
|
21986
|
-
|
|
21987
|
-
|
|
21988
|
-
|
|
21989
|
-
|
|
21990
|
-
return false;
|
|
21991
|
-
}
|
|
21992
|
-
}
|
|
21993
|
-
if (version.prerelease.length && !options.includePrerelease) {
|
|
21994
|
-
// Find the set of versions that are allowed to have prereleases
|
|
21995
|
-
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
|
21996
|
-
// That should allow `1.2.3-pr.2` to pass.
|
|
21997
|
-
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
|
21998
|
-
// even though it's within the range set by the comparators.
|
|
21999
|
-
for (i = 0; i < set.length; i++) {
|
|
22000
|
-
debug(set[i].semver);
|
|
22001
|
-
if (set[i].semver === ANY) {
|
|
22002
|
-
continue;
|
|
22003
|
-
}
|
|
22004
|
-
if (set[i].semver.prerelease.length > 0) {
|
|
22005
|
-
var allowed = set[i].semver;
|
|
22006
|
-
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
22007
|
-
return true;
|
|
22008
|
-
}
|
|
22009
|
-
}
|
|
22010
|
-
}
|
|
21758
|
+
exports.diff = diff;
|
|
21759
|
+
function diff (version1, version2) {
|
|
21760
|
+
if (eq(version1, version2)) {
|
|
21761
|
+
return null
|
|
21762
|
+
} else {
|
|
21763
|
+
var v1 = parse(version1);
|
|
21764
|
+
var v2 = parse(version2);
|
|
21765
|
+
var prefix = '';
|
|
21766
|
+
if (v1.prerelease.length || v2.prerelease.length) {
|
|
21767
|
+
prefix = 'pre';
|
|
21768
|
+
var defaultResult = 'prerelease';
|
|
21769
|
+
}
|
|
21770
|
+
for (var key in v1) {
|
|
21771
|
+
if (key === 'major' || key === 'minor' || key === 'patch') {
|
|
21772
|
+
if (v1[key] !== v2[key]) {
|
|
21773
|
+
return prefix + key
|
|
21774
|
+
}
|
|
21775
|
+
}
|
|
21776
|
+
}
|
|
21777
|
+
return defaultResult // may be undefined
|
|
21778
|
+
}
|
|
21779
|
+
}
|
|
22011
21780
|
|
|
22012
|
-
|
|
22013
|
-
return false;
|
|
22014
|
-
}
|
|
22015
|
-
return true;
|
|
22016
|
-
}
|
|
22017
|
-
exports.satisfies = satisfies;
|
|
22018
|
-
function satisfies(version, range, options) {
|
|
22019
|
-
try {
|
|
22020
|
-
range = new Range(range, options);
|
|
22021
|
-
} catch (er) {
|
|
22022
|
-
return false;
|
|
22023
|
-
}
|
|
22024
|
-
return range.test(version);
|
|
22025
|
-
}
|
|
22026
|
-
exports.maxSatisfying = maxSatisfying;
|
|
22027
|
-
function maxSatisfying(versions, range, options) {
|
|
22028
|
-
var max = null;
|
|
22029
|
-
var maxSV = null;
|
|
22030
|
-
try {
|
|
22031
|
-
var rangeObj = new Range(range, options);
|
|
22032
|
-
} catch (er) {
|
|
22033
|
-
return null;
|
|
22034
|
-
}
|
|
22035
|
-
versions.forEach(function (v) {
|
|
22036
|
-
if (rangeObj.test(v)) {
|
|
22037
|
-
// satisfies(v, range, options)
|
|
22038
|
-
if (!max || maxSV.compare(v) === -1) {
|
|
22039
|
-
// compare(max, v, true)
|
|
22040
|
-
max = v;
|
|
22041
|
-
maxSV = new SemVer(max, options);
|
|
22042
|
-
}
|
|
22043
|
-
}
|
|
22044
|
-
});
|
|
22045
|
-
return max;
|
|
22046
|
-
}
|
|
22047
|
-
exports.minSatisfying = minSatisfying;
|
|
22048
|
-
function minSatisfying(versions, range, options) {
|
|
22049
|
-
var min = null;
|
|
22050
|
-
var minSV = null;
|
|
22051
|
-
try {
|
|
22052
|
-
var rangeObj = new Range(range, options);
|
|
22053
|
-
} catch (er) {
|
|
22054
|
-
return null;
|
|
22055
|
-
}
|
|
22056
|
-
versions.forEach(function (v) {
|
|
22057
|
-
if (rangeObj.test(v)) {
|
|
22058
|
-
// satisfies(v, range, options)
|
|
22059
|
-
if (!min || minSV.compare(v) === 1) {
|
|
22060
|
-
// compare(min, v, true)
|
|
22061
|
-
min = v;
|
|
22062
|
-
minSV = new SemVer(min, options);
|
|
22063
|
-
}
|
|
22064
|
-
}
|
|
22065
|
-
});
|
|
22066
|
-
return min;
|
|
22067
|
-
}
|
|
22068
|
-
exports.minVersion = minVersion;
|
|
22069
|
-
function minVersion(range, loose) {
|
|
22070
|
-
range = new Range(range, loose);
|
|
22071
|
-
var minver = new SemVer('0.0.0');
|
|
22072
|
-
if (range.test(minver)) {
|
|
22073
|
-
return minver;
|
|
22074
|
-
}
|
|
22075
|
-
minver = new SemVer('0.0.0-0');
|
|
22076
|
-
if (range.test(minver)) {
|
|
22077
|
-
return minver;
|
|
22078
|
-
}
|
|
22079
|
-
minver = null;
|
|
22080
|
-
for (var i = 0; i < range.set.length; ++i) {
|
|
22081
|
-
var comparators = range.set[i];
|
|
22082
|
-
comparators.forEach(function (comparator) {
|
|
22083
|
-
// Clone to avoid manipulating the comparator's semver object.
|
|
22084
|
-
var compver = new SemVer(comparator.semver.version);
|
|
22085
|
-
switch (comparator.operator) {
|
|
22086
|
-
case '>':
|
|
22087
|
-
if (compver.prerelease.length === 0) {
|
|
22088
|
-
compver.patch++;
|
|
22089
|
-
} else {
|
|
22090
|
-
compver.prerelease.push(0);
|
|
22091
|
-
}
|
|
22092
|
-
compver.raw = compver.format();
|
|
22093
|
-
/* fallthrough */
|
|
22094
|
-
case '':
|
|
22095
|
-
case '>=':
|
|
22096
|
-
if (!minver || gt(minver, compver)) {
|
|
22097
|
-
minver = compver;
|
|
22098
|
-
}
|
|
22099
|
-
break;
|
|
22100
|
-
case '<':
|
|
22101
|
-
case '<=':
|
|
22102
|
-
/* Ignore maximum versions */
|
|
22103
|
-
break;
|
|
22104
|
-
/* istanbul ignore next */
|
|
22105
|
-
default:
|
|
22106
|
-
throw new Error('Unexpected operation: ' + comparator.operator);
|
|
22107
|
-
}
|
|
22108
|
-
});
|
|
22109
|
-
}
|
|
22110
|
-
if (minver && range.test(minver)) {
|
|
22111
|
-
return minver;
|
|
22112
|
-
}
|
|
22113
|
-
return null;
|
|
22114
|
-
}
|
|
22115
|
-
exports.validRange = validRange;
|
|
22116
|
-
function validRange(range, options) {
|
|
22117
|
-
try {
|
|
22118
|
-
// Return '*' instead of '' so that truthiness works.
|
|
22119
|
-
// This will throw if it's invalid anyway
|
|
22120
|
-
return new Range(range, options).range || '*';
|
|
22121
|
-
} catch (er) {
|
|
22122
|
-
return null;
|
|
22123
|
-
}
|
|
22124
|
-
}
|
|
21781
|
+
exports.compareIdentifiers = compareIdentifiers;
|
|
22125
21782
|
|
|
22126
|
-
|
|
22127
|
-
|
|
22128
|
-
|
|
22129
|
-
|
|
22130
|
-
}
|
|
21783
|
+
var numeric = /^[0-9]+$/;
|
|
21784
|
+
function compareIdentifiers (a, b) {
|
|
21785
|
+
var anum = numeric.test(a);
|
|
21786
|
+
var bnum = numeric.test(b);
|
|
22131
21787
|
|
|
22132
|
-
|
|
22133
|
-
|
|
22134
|
-
|
|
22135
|
-
|
|
22136
|
-
}
|
|
22137
|
-
exports.outside = outside;
|
|
22138
|
-
function outside(version, range, hilo, options) {
|
|
22139
|
-
version = new SemVer(version, options);
|
|
22140
|
-
range = new Range(range, options);
|
|
22141
|
-
var gtfn, ltefn, ltfn, comp, ecomp;
|
|
22142
|
-
switch (hilo) {
|
|
22143
|
-
case '>':
|
|
22144
|
-
gtfn = gt;
|
|
22145
|
-
ltefn = lte;
|
|
22146
|
-
ltfn = lt;
|
|
22147
|
-
comp = '>';
|
|
22148
|
-
ecomp = '>=';
|
|
22149
|
-
break;
|
|
22150
|
-
case '<':
|
|
22151
|
-
gtfn = lt;
|
|
22152
|
-
ltefn = gte;
|
|
22153
|
-
ltfn = gt;
|
|
22154
|
-
comp = '<';
|
|
22155
|
-
ecomp = '<=';
|
|
22156
|
-
break;
|
|
22157
|
-
default:
|
|
22158
|
-
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
22159
|
-
}
|
|
21788
|
+
if (anum && bnum) {
|
|
21789
|
+
a = +a;
|
|
21790
|
+
b = +b;
|
|
21791
|
+
}
|
|
22160
21792
|
|
|
22161
|
-
|
|
22162
|
-
|
|
22163
|
-
|
|
22164
|
-
|
|
21793
|
+
return a === b ? 0
|
|
21794
|
+
: (anum && !bnum) ? -1
|
|
21795
|
+
: (bnum && !anum) ? 1
|
|
21796
|
+
: a < b ? -1
|
|
21797
|
+
: 1
|
|
21798
|
+
}
|
|
22165
21799
|
|
|
22166
|
-
|
|
22167
|
-
|
|
21800
|
+
exports.rcompareIdentifiers = rcompareIdentifiers;
|
|
21801
|
+
function rcompareIdentifiers (a, b) {
|
|
21802
|
+
return compareIdentifiers(b, a)
|
|
21803
|
+
}
|
|
22168
21804
|
|
|
22169
|
-
|
|
22170
|
-
|
|
22171
|
-
|
|
22172
|
-
|
|
22173
|
-
comparators.forEach(function (comparator) {
|
|
22174
|
-
if (comparator.semver === ANY) {
|
|
22175
|
-
comparator = new Comparator('>=0.0.0');
|
|
22176
|
-
}
|
|
22177
|
-
high = high || comparator;
|
|
22178
|
-
low = low || comparator;
|
|
22179
|
-
if (gtfn(comparator.semver, high.semver, options)) {
|
|
22180
|
-
high = comparator;
|
|
22181
|
-
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
22182
|
-
low = comparator;
|
|
22183
|
-
}
|
|
22184
|
-
});
|
|
21805
|
+
exports.major = major;
|
|
21806
|
+
function major (a, loose) {
|
|
21807
|
+
return new SemVer(a, loose).major
|
|
21808
|
+
}
|
|
22185
21809
|
|
|
22186
|
-
|
|
22187
|
-
|
|
22188
|
-
|
|
22189
|
-
|
|
22190
|
-
}
|
|
21810
|
+
exports.minor = minor;
|
|
21811
|
+
function minor (a, loose) {
|
|
21812
|
+
return new SemVer(a, loose).minor
|
|
21813
|
+
}
|
|
22191
21814
|
|
|
22192
|
-
|
|
22193
|
-
|
|
22194
|
-
|
|
22195
|
-
|
|
22196
|
-
|
|
22197
|
-
|
|
22198
|
-
|
|
22199
|
-
|
|
22200
|
-
|
|
22201
|
-
|
|
22202
|
-
|
|
22203
|
-
|
|
22204
|
-
|
|
22205
|
-
|
|
22206
|
-
|
|
22207
|
-
|
|
22208
|
-
|
|
22209
|
-
|
|
22210
|
-
|
|
22211
|
-
|
|
22212
|
-
|
|
22213
|
-
|
|
22214
|
-
|
|
22215
|
-
|
|
22216
|
-
|
|
22217
|
-
|
|
22218
|
-
|
|
22219
|
-
|
|
22220
|
-
|
|
22221
|
-
|
|
22222
|
-
|
|
22223
|
-
|
|
22224
|
-
|
|
22225
|
-
|
|
22226
|
-
|
|
22227
|
-
|
|
22228
|
-
|
|
22229
|
-
|
|
22230
|
-
|
|
22231
|
-
|
|
22232
|
-
|
|
22233
|
-
|
|
22234
|
-
|
|
22235
|
-
|
|
22236
|
-
|
|
22237
|
-
|
|
22238
|
-
|
|
22239
|
-
|
|
22240
|
-
|
|
22241
|
-
|
|
22242
|
-
|
|
22243
|
-
|
|
22244
|
-
|
|
22245
|
-
|
|
22246
|
-
|
|
22247
|
-
|
|
22248
|
-
|
|
22249
|
-
|
|
22250
|
-
|
|
22251
|
-
|
|
22252
|
-
|
|
21815
|
+
exports.patch = patch;
|
|
21816
|
+
function patch (a, loose) {
|
|
21817
|
+
return new SemVer(a, loose).patch
|
|
21818
|
+
}
|
|
21819
|
+
|
|
21820
|
+
exports.compare = compare;
|
|
21821
|
+
function compare (a, b, loose) {
|
|
21822
|
+
return new SemVer(a, loose).compare(new SemVer(b, loose))
|
|
21823
|
+
}
|
|
21824
|
+
|
|
21825
|
+
exports.compareLoose = compareLoose;
|
|
21826
|
+
function compareLoose (a, b) {
|
|
21827
|
+
return compare(a, b, true)
|
|
21828
|
+
}
|
|
21829
|
+
|
|
21830
|
+
exports.compareBuild = compareBuild;
|
|
21831
|
+
function compareBuild (a, b, loose) {
|
|
21832
|
+
var versionA = new SemVer(a, loose);
|
|
21833
|
+
var versionB = new SemVer(b, loose);
|
|
21834
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB)
|
|
21835
|
+
}
|
|
21836
|
+
|
|
21837
|
+
exports.rcompare = rcompare;
|
|
21838
|
+
function rcompare (a, b, loose) {
|
|
21839
|
+
return compare(b, a, loose)
|
|
21840
|
+
}
|
|
21841
|
+
|
|
21842
|
+
exports.sort = sort;
|
|
21843
|
+
function sort (list, loose) {
|
|
21844
|
+
return list.sort(function (a, b) {
|
|
21845
|
+
return exports.compareBuild(a, b, loose)
|
|
21846
|
+
})
|
|
21847
|
+
}
|
|
21848
|
+
|
|
21849
|
+
exports.rsort = rsort;
|
|
21850
|
+
function rsort (list, loose) {
|
|
21851
|
+
return list.sort(function (a, b) {
|
|
21852
|
+
return exports.compareBuild(b, a, loose)
|
|
21853
|
+
})
|
|
21854
|
+
}
|
|
21855
|
+
|
|
21856
|
+
exports.gt = gt;
|
|
21857
|
+
function gt (a, b, loose) {
|
|
21858
|
+
return compare(a, b, loose) > 0
|
|
21859
|
+
}
|
|
21860
|
+
|
|
21861
|
+
exports.lt = lt;
|
|
21862
|
+
function lt (a, b, loose) {
|
|
21863
|
+
return compare(a, b, loose) < 0
|
|
21864
|
+
}
|
|
21865
|
+
|
|
21866
|
+
exports.eq = eq;
|
|
21867
|
+
function eq (a, b, loose) {
|
|
21868
|
+
return compare(a, b, loose) === 0
|
|
21869
|
+
}
|
|
21870
|
+
|
|
21871
|
+
exports.neq = neq;
|
|
21872
|
+
function neq (a, b, loose) {
|
|
21873
|
+
return compare(a, b, loose) !== 0
|
|
21874
|
+
}
|
|
21875
|
+
|
|
21876
|
+
exports.gte = gte;
|
|
21877
|
+
function gte (a, b, loose) {
|
|
21878
|
+
return compare(a, b, loose) >= 0
|
|
21879
|
+
}
|
|
21880
|
+
|
|
21881
|
+
exports.lte = lte;
|
|
21882
|
+
function lte (a, b, loose) {
|
|
21883
|
+
return compare(a, b, loose) <= 0
|
|
21884
|
+
}
|
|
21885
|
+
|
|
21886
|
+
exports.cmp = cmp;
|
|
21887
|
+
function cmp (a, op, b, loose) {
|
|
21888
|
+
switch (op) {
|
|
21889
|
+
case '===':
|
|
21890
|
+
if (typeof a === 'object')
|
|
21891
|
+
a = a.version;
|
|
21892
|
+
if (typeof b === 'object')
|
|
21893
|
+
b = b.version;
|
|
21894
|
+
return a === b
|
|
21895
|
+
|
|
21896
|
+
case '!==':
|
|
21897
|
+
if (typeof a === 'object')
|
|
21898
|
+
a = a.version;
|
|
21899
|
+
if (typeof b === 'object')
|
|
21900
|
+
b = b.version;
|
|
21901
|
+
return a !== b
|
|
21902
|
+
|
|
21903
|
+
case '':
|
|
21904
|
+
case '=':
|
|
21905
|
+
case '==':
|
|
21906
|
+
return eq(a, b, loose)
|
|
21907
|
+
|
|
21908
|
+
case '!=':
|
|
21909
|
+
return neq(a, b, loose)
|
|
21910
|
+
|
|
21911
|
+
case '>':
|
|
21912
|
+
return gt(a, b, loose)
|
|
21913
|
+
|
|
21914
|
+
case '>=':
|
|
21915
|
+
return gte(a, b, loose)
|
|
21916
|
+
|
|
21917
|
+
case '<':
|
|
21918
|
+
return lt(a, b, loose)
|
|
21919
|
+
|
|
21920
|
+
case '<=':
|
|
21921
|
+
return lte(a, b, loose)
|
|
21922
|
+
|
|
21923
|
+
default:
|
|
21924
|
+
throw new TypeError('Invalid operator: ' + op)
|
|
21925
|
+
}
|
|
21926
|
+
}
|
|
21927
|
+
|
|
21928
|
+
exports.Comparator = Comparator;
|
|
21929
|
+
function Comparator (comp, options) {
|
|
21930
|
+
if (!options || typeof options !== 'object') {
|
|
21931
|
+
options = {
|
|
21932
|
+
loose: !!options,
|
|
21933
|
+
includePrerelease: false
|
|
21934
|
+
};
|
|
21935
|
+
}
|
|
21936
|
+
|
|
21937
|
+
if (comp instanceof Comparator) {
|
|
21938
|
+
if (comp.loose === !!options.loose) {
|
|
21939
|
+
return comp
|
|
21940
|
+
} else {
|
|
21941
|
+
comp = comp.value;
|
|
21942
|
+
}
|
|
21943
|
+
}
|
|
21944
|
+
|
|
21945
|
+
if (!(this instanceof Comparator)) {
|
|
21946
|
+
return new Comparator(comp, options)
|
|
21947
|
+
}
|
|
21948
|
+
|
|
21949
|
+
debug('comparator', comp, options);
|
|
21950
|
+
this.options = options;
|
|
21951
|
+
this.loose = !!options.loose;
|
|
21952
|
+
this.parse(comp);
|
|
21953
|
+
|
|
21954
|
+
if (this.semver === ANY) {
|
|
21955
|
+
this.value = '';
|
|
21956
|
+
} else {
|
|
21957
|
+
this.value = this.operator + this.semver.version;
|
|
21958
|
+
}
|
|
21959
|
+
|
|
21960
|
+
debug('comp', this);
|
|
21961
|
+
}
|
|
21962
|
+
|
|
21963
|
+
var ANY = {};
|
|
21964
|
+
Comparator.prototype.parse = function (comp) {
|
|
21965
|
+
var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
21966
|
+
var m = comp.match(r);
|
|
21967
|
+
|
|
21968
|
+
if (!m) {
|
|
21969
|
+
throw new TypeError('Invalid comparator: ' + comp)
|
|
21970
|
+
}
|
|
21971
|
+
|
|
21972
|
+
this.operator = m[1] !== undefined ? m[1] : '';
|
|
21973
|
+
if (this.operator === '=') {
|
|
21974
|
+
this.operator = '';
|
|
21975
|
+
}
|
|
21976
|
+
|
|
21977
|
+
// if it literally is just '>' or '' then allow anything.
|
|
21978
|
+
if (!m[2]) {
|
|
21979
|
+
this.semver = ANY;
|
|
21980
|
+
} else {
|
|
21981
|
+
this.semver = new SemVer(m[2], this.options.loose);
|
|
21982
|
+
}
|
|
21983
|
+
};
|
|
21984
|
+
|
|
21985
|
+
Comparator.prototype.toString = function () {
|
|
21986
|
+
return this.value
|
|
21987
|
+
};
|
|
21988
|
+
|
|
21989
|
+
Comparator.prototype.test = function (version) {
|
|
21990
|
+
debug('Comparator.test', version, this.options.loose);
|
|
21991
|
+
|
|
21992
|
+
if (this.semver === ANY || version === ANY) {
|
|
21993
|
+
return true
|
|
21994
|
+
}
|
|
21995
|
+
|
|
21996
|
+
if (typeof version === 'string') {
|
|
21997
|
+
try {
|
|
21998
|
+
version = new SemVer(version, this.options);
|
|
21999
|
+
} catch (er) {
|
|
22000
|
+
return false
|
|
22001
|
+
}
|
|
22002
|
+
}
|
|
22003
|
+
|
|
22004
|
+
return cmp(version, this.operator, this.semver, this.options)
|
|
22005
|
+
};
|
|
22006
|
+
|
|
22007
|
+
Comparator.prototype.intersects = function (comp, options) {
|
|
22008
|
+
if (!(comp instanceof Comparator)) {
|
|
22009
|
+
throw new TypeError('a Comparator is required')
|
|
22010
|
+
}
|
|
22011
|
+
|
|
22012
|
+
if (!options || typeof options !== 'object') {
|
|
22013
|
+
options = {
|
|
22014
|
+
loose: !!options,
|
|
22015
|
+
includePrerelease: false
|
|
22016
|
+
};
|
|
22017
|
+
}
|
|
22018
|
+
|
|
22019
|
+
var rangeTmp;
|
|
22020
|
+
|
|
22021
|
+
if (this.operator === '') {
|
|
22022
|
+
if (this.value === '') {
|
|
22023
|
+
return true
|
|
22024
|
+
}
|
|
22025
|
+
rangeTmp = new Range(comp.value, options);
|
|
22026
|
+
return satisfies(this.value, rangeTmp, options)
|
|
22027
|
+
} else if (comp.operator === '') {
|
|
22028
|
+
if (comp.value === '') {
|
|
22029
|
+
return true
|
|
22030
|
+
}
|
|
22031
|
+
rangeTmp = new Range(this.value, options);
|
|
22032
|
+
return satisfies(comp.semver, rangeTmp, options)
|
|
22033
|
+
}
|
|
22034
|
+
|
|
22035
|
+
var sameDirectionIncreasing =
|
|
22036
|
+
(this.operator === '>=' || this.operator === '>') &&
|
|
22037
|
+
(comp.operator === '>=' || comp.operator === '>');
|
|
22038
|
+
var sameDirectionDecreasing =
|
|
22039
|
+
(this.operator === '<=' || this.operator === '<') &&
|
|
22040
|
+
(comp.operator === '<=' || comp.operator === '<');
|
|
22041
|
+
var sameSemVer = this.semver.version === comp.semver.version;
|
|
22042
|
+
var differentDirectionsInclusive =
|
|
22043
|
+
(this.operator === '>=' || this.operator === '<=') &&
|
|
22044
|
+
(comp.operator === '>=' || comp.operator === '<=');
|
|
22045
|
+
var oppositeDirectionsLessThan =
|
|
22046
|
+
cmp(this.semver, '<', comp.semver, options) &&
|
|
22047
|
+
((this.operator === '>=' || this.operator === '>') &&
|
|
22048
|
+
(comp.operator === '<=' || comp.operator === '<'));
|
|
22049
|
+
var oppositeDirectionsGreaterThan =
|
|
22050
|
+
cmp(this.semver, '>', comp.semver, options) &&
|
|
22051
|
+
((this.operator === '<=' || this.operator === '<') &&
|
|
22052
|
+
(comp.operator === '>=' || comp.operator === '>'));
|
|
22053
|
+
|
|
22054
|
+
return sameDirectionIncreasing || sameDirectionDecreasing ||
|
|
22055
|
+
(sameSemVer && differentDirectionsInclusive) ||
|
|
22056
|
+
oppositeDirectionsLessThan || oppositeDirectionsGreaterThan
|
|
22057
|
+
};
|
|
22058
|
+
|
|
22059
|
+
exports.Range = Range;
|
|
22060
|
+
function Range (range, options) {
|
|
22061
|
+
if (!options || typeof options !== 'object') {
|
|
22062
|
+
options = {
|
|
22063
|
+
loose: !!options,
|
|
22064
|
+
includePrerelease: false
|
|
22065
|
+
};
|
|
22066
|
+
}
|
|
22067
|
+
|
|
22068
|
+
if (range instanceof Range) {
|
|
22069
|
+
if (range.loose === !!options.loose &&
|
|
22070
|
+
range.includePrerelease === !!options.includePrerelease) {
|
|
22071
|
+
return range
|
|
22072
|
+
} else {
|
|
22073
|
+
return new Range(range.raw, options)
|
|
22074
|
+
}
|
|
22075
|
+
}
|
|
22076
|
+
|
|
22077
|
+
if (range instanceof Comparator) {
|
|
22078
|
+
return new Range(range.value, options)
|
|
22079
|
+
}
|
|
22080
|
+
|
|
22081
|
+
if (!(this instanceof Range)) {
|
|
22082
|
+
return new Range(range, options)
|
|
22083
|
+
}
|
|
22084
|
+
|
|
22085
|
+
this.options = options;
|
|
22086
|
+
this.loose = !!options.loose;
|
|
22087
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
22088
|
+
|
|
22089
|
+
// First, split based on boolean or ||
|
|
22090
|
+
this.raw = range;
|
|
22091
|
+
this.set = range.split(/\s*\|\|\s*/).map(function (range) {
|
|
22092
|
+
return this.parseRange(range.trim())
|
|
22093
|
+
}, this).filter(function (c) {
|
|
22094
|
+
// throw out any that are not relevant for whatever reason
|
|
22095
|
+
return c.length
|
|
22096
|
+
});
|
|
22097
|
+
|
|
22098
|
+
if (!this.set.length) {
|
|
22099
|
+
throw new TypeError('Invalid SemVer Range: ' + range)
|
|
22100
|
+
}
|
|
22101
|
+
|
|
22102
|
+
this.format();
|
|
22103
|
+
}
|
|
22104
|
+
|
|
22105
|
+
Range.prototype.format = function () {
|
|
22106
|
+
this.range = this.set.map(function (comps) {
|
|
22107
|
+
return comps.join(' ').trim()
|
|
22108
|
+
}).join('||').trim();
|
|
22109
|
+
return this.range
|
|
22110
|
+
};
|
|
22111
|
+
|
|
22112
|
+
Range.prototype.toString = function () {
|
|
22113
|
+
return this.range
|
|
22114
|
+
};
|
|
22115
|
+
|
|
22116
|
+
Range.prototype.parseRange = function (range) {
|
|
22117
|
+
var loose = this.options.loose;
|
|
22118
|
+
range = range.trim();
|
|
22119
|
+
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
22120
|
+
var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
22121
|
+
range = range.replace(hr, hyphenReplace);
|
|
22122
|
+
debug('hyphen replace', range);
|
|
22123
|
+
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
|
22124
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
22125
|
+
debug('comparator trim', range, re[t.COMPARATORTRIM]);
|
|
22126
|
+
|
|
22127
|
+
// `~ 1.2.3` => `~1.2.3`
|
|
22128
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
22129
|
+
|
|
22130
|
+
// `^ 1.2.3` => `^1.2.3`
|
|
22131
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
22132
|
+
|
|
22133
|
+
// normalize spaces
|
|
22134
|
+
range = range.split(/\s+/).join(' ');
|
|
22135
|
+
|
|
22136
|
+
// At this point, the range is completely trimmed and
|
|
22137
|
+
// ready to be split into comparators.
|
|
22138
|
+
|
|
22139
|
+
var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
22140
|
+
var set = range.split(' ').map(function (comp) {
|
|
22141
|
+
return parseComparator(comp, this.options)
|
|
22142
|
+
}, this).join(' ').split(/\s+/);
|
|
22143
|
+
if (this.options.loose) {
|
|
22144
|
+
// in loose mode, throw out any that are not valid comparators
|
|
22145
|
+
set = set.filter(function (comp) {
|
|
22146
|
+
return !!comp.match(compRe)
|
|
22147
|
+
});
|
|
22148
|
+
}
|
|
22149
|
+
set = set.map(function (comp) {
|
|
22150
|
+
return new Comparator(comp, this.options)
|
|
22151
|
+
}, this);
|
|
22152
|
+
|
|
22153
|
+
return set
|
|
22154
|
+
};
|
|
22155
|
+
|
|
22156
|
+
Range.prototype.intersects = function (range, options) {
|
|
22157
|
+
if (!(range instanceof Range)) {
|
|
22158
|
+
throw new TypeError('a Range is required')
|
|
22159
|
+
}
|
|
22160
|
+
|
|
22161
|
+
return this.set.some(function (thisComparators) {
|
|
22162
|
+
return (
|
|
22163
|
+
isSatisfiable(thisComparators, options) &&
|
|
22164
|
+
range.set.some(function (rangeComparators) {
|
|
22165
|
+
return (
|
|
22166
|
+
isSatisfiable(rangeComparators, options) &&
|
|
22167
|
+
thisComparators.every(function (thisComparator) {
|
|
22168
|
+
return rangeComparators.every(function (rangeComparator) {
|
|
22169
|
+
return thisComparator.intersects(rangeComparator, options)
|
|
22170
|
+
})
|
|
22171
|
+
})
|
|
22172
|
+
)
|
|
22173
|
+
})
|
|
22174
|
+
)
|
|
22175
|
+
})
|
|
22176
|
+
};
|
|
22177
|
+
|
|
22178
|
+
// take a set of comparators and determine whether there
|
|
22179
|
+
// exists a version which can satisfy it
|
|
22180
|
+
function isSatisfiable (comparators, options) {
|
|
22181
|
+
var result = true;
|
|
22182
|
+
var remainingComparators = comparators.slice();
|
|
22183
|
+
var testComparator = remainingComparators.pop();
|
|
22184
|
+
|
|
22185
|
+
while (result && remainingComparators.length) {
|
|
22186
|
+
result = remainingComparators.every(function (otherComparator) {
|
|
22187
|
+
return testComparator.intersects(otherComparator, options)
|
|
22188
|
+
});
|
|
22189
|
+
|
|
22190
|
+
testComparator = remainingComparators.pop();
|
|
22191
|
+
}
|
|
22192
|
+
|
|
22193
|
+
return result
|
|
22194
|
+
}
|
|
22195
|
+
|
|
22196
|
+
// Mostly just for testing and legacy API reasons
|
|
22197
|
+
exports.toComparators = toComparators;
|
|
22198
|
+
function toComparators (range, options) {
|
|
22199
|
+
return new Range(range, options).set.map(function (comp) {
|
|
22200
|
+
return comp.map(function (c) {
|
|
22201
|
+
return c.value
|
|
22202
|
+
}).join(' ').trim().split(' ')
|
|
22203
|
+
})
|
|
22204
|
+
}
|
|
22205
|
+
|
|
22206
|
+
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
|
22207
|
+
// already replaced the hyphen ranges
|
|
22208
|
+
// turn into a set of JUST comparators.
|
|
22209
|
+
function parseComparator (comp, options) {
|
|
22210
|
+
debug('comp', comp, options);
|
|
22211
|
+
comp = replaceCarets(comp, options);
|
|
22212
|
+
debug('caret', comp);
|
|
22213
|
+
comp = replaceTildes(comp, options);
|
|
22214
|
+
debug('tildes', comp);
|
|
22215
|
+
comp = replaceXRanges(comp, options);
|
|
22216
|
+
debug('xrange', comp);
|
|
22217
|
+
comp = replaceStars(comp, options);
|
|
22218
|
+
debug('stars', comp);
|
|
22219
|
+
return comp
|
|
22220
|
+
}
|
|
22221
|
+
|
|
22222
|
+
function isX (id) {
|
|
22223
|
+
return !id || id.toLowerCase() === 'x' || id === '*'
|
|
22224
|
+
}
|
|
22225
|
+
|
|
22226
|
+
// ~, ~> --> * (any, kinda silly)
|
|
22227
|
+
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
|
|
22228
|
+
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
|
|
22229
|
+
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
|
|
22230
|
+
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
|
|
22231
|
+
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
|
|
22232
|
+
function replaceTildes (comp, options) {
|
|
22233
|
+
return comp.trim().split(/\s+/).map(function (comp) {
|
|
22234
|
+
return replaceTilde(comp, options)
|
|
22235
|
+
}).join(' ')
|
|
22236
|
+
}
|
|
22237
|
+
|
|
22238
|
+
function replaceTilde (comp, options) {
|
|
22239
|
+
var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
22240
|
+
return comp.replace(r, function (_, M, m, p, pr) {
|
|
22241
|
+
debug('tilde', comp, _, M, m, p, pr);
|
|
22242
|
+
var ret;
|
|
22243
|
+
|
|
22244
|
+
if (isX(M)) {
|
|
22245
|
+
ret = '';
|
|
22246
|
+
} else if (isX(m)) {
|
|
22247
|
+
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
|
|
22248
|
+
} else if (isX(p)) {
|
|
22249
|
+
// ~1.2 == >=1.2.0 <1.3.0
|
|
22250
|
+
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
|
|
22251
|
+
} else if (pr) {
|
|
22252
|
+
debug('replaceTilde pr', pr);
|
|
22253
|
+
ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
|
|
22254
|
+
' <' + M + '.' + (+m + 1) + '.0';
|
|
22255
|
+
} else {
|
|
22256
|
+
// ~1.2.3 == >=1.2.3 <1.3.0
|
|
22257
|
+
ret = '>=' + M + '.' + m + '.' + p +
|
|
22258
|
+
' <' + M + '.' + (+m + 1) + '.0';
|
|
22259
|
+
}
|
|
22260
|
+
|
|
22261
|
+
debug('tilde return', ret);
|
|
22262
|
+
return ret
|
|
22263
|
+
})
|
|
22264
|
+
}
|
|
22265
|
+
|
|
22266
|
+
// ^ --> * (any, kinda silly)
|
|
22267
|
+
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
|
|
22268
|
+
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
|
|
22269
|
+
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
|
|
22270
|
+
// ^1.2.3 --> >=1.2.3 <2.0.0
|
|
22271
|
+
// ^1.2.0 --> >=1.2.0 <2.0.0
|
|
22272
|
+
function replaceCarets (comp, options) {
|
|
22273
|
+
return comp.trim().split(/\s+/).map(function (comp) {
|
|
22274
|
+
return replaceCaret(comp, options)
|
|
22275
|
+
}).join(' ')
|
|
22276
|
+
}
|
|
22277
|
+
|
|
22278
|
+
function replaceCaret (comp, options) {
|
|
22279
|
+
debug('caret', comp, options);
|
|
22280
|
+
var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
22281
|
+
return comp.replace(r, function (_, M, m, p, pr) {
|
|
22282
|
+
debug('caret', comp, _, M, m, p, pr);
|
|
22283
|
+
var ret;
|
|
22284
|
+
|
|
22285
|
+
if (isX(M)) {
|
|
22286
|
+
ret = '';
|
|
22287
|
+
} else if (isX(m)) {
|
|
22288
|
+
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
|
|
22289
|
+
} else if (isX(p)) {
|
|
22290
|
+
if (M === '0') {
|
|
22291
|
+
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
|
|
22292
|
+
} else {
|
|
22293
|
+
ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0';
|
|
22294
|
+
}
|
|
22295
|
+
} else if (pr) {
|
|
22296
|
+
debug('replaceCaret pr', pr);
|
|
22297
|
+
if (M === '0') {
|
|
22298
|
+
if (m === '0') {
|
|
22299
|
+
ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
|
|
22300
|
+
' <' + M + '.' + m + '.' + (+p + 1);
|
|
22301
|
+
} else {
|
|
22302
|
+
ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
|
|
22303
|
+
' <' + M + '.' + (+m + 1) + '.0';
|
|
22304
|
+
}
|
|
22305
|
+
} else {
|
|
22306
|
+
ret = '>=' + M + '.' + m + '.' + p + '-' + pr +
|
|
22307
|
+
' <' + (+M + 1) + '.0.0';
|
|
22308
|
+
}
|
|
22309
|
+
} else {
|
|
22310
|
+
debug('no pr');
|
|
22311
|
+
if (M === '0') {
|
|
22312
|
+
if (m === '0') {
|
|
22313
|
+
ret = '>=' + M + '.' + m + '.' + p +
|
|
22314
|
+
' <' + M + '.' + m + '.' + (+p + 1);
|
|
22315
|
+
} else {
|
|
22316
|
+
ret = '>=' + M + '.' + m + '.' + p +
|
|
22317
|
+
' <' + M + '.' + (+m + 1) + '.0';
|
|
22318
|
+
}
|
|
22319
|
+
} else {
|
|
22320
|
+
ret = '>=' + M + '.' + m + '.' + p +
|
|
22321
|
+
' <' + (+M + 1) + '.0.0';
|
|
22322
|
+
}
|
|
22323
|
+
}
|
|
22324
|
+
|
|
22325
|
+
debug('caret return', ret);
|
|
22326
|
+
return ret
|
|
22327
|
+
})
|
|
22328
|
+
}
|
|
22329
|
+
|
|
22330
|
+
function replaceXRanges (comp, options) {
|
|
22331
|
+
debug('replaceXRanges', comp, options);
|
|
22332
|
+
return comp.split(/\s+/).map(function (comp) {
|
|
22333
|
+
return replaceXRange(comp, options)
|
|
22334
|
+
}).join(' ')
|
|
22335
|
+
}
|
|
22336
|
+
|
|
22337
|
+
function replaceXRange (comp, options) {
|
|
22338
|
+
comp = comp.trim();
|
|
22339
|
+
var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
22340
|
+
return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
|
|
22341
|
+
debug('xRange', comp, ret, gtlt, M, m, p, pr);
|
|
22342
|
+
var xM = isX(M);
|
|
22343
|
+
var xm = xM || isX(m);
|
|
22344
|
+
var xp = xm || isX(p);
|
|
22345
|
+
var anyX = xp;
|
|
22346
|
+
|
|
22347
|
+
if (gtlt === '=' && anyX) {
|
|
22348
|
+
gtlt = '';
|
|
22349
|
+
}
|
|
22350
|
+
|
|
22351
|
+
// if we're including prereleases in the match, then we need
|
|
22352
|
+
// to fix this to -0, the lowest possible prerelease value
|
|
22353
|
+
pr = options.includePrerelease ? '-0' : '';
|
|
22354
|
+
|
|
22355
|
+
if (xM) {
|
|
22356
|
+
if (gtlt === '>' || gtlt === '<') {
|
|
22357
|
+
// nothing is allowed
|
|
22358
|
+
ret = '<0.0.0-0';
|
|
22359
|
+
} else {
|
|
22360
|
+
// nothing is forbidden
|
|
22361
|
+
ret = '*';
|
|
22362
|
+
}
|
|
22363
|
+
} else if (gtlt && anyX) {
|
|
22364
|
+
// we know patch is an x, because we have any x at all.
|
|
22365
|
+
// replace X with 0
|
|
22366
|
+
if (xm) {
|
|
22367
|
+
m = 0;
|
|
22368
|
+
}
|
|
22369
|
+
p = 0;
|
|
22370
|
+
|
|
22371
|
+
if (gtlt === '>') {
|
|
22372
|
+
// >1 => >=2.0.0
|
|
22373
|
+
// >1.2 => >=1.3.0
|
|
22374
|
+
// >1.2.3 => >= 1.2.4
|
|
22375
|
+
gtlt = '>=';
|
|
22376
|
+
if (xm) {
|
|
22377
|
+
M = +M + 1;
|
|
22378
|
+
m = 0;
|
|
22379
|
+
p = 0;
|
|
22380
|
+
} else {
|
|
22381
|
+
m = +m + 1;
|
|
22382
|
+
p = 0;
|
|
22383
|
+
}
|
|
22384
|
+
} else if (gtlt === '<=') {
|
|
22385
|
+
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
|
22386
|
+
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
|
22387
|
+
gtlt = '<';
|
|
22388
|
+
if (xm) {
|
|
22389
|
+
M = +M + 1;
|
|
22390
|
+
} else {
|
|
22391
|
+
m = +m + 1;
|
|
22392
|
+
}
|
|
22393
|
+
}
|
|
22394
|
+
|
|
22395
|
+
ret = gtlt + M + '.' + m + '.' + p + pr;
|
|
22396
|
+
} else if (xm) {
|
|
22397
|
+
ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr;
|
|
22398
|
+
} else if (xp) {
|
|
22399
|
+
ret = '>=' + M + '.' + m + '.0' + pr +
|
|
22400
|
+
' <' + M + '.' + (+m + 1) + '.0' + pr;
|
|
22401
|
+
}
|
|
22402
|
+
|
|
22403
|
+
debug('xRange return', ret);
|
|
22404
|
+
|
|
22405
|
+
return ret
|
|
22406
|
+
})
|
|
22407
|
+
}
|
|
22408
|
+
|
|
22409
|
+
// Because * is AND-ed with everything else in the comparator,
|
|
22410
|
+
// and '' means "any version", just remove the *s entirely.
|
|
22411
|
+
function replaceStars (comp, options) {
|
|
22412
|
+
debug('replaceStars', comp, options);
|
|
22413
|
+
// Looseness is ignored here. star is always as loose as it gets!
|
|
22414
|
+
return comp.trim().replace(re[t.STAR], '')
|
|
22415
|
+
}
|
|
22416
|
+
|
|
22417
|
+
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
|
22418
|
+
// M, m, patch, prerelease, build
|
|
22419
|
+
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
|
22420
|
+
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
|
|
22421
|
+
// 1.2 - 3.4 => >=1.2.0 <3.5.0
|
|
22422
|
+
function hyphenReplace ($0,
|
|
22423
|
+
from, fM, fm, fp, fpr, fb,
|
|
22424
|
+
to, tM, tm, tp, tpr, tb) {
|
|
22425
|
+
if (isX(fM)) {
|
|
22426
|
+
from = '';
|
|
22427
|
+
} else if (isX(fm)) {
|
|
22428
|
+
from = '>=' + fM + '.0.0';
|
|
22429
|
+
} else if (isX(fp)) {
|
|
22430
|
+
from = '>=' + fM + '.' + fm + '.0';
|
|
22431
|
+
} else {
|
|
22432
|
+
from = '>=' + from;
|
|
22433
|
+
}
|
|
22434
|
+
|
|
22435
|
+
if (isX(tM)) {
|
|
22436
|
+
to = '';
|
|
22437
|
+
} else if (isX(tm)) {
|
|
22438
|
+
to = '<' + (+tM + 1) + '.0.0';
|
|
22439
|
+
} else if (isX(tp)) {
|
|
22440
|
+
to = '<' + tM + '.' + (+tm + 1) + '.0';
|
|
22441
|
+
} else if (tpr) {
|
|
22442
|
+
to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
|
|
22443
|
+
} else {
|
|
22444
|
+
to = '<=' + to;
|
|
22445
|
+
}
|
|
22446
|
+
|
|
22447
|
+
return (from + ' ' + to).trim()
|
|
22448
|
+
}
|
|
22449
|
+
|
|
22450
|
+
// if ANY of the sets match ALL of its comparators, then pass
|
|
22451
|
+
Range.prototype.test = function (version) {
|
|
22452
|
+
if (!version) {
|
|
22453
|
+
return false
|
|
22454
|
+
}
|
|
22455
|
+
|
|
22456
|
+
if (typeof version === 'string') {
|
|
22457
|
+
try {
|
|
22458
|
+
version = new SemVer(version, this.options);
|
|
22459
|
+
} catch (er) {
|
|
22460
|
+
return false
|
|
22461
|
+
}
|
|
22462
|
+
}
|
|
22463
|
+
|
|
22464
|
+
for (var i = 0; i < this.set.length; i++) {
|
|
22465
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
22466
|
+
return true
|
|
22467
|
+
}
|
|
22468
|
+
}
|
|
22469
|
+
return false
|
|
22470
|
+
};
|
|
22471
|
+
|
|
22472
|
+
function testSet (set, version, options) {
|
|
22473
|
+
for (var i = 0; i < set.length; i++) {
|
|
22474
|
+
if (!set[i].test(version)) {
|
|
22475
|
+
return false
|
|
22476
|
+
}
|
|
22477
|
+
}
|
|
22478
|
+
|
|
22479
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
22480
|
+
// Find the set of versions that are allowed to have prereleases
|
|
22481
|
+
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
|
22482
|
+
// That should allow `1.2.3-pr.2` to pass.
|
|
22483
|
+
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
|
22484
|
+
// even though it's within the range set by the comparators.
|
|
22485
|
+
for (i = 0; i < set.length; i++) {
|
|
22486
|
+
debug(set[i].semver);
|
|
22487
|
+
if (set[i].semver === ANY) {
|
|
22488
|
+
continue
|
|
22489
|
+
}
|
|
22490
|
+
|
|
22491
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
22492
|
+
var allowed = set[i].semver;
|
|
22493
|
+
if (allowed.major === version.major &&
|
|
22494
|
+
allowed.minor === version.minor &&
|
|
22495
|
+
allowed.patch === version.patch) {
|
|
22496
|
+
return true
|
|
22497
|
+
}
|
|
22498
|
+
}
|
|
22499
|
+
}
|
|
22500
|
+
|
|
22501
|
+
// Version has a -pre, but it's not one of the ones we like.
|
|
22502
|
+
return false
|
|
22503
|
+
}
|
|
22504
|
+
|
|
22505
|
+
return true
|
|
22506
|
+
}
|
|
22507
|
+
|
|
22508
|
+
exports.satisfies = satisfies;
|
|
22509
|
+
function satisfies (version, range, options) {
|
|
22510
|
+
try {
|
|
22511
|
+
range = new Range(range, options);
|
|
22512
|
+
} catch (er) {
|
|
22513
|
+
return false
|
|
22514
|
+
}
|
|
22515
|
+
return range.test(version)
|
|
22516
|
+
}
|
|
22517
|
+
|
|
22518
|
+
exports.maxSatisfying = maxSatisfying;
|
|
22519
|
+
function maxSatisfying (versions, range, options) {
|
|
22520
|
+
var max = null;
|
|
22521
|
+
var maxSV = null;
|
|
22522
|
+
try {
|
|
22523
|
+
var rangeObj = new Range(range, options);
|
|
22524
|
+
} catch (er) {
|
|
22525
|
+
return null
|
|
22526
|
+
}
|
|
22527
|
+
versions.forEach(function (v) {
|
|
22528
|
+
if (rangeObj.test(v)) {
|
|
22529
|
+
// satisfies(v, range, options)
|
|
22530
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
22531
|
+
// compare(max, v, true)
|
|
22532
|
+
max = v;
|
|
22533
|
+
maxSV = new SemVer(max, options);
|
|
22534
|
+
}
|
|
22535
|
+
}
|
|
22536
|
+
});
|
|
22537
|
+
return max
|
|
22538
|
+
}
|
|
22539
|
+
|
|
22540
|
+
exports.minSatisfying = minSatisfying;
|
|
22541
|
+
function minSatisfying (versions, range, options) {
|
|
22542
|
+
var min = null;
|
|
22543
|
+
var minSV = null;
|
|
22544
|
+
try {
|
|
22545
|
+
var rangeObj = new Range(range, options);
|
|
22546
|
+
} catch (er) {
|
|
22547
|
+
return null
|
|
22548
|
+
}
|
|
22549
|
+
versions.forEach(function (v) {
|
|
22550
|
+
if (rangeObj.test(v)) {
|
|
22551
|
+
// satisfies(v, range, options)
|
|
22552
|
+
if (!min || minSV.compare(v) === 1) {
|
|
22553
|
+
// compare(min, v, true)
|
|
22554
|
+
min = v;
|
|
22555
|
+
minSV = new SemVer(min, options);
|
|
22556
|
+
}
|
|
22557
|
+
}
|
|
22558
|
+
});
|
|
22559
|
+
return min
|
|
22560
|
+
}
|
|
22561
|
+
|
|
22562
|
+
exports.minVersion = minVersion;
|
|
22563
|
+
function minVersion (range, loose) {
|
|
22564
|
+
range = new Range(range, loose);
|
|
22565
|
+
|
|
22566
|
+
var minver = new SemVer('0.0.0');
|
|
22567
|
+
if (range.test(minver)) {
|
|
22568
|
+
return minver
|
|
22569
|
+
}
|
|
22570
|
+
|
|
22571
|
+
minver = new SemVer('0.0.0-0');
|
|
22572
|
+
if (range.test(minver)) {
|
|
22573
|
+
return minver
|
|
22574
|
+
}
|
|
22575
|
+
|
|
22576
|
+
minver = null;
|
|
22577
|
+
for (var i = 0; i < range.set.length; ++i) {
|
|
22578
|
+
var comparators = range.set[i];
|
|
22579
|
+
|
|
22580
|
+
comparators.forEach(function (comparator) {
|
|
22581
|
+
// Clone to avoid manipulating the comparator's semver object.
|
|
22582
|
+
var compver = new SemVer(comparator.semver.version);
|
|
22583
|
+
switch (comparator.operator) {
|
|
22584
|
+
case '>':
|
|
22585
|
+
if (compver.prerelease.length === 0) {
|
|
22586
|
+
compver.patch++;
|
|
22587
|
+
} else {
|
|
22588
|
+
compver.prerelease.push(0);
|
|
22589
|
+
}
|
|
22590
|
+
compver.raw = compver.format();
|
|
22591
|
+
/* fallthrough */
|
|
22592
|
+
case '':
|
|
22593
|
+
case '>=':
|
|
22594
|
+
if (!minver || gt(minver, compver)) {
|
|
22595
|
+
minver = compver;
|
|
22596
|
+
}
|
|
22597
|
+
break
|
|
22598
|
+
case '<':
|
|
22599
|
+
case '<=':
|
|
22600
|
+
/* Ignore maximum versions */
|
|
22601
|
+
break
|
|
22602
|
+
/* istanbul ignore next */
|
|
22603
|
+
default:
|
|
22604
|
+
throw new Error('Unexpected operation: ' + comparator.operator)
|
|
22605
|
+
}
|
|
22606
|
+
});
|
|
22607
|
+
}
|
|
22608
|
+
|
|
22609
|
+
if (minver && range.test(minver)) {
|
|
22610
|
+
return minver
|
|
22611
|
+
}
|
|
22612
|
+
|
|
22613
|
+
return null
|
|
22614
|
+
}
|
|
22615
|
+
|
|
22616
|
+
exports.validRange = validRange;
|
|
22617
|
+
function validRange (range, options) {
|
|
22618
|
+
try {
|
|
22619
|
+
// Return '*' instead of '' so that truthiness works.
|
|
22620
|
+
// This will throw if it's invalid anyway
|
|
22621
|
+
return new Range(range, options).range || '*'
|
|
22622
|
+
} catch (er) {
|
|
22623
|
+
return null
|
|
22624
|
+
}
|
|
22625
|
+
}
|
|
22626
|
+
|
|
22627
|
+
// Determine if version is less than all the versions possible in the range
|
|
22628
|
+
exports.ltr = ltr;
|
|
22629
|
+
function ltr (version, range, options) {
|
|
22630
|
+
return outside(version, range, '<', options)
|
|
22631
|
+
}
|
|
22632
|
+
|
|
22633
|
+
// Determine if version is greater than all the versions possible in the range.
|
|
22634
|
+
exports.gtr = gtr;
|
|
22635
|
+
function gtr (version, range, options) {
|
|
22636
|
+
return outside(version, range, '>', options)
|
|
22637
|
+
}
|
|
22638
|
+
|
|
22639
|
+
exports.outside = outside;
|
|
22640
|
+
function outside (version, range, hilo, options) {
|
|
22641
|
+
version = new SemVer(version, options);
|
|
22642
|
+
range = new Range(range, options);
|
|
22643
|
+
|
|
22644
|
+
var gtfn, ltefn, ltfn, comp, ecomp;
|
|
22645
|
+
switch (hilo) {
|
|
22646
|
+
case '>':
|
|
22647
|
+
gtfn = gt;
|
|
22648
|
+
ltefn = lte;
|
|
22649
|
+
ltfn = lt;
|
|
22650
|
+
comp = '>';
|
|
22651
|
+
ecomp = '>=';
|
|
22652
|
+
break
|
|
22653
|
+
case '<':
|
|
22654
|
+
gtfn = lt;
|
|
22655
|
+
ltefn = gte;
|
|
22656
|
+
ltfn = gt;
|
|
22657
|
+
comp = '<';
|
|
22658
|
+
ecomp = '<=';
|
|
22659
|
+
break
|
|
22660
|
+
default:
|
|
22661
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"')
|
|
22662
|
+
}
|
|
22663
|
+
|
|
22664
|
+
// If it satisifes the range it is not outside
|
|
22665
|
+
if (satisfies(version, range, options)) {
|
|
22666
|
+
return false
|
|
22667
|
+
}
|
|
22668
|
+
|
|
22669
|
+
// From now on, variable terms are as if we're in "gtr" mode.
|
|
22670
|
+
// but note that everything is flipped for the "ltr" function.
|
|
22671
|
+
|
|
22672
|
+
for (var i = 0; i < range.set.length; ++i) {
|
|
22673
|
+
var comparators = range.set[i];
|
|
22674
|
+
|
|
22675
|
+
var high = null;
|
|
22676
|
+
var low = null;
|
|
22677
|
+
|
|
22678
|
+
comparators.forEach(function (comparator) {
|
|
22679
|
+
if (comparator.semver === ANY) {
|
|
22680
|
+
comparator = new Comparator('>=0.0.0');
|
|
22681
|
+
}
|
|
22682
|
+
high = high || comparator;
|
|
22683
|
+
low = low || comparator;
|
|
22684
|
+
if (gtfn(comparator.semver, high.semver, options)) {
|
|
22685
|
+
high = comparator;
|
|
22686
|
+
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
22687
|
+
low = comparator;
|
|
22688
|
+
}
|
|
22689
|
+
});
|
|
22690
|
+
|
|
22691
|
+
// If the edge version comparator has a operator then our version
|
|
22692
|
+
// isn't outside it
|
|
22693
|
+
if (high.operator === comp || high.operator === ecomp) {
|
|
22694
|
+
return false
|
|
22695
|
+
}
|
|
22696
|
+
|
|
22697
|
+
// If the lowest version comparator has an operator and our version
|
|
22698
|
+
// is less than it then it isn't higher than the range
|
|
22699
|
+
if ((!low.operator || low.operator === comp) &&
|
|
22700
|
+
ltefn(version, low.semver)) {
|
|
22701
|
+
return false
|
|
22702
|
+
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
22703
|
+
return false
|
|
22704
|
+
}
|
|
22705
|
+
}
|
|
22706
|
+
return true
|
|
22707
|
+
}
|
|
22708
|
+
|
|
22709
|
+
exports.prerelease = prerelease;
|
|
22710
|
+
function prerelease (version, options) {
|
|
22711
|
+
var parsed = parse(version, options);
|
|
22712
|
+
return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
|
|
22713
|
+
}
|
|
22714
|
+
|
|
22715
|
+
exports.intersects = intersects;
|
|
22716
|
+
function intersects (r1, r2, options) {
|
|
22717
|
+
r1 = new Range(r1, options);
|
|
22718
|
+
r2 = new Range(r2, options);
|
|
22719
|
+
return r1.intersects(r2)
|
|
22720
|
+
}
|
|
22721
|
+
|
|
22722
|
+
exports.coerce = coerce;
|
|
22723
|
+
function coerce (version, options) {
|
|
22724
|
+
if (version instanceof SemVer) {
|
|
22725
|
+
return version
|
|
22726
|
+
}
|
|
22727
|
+
|
|
22728
|
+
if (typeof version === 'number') {
|
|
22729
|
+
version = String(version);
|
|
22730
|
+
}
|
|
22731
|
+
|
|
22732
|
+
if (typeof version !== 'string') {
|
|
22733
|
+
return null
|
|
22734
|
+
}
|
|
22735
|
+
|
|
22736
|
+
options = options || {};
|
|
22737
|
+
|
|
22738
|
+
var match = null;
|
|
22739
|
+
if (!options.rtl) {
|
|
22740
|
+
match = version.match(re[t.COERCE]);
|
|
22741
|
+
} else {
|
|
22742
|
+
// Find the right-most coercible string that does not share
|
|
22743
|
+
// a terminus with a more left-ward coercible string.
|
|
22744
|
+
// Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
|
|
22745
|
+
//
|
|
22746
|
+
// Walk through the string checking with a /g regexp
|
|
22747
|
+
// Manually set the index so as to pick up overlapping matches.
|
|
22748
|
+
// Stop when we get a match that ends at the string end, since no
|
|
22749
|
+
// coercible string can be more right-ward without the same terminus.
|
|
22750
|
+
var next;
|
|
22751
|
+
while ((next = re[t.COERCERTL].exec(version)) &&
|
|
22752
|
+
(!match || match.index + match[0].length !== version.length)
|
|
22753
|
+
) {
|
|
22754
|
+
if (!match ||
|
|
22755
|
+
next.index + next[0].length !== match.index + match[0].length) {
|
|
22756
|
+
match = next;
|
|
22757
|
+
}
|
|
22758
|
+
re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
|
|
22759
|
+
}
|
|
22760
|
+
// leave it in a clean state
|
|
22761
|
+
re[t.COERCERTL].lastIndex = -1;
|
|
22762
|
+
}
|
|
22763
|
+
|
|
22764
|
+
if (match === null) {
|
|
22765
|
+
return null
|
|
22766
|
+
}
|
|
22767
|
+
|
|
22768
|
+
return parse(match[2] +
|
|
22769
|
+
'.' + (match[3] || '0') +
|
|
22770
|
+
'.' + (match[4] || '0'), options)
|
|
22771
|
+
}
|
|
22772
|
+
} (semver, semverExports));
|
|
22253
22773
|
|
|
22254
22774
|
const LOADED = {};
|
|
22255
22775
|
|
|
@@ -22811,7 +23331,7 @@ function nuked() {
|
|
|
22811
23331
|
*/
|
|
22812
23332
|
|
|
22813
23333
|
/**
|
|
22814
|
-
* @typedef { boolean | 'toggle'
|
|
23334
|
+
* @typedef { boolean | 'toggle' } SearchMode
|
|
22815
23335
|
*/
|
|
22816
23336
|
|
|
22817
23337
|
/**
|
|
@@ -22857,7 +23377,7 @@ function nuked() {
|
|
|
22857
23377
|
* @param {ListLayout=} [options.listLayout=vertical] Layout direction vertical|horizontal (not applicable for existing objects)
|
|
22858
23378
|
* @param {FrequencyMode=} [options.frequencyMode=none] Show frequency none|value|percent|relative
|
|
22859
23379
|
* @param {boolean=} [options.histogram=false] Show histogram bar (not applicable for existing objects)
|
|
22860
|
-
* @param {SearchMode=} [options.search=true] Show the search bar permanently, using the toggle button or when in selection: false|true|toggle
|
|
23380
|
+
* @param {SearchMode=} [options.search=true] Show the search bar permanently, using the toggle button or when in selection: false|true|toggle
|
|
22861
23381
|
* @param {boolean=} [options.toolbar=true] Show the toolbar
|
|
22862
23382
|
* @param {boolean=} [options.checkboxes=false] Show values as checkboxes instead of as fields (not applicable for existing objects)
|
|
22863
23383
|
* @param {boolean=} [options.dense=false] Reduces padding and text size (not applicable for existing objects)
|