tinker-token-usage 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/preload/{index-Dot49rhx.mjs → index-WZEj_JlS.mjs} +592 -584
- package/dist/preload/index.mjs +14 -14
- package/dist/renderer/assets/app-B4oZLD9t.css +1 -0
- package/dist/renderer/assets/app-Bt2wBQGD.js +232 -0
- package/dist/renderer/index.html +2 -2
- package/package.json +3 -4
- package/dist/renderer/assets/app-BFoi1WPE.css +0 -1
- package/dist/renderer/assets/app-BSFWIK2p.js +0 -232
|
@@ -1,167 +1,167 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import * as
|
|
5
|
-
import { statSync as ye, stat as
|
|
6
|
-
import { sep as
|
|
7
|
-
import { fileURLToPath as
|
|
8
|
-
import { createRequire as
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
let s =
|
|
12
|
-
return s.length > 1 && s[s.length - 1] ===
|
|
1
|
+
var he = Object.defineProperty;
|
|
2
|
+
var ge = (t, s, e) => s in t ? he(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
3
|
+
var N = (t, s, e) => ge(t, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
+
import * as de from "fs";
|
|
5
|
+
import { statSync as ye, stat as Ae, realpathSync as Re, realpath as _e, readdirSync as Ee, readdir as Se } from "fs";
|
|
6
|
+
import { sep as Gt, basename as be, dirname as bt, resolve as Wt, normalize as me, relative as xe, posix as tt, isAbsolute as Ce } from "path";
|
|
7
|
+
import { fileURLToPath as $e } from "url";
|
|
8
|
+
import { createRequire as ve } from "module";
|
|
9
|
+
var Ht = /* @__PURE__ */ ve(import.meta.url);
|
|
10
|
+
function we(t) {
|
|
11
|
+
let s = me(t);
|
|
12
|
+
return s.length > 1 && s[s.length - 1] === Gt && (s = s.substring(0, s.length - 1)), s;
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
function
|
|
16
|
-
return t.replace(
|
|
14
|
+
const Oe = /[\\/]/g;
|
|
15
|
+
function Ut(t, s) {
|
|
16
|
+
return t.replace(Oe, s);
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
function
|
|
20
|
-
return t === "/" ||
|
|
18
|
+
const He = /^[a-z]:[\\/]$/i;
|
|
19
|
+
function Le(t) {
|
|
20
|
+
return t === "/" || He.test(t);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function yt(t, s) {
|
|
23
23
|
const { resolvePaths: e, normalizePath: r, pathSeparator: o } = s, n = process.platform === "win32" && t.includes("/") || t.startsWith(".");
|
|
24
|
-
if (e && (t =
|
|
24
|
+
if (e && (t = Wt(t)), (r || n) && (t = we(t)), t === ".") return "";
|
|
25
25
|
const i = t[t.length - 1] !== o;
|
|
26
|
-
return
|
|
26
|
+
return Ut(i ? t + o : t, o);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function qt(t, s) {
|
|
29
29
|
return s + t;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function Te(t, s) {
|
|
32
32
|
return function(e, r) {
|
|
33
|
-
return r.startsWith(t) ? r.slice(t.length) + e :
|
|
33
|
+
return r.startsWith(t) ? r.slice(t.length) + e : Ut(xe(t, r), s.pathSeparator) + s.pathSeparator + e;
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function ke(t) {
|
|
37
37
|
return t;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function Pe(t, s, e) {
|
|
40
40
|
return s + t + e;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function De(t, s) {
|
|
43
43
|
const { relativePaths: e, includeBasePath: r } = s;
|
|
44
|
-
return e && t ?
|
|
44
|
+
return e && t ? Te(t, s) : r ? qt : ke;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function Ie(t) {
|
|
47
47
|
return function(s, e) {
|
|
48
48
|
e.push(s.substring(t.length) || ".");
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function Ne(t) {
|
|
52
52
|
return function(s, e, r) {
|
|
53
53
|
const o = s.substring(t.length) || ".";
|
|
54
54
|
r.every((n) => n(o, !0)) && e.push(o);
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
const
|
|
57
|
+
const Be = (t, s) => {
|
|
58
58
|
s.push(t || ".");
|
|
59
|
-
},
|
|
59
|
+
}, Fe = (t, s, e) => {
|
|
60
60
|
const r = t || ".";
|
|
61
61
|
e.every((o) => o(r, !0)) && s.push(r);
|
|
62
|
-
},
|
|
62
|
+
}, Me = () => {
|
|
63
63
|
};
|
|
64
|
-
function
|
|
64
|
+
function Ge(t, s) {
|
|
65
65
|
const { includeDirs: e, filters: r, relativePaths: o } = s;
|
|
66
|
-
return e ? o ? r && r.length ?
|
|
66
|
+
return e ? o ? r && r.length ? Ne(t) : Ie(t) : r && r.length ? Fe : Be : Me;
|
|
67
67
|
}
|
|
68
|
-
const
|
|
68
|
+
const We = (t, s, e, r) => {
|
|
69
69
|
r.every((o) => o(t, !1)) && e.files++;
|
|
70
|
-
}, We = (t, s, e, r) => {
|
|
71
|
-
r.every((o) => o(t, !1)) && s.push(t);
|
|
72
70
|
}, Ue = (t, s, e, r) => {
|
|
71
|
+
r.every((o) => o(t, !1)) && s.push(t);
|
|
72
|
+
}, qe = (t, s, e, r) => {
|
|
73
73
|
e.files++;
|
|
74
|
-
},
|
|
74
|
+
}, Ke = (t, s) => {
|
|
75
75
|
s.push(t);
|
|
76
|
-
},
|
|
76
|
+
}, Xe = () => {
|
|
77
77
|
};
|
|
78
|
-
function
|
|
78
|
+
function je(t) {
|
|
79
79
|
const { excludeFiles: s, filters: e, onlyCounts: r } = t;
|
|
80
|
-
return s ?
|
|
80
|
+
return s ? Xe : e && e.length ? r ? We : Ue : r ? qe : Ke;
|
|
81
81
|
}
|
|
82
|
-
const
|
|
83
|
-
function
|
|
84
|
-
return t.group ?
|
|
82
|
+
const Qe = (t) => t, ze = () => [""].slice(0, 0);
|
|
83
|
+
function Ye(t) {
|
|
84
|
+
return t.group ? ze : Qe;
|
|
85
85
|
}
|
|
86
|
-
const
|
|
86
|
+
const Ze = (t, s, e) => {
|
|
87
87
|
t.push({
|
|
88
88
|
directory: s,
|
|
89
89
|
files: e,
|
|
90
90
|
dir: s
|
|
91
91
|
});
|
|
92
|
-
},
|
|
92
|
+
}, Ve = () => {
|
|
93
93
|
};
|
|
94
|
-
function
|
|
95
|
-
return t.group ?
|
|
94
|
+
function Je(t) {
|
|
95
|
+
return t.group ? Ze : Ve;
|
|
96
96
|
}
|
|
97
|
-
const
|
|
97
|
+
const ts = function(t, s, e) {
|
|
98
98
|
const { queue: r, fs: o, options: { suppressErrors: n } } = s;
|
|
99
99
|
r.enqueue(), o.realpath(t, (i, l) => {
|
|
100
100
|
if (i) return r.dequeue(n ? null : i, s);
|
|
101
101
|
o.stat(l, (h, g) => {
|
|
102
102
|
if (h) return r.dequeue(n ? null : h, s);
|
|
103
|
-
if (g.isDirectory() &&
|
|
103
|
+
if (g.isDirectory() && Kt(t, l, s)) return r.dequeue(null, s);
|
|
104
104
|
e(g, l), r.dequeue(null, s);
|
|
105
105
|
});
|
|
106
106
|
});
|
|
107
|
-
},
|
|
107
|
+
}, es = function(t, s, e) {
|
|
108
108
|
const { queue: r, fs: o, options: { suppressErrors: n } } = s;
|
|
109
109
|
r.enqueue();
|
|
110
110
|
try {
|
|
111
111
|
const i = o.realpathSync(t), l = o.statSync(i);
|
|
112
|
-
if (l.isDirectory() &&
|
|
112
|
+
if (l.isDirectory() && Kt(t, i, s)) return;
|
|
113
113
|
e(l, i);
|
|
114
114
|
} catch (i) {
|
|
115
115
|
if (!n) throw i;
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
|
-
function
|
|
119
|
-
return !t.resolveSymlinks || t.excludeSymlinks ? null : s ?
|
|
118
|
+
function ss(t, s) {
|
|
119
|
+
return !t.resolveSymlinks || t.excludeSymlinks ? null : s ? es : ts;
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
if (e.options.useRealPaths) return
|
|
123
|
-
let r =
|
|
121
|
+
function Kt(t, s, e) {
|
|
122
|
+
if (e.options.useRealPaths) return ns(s, e);
|
|
123
|
+
let r = bt(t), o = 1;
|
|
124
124
|
for (; r !== e.root && o < 2; ) {
|
|
125
125
|
const n = e.symlinks.get(r);
|
|
126
|
-
!!n && (n === s || n.startsWith(s) || s.startsWith(n)) ? o++ : r =
|
|
126
|
+
!!n && (n === s || n.startsWith(s) || s.startsWith(n)) ? o++ : r = bt(r);
|
|
127
127
|
}
|
|
128
128
|
return e.symlinks.set(t, s), o > 1;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function ns(t, s) {
|
|
131
131
|
return s.visited.includes(t + s.options.pathSeparator);
|
|
132
132
|
}
|
|
133
|
-
const
|
|
134
|
-
function
|
|
133
|
+
const rs = (t) => t.counts, os = (t) => t.groups, is = (t) => t.paths, us = (t) => t.paths.slice(0, t.options.maxFiles), as = (t, s, e) => (ht(s, e, t.counts, t.options.suppressErrors), null), cs = (t, s, e) => (ht(s, e, t.paths, t.options.suppressErrors), null), ls = (t, s, e) => (ht(s, e, t.paths.slice(0, t.options.maxFiles), t.options.suppressErrors), null), fs = (t, s, e) => (ht(s, e, t.groups, t.options.suppressErrors), null);
|
|
134
|
+
function ht(t, s, e, r) {
|
|
135
135
|
s(t && !r ? t : null, e);
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function ps(t, s) {
|
|
138
138
|
const { onlyCounts: e, group: r, maxFiles: o } = t;
|
|
139
|
-
return e ? s ?
|
|
139
|
+
return e ? s ? rs : as : r ? s ? os : fs : o ? s ? us : ls : s ? is : cs;
|
|
140
140
|
}
|
|
141
|
-
const
|
|
141
|
+
const Xt = { withFileTypes: !0 }, hs = (t, s, e, r, o) => {
|
|
142
142
|
if (t.queue.enqueue(), r < 0) return t.queue.dequeue(null, t);
|
|
143
143
|
const { fs: n } = t;
|
|
144
|
-
t.visited.push(s), t.counts.directories++, n.readdir(s || ".",
|
|
144
|
+
t.visited.push(s), t.counts.directories++, n.readdir(s || ".", Xt, (i, l = []) => {
|
|
145
145
|
o(l, e, r), t.queue.dequeue(t.options.suppressErrors ? null : i, t);
|
|
146
146
|
});
|
|
147
|
-
},
|
|
147
|
+
}, gs = (t, s, e, r, o) => {
|
|
148
148
|
const { fs: n } = t;
|
|
149
149
|
if (r < 0) return;
|
|
150
150
|
t.visited.push(s), t.counts.directories++;
|
|
151
151
|
let i = [];
|
|
152
152
|
try {
|
|
153
|
-
i = n.readdirSync(s || ".",
|
|
153
|
+
i = n.readdirSync(s || ".", Xt);
|
|
154
154
|
} catch (l) {
|
|
155
155
|
if (!t.options.suppressErrors) throw l;
|
|
156
156
|
}
|
|
157
157
|
o(i, e, r);
|
|
158
158
|
};
|
|
159
|
-
function
|
|
160
|
-
return t ?
|
|
159
|
+
function ds(t) {
|
|
160
|
+
return t ? gs : hs;
|
|
161
161
|
}
|
|
162
162
|
var ys = class {
|
|
163
163
|
constructor(t) {
|
|
164
|
-
|
|
164
|
+
N(this, "count", 0);
|
|
165
165
|
this.onQueueEmpty = t;
|
|
166
166
|
}
|
|
167
167
|
enqueue() {
|
|
@@ -170,10 +170,10 @@ var ys = class {
|
|
|
170
170
|
dequeue(t, s) {
|
|
171
171
|
this.onQueueEmpty && (--this.count <= 0 || t) && (this.onQueueEmpty(t, s), t && (s.controller.abort(), this.onQueueEmpty = void 0));
|
|
172
172
|
}
|
|
173
|
-
},
|
|
173
|
+
}, As = class {
|
|
174
174
|
constructor() {
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
N(this, "_files", 0);
|
|
176
|
+
N(this, "_directories", 0);
|
|
177
177
|
}
|
|
178
178
|
set files(t) {
|
|
179
179
|
this._files = t;
|
|
@@ -194,29 +194,29 @@ var ys = class {
|
|
|
194
194
|
get dirs() {
|
|
195
195
|
return this._directories;
|
|
196
196
|
}
|
|
197
|
-
},
|
|
197
|
+
}, Rs = class {
|
|
198
198
|
constructor() {
|
|
199
|
-
|
|
199
|
+
N(this, "aborted", !1);
|
|
200
200
|
}
|
|
201
201
|
abort() {
|
|
202
202
|
this.aborted = !0;
|
|
203
203
|
}
|
|
204
|
-
},
|
|
204
|
+
}, jt = class {
|
|
205
205
|
constructor(t, s, e) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
const { paths: r, options: { filters: o, resolveSymlinks: n, excludeSymlinks: i, exclude: l, maxFiles: h, signal: g, useRealPaths: d, pathSeparator: A }, controller:
|
|
219
|
-
if (
|
|
206
|
+
N(this, "root");
|
|
207
|
+
N(this, "isSynchronous");
|
|
208
|
+
N(this, "state");
|
|
209
|
+
N(this, "joinPath");
|
|
210
|
+
N(this, "pushDirectory");
|
|
211
|
+
N(this, "pushFile");
|
|
212
|
+
N(this, "getArray");
|
|
213
|
+
N(this, "groupFiles");
|
|
214
|
+
N(this, "resolveSymlink");
|
|
215
|
+
N(this, "walkDirectory");
|
|
216
|
+
N(this, "callbackInvoker");
|
|
217
|
+
N(this, "walk", (t, s, e) => {
|
|
218
|
+
const { paths: r, options: { filters: o, resolveSymlinks: n, excludeSymlinks: i, exclude: l, maxFiles: h, signal: g, useRealPaths: d, pathSeparator: A }, controller: E } = this.state;
|
|
219
|
+
if (E.aborted || g && g.aborted || h && r.length > h) return;
|
|
220
220
|
const x = this.getArray(this.state.paths);
|
|
221
221
|
for (let y = 0; y < t.length; ++y) {
|
|
222
222
|
const C = t[y];
|
|
@@ -224,85 +224,85 @@ var ys = class {
|
|
|
224
224
|
const T = this.joinPath(C.name, s);
|
|
225
225
|
this.pushFile(T, x, this.state.counts, o);
|
|
226
226
|
} else if (C.isDirectory()) {
|
|
227
|
-
let T =
|
|
227
|
+
let T = Pe(C.name, s, this.state.options.pathSeparator);
|
|
228
228
|
if (l && l(C.name, T)) continue;
|
|
229
229
|
this.pushDirectory(T, r, o), this.walkDirectory(this.state, T, T, e - 1, this.walk);
|
|
230
230
|
} else if (this.resolveSymlink && C.isSymbolicLink()) {
|
|
231
|
-
let T =
|
|
232
|
-
this.resolveSymlink(T, this.state, (
|
|
233
|
-
if (
|
|
234
|
-
if (_ =
|
|
231
|
+
let T = qt(C.name, s);
|
|
232
|
+
this.resolveSymlink(T, this.state, (W, _) => {
|
|
233
|
+
if (W.isDirectory()) {
|
|
234
|
+
if (_ = yt(_, this.state.options), l && l(C.name, d ? _ : T + A)) return;
|
|
235
235
|
this.walkDirectory(this.state, _, d ? _ : T + A, e - 1, this.walk);
|
|
236
236
|
} else {
|
|
237
237
|
_ = d ? _ : T;
|
|
238
|
-
const M =
|
|
239
|
-
_ = this.joinPath(M,
|
|
238
|
+
const M = be(_), j = yt(bt(_), this.state.options);
|
|
239
|
+
_ = this.joinPath(M, j), this.pushFile(_, x, this.state.counts, o);
|
|
240
240
|
}
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
this.groupFiles(this.state.groups, s, x);
|
|
245
245
|
});
|
|
246
|
-
this.isSynchronous = !e, this.callbackInvoker =
|
|
247
|
-
root:
|
|
246
|
+
this.isSynchronous = !e, this.callbackInvoker = ps(s, this.isSynchronous), this.root = yt(t, s), this.state = {
|
|
247
|
+
root: Le(this.root) ? this.root : this.root.slice(0, -1),
|
|
248
248
|
paths: [""].slice(0, 0),
|
|
249
249
|
groups: [],
|
|
250
|
-
counts: new
|
|
250
|
+
counts: new As(),
|
|
251
251
|
options: s,
|
|
252
252
|
queue: new ys((r, o) => this.callbackInvoker(o, r, e)),
|
|
253
253
|
symlinks: /* @__PURE__ */ new Map(),
|
|
254
254
|
visited: [""].slice(0, 0),
|
|
255
|
-
controller: new
|
|
256
|
-
fs: s.fs ||
|
|
257
|
-
}, this.joinPath =
|
|
255
|
+
controller: new Rs(),
|
|
256
|
+
fs: s.fs || de
|
|
257
|
+
}, this.joinPath = De(this.root, s), this.pushDirectory = Ge(this.root, s), this.pushFile = je(s), this.getArray = Ye(s), this.groupFiles = Je(s), this.resolveSymlink = ss(s, this.isSynchronous), this.walkDirectory = ds(this.isSynchronous);
|
|
258
258
|
}
|
|
259
259
|
start() {
|
|
260
260
|
return this.pushDirectory(this.root, this.state.paths, this.state.options.filters), this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk), this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
|
|
261
261
|
}
|
|
262
262
|
};
|
|
263
|
-
function
|
|
263
|
+
function _s(t, s) {
|
|
264
264
|
return new Promise((e, r) => {
|
|
265
|
-
|
|
265
|
+
Qt(t, s, (o, n) => {
|
|
266
266
|
if (o) return r(o);
|
|
267
267
|
e(n);
|
|
268
268
|
});
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
|
-
function
|
|
272
|
-
new
|
|
271
|
+
function Qt(t, s, e) {
|
|
272
|
+
new jt(t, s, e).start();
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
return new
|
|
274
|
+
function Es(t, s) {
|
|
275
|
+
return new jt(t, s).start();
|
|
276
276
|
}
|
|
277
|
-
var
|
|
277
|
+
var Lt = class {
|
|
278
278
|
constructor(t, s) {
|
|
279
279
|
this.root = t, this.options = s;
|
|
280
280
|
}
|
|
281
281
|
withPromise() {
|
|
282
|
-
return
|
|
282
|
+
return _s(this.root, this.options);
|
|
283
283
|
}
|
|
284
284
|
withCallback(t) {
|
|
285
|
-
|
|
285
|
+
Qt(this.root, this.options, t);
|
|
286
286
|
}
|
|
287
287
|
sync() {
|
|
288
|
-
return
|
|
288
|
+
return Es(this.root, this.options);
|
|
289
289
|
}
|
|
290
290
|
};
|
|
291
|
-
let
|
|
291
|
+
let zt = null;
|
|
292
292
|
try {
|
|
293
|
-
|
|
293
|
+
Ht.resolve("picomatch"), zt = Ht("picomatch");
|
|
294
294
|
} catch {
|
|
295
295
|
}
|
|
296
296
|
var Ss = class {
|
|
297
297
|
constructor(t) {
|
|
298
|
-
|
|
299
|
-
|
|
298
|
+
N(this, "globCache", {});
|
|
299
|
+
N(this, "options", {
|
|
300
300
|
maxDepth: 1 / 0,
|
|
301
301
|
suppressErrors: !0,
|
|
302
|
-
pathSeparator:
|
|
302
|
+
pathSeparator: Gt,
|
|
303
303
|
filters: []
|
|
304
304
|
});
|
|
305
|
-
|
|
305
|
+
N(this, "globFunction");
|
|
306
306
|
this.options = {
|
|
307
307
|
...this.options,
|
|
308
308
|
...t
|
|
@@ -357,7 +357,7 @@ var Ss = class {
|
|
|
357
357
|
return this.options.onlyCounts = !0, this;
|
|
358
358
|
}
|
|
359
359
|
crawl(t) {
|
|
360
|
-
return new
|
|
360
|
+
return new Lt(t || ".", this.options);
|
|
361
361
|
}
|
|
362
362
|
withGlobFunction(t) {
|
|
363
363
|
return this.globFunction = t, this;
|
|
@@ -374,54 +374,54 @@ var Ss = class {
|
|
|
374
374
|
return this.options = {
|
|
375
375
|
...this.options,
|
|
376
376
|
...s
|
|
377
|
-
}, new
|
|
377
|
+
}, new Lt(t || ".", this.options);
|
|
378
378
|
}
|
|
379
379
|
glob(...t) {
|
|
380
380
|
return this.globFunction ? this.globWithOptions(t) : this.globWithOptions(t, { dot: !0 });
|
|
381
381
|
}
|
|
382
382
|
globWithOptions(t, ...s) {
|
|
383
|
-
const e = this.globFunction ||
|
|
383
|
+
const e = this.globFunction || zt;
|
|
384
384
|
if (!e) throw new Error("Please specify a glob function to use glob matching.");
|
|
385
385
|
var r = this.globCache[t.join("\0")];
|
|
386
386
|
return r || (r = e(t, ...s), this.globCache[t.join("\0")] = r), this.options.filters.push((o) => r(o)), this;
|
|
387
387
|
}
|
|
388
388
|
};
|
|
389
|
-
function
|
|
389
|
+
function bs(t) {
|
|
390
390
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
391
391
|
}
|
|
392
|
-
var
|
|
393
|
-
const z = "\\\\/",
|
|
394
|
-
DOT_LITERAL:
|
|
395
|
-
PLUS_LITERAL:
|
|
396
|
-
QMARK_LITERAL:
|
|
397
|
-
SLASH_LITERAL:
|
|
398
|
-
ONE_CHAR:
|
|
399
|
-
QMARK:
|
|
400
|
-
END_ANCHOR:
|
|
401
|
-
DOTS_SLASH:
|
|
402
|
-
NO_DOT:
|
|
403
|
-
NO_DOTS:
|
|
404
|
-
NO_DOT_SLASH:
|
|
405
|
-
NO_DOTS_SLASH:
|
|
406
|
-
QMARK_NO_DOT:
|
|
407
|
-
STAR:
|
|
408
|
-
START_ANCHOR:
|
|
409
|
-
SEP:
|
|
410
|
-
},
|
|
411
|
-
...
|
|
392
|
+
var ct = {};
|
|
393
|
+
const z = "\\\\/", Tt = `[^${z}]`, ms = 0, Y = "\\.", xs = "\\+", Cs = "\\?", gt = "\\/", $s = "(?=.)", Yt = "[^/]", Ct = `(?:${gt}|$)`, Zt = `(?:^|${gt})`, $t = `${Y}{1,2}${Ct}`, vs = `(?!${Y})`, ws = `(?!${Zt}${$t})`, Os = `(?!${Y}{0,1}${Ct})`, Hs = `(?!${$t})`, Ls = `[^.${gt}]`, Ts = `${Yt}*?`, ks = "/", Vt = {
|
|
394
|
+
DOT_LITERAL: Y,
|
|
395
|
+
PLUS_LITERAL: xs,
|
|
396
|
+
QMARK_LITERAL: Cs,
|
|
397
|
+
SLASH_LITERAL: gt,
|
|
398
|
+
ONE_CHAR: $s,
|
|
399
|
+
QMARK: Yt,
|
|
400
|
+
END_ANCHOR: Ct,
|
|
401
|
+
DOTS_SLASH: $t,
|
|
402
|
+
NO_DOT: vs,
|
|
403
|
+
NO_DOTS: ws,
|
|
404
|
+
NO_DOT_SLASH: Os,
|
|
405
|
+
NO_DOTS_SLASH: Hs,
|
|
406
|
+
QMARK_NO_DOT: Ls,
|
|
407
|
+
STAR: Ts,
|
|
408
|
+
START_ANCHOR: Zt,
|
|
409
|
+
SEP: ks
|
|
410
|
+
}, Ps = {
|
|
411
|
+
...Vt,
|
|
412
412
|
SLASH_LITERAL: `[${z}]`,
|
|
413
|
-
QMARK:
|
|
414
|
-
STAR: `${
|
|
415
|
-
DOTS_SLASH: `${
|
|
416
|
-
NO_DOT: `(?!${
|
|
417
|
-
NO_DOTS: `(?!(?:^|[${z}])${
|
|
418
|
-
NO_DOT_SLASH: `(?!${
|
|
419
|
-
NO_DOTS_SLASH: `(?!${
|
|
413
|
+
QMARK: Tt,
|
|
414
|
+
STAR: `${Tt}*?`,
|
|
415
|
+
DOTS_SLASH: `${Y}{1,2}(?:[${z}]|$)`,
|
|
416
|
+
NO_DOT: `(?!${Y})`,
|
|
417
|
+
NO_DOTS: `(?!(?:^|[${z}])${Y}{1,2}(?:[${z}]|$))`,
|
|
418
|
+
NO_DOT_SLASH: `(?!${Y}{0,1}(?:[${z}]|$))`,
|
|
419
|
+
NO_DOTS_SLASH: `(?!${Y}{1,2}(?:[${z}]|$))`,
|
|
420
420
|
QMARK_NO_DOT: `[^.${z}]`,
|
|
421
421
|
START_ANCHOR: `(?:^|[${z}])`,
|
|
422
422
|
END_ANCHOR: `(?:[${z}]|$)`,
|
|
423
423
|
SEP: "\\"
|
|
424
|
-
},
|
|
424
|
+
}, Ds = {
|
|
425
425
|
__proto__: null,
|
|
426
426
|
alnum: "a-zA-Z0-9",
|
|
427
427
|
alpha: "a-zA-Z",
|
|
@@ -438,10 +438,10 @@ const z = "\\\\/", Ht = `[^${z}]`, bs = 0, Z = "\\.", ms = "\\+", xs = "\\?", ft
|
|
|
438
438
|
word: "A-Za-z0-9_",
|
|
439
439
|
xdigit: "A-Fa-f0-9"
|
|
440
440
|
};
|
|
441
|
-
var
|
|
442
|
-
DEFAULT_MAX_EXTGLOB_RECURSION:
|
|
441
|
+
var dt = {
|
|
442
|
+
DEFAULT_MAX_EXTGLOB_RECURSION: ms,
|
|
443
443
|
MAX_LENGTH: 1024 * 64,
|
|
444
|
-
POSIX_REGEX_SOURCE:
|
|
444
|
+
POSIX_REGEX_SOURCE: Ds,
|
|
445
445
|
// regular expressions
|
|
446
446
|
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
447
447
|
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
@@ -561,7 +561,7 @@ var pt = {
|
|
|
561
561
|
* Create GLOB_CHARS
|
|
562
562
|
*/
|
|
563
563
|
globChars(t) {
|
|
564
|
-
return t === !0 ?
|
|
564
|
+
return t === !0 ? Ps : Vt;
|
|
565
565
|
}
|
|
566
566
|
};
|
|
567
567
|
(function(t) {
|
|
@@ -570,7 +570,7 @@ var pt = {
|
|
|
570
570
|
REGEX_REMOVE_BACKSLASH: e,
|
|
571
571
|
REGEX_SPECIAL_CHARS: r,
|
|
572
572
|
REGEX_SPECIAL_CHARS_GLOBAL: o
|
|
573
|
-
} =
|
|
573
|
+
} = dt;
|
|
574
574
|
t.isObject = (n) => n !== null && typeof n == "object" && !Array.isArray(n), t.hasRegexChars = (n) => r.test(n), t.isRegexChar = (n) => n.length === 1 && t.hasRegexChars(n), t.escapeRegex = (n) => n.replace(o, "\\$1"), t.toPosixSlashes = (n) => n.replace(s, "/"), t.isWindows = () => {
|
|
575
575
|
if (typeof navigator < "u" && navigator.platform) {
|
|
576
576
|
const n = navigator.platform.toLowerCase();
|
|
@@ -591,73 +591,73 @@ var pt = {
|
|
|
591
591
|
const l = n.split(i ? /[\\/]/ : "/"), h = l[l.length - 1];
|
|
592
592
|
return h === "" ? l[l.length - 2] : h;
|
|
593
593
|
};
|
|
594
|
-
})(
|
|
595
|
-
const
|
|
596
|
-
CHAR_ASTERISK:
|
|
594
|
+
})(ct);
|
|
595
|
+
const kt = ct, {
|
|
596
|
+
CHAR_ASTERISK: At,
|
|
597
597
|
/* * */
|
|
598
|
-
CHAR_AT:
|
|
598
|
+
CHAR_AT: Is,
|
|
599
599
|
/* @ */
|
|
600
|
-
CHAR_BACKWARD_SLASH:
|
|
600
|
+
CHAR_BACKWARD_SLASH: rt,
|
|
601
601
|
/* \ */
|
|
602
|
-
CHAR_COMMA:
|
|
602
|
+
CHAR_COMMA: Ns,
|
|
603
603
|
/* , */
|
|
604
|
-
CHAR_DOT:
|
|
604
|
+
CHAR_DOT: Rt,
|
|
605
605
|
/* . */
|
|
606
|
-
CHAR_EXCLAMATION_MARK:
|
|
606
|
+
CHAR_EXCLAMATION_MARK: _t,
|
|
607
607
|
/* ! */
|
|
608
|
-
CHAR_FORWARD_SLASH:
|
|
608
|
+
CHAR_FORWARD_SLASH: Jt,
|
|
609
609
|
/* / */
|
|
610
|
-
CHAR_LEFT_CURLY_BRACE:
|
|
610
|
+
CHAR_LEFT_CURLY_BRACE: Et,
|
|
611
611
|
/* { */
|
|
612
|
-
CHAR_LEFT_PARENTHESES:
|
|
612
|
+
CHAR_LEFT_PARENTHESES: ft,
|
|
613
613
|
/* ( */
|
|
614
|
-
CHAR_LEFT_SQUARE_BRACKET:
|
|
614
|
+
CHAR_LEFT_SQUARE_BRACKET: Bs,
|
|
615
615
|
/* [ */
|
|
616
|
-
CHAR_PLUS:
|
|
616
|
+
CHAR_PLUS: Fs,
|
|
617
617
|
/* + */
|
|
618
|
-
CHAR_QUESTION_MARK:
|
|
618
|
+
CHAR_QUESTION_MARK: Pt,
|
|
619
619
|
/* ? */
|
|
620
|
-
CHAR_RIGHT_CURLY_BRACE:
|
|
620
|
+
CHAR_RIGHT_CURLY_BRACE: Ms,
|
|
621
621
|
/* } */
|
|
622
|
-
CHAR_RIGHT_PARENTHESES:
|
|
622
|
+
CHAR_RIGHT_PARENTHESES: Dt,
|
|
623
623
|
/* ) */
|
|
624
|
-
CHAR_RIGHT_SQUARE_BRACKET:
|
|
624
|
+
CHAR_RIGHT_SQUARE_BRACKET: Gs
|
|
625
625
|
/* ] */
|
|
626
|
-
} =
|
|
626
|
+
} = dt, It = (t) => t === Jt || t === rt, Nt = (t) => {
|
|
627
627
|
t.isPrefix !== !0 && (t.depth = t.isGlobstar ? 1 / 0 : 1);
|
|
628
|
-
},
|
|
629
|
-
const e = s || {}, r = t.length - 1, o = e.parts === !0 || e.scanToEnd === !0, n = [], i = [], l = [];
|
|
630
|
-
let h = t, g = -1, d = 0, A = 0,
|
|
631
|
-
const
|
|
628
|
+
}, Ws = (t, s) => {
|
|
629
|
+
const e = s || {}, r = t.length - 1, o = e.parts === !0 || e.tokens === !0 || e.scanToEnd === !0, n = [], i = [], l = [];
|
|
630
|
+
let h = t, g = -1, d = 0, A = 0, E = !1, x = !1, y = !1, C = !1, T = !1, W = !1, _ = !1, M = !1, j = !1, k = !1, O = 0, v, R, m = { value: "", depth: 0, isGlob: !1 };
|
|
631
|
+
const u = () => g >= r, G = () => h.charCodeAt(g + 1), I = () => (v = R, h.charCodeAt(++g));
|
|
632
632
|
for (; g < r; ) {
|
|
633
|
-
R =
|
|
633
|
+
R = I();
|
|
634
634
|
let $;
|
|
635
|
-
if (R ===
|
|
636
|
-
_ = m.backslashes = !0, R =
|
|
635
|
+
if (R === rt) {
|
|
636
|
+
_ = m.backslashes = !0, R = I(), R === Et && (W = !0);
|
|
637
637
|
continue;
|
|
638
638
|
}
|
|
639
|
-
if (
|
|
640
|
-
for (O++;
|
|
641
|
-
if (R ===
|
|
642
|
-
_ = m.backslashes = !0,
|
|
639
|
+
if (W === !0 || R === Et) {
|
|
640
|
+
for (O++; u() !== !0 && (R = I()); ) {
|
|
641
|
+
if (R === rt) {
|
|
642
|
+
_ = m.backslashes = !0, I();
|
|
643
643
|
continue;
|
|
644
644
|
}
|
|
645
|
-
if (R ===
|
|
645
|
+
if (R === Et) {
|
|
646
646
|
O++;
|
|
647
647
|
continue;
|
|
648
648
|
}
|
|
649
|
-
if (
|
|
650
|
-
if (
|
|
649
|
+
if (W !== !0 && R === Rt && (R = I()) === Rt) {
|
|
650
|
+
if (E = m.isBrace = !0, y = m.isGlob = !0, k = !0, o === !0)
|
|
651
651
|
continue;
|
|
652
652
|
break;
|
|
653
653
|
}
|
|
654
|
-
if (
|
|
655
|
-
if (
|
|
654
|
+
if (W !== !0 && R === Ns) {
|
|
655
|
+
if (E = m.isBrace = !0, y = m.isGlob = !0, k = !0, o === !0)
|
|
656
656
|
continue;
|
|
657
657
|
break;
|
|
658
658
|
}
|
|
659
|
-
if (R ===
|
|
660
|
-
|
|
659
|
+
if (R === Ms && (O--, O === 0)) {
|
|
660
|
+
W = !1, E = m.isBrace = !0, k = !0;
|
|
661
661
|
break;
|
|
662
662
|
}
|
|
663
663
|
}
|
|
@@ -665,24 +665,29 @@ const Lt = it, {
|
|
|
665
665
|
continue;
|
|
666
666
|
break;
|
|
667
667
|
}
|
|
668
|
-
if (R ===
|
|
669
|
-
if (n.push(g), i.push(m), m = { value: "", depth: 0, isGlob: !1 },
|
|
670
|
-
if (v ===
|
|
668
|
+
if (R === Jt) {
|
|
669
|
+
if (n.push(g), i.push(m), m = { value: "", depth: 0, isGlob: !1 }, k === !0) continue;
|
|
670
|
+
if (v === Rt && g === d + 1) {
|
|
671
671
|
d += 2;
|
|
672
672
|
continue;
|
|
673
673
|
}
|
|
674
674
|
A = g + 1;
|
|
675
675
|
continue;
|
|
676
676
|
}
|
|
677
|
-
if (e.noext !== !0 && (R ===
|
|
678
|
-
if (y = m.isGlob = !0, C = m.isExtglob = !0,
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
677
|
+
if (e.noext !== !0 && (R === Fs || R === Is || R === At || R === Pt || R === _t) === !0 && G() === ft) {
|
|
678
|
+
if (y = m.isGlob = !0, C = m.isExtglob = !0, k = !0, R === _t && g === d && (j = !0), o === !0) {
|
|
679
|
+
let q = 0;
|
|
680
|
+
for (; u() !== !0 && (R = I()); ) {
|
|
681
|
+
if (R === rt) {
|
|
682
|
+
_ = m.backslashes = !0, I();
|
|
683
|
+
continue;
|
|
684
|
+
}
|
|
685
|
+
if (R === ft) {
|
|
686
|
+
q++;
|
|
682
687
|
continue;
|
|
683
688
|
}
|
|
684
|
-
if (R ===
|
|
685
|
-
|
|
689
|
+
if (R === Dt && --q === 0) {
|
|
690
|
+
k = !0;
|
|
686
691
|
break;
|
|
687
692
|
}
|
|
688
693
|
}
|
|
@@ -690,24 +695,24 @@ const Lt = it, {
|
|
|
690
695
|
}
|
|
691
696
|
break;
|
|
692
697
|
}
|
|
693
|
-
if (R ===
|
|
694
|
-
if (v ===
|
|
698
|
+
if (R === At) {
|
|
699
|
+
if (v === At && (T = m.isGlobstar = !0), y = m.isGlob = !0, k = !0, o === !0)
|
|
695
700
|
continue;
|
|
696
701
|
break;
|
|
697
702
|
}
|
|
698
|
-
if (R ===
|
|
699
|
-
if (y = m.isGlob = !0,
|
|
703
|
+
if (R === Pt) {
|
|
704
|
+
if (y = m.isGlob = !0, k = !0, o === !0)
|
|
700
705
|
continue;
|
|
701
706
|
break;
|
|
702
707
|
}
|
|
703
|
-
if (R ===
|
|
704
|
-
for (;
|
|
705
|
-
if ($ ===
|
|
706
|
-
_ = m.backslashes = !0,
|
|
708
|
+
if (R === Bs) {
|
|
709
|
+
for (; u() !== !0 && ($ = I()); ) {
|
|
710
|
+
if ($ === rt) {
|
|
711
|
+
_ = m.backslashes = !0, I();
|
|
707
712
|
continue;
|
|
708
713
|
}
|
|
709
|
-
if ($ ===
|
|
710
|
-
x = m.isBracket = !0, y = m.isGlob = !0,
|
|
714
|
+
if ($ === Gs) {
|
|
715
|
+
x = m.isBracket = !0, y = m.isGlob = !0, k = !0;
|
|
711
716
|
break;
|
|
712
717
|
}
|
|
713
718
|
}
|
|
@@ -715,19 +720,24 @@ const Lt = it, {
|
|
|
715
720
|
continue;
|
|
716
721
|
break;
|
|
717
722
|
}
|
|
718
|
-
if (e.nonegate !== !0 && R ===
|
|
723
|
+
if (e.nonegate !== !0 && R === _t && g === d) {
|
|
719
724
|
M = m.negated = !0, d++;
|
|
720
725
|
continue;
|
|
721
726
|
}
|
|
722
|
-
if (e.noparen !== !0 && R ===
|
|
727
|
+
if (e.noparen !== !0 && R === ft) {
|
|
723
728
|
if (y = m.isGlob = !0, o === !0) {
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
729
|
+
let U = 1;
|
|
730
|
+
for (; u() !== !0 && (R = I()); ) {
|
|
731
|
+
if (R === rt) {
|
|
732
|
+
_ = m.backslashes = !0, I();
|
|
727
733
|
continue;
|
|
728
734
|
}
|
|
729
|
-
if (R ===
|
|
730
|
-
|
|
735
|
+
if (R === ft) {
|
|
736
|
+
U++;
|
|
737
|
+
continue;
|
|
738
|
+
}
|
|
739
|
+
if (R === Dt && --U === 0) {
|
|
740
|
+
k = !0;
|
|
731
741
|
break;
|
|
732
742
|
}
|
|
733
743
|
}
|
|
@@ -736,50 +746,47 @@ const Lt = it, {
|
|
|
736
746
|
break;
|
|
737
747
|
}
|
|
738
748
|
if (y === !0) {
|
|
739
|
-
if (
|
|
749
|
+
if (k = !0, o === !0)
|
|
740
750
|
continue;
|
|
741
751
|
break;
|
|
742
752
|
}
|
|
743
753
|
}
|
|
744
754
|
e.noext === !0 && (C = !1, y = !1);
|
|
745
|
-
let
|
|
746
|
-
d > 0 && (
|
|
747
|
-
const
|
|
748
|
-
prefix:
|
|
755
|
+
let P = h, c = "", a = "";
|
|
756
|
+
d > 0 && (c = h.slice(0, d), h = h.slice(d), A -= d), P && y === !0 && A > 0 ? (P = h.slice(0, A), a = h.slice(A)) : y === !0 ? (P = "", a = h) : P = h, P && P !== "" && P !== "/" && P !== h && It(P.charCodeAt(P.length - 1)) && (P = P.slice(0, -1)), e.unescape === !0 && (a && (a = kt.removeBackslashes(a)), P && _ === !0 && (P = kt.removeBackslashes(P)));
|
|
757
|
+
const X = {
|
|
758
|
+
prefix: c,
|
|
749
759
|
input: t,
|
|
750
760
|
start: d,
|
|
751
|
-
base:
|
|
752
|
-
glob:
|
|
753
|
-
isBrace:
|
|
761
|
+
base: P,
|
|
762
|
+
glob: a,
|
|
763
|
+
isBrace: E,
|
|
754
764
|
isBracket: x,
|
|
755
765
|
isGlob: y,
|
|
756
766
|
isExtglob: C,
|
|
757
767
|
isGlobstar: T,
|
|
758
768
|
negated: M,
|
|
759
|
-
negatedExtglob:
|
|
769
|
+
negatedExtglob: j
|
|
760
770
|
};
|
|
761
|
-
if (e.tokens === !0 && (
|
|
771
|
+
if (e.tokens === !0 && (X.maxDepth = 0, It(R) || i.push(m), X.tokens = i), e.parts === !0 || e.tokens === !0) {
|
|
762
772
|
let $;
|
|
763
|
-
for (let
|
|
764
|
-
const
|
|
765
|
-
e.tokens && (
|
|
766
|
-
}
|
|
767
|
-
if ($ && $ + 1 < t.length) {
|
|
768
|
-
const k = t.slice($ + 1);
|
|
769
|
-
l.push(k), e.tokens && (i[i.length - 1].value = k, Dt(i[i.length - 1]), q.maxDepth += i[i.length - 1].depth);
|
|
773
|
+
for (let B = 0; B < n.length; B++) {
|
|
774
|
+
const et = $ !== void 0 ? $ + 1 : d, ot = n[B], V = t.slice(et, ot);
|
|
775
|
+
e.tokens && (B === 0 && d !== 0 ? (i[B].isPrefix = !0, i[B].value = c) : i[B].value = V, Nt(i[B]), X.maxDepth += i[B].depth), ot >= d && (l.push(V), $ = ot);
|
|
770
776
|
}
|
|
771
|
-
|
|
777
|
+
const U = $ !== void 0 ? $ + 1 : d, q = t.slice(U);
|
|
778
|
+
l.push(q), e.tokens && $ && $ + 1 < t.length && (i[i.length - 1].value = q, Nt(i[i.length - 1]), X.maxDepth += i[i.length - 1].depth), X.slashes = n, X.parts = l;
|
|
772
779
|
}
|
|
773
|
-
return
|
|
780
|
+
return X;
|
|
774
781
|
};
|
|
775
|
-
var
|
|
776
|
-
const
|
|
777
|
-
MAX_LENGTH:
|
|
778
|
-
POSIX_REGEX_SOURCE:
|
|
779
|
-
REGEX_NON_SPECIAL_CHARS:
|
|
780
|
-
REGEX_SPECIAL_CHARS_BACKREF:
|
|
781
|
-
REPLACEMENTS:
|
|
782
|
-
} =
|
|
782
|
+
var Us = Ws;
|
|
783
|
+
const ut = dt, K = ct, {
|
|
784
|
+
MAX_LENGTH: pt,
|
|
785
|
+
POSIX_REGEX_SOURCE: qs,
|
|
786
|
+
REGEX_NON_SPECIAL_CHARS: Ks,
|
|
787
|
+
REGEX_SPECIAL_CHARS_BACKREF: Xs,
|
|
788
|
+
REPLACEMENTS: te
|
|
789
|
+
} = ut, js = (t, s) => {
|
|
783
790
|
if (typeof s.expandRange == "function")
|
|
784
791
|
return s.expandRange(...t, s);
|
|
785
792
|
t.sort();
|
|
@@ -787,10 +794,10 @@ const rt = pt, U = it, {
|
|
|
787
794
|
try {
|
|
788
795
|
new RegExp(e);
|
|
789
796
|
} catch {
|
|
790
|
-
return t.map((o) =>
|
|
797
|
+
return t.map((o) => K.escapeRegex(o)).join("..");
|
|
791
798
|
}
|
|
792
799
|
return e;
|
|
793
|
-
},
|
|
800
|
+
}, nt = (t, s) => `Missing ${t}: "${s}" - use "\\\\${s}" to match literal characters`, ee = (t) => {
|
|
794
801
|
const s = [];
|
|
795
802
|
let e = 0, r = 0, o = 0, n = "", i = !1;
|
|
796
803
|
for (const l of t) {
|
|
@@ -825,7 +832,7 @@ const rt = pt, U = it, {
|
|
|
825
832
|
n += l;
|
|
826
833
|
}
|
|
827
834
|
return s.push(n), s;
|
|
828
|
-
},
|
|
835
|
+
}, Qs = (t) => {
|
|
829
836
|
let s = !1;
|
|
830
837
|
for (const e of t) {
|
|
831
838
|
if (s === !0) {
|
|
@@ -840,14 +847,14 @@ const rt = pt, U = it, {
|
|
|
840
847
|
return !1;
|
|
841
848
|
}
|
|
842
849
|
return !0;
|
|
843
|
-
},
|
|
850
|
+
}, vt = (t) => {
|
|
844
851
|
let s = t.trim(), e = !0;
|
|
845
852
|
for (; e === !0; )
|
|
846
853
|
e = !1, /^@\([^\\()[\]{}|]+\)$/.test(s) && (s = s.slice(2, -1), e = !0);
|
|
847
|
-
if (
|
|
854
|
+
if (Qs(s))
|
|
848
855
|
return s.replace(/\\(.)/g, "$1");
|
|
849
|
-
},
|
|
850
|
-
const s = t.map(
|
|
856
|
+
}, zs = (t) => {
|
|
857
|
+
const s = t.map(vt).filter(Boolean);
|
|
851
858
|
for (let e = 0; e < s.length; e++)
|
|
852
859
|
for (let r = e + 1; r < s.length; r++) {
|
|
853
860
|
const o = s[e], n = s[r], i = o[0];
|
|
@@ -855,7 +862,7 @@ const rt = pt, U = it, {
|
|
|
855
862
|
return !0;
|
|
856
863
|
}
|
|
857
864
|
return !1;
|
|
858
|
-
},
|
|
865
|
+
}, mt = (t, s = !0) => {
|
|
859
866
|
if (t[0] !== "+" && t[0] !== "*" || t[1] !== "(")
|
|
860
867
|
return;
|
|
861
868
|
let e = 0, r = 0, o = 0, n = !1;
|
|
@@ -896,76 +903,76 @@ const rt = pt, U = it, {
|
|
|
896
903
|
}
|
|
897
904
|
}
|
|
898
905
|
}
|
|
899
|
-
},
|
|
906
|
+
}, Ys = (t) => `${t.length === 1 ? K.escapeRegex(t[0]) : `[${t.map((e) => K.escapeRegex(e)).join("")}]`}*`, Zs = (t) => {
|
|
900
907
|
let s = 0;
|
|
901
908
|
const e = [];
|
|
902
909
|
for (; s < t.length; ) {
|
|
903
|
-
const r =
|
|
910
|
+
const r = mt(t.slice(s), !1);
|
|
904
911
|
if (!r || r.type !== "*")
|
|
905
912
|
return;
|
|
906
|
-
const o =
|
|
913
|
+
const o = ee(r.body).map((i) => i.trim());
|
|
907
914
|
if (o.length !== 1)
|
|
908
915
|
return;
|
|
909
|
-
const n =
|
|
916
|
+
const n = vt(o[0]);
|
|
910
917
|
if (!n || n.length !== 1)
|
|
911
918
|
return;
|
|
912
919
|
e.push(n), s += r.end + 1;
|
|
913
920
|
}
|
|
914
921
|
if (!(e.length < 1))
|
|
915
922
|
return e;
|
|
916
|
-
},
|
|
917
|
-
let s = 0, e = t.trim(), r =
|
|
923
|
+
}, Vs = (t) => {
|
|
924
|
+
let s = 0, e = t.trim(), r = mt(e);
|
|
918
925
|
for (; r; )
|
|
919
|
-
s++, e = r.body.trim(), r =
|
|
926
|
+
s++, e = r.body.trim(), r = mt(e);
|
|
920
927
|
return s;
|
|
921
|
-
},
|
|
928
|
+
}, Js = (t, s) => {
|
|
922
929
|
if (s.maxExtglobRecursion === !1)
|
|
923
930
|
return { risky: !1 };
|
|
924
|
-
const e = typeof s.maxExtglobRecursion == "number" ? s.maxExtglobRecursion :
|
|
925
|
-
if (r.length > 1 && (r.some((l) => l === "") || r.some((l) => /^[*?]+$/.test(l)) ||
|
|
931
|
+
const e = typeof s.maxExtglobRecursion == "number" ? s.maxExtglobRecursion : ut.DEFAULT_MAX_EXTGLOB_RECURSION, r = ee(t).map((l) => l.trim());
|
|
932
|
+
if (r.length > 1 && (r.some((l) => l === "") || r.some((l) => /^[*?]+$/.test(l)) || zs(r)))
|
|
926
933
|
return { risky: !0 };
|
|
927
934
|
const o = [];
|
|
928
935
|
let n = !1, i = !0;
|
|
929
936
|
for (const l of r) {
|
|
930
|
-
const h =
|
|
937
|
+
const h = Zs(l);
|
|
931
938
|
if (h) {
|
|
932
939
|
n = !0, o.push(...h);
|
|
933
940
|
continue;
|
|
934
941
|
}
|
|
935
|
-
const g =
|
|
942
|
+
const g = vt(l);
|
|
936
943
|
if (g && g.length === 1) {
|
|
937
944
|
o.push(g);
|
|
938
945
|
continue;
|
|
939
946
|
}
|
|
940
|
-
if (i = !1,
|
|
947
|
+
if (i = !1, Vs(l) > e)
|
|
941
948
|
return { risky: !0 };
|
|
942
949
|
}
|
|
943
|
-
return n ? i ? { risky: !0, safeOutput:
|
|
944
|
-
},
|
|
950
|
+
return n ? i ? { risky: !0, safeOutput: Ys([...new Set(o)]) } : { risky: !0 } : { risky: !1 };
|
|
951
|
+
}, wt = (t, s) => {
|
|
945
952
|
if (typeof t != "string")
|
|
946
953
|
throw new TypeError("Expected a string");
|
|
947
|
-
t =
|
|
948
|
-
const e = { ...s }, r = typeof e.maxLength == "number" ? Math.min(
|
|
954
|
+
t = te[t] || t;
|
|
955
|
+
const e = { ...s }, r = typeof e.maxLength == "number" ? Math.min(pt, e.maxLength) : pt;
|
|
949
956
|
let o = t.length;
|
|
950
957
|
if (o > r)
|
|
951
958
|
throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);
|
|
952
|
-
const n = { type: "bos", value: "", output: e.prepend || "" }, i = [n], l = e.capture ? "" : "?:", h =
|
|
959
|
+
const n = { type: "bos", value: "", output: e.prepend || "" }, i = [n], l = e.capture ? "" : "?:", h = ut.globChars(e.windows), g = ut.extglobChars(h), {
|
|
953
960
|
DOT_LITERAL: d,
|
|
954
961
|
PLUS_LITERAL: A,
|
|
955
|
-
SLASH_LITERAL:
|
|
962
|
+
SLASH_LITERAL: E,
|
|
956
963
|
ONE_CHAR: x,
|
|
957
964
|
DOTS_SLASH: y,
|
|
958
965
|
NO_DOT: C,
|
|
959
966
|
NO_DOT_SLASH: T,
|
|
960
|
-
NO_DOTS_SLASH:
|
|
967
|
+
NO_DOTS_SLASH: W,
|
|
961
968
|
QMARK: _,
|
|
962
969
|
QMARK_NO_DOT: M,
|
|
963
|
-
STAR:
|
|
964
|
-
START_ANCHOR:
|
|
965
|
-
} = h, O = (p) => `(${l}(?:(?!${
|
|
966
|
-
let m = e.bash === !0 ? O(e) :
|
|
970
|
+
STAR: j,
|
|
971
|
+
START_ANCHOR: k
|
|
972
|
+
} = h, O = (p) => `(${l}(?:(?!${k}${p.dot ? y : d}).)*?)`, v = e.dot ? "" : C, R = e.dot ? _ : M;
|
|
973
|
+
let m = e.bash === !0 ? O(e) : j;
|
|
967
974
|
e.capture && (m = `(${m})`), typeof e.noext == "boolean" && (e.noextglob = e.noext);
|
|
968
|
-
const
|
|
975
|
+
const u = {
|
|
969
976
|
input: t,
|
|
970
977
|
index: -1,
|
|
971
978
|
start: 0,
|
|
@@ -982,166 +989,166 @@ const rt = pt, U = it, {
|
|
|
982
989
|
globstar: !1,
|
|
983
990
|
tokens: i
|
|
984
991
|
};
|
|
985
|
-
t =
|
|
986
|
-
const
|
|
987
|
-
let
|
|
988
|
-
const
|
|
989
|
-
|
|
990
|
-
},
|
|
991
|
-
|
|
992
|
-
},
|
|
992
|
+
t = K.removePrefix(t, u), o = t.length;
|
|
993
|
+
const G = [], I = [], P = [];
|
|
994
|
+
let c = n, a;
|
|
995
|
+
const X = () => u.index === o - 1, $ = u.peek = (p = 1) => t[u.index + p], U = u.advance = () => t[++u.index] || "", q = () => t.slice(u.index + 1), B = (p = "", L = 0) => {
|
|
996
|
+
u.consumed += p, u.index += L;
|
|
997
|
+
}, et = (p) => {
|
|
998
|
+
u.output += p.output != null ? p.output : p.value, B(p.value);
|
|
999
|
+
}, ot = () => {
|
|
993
1000
|
let p = 1;
|
|
994
1001
|
for (; $() === "!" && ($(2) !== "(" || $(3) === "?"); )
|
|
995
|
-
|
|
996
|
-
return p % 2 === 0 ? !1 : (
|
|
997
|
-
},
|
|
998
|
-
|
|
999
|
-
},
|
|
1000
|
-
|
|
1001
|
-
},
|
|
1002
|
-
if (
|
|
1003
|
-
const L =
|
|
1004
|
-
p.type !== "slash" && p.type !== "paren" && !L && !f && (
|
|
1002
|
+
U(), u.start++, p++;
|
|
1003
|
+
return p % 2 === 0 ? !1 : (u.negated = !0, u.start++, !0);
|
|
1004
|
+
}, V = (p) => {
|
|
1005
|
+
u[p]++, P.push(p);
|
|
1006
|
+
}, Z = (p) => {
|
|
1007
|
+
u[p]--, P.pop();
|
|
1008
|
+
}, S = (p) => {
|
|
1009
|
+
if (c.type === "globstar") {
|
|
1010
|
+
const L = u.braces > 0 && (p.type === "comma" || p.type === "brace"), f = p.extglob === !0 || G.length && (p.type === "pipe" || p.type === "paren");
|
|
1011
|
+
p.type !== "slash" && p.type !== "paren" && !L && !f && (u.output = u.output.slice(0, -c.output.length), c.type = "star", c.value = "*", c.output = m, u.output += c.output);
|
|
1005
1012
|
}
|
|
1006
|
-
if (
|
|
1007
|
-
|
|
1013
|
+
if (G.length && p.type !== "paren" && (G[G.length - 1].inner += p.value), (p.value || p.output) && et(p), c && c.type === "text" && p.type === "text") {
|
|
1014
|
+
c.output = (c.output || c.value) + p.value, c.value += p.value;
|
|
1008
1015
|
return;
|
|
1009
1016
|
}
|
|
1010
|
-
p.prev =
|
|
1011
|
-
},
|
|
1017
|
+
p.prev = c, i.push(p), c = p;
|
|
1018
|
+
}, lt = (p, L) => {
|
|
1012
1019
|
const f = { ...g[L], conditions: 1, inner: "" };
|
|
1013
|
-
f.prev =
|
|
1020
|
+
f.prev = c, f.parens = u.parens, f.output = u.output, f.startIndex = u.index, f.tokensIndex = i.length;
|
|
1014
1021
|
const b = (e.capture ? "(" : "") + f.open;
|
|
1015
|
-
|
|
1016
|
-
},
|
|
1017
|
-
const L = t.slice(p.startIndex,
|
|
1022
|
+
V("parens"), S({ type: p, value: L, output: u.output ? "" : x }), S({ type: "paren", extglob: !0, value: U(), output: b }), G.push(f);
|
|
1023
|
+
}, pe = (p) => {
|
|
1024
|
+
const L = t.slice(p.startIndex, u.index + 1), f = t.slice(p.startIndex + 2, u.index), b = Js(f, e);
|
|
1018
1025
|
if ((p.type === "plus" || p.type === "star") && b.risky) {
|
|
1019
|
-
const w = b.safeOutput ? (p.output ? "" : x) + (e.capture ? `(${b.safeOutput})` : b.safeOutput) : void 0,
|
|
1020
|
-
|
|
1021
|
-
for (let
|
|
1022
|
-
i[
|
|
1023
|
-
|
|
1026
|
+
const w = b.safeOutput ? (p.output ? "" : x) + (e.capture ? `(${b.safeOutput})` : b.safeOutput) : void 0, Q = i[p.tokensIndex];
|
|
1027
|
+
Q.type = "text", Q.value = L, Q.output = w || K.escapeRegex(L);
|
|
1028
|
+
for (let J = p.tokensIndex + 1; J < i.length; J++)
|
|
1029
|
+
i[J].value = "", i[J].output = "", delete i[J].suffix;
|
|
1030
|
+
u.output = p.output + Q.output, u.backtrack = !0, S({ type: "paren", extglob: !0, value: a, output: "" }), Z("parens");
|
|
1024
1031
|
return;
|
|
1025
1032
|
}
|
|
1026
1033
|
let H = p.close + (e.capture ? ")" : ""), F;
|
|
1027
1034
|
if (p.type === "negate") {
|
|
1028
1035
|
let w = m;
|
|
1029
|
-
if (p.inner && p.inner.length > 1 && p.inner.includes("/") && (w = O(e)), (w !== m ||
|
|
1030
|
-
const
|
|
1031
|
-
H = p.close = `)${
|
|
1036
|
+
if (p.inner && p.inner.length > 1 && p.inner.includes("/") && (w = O(e)), (w !== m || X() || /^\)+$/.test(q())) && (H = p.close = `)$))${w}`), p.inner.includes("*") && (F = q()) && /^\.[^\\/.]+$/.test(F)) {
|
|
1037
|
+
const Q = wt(F, { ...s, fastpaths: !1 }).output;
|
|
1038
|
+
H = p.close = `)${Q})${w})`;
|
|
1032
1039
|
}
|
|
1033
|
-
p.prev.type === "bos" && (
|
|
1040
|
+
p.prev.type === "bos" && (u.negatedExtglob = !0);
|
|
1034
1041
|
}
|
|
1035
|
-
|
|
1042
|
+
S({ type: "paren", extglob: !0, value: a, output: H }), Z("parens");
|
|
1036
1043
|
};
|
|
1037
1044
|
if (e.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(t)) {
|
|
1038
|
-
let p = !1, L = t.replace(
|
|
1039
|
-
return p === !0 && (e.unescape === !0 ? L = L.replace(/\\/g, "") : L = L.replace(/\\+/g, (f) => f.length % 2 === 0 ? "\\\\" : f ? "\\" : "")), L === t && e.contains === !0 ? (
|
|
1045
|
+
let p = !1, L = t.replace(Xs, (f, b, H, F, w, Q) => F === "\\" ? (p = !0, f) : F === "?" ? b ? b + F + (w ? _.repeat(w.length) : "") : Q === 0 ? R + (w ? _.repeat(w.length) : "") : _.repeat(H.length) : F === "." ? d.repeat(H.length) : F === "*" ? b ? b + F + (w ? m : "") : m : b ? f : `\\${f}`);
|
|
1046
|
+
return p === !0 && (e.unescape === !0 ? L = L.replace(/\\/g, "") : L = L.replace(/\\+/g, (f) => f.length % 2 === 0 ? "\\\\" : f ? "\\" : "")), L === t && e.contains === !0 ? (u.output = t, u) : (u.output = K.wrapOutput(L, u, s), u);
|
|
1040
1047
|
}
|
|
1041
|
-
for (; !
|
|
1042
|
-
if (
|
|
1048
|
+
for (; !X(); ) {
|
|
1049
|
+
if (a = U(), a === "\0")
|
|
1043
1050
|
continue;
|
|
1044
|
-
if (
|
|
1051
|
+
if (a === "\\") {
|
|
1045
1052
|
const f = $();
|
|
1046
1053
|
if (f === "/" && e.bash !== !0 || f === "." || f === ";")
|
|
1047
1054
|
continue;
|
|
1048
1055
|
if (!f) {
|
|
1049
|
-
|
|
1056
|
+
a += "\\", S({ type: "text", value: a });
|
|
1050
1057
|
continue;
|
|
1051
1058
|
}
|
|
1052
|
-
const b = /^\\+/.exec(
|
|
1059
|
+
const b = /^\\+/.exec(q());
|
|
1053
1060
|
let H = 0;
|
|
1054
|
-
if (b && b[0].length > 2 && (H = b[0].length,
|
|
1055
|
-
|
|
1061
|
+
if (b && b[0].length > 2 && (H = b[0].length, u.index += H, H % 2 !== 0 && (a += "\\")), e.unescape === !0 ? a = U() : a += U(), u.brackets === 0) {
|
|
1062
|
+
S({ type: "text", value: a });
|
|
1056
1063
|
continue;
|
|
1057
1064
|
}
|
|
1058
1065
|
}
|
|
1059
|
-
if (
|
|
1060
|
-
if (e.posix !== !1 &&
|
|
1061
|
-
const f =
|
|
1062
|
-
if (f.includes("[") && (
|
|
1063
|
-
const b =
|
|
1066
|
+
if (u.brackets > 0 && (a !== "]" || c.value === "[" || c.value === "[^")) {
|
|
1067
|
+
if (e.posix !== !1 && a === ":") {
|
|
1068
|
+
const f = c.value.slice(1);
|
|
1069
|
+
if (f.includes("[") && (c.posix = !0, f.includes(":"))) {
|
|
1070
|
+
const b = c.value.lastIndexOf("["), H = c.value.slice(0, b), F = c.value.slice(b + 2), w = qs[F];
|
|
1064
1071
|
if (w) {
|
|
1065
|
-
|
|
1072
|
+
c.value = H + w, u.backtrack = !0, U(), !n.output && i.indexOf(c) === 1 && (n.output = x);
|
|
1066
1073
|
continue;
|
|
1067
1074
|
}
|
|
1068
1075
|
}
|
|
1069
1076
|
}
|
|
1070
|
-
(
|
|
1077
|
+
(a === "[" && $() !== ":" || a === "-" && $() === "]") && (a = `\\${a}`), a === "]" && (c.value === "[" || c.value === "[^") && (a = `\\${a}`), e.posix === !0 && a === "!" && c.value === "[" && (a = "^"), c.value += a, et({ value: a });
|
|
1071
1078
|
continue;
|
|
1072
1079
|
}
|
|
1073
|
-
if (
|
|
1074
|
-
|
|
1080
|
+
if (u.quotes === 1 && a !== '"') {
|
|
1081
|
+
a = K.escapeRegex(a), c.value += a, et({ value: a });
|
|
1075
1082
|
continue;
|
|
1076
1083
|
}
|
|
1077
|
-
if (
|
|
1078
|
-
|
|
1084
|
+
if (a === '"') {
|
|
1085
|
+
u.quotes = u.quotes === 1 ? 0 : 1, e.keepQuotes === !0 && S({ type: "text", value: a });
|
|
1079
1086
|
continue;
|
|
1080
1087
|
}
|
|
1081
|
-
if (
|
|
1082
|
-
|
|
1088
|
+
if (a === "(") {
|
|
1089
|
+
V("parens"), S({ type: "paren", value: a });
|
|
1083
1090
|
continue;
|
|
1084
1091
|
}
|
|
1085
|
-
if (
|
|
1086
|
-
if (
|
|
1087
|
-
throw new SyntaxError(
|
|
1088
|
-
const f =
|
|
1089
|
-
if (f &&
|
|
1090
|
-
|
|
1092
|
+
if (a === ")") {
|
|
1093
|
+
if (u.parens === 0 && e.strictBrackets === !0)
|
|
1094
|
+
throw new SyntaxError(nt("opening", "("));
|
|
1095
|
+
const f = G[G.length - 1];
|
|
1096
|
+
if (f && u.parens === f.parens + 1) {
|
|
1097
|
+
pe(G.pop());
|
|
1091
1098
|
continue;
|
|
1092
1099
|
}
|
|
1093
|
-
|
|
1100
|
+
S({ type: "paren", value: a, output: u.parens ? ")" : "\\)" }), Z("parens");
|
|
1094
1101
|
continue;
|
|
1095
1102
|
}
|
|
1096
|
-
if (
|
|
1097
|
-
if (e.nobracket === !0 || !
|
|
1103
|
+
if (a === "[") {
|
|
1104
|
+
if (e.nobracket === !0 || !q().includes("]")) {
|
|
1098
1105
|
if (e.nobracket !== !0 && e.strictBrackets === !0)
|
|
1099
|
-
throw new SyntaxError(
|
|
1100
|
-
|
|
1106
|
+
throw new SyntaxError(nt("closing", "]"));
|
|
1107
|
+
a = `\\${a}`;
|
|
1101
1108
|
} else
|
|
1102
|
-
|
|
1103
|
-
|
|
1109
|
+
V("brackets");
|
|
1110
|
+
S({ type: "bracket", value: a });
|
|
1104
1111
|
continue;
|
|
1105
1112
|
}
|
|
1106
|
-
if (
|
|
1107
|
-
if (e.nobracket === !0 ||
|
|
1108
|
-
|
|
1113
|
+
if (a === "]") {
|
|
1114
|
+
if (e.nobracket === !0 || c && c.type === "bracket" && c.value.length === 1) {
|
|
1115
|
+
S({ type: "text", value: a, output: `\\${a}` });
|
|
1109
1116
|
continue;
|
|
1110
1117
|
}
|
|
1111
|
-
if (
|
|
1118
|
+
if (u.brackets === 0) {
|
|
1112
1119
|
if (e.strictBrackets === !0)
|
|
1113
|
-
throw new SyntaxError(
|
|
1114
|
-
|
|
1120
|
+
throw new SyntaxError(nt("opening", "["));
|
|
1121
|
+
S({ type: "text", value: a, output: `\\${a}` });
|
|
1115
1122
|
continue;
|
|
1116
1123
|
}
|
|
1117
|
-
|
|
1118
|
-
const f =
|
|
1119
|
-
if (
|
|
1124
|
+
Z("brackets");
|
|
1125
|
+
const f = c.value.slice(1);
|
|
1126
|
+
if (c.posix !== !0 && f[0] === "^" && !f.includes("/") && (a = `/${a}`), c.value += a, et({ value: a }), e.literalBrackets === !1 || K.hasRegexChars(f))
|
|
1120
1127
|
continue;
|
|
1121
|
-
const b =
|
|
1122
|
-
if (
|
|
1123
|
-
|
|
1128
|
+
const b = K.escapeRegex(c.value);
|
|
1129
|
+
if (u.output = u.output.slice(0, -c.value.length), e.literalBrackets === !0) {
|
|
1130
|
+
u.output += b, c.value = b;
|
|
1124
1131
|
continue;
|
|
1125
1132
|
}
|
|
1126
|
-
|
|
1133
|
+
c.value = `(${l}${b}|${c.value})`, u.output += c.value;
|
|
1127
1134
|
continue;
|
|
1128
1135
|
}
|
|
1129
|
-
if (
|
|
1130
|
-
|
|
1136
|
+
if (a === "{" && e.nobrace !== !0) {
|
|
1137
|
+
V("braces");
|
|
1131
1138
|
const f = {
|
|
1132
1139
|
type: "brace",
|
|
1133
|
-
value:
|
|
1140
|
+
value: a,
|
|
1134
1141
|
output: "(",
|
|
1135
|
-
outputIndex:
|
|
1136
|
-
tokensIndex:
|
|
1142
|
+
outputIndex: u.output.length,
|
|
1143
|
+
tokensIndex: u.tokens.length
|
|
1137
1144
|
};
|
|
1138
|
-
|
|
1145
|
+
I.push(f), S(f);
|
|
1139
1146
|
continue;
|
|
1140
1147
|
}
|
|
1141
|
-
if (
|
|
1142
|
-
const f =
|
|
1148
|
+
if (a === "}") {
|
|
1149
|
+
const f = I[I.length - 1];
|
|
1143
1150
|
if (e.nobrace === !0 || !f) {
|
|
1144
|
-
|
|
1151
|
+
S({ type: "text", value: a, output: a });
|
|
1145
1152
|
continue;
|
|
1146
1153
|
}
|
|
1147
1154
|
let b = ")";
|
|
@@ -1149,192 +1156,193 @@ const rt = pt, U = it, {
|
|
|
1149
1156
|
const H = i.slice(), F = [];
|
|
1150
1157
|
for (let w = H.length - 1; w >= 0 && (i.pop(), H[w].type !== "brace"); w--)
|
|
1151
1158
|
H[w].type !== "dots" && F.unshift(H[w].value);
|
|
1152
|
-
b =
|
|
1159
|
+
b = js(F, e), u.backtrack = !0;
|
|
1153
1160
|
}
|
|
1154
1161
|
if (f.comma !== !0 && f.dots !== !0) {
|
|
1155
|
-
const H =
|
|
1156
|
-
f.value = f.output = "\\{",
|
|
1162
|
+
const H = u.output.slice(0, f.outputIndex), F = u.tokens.slice(f.tokensIndex);
|
|
1163
|
+
f.value = f.output = "\\{", a = b = "\\}", u.output = H;
|
|
1157
1164
|
for (const w of F)
|
|
1158
|
-
|
|
1165
|
+
u.output += w.output || w.value;
|
|
1159
1166
|
}
|
|
1160
|
-
|
|
1167
|
+
S({ type: "brace", value: a, output: b }), Z("braces"), I.pop();
|
|
1161
1168
|
continue;
|
|
1162
1169
|
}
|
|
1163
|
-
if (
|
|
1164
|
-
|
|
1170
|
+
if (a === "|") {
|
|
1171
|
+
G.length > 0 && G[G.length - 1].conditions++, S({ type: "text", value: a });
|
|
1165
1172
|
continue;
|
|
1166
1173
|
}
|
|
1167
|
-
if (
|
|
1168
|
-
let f =
|
|
1169
|
-
const b =
|
|
1170
|
-
b &&
|
|
1174
|
+
if (a === ",") {
|
|
1175
|
+
let f = a;
|
|
1176
|
+
const b = I[I.length - 1];
|
|
1177
|
+
b && P[P.length - 1] === "braces" && (b.comma = !0, f = "|"), S({ type: "comma", value: a, output: f });
|
|
1171
1178
|
continue;
|
|
1172
1179
|
}
|
|
1173
|
-
if (
|
|
1174
|
-
if (
|
|
1175
|
-
|
|
1180
|
+
if (a === "/") {
|
|
1181
|
+
if (c.type === "dot" && u.index === u.start + 1) {
|
|
1182
|
+
u.start = u.index + 1, u.consumed = "", u.output = "", i.pop(), c = n;
|
|
1176
1183
|
continue;
|
|
1177
1184
|
}
|
|
1178
|
-
|
|
1185
|
+
S({ type: "slash", value: a, output: E });
|
|
1179
1186
|
continue;
|
|
1180
1187
|
}
|
|
1181
|
-
if (
|
|
1182
|
-
if (
|
|
1183
|
-
|
|
1184
|
-
const f =
|
|
1185
|
-
|
|
1188
|
+
if (a === ".") {
|
|
1189
|
+
if (u.braces > 0 && c.type === "dot") {
|
|
1190
|
+
c.value === "." && (c.output = d);
|
|
1191
|
+
const f = I[I.length - 1];
|
|
1192
|
+
c.type = "dots", c.output += a, c.value += a, f.dots = !0;
|
|
1186
1193
|
continue;
|
|
1187
1194
|
}
|
|
1188
|
-
if (
|
|
1189
|
-
|
|
1195
|
+
if (u.braces + u.parens === 0 && c.type !== "bos" && c.type !== "slash") {
|
|
1196
|
+
S({ type: "text", value: a, output: d });
|
|
1190
1197
|
continue;
|
|
1191
1198
|
}
|
|
1192
|
-
|
|
1199
|
+
S({ type: "dot", value: a, output: d });
|
|
1193
1200
|
continue;
|
|
1194
1201
|
}
|
|
1195
|
-
if (
|
|
1196
|
-
if (!(
|
|
1197
|
-
|
|
1202
|
+
if (a === "?") {
|
|
1203
|
+
if (!(c && c.value === "(") && e.noextglob !== !0 && $() === "(" && $(2) !== "?") {
|
|
1204
|
+
lt("qmark", a);
|
|
1198
1205
|
continue;
|
|
1199
1206
|
}
|
|
1200
|
-
if (
|
|
1207
|
+
if (c && c.type === "paren") {
|
|
1201
1208
|
const b = $();
|
|
1202
|
-
let H =
|
|
1203
|
-
(
|
|
1209
|
+
let H = a;
|
|
1210
|
+
(c.value === "(" && !/[!=<:]/.test(b) || b === "<" && !/<([!=]|\w+>)/.test(q())) && (H = `\\${a}`), S({ type: "text", value: a, output: H });
|
|
1204
1211
|
continue;
|
|
1205
1212
|
}
|
|
1206
|
-
if (e.dot !== !0 && (
|
|
1207
|
-
|
|
1213
|
+
if (e.dot !== !0 && (c.type === "slash" || c.type === "bos")) {
|
|
1214
|
+
S({ type: "qmark", value: a, output: M });
|
|
1208
1215
|
continue;
|
|
1209
1216
|
}
|
|
1210
|
-
|
|
1217
|
+
S({ type: "qmark", value: a, output: _ });
|
|
1211
1218
|
continue;
|
|
1212
1219
|
}
|
|
1213
|
-
if (
|
|
1220
|
+
if (a === "!") {
|
|
1214
1221
|
if (e.noextglob !== !0 && $() === "(" && ($(2) !== "?" || !/[!=<:]/.test($(3)))) {
|
|
1215
|
-
|
|
1222
|
+
lt("negate", a);
|
|
1216
1223
|
continue;
|
|
1217
1224
|
}
|
|
1218
|
-
if (e.nonegate !== !0 &&
|
|
1219
|
-
|
|
1225
|
+
if (e.nonegate !== !0 && u.index === 0) {
|
|
1226
|
+
ot();
|
|
1220
1227
|
continue;
|
|
1221
1228
|
}
|
|
1222
1229
|
}
|
|
1223
|
-
if (
|
|
1230
|
+
if (a === "+") {
|
|
1224
1231
|
if (e.noextglob !== !0 && $() === "(" && $(2) !== "?") {
|
|
1225
|
-
|
|
1232
|
+
lt("plus", a);
|
|
1226
1233
|
continue;
|
|
1227
1234
|
}
|
|
1228
|
-
if (
|
|
1229
|
-
|
|
1235
|
+
if (c && c.value === "(" || e.regex === !1) {
|
|
1236
|
+
S({ type: "plus", value: a, output: A });
|
|
1230
1237
|
continue;
|
|
1231
1238
|
}
|
|
1232
|
-
if (
|
|
1233
|
-
|
|
1239
|
+
if (c && (c.type === "bracket" || c.type === "paren" || c.type === "brace") || u.parens > 0) {
|
|
1240
|
+
S({ type: "plus", value: a });
|
|
1234
1241
|
continue;
|
|
1235
1242
|
}
|
|
1236
|
-
|
|
1243
|
+
S({ type: "plus", value: A });
|
|
1237
1244
|
continue;
|
|
1238
1245
|
}
|
|
1239
|
-
if (
|
|
1246
|
+
if (a === "@") {
|
|
1240
1247
|
if (e.noextglob !== !0 && $() === "(" && $(2) !== "?") {
|
|
1241
|
-
|
|
1248
|
+
S({ type: "at", extglob: !0, value: a, output: "" });
|
|
1242
1249
|
continue;
|
|
1243
1250
|
}
|
|
1244
|
-
|
|
1251
|
+
S({ type: "text", value: a });
|
|
1245
1252
|
continue;
|
|
1246
1253
|
}
|
|
1247
|
-
if (
|
|
1248
|
-
(
|
|
1249
|
-
const f =
|
|
1250
|
-
f && (
|
|
1254
|
+
if (a !== "*") {
|
|
1255
|
+
(a === "$" || a === "^") && (a = `\\${a}`);
|
|
1256
|
+
const f = Ks.exec(q());
|
|
1257
|
+
f && (a += f[0], u.index += f[0].length), S({ type: "text", value: a });
|
|
1251
1258
|
continue;
|
|
1252
1259
|
}
|
|
1253
|
-
if (
|
|
1254
|
-
|
|
1260
|
+
if (c && (c.type === "globstar" || c.star === !0)) {
|
|
1261
|
+
c.type = "star", c.star = !0, c.value += a, c.output = m, u.backtrack = !0, u.globstar = !0, B(a);
|
|
1255
1262
|
continue;
|
|
1256
1263
|
}
|
|
1257
|
-
let p =
|
|
1264
|
+
let p = q();
|
|
1258
1265
|
if (e.noextglob !== !0 && /^\([^?]/.test(p)) {
|
|
1259
|
-
|
|
1266
|
+
lt("star", a);
|
|
1260
1267
|
continue;
|
|
1261
1268
|
}
|
|
1262
|
-
if (
|
|
1269
|
+
if (c.type === "star") {
|
|
1263
1270
|
if (e.noglobstar === !0) {
|
|
1264
|
-
|
|
1271
|
+
B(a);
|
|
1265
1272
|
continue;
|
|
1266
1273
|
}
|
|
1267
|
-
const f =
|
|
1274
|
+
const f = c.prev, b = f.prev, H = f.type === "slash" || f.type === "bos", F = b && (b.type === "star" || b.type === "globstar");
|
|
1268
1275
|
if (e.bash === !0 && (!H || p[0] && p[0] !== "/")) {
|
|
1269
|
-
|
|
1276
|
+
S({ type: "star", value: a, output: "" });
|
|
1270
1277
|
continue;
|
|
1271
1278
|
}
|
|
1272
|
-
const w =
|
|
1273
|
-
if (!H && f.type !== "paren" && !w && !
|
|
1274
|
-
|
|
1279
|
+
const w = u.braces > 0 && (f.type === "comma" || f.type === "brace"), Q = G.length && (f.type === "pipe" || f.type === "paren");
|
|
1280
|
+
if (!H && f.type !== "paren" && !w && !Q) {
|
|
1281
|
+
S({ type: "star", value: a, output: "" });
|
|
1275
1282
|
continue;
|
|
1276
1283
|
}
|
|
1277
1284
|
for (; p.slice(0, 3) === "/**"; ) {
|
|
1278
|
-
const
|
|
1279
|
-
if (
|
|
1285
|
+
const st = t[u.index + 4];
|
|
1286
|
+
if (st && st !== "/")
|
|
1280
1287
|
break;
|
|
1281
|
-
p = p.slice(3),
|
|
1288
|
+
p = p.slice(3), B("/**", 3);
|
|
1282
1289
|
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1290
|
+
const J = X() || u.parens > 0 && p === ")".repeat(u.parens) && !G.some((st) => st.type === "negate");
|
|
1291
|
+
if (f.type === "bos" && X()) {
|
|
1292
|
+
c.type = "globstar", c.value += a, c.output = O(e), u.output = c.output, u.globstar = !0, B(a);
|
|
1285
1293
|
continue;
|
|
1286
1294
|
}
|
|
1287
|
-
if (f.type === "slash" && f.prev.type !== "bos" && !F &&
|
|
1288
|
-
|
|
1295
|
+
if (f.type === "slash" && f.prev.type !== "bos" && !F && J) {
|
|
1296
|
+
u.output = u.output.slice(0, -(f.output + c.output).length), f.output = `(?:${f.output}`, c.type = "globstar", c.output = O(e) + (e.strictSlashes ? ")" : "|$)"), c.value += a, u.globstar = !0, u.output += f.output + c.output, B(a);
|
|
1289
1297
|
continue;
|
|
1290
1298
|
}
|
|
1291
1299
|
if (f.type === "slash" && f.prev.type !== "bos" && p[0] === "/") {
|
|
1292
|
-
const
|
|
1293
|
-
|
|
1300
|
+
const st = p[1] !== void 0 ? "|$" : "";
|
|
1301
|
+
u.output = u.output.slice(0, -(f.output + c.output).length), f.output = `(?:${f.output}`, c.type = "globstar", c.output = `${O(e)}${E}|${E}${st})`, c.value += a, u.output += f.output + c.output, u.globstar = !0, B(a + U()), S({ type: "slash", value: "/", output: "" });
|
|
1294
1302
|
continue;
|
|
1295
1303
|
}
|
|
1296
1304
|
if (f.type === "bos" && p[0] === "/") {
|
|
1297
|
-
|
|
1305
|
+
c.type = "globstar", c.value += a, c.output = `(?:^|${E}|${O(e)}${E})`, u.output = c.output, u.globstar = !0, B(a + U()), S({ type: "slash", value: "/", output: "" });
|
|
1298
1306
|
continue;
|
|
1299
1307
|
}
|
|
1300
|
-
|
|
1308
|
+
u.output = u.output.slice(0, -c.output.length), c.type = "globstar", c.output = O(e), c.value += a, u.output += c.output, u.globstar = !0, B(a);
|
|
1301
1309
|
continue;
|
|
1302
1310
|
}
|
|
1303
|
-
const L = { type: "star", value:
|
|
1311
|
+
const L = { type: "star", value: a, output: m };
|
|
1304
1312
|
if (e.bash === !0) {
|
|
1305
|
-
L.output = ".*?", (
|
|
1313
|
+
L.output = ".*?", (c.type === "bos" || c.type === "slash") && (L.output = v + L.output), S(L);
|
|
1306
1314
|
continue;
|
|
1307
1315
|
}
|
|
1308
|
-
if (
|
|
1309
|
-
L.output =
|
|
1316
|
+
if (c && (c.type === "bracket" || c.type === "paren") && e.regex === !0) {
|
|
1317
|
+
L.output = a, S(L);
|
|
1310
1318
|
continue;
|
|
1311
1319
|
}
|
|
1312
|
-
(
|
|
1320
|
+
(u.index === u.start || c.type === "slash" || c.type === "dot") && (c.type === "dot" ? (u.output += T, c.output += T) : e.dot === !0 ? (u.output += W, c.output += W) : (u.output += v, c.output += v), $() !== "*" && (u.output += x, c.output += x)), S(L);
|
|
1313
1321
|
}
|
|
1314
|
-
for (;
|
|
1315
|
-
if (e.strictBrackets === !0) throw new SyntaxError(
|
|
1316
|
-
|
|
1322
|
+
for (; u.brackets > 0; ) {
|
|
1323
|
+
if (e.strictBrackets === !0) throw new SyntaxError(nt("closing", "]"));
|
|
1324
|
+
u.output = K.escapeLast(u.output, "["), Z("brackets");
|
|
1317
1325
|
}
|
|
1318
|
-
for (;
|
|
1319
|
-
if (e.strictBrackets === !0) throw new SyntaxError(
|
|
1320
|
-
|
|
1326
|
+
for (; u.parens > 0; ) {
|
|
1327
|
+
if (e.strictBrackets === !0) throw new SyntaxError(nt("closing", ")"));
|
|
1328
|
+
u.output = K.escapeLast(u.output, "("), Z("parens");
|
|
1321
1329
|
}
|
|
1322
|
-
for (;
|
|
1323
|
-
if (e.strictBrackets === !0) throw new SyntaxError(
|
|
1324
|
-
|
|
1330
|
+
for (; u.braces > 0; ) {
|
|
1331
|
+
if (e.strictBrackets === !0) throw new SyntaxError(nt("closing", "}"));
|
|
1332
|
+
u.output = K.escapeLast(u.output, "{"), Z("braces");
|
|
1325
1333
|
}
|
|
1326
|
-
if (e.strictSlashes !== !0 && (
|
|
1327
|
-
|
|
1328
|
-
for (const p of
|
|
1329
|
-
|
|
1334
|
+
if (e.strictSlashes !== !0 && (c.type === "star" || c.type === "bracket") && S({ type: "maybe_slash", value: "", output: `${E}?` }), u.backtrack === !0) {
|
|
1335
|
+
u.output = "";
|
|
1336
|
+
for (const p of u.tokens)
|
|
1337
|
+
u.output += p.output != null ? p.output : p.value, p.suffix && (u.output += p.suffix);
|
|
1330
1338
|
}
|
|
1331
|
-
return
|
|
1339
|
+
return u;
|
|
1332
1340
|
};
|
|
1333
|
-
|
|
1334
|
-
const e = { ...s }, r = typeof e.maxLength == "number" ? Math.min(
|
|
1341
|
+
wt.fastpaths = (t, s) => {
|
|
1342
|
+
const e = { ...s }, r = typeof e.maxLength == "number" ? Math.min(pt, e.maxLength) : pt, o = t.length;
|
|
1335
1343
|
if (o > r)
|
|
1336
1344
|
throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${r}`);
|
|
1337
|
-
t =
|
|
1345
|
+
t = te[t] || t;
|
|
1338
1346
|
const {
|
|
1339
1347
|
DOT_LITERAL: n,
|
|
1340
1348
|
SLASH_LITERAL: i,
|
|
@@ -1343,12 +1351,12 @@ $t.fastpaths = (t, s) => {
|
|
|
1343
1351
|
NO_DOT: g,
|
|
1344
1352
|
NO_DOTS: d,
|
|
1345
1353
|
NO_DOTS_SLASH: A,
|
|
1346
|
-
STAR:
|
|
1354
|
+
STAR: E,
|
|
1347
1355
|
START_ANCHOR: x
|
|
1348
|
-
} =
|
|
1349
|
-
let _ = e.bash === !0 ? ".*?" :
|
|
1356
|
+
} = ut.globChars(e.windows), y = e.dot ? d : g, C = e.dot ? A : g, T = e.capture ? "" : "?:", W = { negated: !1, prefix: "" };
|
|
1357
|
+
let _ = e.bash === !0 ? ".*?" : E;
|
|
1350
1358
|
e.capture && (_ = `(${_})`);
|
|
1351
|
-
const M = (v) => v.noglobstar === !0 ? _ : `(${T}(?:(?!${x}${v.dot ? h : n}).)*?)`,
|
|
1359
|
+
const M = (v) => v.noglobstar === !0 ? _ : `(${T}(?:(?!${x}${v.dot ? h : n}).)*?)`, j = (v) => {
|
|
1352
1360
|
switch (v) {
|
|
1353
1361
|
case "*":
|
|
1354
1362
|
return `${y}${l}${_}`;
|
|
@@ -1369,71 +1377,71 @@ $t.fastpaths = (t, s) => {
|
|
|
1369
1377
|
default: {
|
|
1370
1378
|
const R = /^(.*?)\.(\w+)$/.exec(v);
|
|
1371
1379
|
if (!R) return;
|
|
1372
|
-
const m =
|
|
1380
|
+
const m = j(R[1]);
|
|
1373
1381
|
return m ? m + n + R[2] : void 0;
|
|
1374
1382
|
}
|
|
1375
1383
|
}
|
|
1376
|
-
},
|
|
1377
|
-
let O =
|
|
1384
|
+
}, k = K.removePrefix(t, W);
|
|
1385
|
+
let O = j(k);
|
|
1378
1386
|
return O && e.strictSlashes !== !0 && (O += `${i}?`), O;
|
|
1379
1387
|
};
|
|
1380
|
-
var
|
|
1381
|
-
const
|
|
1388
|
+
var tn = wt;
|
|
1389
|
+
const en = Us, xt = tn, se = ct, sn = dt, nn = (t) => t && typeof t == "object" && !Array.isArray(t), D = (t, s, e = !1) => {
|
|
1382
1390
|
if (Array.isArray(t)) {
|
|
1383
|
-
const d = t.map((
|
|
1384
|
-
return (
|
|
1391
|
+
const d = t.map((E) => D(E, s, e));
|
|
1392
|
+
return (E) => {
|
|
1385
1393
|
for (const x of d) {
|
|
1386
|
-
const y = x(
|
|
1394
|
+
const y = x(E);
|
|
1387
1395
|
if (y) return y;
|
|
1388
1396
|
}
|
|
1389
1397
|
return !1;
|
|
1390
1398
|
};
|
|
1391
1399
|
}
|
|
1392
|
-
const r =
|
|
1400
|
+
const r = nn(t) && t.tokens && t.input;
|
|
1393
1401
|
if (t === "" || typeof t != "string" && !r)
|
|
1394
1402
|
throw new TypeError("Expected pattern to be a non-empty string");
|
|
1395
|
-
const o = s || {}, n = o.windows, i = r ?
|
|
1403
|
+
const o = s || {}, n = o.windows, i = r ? D.compileRe(t, s) : D.makeRe(t, s, !1, !0), l = i.state;
|
|
1396
1404
|
delete i.state;
|
|
1397
1405
|
let h = () => !1;
|
|
1398
1406
|
if (o.ignore) {
|
|
1399
1407
|
const d = { ...s, ignore: null, onMatch: null, onResult: null };
|
|
1400
|
-
h =
|
|
1408
|
+
h = D(o.ignore, d, e);
|
|
1401
1409
|
}
|
|
1402
1410
|
const g = (d, A = !1) => {
|
|
1403
|
-
const { isMatch:
|
|
1404
|
-
return typeof o.onResult == "function" && o.onResult(C),
|
|
1411
|
+
const { isMatch: E, match: x, output: y } = D.test(d, i, s, { glob: t, posix: n }), C = { glob: t, state: l, regex: i, posix: n, input: d, output: y, match: x, isMatch: E };
|
|
1412
|
+
return typeof o.onResult == "function" && o.onResult(C), E === !1 ? (C.isMatch = !1, A ? C : !1) : h(d) ? (typeof o.onIgnore == "function" && o.onIgnore(C), C.isMatch = !1, A ? C : !1) : (typeof o.onMatch == "function" && o.onMatch(C), A ? C : !0);
|
|
1405
1413
|
};
|
|
1406
1414
|
return e && (g.state = l), g;
|
|
1407
1415
|
};
|
|
1408
|
-
|
|
1416
|
+
D.test = (t, s, e, { glob: r, posix: o } = {}) => {
|
|
1409
1417
|
if (typeof t != "string")
|
|
1410
1418
|
throw new TypeError("Expected input to be a string");
|
|
1411
1419
|
if (t === "")
|
|
1412
1420
|
return { isMatch: !1, output: "" };
|
|
1413
|
-
const n = e || {}, i = n.format || (o ?
|
|
1421
|
+
const n = e || {}, i = n.format || (o ? se.toPosixSlashes : null);
|
|
1414
1422
|
let l = t === r, h = l && i ? i(t) : t;
|
|
1415
|
-
return l === !1 && (h = i ? i(t) : t, l = h === r), (l === !1 || n.capture === !0) && (n.matchBase === !0 || n.basename === !0 ? l =
|
|
1423
|
+
return l === !1 && (h = i ? i(t) : t, l = h === r), (l === !1 || n.capture === !0) && (n.matchBase === !0 || n.basename === !0 ? l = D.matchBase(t, s, e, o) : l = s.exec(h)), { isMatch: !!l, match: l, output: h };
|
|
1416
1424
|
};
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1425
|
+
D.matchBase = (t, s, e, r = e && e.windows) => (s instanceof RegExp ? s : D.makeRe(s, e)).test(se.basename(t, { windows: r }));
|
|
1426
|
+
D.isMatch = (t, s, e) => D(s, e)(t);
|
|
1427
|
+
D.parse = (t, s) => Array.isArray(t) ? t.map((e) => D.parse(e, s)) : xt(t, { ...s, fastpaths: !1 });
|
|
1428
|
+
D.scan = (t, s) => en(t, s);
|
|
1429
|
+
D.compileRe = (t, s, e = !1, r = !1) => {
|
|
1422
1430
|
if (e === !0)
|
|
1423
1431
|
return t.output;
|
|
1424
1432
|
const o = s || {}, n = o.contains ? "" : "^", i = o.contains ? "" : "$";
|
|
1425
1433
|
let l = `${n}(?:${t.output})${i}`;
|
|
1426
1434
|
t && t.negated === !0 && (l = `^(?!${l}).*$`);
|
|
1427
|
-
const h =
|
|
1435
|
+
const h = D.toRegex(l, s);
|
|
1428
1436
|
return r === !0 && (h.state = t), h;
|
|
1429
1437
|
};
|
|
1430
|
-
|
|
1438
|
+
D.makeRe = (t, s = {}, e = !1, r = !1) => {
|
|
1431
1439
|
if (!t || typeof t != "string")
|
|
1432
1440
|
throw new TypeError("Expected a non-empty string");
|
|
1433
1441
|
let o = { negated: !1, fastpaths: !0 };
|
|
1434
|
-
return s.fastpaths !== !1 && (t[0] === "." || t[0] === "*") && (o.output =
|
|
1442
|
+
return s.fastpaths !== !1 && (t[0] === "." || t[0] === "*") && (o.output = xt.fastpaths(t, s)), o.output || (o = xt(t, s)), D.compileRe(o, s, e, r);
|
|
1435
1443
|
};
|
|
1436
|
-
|
|
1444
|
+
D.toRegex = (t, s) => {
|
|
1437
1445
|
try {
|
|
1438
1446
|
const e = s || {};
|
|
1439
1447
|
return new RegExp(t, e.flags || (e.nocase ? "i" : ""));
|
|
@@ -1442,31 +1450,31 @@ I.toRegex = (t, s) => {
|
|
|
1442
1450
|
return /$^/;
|
|
1443
1451
|
}
|
|
1444
1452
|
};
|
|
1445
|
-
|
|
1446
|
-
var
|
|
1447
|
-
const
|
|
1448
|
-
function
|
|
1449
|
-
return s && (s.windows === null || s.windows === void 0) && (s = { ...s, windows:
|
|
1453
|
+
D.constants = sn;
|
|
1454
|
+
var rn = D;
|
|
1455
|
+
const ne = rn, on = ct;
|
|
1456
|
+
function re(t, s, e = !1) {
|
|
1457
|
+
return s && (s.windows === null || s.windows === void 0) && (s = { ...s, windows: on.isWindows() }), ne(t, s, e);
|
|
1450
1458
|
}
|
|
1451
|
-
Object.assign(
|
|
1452
|
-
var
|
|
1453
|
-
const
|
|
1454
|
-
function
|
|
1459
|
+
Object.assign(re, ne);
|
|
1460
|
+
var un = re;
|
|
1461
|
+
const at = /* @__PURE__ */ bs(un), an = Array.isArray, oe = /\\/g, cn = /^[A-Za-z]:$/, Ot = process.platform === "win32", ln = /^(\/?\.\.)+$/;
|
|
1462
|
+
function fn(t, s = {}) {
|
|
1455
1463
|
const e = t.length, r = Array(e), o = Array(e);
|
|
1456
1464
|
let n, i;
|
|
1457
1465
|
for (n = 0; n < e; n++) {
|
|
1458
|
-
const l =
|
|
1466
|
+
const l = ie(t[n]);
|
|
1459
1467
|
r[n] = l;
|
|
1460
1468
|
const h = l.length, g = Array(h);
|
|
1461
|
-
for (i = 0; i < h; i++) g[i] =
|
|
1469
|
+
for (i = 0; i < h; i++) g[i] = at(l[i], s);
|
|
1462
1470
|
o[n] = g;
|
|
1463
1471
|
}
|
|
1464
1472
|
return (l) => {
|
|
1465
1473
|
const h = l.split("/");
|
|
1466
|
-
if (h[0] === ".." &&
|
|
1474
|
+
if (h[0] === ".." && ln.test(l)) return !0;
|
|
1467
1475
|
for (n = 0; n < e; n++) {
|
|
1468
|
-
const g = r[n], d = o[n], A = h.length,
|
|
1469
|
-
for (i = 0; i <
|
|
1476
|
+
const g = r[n], d = o[n], A = h.length, E = Math.min(A, g.length);
|
|
1477
|
+
for (i = 0; i < E; ) {
|
|
1470
1478
|
const x = g[i];
|
|
1471
1479
|
if (x.includes("/")) return !0;
|
|
1472
1480
|
if (!d[i](h[i])) break;
|
|
@@ -1478,11 +1486,11 @@ function ln(t, s = {}) {
|
|
|
1478
1486
|
return !1;
|
|
1479
1487
|
};
|
|
1480
1488
|
}
|
|
1481
|
-
const
|
|
1482
|
-
function
|
|
1489
|
+
const pn = /^[A-Z]:\/$/i, hn = Ot ? (t) => pn.test(t) : (t) => t === "/";
|
|
1490
|
+
function Bt(t, s, e) {
|
|
1483
1491
|
if (t === s || s.startsWith(`${t}/`)) {
|
|
1484
1492
|
if (e) {
|
|
1485
|
-
const o = t.length + +!
|
|
1493
|
+
const o = t.length + +!hn(t);
|
|
1486
1494
|
return (n, i) => n.slice(o, i ? -1 : void 0) || ".";
|
|
1487
1495
|
}
|
|
1488
1496
|
const r = s.slice(t.length + 1);
|
|
@@ -1494,7 +1502,7 @@ function It(t, s, e) {
|
|
|
1494
1502
|
}
|
|
1495
1503
|
return e ? (r) => tt.relative(t, r) || "." : (r) => tt.relative(t, `${s}/${r}`) || ".";
|
|
1496
1504
|
}
|
|
1497
|
-
function
|
|
1505
|
+
function gn(t, s) {
|
|
1498
1506
|
if (s.startsWith(`${t}/`)) {
|
|
1499
1507
|
const e = s.slice(t.length + 1);
|
|
1500
1508
|
return (r) => `${e}/${r}`;
|
|
@@ -1504,110 +1512,110 @@ function hn(t, s) {
|
|
|
1504
1512
|
return e[e.length - 1] === "/" && r !== "" ? `${r}/` : r || ".";
|
|
1505
1513
|
};
|
|
1506
1514
|
}
|
|
1507
|
-
function
|
|
1508
|
-
return t.replace(
|
|
1515
|
+
function Ft(t) {
|
|
1516
|
+
return t.replace(cn, (s) => `${s}/`);
|
|
1509
1517
|
}
|
|
1510
|
-
const
|
|
1511
|
-
function
|
|
1518
|
+
const dn = { parts: !0 };
|
|
1519
|
+
function ie(t) {
|
|
1512
1520
|
var s;
|
|
1513
|
-
const e =
|
|
1521
|
+
const e = at.scan(t, dn);
|
|
1514
1522
|
return !((s = e.parts) === null || s === void 0) && s.length ? e.parts : [t];
|
|
1515
1523
|
}
|
|
1516
1524
|
const yn = /\\(?![()[\]{}!+@])/g;
|
|
1517
|
-
function dn(t) {
|
|
1518
|
-
return oe(t);
|
|
1519
|
-
}
|
|
1520
1525
|
function An(t) {
|
|
1521
|
-
return
|
|
1526
|
+
return ue(t);
|
|
1527
|
+
}
|
|
1528
|
+
function Rn(t) {
|
|
1529
|
+
return ae(t).replace(yn, "/");
|
|
1522
1530
|
}
|
|
1523
|
-
const
|
|
1524
|
-
function
|
|
1531
|
+
const kn = Ot ? Rn : An, _n = new RegExp("(?<!\\\\)([()[\\]{}*?|]|^!|[!+@](?=\\()|\\\\(?![()[\\]{}!*+?@|]))", "g"), En = new RegExp("(?<!\\\\)([()[\\]{}]|^!|[!+@](?=\\())", "g"), ue = (t) => t.replace(_n, "\\$&"), ae = (t) => t.replace(En, "\\$&"), Sn = Ot ? ae : ue;
|
|
1532
|
+
function bn(t, s) {
|
|
1525
1533
|
if ((s == null ? void 0 : s.caseSensitiveMatch) === !1) return !0;
|
|
1526
|
-
const e =
|
|
1534
|
+
const e = at.scan(t);
|
|
1527
1535
|
return e.isGlob || e.negated;
|
|
1528
1536
|
}
|
|
1529
|
-
function
|
|
1537
|
+
function it(...t) {
|
|
1530
1538
|
console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...t);
|
|
1531
1539
|
}
|
|
1532
|
-
function
|
|
1540
|
+
function ce(t) {
|
|
1533
1541
|
return typeof t == "string" ? [t] : t ?? [];
|
|
1534
1542
|
}
|
|
1535
|
-
const
|
|
1536
|
-
function
|
|
1543
|
+
const mn = /^(\/?\.\.)+/, xn = /\\(?=[()[\]{}!*+?@|])/g;
|
|
1544
|
+
function St(t, s, e, r) {
|
|
1537
1545
|
var o;
|
|
1538
1546
|
const n = s.cwd;
|
|
1539
1547
|
let i = t;
|
|
1540
1548
|
t[t.length - 1] === "/" && (i = t.slice(0, -1)), i[i.length - 1] !== "*" && s.expandDirectories && (i += "/**");
|
|
1541
1549
|
const l = Sn(n);
|
|
1542
|
-
i =
|
|
1543
|
-
const h = (o =
|
|
1550
|
+
i = Ce(i.replace(xn, "")) ? tt.relative(l, i) : tt.normalize(i);
|
|
1551
|
+
const h = (o = mn.exec(i)) === null || o === void 0 ? void 0 : o[0], g = ie(i);
|
|
1544
1552
|
if (h) {
|
|
1545
1553
|
const A = (h.length + 1) / 3;
|
|
1546
|
-
let
|
|
1554
|
+
let E = 0;
|
|
1547
1555
|
const x = l.split("/");
|
|
1548
|
-
for (;
|
|
1549
|
-
i = i.slice(0, (A -
|
|
1550
|
-
const y = tt.join(n, h.slice(
|
|
1551
|
-
y[0] !== "." && e.root.length > y.length && (e.root =
|
|
1556
|
+
for (; E < A && g[E + A] === x[x.length + E - A]; )
|
|
1557
|
+
i = i.slice(0, (A - E - 1) * 3) + i.slice((A - E) * 3 + g[E + A].length + 1) || ".", E++;
|
|
1558
|
+
const y = tt.join(n, h.slice(E * 3));
|
|
1559
|
+
y[0] !== "." && e.root.length > y.length && (e.root = Ft(y), e.depthOffset = -A + E);
|
|
1552
1560
|
}
|
|
1553
1561
|
if (!r && e.depthOffset >= 0) {
|
|
1554
1562
|
var d;
|
|
1555
1563
|
(d = e.commonPath) !== null && d !== void 0 || (e.commonPath = g);
|
|
1556
|
-
const A = [],
|
|
1557
|
-
for (let x = 0; x <
|
|
1564
|
+
const A = [], E = Math.min(e.commonPath.length, g.length);
|
|
1565
|
+
for (let x = 0; x < E; x++) {
|
|
1558
1566
|
const y = g[x];
|
|
1559
1567
|
if (y === "**" && !g[x + 1]) {
|
|
1560
1568
|
A.pop();
|
|
1561
1569
|
break;
|
|
1562
1570
|
}
|
|
1563
|
-
if (x === g.length - 1 || y !== e.commonPath[x] ||
|
|
1571
|
+
if (x === g.length - 1 || y !== e.commonPath[x] || bn(y)) break;
|
|
1564
1572
|
A.push(y);
|
|
1565
1573
|
}
|
|
1566
|
-
e.depthOffset = A.length, e.commonPath = A, e.root =
|
|
1574
|
+
e.depthOffset = A.length, e.commonPath = A, e.root = Ft(A.length > 0 ? tt.join(n, ...A) : n);
|
|
1567
1575
|
}
|
|
1568
1576
|
return i;
|
|
1569
1577
|
}
|
|
1570
|
-
function
|
|
1578
|
+
function Cn(t, s, e) {
|
|
1571
1579
|
const r = [], o = [];
|
|
1572
1580
|
for (const n of t.ignore)
|
|
1573
|
-
n && (n[0] !== "!" || n[1] === "(") && o.push(
|
|
1581
|
+
n && (n[0] !== "!" || n[1] === "(") && o.push(St(n, t, e, !0));
|
|
1574
1582
|
for (const n of s)
|
|
1575
|
-
n && (n[0] !== "!" || n[1] === "(" ? r.push(
|
|
1583
|
+
n && (n[0] !== "!" || n[1] === "(" ? r.push(St(n, t, e, !1)) : (n[1] !== "!" || n[2] === "(") && o.push(St(n.slice(1), t, e, !0)));
|
|
1576
1584
|
return {
|
|
1577
1585
|
match: r,
|
|
1578
1586
|
ignore: o
|
|
1579
1587
|
};
|
|
1580
1588
|
}
|
|
1581
|
-
function
|
|
1589
|
+
function $n(t, s) {
|
|
1582
1590
|
const e = t.cwd, r = {
|
|
1583
1591
|
root: e,
|
|
1584
1592
|
depthOffset: 0
|
|
1585
|
-
}, o =
|
|
1586
|
-
t.debug &&
|
|
1587
|
-
const { absolute: n, caseSensitiveMatch: i, debug: l, dot: h, followSymbolicLinks: g, onlyDirectories: d } = t, A = r.root.replace(
|
|
1593
|
+
}, o = Cn(t, s, r);
|
|
1594
|
+
t.debug && it("internal processing patterns:", o);
|
|
1595
|
+
const { absolute: n, caseSensitiveMatch: i, debug: l, dot: h, followSymbolicLinks: g, onlyDirectories: d } = t, A = r.root.replace(oe, ""), E = {
|
|
1588
1596
|
dot: h,
|
|
1589
1597
|
nobrace: t.braceExpansion === !1,
|
|
1590
1598
|
nocase: !i,
|
|
1591
1599
|
noextglob: t.extglob === !1,
|
|
1592
1600
|
noglobstar: t.globstar === !1,
|
|
1593
1601
|
posix: !0
|
|
1594
|
-
}, x =
|
|
1595
|
-
const v =
|
|
1602
|
+
}, x = at(o.match, E), y = at(o.ignore, E), C = fn(o.match, E), T = Bt(e, A, n), W = n ? T : Bt(e, A, !0), _ = (k, O) => {
|
|
1603
|
+
const v = W(O, !0);
|
|
1596
1604
|
return v !== "." && !C(v) || y(v);
|
|
1597
1605
|
};
|
|
1598
1606
|
let M;
|
|
1599
1607
|
t.deep !== void 0 && (M = Math.round(t.deep - r.depthOffset));
|
|
1600
|
-
const
|
|
1601
|
-
filters: [l ? (
|
|
1602
|
-
const v = T(
|
|
1603
|
-
return R &&
|
|
1604
|
-
} : (
|
|
1605
|
-
const v = T(
|
|
1608
|
+
const j = new Ss({
|
|
1609
|
+
filters: [l ? (k, O) => {
|
|
1610
|
+
const v = T(k, O), R = x(v) && !y(v);
|
|
1611
|
+
return R && it(`matched ${v}`), R;
|
|
1612
|
+
} : (k, O) => {
|
|
1613
|
+
const v = T(k, O);
|
|
1606
1614
|
return x(v) && !y(v);
|
|
1607
1615
|
}],
|
|
1608
|
-
exclude: l ? (
|
|
1609
|
-
const v = _(
|
|
1610
|
-
return
|
|
1616
|
+
exclude: l ? (k, O) => {
|
|
1617
|
+
const v = _(k, O);
|
|
1618
|
+
return it(`${v ? "skipped" : "crawling"} ${O}`), v;
|
|
1611
1619
|
} : _,
|
|
1612
1620
|
fs: t.fs,
|
|
1613
1621
|
pathSeparator: "/",
|
|
@@ -1621,52 +1629,52 @@ function Cn(t, s) {
|
|
|
1621
1629
|
maxDepth: M,
|
|
1622
1630
|
signal: t.signal
|
|
1623
1631
|
}).crawl(A);
|
|
1624
|
-
return t.debug &&
|
|
1632
|
+
return t.debug && it("internal properties:", {
|
|
1625
1633
|
...r,
|
|
1626
1634
|
root: A
|
|
1627
|
-
}), [
|
|
1635
|
+
}), [j, e !== A && !n && gn(e, A)];
|
|
1628
1636
|
}
|
|
1629
|
-
function
|
|
1637
|
+
function le(t, s) {
|
|
1630
1638
|
if (s) for (let e = t.length - 1; e >= 0; e--) t[e] = s(t[e]);
|
|
1631
1639
|
return t;
|
|
1632
1640
|
}
|
|
1633
|
-
const
|
|
1641
|
+
const Mt = {
|
|
1634
1642
|
caseSensitiveMatch: !0,
|
|
1635
1643
|
debug: !!process.env.TINYGLOBBY_DEBUG,
|
|
1636
1644
|
expandDirectories: !0,
|
|
1637
1645
|
followSymbolicLinks: !0,
|
|
1638
1646
|
onlyFiles: !0
|
|
1639
1647
|
};
|
|
1640
|
-
function
|
|
1648
|
+
function vn(t) {
|
|
1641
1649
|
const s = Object.assign({}, t);
|
|
1642
|
-
for (const e in
|
|
1643
|
-
return s.cwd = (s.cwd instanceof URL ?
|
|
1650
|
+
for (const e in Mt) s[e] === void 0 && Object.assign(s, { [e]: Mt[e] });
|
|
1651
|
+
return s.cwd = (s.cwd instanceof URL ? $e(s.cwd) : Wt(s.cwd || process.cwd())).replace(oe, "/"), s.ignore = ce(s.ignore), s.fs && (s.fs = {
|
|
1644
1652
|
readdir: s.fs.readdir || Se,
|
|
1645
|
-
readdirSync: s.fs.readdirSync ||
|
|
1646
|
-
realpath: s.fs.realpath ||
|
|
1647
|
-
realpathSync: s.fs.realpathSync ||
|
|
1648
|
-
stat: s.fs.stat ||
|
|
1653
|
+
readdirSync: s.fs.readdirSync || Ee,
|
|
1654
|
+
realpath: s.fs.realpath || _e,
|
|
1655
|
+
realpathSync: s.fs.realpathSync || Re,
|
|
1656
|
+
stat: s.fs.stat || Ae,
|
|
1649
1657
|
statSync: s.fs.statSync || ye
|
|
1650
|
-
}), s.debug &&
|
|
1658
|
+
}), s.debug && it("globbing with options:", s), s;
|
|
1651
1659
|
}
|
|
1652
|
-
function
|
|
1660
|
+
function fe(t, s = {}) {
|
|
1653
1661
|
var e;
|
|
1654
1662
|
if (t && (s != null && s.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
|
|
1655
|
-
const r =
|
|
1656
|
-
return o.length > 0 ?
|
|
1663
|
+
const r = an(t) || typeof t == "string", o = ce((e = r ? t : t.patterns) !== null && e !== void 0 ? e : "**/*"), n = vn(r ? s : t);
|
|
1664
|
+
return o.length > 0 ? $n(n, o) : [];
|
|
1657
1665
|
}
|
|
1658
|
-
async function
|
|
1659
|
-
const [e, r] =
|
|
1660
|
-
return e ?
|
|
1666
|
+
async function Pn(t, s) {
|
|
1667
|
+
const [e, r] = fe(t, s);
|
|
1668
|
+
return e ? le(await e.withPromise(), r) : [];
|
|
1661
1669
|
}
|
|
1662
|
-
function
|
|
1663
|
-
const [e, r] =
|
|
1664
|
-
return e ?
|
|
1670
|
+
function Dn(t, s) {
|
|
1671
|
+
const [e, r] = fe(t, s);
|
|
1672
|
+
return e ? le(e.sync(), r) : [];
|
|
1665
1673
|
}
|
|
1666
1674
|
export {
|
|
1667
|
-
|
|
1675
|
+
kn as convertPathToPattern,
|
|
1668
1676
|
Sn as escapePath,
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1677
|
+
Pn as glob,
|
|
1678
|
+
Dn as globSync,
|
|
1679
|
+
bn as isDynamicPattern
|
|
1672
1680
|
};
|