From 2cc85c64f1c64a2dbaeae276a3e2ca8420de76b7 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 22 四月 2026 18:09:58 +0800
Subject: [PATCH] 上报转运调试
---
node_modules/brace-expansion/index.js | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/node_modules/brace-expansion/index.js b/node_modules/brace-expansion/index.js
index bd19fe6..87ecd30 100644
--- a/node_modules/brace-expansion/index.js
+++ b/node_modules/brace-expansion/index.js
@@ -62,9 +62,12 @@
return parts;
}
-function expandTop(str) {
+function expandTop(str, options) {
if (!str)
return [];
+
+ options = options || {};
+ var max = options.max == null ? Infinity : options.max;
// I don't know why Bash 4.3 does this, but it does.
// Anything starting with {} will have the first two bytes preserved
@@ -76,7 +79,7 @@
str = '\\{\\}' + str.substr(2);
}
- return expand(escapeBraces(str), true).map(unescapeBraces);
+ return expand(escapeBraces(str), max, true).map(unescapeBraces);
}
function identity(e) {
@@ -97,7 +100,7 @@
return i >= y;
}
-function expand(str, isTop) {
+function expand(str, max, isTop) {
var expansions = [];
var m = balanced('{', '}', str);
@@ -111,7 +114,7 @@
// {a},b}
if (m.post.match(/,(?!,).*\}/)) {
str = m.pre + '{' + m.body + escClose + m.post;
- return expand(str);
+ return expand(str, max, true);
}
return [str];
}
@@ -123,10 +126,10 @@
n = parseCommaParts(m.body);
if (n.length === 1) {
// x{{a,b}}y ==> x{a}y x{b}y
- n = expand(n[0], false).map(embrace);
+ n = expand(n[0], max, false).map(embrace);
if (n.length === 1) {
var post = m.post.length
- ? expand(m.post, false)
+ ? expand(m.post, max, false)
: [''];
return post.map(function(p) {
return m.pre + n[0] + p;
@@ -141,7 +144,7 @@
// no need to expand pre, since it is guaranteed to be free of brace-sets
var pre = m.pre;
var post = m.post.length
- ? expand(m.post, false)
+ ? expand(m.post, max, false)
: [''];
var N;
@@ -151,7 +154,7 @@
var y = numeric(n[1]);
var width = Math.max(n[0].length, n[1].length)
var incr = n.length == 3
- ? Math.abs(numeric(n[2]))
+ ? Math.max(Math.abs(numeric(n[2])), 1)
: 1;
var test = lte;
var reverse = y < x;
@@ -185,11 +188,11 @@
N.push(c);
}
} else {
- N = concatMap(n, function(el) { return expand(el, false) });
+ N = concatMap(n, function(el) { return expand(el, max, false) });
}
for (var j = 0; j < N.length; j++) {
- for (var k = 0; k < post.length; k++) {
+ for (var k = 0; k < post.length && expansions.length < max; k++) {
var expansion = pre + N[j] + post[k];
if (!isTop || isSequence || expansion)
expansions.push(expansion);
@@ -198,4 +201,3 @@
return expansions;
}
-
--
Gitblit v1.9.3