bun-plugin-dtsx 0.21.0
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/LICENSE.md +21 -0
- package/README.md +121 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1750 -0
- package/package.json +80 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1750 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/index.ts
|
|
3
|
+
import process2 from "process";
|
|
4
|
+
|
|
5
|
+
// node_modules/@stacksjs/dtsx/dist/index.js
|
|
6
|
+
import { existsSync as Aq } from "fs";
|
|
7
|
+
import { resolve as xq } from "path";
|
|
8
|
+
import I1 from "process";
|
|
9
|
+
import { readdir as _q, readFile as Rq } from "fs/promises";
|
|
10
|
+
import { extname as Eq, join as g1 } from "path";
|
|
11
|
+
import Sq from "process";
|
|
12
|
+
import { readFile as gq } from "fs/promises";
|
|
13
|
+
import { mkdir as kZ, rm as vZ } from "fs/promises";
|
|
14
|
+
import { dirname as mZ, join as uZ, parse as hZ, relative as dZ } from "path";
|
|
15
|
+
import Nq, { posix as N1 } from "path";
|
|
16
|
+
var Lq = Object.create;
|
|
17
|
+
var { getPrototypeOf: Pq, defineProperty: b1, getOwnPropertyNames: Tq } = Object;
|
|
18
|
+
var Oq = Object.prototype.hasOwnProperty;
|
|
19
|
+
var X1 = (q, Z, $) => {
|
|
20
|
+
$ = q != null ? Lq(Pq(q)) : {};
|
|
21
|
+
let J = Z || !q || !q.__esModule ? b1($, "default", { value: q, enumerable: true }) : $;
|
|
22
|
+
for (let j of Tq(q))
|
|
23
|
+
if (!Oq.call(J, j))
|
|
24
|
+
b1(J, j, { get: () => q[j], enumerable: true });
|
|
25
|
+
return J;
|
|
26
|
+
};
|
|
27
|
+
var _ = (q, Z) => () => (Z || q((Z = { exports: {} }).exports, Z), Z.exports);
|
|
28
|
+
var f1 = _((c1) => {
|
|
29
|
+
Object.defineProperty(c1, "__esModule", { value: true });
|
|
30
|
+
c1.normalizePath = c1.convertSlashes = c1.cleanPath = undefined;
|
|
31
|
+
var D1 = import.meta.require("path");
|
|
32
|
+
function d1(q) {
|
|
33
|
+
let Z = D1.normalize(q);
|
|
34
|
+
if (Z.length > 1 && Z[Z.length - 1] === D1.sep)
|
|
35
|
+
Z = Z.substring(0, Z.length - 1);
|
|
36
|
+
return Z;
|
|
37
|
+
}
|
|
38
|
+
c1.cleanPath = d1;
|
|
39
|
+
var kq = /[\\/]/g;
|
|
40
|
+
function l1(q, Z) {
|
|
41
|
+
return q.replace(kq, Z);
|
|
42
|
+
}
|
|
43
|
+
c1.convertSlashes = l1;
|
|
44
|
+
function vq(q, Z) {
|
|
45
|
+
let { resolvePaths: $, normalizePath: J, pathSeparator: j } = Z, z = process.platform === "win32" && q.includes("/") || q.startsWith(".");
|
|
46
|
+
if ($)
|
|
47
|
+
q = D1.resolve(q);
|
|
48
|
+
if (J || z)
|
|
49
|
+
q = d1(q);
|
|
50
|
+
if (q === ".")
|
|
51
|
+
return "";
|
|
52
|
+
let U = q[q.length - 1] !== j;
|
|
53
|
+
return l1(U ? q + j : q, j);
|
|
54
|
+
}
|
|
55
|
+
c1.normalizePath = vq;
|
|
56
|
+
});
|
|
57
|
+
var a1 = _((r1) => {
|
|
58
|
+
Object.defineProperty(r1, "__esModule", { value: true });
|
|
59
|
+
r1.build = r1.joinDirectoryPath = r1.joinPathWithBasePath = undefined;
|
|
60
|
+
var hq = import.meta.require("path"), dq = f1();
|
|
61
|
+
function n1(q, Z) {
|
|
62
|
+
return Z + q;
|
|
63
|
+
}
|
|
64
|
+
r1.joinPathWithBasePath = n1;
|
|
65
|
+
function lq(q, Z) {
|
|
66
|
+
return function($, J) {
|
|
67
|
+
if (J.startsWith(q))
|
|
68
|
+
return J.replace(q, "") + $;
|
|
69
|
+
else
|
|
70
|
+
return dq.convertSlashes(hq.relative(q, J), Z.pathSeparator) + Z.pathSeparator + $;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function cq(q) {
|
|
74
|
+
return q;
|
|
75
|
+
}
|
|
76
|
+
function iq(q, Z, $) {
|
|
77
|
+
return Z + q + $;
|
|
78
|
+
}
|
|
79
|
+
r1.joinDirectoryPath = iq;
|
|
80
|
+
function nq(q, Z) {
|
|
81
|
+
let { relativePaths: $, includeBasePath: J } = Z;
|
|
82
|
+
return $ && q ? lq(q, Z) : J ? n1 : cq;
|
|
83
|
+
}
|
|
84
|
+
r1.build = nq;
|
|
85
|
+
});
|
|
86
|
+
var e1 = _((s1) => {
|
|
87
|
+
Object.defineProperty(s1, "__esModule", { value: true });
|
|
88
|
+
s1.build = undefined;
|
|
89
|
+
function aq(q) {
|
|
90
|
+
return function(Z, $) {
|
|
91
|
+
$.push(Z.substring(q.length) || ".");
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function sq(q) {
|
|
95
|
+
return function(Z, $, J) {
|
|
96
|
+
let j = Z.substring(q.length) || ".";
|
|
97
|
+
if (J.every((z) => z(j, true)))
|
|
98
|
+
$.push(j);
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
var oq = (q, Z) => {
|
|
102
|
+
Z.push(q || ".");
|
|
103
|
+
}, eq = (q, Z, $) => {
|
|
104
|
+
let J = q || ".";
|
|
105
|
+
if ($.every((j) => j(J, true)))
|
|
106
|
+
Z.push(J);
|
|
107
|
+
}, tq = () => {
|
|
108
|
+
};
|
|
109
|
+
function q$(q, Z) {
|
|
110
|
+
let { includeDirs: $, filters: J, relativePaths: j } = Z;
|
|
111
|
+
if (!$)
|
|
112
|
+
return tq;
|
|
113
|
+
if (j)
|
|
114
|
+
return J && J.length ? sq(q) : aq(q);
|
|
115
|
+
return J && J.length ? eq : oq;
|
|
116
|
+
}
|
|
117
|
+
s1.build = q$;
|
|
118
|
+
});
|
|
119
|
+
var $0 = _((t1) => {
|
|
120
|
+
Object.defineProperty(t1, "__esModule", { value: true });
|
|
121
|
+
t1.build = undefined;
|
|
122
|
+
var $$ = (q, Z, $, J) => {
|
|
123
|
+
if (J.every((j) => j(q, false)))
|
|
124
|
+
$.files++;
|
|
125
|
+
}, Z$ = (q, Z, $, J) => {
|
|
126
|
+
if (J.every((j) => j(q, false)))
|
|
127
|
+
Z.push(q);
|
|
128
|
+
}, J$ = (q, Z, $, J) => {
|
|
129
|
+
$.files++;
|
|
130
|
+
}, j$ = (q, Z) => {
|
|
131
|
+
Z.push(q);
|
|
132
|
+
}, V$ = () => {
|
|
133
|
+
};
|
|
134
|
+
function Y$(q) {
|
|
135
|
+
let { excludeFiles: Z, filters: $, onlyCounts: J } = q;
|
|
136
|
+
if (Z)
|
|
137
|
+
return V$;
|
|
138
|
+
if ($ && $.length)
|
|
139
|
+
return J ? $$ : Z$;
|
|
140
|
+
else if (J)
|
|
141
|
+
return J$;
|
|
142
|
+
else
|
|
143
|
+
return j$;
|
|
144
|
+
}
|
|
145
|
+
t1.build = Y$;
|
|
146
|
+
});
|
|
147
|
+
var j0 = _((Z0) => {
|
|
148
|
+
Object.defineProperty(Z0, "__esModule", { value: true });
|
|
149
|
+
Z0.build = undefined;
|
|
150
|
+
var W$ = (q) => {
|
|
151
|
+
return q;
|
|
152
|
+
}, z$ = () => {
|
|
153
|
+
return [""].slice(0, 0);
|
|
154
|
+
};
|
|
155
|
+
function U$(q) {
|
|
156
|
+
return q.group ? z$ : W$;
|
|
157
|
+
}
|
|
158
|
+
Z0.build = U$;
|
|
159
|
+
});
|
|
160
|
+
var W0 = _((V0) => {
|
|
161
|
+
Object.defineProperty(V0, "__esModule", { value: true });
|
|
162
|
+
V0.build = undefined;
|
|
163
|
+
var X$ = (q, Z, $) => {
|
|
164
|
+
q.push({ directory: Z, files: $, dir: Z });
|
|
165
|
+
}, B$ = () => {
|
|
166
|
+
};
|
|
167
|
+
function Q$(q) {
|
|
168
|
+
return q.group ? X$ : B$;
|
|
169
|
+
}
|
|
170
|
+
V0.build = Q$;
|
|
171
|
+
});
|
|
172
|
+
var X0 = _((t) => {
|
|
173
|
+
var F$ = t && t.__importDefault || function(q) {
|
|
174
|
+
return q && q.__esModule ? q : { default: q };
|
|
175
|
+
};
|
|
176
|
+
Object.defineProperty(t, "__esModule", { value: true });
|
|
177
|
+
t.build = undefined;
|
|
178
|
+
var F1 = F$(import.meta.require("fs")), z0 = import.meta.require("path"), K$ = function(q, Z, $) {
|
|
179
|
+
let { queue: J, options: { suppressErrors: j } } = Z;
|
|
180
|
+
J.enqueue(), F1.default.realpath(q, (z, U) => {
|
|
181
|
+
if (z)
|
|
182
|
+
return J.dequeue(j ? null : z, Z);
|
|
183
|
+
F1.default.stat(U, (B, M) => {
|
|
184
|
+
if (B)
|
|
185
|
+
return J.dequeue(j ? null : B, Z);
|
|
186
|
+
if (M.isDirectory() && U0(q, U, Z))
|
|
187
|
+
return J.dequeue(null, Z);
|
|
188
|
+
$(M, U), J.dequeue(null, Z);
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
}, G$ = function(q, Z, $) {
|
|
192
|
+
let { queue: J, options: { suppressErrors: j } } = Z;
|
|
193
|
+
J.enqueue();
|
|
194
|
+
try {
|
|
195
|
+
let z = F1.default.realpathSync(q), U = F1.default.statSync(z);
|
|
196
|
+
if (U.isDirectory() && U0(q, z, Z))
|
|
197
|
+
return;
|
|
198
|
+
$(U, z);
|
|
199
|
+
} catch (z) {
|
|
200
|
+
if (!j)
|
|
201
|
+
throw z;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
function M$(q, Z) {
|
|
205
|
+
if (!q.resolveSymlinks || q.excludeSymlinks)
|
|
206
|
+
return null;
|
|
207
|
+
return Z ? G$ : K$;
|
|
208
|
+
}
|
|
209
|
+
t.build = M$;
|
|
210
|
+
function U0(q, Z, $) {
|
|
211
|
+
if ($.options.useRealPaths)
|
|
212
|
+
return N$(Z, $);
|
|
213
|
+
let J = z0.dirname(q), j = 1;
|
|
214
|
+
while (J !== $.root && j < 2) {
|
|
215
|
+
let z = $.symlinks.get(J);
|
|
216
|
+
if (!!z && (z === Z || z.startsWith(Z) || Z.startsWith(z)))
|
|
217
|
+
j++;
|
|
218
|
+
else
|
|
219
|
+
J = z0.dirname(J);
|
|
220
|
+
}
|
|
221
|
+
return $.symlinks.set(q, Z), j > 1;
|
|
222
|
+
}
|
|
223
|
+
function N$(q, Z) {
|
|
224
|
+
return Z.visited.includes(q + Z.options.pathSeparator);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
var F0 = _((B0) => {
|
|
228
|
+
Object.defineProperty(B0, "__esModule", { value: true });
|
|
229
|
+
B0.build = undefined;
|
|
230
|
+
var w$ = (q) => {
|
|
231
|
+
return q.counts;
|
|
232
|
+
}, y$ = (q) => {
|
|
233
|
+
return q.groups;
|
|
234
|
+
}, I$ = (q) => {
|
|
235
|
+
return q.paths;
|
|
236
|
+
}, D$ = (q) => {
|
|
237
|
+
return q.paths.slice(0, q.options.maxFiles);
|
|
238
|
+
}, f$ = (q, Z, $) => {
|
|
239
|
+
return K1(Z, $, q.counts, q.options.suppressErrors), null;
|
|
240
|
+
}, H$ = (q, Z, $) => {
|
|
241
|
+
return K1(Z, $, q.paths, q.options.suppressErrors), null;
|
|
242
|
+
}, C$ = (q, Z, $) => {
|
|
243
|
+
return K1(Z, $, q.paths.slice(0, q.options.maxFiles), q.options.suppressErrors), null;
|
|
244
|
+
}, L$ = (q, Z, $) => {
|
|
245
|
+
return K1(Z, $, q.groups, q.options.suppressErrors), null;
|
|
246
|
+
};
|
|
247
|
+
function K1(q, Z, $, J) {
|
|
248
|
+
if (q && !J)
|
|
249
|
+
Z(q, $);
|
|
250
|
+
else
|
|
251
|
+
Z(null, $);
|
|
252
|
+
}
|
|
253
|
+
function P$(q, Z) {
|
|
254
|
+
let { onlyCounts: $, group: J, maxFiles: j } = q;
|
|
255
|
+
if ($)
|
|
256
|
+
return Z ? w$ : f$;
|
|
257
|
+
else if (J)
|
|
258
|
+
return Z ? y$ : L$;
|
|
259
|
+
else if (j)
|
|
260
|
+
return Z ? D$ : C$;
|
|
261
|
+
else
|
|
262
|
+
return Z ? I$ : H$;
|
|
263
|
+
}
|
|
264
|
+
B0.build = P$;
|
|
265
|
+
});
|
|
266
|
+
var M0 = _((q1) => {
|
|
267
|
+
var T$ = q1 && q1.__importDefault || function(q) {
|
|
268
|
+
return q && q.__esModule ? q : { default: q };
|
|
269
|
+
};
|
|
270
|
+
Object.defineProperty(q1, "__esModule", { value: true });
|
|
271
|
+
q1.build = undefined;
|
|
272
|
+
var K0 = T$(import.meta.require("fs")), G0 = { withFileTypes: true }, O$ = (q, Z, $, J, j) => {
|
|
273
|
+
if (J < 0)
|
|
274
|
+
return q.queue.dequeue(null, q);
|
|
275
|
+
q.visited.push(Z), q.counts.directories++, q.queue.enqueue(), K0.default.readdir(Z || ".", G0, (z, U = []) => {
|
|
276
|
+
j(U, $, J), q.queue.dequeue(q.options.suppressErrors ? null : z, q);
|
|
277
|
+
});
|
|
278
|
+
}, _$ = (q, Z, $, J, j) => {
|
|
279
|
+
if (J < 0)
|
|
280
|
+
return;
|
|
281
|
+
q.visited.push(Z), q.counts.directories++;
|
|
282
|
+
let z = [];
|
|
283
|
+
try {
|
|
284
|
+
z = K0.default.readdirSync(Z || ".", G0);
|
|
285
|
+
} catch (U) {
|
|
286
|
+
if (!q.options.suppressErrors)
|
|
287
|
+
throw U;
|
|
288
|
+
}
|
|
289
|
+
j(z, $, J);
|
|
290
|
+
};
|
|
291
|
+
function R$(q) {
|
|
292
|
+
return q ? _$ : O$;
|
|
293
|
+
}
|
|
294
|
+
q1.build = R$;
|
|
295
|
+
});
|
|
296
|
+
var I0 = _((w0) => {
|
|
297
|
+
Object.defineProperty(w0, "__esModule", { value: true });
|
|
298
|
+
w0.Queue = undefined;
|
|
299
|
+
|
|
300
|
+
class N0 {
|
|
301
|
+
onQueueEmpty;
|
|
302
|
+
count = 0;
|
|
303
|
+
constructor(q) {
|
|
304
|
+
this.onQueueEmpty = q;
|
|
305
|
+
}
|
|
306
|
+
enqueue() {
|
|
307
|
+
this.count++;
|
|
308
|
+
}
|
|
309
|
+
dequeue(q, Z) {
|
|
310
|
+
if (--this.count <= 0 || q)
|
|
311
|
+
this.onQueueEmpty(q, Z);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
w0.Queue = N0;
|
|
315
|
+
});
|
|
316
|
+
var C0 = _((f0) => {
|
|
317
|
+
Object.defineProperty(f0, "__esModule", { value: true });
|
|
318
|
+
f0.Counter = undefined;
|
|
319
|
+
|
|
320
|
+
class D0 {
|
|
321
|
+
_files = 0;
|
|
322
|
+
_directories = 0;
|
|
323
|
+
set files(q) {
|
|
324
|
+
this._files = q;
|
|
325
|
+
}
|
|
326
|
+
get files() {
|
|
327
|
+
return this._files;
|
|
328
|
+
}
|
|
329
|
+
set directories(q) {
|
|
330
|
+
this._directories = q;
|
|
331
|
+
}
|
|
332
|
+
get directories() {
|
|
333
|
+
return this._directories;
|
|
334
|
+
}
|
|
335
|
+
get dirs() {
|
|
336
|
+
return this._directories;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
f0.Counter = D0;
|
|
340
|
+
});
|
|
341
|
+
var L1 = _((n) => {
|
|
342
|
+
var E$ = n && n.__createBinding || (Object.create ? function(q, Z, $, J) {
|
|
343
|
+
if (J === undefined)
|
|
344
|
+
J = $;
|
|
345
|
+
var j = Object.getOwnPropertyDescriptor(Z, $);
|
|
346
|
+
if (!j || ("get" in j ? !Z.__esModule : j.writable || j.configurable))
|
|
347
|
+
j = { enumerable: true, get: function() {
|
|
348
|
+
return Z[$];
|
|
349
|
+
} };
|
|
350
|
+
Object.defineProperty(q, J, j);
|
|
351
|
+
} : function(q, Z, $, J) {
|
|
352
|
+
if (J === undefined)
|
|
353
|
+
J = $;
|
|
354
|
+
q[J] = Z[$];
|
|
355
|
+
}), S$ = n && n.__setModuleDefault || (Object.create ? function(q, Z) {
|
|
356
|
+
Object.defineProperty(q, "default", { enumerable: true, value: Z });
|
|
357
|
+
} : function(q, Z) {
|
|
358
|
+
q.default = Z;
|
|
359
|
+
}), o = n && n.__importStar || function(q) {
|
|
360
|
+
if (q && q.__esModule)
|
|
361
|
+
return q;
|
|
362
|
+
var Z = {};
|
|
363
|
+
if (q != null) {
|
|
364
|
+
for (var $ in q)
|
|
365
|
+
if ($ !== "default" && Object.prototype.hasOwnProperty.call(q, $))
|
|
366
|
+
E$(Z, q, $);
|
|
367
|
+
}
|
|
368
|
+
return S$(Z, q), Z;
|
|
369
|
+
};
|
|
370
|
+
Object.defineProperty(n, "__esModule", { value: true });
|
|
371
|
+
n.Walker = undefined;
|
|
372
|
+
var L0 = import.meta.require("path"), H1 = f1(), C1 = o(a1()), A$ = o(e1()), x$ = o($0()), b$ = o(j0()), g$ = o(W0()), k$ = o(X0()), v$ = o(F0()), m$ = o(M0()), u$ = I0(), h$ = C0();
|
|
373
|
+
|
|
374
|
+
class P0 {
|
|
375
|
+
root;
|
|
376
|
+
isSynchronous;
|
|
377
|
+
state;
|
|
378
|
+
joinPath;
|
|
379
|
+
pushDirectory;
|
|
380
|
+
pushFile;
|
|
381
|
+
getArray;
|
|
382
|
+
groupFiles;
|
|
383
|
+
resolveSymlink;
|
|
384
|
+
walkDirectory;
|
|
385
|
+
callbackInvoker;
|
|
386
|
+
constructor(q, Z, $) {
|
|
387
|
+
this.isSynchronous = !$, this.callbackInvoker = v$.build(Z, this.isSynchronous), this.root = H1.normalizePath(q, Z), this.state = { root: this.root.slice(0, -1), paths: [""].slice(0, 0), groups: [], counts: new h$.Counter, options: Z, queue: new u$.Queue((J, j) => this.callbackInvoker(j, J, $)), symlinks: new Map, visited: [""].slice(0, 0) }, this.joinPath = C1.build(this.root, Z), this.pushDirectory = A$.build(this.root, Z), this.pushFile = x$.build(Z), this.getArray = b$.build(Z), this.groupFiles = g$.build(Z), this.resolveSymlink = k$.build(Z, this.isSynchronous), this.walkDirectory = m$.build(this.isSynchronous);
|
|
388
|
+
}
|
|
389
|
+
start() {
|
|
390
|
+
return this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk), this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
|
|
391
|
+
}
|
|
392
|
+
walk = (q, Z, $) => {
|
|
393
|
+
let { paths: J, options: { filters: j, resolveSymlinks: z, excludeSymlinks: U, exclude: B, maxFiles: M, signal: K, useRealPaths: F, pathSeparator: T } } = this.state;
|
|
394
|
+
if (K && K.aborted || M && J.length > M)
|
|
395
|
+
return;
|
|
396
|
+
this.pushDirectory(Z, J, j);
|
|
397
|
+
let H = this.getArray(this.state.paths);
|
|
398
|
+
for (let P = 0;P < q.length; ++P) {
|
|
399
|
+
let N = q[P];
|
|
400
|
+
if (N.isFile() || N.isSymbolicLink() && !z && !U) {
|
|
401
|
+
let G = this.joinPath(N.name, Z);
|
|
402
|
+
this.pushFile(G, H, this.state.counts, j);
|
|
403
|
+
} else if (N.isDirectory()) {
|
|
404
|
+
let G = C1.joinDirectoryPath(N.name, Z, this.state.options.pathSeparator);
|
|
405
|
+
if (B && B(N.name, G))
|
|
406
|
+
continue;
|
|
407
|
+
this.walkDirectory(this.state, G, G, $ - 1, this.walk);
|
|
408
|
+
} else if (N.isSymbolicLink() && this.resolveSymlink) {
|
|
409
|
+
let G = C1.joinPathWithBasePath(N.name, Z);
|
|
410
|
+
this.resolveSymlink(G, this.state, (h, C) => {
|
|
411
|
+
if (h.isDirectory()) {
|
|
412
|
+
if (C = H1.normalizePath(C, this.state.options), B && B(N.name, C))
|
|
413
|
+
return;
|
|
414
|
+
this.walkDirectory(this.state, C, F ? C : G + T, $ - 1, this.walk);
|
|
415
|
+
} else {
|
|
416
|
+
C = F ? C : G;
|
|
417
|
+
let I = L0.basename(C), g = H1.normalizePath(L0.dirname(C), this.state.options);
|
|
418
|
+
C = this.joinPath(I, g), this.pushFile(C, H, this.state.counts, j);
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
this.groupFiles(this.state.groups, Z, H);
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
n.Walker = P0;
|
|
427
|
+
});
|
|
428
|
+
var R0 = _((O0) => {
|
|
429
|
+
Object.defineProperty(O0, "__esModule", { value: true });
|
|
430
|
+
O0.callback = O0.promise = undefined;
|
|
431
|
+
var d$ = L1();
|
|
432
|
+
function l$(q, Z) {
|
|
433
|
+
return new Promise(($, J) => {
|
|
434
|
+
T0(q, Z, (j, z) => {
|
|
435
|
+
if (j)
|
|
436
|
+
return J(j);
|
|
437
|
+
$(z);
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
O0.promise = l$;
|
|
442
|
+
function T0(q, Z, $) {
|
|
443
|
+
new d$.Walker(q, Z, $).start();
|
|
444
|
+
}
|
|
445
|
+
O0.callback = T0;
|
|
446
|
+
});
|
|
447
|
+
var A0 = _((E0) => {
|
|
448
|
+
Object.defineProperty(E0, "__esModule", { value: true });
|
|
449
|
+
E0.sync = undefined;
|
|
450
|
+
var i$ = L1();
|
|
451
|
+
function n$(q, Z) {
|
|
452
|
+
return new i$.Walker(q, Z).start();
|
|
453
|
+
}
|
|
454
|
+
E0.sync = n$;
|
|
455
|
+
});
|
|
456
|
+
var v0 = _((g0) => {
|
|
457
|
+
Object.defineProperty(g0, "__esModule", { value: true });
|
|
458
|
+
g0.APIBuilder = undefined;
|
|
459
|
+
var x0 = R0(), r$ = A0();
|
|
460
|
+
|
|
461
|
+
class b0 {
|
|
462
|
+
root;
|
|
463
|
+
options;
|
|
464
|
+
constructor(q, Z) {
|
|
465
|
+
this.root = q, this.options = Z;
|
|
466
|
+
}
|
|
467
|
+
withPromise() {
|
|
468
|
+
return x0.promise(this.root, this.options);
|
|
469
|
+
}
|
|
470
|
+
withCallback(q) {
|
|
471
|
+
x0.callback(this.root, this.options, q);
|
|
472
|
+
}
|
|
473
|
+
sync() {
|
|
474
|
+
return r$.sync(this.root, this.options);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
g0.APIBuilder = b0;
|
|
478
|
+
});
|
|
479
|
+
var J1 = _((y8, u0) => {
|
|
480
|
+
var m0 = { DOT_LITERAL: "\\.", PLUS_LITERAL: "\\+", QMARK_LITERAL: "\\?", SLASH_LITERAL: "\\/", ONE_CHAR: "(?=.)", QMARK: "[^/]", END_ANCHOR: "(?:\\/|$)", DOTS_SLASH: "\\.{1,2}(?:\\/|$)", NO_DOT: "(?!\\.)", NO_DOTS: "(?!(?:^|\\/)\\.{1,2}(?:\\/|$))", NO_DOT_SLASH: "(?!\\.{0,1}(?:\\/|$))", NO_DOTS_SLASH: "(?!\\.{1,2}(?:\\/|$))", QMARK_NO_DOT: "[^.\\/]", STAR: "[^/]*?", START_ANCHOR: "(?:^|\\/)", SEP: "/" }, p$ = { ...m0, SLASH_LITERAL: "[\\\\/]", QMARK: "[^\\\\/]", STAR: "[^\\\\/]*?", DOTS_SLASH: "\\.{1,2}(?:[\\\\/]|$)", NO_DOT: "(?!\\.)", NO_DOTS: "(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))", NO_DOT_SLASH: "(?!\\.{0,1}(?:[\\\\/]|$))", NO_DOTS_SLASH: "(?!\\.{1,2}(?:[\\\\/]|$))", QMARK_NO_DOT: "[^.\\\\/]", START_ANCHOR: "(?:^|[\\\\/])", END_ANCHOR: "(?:[\\\\/]|$)", SEP: "\\" }, a$ = { alnum: "a-zA-Z0-9", alpha: "a-zA-Z", ascii: "\\x00-\\x7F", blank: " \\t", cntrl: "\\x00-\\x1F\\x7F", digit: "0-9", graph: "\\x21-\\x7E", lower: "a-z", print: "\\x20-\\x7E ", punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', space: " \\t\\r\\n\\v\\f", upper: "A-Z", word: "A-Za-z0-9_", xdigit: "A-Fa-f0-9" };
|
|
481
|
+
u0.exports = { MAX_LENGTH: 65536, POSIX_REGEX_SOURCE: a$, REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, REPLACEMENTS: { "***": "*", "**/**": "**", "**/**/**": "**" }, CHAR_0: 48, CHAR_9: 57, CHAR_UPPERCASE_A: 65, CHAR_LOWERCASE_A: 97, CHAR_UPPERCASE_Z: 90, CHAR_LOWERCASE_Z: 122, CHAR_LEFT_PARENTHESES: 40, CHAR_RIGHT_PARENTHESES: 41, CHAR_ASTERISK: 42, CHAR_AMPERSAND: 38, CHAR_AT: 64, CHAR_BACKWARD_SLASH: 92, CHAR_CARRIAGE_RETURN: 13, CHAR_CIRCUMFLEX_ACCENT: 94, CHAR_COLON: 58, CHAR_COMMA: 44, CHAR_DOT: 46, CHAR_DOUBLE_QUOTE: 34, CHAR_EQUAL: 61, CHAR_EXCLAMATION_MARK: 33, CHAR_FORM_FEED: 12, CHAR_FORWARD_SLASH: 47, CHAR_GRAVE_ACCENT: 96, CHAR_HASH: 35, CHAR_HYPHEN_MINUS: 45, CHAR_LEFT_ANGLE_BRACKET: 60, CHAR_LEFT_CURLY_BRACE: 123, CHAR_LEFT_SQUARE_BRACKET: 91, CHAR_LINE_FEED: 10, CHAR_NO_BREAK_SPACE: 160, CHAR_PERCENT: 37, CHAR_PLUS: 43, CHAR_QUESTION_MARK: 63, CHAR_RIGHT_ANGLE_BRACKET: 62, CHAR_RIGHT_CURLY_BRACE: 125, CHAR_RIGHT_SQUARE_BRACKET: 93, CHAR_SEMICOLON: 59, CHAR_SINGLE_QUOTE: 39, CHAR_SPACE: 32, CHAR_TAB: 9, CHAR_UNDERSCORE: 95, CHAR_VERTICAL_LINE: 124, CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, extglobChars(q) {
|
|
482
|
+
return { "!": { type: "negate", open: "(?:(?!(?:", close: `))${q.STAR})` }, "?": { type: "qmark", open: "(?:", close: ")?" }, "+": { type: "plus", open: "(?:", close: ")+" }, "*": { type: "star", open: "(?:", close: ")*" }, "@": { type: "at", open: "(?:", close: ")" } };
|
|
483
|
+
}, globChars(q) {
|
|
484
|
+
return q === true ? p$ : m0;
|
|
485
|
+
} };
|
|
486
|
+
});
|
|
487
|
+
var j1 = _((qZ) => {
|
|
488
|
+
var { REGEX_BACKSLASH: s$, REGEX_REMOVE_BACKSLASH: o$, REGEX_SPECIAL_CHARS: e$, REGEX_SPECIAL_CHARS_GLOBAL: t$ } = J1();
|
|
489
|
+
qZ.isObject = (q) => q !== null && typeof q === "object" && !Array.isArray(q);
|
|
490
|
+
qZ.hasRegexChars = (q) => e$.test(q);
|
|
491
|
+
qZ.isRegexChar = (q) => q.length === 1 && qZ.hasRegexChars(q);
|
|
492
|
+
qZ.escapeRegex = (q) => q.replace(t$, "\\$1");
|
|
493
|
+
qZ.toPosixSlashes = (q) => q.replace(s$, "/");
|
|
494
|
+
qZ.isWindows = () => {
|
|
495
|
+
if (typeof navigator !== "undefined" && navigator.platform) {
|
|
496
|
+
let q = navigator.platform.toLowerCase();
|
|
497
|
+
return q === "win32" || q === "windows";
|
|
498
|
+
}
|
|
499
|
+
if (typeof process !== "undefined" && process.platform)
|
|
500
|
+
return process.platform === "win32";
|
|
501
|
+
return false;
|
|
502
|
+
};
|
|
503
|
+
qZ.removeBackslashes = (q) => {
|
|
504
|
+
return q.replace(o$, (Z) => {
|
|
505
|
+
return Z === "\\" ? "" : Z;
|
|
506
|
+
});
|
|
507
|
+
};
|
|
508
|
+
qZ.escapeLast = (q, Z, $) => {
|
|
509
|
+
let J = q.lastIndexOf(Z, $);
|
|
510
|
+
if (J === -1)
|
|
511
|
+
return q;
|
|
512
|
+
if (q[J - 1] === "\\")
|
|
513
|
+
return qZ.escapeLast(q, Z, J - 1);
|
|
514
|
+
return `${q.slice(0, J)}\\${q.slice(J)}`;
|
|
515
|
+
};
|
|
516
|
+
qZ.removePrefix = (q, Z = {}) => {
|
|
517
|
+
let $ = q;
|
|
518
|
+
if ($.startsWith("./"))
|
|
519
|
+
$ = $.slice(2), Z.prefix = "./";
|
|
520
|
+
return $;
|
|
521
|
+
};
|
|
522
|
+
qZ.wrapOutput = (q, Z = {}, $ = {}) => {
|
|
523
|
+
let J = $.contains ? "" : "^", j = $.contains ? "" : "$", z = `${J}(?:${q})${j}`;
|
|
524
|
+
if (Z.negated === true)
|
|
525
|
+
z = `(?:^(?!${z}).*$)`;
|
|
526
|
+
return z;
|
|
527
|
+
};
|
|
528
|
+
qZ.basename = (q, { windows: Z } = {}) => {
|
|
529
|
+
let $ = q.split(Z ? /[\\/]/ : "/"), J = $[$.length - 1];
|
|
530
|
+
if (J === "")
|
|
531
|
+
return $[$.length - 2];
|
|
532
|
+
return J;
|
|
533
|
+
};
|
|
534
|
+
});
|
|
535
|
+
var s0 = _((D8, a0) => {
|
|
536
|
+
var l0 = j1(), { CHAR_ASTERISK: P1, CHAR_AT: XZ, CHAR_BACKWARD_SLASH: V1, CHAR_COMMA: BZ, CHAR_DOT: T1, CHAR_EXCLAMATION_MARK: O1, CHAR_FORWARD_SLASH: p0, CHAR_LEFT_CURLY_BRACE: _1, CHAR_LEFT_PARENTHESES: R1, CHAR_LEFT_SQUARE_BRACKET: QZ, CHAR_PLUS: FZ, CHAR_QUESTION_MARK: c0, CHAR_RIGHT_CURLY_BRACE: KZ, CHAR_RIGHT_PARENTHESES: i0, CHAR_RIGHT_SQUARE_BRACKET: GZ } = J1(), n0 = (q) => {
|
|
537
|
+
return q === p0 || q === V1;
|
|
538
|
+
}, r0 = (q) => {
|
|
539
|
+
if (q.isPrefix !== true)
|
|
540
|
+
q.depth = q.isGlobstar ? 1 / 0 : 1;
|
|
541
|
+
}, MZ = (q, Z) => {
|
|
542
|
+
let $ = Z || {}, J = q.length - 1, j = $.parts === true || $.scanToEnd === true, z = [], U = [], B = [], M = q, K = -1, F = 0, T = 0, H = false, P = false, N = false, G = false, h = false, C = false, I = false, g = false, i = false, v = false, x = 0, m, w, y = { value: "", depth: 0, isGlob: false }, W = () => K >= J, d = () => M.charCodeAt(K + 1), b = () => {
|
|
543
|
+
return m = w, M.charCodeAt(++K);
|
|
544
|
+
};
|
|
545
|
+
while (K < J) {
|
|
546
|
+
w = b();
|
|
547
|
+
let L;
|
|
548
|
+
if (w === V1) {
|
|
549
|
+
if (I = y.backslashes = true, w = b(), w === _1)
|
|
550
|
+
C = true;
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
if (C === true || w === _1) {
|
|
554
|
+
x++;
|
|
555
|
+
while (W() !== true && (w = b())) {
|
|
556
|
+
if (w === V1) {
|
|
557
|
+
I = y.backslashes = true, b();
|
|
558
|
+
continue;
|
|
559
|
+
}
|
|
560
|
+
if (w === _1) {
|
|
561
|
+
x++;
|
|
562
|
+
continue;
|
|
563
|
+
}
|
|
564
|
+
if (C !== true && w === T1 && (w = b()) === T1) {
|
|
565
|
+
if (H = y.isBrace = true, N = y.isGlob = true, v = true, j === true)
|
|
566
|
+
continue;
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
if (C !== true && w === BZ) {
|
|
570
|
+
if (H = y.isBrace = true, N = y.isGlob = true, v = true, j === true)
|
|
571
|
+
continue;
|
|
572
|
+
break;
|
|
573
|
+
}
|
|
574
|
+
if (w === KZ) {
|
|
575
|
+
if (x--, x === 0) {
|
|
576
|
+
C = false, H = y.isBrace = true, v = true;
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
if (j === true)
|
|
582
|
+
continue;
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
if (w === p0) {
|
|
586
|
+
if (z.push(K), U.push(y), y = { value: "", depth: 0, isGlob: false }, v === true)
|
|
587
|
+
continue;
|
|
588
|
+
if (m === T1 && K === F + 1) {
|
|
589
|
+
F += 2;
|
|
590
|
+
continue;
|
|
591
|
+
}
|
|
592
|
+
T = K + 1;
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
if ($.noext !== true) {
|
|
596
|
+
if ((w === FZ || w === XZ || w === P1 || w === c0 || w === O1) === true && d() === R1) {
|
|
597
|
+
if (N = y.isGlob = true, G = y.isExtglob = true, v = true, w === O1 && K === F)
|
|
598
|
+
i = true;
|
|
599
|
+
if (j === true) {
|
|
600
|
+
while (W() !== true && (w = b())) {
|
|
601
|
+
if (w === V1) {
|
|
602
|
+
I = y.backslashes = true, w = b();
|
|
603
|
+
continue;
|
|
604
|
+
}
|
|
605
|
+
if (w === i0) {
|
|
606
|
+
N = y.isGlob = true, v = true;
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
continue;
|
|
611
|
+
}
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
if (w === P1) {
|
|
616
|
+
if (m === P1)
|
|
617
|
+
h = y.isGlobstar = true;
|
|
618
|
+
if (N = y.isGlob = true, v = true, j === true)
|
|
619
|
+
continue;
|
|
620
|
+
break;
|
|
621
|
+
}
|
|
622
|
+
if (w === c0) {
|
|
623
|
+
if (N = y.isGlob = true, v = true, j === true)
|
|
624
|
+
continue;
|
|
625
|
+
break;
|
|
626
|
+
}
|
|
627
|
+
if (w === QZ) {
|
|
628
|
+
while (W() !== true && (L = b())) {
|
|
629
|
+
if (L === V1) {
|
|
630
|
+
I = y.backslashes = true, b();
|
|
631
|
+
continue;
|
|
632
|
+
}
|
|
633
|
+
if (L === GZ) {
|
|
634
|
+
P = y.isBracket = true, N = y.isGlob = true, v = true;
|
|
635
|
+
break;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
if (j === true)
|
|
639
|
+
continue;
|
|
640
|
+
break;
|
|
641
|
+
}
|
|
642
|
+
if ($.nonegate !== true && w === O1 && K === F) {
|
|
643
|
+
g = y.negated = true, F++;
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
if ($.noparen !== true && w === R1) {
|
|
647
|
+
if (N = y.isGlob = true, j === true) {
|
|
648
|
+
while (W() !== true && (w = b())) {
|
|
649
|
+
if (w === R1) {
|
|
650
|
+
I = y.backslashes = true, w = b();
|
|
651
|
+
continue;
|
|
652
|
+
}
|
|
653
|
+
if (w === i0) {
|
|
654
|
+
v = true;
|
|
655
|
+
break;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
continue;
|
|
659
|
+
}
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
if (N === true) {
|
|
663
|
+
if (v = true, j === true)
|
|
664
|
+
continue;
|
|
665
|
+
break;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
if ($.noext === true)
|
|
669
|
+
G = false, N = false;
|
|
670
|
+
let S = M, V = "", Y = "";
|
|
671
|
+
if (F > 0)
|
|
672
|
+
V = M.slice(0, F), M = M.slice(F), T -= F;
|
|
673
|
+
if (S && N === true && T > 0)
|
|
674
|
+
S = M.slice(0, T), Y = M.slice(T);
|
|
675
|
+
else if (N === true)
|
|
676
|
+
S = "", Y = M;
|
|
677
|
+
else
|
|
678
|
+
S = M;
|
|
679
|
+
if (S && S !== "" && S !== "/" && S !== M) {
|
|
680
|
+
if (n0(S.charCodeAt(S.length - 1)))
|
|
681
|
+
S = S.slice(0, -1);
|
|
682
|
+
}
|
|
683
|
+
if ($.unescape === true) {
|
|
684
|
+
if (Y)
|
|
685
|
+
Y = l0.removeBackslashes(Y);
|
|
686
|
+
if (S && I === true)
|
|
687
|
+
S = l0.removeBackslashes(S);
|
|
688
|
+
}
|
|
689
|
+
let l = { prefix: V, input: q, start: F, base: S, glob: Y, isBrace: H, isBracket: P, isGlob: N, isExtglob: G, isGlobstar: h, negated: g, negatedExtglob: i };
|
|
690
|
+
if ($.tokens === true) {
|
|
691
|
+
if (l.maxDepth = 0, !n0(w))
|
|
692
|
+
U.push(y);
|
|
693
|
+
l.tokens = U;
|
|
694
|
+
}
|
|
695
|
+
if ($.parts === true || $.tokens === true) {
|
|
696
|
+
let L;
|
|
697
|
+
for (let R = 0;R < z.length; R++) {
|
|
698
|
+
let p = L ? L + 1 : F, c = z[R], s = q.slice(p, c);
|
|
699
|
+
if ($.tokens) {
|
|
700
|
+
if (R === 0 && F !== 0)
|
|
701
|
+
U[R].isPrefix = true, U[R].value = V;
|
|
702
|
+
else
|
|
703
|
+
U[R].value = s;
|
|
704
|
+
r0(U[R]), l.maxDepth += U[R].depth;
|
|
705
|
+
}
|
|
706
|
+
if (R !== 0 || s !== "")
|
|
707
|
+
B.push(s);
|
|
708
|
+
L = c;
|
|
709
|
+
}
|
|
710
|
+
if (L && L + 1 < q.length) {
|
|
711
|
+
let R = q.slice(L + 1);
|
|
712
|
+
if (B.push(R), $.tokens)
|
|
713
|
+
U[U.length - 1].value = R, r0(U[U.length - 1]), l.maxDepth += U[U.length - 1].depth;
|
|
714
|
+
}
|
|
715
|
+
l.slashes = z, l.parts = B;
|
|
716
|
+
}
|
|
717
|
+
return l;
|
|
718
|
+
};
|
|
719
|
+
a0.exports = MZ;
|
|
720
|
+
});
|
|
721
|
+
var t0 = _((f8, e0) => {
|
|
722
|
+
var G1 = J1(), r = j1(), { MAX_LENGTH: M1, POSIX_REGEX_SOURCE: NZ, REGEX_NON_SPECIAL_CHARS: wZ, REGEX_SPECIAL_CHARS_BACKREF: yZ, REPLACEMENTS: o0 } = G1, IZ = (q, Z) => {
|
|
723
|
+
if (typeof Z.expandRange === "function")
|
|
724
|
+
return Z.expandRange(...q, Z);
|
|
725
|
+
q.sort();
|
|
726
|
+
let $ = `[${q.join("-")}]`;
|
|
727
|
+
try {
|
|
728
|
+
new RegExp($);
|
|
729
|
+
} catch (J) {
|
|
730
|
+
return q.map((j) => r.escapeRegex(j)).join("..");
|
|
731
|
+
}
|
|
732
|
+
return $;
|
|
733
|
+
}, $1 = (q, Z) => {
|
|
734
|
+
return `Missing ${q}: "${Z}" - use "\\\\${Z}" to match literal characters`;
|
|
735
|
+
}, E1 = (q, Z) => {
|
|
736
|
+
if (typeof q !== "string")
|
|
737
|
+
throw new TypeError("Expected a string");
|
|
738
|
+
q = o0[q] || q;
|
|
739
|
+
let $ = { ...Z }, J = typeof $.maxLength === "number" ? Math.min(M1, $.maxLength) : M1, j = q.length;
|
|
740
|
+
if (j > J)
|
|
741
|
+
throw new SyntaxError(`Input length: ${j}, exceeds maximum allowed length: ${J}`);
|
|
742
|
+
let z = { type: "bos", value: "", output: $.prepend || "" }, U = [z], B = $.capture ? "" : "?:", M = G1.globChars($.windows), K = G1.extglobChars(M), { DOT_LITERAL: F, PLUS_LITERAL: T, SLASH_LITERAL: H, ONE_CHAR: P, DOTS_SLASH: N, NO_DOT: G, NO_DOT_SLASH: h, NO_DOTS_SLASH: C, QMARK: I, QMARK_NO_DOT: g, STAR: i, START_ANCHOR: v } = M, x = (Q) => {
|
|
743
|
+
return `(${B}(?:(?!${v}${Q.dot ? N : F}).)*?)`;
|
|
744
|
+
}, m = $.dot ? "" : G, w = $.dot ? I : g, y = $.bash === true ? x($) : i;
|
|
745
|
+
if ($.capture)
|
|
746
|
+
y = `(${y})`;
|
|
747
|
+
if (typeof $.noext === "boolean")
|
|
748
|
+
$.noextglob = $.noext;
|
|
749
|
+
let W = { input: q, index: -1, start: 0, dot: $.dot === true, consumed: "", output: "", prefix: "", backtrack: false, negated: false, brackets: 0, braces: 0, parens: 0, quotes: 0, globstar: false, tokens: U };
|
|
750
|
+
q = r.removePrefix(q, W), j = q.length;
|
|
751
|
+
let d = [], b = [], S = [], V = z, Y, l = () => W.index === j - 1, L = W.peek = (Q = 1) => q[W.index + Q], R = W.advance = () => q[++W.index] || "", p = () => q.slice(W.index + 1), c = (Q = "", O = 0) => {
|
|
752
|
+
W.consumed += Q, W.index += O;
|
|
753
|
+
}, s = (Q) => {
|
|
754
|
+
W.output += Q.output != null ? Q.output : Q.value, c(Q.value);
|
|
755
|
+
}, Hq = () => {
|
|
756
|
+
let Q = 1;
|
|
757
|
+
while (L() === "!" && (L(2) !== "(" || L(3) === "?"))
|
|
758
|
+
R(), W.start++, Q++;
|
|
759
|
+
if (Q % 2 === 0)
|
|
760
|
+
return false;
|
|
761
|
+
return W.negated = true, W.start++, true;
|
|
762
|
+
}, W1 = (Q) => {
|
|
763
|
+
W[Q]++, S.push(Q);
|
|
764
|
+
}, e = (Q) => {
|
|
765
|
+
W[Q]--, S.pop();
|
|
766
|
+
}, f = (Q) => {
|
|
767
|
+
if (V.type === "globstar") {
|
|
768
|
+
let O = W.braces > 0 && (Q.type === "comma" || Q.type === "brace"), X = Q.extglob === true || d.length && (Q.type === "pipe" || Q.type === "paren");
|
|
769
|
+
if (Q.type !== "slash" && Q.type !== "paren" && !O && !X)
|
|
770
|
+
W.output = W.output.slice(0, -V.output.length), V.type = "star", V.value = "*", V.output = y, W.output += V.output;
|
|
771
|
+
}
|
|
772
|
+
if (d.length && Q.type !== "paren")
|
|
773
|
+
d[d.length - 1].inner += Q.value;
|
|
774
|
+
if (Q.value || Q.output)
|
|
775
|
+
s(Q);
|
|
776
|
+
if (V && V.type === "text" && Q.type === "text") {
|
|
777
|
+
V.output = (V.output || V.value) + Q.value, V.value += Q.value;
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
Q.prev = V, U.push(Q), V = Q;
|
|
781
|
+
}, z1 = (Q, O) => {
|
|
782
|
+
let X = { ...K[O], conditions: 1, inner: "" };
|
|
783
|
+
X.prev = V, X.parens = W.parens, X.output = W.output;
|
|
784
|
+
let D = ($.capture ? "(" : "") + X.open;
|
|
785
|
+
W1("parens"), f({ type: Q, value: O, output: W.output ? "" : P }), f({ type: "paren", extglob: true, value: R(), output: D }), d.push(X);
|
|
786
|
+
}, Cq = (Q) => {
|
|
787
|
+
let O = Q.close + ($.capture ? ")" : ""), X;
|
|
788
|
+
if (Q.type === "negate") {
|
|
789
|
+
let D = y;
|
|
790
|
+
if (Q.inner && Q.inner.length > 1 && Q.inner.includes("/"))
|
|
791
|
+
D = x($);
|
|
792
|
+
if (D !== y || l() || /^\)+$/.test(p()))
|
|
793
|
+
O = Q.close = `)$))${D}`;
|
|
794
|
+
if (Q.inner.includes("*") && (X = p()) && /^\.[^\\/.]+$/.test(X)) {
|
|
795
|
+
let E = E1(X, { ...Z, fastpaths: false }).output;
|
|
796
|
+
O = Q.close = `)${E})${D})`;
|
|
797
|
+
}
|
|
798
|
+
if (Q.prev.type === "bos")
|
|
799
|
+
W.negatedExtglob = true;
|
|
800
|
+
}
|
|
801
|
+
f({ type: "paren", extglob: true, value: Y, output: O }), e("parens");
|
|
802
|
+
};
|
|
803
|
+
if ($.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(q)) {
|
|
804
|
+
let Q = false, O = q.replace(yZ, (X, D, E, u, k, w1) => {
|
|
805
|
+
if (u === "\\")
|
|
806
|
+
return Q = true, X;
|
|
807
|
+
if (u === "?") {
|
|
808
|
+
if (D)
|
|
809
|
+
return D + u + (k ? I.repeat(k.length) : "");
|
|
810
|
+
if (w1 === 0)
|
|
811
|
+
return w + (k ? I.repeat(k.length) : "");
|
|
812
|
+
return I.repeat(E.length);
|
|
813
|
+
}
|
|
814
|
+
if (u === ".")
|
|
815
|
+
return F.repeat(E.length);
|
|
816
|
+
if (u === "*") {
|
|
817
|
+
if (D)
|
|
818
|
+
return D + u + (k ? y : "");
|
|
819
|
+
return y;
|
|
820
|
+
}
|
|
821
|
+
return D ? X : `\\${X}`;
|
|
822
|
+
});
|
|
823
|
+
if (Q === true)
|
|
824
|
+
if ($.unescape === true)
|
|
825
|
+
O = O.replace(/\\/g, "");
|
|
826
|
+
else
|
|
827
|
+
O = O.replace(/\\+/g, (X) => {
|
|
828
|
+
return X.length % 2 === 0 ? "\\\\" : X ? "\\" : "";
|
|
829
|
+
});
|
|
830
|
+
if (O === q && $.contains === true)
|
|
831
|
+
return W.output = q, W;
|
|
832
|
+
return W.output = r.wrapOutput(O, W, Z), W;
|
|
833
|
+
}
|
|
834
|
+
while (!l()) {
|
|
835
|
+
if (Y = R(), Y === "\0")
|
|
836
|
+
continue;
|
|
837
|
+
if (Y === "\\") {
|
|
838
|
+
let X = L();
|
|
839
|
+
if (X === "/" && $.bash !== true)
|
|
840
|
+
continue;
|
|
841
|
+
if (X === "." || X === ";")
|
|
842
|
+
continue;
|
|
843
|
+
if (!X) {
|
|
844
|
+
Y += "\\", f({ type: "text", value: Y });
|
|
845
|
+
continue;
|
|
846
|
+
}
|
|
847
|
+
let D = /^\\+/.exec(p()), E = 0;
|
|
848
|
+
if (D && D[0].length > 2) {
|
|
849
|
+
if (E = D[0].length, W.index += E, E % 2 !== 0)
|
|
850
|
+
Y += "\\";
|
|
851
|
+
}
|
|
852
|
+
if ($.unescape === true)
|
|
853
|
+
Y = R();
|
|
854
|
+
else
|
|
855
|
+
Y += R();
|
|
856
|
+
if (W.brackets === 0) {
|
|
857
|
+
f({ type: "text", value: Y });
|
|
858
|
+
continue;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
if (W.brackets > 0 && (Y !== "]" || V.value === "[" || V.value === "[^")) {
|
|
862
|
+
if ($.posix !== false && Y === ":") {
|
|
863
|
+
let X = V.value.slice(1);
|
|
864
|
+
if (X.includes("[")) {
|
|
865
|
+
if (V.posix = true, X.includes(":")) {
|
|
866
|
+
let D = V.value.lastIndexOf("["), E = V.value.slice(0, D), u = V.value.slice(D + 2), k = NZ[u];
|
|
867
|
+
if (k) {
|
|
868
|
+
if (V.value = E + k, W.backtrack = true, R(), !z.output && U.indexOf(V) === 1)
|
|
869
|
+
z.output = P;
|
|
870
|
+
continue;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
if (Y === "[" && L() !== ":" || Y === "-" && L() === "]")
|
|
876
|
+
Y = `\\${Y}`;
|
|
877
|
+
if (Y === "]" && (V.value === "[" || V.value === "[^"))
|
|
878
|
+
Y = `\\${Y}`;
|
|
879
|
+
if ($.posix === true && Y === "!" && V.value === "[")
|
|
880
|
+
Y = "^";
|
|
881
|
+
V.value += Y, s({ value: Y });
|
|
882
|
+
continue;
|
|
883
|
+
}
|
|
884
|
+
if (W.quotes === 1 && Y !== '"') {
|
|
885
|
+
Y = r.escapeRegex(Y), V.value += Y, s({ value: Y });
|
|
886
|
+
continue;
|
|
887
|
+
}
|
|
888
|
+
if (Y === '"') {
|
|
889
|
+
if (W.quotes = W.quotes === 1 ? 0 : 1, $.keepQuotes === true)
|
|
890
|
+
f({ type: "text", value: Y });
|
|
891
|
+
continue;
|
|
892
|
+
}
|
|
893
|
+
if (Y === "(") {
|
|
894
|
+
W1("parens"), f({ type: "paren", value: Y });
|
|
895
|
+
continue;
|
|
896
|
+
}
|
|
897
|
+
if (Y === ")") {
|
|
898
|
+
if (W.parens === 0 && $.strictBrackets === true)
|
|
899
|
+
throw new SyntaxError($1("opening", "("));
|
|
900
|
+
let X = d[d.length - 1];
|
|
901
|
+
if (X && W.parens === X.parens + 1) {
|
|
902
|
+
Cq(d.pop());
|
|
903
|
+
continue;
|
|
904
|
+
}
|
|
905
|
+
f({ type: "paren", value: Y, output: W.parens ? ")" : "\\)" }), e("parens");
|
|
906
|
+
continue;
|
|
907
|
+
}
|
|
908
|
+
if (Y === "[") {
|
|
909
|
+
if ($.nobracket === true || !p().includes("]")) {
|
|
910
|
+
if ($.nobracket !== true && $.strictBrackets === true)
|
|
911
|
+
throw new SyntaxError($1("closing", "]"));
|
|
912
|
+
Y = `\\${Y}`;
|
|
913
|
+
} else
|
|
914
|
+
W1("brackets");
|
|
915
|
+
f({ type: "bracket", value: Y });
|
|
916
|
+
continue;
|
|
917
|
+
}
|
|
918
|
+
if (Y === "]") {
|
|
919
|
+
if ($.nobracket === true || V && V.type === "bracket" && V.value.length === 1) {
|
|
920
|
+
f({ type: "text", value: Y, output: `\\${Y}` });
|
|
921
|
+
continue;
|
|
922
|
+
}
|
|
923
|
+
if (W.brackets === 0) {
|
|
924
|
+
if ($.strictBrackets === true)
|
|
925
|
+
throw new SyntaxError($1("opening", "["));
|
|
926
|
+
f({ type: "text", value: Y, output: `\\${Y}` });
|
|
927
|
+
continue;
|
|
928
|
+
}
|
|
929
|
+
e("brackets");
|
|
930
|
+
let X = V.value.slice(1);
|
|
931
|
+
if (V.posix !== true && X[0] === "^" && !X.includes("/"))
|
|
932
|
+
Y = `/${Y}`;
|
|
933
|
+
if (V.value += Y, s({ value: Y }), $.literalBrackets === false || r.hasRegexChars(X))
|
|
934
|
+
continue;
|
|
935
|
+
let D = r.escapeRegex(V.value);
|
|
936
|
+
if (W.output = W.output.slice(0, -V.value.length), $.literalBrackets === true) {
|
|
937
|
+
W.output += D, V.value = D;
|
|
938
|
+
continue;
|
|
939
|
+
}
|
|
940
|
+
V.value = `(${B}${D}|${V.value})`, W.output += V.value;
|
|
941
|
+
continue;
|
|
942
|
+
}
|
|
943
|
+
if (Y === "{" && $.nobrace !== true) {
|
|
944
|
+
W1("braces");
|
|
945
|
+
let X = { type: "brace", value: Y, output: "(", outputIndex: W.output.length, tokensIndex: W.tokens.length };
|
|
946
|
+
b.push(X), f(X);
|
|
947
|
+
continue;
|
|
948
|
+
}
|
|
949
|
+
if (Y === "}") {
|
|
950
|
+
let X = b[b.length - 1];
|
|
951
|
+
if ($.nobrace === true || !X) {
|
|
952
|
+
f({ type: "text", value: Y, output: Y });
|
|
953
|
+
continue;
|
|
954
|
+
}
|
|
955
|
+
let D = ")";
|
|
956
|
+
if (X.dots === true) {
|
|
957
|
+
let E = U.slice(), u = [];
|
|
958
|
+
for (let k = E.length - 1;k >= 0; k--) {
|
|
959
|
+
if (U.pop(), E[k].type === "brace")
|
|
960
|
+
break;
|
|
961
|
+
if (E[k].type !== "dots")
|
|
962
|
+
u.unshift(E[k].value);
|
|
963
|
+
}
|
|
964
|
+
D = IZ(u, $), W.backtrack = true;
|
|
965
|
+
}
|
|
966
|
+
if (X.comma !== true && X.dots !== true) {
|
|
967
|
+
let E = W.output.slice(0, X.outputIndex), u = W.tokens.slice(X.tokensIndex);
|
|
968
|
+
X.value = X.output = "\\{", Y = D = "\\}", W.output = E;
|
|
969
|
+
for (let k of u)
|
|
970
|
+
W.output += k.output || k.value;
|
|
971
|
+
}
|
|
972
|
+
f({ type: "brace", value: Y, output: D }), e("braces"), b.pop();
|
|
973
|
+
continue;
|
|
974
|
+
}
|
|
975
|
+
if (Y === "|") {
|
|
976
|
+
if (d.length > 0)
|
|
977
|
+
d[d.length - 1].conditions++;
|
|
978
|
+
f({ type: "text", value: Y });
|
|
979
|
+
continue;
|
|
980
|
+
}
|
|
981
|
+
if (Y === ",") {
|
|
982
|
+
let X = Y, D = b[b.length - 1];
|
|
983
|
+
if (D && S[S.length - 1] === "braces")
|
|
984
|
+
D.comma = true, X = "|";
|
|
985
|
+
f({ type: "comma", value: Y, output: X });
|
|
986
|
+
continue;
|
|
987
|
+
}
|
|
988
|
+
if (Y === "/") {
|
|
989
|
+
if (V.type === "dot" && W.index === W.start + 1) {
|
|
990
|
+
W.start = W.index + 1, W.consumed = "", W.output = "", U.pop(), V = z;
|
|
991
|
+
continue;
|
|
992
|
+
}
|
|
993
|
+
f({ type: "slash", value: Y, output: H });
|
|
994
|
+
continue;
|
|
995
|
+
}
|
|
996
|
+
if (Y === ".") {
|
|
997
|
+
if (W.braces > 0 && V.type === "dot") {
|
|
998
|
+
if (V.value === ".")
|
|
999
|
+
V.output = F;
|
|
1000
|
+
let X = b[b.length - 1];
|
|
1001
|
+
V.type = "dots", V.output += Y, V.value += Y, X.dots = true;
|
|
1002
|
+
continue;
|
|
1003
|
+
}
|
|
1004
|
+
if (W.braces + W.parens === 0 && V.type !== "bos" && V.type !== "slash") {
|
|
1005
|
+
f({ type: "text", value: Y, output: F });
|
|
1006
|
+
continue;
|
|
1007
|
+
}
|
|
1008
|
+
f({ type: "dot", value: Y, output: F });
|
|
1009
|
+
continue;
|
|
1010
|
+
}
|
|
1011
|
+
if (Y === "?") {
|
|
1012
|
+
if (!(V && V.value === "(") && $.noextglob !== true && L() === "(" && L(2) !== "?") {
|
|
1013
|
+
z1("qmark", Y);
|
|
1014
|
+
continue;
|
|
1015
|
+
}
|
|
1016
|
+
if (V && V.type === "paren") {
|
|
1017
|
+
let D = L(), E = Y;
|
|
1018
|
+
if (V.value === "(" && !/[!=<:]/.test(D) || D === "<" && !/<([!=]|\w+>)/.test(p()))
|
|
1019
|
+
E = `\\${Y}`;
|
|
1020
|
+
f({ type: "text", value: Y, output: E });
|
|
1021
|
+
continue;
|
|
1022
|
+
}
|
|
1023
|
+
if ($.dot !== true && (V.type === "slash" || V.type === "bos")) {
|
|
1024
|
+
f({ type: "qmark", value: Y, output: g });
|
|
1025
|
+
continue;
|
|
1026
|
+
}
|
|
1027
|
+
f({ type: "qmark", value: Y, output: I });
|
|
1028
|
+
continue;
|
|
1029
|
+
}
|
|
1030
|
+
if (Y === "!") {
|
|
1031
|
+
if ($.noextglob !== true && L() === "(") {
|
|
1032
|
+
if (L(2) !== "?" || !/[!=<:]/.test(L(3))) {
|
|
1033
|
+
z1("negate", Y);
|
|
1034
|
+
continue;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
if ($.nonegate !== true && W.index === 0) {
|
|
1038
|
+
Hq();
|
|
1039
|
+
continue;
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
if (Y === "+") {
|
|
1043
|
+
if ($.noextglob !== true && L() === "(" && L(2) !== "?") {
|
|
1044
|
+
z1("plus", Y);
|
|
1045
|
+
continue;
|
|
1046
|
+
}
|
|
1047
|
+
if (V && V.value === "(" || $.regex === false) {
|
|
1048
|
+
f({ type: "plus", value: Y, output: T });
|
|
1049
|
+
continue;
|
|
1050
|
+
}
|
|
1051
|
+
if (V && (V.type === "bracket" || V.type === "paren" || V.type === "brace") || W.parens > 0) {
|
|
1052
|
+
f({ type: "plus", value: Y });
|
|
1053
|
+
continue;
|
|
1054
|
+
}
|
|
1055
|
+
f({ type: "plus", value: T });
|
|
1056
|
+
continue;
|
|
1057
|
+
}
|
|
1058
|
+
if (Y === "@") {
|
|
1059
|
+
if ($.noextglob !== true && L() === "(" && L(2) !== "?") {
|
|
1060
|
+
f({ type: "at", extglob: true, value: Y, output: "" });
|
|
1061
|
+
continue;
|
|
1062
|
+
}
|
|
1063
|
+
f({ type: "text", value: Y });
|
|
1064
|
+
continue;
|
|
1065
|
+
}
|
|
1066
|
+
if (Y !== "*") {
|
|
1067
|
+
if (Y === "$" || Y === "^")
|
|
1068
|
+
Y = `\\${Y}`;
|
|
1069
|
+
let X = wZ.exec(p());
|
|
1070
|
+
if (X)
|
|
1071
|
+
Y += X[0], W.index += X[0].length;
|
|
1072
|
+
f({ type: "text", value: Y });
|
|
1073
|
+
continue;
|
|
1074
|
+
}
|
|
1075
|
+
if (V && (V.type === "globstar" || V.star === true)) {
|
|
1076
|
+
V.type = "star", V.star = true, V.value += Y, V.output = y, W.backtrack = true, W.globstar = true, c(Y);
|
|
1077
|
+
continue;
|
|
1078
|
+
}
|
|
1079
|
+
let Q = p();
|
|
1080
|
+
if ($.noextglob !== true && /^\([^?]/.test(Q)) {
|
|
1081
|
+
z1("star", Y);
|
|
1082
|
+
continue;
|
|
1083
|
+
}
|
|
1084
|
+
if (V.type === "star") {
|
|
1085
|
+
if ($.noglobstar === true) {
|
|
1086
|
+
c(Y);
|
|
1087
|
+
continue;
|
|
1088
|
+
}
|
|
1089
|
+
let X = V.prev, D = X.prev, E = X.type === "slash" || X.type === "bos", u = D && (D.type === "star" || D.type === "globstar");
|
|
1090
|
+
if ($.bash === true && (!E || Q[0] && Q[0] !== "/")) {
|
|
1091
|
+
f({ type: "star", value: Y, output: "" });
|
|
1092
|
+
continue;
|
|
1093
|
+
}
|
|
1094
|
+
let k = W.braces > 0 && (X.type === "comma" || X.type === "brace"), w1 = d.length && (X.type === "pipe" || X.type === "paren");
|
|
1095
|
+
if (!E && X.type !== "paren" && !k && !w1) {
|
|
1096
|
+
f({ type: "star", value: Y, output: "" });
|
|
1097
|
+
continue;
|
|
1098
|
+
}
|
|
1099
|
+
while (Q.slice(0, 3) === "/**") {
|
|
1100
|
+
let U1 = q[W.index + 4];
|
|
1101
|
+
if (U1 && U1 !== "/")
|
|
1102
|
+
break;
|
|
1103
|
+
Q = Q.slice(3), c("/**", 3);
|
|
1104
|
+
}
|
|
1105
|
+
if (X.type === "bos" && l()) {
|
|
1106
|
+
V.type = "globstar", V.value += Y, V.output = x($), W.output = V.output, W.globstar = true, c(Y);
|
|
1107
|
+
continue;
|
|
1108
|
+
}
|
|
1109
|
+
if (X.type === "slash" && X.prev.type !== "bos" && !u && l()) {
|
|
1110
|
+
W.output = W.output.slice(0, -(X.output + V.output).length), X.output = `(?:${X.output}`, V.type = "globstar", V.output = x($) + ($.strictSlashes ? ")" : "|$)"), V.value += Y, W.globstar = true, W.output += X.output + V.output, c(Y);
|
|
1111
|
+
continue;
|
|
1112
|
+
}
|
|
1113
|
+
if (X.type === "slash" && X.prev.type !== "bos" && Q[0] === "/") {
|
|
1114
|
+
let U1 = Q[1] !== undefined ? "|$" : "";
|
|
1115
|
+
W.output = W.output.slice(0, -(X.output + V.output).length), X.output = `(?:${X.output}`, V.type = "globstar", V.output = `${x($)}${H}|${H}${U1})`, V.value += Y, W.output += X.output + V.output, W.globstar = true, c(Y + R()), f({ type: "slash", value: "/", output: "" });
|
|
1116
|
+
continue;
|
|
1117
|
+
}
|
|
1118
|
+
if (X.type === "bos" && Q[0] === "/") {
|
|
1119
|
+
V.type = "globstar", V.value += Y, V.output = `(?:^|${H}|${x($)}${H})`, W.output = V.output, W.globstar = true, c(Y + R()), f({ type: "slash", value: "/", output: "" });
|
|
1120
|
+
continue;
|
|
1121
|
+
}
|
|
1122
|
+
W.output = W.output.slice(0, -V.output.length), V.type = "globstar", V.output = x($), V.value += Y, W.output += V.output, W.globstar = true, c(Y);
|
|
1123
|
+
continue;
|
|
1124
|
+
}
|
|
1125
|
+
let O = { type: "star", value: Y, output: y };
|
|
1126
|
+
if ($.bash === true) {
|
|
1127
|
+
if (O.output = ".*?", V.type === "bos" || V.type === "slash")
|
|
1128
|
+
O.output = m + O.output;
|
|
1129
|
+
f(O);
|
|
1130
|
+
continue;
|
|
1131
|
+
}
|
|
1132
|
+
if (V && (V.type === "bracket" || V.type === "paren") && $.regex === true) {
|
|
1133
|
+
O.output = Y, f(O);
|
|
1134
|
+
continue;
|
|
1135
|
+
}
|
|
1136
|
+
if (W.index === W.start || V.type === "slash" || V.type === "dot") {
|
|
1137
|
+
if (V.type === "dot")
|
|
1138
|
+
W.output += h, V.output += h;
|
|
1139
|
+
else if ($.dot === true)
|
|
1140
|
+
W.output += C, V.output += C;
|
|
1141
|
+
else
|
|
1142
|
+
W.output += m, V.output += m;
|
|
1143
|
+
if (L() !== "*")
|
|
1144
|
+
W.output += P, V.output += P;
|
|
1145
|
+
}
|
|
1146
|
+
f(O);
|
|
1147
|
+
}
|
|
1148
|
+
while (W.brackets > 0) {
|
|
1149
|
+
if ($.strictBrackets === true)
|
|
1150
|
+
throw new SyntaxError($1("closing", "]"));
|
|
1151
|
+
W.output = r.escapeLast(W.output, "["), e("brackets");
|
|
1152
|
+
}
|
|
1153
|
+
while (W.parens > 0) {
|
|
1154
|
+
if ($.strictBrackets === true)
|
|
1155
|
+
throw new SyntaxError($1("closing", ")"));
|
|
1156
|
+
W.output = r.escapeLast(W.output, "("), e("parens");
|
|
1157
|
+
}
|
|
1158
|
+
while (W.braces > 0) {
|
|
1159
|
+
if ($.strictBrackets === true)
|
|
1160
|
+
throw new SyntaxError($1("closing", "}"));
|
|
1161
|
+
W.output = r.escapeLast(W.output, "{"), e("braces");
|
|
1162
|
+
}
|
|
1163
|
+
if ($.strictSlashes !== true && (V.type === "star" || V.type === "bracket"))
|
|
1164
|
+
f({ type: "maybe_slash", value: "", output: `${H}?` });
|
|
1165
|
+
if (W.backtrack === true) {
|
|
1166
|
+
W.output = "";
|
|
1167
|
+
for (let Q of W.tokens)
|
|
1168
|
+
if (W.output += Q.output != null ? Q.output : Q.value, Q.suffix)
|
|
1169
|
+
W.output += Q.suffix;
|
|
1170
|
+
}
|
|
1171
|
+
return W;
|
|
1172
|
+
};
|
|
1173
|
+
E1.fastpaths = (q, Z) => {
|
|
1174
|
+
let $ = { ...Z }, J = typeof $.maxLength === "number" ? Math.min(M1, $.maxLength) : M1, j = q.length;
|
|
1175
|
+
if (j > J)
|
|
1176
|
+
throw new SyntaxError(`Input length: ${j}, exceeds maximum allowed length: ${J}`);
|
|
1177
|
+
q = o0[q] || q;
|
|
1178
|
+
let { DOT_LITERAL: z, SLASH_LITERAL: U, ONE_CHAR: B, DOTS_SLASH: M, NO_DOT: K, NO_DOTS: F, NO_DOTS_SLASH: T, STAR: H, START_ANCHOR: P } = G1.globChars($.windows), N = $.dot ? F : K, G = $.dot ? T : K, h = $.capture ? "" : "?:", C = { negated: false, prefix: "" }, I = $.bash === true ? ".*?" : H;
|
|
1179
|
+
if ($.capture)
|
|
1180
|
+
I = `(${I})`;
|
|
1181
|
+
let g = (m) => {
|
|
1182
|
+
if (m.noglobstar === true)
|
|
1183
|
+
return I;
|
|
1184
|
+
return `(${h}(?:(?!${P}${m.dot ? M : z}).)*?)`;
|
|
1185
|
+
}, i = (m) => {
|
|
1186
|
+
switch (m) {
|
|
1187
|
+
case "*":
|
|
1188
|
+
return `${N}${B}${I}`;
|
|
1189
|
+
case ".*":
|
|
1190
|
+
return `${z}${B}${I}`;
|
|
1191
|
+
case "*.*":
|
|
1192
|
+
return `${N}${I}${z}${B}${I}`;
|
|
1193
|
+
case "*/*":
|
|
1194
|
+
return `${N}${I}${U}${B}${G}${I}`;
|
|
1195
|
+
case "**":
|
|
1196
|
+
return N + g($);
|
|
1197
|
+
case "**/*":
|
|
1198
|
+
return `(?:${N}${g($)}${U})?${G}${B}${I}`;
|
|
1199
|
+
case "**/*.*":
|
|
1200
|
+
return `(?:${N}${g($)}${U})?${G}${I}${z}${B}${I}`;
|
|
1201
|
+
case "**/.*":
|
|
1202
|
+
return `(?:${N}${g($)}${U})?${z}${B}${I}`;
|
|
1203
|
+
default: {
|
|
1204
|
+
let w = /^(.*?)\.(\w+)$/.exec(m);
|
|
1205
|
+
if (!w)
|
|
1206
|
+
return;
|
|
1207
|
+
let y = i(w[1]);
|
|
1208
|
+
if (!y)
|
|
1209
|
+
return;
|
|
1210
|
+
return y + z + w[2];
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
}, v = r.removePrefix(q, C), x = i(v);
|
|
1214
|
+
if (x && $.strictSlashes !== true)
|
|
1215
|
+
x += `${U}?`;
|
|
1216
|
+
return x;
|
|
1217
|
+
};
|
|
1218
|
+
e0.exports = E1;
|
|
1219
|
+
});
|
|
1220
|
+
var Zq = _((H8, $q) => {
|
|
1221
|
+
var DZ = s0(), S1 = t0(), qq = j1(), fZ = J1(), HZ = (q) => q && typeof q === "object" && !Array.isArray(q), A = (q, Z, $ = false) => {
|
|
1222
|
+
if (Array.isArray(q)) {
|
|
1223
|
+
let F = q.map((H) => A(H, Z, $));
|
|
1224
|
+
return (H) => {
|
|
1225
|
+
for (let P of F) {
|
|
1226
|
+
let N = P(H);
|
|
1227
|
+
if (N)
|
|
1228
|
+
return N;
|
|
1229
|
+
}
|
|
1230
|
+
return false;
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
let J = HZ(q) && q.tokens && q.input;
|
|
1234
|
+
if (q === "" || typeof q !== "string" && !J)
|
|
1235
|
+
throw new TypeError("Expected pattern to be a non-empty string");
|
|
1236
|
+
let j = Z || {}, z = j.windows, U = J ? A.compileRe(q, Z) : A.makeRe(q, Z, false, true), B = U.state;
|
|
1237
|
+
delete U.state;
|
|
1238
|
+
let M = () => false;
|
|
1239
|
+
if (j.ignore) {
|
|
1240
|
+
let F = { ...Z, ignore: null, onMatch: null, onResult: null };
|
|
1241
|
+
M = A(j.ignore, F, $);
|
|
1242
|
+
}
|
|
1243
|
+
let K = (F, T = false) => {
|
|
1244
|
+
let { isMatch: H, match: P, output: N } = A.test(F, U, Z, { glob: q, posix: z }), G = { glob: q, state: B, regex: U, posix: z, input: F, output: N, match: P, isMatch: H };
|
|
1245
|
+
if (typeof j.onResult === "function")
|
|
1246
|
+
j.onResult(G);
|
|
1247
|
+
if (H === false)
|
|
1248
|
+
return G.isMatch = false, T ? G : false;
|
|
1249
|
+
if (M(F)) {
|
|
1250
|
+
if (typeof j.onIgnore === "function")
|
|
1251
|
+
j.onIgnore(G);
|
|
1252
|
+
return G.isMatch = false, T ? G : false;
|
|
1253
|
+
}
|
|
1254
|
+
if (typeof j.onMatch === "function")
|
|
1255
|
+
j.onMatch(G);
|
|
1256
|
+
return T ? G : true;
|
|
1257
|
+
};
|
|
1258
|
+
if ($)
|
|
1259
|
+
K.state = B;
|
|
1260
|
+
return K;
|
|
1261
|
+
};
|
|
1262
|
+
A.test = (q, Z, $, { glob: J, posix: j } = {}) => {
|
|
1263
|
+
if (typeof q !== "string")
|
|
1264
|
+
throw new TypeError("Expected input to be a string");
|
|
1265
|
+
if (q === "")
|
|
1266
|
+
return { isMatch: false, output: "" };
|
|
1267
|
+
let z = $ || {}, U = z.format || (j ? qq.toPosixSlashes : null), B = q === J, M = B && U ? U(q) : q;
|
|
1268
|
+
if (B === false)
|
|
1269
|
+
M = U ? U(q) : q, B = M === J;
|
|
1270
|
+
if (B === false || z.capture === true)
|
|
1271
|
+
if (z.matchBase === true || z.basename === true)
|
|
1272
|
+
B = A.matchBase(q, Z, $, j);
|
|
1273
|
+
else
|
|
1274
|
+
B = Z.exec(M);
|
|
1275
|
+
return { isMatch: Boolean(B), match: B, output: M };
|
|
1276
|
+
};
|
|
1277
|
+
A.matchBase = (q, Z, $) => {
|
|
1278
|
+
return (Z instanceof RegExp ? Z : A.makeRe(Z, $)).test(qq.basename(q));
|
|
1279
|
+
};
|
|
1280
|
+
A.isMatch = (q, Z, $) => A(Z, $)(q);
|
|
1281
|
+
A.parse = (q, Z) => {
|
|
1282
|
+
if (Array.isArray(q))
|
|
1283
|
+
return q.map(($) => A.parse($, Z));
|
|
1284
|
+
return S1(q, { ...Z, fastpaths: false });
|
|
1285
|
+
};
|
|
1286
|
+
A.scan = (q, Z) => DZ(q, Z);
|
|
1287
|
+
A.compileRe = (q, Z, $ = false, J = false) => {
|
|
1288
|
+
if ($ === true)
|
|
1289
|
+
return q.output;
|
|
1290
|
+
let j = Z || {}, z = j.contains ? "" : "^", U = j.contains ? "" : "$", B = `${z}(?:${q.output})${U}`;
|
|
1291
|
+
if (q && q.negated === true)
|
|
1292
|
+
B = `^(?!${B}).*$`;
|
|
1293
|
+
let M = A.toRegex(B, Z);
|
|
1294
|
+
if (J === true)
|
|
1295
|
+
M.state = q;
|
|
1296
|
+
return M;
|
|
1297
|
+
};
|
|
1298
|
+
A.makeRe = (q, Z = {}, $ = false, J = false) => {
|
|
1299
|
+
if (!q || typeof q !== "string")
|
|
1300
|
+
throw new TypeError("Expected a non-empty string");
|
|
1301
|
+
let j = { negated: false, fastpaths: true };
|
|
1302
|
+
if (Z.fastpaths !== false && (q[0] === "." || q[0] === "*"))
|
|
1303
|
+
j.output = S1.fastpaths(q, Z);
|
|
1304
|
+
if (!j.output)
|
|
1305
|
+
j = S1(q, Z);
|
|
1306
|
+
return A.compileRe(j, Z, $, J);
|
|
1307
|
+
};
|
|
1308
|
+
A.toRegex = (q, Z) => {
|
|
1309
|
+
try {
|
|
1310
|
+
let $ = Z || {};
|
|
1311
|
+
return new RegExp(q, $.flags || ($.nocase ? "i" : ""));
|
|
1312
|
+
} catch ($) {
|
|
1313
|
+
if (Z && Z.debug === true)
|
|
1314
|
+
throw $;
|
|
1315
|
+
return /$^/;
|
|
1316
|
+
}
|
|
1317
|
+
};
|
|
1318
|
+
A.constants = fZ;
|
|
1319
|
+
$q.exports = A;
|
|
1320
|
+
});
|
|
1321
|
+
var Y1 = _((C8, Vq) => {
|
|
1322
|
+
var Jq = Zq(), CZ = j1();
|
|
1323
|
+
function jq(q, Z, $ = false) {
|
|
1324
|
+
if (Z && (Z.windows === null || Z.windows === undefined))
|
|
1325
|
+
Z = { ...Z, windows: CZ.isWindows() };
|
|
1326
|
+
return Jq(q, Z, $);
|
|
1327
|
+
}
|
|
1328
|
+
Object.assign(jq, Jq);
|
|
1329
|
+
Vq.exports = jq;
|
|
1330
|
+
});
|
|
1331
|
+
var Bq = _((Uq) => {
|
|
1332
|
+
Object.defineProperty(Uq, "__esModule", { value: true });
|
|
1333
|
+
Uq.Builder = undefined;
|
|
1334
|
+
var LZ = import.meta.require("path"), Yq = v0(), Wq = null;
|
|
1335
|
+
try {
|
|
1336
|
+
import.meta.require.resolve("picomatch"), Wq = Y1();
|
|
1337
|
+
} catch (q) {
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
class zq {
|
|
1341
|
+
globCache = {};
|
|
1342
|
+
options = { maxDepth: 1 / 0, suppressErrors: true, pathSeparator: LZ.sep, filters: [] };
|
|
1343
|
+
globFunction;
|
|
1344
|
+
constructor(q) {
|
|
1345
|
+
this.options = { ...this.options, ...q }, this.globFunction = this.options.globFunction;
|
|
1346
|
+
}
|
|
1347
|
+
group() {
|
|
1348
|
+
return this.options.group = true, this;
|
|
1349
|
+
}
|
|
1350
|
+
withPathSeparator(q) {
|
|
1351
|
+
return this.options.pathSeparator = q, this;
|
|
1352
|
+
}
|
|
1353
|
+
withBasePath() {
|
|
1354
|
+
return this.options.includeBasePath = true, this;
|
|
1355
|
+
}
|
|
1356
|
+
withRelativePaths() {
|
|
1357
|
+
return this.options.relativePaths = true, this;
|
|
1358
|
+
}
|
|
1359
|
+
withDirs() {
|
|
1360
|
+
return this.options.includeDirs = true, this;
|
|
1361
|
+
}
|
|
1362
|
+
withMaxDepth(q) {
|
|
1363
|
+
return this.options.maxDepth = q, this;
|
|
1364
|
+
}
|
|
1365
|
+
withMaxFiles(q) {
|
|
1366
|
+
return this.options.maxFiles = q, this;
|
|
1367
|
+
}
|
|
1368
|
+
withFullPaths() {
|
|
1369
|
+
return this.options.resolvePaths = true, this.options.includeBasePath = true, this;
|
|
1370
|
+
}
|
|
1371
|
+
withErrors() {
|
|
1372
|
+
return this.options.suppressErrors = false, this;
|
|
1373
|
+
}
|
|
1374
|
+
withSymlinks({ resolvePaths: q = true } = {}) {
|
|
1375
|
+
return this.options.resolveSymlinks = true, this.options.useRealPaths = q, this.withFullPaths();
|
|
1376
|
+
}
|
|
1377
|
+
withAbortSignal(q) {
|
|
1378
|
+
return this.options.signal = q, this;
|
|
1379
|
+
}
|
|
1380
|
+
normalize() {
|
|
1381
|
+
return this.options.normalizePath = true, this;
|
|
1382
|
+
}
|
|
1383
|
+
filter(q) {
|
|
1384
|
+
return this.options.filters.push(q), this;
|
|
1385
|
+
}
|
|
1386
|
+
onlyDirs() {
|
|
1387
|
+
return this.options.excludeFiles = true, this.options.includeDirs = true, this;
|
|
1388
|
+
}
|
|
1389
|
+
exclude(q) {
|
|
1390
|
+
return this.options.exclude = q, this;
|
|
1391
|
+
}
|
|
1392
|
+
onlyCounts() {
|
|
1393
|
+
return this.options.onlyCounts = true, this;
|
|
1394
|
+
}
|
|
1395
|
+
crawl(q) {
|
|
1396
|
+
return new Yq.APIBuilder(q || ".", this.options);
|
|
1397
|
+
}
|
|
1398
|
+
withGlobFunction(q) {
|
|
1399
|
+
return this.globFunction = q, this;
|
|
1400
|
+
}
|
|
1401
|
+
crawlWithOptions(q, Z) {
|
|
1402
|
+
return this.options = { ...this.options, ...Z }, new Yq.APIBuilder(q || ".", this.options);
|
|
1403
|
+
}
|
|
1404
|
+
glob(...q) {
|
|
1405
|
+
if (this.globFunction)
|
|
1406
|
+
return this.globWithOptions(q);
|
|
1407
|
+
return this.globWithOptions(q, ...[{ dot: true }]);
|
|
1408
|
+
}
|
|
1409
|
+
globWithOptions(q, ...Z) {
|
|
1410
|
+
let $ = this.globFunction || Wq;
|
|
1411
|
+
if (!$)
|
|
1412
|
+
throw new Error("Please specify a glob function to use glob matching.");
|
|
1413
|
+
var J = this.globCache[q.join("\0")];
|
|
1414
|
+
if (!J)
|
|
1415
|
+
J = $(q, ...Z), this.globCache[q.join("\0")] = J;
|
|
1416
|
+
return this.options.filters.push((j) => J(j)), this;
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
Uq.Builder = zq;
|
|
1420
|
+
});
|
|
1421
|
+
var Fq = _((Qq) => {
|
|
1422
|
+
Object.defineProperty(Qq, "__esModule", { value: true });
|
|
1423
|
+
});
|
|
1424
|
+
var Kq = _((a) => {
|
|
1425
|
+
var PZ = a && a.__createBinding || (Object.create ? function(q, Z, $, J) {
|
|
1426
|
+
if (J === undefined)
|
|
1427
|
+
J = $;
|
|
1428
|
+
var j = Object.getOwnPropertyDescriptor(Z, $);
|
|
1429
|
+
if (!j || ("get" in j ? !Z.__esModule : j.writable || j.configurable))
|
|
1430
|
+
j = { enumerable: true, get: function() {
|
|
1431
|
+
return Z[$];
|
|
1432
|
+
} };
|
|
1433
|
+
Object.defineProperty(q, J, j);
|
|
1434
|
+
} : function(q, Z, $, J) {
|
|
1435
|
+
if (J === undefined)
|
|
1436
|
+
J = $;
|
|
1437
|
+
q[J] = Z[$];
|
|
1438
|
+
}), TZ = a && a.__exportStar || function(q, Z) {
|
|
1439
|
+
for (var $ in q)
|
|
1440
|
+
if ($ !== "default" && !Object.prototype.hasOwnProperty.call(Z, $))
|
|
1441
|
+
PZ(Z, q, $);
|
|
1442
|
+
};
|
|
1443
|
+
Object.defineProperty(a, "__esModule", { value: true });
|
|
1444
|
+
a.fdir = undefined;
|
|
1445
|
+
var OZ = Bq();
|
|
1446
|
+
Object.defineProperty(a, "fdir", { enumerable: true, get: function() {
|
|
1447
|
+
return OZ.Builder;
|
|
1448
|
+
} });
|
|
1449
|
+
TZ(Fq(), a);
|
|
1450
|
+
});
|
|
1451
|
+
async function k1(q, Z) {
|
|
1452
|
+
await Bun.write(q, Z);
|
|
1453
|
+
}
|
|
1454
|
+
async function y1(q) {
|
|
1455
|
+
let Z = q ?? Z1.root, $ = await _q(Z, { withFileTypes: true }), J = await Promise.all($.map((j) => {
|
|
1456
|
+
let z = g1(Z, j.name);
|
|
1457
|
+
return j.isDirectory() ? y1(z) : z;
|
|
1458
|
+
}));
|
|
1459
|
+
return Array.prototype.concat(...J).filter((j) => Eq(j) === ".ts");
|
|
1460
|
+
}
|
|
1461
|
+
async function v1(q) {
|
|
1462
|
+
try {
|
|
1463
|
+
let Z = q?.tsconfigPath || g1(q?.root ?? Sq.cwd(), "tsconfig.json"), $ = await Rq(Z, "utf-8");
|
|
1464
|
+
return JSON.parse($).compilerOptions?.isolatedDeclarations === true;
|
|
1465
|
+
} catch (Z) {
|
|
1466
|
+
return console.log("Error reading tsconfig.json:", Z), false;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
function m1(q) {
|
|
1470
|
+
let J = q.split("\n").map((j) => {
|
|
1471
|
+
if (j = j.trimEnd(), j.startsWith("export interface") || j.startsWith("export type")) {
|
|
1472
|
+
let z = j.split("{");
|
|
1473
|
+
if (z.length > 1)
|
|
1474
|
+
return `${z[0].trim()} {${z[1]}`;
|
|
1475
|
+
}
|
|
1476
|
+
if (j.endsWith(";"))
|
|
1477
|
+
j = j.slice(0, -1);
|
|
1478
|
+
return j;
|
|
1479
|
+
}).join("\n");
|
|
1480
|
+
return J = J.replace(/\n{3,}/g, "\n\n"), J = J.replace(/\/\*\*\n([^*]*)(\n \*\/)/g, (j, z) => {
|
|
1481
|
+
return `/**\n${z.split("\n").map((B) => ` *${B.trim() ? ` ${B.trim()}` : ""}`).join("\n")}\n */`;
|
|
1482
|
+
}), `${J.trim()}\n`;
|
|
1483
|
+
}
|
|
1484
|
+
function u1(q) {
|
|
1485
|
+
let Z = q.split("\n");
|
|
1486
|
+
return Z.map(($, J) => {
|
|
1487
|
+
if (J === 0)
|
|
1488
|
+
return "/**";
|
|
1489
|
+
if (J === Z.length - 1)
|
|
1490
|
+
return " */";
|
|
1491
|
+
return ` * ${$.replace(/^\s*\*?\s?/, "").trim()}`;
|
|
1492
|
+
}).join("\n");
|
|
1493
|
+
}
|
|
1494
|
+
function Q1(q, ...Z) {
|
|
1495
|
+
if (!Z.length)
|
|
1496
|
+
return q;
|
|
1497
|
+
let $ = Z.shift();
|
|
1498
|
+
if (B1(q) && B1($)) {
|
|
1499
|
+
for (let J in $)
|
|
1500
|
+
if (Object.prototype.hasOwnProperty.call($, J)) {
|
|
1501
|
+
let j = $[J];
|
|
1502
|
+
if (B1(j) && B1(q[J]))
|
|
1503
|
+
q[J] = Q1(q[J], j);
|
|
1504
|
+
else
|
|
1505
|
+
q[J] = j;
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
return Q1(q, ...Z);
|
|
1509
|
+
}
|
|
1510
|
+
function B1(q) {
|
|
1511
|
+
return q && typeof q === "object" && !Array.isArray(q);
|
|
1512
|
+
}
|
|
1513
|
+
async function bq({ name: q, cwd: Z, defaultConfig: $ }) {
|
|
1514
|
+
let J = Z ?? I1.cwd(), j = xq(J, `${q}.config`);
|
|
1515
|
+
if (Aq(j))
|
|
1516
|
+
try {
|
|
1517
|
+
let z = await import(j), U = z.default || z;
|
|
1518
|
+
return Q1($, U);
|
|
1519
|
+
} catch (z) {
|
|
1520
|
+
console.error(`Error loading config from ${j}:`, z);
|
|
1521
|
+
}
|
|
1522
|
+
return $;
|
|
1523
|
+
}
|
|
1524
|
+
var Z1 = await bq({ name: "dts", cwd: I1.cwd(), defaultConfig: { cwd: I1.cwd(), root: "./src", entrypoints: ["**/*.ts"], outdir: "./dist", keepComments: true, clean: true, tsconfigPath: "./tsconfig.json" } });
|
|
1525
|
+
async function h1(q) {
|
|
1526
|
+
let Z = await gq(q, "utf-8"), $ = "", J = new Set, j = new Map, z = /export\s*(?:\*|\{[^}]*\})\s*from\s*['"][^'"]+['"]/g, U = Z.match(z) || [];
|
|
1527
|
+
$ += `${U.join("\n")}\n`;
|
|
1528
|
+
let B = /import\s+(?:(type)\s+)?(?:(\{[^}]+\})|(\w+))(?:\s*,\s*(?:(\{[^}]+\})|(\w+)))?\s+from\s+['"]([^'"]+)['"]/g;
|
|
1529
|
+
Array.from(Z.matchAll(B)).forEach(([, H, P, N, G, h, C]) => {
|
|
1530
|
+
if (!j.has(C))
|
|
1531
|
+
j.set(C, new Set);
|
|
1532
|
+
let I = (g, i) => {
|
|
1533
|
+
if (g)
|
|
1534
|
+
g.replace(/[{}]/g, "").split(",").map((x) => {
|
|
1535
|
+
let [m, w] = x.split(" as ").map((y) => y.trim());
|
|
1536
|
+
return { name: m.replace(/^type\s+/, ""), alias: w || m.replace(/^type\s+/, "") };
|
|
1537
|
+
}).forEach(({ name: x }) => {
|
|
1538
|
+
j.get(C).add(x);
|
|
1539
|
+
});
|
|
1540
|
+
};
|
|
1541
|
+
if (I(P, !!H), I(G, !!H), N)
|
|
1542
|
+
j.get(C).add(N);
|
|
1543
|
+
if (h)
|
|
1544
|
+
j.get(C).add(h);
|
|
1545
|
+
});
|
|
1546
|
+
let K = Z.split("\n"), F = 0;
|
|
1547
|
+
while (F < K.length) {
|
|
1548
|
+
let H = "", P = "";
|
|
1549
|
+
if (K[F].trim().startsWith("/**")) {
|
|
1550
|
+
while (F < K.length && !K[F].includes("*/"))
|
|
1551
|
+
H += `${K[F]}\n`, F++;
|
|
1552
|
+
H += `${K[F]}\n`, F++;
|
|
1553
|
+
}
|
|
1554
|
+
if (F < K.length && K[F].trim().startsWith("export")) {
|
|
1555
|
+
P = K[F], F++;
|
|
1556
|
+
while (F < K.length && !K[F].trim().startsWith("export") && !K[F].trim().startsWith("/**"))
|
|
1557
|
+
P += `\n${K[F]}`, F++;
|
|
1558
|
+
}
|
|
1559
|
+
if (P) {
|
|
1560
|
+
let N = H ? u1(H.trim()) : "", G = P.trim();
|
|
1561
|
+
if (G.startsWith("export function") || G.startsWith("export async function")) {
|
|
1562
|
+
G = G.replace(/^export\s+(async\s+)?function/, "export declare function");
|
|
1563
|
+
let I = G.match(/^.*?\)/);
|
|
1564
|
+
if (I) {
|
|
1565
|
+
let g = I[0].slice(I[0].indexOf("(") + 1, -1);
|
|
1566
|
+
g = g.replace(/\s*=[^,)]+/g, "");
|
|
1567
|
+
let i = G.match(/\):\s*([^{]+)/);
|
|
1568
|
+
G = `export declare function ${G.split("function")[1].split("(")[0].trim()}(${g})${i ? `: ${i[1].trim()}` : ""};`;
|
|
1569
|
+
}
|
|
1570
|
+
} else if (G.startsWith("export const") || G.startsWith("export let") || G.startsWith("export var"))
|
|
1571
|
+
G = G.replace(/^export\s+(const|let|var)/, "export declare $1"), G = `${G.split("=")[0].trim()};`;
|
|
1572
|
+
$ += `${N}\n${G}\n\n`;
|
|
1573
|
+
let h = /\b([A-Z]\w+)(?:<[^>]*>)?/g;
|
|
1574
|
+
Array.from(G.matchAll(h)).forEach(([, I]) => J.add(I));
|
|
1575
|
+
}
|
|
1576
|
+
if (!P && !H)
|
|
1577
|
+
F++;
|
|
1578
|
+
}
|
|
1579
|
+
let T = "";
|
|
1580
|
+
if (j.forEach((H, P) => {
|
|
1581
|
+
let N = [...H].filter((G) => J.has(G));
|
|
1582
|
+
if (N.length > 0)
|
|
1583
|
+
T += `import type { ${N.join(", ")} } from '${P}'\n`;
|
|
1584
|
+
}), T)
|
|
1585
|
+
$ = `${T}\n${$}`;
|
|
1586
|
+
return m1($);
|
|
1587
|
+
}
|
|
1588
|
+
var wq = X1(Kq(), 1);
|
|
1589
|
+
var A1 = X1(Y1(), 1);
|
|
1590
|
+
var yq = X1(Y1(), 1);
|
|
1591
|
+
var _Z = /\\(?![()[\]{}!+@])/g;
|
|
1592
|
+
function RZ(q) {
|
|
1593
|
+
return Iq(q);
|
|
1594
|
+
}
|
|
1595
|
+
function EZ(q) {
|
|
1596
|
+
return Dq(q).replace(_Z, "/");
|
|
1597
|
+
}
|
|
1598
|
+
var _8 = process.platform === "win32" ? EZ : RZ;
|
|
1599
|
+
var SZ = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
1600
|
+
var AZ = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
1601
|
+
var Iq = (q) => q.replace(SZ, "\\$&");
|
|
1602
|
+
var Dq = (q) => q.replace(AZ, "\\$&");
|
|
1603
|
+
var R8 = process.platform === "win32" ? Dq : Iq;
|
|
1604
|
+
function xZ(q, Z) {
|
|
1605
|
+
if ((Z == null ? undefined : Z.caseSensitiveMatch) === false)
|
|
1606
|
+
return true;
|
|
1607
|
+
let $ = yq.default.scan(q);
|
|
1608
|
+
return $.isGlob || $.negated;
|
|
1609
|
+
}
|
|
1610
|
+
function Gq(q, Z, $, J, j) {
|
|
1611
|
+
var z;
|
|
1612
|
+
let U = q;
|
|
1613
|
+
if (q.endsWith("/"))
|
|
1614
|
+
U = q.slice(0, -1);
|
|
1615
|
+
if (!U.endsWith("*") && Z)
|
|
1616
|
+
U += "/**";
|
|
1617
|
+
if (Nq.isAbsolute(U.replace(/\\(?=[()[\]{}!*+?@|])/g, "")))
|
|
1618
|
+
U = N1.relative($, U);
|
|
1619
|
+
else
|
|
1620
|
+
U = N1.normalize(U);
|
|
1621
|
+
let B = /^(\/?\.\.)+/.exec(U);
|
|
1622
|
+
if (B == null ? undefined : B[0]) {
|
|
1623
|
+
let M = N1.join($, B[0]);
|
|
1624
|
+
if (J.root.length > M.length)
|
|
1625
|
+
J.root = M, J.depthOffset = -(B[0].length + 1) / 3;
|
|
1626
|
+
} else if (!j && J.depthOffset >= 0) {
|
|
1627
|
+
let M = U.split("/");
|
|
1628
|
+
(z = J.commonPath) != null || (J.commonPath = M);
|
|
1629
|
+
let K = [];
|
|
1630
|
+
for (let F = 0;F < Math.min(J.commonPath.length, M.length); F++) {
|
|
1631
|
+
let T = M[F];
|
|
1632
|
+
if (T === "**" && !M[F + 1]) {
|
|
1633
|
+
K.pop();
|
|
1634
|
+
break;
|
|
1635
|
+
}
|
|
1636
|
+
if (T !== J.commonPath[F] || xZ(T) || F === M.length - 1)
|
|
1637
|
+
break;
|
|
1638
|
+
K.push(T);
|
|
1639
|
+
}
|
|
1640
|
+
J.depthOffset = K.length, J.commonPath = K, J.root = K.length > 0 ? `${$}/${K.join("/")}` : $;
|
|
1641
|
+
}
|
|
1642
|
+
return U;
|
|
1643
|
+
}
|
|
1644
|
+
function bZ({ patterns: q, ignore: Z = [], expandDirectories: $ = true }, J, j) {
|
|
1645
|
+
if (typeof q === "string")
|
|
1646
|
+
q = [q];
|
|
1647
|
+
if (typeof Z === "string")
|
|
1648
|
+
Z = [Z];
|
|
1649
|
+
let z = [], U = Z.map((B) => Gq(B, $, J, j, true));
|
|
1650
|
+
if (!q)
|
|
1651
|
+
return { match: ["**/*"], ignore: U };
|
|
1652
|
+
for (let B of q)
|
|
1653
|
+
if (B = Gq(B, $, J, j, false), B.startsWith("!") && B[1] !== "(")
|
|
1654
|
+
U.push(B.slice(1));
|
|
1655
|
+
else
|
|
1656
|
+
z.push(B);
|
|
1657
|
+
return { match: z, ignore: U };
|
|
1658
|
+
}
|
|
1659
|
+
function x1(q, Z, $) {
|
|
1660
|
+
return N1.relative(Z, `${$}/${q}`);
|
|
1661
|
+
}
|
|
1662
|
+
function Mq(q, Z, $, J, j) {
|
|
1663
|
+
let z = j ? q.slice($.length + 1) || "." : q;
|
|
1664
|
+
if ($ === Z)
|
|
1665
|
+
return J && z !== "." ? z.slice(0, -1) : z;
|
|
1666
|
+
return x1(z, Z, $);
|
|
1667
|
+
}
|
|
1668
|
+
function gZ(q, Z, $) {
|
|
1669
|
+
let J = { root: Z, commonPath: null, depthOffset: 0 }, j = bZ(q, Z, J), z = A1.default(j.match, { dot: q.dot, nocase: q.caseSensitiveMatch === false, ignore: j.ignore }), U = A1.default(j.ignore, { dot: q.dot, nocase: q.caseSensitiveMatch === false }), B = { filters: [(K, F) => z(Mq(K, Z, J.root, F, q.absolute))], exclude: (K, F) => U(Mq(F, Z, J.root, true, true)), pathSeparator: "/", relativePaths: true };
|
|
1670
|
+
if (q.deep)
|
|
1671
|
+
B.maxDepth = Math.round(q.deep - J.depthOffset);
|
|
1672
|
+
if (q.absolute)
|
|
1673
|
+
B.relativePaths = false, B.resolvePaths = true, B.includeBasePath = true;
|
|
1674
|
+
if (q.followSymbolicLinks === false)
|
|
1675
|
+
B.resolveSymlinks = false, B.excludeSymlinks = true;
|
|
1676
|
+
if (q.onlyDirectories)
|
|
1677
|
+
B.excludeFiles = true, B.includeDirs = true;
|
|
1678
|
+
else if (q.onlyFiles === false)
|
|
1679
|
+
B.includeDirs = true;
|
|
1680
|
+
J.root = J.root.replace(/\\/g, "");
|
|
1681
|
+
let M = new wq.fdir(B).crawl(J.root);
|
|
1682
|
+
if (Z === J.root || q.absolute)
|
|
1683
|
+
return $ ? M.sync() : M.withPromise();
|
|
1684
|
+
return $ ? M.sync().map((K) => x1(K, Z, J.root) + (!K || K.endsWith("/") ? "/" : "")) : M.withPromise().then((K) => K.map((F) => x1(F, Z, J.root) + (!F || F.endsWith("/") ? "/" : "")));
|
|
1685
|
+
}
|
|
1686
|
+
async function fq(q, Z) {
|
|
1687
|
+
if (q && (Z == null ? undefined : Z.patterns))
|
|
1688
|
+
throw new Error("Cannot pass patterns as both an argument and an option");
|
|
1689
|
+
let $ = Array.isArray(q) || typeof q === "string" ? { ...Z, patterns: q } : q, J = $.cwd ? Nq.resolve($.cwd).replace(/\\/g, "/") : process.cwd().replace(/\\/g, "/");
|
|
1690
|
+
return gZ($, J, false);
|
|
1691
|
+
}
|
|
1692
|
+
async function lZ(q) {
|
|
1693
|
+
try {
|
|
1694
|
+
if (!await v1(q)) {
|
|
1695
|
+
console.error("Error: isolatedModules must be set to true in your tsconfig.json. Ensure `tsc --noEmit` does not output any errors.");
|
|
1696
|
+
return;
|
|
1697
|
+
}
|
|
1698
|
+
if (q?.clean)
|
|
1699
|
+
await vZ(q.outdir, { recursive: true, force: true });
|
|
1700
|
+
let $;
|
|
1701
|
+
if (q?.entrypoints)
|
|
1702
|
+
$ = await fq(q.entrypoints, { cwd: q.root ?? q.cwd, absolute: true });
|
|
1703
|
+
else
|
|
1704
|
+
$ = await y1(q?.root);
|
|
1705
|
+
for (let J of $) {
|
|
1706
|
+
let j = await h1(J);
|
|
1707
|
+
if (j) {
|
|
1708
|
+
let z = dZ(q?.root ?? "./src", J), U = hZ(z), B = uZ(q?.outdir ?? "./dist", `${U.name}.d.ts`);
|
|
1709
|
+
await kZ(mZ(B), { recursive: true }), await k1(B, j);
|
|
1710
|
+
} else
|
|
1711
|
+
console.warn(`No declarations extracted for ${J}`);
|
|
1712
|
+
}
|
|
1713
|
+
} catch (Z) {
|
|
1714
|
+
console.error("Error generating declarations:", Z);
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
async function v8(q) {
|
|
1718
|
+
await lZ({ ...Z1, ...q });
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
// src/index.ts
|
|
1722
|
+
function dts(options) {
|
|
1723
|
+
return {
|
|
1724
|
+
name: "bun-plugin-dtsx",
|
|
1725
|
+
async setup(build) {
|
|
1726
|
+
const cwd = options?.cwd ?? process2.cwd();
|
|
1727
|
+
const root = options?.root ?? build.config.root;
|
|
1728
|
+
const entrypoints = options?.entrypoints ?? build.config.entrypoints;
|
|
1729
|
+
const outdir = options?.outdir ?? build.config.outdir;
|
|
1730
|
+
const keepComments = options?.keepComments ?? true;
|
|
1731
|
+
const clean = options?.clean ?? false;
|
|
1732
|
+
const tsconfigPath = options?.tsconfigPath ?? "./tsconfig.json";
|
|
1733
|
+
await v8({
|
|
1734
|
+
...options,
|
|
1735
|
+
cwd,
|
|
1736
|
+
root,
|
|
1737
|
+
entrypoints,
|
|
1738
|
+
outdir,
|
|
1739
|
+
keepComments,
|
|
1740
|
+
clean,
|
|
1741
|
+
tsconfigPath
|
|
1742
|
+
});
|
|
1743
|
+
}
|
|
1744
|
+
};
|
|
1745
|
+
}
|
|
1746
|
+
var src_default = dts;
|
|
1747
|
+
export {
|
|
1748
|
+
dts,
|
|
1749
|
+
src_default as default
|
|
1750
|
+
};
|