sindresorhus / find-versions Goto Github PK
View Code? Open in Web Editor NEWFind semver versions in a string: `unicorn v1.2.3` → `1.2.3`
License: MIT License
Find semver versions in a string: `unicorn v1.2.3` → `1.2.3`
License: MIT License
PHP 7 is recognised as 3.0.0-dev
, instead of 7.0.0-rc.6
$ php --version
PHP 7.0.0RC6 (cli) (built: Oct 29 2015 13:46:05) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
This currently breaks grunt-php when PHP 7 is installed, because it has a requirement of >=5.4
[email protected] requires [email protected], which has a security problem (see: SNYK-JS-SEMVERREGEX-1047770):
[email protected] ➔ [email protected]
I do not know if this vulnerability actually affects find-versions, but it will show up in security reports about dependencies. Since a large number of developers still use [email protected].*(1,762,377 downloads per week), is there any posibility that you could release an update version for 3.2.* (ie 3.2.1) that introduces a patched version(>=3.1.2) of semver-regex?
In [email protected], maybe you can perform the following update:
semver-regex ^2.0.0 ➔ ^3.1.2
where [email protected](>=3.1.2) has fixed the vulnerability SNYK-JS-SEMVERREGEX-1047770.
Current one works fine, but it's awful.
Lines 8 to 10 in 9012fc5
I'm bad at regex. Any suggestions on how to improve it welcome.
import "/node_modules/.vite/chunk-R6I3GLEQ.js?v=1eb03933";
// node_modules/semver-regex/index.js
function semverRegex() {
return /(?<=^v?|\sv?)(?:(?:0|[1-9]\d*)\.){2}(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*)(?:\.(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*))*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?\b/gi;
}
// node_modules/find-versions/index.js
function findVersions(stringWithVersions, { loose = false } = {}) {
if (typeof stringWithVersions !== "string") {
throw new TypeError(`Expected a string, got ${typeof stringWithVersions}`);
}
const regex = loose ? new RegExp(`(?:${semverRegex().source})|(?:v?(?:\\d+\\.\\d+)(?:\\.\\d+)?)`, "g") : semverRegex();
const matches = stringWithVersions.match(regex) || [];
return [...new Set(matches.map((match) => match.trim().replace(/^v/, "").replace(/^\d+\.\d+$/, "$&.0")))];
}
// dep:find-versions
var find_versions_default = findVersions;
export {
find_versions_default as default
};
safari can't resolve ?<= ; throw error
SyntaxError: Invalid regular expression: invalid group specifier name
but you package use semver-regex
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.