mirror of
https://github.com/astral-sh/ruff-action.git
synced 2026-11-10 08:40:38 +00:00
Update brace-expansion dependencies (#432)
Update the locked `brace-expansion` dependencies to `1.1.21`, `2.1.7`, and `5.0.12` in `package-lock.json`. This addresses Dependabot alerts [#73](https://github.com/astral-sh/ruff-action/security/dependabot/73), [#72](https://github.com/astral-sh/ruff-action/security/dependabot/72), and [#71](https://github.com/astral-sh/ruff-action/security/dependabot/71), among other alerts for this dependency.
This commit is contained in:
+154
-86
@@ -28880,6 +28880,9 @@ var closePattern = /\\}/g;
|
|||||||
var commaPattern = /\\,/g;
|
var commaPattern = /\\,/g;
|
||||||
var periodPattern = /\\\./g;
|
var periodPattern = /\\\./g;
|
||||||
var EXPANSION_MAX = 1e5;
|
var EXPANSION_MAX = 1e5;
|
||||||
|
var EXPANSION_MAX_LENGTH = 4e6;
|
||||||
|
var EXPANSION_MAX_DEPTH = 1e3;
|
||||||
|
var EXPANSION_MAX_REWRITES = 1e3;
|
||||||
function numeric(str) {
|
function numeric(str) {
|
||||||
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
||||||
}
|
}
|
||||||
@@ -28889,36 +28892,44 @@ function escapeBraces(str) {
|
|||||||
function unescapeBraces(str) {
|
function unescapeBraces(str) {
|
||||||
return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
|
return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
|
||||||
}
|
}
|
||||||
|
function pushAll(target, items) {
|
||||||
|
for (let i = 0; i < items.length; i++) {
|
||||||
|
target.push(items[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
function parseCommaParts(str) {
|
function parseCommaParts(str) {
|
||||||
if (!str) {
|
|
||||||
return [""];
|
|
||||||
}
|
|
||||||
const parts = [];
|
const parts = [];
|
||||||
const m = balanced("{", "}", str);
|
let carry = "";
|
||||||
if (!m) {
|
for (; ; ) {
|
||||||
return str.split(",");
|
const m = balanced("{", "}", str);
|
||||||
|
if (!m) {
|
||||||
|
const tail = str.split(",");
|
||||||
|
tail[0] = carry + tail[0];
|
||||||
|
pushAll(parts, tail);
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
|
const { pre, body, post } = m;
|
||||||
|
const p = pre.split(",");
|
||||||
|
p[0] = carry + p[0];
|
||||||
|
p[p.length - 1] += "{" + body + "}";
|
||||||
|
if (!post.length) {
|
||||||
|
pushAll(parts, p);
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
|
carry = p.pop();
|
||||||
|
pushAll(parts, p);
|
||||||
|
str = post;
|
||||||
}
|
}
|
||||||
const { pre, body, post } = m;
|
|
||||||
const p = pre.split(",");
|
|
||||||
p[p.length - 1] += "{" + body + "}";
|
|
||||||
const postParts = parseCommaParts(post);
|
|
||||||
if (post.length) {
|
|
||||||
;
|
|
||||||
p[p.length - 1] += postParts.shift();
|
|
||||||
p.push.apply(p, postParts);
|
|
||||||
}
|
|
||||||
parts.push.apply(parts, p);
|
|
||||||
return parts;
|
|
||||||
}
|
}
|
||||||
function expand(str, options = {}) {
|
function expand(str, options = {}) {
|
||||||
if (!str) {
|
if (!str) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const { max = EXPANSION_MAX } = options;
|
const { max = EXPANSION_MAX, maxLength = EXPANSION_MAX_LENGTH, maxDepth = EXPANSION_MAX_DEPTH, maxRewrites = EXPANSION_MAX_REWRITES } = options;
|
||||||
if (str.slice(0, 2) === "{}") {
|
if (str.slice(0, 2) === "{}") {
|
||||||
str = "\\{\\}" + str.slice(2);
|
str = "\\{\\}" + str.slice(2);
|
||||||
}
|
}
|
||||||
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
|
return expand_(escapeBraces(str), max, maxLength, maxDepth, 0, maxRewrites, true).map(unescapeBraces);
|
||||||
}
|
}
|
||||||
function embrace(str) {
|
function embrace(str) {
|
||||||
return "{" + str + "}";
|
return "{" + str + "}";
|
||||||
@@ -28932,95 +28943,152 @@ function lte2(i, y) {
|
|||||||
function gte2(i, y) {
|
function gte2(i, y) {
|
||||||
return i >= y;
|
return i >= y;
|
||||||
}
|
}
|
||||||
function expand_(str, max, isTop) {
|
function combine(acc, pre, values, max, maxLength, dropEmpties) {
|
||||||
const expansions = [];
|
const out = [];
|
||||||
const m = balanced("{", "}", str);
|
let length = 0;
|
||||||
if (!m)
|
for (let a = 0; a < acc.length; a++) {
|
||||||
|
for (let v = 0; v < values.length; v++) {
|
||||||
|
if (out.length >= max)
|
||||||
|
return out;
|
||||||
|
const expansion = acc[a] + pre + values[v];
|
||||||
|
if (dropEmpties && !expansion)
|
||||||
|
continue;
|
||||||
|
if (length + expansion.length > maxLength)
|
||||||
|
return out;
|
||||||
|
out.push(expansion);
|
||||||
|
length += expansion.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
function expandSequence(body, isAlphaSequence, max, maxLength) {
|
||||||
|
const n = body.split(/\.\./);
|
||||||
|
const N = [];
|
||||||
|
if (n[0] === void 0 || n[1] === void 0) {
|
||||||
|
return N;
|
||||||
|
}
|
||||||
|
const x = numeric(n[0]);
|
||||||
|
const y = numeric(n[1]);
|
||||||
|
const width = Math.max(n[0].length, n[1].length);
|
||||||
|
let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
||||||
|
let test = lte2;
|
||||||
|
const reverse = y < x;
|
||||||
|
if (reverse) {
|
||||||
|
incr *= -1;
|
||||||
|
test = gte2;
|
||||||
|
}
|
||||||
|
const pad = n.some(isPadded);
|
||||||
|
let length = 0;
|
||||||
|
for (let i = x; test(i, y) && N.length < max; i += incr) {
|
||||||
|
let c;
|
||||||
|
if (isAlphaSequence) {
|
||||||
|
c = String.fromCharCode(i);
|
||||||
|
if (c === "\\") {
|
||||||
|
c = "";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
c = String(i);
|
||||||
|
if (pad) {
|
||||||
|
const need = width - c.length;
|
||||||
|
if (need > 0) {
|
||||||
|
const z = new Array(need + 1).join("0");
|
||||||
|
if (i < 0) {
|
||||||
|
c = "-" + z + c.slice(1);
|
||||||
|
} else {
|
||||||
|
c = z + c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (length + c.length > maxLength)
|
||||||
|
break;
|
||||||
|
N.push(c);
|
||||||
|
length += c.length;
|
||||||
|
}
|
||||||
|
return N;
|
||||||
|
}
|
||||||
|
function expand_(str, max, maxLength, maxDepth, depth, maxRewrites, isTop) {
|
||||||
|
if (depth > maxDepth) {
|
||||||
return [str];
|
return [str];
|
||||||
const pre = m.pre;
|
}
|
||||||
const post = m.post.length ? expand_(m.post, max, false) : [""];
|
let acc = [""];
|
||||||
if (/\$$/.test(m.pre)) {
|
let rewrites = 0;
|
||||||
for (let k = 0; k < post.length && k < max; k++) {
|
let dropEmpties = false;
|
||||||
const expansion = pre + "{" + m.body + "}" + post[k];
|
let firstGroup = true;
|
||||||
expansions.push(expansion);
|
for (; ; ) {
|
||||||
|
const m = balanced("{", "}", str);
|
||||||
|
if (!m) {
|
||||||
|
return combine(acc, str, [""], max, maxLength, dropEmpties);
|
||||||
|
}
|
||||||
|
const pre = m.pre;
|
||||||
|
if (/\$$/.test(pre)) {
|
||||||
|
acc = combine(acc, pre + "{" + m.body + "}", [""], max, maxLength, dropEmpties && !m.post.length);
|
||||||
|
firstGroup = false;
|
||||||
|
if (!m.post.length)
|
||||||
|
break;
|
||||||
|
str = m.post;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||||
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||||
const isSequence = isNumericSequence || isAlphaSequence;
|
const isSequence = isNumericSequence || isAlphaSequence;
|
||||||
const isOptions = m.body.indexOf(",") >= 0;
|
const isOptions = m.body.indexOf(",") >= 0;
|
||||||
if (!isSequence && !isOptions) {
|
if (!isSequence && !isOptions) {
|
||||||
if (m.post.match(/,(?!,).*\}/)) {
|
if (rewrites < maxRewrites && m.post.match(/,(?!,).*\}/)) {
|
||||||
|
rewrites++;
|
||||||
str = m.pre + "{" + m.body + escClose + m.post;
|
str = m.pre + "{" + m.body + escClose + m.post;
|
||||||
return expand_(str, max, true);
|
isTop = true;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
return [str];
|
return combine(acc, pre + "{" + m.body + "}" + m.post, [""], max, maxLength, dropEmpties);
|
||||||
}
|
}
|
||||||
let n;
|
if (firstGroup) {
|
||||||
|
dropEmpties = isTop && !isSequence;
|
||||||
|
firstGroup = false;
|
||||||
|
}
|
||||||
|
let values;
|
||||||
if (isSequence) {
|
if (isSequence) {
|
||||||
n = m.body.split(/\.\./);
|
values = expandSequence(m.body, isAlphaSequence, max, maxLength);
|
||||||
} else {
|
} else {
|
||||||
n = parseCommaParts(m.body);
|
let n = parseCommaParts(m.body);
|
||||||
if (n.length === 1 && n[0] !== void 0) {
|
if (n.length === 1 && n[0] !== void 0) {
|
||||||
n = expand_(n[0], max, false).map(embrace);
|
n = expand_(n[0], max, maxLength, maxDepth, depth + 1, maxRewrites, false).map(embrace);
|
||||||
if (n.length === 1) {
|
if (n.length === 1) {
|
||||||
return post.map((p) => m.pre + n[0] + p);
|
acc = combine(acc, pre + n[0], [""], max, maxLength, dropEmpties && !m.post.length);
|
||||||
|
if (!m.post.length)
|
||||||
|
break;
|
||||||
|
str = m.post;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
let dropsEmpties = dropEmpties && !m.post.length && !pre;
|
||||||
let N;
|
for (let d = 0; dropsEmpties && d < acc.length; d++) {
|
||||||
if (isSequence && n[0] !== void 0 && n[1] !== void 0) {
|
if (acc[d]) {
|
||||||
const x = numeric(n[0]);
|
dropsEmpties = false;
|
||||||
const y = numeric(n[1]);
|
}
|
||||||
const width = Math.max(n[0].length, n[1].length);
|
|
||||||
let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
|
||||||
let test = lte2;
|
|
||||||
const reverse = y < x;
|
|
||||||
if (reverse) {
|
|
||||||
incr *= -1;
|
|
||||||
test = gte2;
|
|
||||||
}
|
}
|
||||||
const pad = n.some(isPadded);
|
values = [];
|
||||||
N = [];
|
let valuesLength = 0;
|
||||||
for (let i = x; test(i, y); i += incr) {
|
outer: for (let j = 0; j < n.length; j++) {
|
||||||
let c;
|
const expanded = expand_(n[j], max, maxLength, maxDepth, depth + 1, maxRewrites, false);
|
||||||
if (isAlphaSequence) {
|
for (let k = 0; k < expanded.length; k++) {
|
||||||
c = String.fromCharCode(i);
|
const v = expanded[k];
|
||||||
if (c === "\\") {
|
if (dropsEmpties && !v)
|
||||||
c = "";
|
continue;
|
||||||
|
if (values.length >= max || valuesLength + v.length > maxLength) {
|
||||||
|
break outer;
|
||||||
}
|
}
|
||||||
} else {
|
values.push(v);
|
||||||
c = String(i);
|
valuesLength += v.length;
|
||||||
if (pad) {
|
|
||||||
const need = width - c.length;
|
|
||||||
if (need > 0) {
|
|
||||||
const z = new Array(need + 1).join("0");
|
|
||||||
if (i < 0) {
|
|
||||||
c = "-" + z + c.slice(1);
|
|
||||||
} else {
|
|
||||||
c = z + c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
N.push(c);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
N = [];
|
|
||||||
for (let j = 0; j < n.length; j++) {
|
|
||||||
N.push.apply(N, expand_(n[j], max, false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let j = 0; j < N.length; j++) {
|
|
||||||
for (let k = 0; k < post.length && expansions.length < max; k++) {
|
|
||||||
const expansion = pre + N[j] + post[k];
|
|
||||||
if (!isTop || isSequence || expansion) {
|
|
||||||
expansions.push(expansion);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
acc = combine(acc, pre, values, max, maxLength, dropEmpties && !m.post.length);
|
||||||
|
if (!m.post.length)
|
||||||
|
break;
|
||||||
|
str = m.post;
|
||||||
}
|
}
|
||||||
return expansions;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// node_modules/@actions/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
// node_modules/@actions/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
||||||
|
|||||||
Generated
+10
-10
@@ -75,15 +75,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/glob/node_modules/brace-expansion": {
|
"node_modules/@actions/glob/node_modules/brace-expansion": {
|
||||||
"version": "5.0.5",
|
"version": "5.0.12",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz",
|
||||||
"integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==",
|
"integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"balanced-match": "^4.0.2"
|
"balanced-match": "^4.0.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "18 || 20 || >=22"
|
"node": "20 || >=22"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/glob/node_modules/minimatch": {
|
"node_modules/@actions/glob/node_modules/minimatch": {
|
||||||
@@ -3613,9 +3613,9 @@
|
|||||||
"license": "Apache-2.0"
|
"license": "Apache-2.0"
|
||||||
},
|
},
|
||||||
"node_modules/brace-expansion": {
|
"node_modules/brace-expansion": {
|
||||||
"version": "2.0.3",
|
"version": "2.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz",
|
||||||
"integrity": "sha512-MCV/fYJEbqx68aE58kv2cA/kiky1G8vux3OR6/jbS+jIMe/6fJWa0DTzJU7dqijOWYwHi1t29FlfYI9uytqlpA==",
|
"integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -7825,9 +7825,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/test-exclude/node_modules/brace-expansion": {
|
"node_modules/test-exclude/node_modules/brace-expansion": {
|
||||||
"version": "1.1.13",
|
"version": "1.1.21",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz",
|
||||||
"integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==",
|
"integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
Reference in New Issue
Block a user