mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-20 13:14:44 +00:00
.
This commit is contained in:
parent
beb1329f9f
commit
2b95e76931
7736 changed files with 1874747 additions and 51184 deletions
BIN
node_modules/extglob/lib/.DS_Store
generated
vendored
Normal file
BIN
node_modules/extglob/lib/.DS_Store
generated
vendored
Normal file
Binary file not shown.
169
node_modules/extglob/lib/compilers.js
generated
vendored
Normal file
169
node_modules/extglob/lib/compilers.js
generated
vendored
Normal file
|
@ -0,0 +1,169 @@
|
|||
'use strict';
|
||||
|
||||
var brackets = require('expand-brackets');
|
||||
|
||||
/**
|
||||
* Extglob compilers
|
||||
*/
|
||||
|
||||
module.exports = function(extglob) {
|
||||
function star() {
|
||||
if (typeof extglob.options.star === 'function') {
|
||||
return extglob.options.star.apply(this, arguments);
|
||||
}
|
||||
if (typeof extglob.options.star === 'string') {
|
||||
return extglob.options.star;
|
||||
}
|
||||
return '.*?';
|
||||
}
|
||||
|
||||
/**
|
||||
* Use `expand-brackets` compilers
|
||||
*/
|
||||
|
||||
extglob.use(brackets.compilers);
|
||||
extglob.compiler
|
||||
|
||||
/**
|
||||
* Escaped: "\\*"
|
||||
*/
|
||||
|
||||
.set('escape', function(node) {
|
||||
return this.emit(node.val, node);
|
||||
})
|
||||
|
||||
/**
|
||||
* Dot: "."
|
||||
*/
|
||||
|
||||
.set('dot', function(node) {
|
||||
return this.emit('\\' + node.val, node);
|
||||
})
|
||||
|
||||
/**
|
||||
* Question mark: "?"
|
||||
*/
|
||||
|
||||
.set('qmark', function(node) {
|
||||
var val = '[^\\\\/.]';
|
||||
var prev = this.prev();
|
||||
|
||||
if (node.parsed.slice(-1) === '(') {
|
||||
var ch = node.rest.charAt(0);
|
||||
if (ch !== '!' && ch !== '=' && ch !== ':') {
|
||||
return this.emit(val, node);
|
||||
}
|
||||
return this.emit(node.val, node);
|
||||
}
|
||||
|
||||
if (prev.type === 'text' && prev.val) {
|
||||
return this.emit(val, node);
|
||||
}
|
||||
|
||||
if (node.val.length > 1) {
|
||||
val += '{' + node.val.length + '}';
|
||||
}
|
||||
return this.emit(val, node);
|
||||
})
|
||||
|
||||
/**
|
||||
* Plus: "+"
|
||||
*/
|
||||
|
||||
.set('plus', function(node) {
|
||||
var prev = node.parsed.slice(-1);
|
||||
if (prev === ']' || prev === ')') {
|
||||
return this.emit(node.val, node);
|
||||
}
|
||||
var ch = this.output.slice(-1);
|
||||
if (!this.output || (/[?*+]/.test(ch) && node.parent.type !== 'bracket')) {
|
||||
return this.emit('\\+', node);
|
||||
}
|
||||
if (/\w/.test(ch) && !node.inside) {
|
||||
return this.emit('+\\+?', node);
|
||||
}
|
||||
return this.emit('+', node);
|
||||
})
|
||||
|
||||
/**
|
||||
* Star: "*"
|
||||
*/
|
||||
|
||||
.set('star', function(node) {
|
||||
var prev = this.prev();
|
||||
var prefix = prev.type !== 'text' && prev.type !== 'escape'
|
||||
? '(?!\\.)'
|
||||
: '';
|
||||
|
||||
return this.emit(prefix + star.call(this, node), node);
|
||||
})
|
||||
|
||||
/**
|
||||
* Parens
|
||||
*/
|
||||
|
||||
.set('paren', function(node) {
|
||||
return this.mapVisit(node.nodes);
|
||||
})
|
||||
.set('paren.open', function(node) {
|
||||
var capture = this.options.capture ? '(' : '';
|
||||
|
||||
switch (node.parent.prefix) {
|
||||
case '!':
|
||||
case '^':
|
||||
return this.emit(capture + '(?:(?!(?:', node);
|
||||
case '*':
|
||||
case '+':
|
||||
case '?':
|
||||
case '@':
|
||||
return this.emit(capture + '(?:', node);
|
||||
default: {
|
||||
var val = node.val;
|
||||
if (this.options.bash === true) {
|
||||
val = '\\' + val;
|
||||
} else if (!this.options.capture && val === '(' && node.parent.rest[0] !== '?') {
|
||||
val += '?:';
|
||||
}
|
||||
|
||||
return this.emit(val, node);
|
||||
}
|
||||
}
|
||||
})
|
||||
.set('paren.close', function(node) {
|
||||
var capture = this.options.capture ? ')' : '';
|
||||
|
||||
switch (node.prefix) {
|
||||
case '!':
|
||||
case '^':
|
||||
var prefix = /^(\)|$)/.test(node.rest) ? '$' : '';
|
||||
var str = star.call(this, node);
|
||||
|
||||
// if the extglob has a slash explicitly defined, we know the user wants
|
||||
// to match slashes, so we need to ensure the "star" regex allows for it
|
||||
if (node.parent.hasSlash && !this.options.star && this.options.slash !== false) {
|
||||
str = '.*?';
|
||||
}
|
||||
|
||||
return this.emit(prefix + ('))' + str + ')') + capture, node);
|
||||
case '*':
|
||||
case '+':
|
||||
case '?':
|
||||
return this.emit(')' + node.prefix + capture, node);
|
||||
case '@':
|
||||
return this.emit(')' + capture, node);
|
||||
default: {
|
||||
var val = (this.options.bash === true ? '\\' : '') + ')';
|
||||
return this.emit(val, node);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* Text
|
||||
*/
|
||||
|
||||
.set('text', function(node) {
|
||||
var val = node.val.replace(/[\[\]]/g, '\\$&');
|
||||
return this.emit(val, node);
|
||||
});
|
||||
};
|
78
node_modules/extglob/lib/extglob.js
generated
vendored
Normal file
78
node_modules/extglob/lib/extglob.js
generated
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var Snapdragon = require('snapdragon');
|
||||
var define = require('define-property');
|
||||
var extend = require('extend-shallow');
|
||||
|
||||
/**
|
||||
* Local dependencies
|
||||
*/
|
||||
|
||||
var compilers = require('./compilers');
|
||||
var parsers = require('./parsers');
|
||||
|
||||
/**
|
||||
* Customize Snapdragon parser and renderer
|
||||
*/
|
||||
|
||||
function Extglob(options) {
|
||||
this.options = extend({source: 'extglob'}, options);
|
||||
this.snapdragon = this.options.snapdragon || new Snapdragon(this.options);
|
||||
this.snapdragon.patterns = this.snapdragon.patterns || {};
|
||||
this.compiler = this.snapdragon.compiler;
|
||||
this.parser = this.snapdragon.parser;
|
||||
|
||||
compilers(this.snapdragon);
|
||||
parsers(this.snapdragon);
|
||||
|
||||
/**
|
||||
* Override Snapdragon `.parse` method
|
||||
*/
|
||||
|
||||
define(this.snapdragon, 'parse', function(str, options) {
|
||||
var parsed = Snapdragon.prototype.parse.apply(this, arguments);
|
||||
parsed.input = str;
|
||||
|
||||
// escape unmatched brace/bracket/parens
|
||||
var last = this.parser.stack.pop();
|
||||
if (last && this.options.strict !== true) {
|
||||
var node = last.nodes[0];
|
||||
node.val = '\\' + node.val;
|
||||
var sibling = node.parent.nodes[1];
|
||||
if (sibling.type === 'star') {
|
||||
sibling.loose = true;
|
||||
}
|
||||
}
|
||||
|
||||
// add non-enumerable parser reference
|
||||
define(parsed, 'parser', this.parser);
|
||||
return parsed;
|
||||
});
|
||||
|
||||
/**
|
||||
* Decorate `.parse` method
|
||||
*/
|
||||
|
||||
define(this, 'parse', function(ast, options) {
|
||||
return this.snapdragon.parse.apply(this.snapdragon, arguments);
|
||||
});
|
||||
|
||||
/**
|
||||
* Decorate `.compile` method
|
||||
*/
|
||||
|
||||
define(this, 'compile', function(ast, options) {
|
||||
return this.snapdragon.compile.apply(this.snapdragon, arguments);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose `Extglob`
|
||||
*/
|
||||
|
||||
module.exports = Extglob;
|
156
node_modules/extglob/lib/parsers.js
generated
vendored
Normal file
156
node_modules/extglob/lib/parsers.js
generated
vendored
Normal file
|
@ -0,0 +1,156 @@
|
|||
'use strict';
|
||||
|
||||
var brackets = require('expand-brackets');
|
||||
var define = require('define-property');
|
||||
var utils = require('./utils');
|
||||
|
||||
/**
|
||||
* Characters to use in text regex (we want to "not" match
|
||||
* characters that are matched by other parsers)
|
||||
*/
|
||||
|
||||
var TEXT_REGEX = '([!@*?+]?\\(|\\)|[*?.+\\\\]|\\[:?(?=.*\\])|:?\\])+';
|
||||
var not = utils.createRegex(TEXT_REGEX);
|
||||
|
||||
/**
|
||||
* Extglob parsers
|
||||
*/
|
||||
|
||||
function parsers(extglob) {
|
||||
extglob.state = extglob.state || {};
|
||||
|
||||
/**
|
||||
* Use `expand-brackets` parsers
|
||||
*/
|
||||
|
||||
extglob.use(brackets.parsers);
|
||||
extglob.parser.sets.paren = extglob.parser.sets.paren || [];
|
||||
extglob.parser
|
||||
|
||||
/**
|
||||
* Extglob open: "*("
|
||||
*/
|
||||
|
||||
.capture('paren.open', function() {
|
||||
var parsed = this.parsed;
|
||||
var pos = this.position();
|
||||
var m = this.match(/^([!@*?+])?\(/);
|
||||
if (!m) return;
|
||||
|
||||
var prev = this.prev();
|
||||
var prefix = m[1];
|
||||
var val = m[0];
|
||||
|
||||
var open = pos({
|
||||
type: 'paren.open',
|
||||
parsed: parsed,
|
||||
val: val
|
||||
});
|
||||
|
||||
var node = pos({
|
||||
type: 'paren',
|
||||
prefix: prefix,
|
||||
nodes: [open]
|
||||
});
|
||||
|
||||
// if nested negation extglobs, just cancel them out to simplify
|
||||
if (prefix === '!' && prev.type === 'paren' && prev.prefix === '!') {
|
||||
prev.prefix = '@';
|
||||
node.prefix = '@';
|
||||
}
|
||||
|
||||
define(node, 'rest', this.input);
|
||||
define(node, 'parsed', parsed);
|
||||
define(node, 'parent', prev);
|
||||
define(open, 'parent', node);
|
||||
|
||||
this.push('paren', node);
|
||||
prev.nodes.push(node);
|
||||
})
|
||||
|
||||
/**
|
||||
* Extglob close: ")"
|
||||
*/
|
||||
|
||||
.capture('paren.close', function() {
|
||||
var parsed = this.parsed;
|
||||
var pos = this.position();
|
||||
var m = this.match(/^\)/);
|
||||
if (!m) return;
|
||||
|
||||
var parent = this.pop('paren');
|
||||
var node = pos({
|
||||
type: 'paren.close',
|
||||
rest: this.input,
|
||||
parsed: parsed,
|
||||
val: m[0]
|
||||
});
|
||||
|
||||
if (!this.isType(parent, 'paren')) {
|
||||
if (this.options.strict) {
|
||||
throw new Error('missing opening paren: "("');
|
||||
}
|
||||
node.escaped = true;
|
||||
return node;
|
||||
}
|
||||
|
||||
node.prefix = parent.prefix;
|
||||
parent.nodes.push(node);
|
||||
define(node, 'parent', parent);
|
||||
})
|
||||
|
||||
/**
|
||||
* Escape: "\\."
|
||||
*/
|
||||
|
||||
.capture('escape', function() {
|
||||
var pos = this.position();
|
||||
var m = this.match(/^\\(.)/);
|
||||
if (!m) return;
|
||||
|
||||
return pos({
|
||||
type: 'escape',
|
||||
val: m[0],
|
||||
ch: m[1]
|
||||
});
|
||||
})
|
||||
|
||||
/**
|
||||
* Question marks: "?"
|
||||
*/
|
||||
|
||||
.capture('qmark', function() {
|
||||
var parsed = this.parsed;
|
||||
var pos = this.position();
|
||||
var m = this.match(/^\?+(?!\()/);
|
||||
if (!m) return;
|
||||
extglob.state.metachar = true;
|
||||
return pos({
|
||||
type: 'qmark',
|
||||
rest: this.input,
|
||||
parsed: parsed,
|
||||
val: m[0]
|
||||
});
|
||||
})
|
||||
|
||||
/**
|
||||
* Character parsers
|
||||
*/
|
||||
|
||||
.capture('star', /^\*(?!\()/)
|
||||
.capture('plus', /^\+(?!\()/)
|
||||
.capture('dot', /^\./)
|
||||
.capture('text', not);
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose text regex string
|
||||
*/
|
||||
|
||||
module.exports.TEXT_REGEX = TEXT_REGEX;
|
||||
|
||||
/**
|
||||
* Extglob parsers
|
||||
*/
|
||||
|
||||
module.exports = parsers;
|
69
node_modules/extglob/lib/utils.js
generated
vendored
Normal file
69
node_modules/extglob/lib/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
'use strict';
|
||||
|
||||
var regex = require('regex-not');
|
||||
var Cache = require('fragment-cache');
|
||||
|
||||
/**
|
||||
* Utils
|
||||
*/
|
||||
|
||||
var utils = module.exports;
|
||||
var cache = utils.cache = new Cache();
|
||||
|
||||
/**
|
||||
* Cast `val` to an array
|
||||
* @return {Array}
|
||||
*/
|
||||
|
||||
utils.arrayify = function(val) {
|
||||
if (!Array.isArray(val)) {
|
||||
return [val];
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
/**
|
||||
* Memoize a generated regex or function
|
||||
*/
|
||||
|
||||
utils.memoize = function(type, pattern, options, fn) {
|
||||
var key = utils.createKey(type + pattern, options);
|
||||
|
||||
if (cache.has(type, key)) {
|
||||
return cache.get(type, key);
|
||||
}
|
||||
|
||||
var val = fn(pattern, options);
|
||||
if (options && options.cache === false) {
|
||||
return val;
|
||||
}
|
||||
|
||||
cache.set(type, key, val);
|
||||
return val;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create the key to use for memoization. The key is generated
|
||||
* by iterating over the options and concatenating key-value pairs
|
||||
* to the pattern string.
|
||||
*/
|
||||
|
||||
utils.createKey = function(pattern, options) {
|
||||
var key = pattern;
|
||||
if (typeof options === 'undefined') {
|
||||
return key;
|
||||
}
|
||||
for (var prop in options) {
|
||||
key += ';' + prop + '=' + String(options[prop]);
|
||||
}
|
||||
return key;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create the regex to use for matching text
|
||||
*/
|
||||
|
||||
utils.createRegex = function(str) {
|
||||
var opts = {contains: true, strictClose: false};
|
||||
return regex(str, opts);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue