Ignore:
Timestamp:
09/21/26 00:41:03 (9 days ago)
Author:
Klimentina Efremova <klimentina08642@…>
Branches:
main
Children:
2d1ec46
Parents:
6149556
git-author:
Klimentina Efremova <klimentina08642@…> (09/21/26 00:24:09)
git-committer:
Klimentina Efremova <klimentina08642@…> (09/21/26 00:41:03)
Message:

Implemented Advaced database reports

File:
1 edited

Legend:

Unmodified
Added
Removed
  • node_modules/semver/classes/range.js

    r6149556 r6c7cfa6  
    9999
    100100  parseRange (range) {
     101    // strip build metadata so it can't bleed into the version
     102    range = range.replace(BUILDSTRIPRE, '')
     103
    101104    // memoize range parsing for performance.
    102105    // this is a very hot path, and fully deterministic.
    … …  
    224227const {
    225228  safeRe: re,
     229  src,
    226230  t,
    227231  comparatorTrimReplace,
    … …  
    230234} = require('../internal/re')
    231235const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')
     236
     237// unbounded global build-metadata stripper used by parseRange
     238const BUILDSTRIPRE = new RegExp(src[t.BUILD], 'g')
    232239
    233240const isNullSet = c => c.value === '<0.0.0-0'
    … …  
    271278const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
    272279
     280const invalidXRangeOrder = (M, m, p) => (
     281  (isX(M) && !isX(m)) ||
     282  (isX(m) && p && !isX(p))
     283)
     284
    273285// ~, ~> --> * (any, kinda silly)
    274286// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
    … …  
    288300const replaceTilde = (comp, options) => {
    289301  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
     302  // if we're including prereleases in the match, then the lower bound is
     303  // -0, the lowest possible prerelease value, just like x-ranges and carets.
     304  // this keeps `~1.2` equivalent to the `1.2.x` x-range it's documented as.
     305  const z = options.includePrerelease ? '-0' : ''
    290306  return comp.replace(r, (_, M, m, p, pr) => {
    291307    debug('tilde', comp, _, M, m, p, pr)
    … …  
    295311      ret = ''
    296312    } else if (isX(m)) {
    297       ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
     313      ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
    298314    } else if (isX(p)) {
    299315      // ~1.2 == >=1.2.0 <1.3.0-0
    300       ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
     316      ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
    301317    } else if (pr) {
    302318      debug('replaceTilde pr', pr)
    … …  
    367383        if (m === '0') {
    368384          ret = `>=${M}.${m}.${p
    369           }${z} <${M}.${m}.${+p + 1}-0`
     385          } <${M}.${m}.${+p + 1}-0`
    370386        } else {
    371387          ret = `>=${M}.${m}.${p
    372           }${z} <${M}.${+m + 1}.0-0`
     388          } <${M}.${+m + 1}.0-0`
    373389        }
    374390      } else {
    … …  
    396412  return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
    397413    debug('xRange', comp, ret, gtlt, M, m, p, pr)
     414    if (invalidXRangeOrder(M, m, p)) {
     415      return comp
     416    }
     417
    398418    const xM = isX(M)
    399419    const xm = xM || isX(m)
Note: See TracChangeset for help on using the changeset viewer.