mirror of
https://github.com/actions/setup-node
synced 2024-11-30 21:22:29 +08:00
start corepack test
This commit is contained in:
parent
70c3da958b
commit
1e2990d3cd
@ -89,19 +89,19 @@ describe('setup-node', () => {
|
||||
warningSpy = jest.spyOn(core, 'warning');
|
||||
cnSpy.mockImplementation(line => {
|
||||
// uncomment to debug
|
||||
// process.stderr.write('write:' + line + '\n');
|
||||
process.stderr.write('write:' + line + '\n');
|
||||
});
|
||||
logSpy.mockImplementation(line => {
|
||||
// uncomment to debug
|
||||
// process.stderr.write('log:' + line + '\n');
|
||||
process.stderr.write('log:' + line + '\n');
|
||||
});
|
||||
dbgSpy.mockImplementation(msg => {
|
||||
// uncomment to see debug output
|
||||
// process.stderr.write(msg + '\n');
|
||||
process.stderr.write(msg + '\n');
|
||||
});
|
||||
warningSpy.mockImplementation(msg => {
|
||||
// uncomment to debug
|
||||
// process.stderr.write('log:' + line + '\n');
|
||||
process.stderr.write('log:' + msg + '\n');
|
||||
});
|
||||
});
|
||||
|
||||
@ -909,4 +909,13 @@ describe('setup-node', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('corepack', () => {
|
||||
it.only('supports pnpm automatically from Node v14+', async () => {
|
||||
inputs['node-version'] = '14.9.0';
|
||||
inputs['cache'] = 'pnpm';
|
||||
await main.run();
|
||||
expect(execSpy).toBeCalledWith('corepack enable');
|
||||
})
|
||||
})
|
||||
});
|
||||
|
288
dist/cache-save/index.js
vendored
288
dist/cache-save/index.js
vendored
@ -7143,75 +7143,80 @@ var MAX_SAFE_COMPONENT_LENGTH = 16
|
||||
// The actual regexps go on exports.re
|
||||
var re = exports.re = []
|
||||
var src = exports.src = []
|
||||
var t = exports.tokens = {}
|
||||
var R = 0
|
||||
|
||||
function tok (n) {
|
||||
t[n] = R++
|
||||
}
|
||||
|
||||
// The following Regular Expressions can be used for tokenizing,
|
||||
// validating, and parsing SemVer version strings.
|
||||
|
||||
// ## Numeric Identifier
|
||||
// A single `0`, or a non-zero digit followed by zero or more digits.
|
||||
|
||||
var NUMERICIDENTIFIER = R++
|
||||
src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'
|
||||
var NUMERICIDENTIFIERLOOSE = R++
|
||||
src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'
|
||||
tok('NUMERICIDENTIFIER')
|
||||
src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*'
|
||||
tok('NUMERICIDENTIFIERLOOSE')
|
||||
src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+'
|
||||
|
||||
// ## Non-numeric Identifier
|
||||
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
||||
// more letters, digits, or hyphens.
|
||||
|
||||
var NONNUMERICIDENTIFIER = R++
|
||||
src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'
|
||||
tok('NONNUMERICIDENTIFIER')
|
||||
src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'
|
||||
|
||||
// ## Main Version
|
||||
// Three dot-separated numeric identifiers.
|
||||
|
||||
var MAINVERSION = R++
|
||||
src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' +
|
||||
'(' + src[NUMERICIDENTIFIER] + ')\\.' +
|
||||
'(' + src[NUMERICIDENTIFIER] + ')'
|
||||
tok('MAINVERSION')
|
||||
src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
|
||||
'(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
|
||||
'(' + src[t.NUMERICIDENTIFIER] + ')'
|
||||
|
||||
var MAINVERSIONLOOSE = R++
|
||||
src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
||||
'(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
||||
'(' + src[NUMERICIDENTIFIERLOOSE] + ')'
|
||||
tok('MAINVERSIONLOOSE')
|
||||
src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
||||
'(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
||||
'(' + src[t.NUMERICIDENTIFIERLOOSE] + ')'
|
||||
|
||||
// ## Pre-release Version Identifier
|
||||
// A numeric identifier, or a non-numeric identifier.
|
||||
|
||||
var PRERELEASEIDENTIFIER = R++
|
||||
src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +
|
||||
'|' + src[NONNUMERICIDENTIFIER] + ')'
|
||||
tok('PRERELEASEIDENTIFIER')
|
||||
src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] +
|
||||
'|' + src[t.NONNUMERICIDENTIFIER] + ')'
|
||||
|
||||
var PRERELEASEIDENTIFIERLOOSE = R++
|
||||
src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +
|
||||
'|' + src[NONNUMERICIDENTIFIER] + ')'
|
||||
tok('PRERELEASEIDENTIFIERLOOSE')
|
||||
src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] +
|
||||
'|' + src[t.NONNUMERICIDENTIFIER] + ')'
|
||||
|
||||
// ## Pre-release Version
|
||||
// Hyphen, followed by one or more dot-separated pre-release version
|
||||
// identifiers.
|
||||
|
||||
var PRERELEASE = R++
|
||||
src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +
|
||||
'(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'
|
||||
tok('PRERELEASE')
|
||||
src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] +
|
||||
'(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))'
|
||||
|
||||
var PRERELEASELOOSE = R++
|
||||
src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +
|
||||
'(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'
|
||||
tok('PRERELEASELOOSE')
|
||||
src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +
|
||||
'(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))'
|
||||
|
||||
// ## Build Metadata Identifier
|
||||
// Any combination of digits, letters, or hyphens.
|
||||
|
||||
var BUILDIDENTIFIER = R++
|
||||
src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'
|
||||
tok('BUILDIDENTIFIER')
|
||||
src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+'
|
||||
|
||||
// ## Build Metadata
|
||||
// Plus sign, followed by one or more period-separated build metadata
|
||||
// identifiers.
|
||||
|
||||
var BUILD = R++
|
||||
src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
|
||||
'(?:\\.' + src[BUILDIDENTIFIER] + ')*))'
|
||||
tok('BUILD')
|
||||
src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] +
|
||||
'(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))'
|
||||
|
||||
// ## Full Version String
|
||||
// A main version, followed optionally by a pre-release version and
|
||||
@ -7222,129 +7227,133 @@ src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
|
||||
// capturing group, because it should not ever be used in version
|
||||
// comparison.
|
||||
|
||||
var FULL = R++
|
||||
var FULLPLAIN = 'v?' + src[MAINVERSION] +
|
||||
src[PRERELEASE] + '?' +
|
||||
src[BUILD] + '?'
|
||||
tok('FULL')
|
||||
tok('FULLPLAIN')
|
||||
src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] +
|
||||
src[t.PRERELEASE] + '?' +
|
||||
src[t.BUILD] + '?'
|
||||
|
||||
src[FULL] = '^' + FULLPLAIN + '$'
|
||||
src[t.FULL] = '^' + src[t.FULLPLAIN] + '$'
|
||||
|
||||
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
||||
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
||||
// common in the npm registry.
|
||||
var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] +
|
||||
src[PRERELEASELOOSE] + '?' +
|
||||
src[BUILD] + '?'
|
||||
tok('LOOSEPLAIN')
|
||||
src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] +
|
||||
src[t.PRERELEASELOOSE] + '?' +
|
||||
src[t.BUILD] + '?'
|
||||
|
||||
var LOOSE = R++
|
||||
src[LOOSE] = '^' + LOOSEPLAIN + '$'
|
||||
tok('LOOSE')
|
||||
src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$'
|
||||
|
||||
var GTLT = R++
|
||||
src[GTLT] = '((?:<|>)?=?)'
|
||||
tok('GTLT')
|
||||
src[t.GTLT] = '((?:<|>)?=?)'
|
||||
|
||||
// Something like "2.*" or "1.2.x".
|
||||
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
||||
// Only the first item is strictly required.
|
||||
var XRANGEIDENTIFIERLOOSE = R++
|
||||
src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'
|
||||
var XRANGEIDENTIFIER = R++
|
||||
src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'
|
||||
tok('XRANGEIDENTIFIERLOOSE')
|
||||
src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'
|
||||
tok('XRANGEIDENTIFIER')
|
||||
src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*'
|
||||
|
||||
var XRANGEPLAIN = R++
|
||||
src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:' + src[PRERELEASE] + ')?' +
|
||||
src[BUILD] + '?' +
|
||||
tok('XRANGEPLAIN')
|
||||
src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
|
||||
'(?:' + src[t.PRERELEASE] + ')?' +
|
||||
src[t.BUILD] + '?' +
|
||||
')?)?'
|
||||
|
||||
var XRANGEPLAINLOOSE = R++
|
||||
src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:' + src[PRERELEASELOOSE] + ')?' +
|
||||
src[BUILD] + '?' +
|
||||
tok('XRANGEPLAINLOOSE')
|
||||
src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:' + src[t.PRERELEASELOOSE] + ')?' +
|
||||
src[t.BUILD] + '?' +
|
||||
')?)?'
|
||||
|
||||
var XRANGE = R++
|
||||
src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'
|
||||
var XRANGELOOSE = R++
|
||||
src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'
|
||||
tok('XRANGE')
|
||||
src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$'
|
||||
tok('XRANGELOOSE')
|
||||
src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$'
|
||||
|
||||
// Coercion.
|
||||
// Extract anything that could conceivably be a part of a valid semver
|
||||
var COERCE = R++
|
||||
src[COERCE] = '(?:^|[^\\d])' +
|
||||
tok('COERCE')
|
||||
src[t.COERCE] = '(^|[^\\d])' +
|
||||
'(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
|
||||
'(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
|
||||
'(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
|
||||
'(?:$|[^\\d])'
|
||||
tok('COERCERTL')
|
||||
re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g')
|
||||
|
||||
// Tilde ranges.
|
||||
// Meaning is "reasonably at or greater than"
|
||||
var LONETILDE = R++
|
||||
src[LONETILDE] = '(?:~>?)'
|
||||
tok('LONETILDE')
|
||||
src[t.LONETILDE] = '(?:~>?)'
|
||||
|
||||
var TILDETRIM = R++
|
||||
src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'
|
||||
re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g')
|
||||
tok('TILDETRIM')
|
||||
src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+'
|
||||
re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g')
|
||||
var tildeTrimReplace = '$1~'
|
||||
|
||||
var TILDE = R++
|
||||
src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'
|
||||
var TILDELOOSE = R++
|
||||
src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'
|
||||
tok('TILDE')
|
||||
src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$'
|
||||
tok('TILDELOOSE')
|
||||
src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$'
|
||||
|
||||
// Caret ranges.
|
||||
// Meaning is "at least and backwards compatible with"
|
||||
var LONECARET = R++
|
||||
src[LONECARET] = '(?:\\^)'
|
||||
tok('LONECARET')
|
||||
src[t.LONECARET] = '(?:\\^)'
|
||||
|
||||
var CARETTRIM = R++
|
||||
src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'
|
||||
re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g')
|
||||
tok('CARETTRIM')
|
||||
src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+'
|
||||
re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g')
|
||||
var caretTrimReplace = '$1^'
|
||||
|
||||
var CARET = R++
|
||||
src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'
|
||||
var CARETLOOSE = R++
|
||||
src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'
|
||||
tok('CARET')
|
||||
src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$'
|
||||
tok('CARETLOOSE')
|
||||
src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$'
|
||||
|
||||
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
||||
var COMPARATORLOOSE = R++
|
||||
src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'
|
||||
var COMPARATOR = R++
|
||||
src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'
|
||||
tok('COMPARATORLOOSE')
|
||||
src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$'
|
||||
tok('COMPARATOR')
|
||||
src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$'
|
||||
|
||||
// An expression to strip any whitespace between the gtlt and the thing
|
||||
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
||||
var COMPARATORTRIM = R++
|
||||
src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] +
|
||||
'\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'
|
||||
tok('COMPARATORTRIM')
|
||||
src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] +
|
||||
'\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')'
|
||||
|
||||
// this one has to use the /g flag
|
||||
re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g')
|
||||
re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g')
|
||||
var comparatorTrimReplace = '$1$2$3'
|
||||
|
||||
// Something like `1.2.3 - 1.2.4`
|
||||
// Note that these all use the loose form, because they'll be
|
||||
// checked against either the strict or loose comparator form
|
||||
// later.
|
||||
var HYPHENRANGE = R++
|
||||
src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' +
|
||||
tok('HYPHENRANGE')
|
||||
src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' +
|
||||
'\\s+-\\s+' +
|
||||
'(' + src[XRANGEPLAIN] + ')' +
|
||||
'(' + src[t.XRANGEPLAIN] + ')' +
|
||||
'\\s*$'
|
||||
|
||||
var HYPHENRANGELOOSE = R++
|
||||
src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' +
|
||||
tok('HYPHENRANGELOOSE')
|
||||
src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' +
|
||||
'\\s+-\\s+' +
|
||||
'(' + src[XRANGEPLAINLOOSE] + ')' +
|
||||
'(' + src[t.XRANGEPLAINLOOSE] + ')' +
|
||||
'\\s*$'
|
||||
|
||||
// Star ranges basically just allow anything at all.
|
||||
var STAR = R++
|
||||
src[STAR] = '(<|>)?=?\\s*\\*'
|
||||
tok('STAR')
|
||||
src[t.STAR] = '(<|>)?=?\\s*\\*'
|
||||
|
||||
// Compile to actual regexp objects.
|
||||
// All are flag-free, unless they were created above with a flag.
|
||||
@ -7376,7 +7385,7 @@ function parse (version, options) {
|
||||
return null
|
||||
}
|
||||
|
||||
var r = options.loose ? re[LOOSE] : re[FULL]
|
||||
var r = options.loose ? re[t.LOOSE] : re[t.FULL]
|
||||
if (!r.test(version)) {
|
||||
return null
|
||||
}
|
||||
@ -7431,7 +7440,7 @@ function SemVer (version, options) {
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
|
||||
var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL])
|
||||
var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError('Invalid Version: ' + version)
|
||||
@ -7892,7 +7901,7 @@ function Comparator (comp, options) {
|
||||
|
||||
var ANY = {}
|
||||
Comparator.prototype.parse = function (comp) {
|
||||
var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]
|
||||
var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
var m = comp.match(r)
|
||||
|
||||
if (!m) {
|
||||
@ -8047,18 +8056,18 @@ Range.prototype.parseRange = function (range) {
|
||||
var loose = this.options.loose
|
||||
range = range.trim()
|
||||
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
||||
var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]
|
||||
var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
|
||||
range = range.replace(hr, hyphenReplace)
|
||||
debug('hyphen replace', range)
|
||||
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
||||
range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace)
|
||||
debug('comparator trim', range, re[COMPARATORTRIM])
|
||||
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
|
||||
debug('comparator trim', range, re[t.COMPARATORTRIM])
|
||||
|
||||
// `~ 1.2.3` => `~1.2.3`
|
||||
range = range.replace(re[TILDETRIM], tildeTrimReplace)
|
||||
range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
|
||||
|
||||
// `^ 1.2.3` => `^1.2.3`
|
||||
range = range.replace(re[CARETTRIM], caretTrimReplace)
|
||||
range = range.replace(re[t.CARETTRIM], caretTrimReplace)
|
||||
|
||||
// normalize spaces
|
||||
range = range.split(/\s+/).join(' ')
|
||||
@ -8066,7 +8075,7 @@ Range.prototype.parseRange = function (range) {
|
||||
// At this point, the range is completely trimmed and
|
||||
// ready to be split into comparators.
|
||||
|
||||
var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]
|
||||
var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
var set = range.split(' ').map(function (comp) {
|
||||
return parseComparator(comp, this.options)
|
||||
}, this).join(' ').split(/\s+/)
|
||||
@ -8166,7 +8175,7 @@ function replaceTildes (comp, options) {
|
||||
}
|
||||
|
||||
function replaceTilde (comp, options) {
|
||||
var r = options.loose ? re[TILDELOOSE] : re[TILDE]
|
||||
var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
|
||||
return comp.replace(r, function (_, M, m, p, pr) {
|
||||
debug('tilde', comp, _, M, m, p, pr)
|
||||
var ret
|
||||
@ -8207,7 +8216,7 @@ function replaceCarets (comp, options) {
|
||||
|
||||
function replaceCaret (comp, options) {
|
||||
debug('caret', comp, options)
|
||||
var r = options.loose ? re[CARETLOOSE] : re[CARET]
|
||||
var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
|
||||
return comp.replace(r, function (_, M, m, p, pr) {
|
||||
debug('caret', comp, _, M, m, p, pr)
|
||||
var ret
|
||||
@ -8266,7 +8275,7 @@ function replaceXRanges (comp, options) {
|
||||
|
||||
function replaceXRange (comp, options) {
|
||||
comp = comp.trim()
|
||||
var r = options.loose ? re[XRANGELOOSE] : re[XRANGE]
|
||||
var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
|
||||
return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
|
||||
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
||||
var xM = isX(M)
|
||||
@ -8278,10 +8287,14 @@ function replaceXRange (comp, options) {
|
||||
gtlt = ''
|
||||
}
|
||||
|
||||
// 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 {
|
||||
// nothing is forbidden
|
||||
ret = '*'
|
||||
@ -8318,11 +8331,12 @@ function replaceXRange (comp, options) {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
debug('xRange return', ret)
|
||||
@ -8336,10 +8350,10 @@ function replaceXRange (comp, options) {
|
||||
function replaceStars (comp, options) {
|
||||
debug('replaceStars', comp, options)
|
||||
// Looseness is ignored here. star is always as loose as it gets!
|
||||
return comp.trim().replace(re[STAR], '')
|
||||
return comp.trim().replace(re[t.STAR], '')
|
||||
}
|
||||
|
||||
// This function is passed to string.replace(re[HYPHENRANGE])
|
||||
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
||||
// M, m, patch, prerelease, build
|
||||
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
||||
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
|
||||
@ -8650,19 +8664,49 @@ function coerce (version, options) {
|
||||
return version
|
||||
}
|
||||
|
||||
if (typeof version === 'number') {
|
||||
version = String(version)
|
||||
}
|
||||
|
||||
if (typeof version !== 'string') {
|
||||
return null
|
||||
}
|
||||
|
||||
var match = version.match(re[COERCE])
|
||||
options = options || {}
|
||||
|
||||
if (match == null) {
|
||||
var match = null
|
||||
if (!options.rtl) {
|
||||
match = version.match(re[t.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[t.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[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
|
||||
}
|
||||
// leave it in a clean state
|
||||
re[t.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)
|
||||
}
|
||||
|
||||
|
||||
|
299
dist/setup/index.js
vendored
299
dist/setup/index.js
vendored
@ -6486,6 +6486,7 @@ const path = __importStar(__webpack_require__(622));
|
||||
const cache_restore_1 = __webpack_require__(409);
|
||||
const cache_utils_1 = __webpack_require__(570);
|
||||
const os = __webpack_require__(87);
|
||||
const semver_1 = __importDefault(__webpack_require__(280));
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
@ -6516,7 +6517,17 @@ function run() {
|
||||
if (registryUrl) {
|
||||
auth.configAuthentication(registryUrl, alwaysAuth);
|
||||
}
|
||||
core.info('here');
|
||||
if (cache && cache_utils_1.isCacheFeatureAvailable()) {
|
||||
if (semver_1.default.gte(version, '14.19.0')) {
|
||||
core.info('here');
|
||||
try {
|
||||
core.info(yield cache_utils_1.getCommandOutput('corepack enable'));
|
||||
}
|
||||
catch (err) {
|
||||
core.warning(`Failed to enable corepack. Error: ${err.message}`);
|
||||
}
|
||||
}
|
||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||
yield cache_restore_1.restoreCache(cache, cacheDependencyPath);
|
||||
}
|
||||
@ -10946,75 +10957,80 @@ var MAX_SAFE_COMPONENT_LENGTH = 16
|
||||
// The actual regexps go on exports.re
|
||||
var re = exports.re = []
|
||||
var src = exports.src = []
|
||||
var t = exports.tokens = {}
|
||||
var R = 0
|
||||
|
||||
function tok (n) {
|
||||
t[n] = R++
|
||||
}
|
||||
|
||||
// The following Regular Expressions can be used for tokenizing,
|
||||
// validating, and parsing SemVer version strings.
|
||||
|
||||
// ## Numeric Identifier
|
||||
// A single `0`, or a non-zero digit followed by zero or more digits.
|
||||
|
||||
var NUMERICIDENTIFIER = R++
|
||||
src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'
|
||||
var NUMERICIDENTIFIERLOOSE = R++
|
||||
src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'
|
||||
tok('NUMERICIDENTIFIER')
|
||||
src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*'
|
||||
tok('NUMERICIDENTIFIERLOOSE')
|
||||
src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+'
|
||||
|
||||
// ## Non-numeric Identifier
|
||||
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
||||
// more letters, digits, or hyphens.
|
||||
|
||||
var NONNUMERICIDENTIFIER = R++
|
||||
src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'
|
||||
tok('NONNUMERICIDENTIFIER')
|
||||
src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'
|
||||
|
||||
// ## Main Version
|
||||
// Three dot-separated numeric identifiers.
|
||||
|
||||
var MAINVERSION = R++
|
||||
src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' +
|
||||
'(' + src[NUMERICIDENTIFIER] + ')\\.' +
|
||||
'(' + src[NUMERICIDENTIFIER] + ')'
|
||||
tok('MAINVERSION')
|
||||
src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
|
||||
'(' + src[t.NUMERICIDENTIFIER] + ')\\.' +
|
||||
'(' + src[t.NUMERICIDENTIFIER] + ')'
|
||||
|
||||
var MAINVERSIONLOOSE = R++
|
||||
src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
||||
'(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
||||
'(' + src[NUMERICIDENTIFIERLOOSE] + ')'
|
||||
tok('MAINVERSIONLOOSE')
|
||||
src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
||||
'(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' +
|
||||
'(' + src[t.NUMERICIDENTIFIERLOOSE] + ')'
|
||||
|
||||
// ## Pre-release Version Identifier
|
||||
// A numeric identifier, or a non-numeric identifier.
|
||||
|
||||
var PRERELEASEIDENTIFIER = R++
|
||||
src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +
|
||||
'|' + src[NONNUMERICIDENTIFIER] + ')'
|
||||
tok('PRERELEASEIDENTIFIER')
|
||||
src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] +
|
||||
'|' + src[t.NONNUMERICIDENTIFIER] + ')'
|
||||
|
||||
var PRERELEASEIDENTIFIERLOOSE = R++
|
||||
src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +
|
||||
'|' + src[NONNUMERICIDENTIFIER] + ')'
|
||||
tok('PRERELEASEIDENTIFIERLOOSE')
|
||||
src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] +
|
||||
'|' + src[t.NONNUMERICIDENTIFIER] + ')'
|
||||
|
||||
// ## Pre-release Version
|
||||
// Hyphen, followed by one or more dot-separated pre-release version
|
||||
// identifiers.
|
||||
|
||||
var PRERELEASE = R++
|
||||
src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +
|
||||
'(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'
|
||||
tok('PRERELEASE')
|
||||
src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] +
|
||||
'(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))'
|
||||
|
||||
var PRERELEASELOOSE = R++
|
||||
src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +
|
||||
'(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'
|
||||
tok('PRERELEASELOOSE')
|
||||
src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +
|
||||
'(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))'
|
||||
|
||||
// ## Build Metadata Identifier
|
||||
// Any combination of digits, letters, or hyphens.
|
||||
|
||||
var BUILDIDENTIFIER = R++
|
||||
src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'
|
||||
tok('BUILDIDENTIFIER')
|
||||
src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+'
|
||||
|
||||
// ## Build Metadata
|
||||
// Plus sign, followed by one or more period-separated build metadata
|
||||
// identifiers.
|
||||
|
||||
var BUILD = R++
|
||||
src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
|
||||
'(?:\\.' + src[BUILDIDENTIFIER] + ')*))'
|
||||
tok('BUILD')
|
||||
src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] +
|
||||
'(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))'
|
||||
|
||||
// ## Full Version String
|
||||
// A main version, followed optionally by a pre-release version and
|
||||
@ -11025,129 +11041,133 @@ src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] +
|
||||
// capturing group, because it should not ever be used in version
|
||||
// comparison.
|
||||
|
||||
var FULL = R++
|
||||
var FULLPLAIN = 'v?' + src[MAINVERSION] +
|
||||
src[PRERELEASE] + '?' +
|
||||
src[BUILD] + '?'
|
||||
tok('FULL')
|
||||
tok('FULLPLAIN')
|
||||
src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] +
|
||||
src[t.PRERELEASE] + '?' +
|
||||
src[t.BUILD] + '?'
|
||||
|
||||
src[FULL] = '^' + FULLPLAIN + '$'
|
||||
src[t.FULL] = '^' + src[t.FULLPLAIN] + '$'
|
||||
|
||||
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
||||
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
||||
// common in the npm registry.
|
||||
var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] +
|
||||
src[PRERELEASELOOSE] + '?' +
|
||||
src[BUILD] + '?'
|
||||
tok('LOOSEPLAIN')
|
||||
src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] +
|
||||
src[t.PRERELEASELOOSE] + '?' +
|
||||
src[t.BUILD] + '?'
|
||||
|
||||
var LOOSE = R++
|
||||
src[LOOSE] = '^' + LOOSEPLAIN + '$'
|
||||
tok('LOOSE')
|
||||
src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$'
|
||||
|
||||
var GTLT = R++
|
||||
src[GTLT] = '((?:<|>)?=?)'
|
||||
tok('GTLT')
|
||||
src[t.GTLT] = '((?:<|>)?=?)'
|
||||
|
||||
// Something like "2.*" or "1.2.x".
|
||||
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
||||
// Only the first item is strictly required.
|
||||
var XRANGEIDENTIFIERLOOSE = R++
|
||||
src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'
|
||||
var XRANGEIDENTIFIER = R++
|
||||
src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'
|
||||
tok('XRANGEIDENTIFIERLOOSE')
|
||||
src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'
|
||||
tok('XRANGEIDENTIFIER')
|
||||
src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*'
|
||||
|
||||
var XRANGEPLAIN = R++
|
||||
src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIER] + ')' +
|
||||
'(?:' + src[PRERELEASE] + ')?' +
|
||||
src[BUILD] + '?' +
|
||||
tok('XRANGEPLAIN')
|
||||
src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
|
||||
'(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' +
|
||||
'(?:' + src[t.PRERELEASE] + ')?' +
|
||||
src[t.BUILD] + '?' +
|
||||
')?)?'
|
||||
|
||||
var XRANGEPLAINLOOSE = R++
|
||||
src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:' + src[PRERELEASELOOSE] + ')?' +
|
||||
src[BUILD] + '?' +
|
||||
tok('XRANGEPLAINLOOSE')
|
||||
src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' +
|
||||
'(?:' + src[t.PRERELEASELOOSE] + ')?' +
|
||||
src[t.BUILD] + '?' +
|
||||
')?)?'
|
||||
|
||||
var XRANGE = R++
|
||||
src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'
|
||||
var XRANGELOOSE = R++
|
||||
src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'
|
||||
tok('XRANGE')
|
||||
src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$'
|
||||
tok('XRANGELOOSE')
|
||||
src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$'
|
||||
|
||||
// Coercion.
|
||||
// Extract anything that could conceivably be a part of a valid semver
|
||||
var COERCE = R++
|
||||
src[COERCE] = '(?:^|[^\\d])' +
|
||||
tok('COERCE')
|
||||
src[t.COERCE] = '(^|[^\\d])' +
|
||||
'(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +
|
||||
'(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
|
||||
'(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +
|
||||
'(?:$|[^\\d])'
|
||||
tok('COERCERTL')
|
||||
re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g')
|
||||
|
||||
// Tilde ranges.
|
||||
// Meaning is "reasonably at or greater than"
|
||||
var LONETILDE = R++
|
||||
src[LONETILDE] = '(?:~>?)'
|
||||
tok('LONETILDE')
|
||||
src[t.LONETILDE] = '(?:~>?)'
|
||||
|
||||
var TILDETRIM = R++
|
||||
src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'
|
||||
re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g')
|
||||
tok('TILDETRIM')
|
||||
src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+'
|
||||
re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g')
|
||||
var tildeTrimReplace = '$1~'
|
||||
|
||||
var TILDE = R++
|
||||
src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'
|
||||
var TILDELOOSE = R++
|
||||
src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'
|
||||
tok('TILDE')
|
||||
src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$'
|
||||
tok('TILDELOOSE')
|
||||
src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$'
|
||||
|
||||
// Caret ranges.
|
||||
// Meaning is "at least and backwards compatible with"
|
||||
var LONECARET = R++
|
||||
src[LONECARET] = '(?:\\^)'
|
||||
tok('LONECARET')
|
||||
src[t.LONECARET] = '(?:\\^)'
|
||||
|
||||
var CARETTRIM = R++
|
||||
src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'
|
||||
re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g')
|
||||
tok('CARETTRIM')
|
||||
src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+'
|
||||
re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g')
|
||||
var caretTrimReplace = '$1^'
|
||||
|
||||
var CARET = R++
|
||||
src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'
|
||||
var CARETLOOSE = R++
|
||||
src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'
|
||||
tok('CARET')
|
||||
src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$'
|
||||
tok('CARETLOOSE')
|
||||
src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$'
|
||||
|
||||
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
||||
var COMPARATORLOOSE = R++
|
||||
src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'
|
||||
var COMPARATOR = R++
|
||||
src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'
|
||||
tok('COMPARATORLOOSE')
|
||||
src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$'
|
||||
tok('COMPARATOR')
|
||||
src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$'
|
||||
|
||||
// An expression to strip any whitespace between the gtlt and the thing
|
||||
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
||||
var COMPARATORTRIM = R++
|
||||
src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] +
|
||||
'\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'
|
||||
tok('COMPARATORTRIM')
|
||||
src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] +
|
||||
'\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')'
|
||||
|
||||
// this one has to use the /g flag
|
||||
re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g')
|
||||
re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g')
|
||||
var comparatorTrimReplace = '$1$2$3'
|
||||
|
||||
// Something like `1.2.3 - 1.2.4`
|
||||
// Note that these all use the loose form, because they'll be
|
||||
// checked against either the strict or loose comparator form
|
||||
// later.
|
||||
var HYPHENRANGE = R++
|
||||
src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' +
|
||||
tok('HYPHENRANGE')
|
||||
src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' +
|
||||
'\\s+-\\s+' +
|
||||
'(' + src[XRANGEPLAIN] + ')' +
|
||||
'(' + src[t.XRANGEPLAIN] + ')' +
|
||||
'\\s*$'
|
||||
|
||||
var HYPHENRANGELOOSE = R++
|
||||
src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' +
|
||||
tok('HYPHENRANGELOOSE')
|
||||
src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' +
|
||||
'\\s+-\\s+' +
|
||||
'(' + src[XRANGEPLAINLOOSE] + ')' +
|
||||
'(' + src[t.XRANGEPLAINLOOSE] + ')' +
|
||||
'\\s*$'
|
||||
|
||||
// Star ranges basically just allow anything at all.
|
||||
var STAR = R++
|
||||
src[STAR] = '(<|>)?=?\\s*\\*'
|
||||
tok('STAR')
|
||||
src[t.STAR] = '(<|>)?=?\\s*\\*'
|
||||
|
||||
// Compile to actual regexp objects.
|
||||
// All are flag-free, unless they were created above with a flag.
|
||||
@ -11179,7 +11199,7 @@ function parse (version, options) {
|
||||
return null
|
||||
}
|
||||
|
||||
var r = options.loose ? re[LOOSE] : re[FULL]
|
||||
var r = options.loose ? re[t.LOOSE] : re[t.FULL]
|
||||
if (!r.test(version)) {
|
||||
return null
|
||||
}
|
||||
@ -11234,7 +11254,7 @@ function SemVer (version, options) {
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
|
||||
var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL])
|
||||
var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError('Invalid Version: ' + version)
|
||||
@ -11695,7 +11715,7 @@ function Comparator (comp, options) {
|
||||
|
||||
var ANY = {}
|
||||
Comparator.prototype.parse = function (comp) {
|
||||
var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]
|
||||
var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
var m = comp.match(r)
|
||||
|
||||
if (!m) {
|
||||
@ -11850,18 +11870,18 @@ Range.prototype.parseRange = function (range) {
|
||||
var loose = this.options.loose
|
||||
range = range.trim()
|
||||
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
||||
var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]
|
||||
var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
|
||||
range = range.replace(hr, hyphenReplace)
|
||||
debug('hyphen replace', range)
|
||||
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
||||
range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace)
|
||||
debug('comparator trim', range, re[COMPARATORTRIM])
|
||||
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
|
||||
debug('comparator trim', range, re[t.COMPARATORTRIM])
|
||||
|
||||
// `~ 1.2.3` => `~1.2.3`
|
||||
range = range.replace(re[TILDETRIM], tildeTrimReplace)
|
||||
range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
|
||||
|
||||
// `^ 1.2.3` => `^1.2.3`
|
||||
range = range.replace(re[CARETTRIM], caretTrimReplace)
|
||||
range = range.replace(re[t.CARETTRIM], caretTrimReplace)
|
||||
|
||||
// normalize spaces
|
||||
range = range.split(/\s+/).join(' ')
|
||||
@ -11869,7 +11889,7 @@ Range.prototype.parseRange = function (range) {
|
||||
// At this point, the range is completely trimmed and
|
||||
// ready to be split into comparators.
|
||||
|
||||
var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]
|
||||
var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
var set = range.split(' ').map(function (comp) {
|
||||
return parseComparator(comp, this.options)
|
||||
}, this).join(' ').split(/\s+/)
|
||||
@ -11969,7 +11989,7 @@ function replaceTildes (comp, options) {
|
||||
}
|
||||
|
||||
function replaceTilde (comp, options) {
|
||||
var r = options.loose ? re[TILDELOOSE] : re[TILDE]
|
||||
var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
|
||||
return comp.replace(r, function (_, M, m, p, pr) {
|
||||
debug('tilde', comp, _, M, m, p, pr)
|
||||
var ret
|
||||
@ -12010,7 +12030,7 @@ function replaceCarets (comp, options) {
|
||||
|
||||
function replaceCaret (comp, options) {
|
||||
debug('caret', comp, options)
|
||||
var r = options.loose ? re[CARETLOOSE] : re[CARET]
|
||||
var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
|
||||
return comp.replace(r, function (_, M, m, p, pr) {
|
||||
debug('caret', comp, _, M, m, p, pr)
|
||||
var ret
|
||||
@ -12069,7 +12089,7 @@ function replaceXRanges (comp, options) {
|
||||
|
||||
function replaceXRange (comp, options) {
|
||||
comp = comp.trim()
|
||||
var r = options.loose ? re[XRANGELOOSE] : re[XRANGE]
|
||||
var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
|
||||
return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
|
||||
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
||||
var xM = isX(M)
|
||||
@ -12081,10 +12101,14 @@ function replaceXRange (comp, options) {
|
||||
gtlt = ''
|
||||
}
|
||||
|
||||
// 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 {
|
||||
// nothing is forbidden
|
||||
ret = '*'
|
||||
@ -12121,11 +12145,12 @@ function replaceXRange (comp, options) {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
debug('xRange return', ret)
|
||||
@ -12139,10 +12164,10 @@ function replaceXRange (comp, options) {
|
||||
function replaceStars (comp, options) {
|
||||
debug('replaceStars', comp, options)
|
||||
// Looseness is ignored here. star is always as loose as it gets!
|
||||
return comp.trim().replace(re[STAR], '')
|
||||
return comp.trim().replace(re[t.STAR], '')
|
||||
}
|
||||
|
||||
// This function is passed to string.replace(re[HYPHENRANGE])
|
||||
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
||||
// M, m, patch, prerelease, build
|
||||
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
||||
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
|
||||
@ -12453,19 +12478,49 @@ function coerce (version, options) {
|
||||
return version
|
||||
}
|
||||
|
||||
if (typeof version === 'number') {
|
||||
version = String(version)
|
||||
}
|
||||
|
||||
if (typeof version !== 'string') {
|
||||
return null
|
||||
}
|
||||
|
||||
var match = version.match(re[COERCE])
|
||||
options = options || {}
|
||||
|
||||
if (match == null) {
|
||||
var match = null
|
||||
if (!options.rtl) {
|
||||
match = version.match(re[t.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[t.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[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
|
||||
}
|
||||
// leave it in a clean state
|
||||
re[t.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)
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,8 +47,12 @@ export async function run() {
|
||||
}
|
||||
|
||||
if (cache && isCacheFeatureAvailable()) {
|
||||
if (semver.gte(version, '14')) {
|
||||
await getCommandOutput('corepack enable');
|
||||
if (semver.gte(version, '14.19.0')) {
|
||||
try {
|
||||
core.info(await getCommandOutput('corepack enable'));
|
||||
} catch (err) {
|
||||
core.warning(`Failed to enable corepack. Error: ${err.message}`)
|
||||
}
|
||||
}
|
||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||
await restoreCache(cache, cacheDependencyPath);
|
||||
|
Loading…
Reference in New Issue
Block a user