Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions actions/should-release/dist/NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ Apache License

----

brace-expansion 5.0.7 - MIT
brace-expansion 5.0.8 - MIT
https://github.com/juliangruber/brace-expansion

MIT License
Expand Down Expand Up @@ -661,7 +661,7 @@ SOFTWARE.

----

minimatch 10.2.5 - BlueOak-1.0.0
minimatch 10.2.6 - BlueOak-1.0.0
https://github.com/isaacs/minimatch

Author: Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)
Expand Down
170 changes: 100 additions & 70 deletions actions/should-release/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21215,6 +21215,7 @@ var closePattern = /\\}/g;
var commaPattern = /\\,/g;
var periodPattern = /\\\./g;
var EXPANSION_MAX = 1e5;
var EXPANSION_MAX_LENGTH = 4e6;
function numeric(str) {
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
}
Expand Down Expand Up @@ -21253,11 +21254,11 @@ function expand(str, options = {}) {
if (!str) {
return [];
}
const { max = EXPANSION_MAX } = options;
const { max = EXPANSION_MAX, maxLength = EXPANSION_MAX_LENGTH } = options;
if (str.slice(0, 2) === "{}") {
str = "\\{\\}" + str.slice(2);
}
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
return expand_(escapeBraces(str), max, maxLength, true).map(unescapeBraces);
}
__name(expand, "expand");
function embrace(str) {
Expand All @@ -21276,20 +21277,85 @@ function gte(i, y) {
return i >= y;
}
__name(gte, "gte");
function expand_(str, max, isTop) {
const expansions = [];
function combine(acc, pre, values, max, maxLength, dropEmpties) {
const out = [];
let length = 0;
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;
}
__name(combine, "combine");
function expandSequence(body, isAlphaSequence, max) {
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 = lte;
const reverse = y < x;
if (reverse) {
incr *= -1;
test = gte;
}
const pad = n.some(isPadded);
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;
}
}
}
}
N.push(c);
}
return N;
}
__name(expandSequence, "expandSequence");
function expand_(str, max, maxLength, isTop) {
let acc = [""];
let dropEmpties = false;
let firstGroup = true;
for (; ; ) {
const m = balanced("{", "}", str);
if (!m)
return [str];
if (!m) {
return combine(acc, str, [""], max, maxLength, dropEmpties);
}
const pre = m.pre;
if (/\$$/.test(m.pre)) {
const post2 = m.post.length ? expand_(m.post, max, false) : [""];
for (let k = 0; k < post2.length && k < max; k++) {
const expansion = pre + "{" + m.body + "}" + post2[k];
expansions.push(expansion);
}
return expansions;
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;
}
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
Expand All @@ -21301,74 +21367,38 @@ function expand_(str, max, isTop) {
isTop = true;
continue;
}
return [str];
return combine(acc, pre + "{" + m.body + "}" + m.post, [""], max, maxLength, dropEmpties);
}
const post = m.post.length ? expand_(m.post, max, false) : [""];
let n;
if (firstGroup) {
dropEmpties = isTop && !isSequence;
firstGroup = false;
}
let values;
if (isSequence) {
n = m.body.split(/\.\./);
values = expandSequence(m.body, isAlphaSequence, max);
} else {
n = parseCommaParts(m.body);
let n = parseCommaParts(m.body);
if (n.length === 1 && n[0] !== void 0) {
n = expand_(n[0], max, false).map(embrace);
n = expand_(n[0], max, maxLength, false).map(embrace);
if (n.length === 1) {
return post.map((p) => m.pre + n[0] + p);
}
}
}
let N;
if (isSequence && n[0] !== void 0 && n[1] !== void 0) {
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 = lte;
const reverse = y < x;
if (reverse) {
incr *= -1;
test = gte;
}
const pad = n.some(isPadded);
N = [];
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;
}
}
}
acc = combine(acc, pre + n[0], [""], max, maxLength, dropEmpties && !m.post.length);
if (!m.post.length)
break;
str = m.post;
continue;
}
N.push(c);
}
} else {
N = [];
values = [];
for (let j = 0; j < n.length; j++) {
N.push.apply(N, expand_(n[j], max, false));
values.push.apply(values, expand_(n[j], max, maxLength, 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);
}
}
}
return expansions;
acc = combine(acc, pre, values, max, maxLength, dropEmpties && !m.post.length);
if (!m.post.length)
break;
str = m.post;
}
return acc;
}
__name(expand_, "expand_");

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Update brace-expansion and minimatch dependencies",
"packageName": "@microsoft/beachball-action-should-release",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
}
Loading