@aws-cdk/cx-api
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "semver", | ||
"version": "6.1.1", | ||
"version": "6.2.0", | ||
"description": "The semantic version parser used by npm.", | ||
@@ -13,3 +13,3 @@ "main": "semver.js", | ||
"devDependencies": { | ||
"tap": "^14.1.6" | ||
"tap": "^14.3.1" | ||
}, | ||
@@ -19,3 +19,3 @@ "license": "ISC", | ||
"bin": { | ||
"semver": "./bin/semver" | ||
"semver": "./bin/semver.js" | ||
}, | ||
@@ -31,5 +31,5 @@ "files": [ | ||
,"_resolved": "https://registry.npmjs.org/semver/-/semver-6.1.1.tgz" | ||
,"_integrity": "sha512-rWYq2e5iYW+fFe/oPPtYJxYgjBm8sC4rmoGdUOgBB7VnwKt6HrL793l2voH1UlsyYZpJ4g0wfjnTEO1s1NP2eQ==" | ||
,"_from": "semver@6.1.1" | ||
,"_resolved": "https://registry.npmjs.org/semver/-/semver-6.2.0.tgz" | ||
,"_integrity": "sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A==" | ||
,"_from": "semver@6.2.0" | ||
} |
@@ -63,2 +63,8 @@ semver(1) -- The semantic versioner for npm | ||
--rtl | ||
Coerce version strings right to left | ||
--ltr | ||
Coerce version strings left to right (default) | ||
Program exits successfully if any valid version satisfies | ||
@@ -403,16 +409,23 @@ all supplied ranges, and prints all satisfying versions. | ||
* `coerce(version)`: Coerces a string to semver if possible | ||
* `coerce(version, options)`: Coerces a string to semver if possible | ||
This aims to provide a very forgiving translation of a non-semver | ||
string to semver. It looks for the first digit in a string, and | ||
consumes all remaining characters which satisfy at least a partial semver | ||
(e.g., `1`, `1.2`, `1.2.3`) up to the max permitted length (256 characters). | ||
Longer versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). | ||
All surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes `3.4.0`). | ||
Only text which lacks digits will fail coercion (`version one` is not valid). | ||
The maximum length for any semver component considered for coercion is 16 characters; | ||
longer components will be ignored (`10000000000000000.4.7.4` becomes `4.7.4`). | ||
The maximum value for any semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; | ||
higher value components are invalid (`9999999999999999.4.7.4` is likely invalid). | ||
This aims to provide a very forgiving translation of a non-semver string to | ||
semver. It looks for the first digit in a string, and consumes all | ||
remaining characters which satisfy at least a partial semver (e.g., `1`, | ||
`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer | ||
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All | ||
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes | ||
`3.4.0`). Only text which lacks digits will fail coercion (`version one` | ||
is not valid). The maximum length for any semver component considered for | ||
coercion is 16 characters; longer components will be ignored | ||
(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any | ||
semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value | ||
components are invalid (`9999999999999999.4.7.4` is likely invalid). | ||
If the `options.rtl` flag is set, then `coerce` will return the right-most | ||
coercible tuple that does not share an ending index with a longer coercible | ||
tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not | ||
`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of | ||
any other overlapping SemVer tuple. | ||
### Clean | ||
@@ -419,0 +432,0 @@ |
@@ -163,3 +163,3 @@ exports = module.exports = SemVer | ||
var COERCE = R++ | ||
src[COERCE] = '(?:^|[^\\d])' + | ||
src[COERCE] = '(^|[^\\d])' + | ||
'(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + | ||
@@ -169,2 +169,4 @@ '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + | ||
'(?:$|[^\\d])' | ||
var COERCERTL = R++ | ||
re[COERCERTL] = new RegExp(src[COERCE], 'g') | ||
@@ -815,3 +817,7 @@ // Tilde ranges. | ||
if (typeof version === 'string') { | ||
version = new SemVer(version, this.options) | ||
try { | ||
version = new SemVer(version, this.options) | ||
} catch (er) { | ||
return false | ||
} | ||
} | ||
@@ -1166,6 +1172,10 @@ | ||
// if we're including prereleases in the match, then we need | ||
// to fix this to -0, the lowest possible prerelease value | ||
pr = options.includePrerelease ? '-0' : '' | ||
if (xM) { | ||
if (gtlt === '>' || gtlt === '<') { | ||
// nothing is allowed | ||
ret = '<0.0.0' | ||
ret = '<0.0.0-0' | ||
} else { | ||
@@ -1207,7 +1217,8 @@ // nothing is forbidden | ||
ret = gtlt + M + '.' + m + '.' + p | ||
ret = gtlt + M + '.' + m + '.' + p + pr | ||
} else if (xm) { | ||
ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' | ||
ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr | ||
} else if (xp) { | ||
ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' | ||
ret = '>=' + M + '.' + m + '.0' + pr + | ||
' <' + M + '.' + (+m + 1) + '.0' + pr | ||
} | ||
@@ -1269,3 +1280,7 @@ | ||
if (typeof version === 'string') { | ||
version = new SemVer(version, this.options) | ||
try { | ||
version = new SemVer(version, this.options) | ||
} catch (er) { | ||
return false | ||
} | ||
} | ||
@@ -1537,2 +1552,6 @@ | ||
if (typeof version === 'number') { | ||
version = String(version) | ||
} | ||
if (typeof version !== 'string') { | ||
@@ -1542,11 +1561,37 @@ return null | ||
var match = version.match(re[COERCE]) | ||
options = options || {} | ||
if (match == null) { | ||
var match = null | ||
if (!options.rtl) { | ||
match = version.match(re[COERCE]) | ||
} else { | ||
// Find the right-most coercible string that does not share | ||
// a terminus with a more left-ward coercible string. | ||
// Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' | ||
// | ||
// Walk through the string checking with a /g regexp | ||
// Manually set the index so as to pick up overlapping matches. | ||
// Stop when we get a match that ends at the string end, since no | ||
// coercible string can be more right-ward without the same terminus. | ||
var next | ||
while ((next = re[COERCERTL].exec(version)) && | ||
(!match || match.index + match[0].length !== version.length) | ||
) { | ||
if (!match || | ||
next.index + next[0].length !== match.index + match[0].length) { | ||
match = next | ||
} | ||
re[COERCERTL].lastIndex = next.index + next[1].length + next[2].length | ||
} | ||
// leave it in a clean state | ||
re[COERCERTL].lastIndex = -1 | ||
} | ||
if (match === null) { | ||
return null | ||
} | ||
return parse(match[1] + | ||
'.' + (match[2] || '0') + | ||
'.' + (match[3] || '0'), options) | ||
return parse(match[2] + | ||
'.' + (match[3] || '0') + | ||
'.' + (match[4] || '0'), options) | ||
} |
{ | ||
"name": "@aws-cdk/cx-api", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Cloud executable protocol", | ||
@@ -65,8 +65,8 @@ "main": "lib/index.js", | ||
"@types/semver": "^6.0.0", | ||
"cdk-build-tools": "^1.0.0", | ||
"cdk-build-tools": "file:../../../tools/cdk-build-tools", | ||
"jest": "^24.8.0", | ||
"pkglint": "^1.0.0" | ||
"pkglint": "file:../../../tools/pkglint" | ||
}, | ||
"repository": { | ||
"url": "https://github.com/awslabs/aws-cdk.git", | ||
"url": "https://github.com/aws/aws-cdk.git", | ||
"type": "git", | ||
@@ -79,3 +79,3 @@ "directory": "packages/@aws-cdk/cx-api" | ||
], | ||
"homepage": "https://github.com/awslabs/aws-cdk", | ||
"homepage": "https://github.com/aws/aws-cdk", | ||
"bundledDependencies": [ | ||
@@ -82,0 +82,0 @@ "semver" |
@@ -18,2 +18,2 @@ ## Cloud Executable protocol | ||
This module is part of the [AWS Cloud Development Kit](https://github.com/awslabs/aws-cdk) project. | ||
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
300298
72
3260