[BUG] `* || 1.2.3-alpha` won't match `1.2.3-alpha` (when includePrerelease = false)
I maintainer di solito rispondono entro 4 giorni
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, nodejs
- Ambito
- tooling
Direzione di ricerca
Start in classes/range.js at the Range constructor, then read the README's range and prerelease rules alongside the linked discussion in #183. Reproduce the four satisfies calls and inspect the resulting Range.range value; done means the explicit prerelease alternative still matches when combined with a wildcard while the wildcard alone does not admit it.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
With [email protected] and the default options:
const semver = require('semver')
semver.satisfies('1.2.3-alpha', '1.2.3-alpha') // true
semver.satisfies('1.2.3-alpha', '*') // false
semver.satisfies('1.2.3-alpha', '* || 1.2.3-alpha') // false
semver.satisfies('1.2.3-alpha', '1.2.3-alpha || *') // false
new semver.Range('* || 1.2.3-alpha').range // ''
The explicit prerelease alternative matches on its own, but adding * || makes it stop matching. The same result occurs with the alternatives reversed. This is reproducible from the unmodified v7.8.5 tag (Node v22.23.3).
The range constructor collapses the whole OR range to * when any alternative is a wildcard, before prerelease eligibility is checked. This discards the explicit prerelease alternative and changes the set of matching versions.
Expected Behavior
The README's range description says a range matches when at least one ||-separated comparator set matches, and its prerelease rule checks for an eligible comparator within a comparator set. Thus 1.2.3-alpha should match the explicit 1.2.3-alpha alternative even though the wildcard alternative does not admit prereleases. In #183, @isaacs explicitly noted that * || 1.0.0-prerelease is different from * for this reason.
The Range.constructor shouldn't collapse * || 1.2.3-alpha into just *, when includePrerelease is false and one of the other comparators has a prerelease version.
Steps To Reproduce
n/a
Environment
n/a
- Lingua principale
- JavaScript
- Stelle
- 5.5k
- Fork
- 617
- Merge medio
- 4g 23h
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di npm/node-semver
-
[BUG] new Range(comparator).test() throws TypeError for a prerelease versionForse già presa @00200200 l’ha presa 27 giorni fa. ApertaBug Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
npm/node-semver#908 ·
I maintainer di solito rispondono entro 4 giorni
-
semver:major
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
npm/node-semver#108 · 6 commenti ·
I maintainer di solito rispondono entro 4 giorni
-
[BUG] intersects() still returns true for an empty range against "*" (follow-up to #521)Forse già presa @json-open-source l’ha presa 24 giorni fa. ApertaBug Needs Triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
npm/node-semver#909 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
-
[BUG] gtr and ltr are wrong when a range has two bounds on the same sideForse già presa @Prafyl l’ha presa 35 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
npm/node-semver#904 ·
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
npm/node-semver#900 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni
Tutte le issue di npm/node-semver
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
bug needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
apex-dev-tools/apex-log-parser#199 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue hacktoberfest help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
ReadBufferStream.addBuffer adds the full ArrayBuffer of a typed array view, and ignores its byteOffsetForse già presa @wayfarer3130 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Expo 57 example: pnpm install fails with ERR_PNPM_TRUST_DOWNGRADEForse già presa @github-actions l’ha presa oggi. Apertabug react-native team/client-libraries
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
PostHog/posthog-js#5442 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno