@stacksjs/dtsx 0.2.2 → 0.4.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/dist/cli.js +59 -59
- package/dist/config.d.ts +9 -3
- package/dist/extract.d.ts +155 -58
- package/dist/generate.d.ts +3 -3
- package/dist/index.d.ts +5 -14
- package/dist/index.js +1 -1
- package/dist/types.d.ts +10 -10
- package/dist/utils.d.ts +5 -10
- package/package.json +3 -4
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type { DtsGenerationConfig } from './types'
|
|
1
|
+
import type { DtsGenerationConfig } from './types';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
declare interface Options<T> {
|
|
4
|
+
name: string;
|
|
5
|
+
cwd?: string;
|
|
6
|
+
defaultConfig: T;
|
|
7
|
+
}
|
|
4
8
|
|
|
5
|
-
export declare
|
|
9
|
+
export declare function loadConfig<T extends Record<string, unknown>>(options: Options<T>): Promise<T>;
|
|
10
|
+
|
|
11
|
+
export declare const config: DtsGenerationConfig;
|
package/dist/extract.d.ts
CHANGED
|
@@ -1,59 +1,156 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (exportStatement) {
|
|
13
|
-
const formattedComment = comment ? formatComment(comment.trim()) : ''
|
|
14
|
-
let formattedExport = exportStatement.trim()
|
|
15
|
-
|
|
16
|
-
if (formattedExport.startsWith('export function') || formattedExport.startsWith('export async function')) {
|
|
17
|
-
formattedExport = formattedExport.replace(/^export\s+(async\s+)?function/, 'export declare function')
|
|
18
|
-
const functionSignature = formattedExport.match(/^.*?\)/)
|
|
19
|
-
if (functionSignature) {
|
|
20
|
-
let params = functionSignature[0].slice(functionSignature[0].indexOf('(') + 1, -1)
|
|
21
|
-
params = params.replace(/\s*=[^,)]+/g, '') // Remove default values
|
|
22
|
-
const returnType = formattedExport.match(/\):\s*([^{]+)/)
|
|
23
|
-
formattedExport = `export declare function ${formattedExport.split('function')[1].split('(')[0].trim()}(${params})${returnType ? `: ${returnType[1].trim()}` : ''};`
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
else if (formattedExport.startsWith('export const') || formattedExport.startsWith('export let') || formattedExport.startsWith('export var')) {
|
|
27
|
-
formattedExport = formattedExport.replace(/^export\s+(const|let|var)/, 'export declare $1')
|
|
28
|
-
formattedExport = `${formattedExport.split('=')[0].trim()};`
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
declarations += `${formattedComment}\n${formattedExport}\n\n`
|
|
32
|
-
|
|
33
|
-
// Add types used in the export to usedTypes
|
|
34
|
-
const typeRegex = /\b([A-Z]\w+)(?:<[^>]*>)?/g
|
|
35
|
-
const types = Array.from(formattedExport.matchAll(typeRegex))
|
|
36
|
-
types.forEach(([, type]) => usedTypes.add(type))
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (!exportStatement && !comment) {
|
|
40
|
-
i++
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Generate import statements for used types
|
|
45
|
-
let importDeclarations = ''
|
|
46
|
-
importMap.forEach((types, path) => {
|
|
47
|
-
const usedTypesFromPath = [...types].filter(type => usedTypes.has(type))
|
|
48
|
-
if (usedTypesFromPath.length > 0) {
|
|
49
|
-
importDeclarations += `import type { ${usedTypesFromPath.join(', ')} } from '${path}'\n`
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
if (importDeclarations) {
|
|
54
|
-
declarations = `${importDeclarations}\n${declarations}`
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Apply final formatting
|
|
58
|
-
return formatDeclarations(declarations)
|
|
1
|
+
/**
|
|
2
|
+
* RegExp patterns used throughout the module
|
|
3
|
+
*/
|
|
4
|
+
export declare interface RegexPatterns {
|
|
5
|
+
readonly typeImport: RegExp;
|
|
6
|
+
readonly regularImport: RegExp;
|
|
7
|
+
readonly returnType: RegExp;
|
|
8
|
+
readonly constType: RegExp;
|
|
9
|
+
readonly bracketOpen: RegExp;
|
|
10
|
+
readonly bracketClose: RegExp;
|
|
11
|
+
readonly functionReturn: RegExp;
|
|
59
12
|
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Regular expression patterns used throughout the module
|
|
16
|
+
*/
|
|
17
|
+
export declare const REGEX: RegexPatterns;
|
|
18
|
+
|
|
19
|
+
declare const Type: /const([^:;
|
|
20
|
+
|
|
21
|
+
declare function functionReturn:(): void;
|
|
22
|
+
|
|
23
|
+
/** Nested properties for objects */
|
|
24
|
+
export declare interface PropertyInfo {
|
|
25
|
+
key: string;
|
|
26
|
+
value: string;
|
|
27
|
+
type: string;
|
|
28
|
+
nested?: PropertyInfo[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Represents the current state of the processing
|
|
33
|
+
*/
|
|
34
|
+
export declare interface ProcessingState {
|
|
35
|
+
dtsLines: string[];
|
|
36
|
+
usedTypes: Set<string>;
|
|
37
|
+
typeSources: Map<string, string>;
|
|
38
|
+
defaultExport: string;
|
|
39
|
+
currentDeclaration: string;
|
|
40
|
+
lastCommentBlock: string;
|
|
41
|
+
bracketCount: number;
|
|
42
|
+
isMultiLineDeclaration: boolean;
|
|
43
|
+
moduleImports: Map<string, ImportInfo>;
|
|
44
|
+
availableTypes: Map<string, string>;
|
|
45
|
+
availableValues: Map<string, string>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Initialize processing state
|
|
50
|
+
*/
|
|
51
|
+
export declare function createProcessingState(): ProcessingState;
|
|
52
|
+
|
|
53
|
+
declare interface TypeAnnotation {
|
|
54
|
+
raw: string | null;
|
|
55
|
+
parsed: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare function getTypeAnnotation(declaration: string): TypeAnnotation;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Extracts types from a TypeScript file and generates corresponding .d.ts content
|
|
62
|
+
*/
|
|
63
|
+
export declare function extract(filePath: string): Promise<string>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Generates TypeScript declaration types from source code.
|
|
67
|
+
*/
|
|
68
|
+
export declare function extractDtsTypes(sourceCode: string): string;
|
|
69
|
+
|
|
70
|
+
export declare function processLine(line: string, state: ProcessingState): void;
|
|
71
|
+
|
|
72
|
+
export declare interface ImportInfo {
|
|
73
|
+
kind: 'type' | 'value' | 'mixed';
|
|
74
|
+
usedTypes: Set<string>;
|
|
75
|
+
usedValues: Set<string>;
|
|
76
|
+
source: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Process import statements with improved tracking
|
|
81
|
+
*/
|
|
82
|
+
export declare function processImport(line: string, state: ProcessingState): string;
|
|
83
|
+
|
|
84
|
+
declare const valueImportMatch: {
|
|
85
|
+
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
declare const match: {
|
|
89
|
+
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
declare const isTypeImport: {
|
|
93
|
+
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
declare const [, items, source]: {
|
|
97
|
+
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
declare const moduleInfo: {
|
|
101
|
+
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
declare const [name, alias]: {
|
|
105
|
+
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
declare const importedName: {
|
|
109
|
+
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Generate final import statements
|
|
114
|
+
*/
|
|
115
|
+
export declare function generateImports(state: ProcessingState): string[];
|
|
116
|
+
|
|
117
|
+
declare const imports: string[];
|
|
118
|
+
|
|
119
|
+
declare const { usedTypes, usedValues }: {
|
|
120
|
+
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
declare const types: {
|
|
124
|
+
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
declare const values: {
|
|
128
|
+
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Process imports while preserving their original sources
|
|
133
|
+
*/
|
|
134
|
+
export declare function processImports(imports: string[], usedTypes: Set<string>): string[];
|
|
135
|
+
|
|
136
|
+
declare const match: {
|
|
137
|
+
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
declare const types: {
|
|
141
|
+
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
declare const [type, alias]: {
|
|
145
|
+
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
declare const module: {
|
|
149
|
+
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
declare type s.forEach(( = > {
|
|
153
|
+
|
|
154
|
+
declare const relevantTypes: {
|
|
155
|
+
|
|
156
|
+
};
|
package/dist/generate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DtsGenerationConfig, DtsGenerationOption } from './types'
|
|
1
|
+
import type { DtsGenerationConfig, DtsGenerationOption } from './types';
|
|
2
2
|
|
|
3
|
-
export declare function generateDeclarationsFromFiles(options?: DtsGenerationConfig): Promise<void
|
|
3
|
+
export declare function generateDeclarationsFromFiles(options?: DtsGenerationConfig): Promise<void>;
|
|
4
4
|
|
|
5
|
-
export declare function generate(options?: DtsGenerationOption): Promise<void
|
|
5
|
+
export declare function generate(options?: DtsGenerationOption): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
export { config } from './config'
|
|
2
|
-
export * from './extract'
|
|
3
|
-
export * from './generate'
|
|
4
|
-
export * from './types'
|
|
5
|
-
export * from './utils'
|
|
1
|
+
export { config } from './config';
|
|
6
2
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
export * from './
|
|
10
|
-
|
|
11
|
-
export * from './generate'
|
|
12
|
-
|
|
13
|
-
export * from './types'
|
|
14
|
-
|
|
15
|
-
export * from './utils'
|
|
3
|
+
export * from './extract';
|
|
4
|
+
export * from './generate';
|
|
5
|
+
export * from './types';
|
|
6
|
+
export * from './utils';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var Lq=Object.create;var{getPrototypeOf:Pq,defineProperty:b1,getOwnPropertyNames:Tq}=Object;var Oq=Object.prototype.hasOwnProperty;var X1=(q,Z,$)=>{$=q!=null?Lq(Pq(q)):{};let J=Z||!q||!q.__esModule?b1($,"default",{value:q,enumerable:!0}):$;for(let j of Tq(q))if(!Oq.call(J,j))b1(J,j,{get:()=>q[j],enumerable:!0});return J};var _=(q,Z)=>()=>(Z||q((Z={exports:{}}).exports,Z),Z.exports);var f1=_((c1)=>{Object.defineProperty(c1,"__esModule",{value:!0});c1.normalizePath=c1.convertSlashes=c1.cleanPath=void 0;var D1=import.meta.require("path");function d1(q){let Z=D1.normalize(q);if(Z.length>1&&Z[Z.length-1]===D1.sep)Z=Z.substring(0,Z.length-1);return Z}c1.cleanPath=d1;var kq=/[\\/]/g;function l1(q,Z){return q.replace(kq,Z)}c1.convertSlashes=l1;function vq(q,Z){let{resolvePaths:$,normalizePath:J,pathSeparator:j}=Z,z=process.platform==="win32"&&q.includes("/")||q.startsWith(".");if($)q=D1.resolve(q);if(J||z)q=d1(q);if(q===".")return"";let U=q[q.length-1]!==j;return l1(U?q+j:q,j)}c1.normalizePath=vq});var a1=_((r1)=>{Object.defineProperty(r1,"__esModule",{value:!0});r1.build=r1.joinDirectoryPath=r1.joinPathWithBasePath=void 0;var hq=import.meta.require("path"),dq=f1();function n1(q,Z){return Z+q}r1.joinPathWithBasePath=n1;function lq(q,Z){return function($,J){if(J.startsWith(q))return J.replace(q,"")+$;else return dq.convertSlashes(hq.relative(q,J),Z.pathSeparator)+Z.pathSeparator+$}}function cq(q){return q}function iq(q,Z,$){return Z+q+$}r1.joinDirectoryPath=iq;function nq(q,Z){let{relativePaths:$,includeBasePath:J}=Z;return $&&q?lq(q,Z):J?n1:cq}r1.build=nq});var e1=_((s1)=>{Object.defineProperty(s1,"__esModule",{value:!0});s1.build=void 0;function aq(q){return function(Z,$){$.push(Z.substring(q.length)||".")}}function sq(q){return function(Z,$,J){let j=Z.substring(q.length)||".";if(J.every((z)=>z(j,!0)))$.push(j)}}var oq=(q,Z)=>{Z.push(q||".")},eq=(q,Z,$)=>{let J=q||".";if($.every((j)=>j(J,!0)))Z.push(J)},tq=()=>{};function q$(q,Z){let{includeDirs:$,filters:J,relativePaths:j}=Z;if(!$)return tq;if(j)return J&&J.length?sq(q):aq(q);return J&&J.length?eq:oq}s1.build=q$});var $0=_((t1)=>{Object.defineProperty(t1,"__esModule",{value:!0});t1.build=void 0;var $$=(q,Z,$,J)=>{if(J.every((j)=>j(q,!1)))$.files++},Z$=(q,Z,$,J)=>{if(J.every((j)=>j(q,!1)))Z.push(q)},J$=(q,Z,$,J)=>{$.files++},j$=(q,Z)=>{Z.push(q)},V$=()=>{};function Y$(q){let{excludeFiles:Z,filters:$,onlyCounts:J}=q;if(Z)return V$;if($&&$.length)return J?$$:Z$;else if(J)return J$;else return j$}t1.build=Y$});var j0=_((Z0)=>{Object.defineProperty(Z0,"__esModule",{value:!0});Z0.build=void 0;var W$=(q)=>{return q},z$=()=>{return[""].slice(0,0)};function U$(q){return q.group?z$:W$}Z0.build=U$});var W0=_((V0)=>{Object.defineProperty(V0,"__esModule",{value:!0});V0.build=void 0;var X$=(q,Z,$)=>{q.push({directory:Z,files:$,dir:Z})},B$=()=>{};function Q$(q){return q.group?X$:B$}V0.build=Q$});var X0=_((t)=>{var F$=t&&t.__importDefault||function(q){return q&&q.__esModule?q:{default:q}};Object.defineProperty(t,"__esModule",{value:!0});t.build=void 0;var F1=F$(import.meta.require("fs")),z0=import.meta.require("path"),K$=function(q,Z,$){let{queue:J,options:{suppressErrors:j}}=Z;J.enqueue(),F1.default.realpath(q,(z,U)=>{if(z)return J.dequeue(j?null:z,Z);F1.default.stat(U,(B,M)=>{if(B)return J.dequeue(j?null:B,Z);if(M.isDirectory()&&U0(q,U,Z))return J.dequeue(null,Z);$(M,U),J.dequeue(null,Z)})})},G$=function(q,Z,$){let{queue:J,options:{suppressErrors:j}}=Z;J.enqueue();try{let z=F1.default.realpathSync(q),U=F1.default.statSync(z);if(U.isDirectory()&&U0(q,z,Z))return;$(U,z)}catch(z){if(!j)throw z}};function M$(q,Z){if(!q.resolveSymlinks||q.excludeSymlinks)return null;return Z?G$:K$}t.build=M$;function U0(q,Z,$){if($.options.useRealPaths)return N$(Z,$);let J=z0.dirname(q),j=1;while(J!==$.root&&j<2){let z=$.symlinks.get(J);if(!!z&&(z===Z||z.startsWith(Z)||Z.startsWith(z)))j++;else J=z0.dirname(J)}return $.symlinks.set(q,Z),j>1}function N$(q,Z){return Z.visited.includes(q+Z.options.pathSeparator)}});var F0=_((B0)=>{Object.defineProperty(B0,"__esModule",{value:!0});B0.build=void 0;var w$=(q)=>{return q.counts},y$=(q)=>{return q.groups},I$=(q)=>{return q.paths},D$=(q)=>{return q.paths.slice(0,q.options.maxFiles)},f$=(q,Z,$)=>{return K1(Z,$,q.counts,q.options.suppressErrors),null},H$=(q,Z,$)=>{return K1(Z,$,q.paths,q.options.suppressErrors),null},C$=(q,Z,$)=>{return K1(Z,$,q.paths.slice(0,q.options.maxFiles),q.options.suppressErrors),null},L$=(q,Z,$)=>{return K1(Z,$,q.groups,q.options.suppressErrors),null};function K1(q,Z,$,J){if(q&&!J)Z(q,$);else Z(null,$)}function P$(q,Z){let{onlyCounts:$,group:J,maxFiles:j}=q;if($)return Z?w$:f$;else if(J)return Z?y$:L$;else if(j)return Z?D$:C$;else return Z?I$:H$}B0.build=P$});var M0=_((q1)=>{var T$=q1&&q1.__importDefault||function(q){return q&&q.__esModule?q:{default:q}};Object.defineProperty(q1,"__esModule",{value:!0});q1.build=void 0;var K0=T$(import.meta.require("fs")),G0={withFileTypes:!0},O$=(q,Z,$,J,j)=>{if(J<0)return q.queue.dequeue(null,q);q.visited.push(Z),q.counts.directories++,q.queue.enqueue(),K0.default.readdir(Z||".",G0,(z,U=[])=>{j(U,$,J),q.queue.dequeue(q.options.suppressErrors?null:z,q)})},_$=(q,Z,$,J,j)=>{if(J<0)return;q.visited.push(Z),q.counts.directories++;let z=[];try{z=K0.default.readdirSync(Z||".",G0)}catch(U){if(!q.options.suppressErrors)throw U}j(z,$,J)};function R$(q){return q?_$:O$}q1.build=R$});var I0=_((w0)=>{Object.defineProperty(w0,"__esModule",{value:!0});w0.Queue=void 0;class N0{onQueueEmpty;count=0;constructor(q){this.onQueueEmpty=q}enqueue(){this.count++}dequeue(q,Z){if(--this.count<=0||q)this.onQueueEmpty(q,Z)}}w0.Queue=N0});var C0=_((f0)=>{Object.defineProperty(f0,"__esModule",{value:!0});f0.Counter=void 0;class D0{_files=0;_directories=0;set files(q){this._files=q}get files(){return this._files}set directories(q){this._directories=q}get directories(){return this._directories}get dirs(){return this._directories}}f0.Counter=D0});var L1=_((n)=>{var E$=n&&n.__createBinding||(Object.create?function(q,Z,$,J){if(J===void 0)J=$;var j=Object.getOwnPropertyDescriptor(Z,$);if(!j||("get"in j?!Z.__esModule:j.writable||j.configurable))j={enumerable:!0,get:function(){return Z[$]}};Object.defineProperty(q,J,j)}:function(q,Z,$,J){if(J===void 0)J=$;q[J]=Z[$]}),S$=n&&n.__setModuleDefault||(Object.create?function(q,Z){Object.defineProperty(q,"default",{enumerable:!0,value:Z})}:function(q,Z){q.default=Z}),o=n&&n.__importStar||function(q){if(q&&q.__esModule)return q;var Z={};if(q!=null){for(var $ in q)if($!=="default"&&Object.prototype.hasOwnProperty.call(q,$))E$(Z,q,$)}return S$(Z,q),Z};Object.defineProperty(n,"__esModule",{value:!0});n.Walker=void 0;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();class P0{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(q,Z,$){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)}start(){return this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(q,Z,$)=>{let{paths:J,options:{filters:j,resolveSymlinks:z,excludeSymlinks:U,exclude:B,maxFiles:M,signal:K,useRealPaths:F,pathSeparator:T}}=this.state;if(K&&K.aborted||M&&J.length>M)return;this.pushDirectory(Z,J,j);let H=this.getArray(this.state.paths);for(let P=0;P<q.length;++P){let N=q[P];if(N.isFile()||N.isSymbolicLink()&&!z&&!U){let G=this.joinPath(N.name,Z);this.pushFile(G,H,this.state.counts,j)}else if(N.isDirectory()){let G=C1.joinDirectoryPath(N.name,Z,this.state.options.pathSeparator);if(B&&B(N.name,G))continue;this.walkDirectory(this.state,G,G,$-1,this.walk)}else if(N.isSymbolicLink()&&this.resolveSymlink){let G=C1.joinPathWithBasePath(N.name,Z);this.resolveSymlink(G,this.state,(h,C)=>{if(h.isDirectory()){if(C=H1.normalizePath(C,this.state.options),B&&B(N.name,C))return;this.walkDirectory(this.state,C,F?C:G+T,$-1,this.walk)}else{C=F?C:G;let I=L0.basename(C),g=H1.normalizePath(L0.dirname(C),this.state.options);C=this.joinPath(I,g),this.pushFile(C,H,this.state.counts,j)}})}}this.groupFiles(this.state.groups,Z,H)}}n.Walker=P0});var R0=_((O0)=>{Object.defineProperty(O0,"__esModule",{value:!0});O0.callback=O0.promise=void 0;var d$=L1();function l$(q,Z){return new Promise(($,J)=>{T0(q,Z,(j,z)=>{if(j)return J(j);$(z)})})}O0.promise=l$;function T0(q,Z,$){new d$.Walker(q,Z,$).start()}O0.callback=T0});var A0=_((E0)=>{Object.defineProperty(E0,"__esModule",{value:!0});E0.sync=void 0;var i$=L1();function n$(q,Z){return new i$.Walker(q,Z).start()}E0.sync=n$});var v0=_((g0)=>{Object.defineProperty(g0,"__esModule",{value:!0});g0.APIBuilder=void 0;var x0=R0(),r$=A0();class b0{root;options;constructor(q,Z){this.root=q,this.options=Z}withPromise(){return x0.promise(this.root,this.options)}withCallback(q){x0.callback(this.root,this.options,q)}sync(){return r$.sync(this.root,this.options)}}g0.APIBuilder=b0});var J1=_((y8,u0)=>{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"};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){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${q.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(q){return q===!0?p$:m0}}});var j1=_((qZ)=>{var{REGEX_BACKSLASH:s$,REGEX_REMOVE_BACKSLASH:o$,REGEX_SPECIAL_CHARS:e$,REGEX_SPECIAL_CHARS_GLOBAL:t$}=J1();qZ.isObject=(q)=>q!==null&&typeof q==="object"&&!Array.isArray(q);qZ.hasRegexChars=(q)=>e$.test(q);qZ.isRegexChar=(q)=>q.length===1&&qZ.hasRegexChars(q);qZ.escapeRegex=(q)=>q.replace(t$,"\\$1");qZ.toPosixSlashes=(q)=>q.replace(s$,"/");qZ.isWindows=()=>{if(typeof navigator!=="undefined"&&navigator.platform){let q=navigator.platform.toLowerCase();return q==="win32"||q==="windows"}if(typeof process!=="undefined"&&process.platform)return process.platform==="win32";return!1};qZ.removeBackslashes=(q)=>{return q.replace(o$,(Z)=>{return Z==="\\"?"":Z})};qZ.escapeLast=(q,Z,$)=>{let J=q.lastIndexOf(Z,$);if(J===-1)return q;if(q[J-1]==="\\")return qZ.escapeLast(q,Z,J-1);return`${q.slice(0,J)}\\${q.slice(J)}`};qZ.removePrefix=(q,Z={})=>{let $=q;if($.startsWith("./"))$=$.slice(2),Z.prefix="./";return $};qZ.wrapOutput=(q,Z={},$={})=>{let J=$.contains?"":"^",j=$.contains?"":"$",z=`${J}(?:${q})${j}`;if(Z.negated===!0)z=`(?:^(?!${z}).*\$)`;return z};qZ.basename=(q,{windows:Z}={})=>{let $=q.split(Z?/[\\/]/:"/"),J=$[$.length-1];if(J==="")return $[$.length-2];return J}});var s0=_((D8,a0)=>{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)=>{return q===p0||q===V1},r0=(q)=>{if(q.isPrefix!==!0)q.depth=q.isGlobstar?1/0:1},MZ=(q,Z)=>{let $=Z||{},J=q.length-1,j=$.parts===!0||$.scanToEnd===!0,z=[],U=[],B=[],M=q,K=-1,F=0,T=0,H=!1,P=!1,N=!1,G=!1,h=!1,C=!1,I=!1,g=!1,i=!1,v=!1,x=0,m,w,y={value:"",depth:0,isGlob:!1},W=()=>K>=J,d=()=>M.charCodeAt(K+1),b=()=>{return m=w,M.charCodeAt(++K)};while(K<J){w=b();let L;if(w===V1){if(I=y.backslashes=!0,w=b(),w===_1)C=!0;continue}if(C===!0||w===_1){x++;while(W()!==!0&&(w=b())){if(w===V1){I=y.backslashes=!0,b();continue}if(w===_1){x++;continue}if(C!==!0&&w===T1&&(w=b())===T1){if(H=y.isBrace=!0,N=y.isGlob=!0,v=!0,j===!0)continue;break}if(C!==!0&&w===BZ){if(H=y.isBrace=!0,N=y.isGlob=!0,v=!0,j===!0)continue;break}if(w===KZ){if(x--,x===0){C=!1,H=y.isBrace=!0,v=!0;break}}}if(j===!0)continue;break}if(w===p0){if(z.push(K),U.push(y),y={value:"",depth:0,isGlob:!1},v===!0)continue;if(m===T1&&K===F+1){F+=2;continue}T=K+1;continue}if($.noext!==!0){if((w===FZ||w===XZ||w===P1||w===c0||w===O1)===!0&&d()===R1){if(N=y.isGlob=!0,G=y.isExtglob=!0,v=!0,w===O1&&K===F)i=!0;if(j===!0){while(W()!==!0&&(w=b())){if(w===V1){I=y.backslashes=!0,w=b();continue}if(w===i0){N=y.isGlob=!0,v=!0;break}}continue}break}}if(w===P1){if(m===P1)h=y.isGlobstar=!0;if(N=y.isGlob=!0,v=!0,j===!0)continue;break}if(w===c0){if(N=y.isGlob=!0,v=!0,j===!0)continue;break}if(w===QZ){while(W()!==!0&&(L=b())){if(L===V1){I=y.backslashes=!0,b();continue}if(L===GZ){P=y.isBracket=!0,N=y.isGlob=!0,v=!0;break}}if(j===!0)continue;break}if($.nonegate!==!0&&w===O1&&K===F){g=y.negated=!0,F++;continue}if($.noparen!==!0&&w===R1){if(N=y.isGlob=!0,j===!0){while(W()!==!0&&(w=b())){if(w===R1){I=y.backslashes=!0,w=b();continue}if(w===i0){v=!0;break}}continue}break}if(N===!0){if(v=!0,j===!0)continue;break}}if($.noext===!0)G=!1,N=!1;let S=M,V="",Y="";if(F>0)V=M.slice(0,F),M=M.slice(F),T-=F;if(S&&N===!0&&T>0)S=M.slice(0,T),Y=M.slice(T);else if(N===!0)S="",Y=M;else S=M;if(S&&S!==""&&S!=="/"&&S!==M){if(n0(S.charCodeAt(S.length-1)))S=S.slice(0,-1)}if($.unescape===!0){if(Y)Y=l0.removeBackslashes(Y);if(S&&I===!0)S=l0.removeBackslashes(S)}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};if($.tokens===!0){if(l.maxDepth=0,!n0(w))U.push(y);l.tokens=U}if($.parts===!0||$.tokens===!0){let L;for(let R=0;R<z.length;R++){let p=L?L+1:F,c=z[R],s=q.slice(p,c);if($.tokens){if(R===0&&F!==0)U[R].isPrefix=!0,U[R].value=V;else U[R].value=s;r0(U[R]),l.maxDepth+=U[R].depth}if(R!==0||s!=="")B.push(s);L=c}if(L&&L+1<q.length){let R=q.slice(L+1);if(B.push(R),$.tokens)U[U.length-1].value=R,r0(U[U.length-1]),l.maxDepth+=U[U.length-1].depth}l.slashes=z,l.parts=B}return l};a0.exports=MZ});var t0=_((f8,e0)=>{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)=>{if(typeof Z.expandRange==="function")return Z.expandRange(...q,Z);q.sort();let $=`[${q.join("-")}]`;try{new RegExp($)}catch(J){return q.map((j)=>r.escapeRegex(j)).join("..")}return $},$1=(q,Z)=>{return`Missing ${q}: "${Z}" - use "\\\\${Z}" to match literal characters`},E1=(q,Z)=>{if(typeof q!=="string")throw new TypeError("Expected a string");q=o0[q]||q;let $={...Z},J=typeof $.maxLength==="number"?Math.min(M1,$.maxLength):M1,j=q.length;if(j>J)throw new SyntaxError(`Input length: ${j}, exceeds maximum allowed length: ${J}`);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)=>{return`(${B}(?:(?!${v}${Q.dot?N:F}).)*?)`},m=$.dot?"":G,w=$.dot?I:g,y=$.bash===!0?x($):i;if($.capture)y=`(${y})`;if(typeof $.noext==="boolean")$.noextglob=$.noext;let W={input:q,index:-1,start:0,dot:$.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:U};q=r.removePrefix(q,W),j=q.length;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)=>{W.consumed+=Q,W.index+=O},s=(Q)=>{W.output+=Q.output!=null?Q.output:Q.value,c(Q.value)},Hq=()=>{let Q=1;while(L()==="!"&&(L(2)!=="("||L(3)==="?"))R(),W.start++,Q++;if(Q%2===0)return!1;return W.negated=!0,W.start++,!0},W1=(Q)=>{W[Q]++,S.push(Q)},e=(Q)=>{W[Q]--,S.pop()},f=(Q)=>{if(V.type==="globstar"){let O=W.braces>0&&(Q.type==="comma"||Q.type==="brace"),X=Q.extglob===!0||d.length&&(Q.type==="pipe"||Q.type==="paren");if(Q.type!=="slash"&&Q.type!=="paren"&&!O&&!X)W.output=W.output.slice(0,-V.output.length),V.type="star",V.value="*",V.output=y,W.output+=V.output}if(d.length&&Q.type!=="paren")d[d.length-1].inner+=Q.value;if(Q.value||Q.output)s(Q);if(V&&V.type==="text"&&Q.type==="text"){V.output=(V.output||V.value)+Q.value,V.value+=Q.value;return}Q.prev=V,U.push(Q),V=Q},z1=(Q,O)=>{let X={...K[O],conditions:1,inner:""};X.prev=V,X.parens=W.parens,X.output=W.output;let D=($.capture?"(":"")+X.open;W1("parens"),f({type:Q,value:O,output:W.output?"":P}),f({type:"paren",extglob:!0,value:R(),output:D}),d.push(X)},Cq=(Q)=>{let O=Q.close+($.capture?")":""),X;if(Q.type==="negate"){let D=y;if(Q.inner&&Q.inner.length>1&&Q.inner.includes("/"))D=x($);if(D!==y||l()||/^\)+$/.test(p()))O=Q.close=`)\$))${D}`;if(Q.inner.includes("*")&&(X=p())&&/^\.[^\\/.]+$/.test(X)){let E=E1(X,{...Z,fastpaths:!1}).output;O=Q.close=`)${E})${D})`}if(Q.prev.type==="bos")W.negatedExtglob=!0}f({type:"paren",extglob:!0,value:Y,output:O}),e("parens")};if($.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(q)){let Q=!1,O=q.replace(yZ,(X,D,E,u,k,w1)=>{if(u==="\\")return Q=!0,X;if(u==="?"){if(D)return D+u+(k?I.repeat(k.length):"");if(w1===0)return w+(k?I.repeat(k.length):"");return I.repeat(E.length)}if(u===".")return F.repeat(E.length);if(u==="*"){if(D)return D+u+(k?y:"");return y}return D?X:`\\${X}`});if(Q===!0)if($.unescape===!0)O=O.replace(/\\/g,"");else O=O.replace(/\\+/g,(X)=>{return X.length%2===0?"\\\\":X?"\\":""});if(O===q&&$.contains===!0)return W.output=q,W;return W.output=r.wrapOutput(O,W,Z),W}while(!l()){if(Y=R(),Y==="\0")continue;if(Y==="\\"){let X=L();if(X==="/"&&$.bash!==!0)continue;if(X==="."||X===";")continue;if(!X){Y+="\\",f({type:"text",value:Y});continue}let D=/^\\+/.exec(p()),E=0;if(D&&D[0].length>2){if(E=D[0].length,W.index+=E,E%2!==0)Y+="\\"}if($.unescape===!0)Y=R();else Y+=R();if(W.brackets===0){f({type:"text",value:Y});continue}}if(W.brackets>0&&(Y!=="]"||V.value==="["||V.value==="[^")){if($.posix!==!1&&Y===":"){let X=V.value.slice(1);if(X.includes("[")){if(V.posix=!0,X.includes(":")){let D=V.value.lastIndexOf("["),E=V.value.slice(0,D),u=V.value.slice(D+2),k=NZ[u];if(k){if(V.value=E+k,W.backtrack=!0,R(),!z.output&&U.indexOf(V)===1)z.output=P;continue}}}}if(Y==="["&&L()!==":"||Y==="-"&&L()==="]")Y=`\\${Y}`;if(Y==="]"&&(V.value==="["||V.value==="[^"))Y=`\\${Y}`;if($.posix===!0&&Y==="!"&&V.value==="[")Y="^";V.value+=Y,s({value:Y});continue}if(W.quotes===1&&Y!=='"'){Y=r.escapeRegex(Y),V.value+=Y,s({value:Y});continue}if(Y==='"'){if(W.quotes=W.quotes===1?0:1,$.keepQuotes===!0)f({type:"text",value:Y});continue}if(Y==="("){W1("parens"),f({type:"paren",value:Y});continue}if(Y===")"){if(W.parens===0&&$.strictBrackets===!0)throw new SyntaxError($1("opening","("));let X=d[d.length-1];if(X&&W.parens===X.parens+1){Cq(d.pop());continue}f({type:"paren",value:Y,output:W.parens?")":"\\)"}),e("parens");continue}if(Y==="["){if($.nobracket===!0||!p().includes("]")){if($.nobracket!==!0&&$.strictBrackets===!0)throw new SyntaxError($1("closing","]"));Y=`\\${Y}`}else W1("brackets");f({type:"bracket",value:Y});continue}if(Y==="]"){if($.nobracket===!0||V&&V.type==="bracket"&&V.value.length===1){f({type:"text",value:Y,output:`\\${Y}`});continue}if(W.brackets===0){if($.strictBrackets===!0)throw new SyntaxError($1("opening","["));f({type:"text",value:Y,output:`\\${Y}`});continue}e("brackets");let X=V.value.slice(1);if(V.posix!==!0&&X[0]==="^"&&!X.includes("/"))Y=`/${Y}`;if(V.value+=Y,s({value:Y}),$.literalBrackets===!1||r.hasRegexChars(X))continue;let D=r.escapeRegex(V.value);if(W.output=W.output.slice(0,-V.value.length),$.literalBrackets===!0){W.output+=D,V.value=D;continue}V.value=`(${B}${D}|${V.value})`,W.output+=V.value;continue}if(Y==="{"&&$.nobrace!==!0){W1("braces");let X={type:"brace",value:Y,output:"(",outputIndex:W.output.length,tokensIndex:W.tokens.length};b.push(X),f(X);continue}if(Y==="}"){let X=b[b.length-1];if($.nobrace===!0||!X){f({type:"text",value:Y,output:Y});continue}let D=")";if(X.dots===!0){let E=U.slice(),u=[];for(let k=E.length-1;k>=0;k--){if(U.pop(),E[k].type==="brace")break;if(E[k].type!=="dots")u.unshift(E[k].value)}D=IZ(u,$),W.backtrack=!0}if(X.comma!==!0&&X.dots!==!0){let E=W.output.slice(0,X.outputIndex),u=W.tokens.slice(X.tokensIndex);X.value=X.output="\\{",Y=D="\\}",W.output=E;for(let k of u)W.output+=k.output||k.value}f({type:"brace",value:Y,output:D}),e("braces"),b.pop();continue}if(Y==="|"){if(d.length>0)d[d.length-1].conditions++;f({type:"text",value:Y});continue}if(Y===","){let X=Y,D=b[b.length-1];if(D&&S[S.length-1]==="braces")D.comma=!0,X="|";f({type:"comma",value:Y,output:X});continue}if(Y==="/"){if(V.type==="dot"&&W.index===W.start+1){W.start=W.index+1,W.consumed="",W.output="",U.pop(),V=z;continue}f({type:"slash",value:Y,output:H});continue}if(Y==="."){if(W.braces>0&&V.type==="dot"){if(V.value===".")V.output=F;let X=b[b.length-1];V.type="dots",V.output+=Y,V.value+=Y,X.dots=!0;continue}if(W.braces+W.parens===0&&V.type!=="bos"&&V.type!=="slash"){f({type:"text",value:Y,output:F});continue}f({type:"dot",value:Y,output:F});continue}if(Y==="?"){if(!(V&&V.value==="(")&&$.noextglob!==!0&&L()==="("&&L(2)!=="?"){z1("qmark",Y);continue}if(V&&V.type==="paren"){let D=L(),E=Y;if(V.value==="("&&!/[!=<:]/.test(D)||D==="<"&&!/<([!=]|\w+>)/.test(p()))E=`\\${Y}`;f({type:"text",value:Y,output:E});continue}if($.dot!==!0&&(V.type==="slash"||V.type==="bos")){f({type:"qmark",value:Y,output:g});continue}f({type:"qmark",value:Y,output:I});continue}if(Y==="!"){if($.noextglob!==!0&&L()==="("){if(L(2)!=="?"||!/[!=<:]/.test(L(3))){z1("negate",Y);continue}}if($.nonegate!==!0&&W.index===0){Hq();continue}}if(Y==="+"){if($.noextglob!==!0&&L()==="("&&L(2)!=="?"){z1("plus",Y);continue}if(V&&V.value==="("||$.regex===!1){f({type:"plus",value:Y,output:T});continue}if(V&&(V.type==="bracket"||V.type==="paren"||V.type==="brace")||W.parens>0){f({type:"plus",value:Y});continue}f({type:"plus",value:T});continue}if(Y==="@"){if($.noextglob!==!0&&L()==="("&&L(2)!=="?"){f({type:"at",extglob:!0,value:Y,output:""});continue}f({type:"text",value:Y});continue}if(Y!=="*"){if(Y==="$"||Y==="^")Y=`\\${Y}`;let X=wZ.exec(p());if(X)Y+=X[0],W.index+=X[0].length;f({type:"text",value:Y});continue}if(V&&(V.type==="globstar"||V.star===!0)){V.type="star",V.star=!0,V.value+=Y,V.output=y,W.backtrack=!0,W.globstar=!0,c(Y);continue}let Q=p();if($.noextglob!==!0&&/^\([^?]/.test(Q)){z1("star",Y);continue}if(V.type==="star"){if($.noglobstar===!0){c(Y);continue}let X=V.prev,D=X.prev,E=X.type==="slash"||X.type==="bos",u=D&&(D.type==="star"||D.type==="globstar");if($.bash===!0&&(!E||Q[0]&&Q[0]!=="/")){f({type:"star",value:Y,output:""});continue}let k=W.braces>0&&(X.type==="comma"||X.type==="brace"),w1=d.length&&(X.type==="pipe"||X.type==="paren");if(!E&&X.type!=="paren"&&!k&&!w1){f({type:"star",value:Y,output:""});continue}while(Q.slice(0,3)==="/**"){let U1=q[W.index+4];if(U1&&U1!=="/")break;Q=Q.slice(3),c("/**",3)}if(X.type==="bos"&&l()){V.type="globstar",V.value+=Y,V.output=x($),W.output=V.output,W.globstar=!0,c(Y);continue}if(X.type==="slash"&&X.prev.type!=="bos"&&!u&&l()){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=!0,W.output+=X.output+V.output,c(Y);continue}if(X.type==="slash"&&X.prev.type!=="bos"&&Q[0]==="/"){let U1=Q[1]!==void 0?"|$":"";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=!0,c(Y+R()),f({type:"slash",value:"/",output:""});continue}if(X.type==="bos"&&Q[0]==="/"){V.type="globstar",V.value+=Y,V.output=`(?:^|${H}|${x($)}${H})`,W.output=V.output,W.globstar=!0,c(Y+R()),f({type:"slash",value:"/",output:""});continue}W.output=W.output.slice(0,-V.output.length),V.type="globstar",V.output=x($),V.value+=Y,W.output+=V.output,W.globstar=!0,c(Y);continue}let O={type:"star",value:Y,output:y};if($.bash===!0){if(O.output=".*?",V.type==="bos"||V.type==="slash")O.output=m+O.output;f(O);continue}if(V&&(V.type==="bracket"||V.type==="paren")&&$.regex===!0){O.output=Y,f(O);continue}if(W.index===W.start||V.type==="slash"||V.type==="dot"){if(V.type==="dot")W.output+=h,V.output+=h;else if($.dot===!0)W.output+=C,V.output+=C;else W.output+=m,V.output+=m;if(L()!=="*")W.output+=P,V.output+=P}f(O)}while(W.brackets>0){if($.strictBrackets===!0)throw new SyntaxError($1("closing","]"));W.output=r.escapeLast(W.output,"["),e("brackets")}while(W.parens>0){if($.strictBrackets===!0)throw new SyntaxError($1("closing",")"));W.output=r.escapeLast(W.output,"("),e("parens")}while(W.braces>0){if($.strictBrackets===!0)throw new SyntaxError($1("closing","}"));W.output=r.escapeLast(W.output,"{"),e("braces")}if($.strictSlashes!==!0&&(V.type==="star"||V.type==="bracket"))f({type:"maybe_slash",value:"",output:`${H}?`});if(W.backtrack===!0){W.output="";for(let Q of W.tokens)if(W.output+=Q.output!=null?Q.output:Q.value,Q.suffix)W.output+=Q.suffix}return W};E1.fastpaths=(q,Z)=>{let $={...Z},J=typeof $.maxLength==="number"?Math.min(M1,$.maxLength):M1,j=q.length;if(j>J)throw new SyntaxError(`Input length: ${j}, exceeds maximum allowed length: ${J}`);q=o0[q]||q;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:!1,prefix:""},I=$.bash===!0?".*?":H;if($.capture)I=`(${I})`;let g=(m)=>{if(m.noglobstar===!0)return I;return`(${h}(?:(?!${P}${m.dot?M:z}).)*?)`},i=(m)=>{switch(m){case"*":return`${N}${B}${I}`;case".*":return`${z}${B}${I}`;case"*.*":return`${N}${I}${z}${B}${I}`;case"*/*":return`${N}${I}${U}${B}${G}${I}`;case"**":return N+g($);case"**/*":return`(?:${N}${g($)}${U})?${G}${B}${I}`;case"**/*.*":return`(?:${N}${g($)}${U})?${G}${I}${z}${B}${I}`;case"**/.*":return`(?:${N}${g($)}${U})?${z}${B}${I}`;default:{let w=/^(.*?)\.(\w+)$/.exec(m);if(!w)return;let y=i(w[1]);if(!y)return;return y+z+w[2]}}},v=r.removePrefix(q,C),x=i(v);if(x&&$.strictSlashes!==!0)x+=`${U}?`;return x};e0.exports=E1});var Zq=_((H8,$q)=>{var DZ=s0(),S1=t0(),qq=j1(),fZ=J1(),HZ=(q)=>q&&typeof q==="object"&&!Array.isArray(q),A=(q,Z,$=!1)=>{if(Array.isArray(q)){let F=q.map((H)=>A(H,Z,$));return(H)=>{for(let P of F){let N=P(H);if(N)return N}return!1}}let J=HZ(q)&&q.tokens&&q.input;if(q===""||typeof q!=="string"&&!J)throw new TypeError("Expected pattern to be a non-empty string");let j=Z||{},z=j.windows,U=J?A.compileRe(q,Z):A.makeRe(q,Z,!1,!0),B=U.state;delete U.state;let M=()=>!1;if(j.ignore){let F={...Z,ignore:null,onMatch:null,onResult:null};M=A(j.ignore,F,$)}let K=(F,T=!1)=>{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};if(typeof j.onResult==="function")j.onResult(G);if(H===!1)return G.isMatch=!1,T?G:!1;if(M(F)){if(typeof j.onIgnore==="function")j.onIgnore(G);return G.isMatch=!1,T?G:!1}if(typeof j.onMatch==="function")j.onMatch(G);return T?G:!0};if($)K.state=B;return K};A.test=(q,Z,$,{glob:J,posix:j}={})=>{if(typeof q!=="string")throw new TypeError("Expected input to be a string");if(q==="")return{isMatch:!1,output:""};let z=$||{},U=z.format||(j?qq.toPosixSlashes:null),B=q===J,M=B&&U?U(q):q;if(B===!1)M=U?U(q):q,B=M===J;if(B===!1||z.capture===!0)if(z.matchBase===!0||z.basename===!0)B=A.matchBase(q,Z,$,j);else B=Z.exec(M);return{isMatch:Boolean(B),match:B,output:M}};A.matchBase=(q,Z,$)=>{return(Z instanceof RegExp?Z:A.makeRe(Z,$)).test(qq.basename(q))};A.isMatch=(q,Z,$)=>A(Z,$)(q);A.parse=(q,Z)=>{if(Array.isArray(q))return q.map(($)=>A.parse($,Z));return S1(q,{...Z,fastpaths:!1})};A.scan=(q,Z)=>DZ(q,Z);A.compileRe=(q,Z,$=!1,J=!1)=>{if($===!0)return q.output;let j=Z||{},z=j.contains?"":"^",U=j.contains?"":"$",B=`${z}(?:${q.output})${U}`;if(q&&q.negated===!0)B=`^(?!${B}).*\$`;let M=A.toRegex(B,Z);if(J===!0)M.state=q;return M};A.makeRe=(q,Z={},$=!1,J=!1)=>{if(!q||typeof q!=="string")throw new TypeError("Expected a non-empty string");let j={negated:!1,fastpaths:!0};if(Z.fastpaths!==!1&&(q[0]==="."||q[0]==="*"))j.output=S1.fastpaths(q,Z);if(!j.output)j=S1(q,Z);return A.compileRe(j,Z,$,J)};A.toRegex=(q,Z)=>{try{let $=Z||{};return new RegExp(q,$.flags||($.nocase?"i":""))}catch($){if(Z&&Z.debug===!0)throw $;return/$^/}};A.constants=fZ;$q.exports=A});var Y1=_((C8,Vq)=>{var Jq=Zq(),CZ=j1();function jq(q,Z,$=!1){if(Z&&(Z.windows===null||Z.windows===void 0))Z={...Z,windows:CZ.isWindows()};return Jq(q,Z,$)}Object.assign(jq,Jq);Vq.exports=jq});var Bq=_((Uq)=>{Object.defineProperty(Uq,"__esModule",{value:!0});Uq.Builder=void 0;var LZ=import.meta.require("path"),Yq=v0(),Wq=null;try{import.meta.require.resolve("picomatch"),Wq=Y1()}catch(q){}class zq{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:LZ.sep,filters:[]};globFunction;constructor(q){this.options={...this.options,...q},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(q){return this.options.pathSeparator=q,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(q){return this.options.maxDepth=q,this}withMaxFiles(q){return this.options.maxFiles=q,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:q=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=q,this.withFullPaths()}withAbortSignal(q){return this.options.signal=q,this}normalize(){return this.options.normalizePath=!0,this}filter(q){return this.options.filters.push(q),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(q){return this.options.exclude=q,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(q){return new Yq.APIBuilder(q||".",this.options)}withGlobFunction(q){return this.globFunction=q,this}crawlWithOptions(q,Z){return this.options={...this.options,...Z},new Yq.APIBuilder(q||".",this.options)}glob(...q){if(this.globFunction)return this.globWithOptions(q);return this.globWithOptions(q,...[{dot:!0}])}globWithOptions(q,...Z){let $=this.globFunction||Wq;if(!$)throw new Error("Please specify a glob function to use glob matching.");var J=this.globCache[q.join("\0")];if(!J)J=$(q,...Z),this.globCache[q.join("\0")]=J;return this.options.filters.push((j)=>J(j)),this}}Uq.Builder=zq});var Fq=_((Qq)=>{Object.defineProperty(Qq,"__esModule",{value:!0})});var Kq=_((a)=>{var PZ=a&&a.__createBinding||(Object.create?function(q,Z,$,J){if(J===void 0)J=$;var j=Object.getOwnPropertyDescriptor(Z,$);if(!j||("get"in j?!Z.__esModule:j.writable||j.configurable))j={enumerable:!0,get:function(){return Z[$]}};Object.defineProperty(q,J,j)}:function(q,Z,$,J){if(J===void 0)J=$;q[J]=Z[$]}),TZ=a&&a.__exportStar||function(q,Z){for(var $ in q)if($!=="default"&&!Object.prototype.hasOwnProperty.call(Z,$))PZ(Z,q,$)};Object.defineProperty(a,"__esModule",{value:!0});a.fdir=void 0;var OZ=Bq();Object.defineProperty(a,"fdir",{enumerable:!0,get:function(){return OZ.Builder}});TZ(Fq(),a)});import{existsSync as Aq}from"fs";import{resolve as xq}from"path";import I1 from"process";import{readdir as _q,readFile as Rq}from"fs/promises";import{extname as Eq,join as g1}from"path";import Sq from"process";async function k1(q,Z){await Bun.write(q,Z)}async function y1(q){let Z=q??Z1.root,$=await _q(Z,{withFileTypes:!0}),J=await Promise.all($.map((j)=>{let z=g1(Z,j.name);return j.isDirectory()?y1(z):z}));return Array.prototype.concat(...J).filter((j)=>Eq(j)===".ts")}async function v1(q){try{let Z=q?.tsconfigPath||g1(q?.root??Sq.cwd(),"tsconfig.json"),$=await Rq(Z,"utf-8");return JSON.parse($).compilerOptions?.isolatedDeclarations===!0}catch(Z){return console.log("Error reading tsconfig.json:",Z),!1}}function m1(q){let J=q.split("\n").map((j)=>{if(j=j.trimEnd(),j.startsWith("export interface")||j.startsWith("export type")){let z=j.split("{");if(z.length>1)return`${z[0].trim()} {${z[1]}`}if(j.endsWith(";"))j=j.slice(0,-1);return j}).join("\n");return J=J.replace(/\n{3,}/g,"\n\n"),J=J.replace(/\/\*\*\n([^*]*)(\n \*\/)/g,(j,z)=>{return`/**\n${z.split("\n").map((B)=>` *${B.trim()?` ${B.trim()}`:""}`).join("\n")}\n */`}),`${J.trim()}\n`}function u1(q){let Z=q.split("\n");return Z.map(($,J)=>{if(J===0)return"/**";if(J===Z.length-1)return" */";return` * ${$.replace(/^\s*\*?\s?/,"").trim()}`}).join("\n")}function Q1(q,...Z){if(!Z.length)return q;let $=Z.shift();if(B1(q)&&B1($)){for(let J in $)if(Object.prototype.hasOwnProperty.call($,J)){let j=$[J];if(B1(j)&&B1(q[J]))q[J]=Q1(q[J],j);else q[J]=j}}return Q1(q,...Z)}function B1(q){return q&&typeof q==="object"&&!Array.isArray(q)}async function bq({name:q,cwd:Z,defaultConfig:$}){let J=Z??I1.cwd(),j=xq(J,`${q}.config`);if(Aq(j))try{let z=await import(j),U=z.default||z;return Q1($,U)}catch(z){console.error(`Error loading config from ${j}:`,z)}return $}var Z1=await bq({name:"dts",cwd:I1.cwd(),defaultConfig:{cwd:I1.cwd(),root:"./src",entrypoints:["**/*.ts"],outdir:"./dist",keepComments:!0,clean:!0,tsconfigPath:"./tsconfig.json"}});import{readFile as gq}from"fs/promises";async function h1(q){let Z=await gq(q,"utf-8"),$="",J=new Set,j=new Map,z=/export\s*(?:\*|\{[^}]*\})\s*from\s*['"][^'"]+['"]/g,U=Z.match(z)||[];$+=`${U.join("\n")}\n`;let B=/import\s+(?:(type)\s+)?(?:(\{[^}]+\})|(\w+))(?:\s*,\s*(?:(\{[^}]+\})|(\w+)))?\s+from\s+['"]([^'"]+)['"]/g;Array.from(Z.matchAll(B)).forEach(([,H,P,N,G,h,C])=>{if(!j.has(C))j.set(C,new Set);let I=(g,i)=>{if(g)g.replace(/[{}]/g,"").split(",").map((x)=>{let[m,w]=x.split(" as ").map((y)=>y.trim());return{name:m.replace(/^type\s+/,""),alias:w||m.replace(/^type\s+/,"")}}).forEach(({name:x})=>{j.get(C).add(x)})};if(I(P,!!H),I(G,!!H),N)j.get(C).add(N);if(h)j.get(C).add(h)});let K=Z.split("\n"),F=0;while(F<K.length){let H="",P="";if(K[F].trim().startsWith("/**")){while(F<K.length&&!K[F].includes("*/"))H+=`${K[F]}\n`,F++;H+=`${K[F]}\n`,F++}if(F<K.length&&K[F].trim().startsWith("export")){P=K[F],F++;while(F<K.length&&!K[F].trim().startsWith("export")&&!K[F].trim().startsWith("/**"))P+=`\n${K[F]}`,F++}if(P){let N=H?u1(H.trim()):"",G=P.trim();if(G.startsWith("export function")||G.startsWith("export async function")){G=G.replace(/^export\s+(async\s+)?function/,"export declare function");let I=G.match(/^.*?\)/);if(I){let g=I[0].slice(I[0].indexOf("(")+1,-1);g=g.replace(/\s*=[^,)]+/g,"");let i=G.match(/\):\s*([^{]+)/);G=`export declare function ${G.split("function")[1].split("(")[0].trim()}(${g})${i?`: ${i[1].trim()}`:""};`}}else if(G.startsWith("export const")||G.startsWith("export let")||G.startsWith("export var"))G=G.replace(/^export\s+(const|let|var)/,"export declare $1"),G=`${G.split("=")[0].trim()};`;$+=`${N}\n${G}\n\n`;let h=/\b([A-Z]\w+)(?:<[^>]*>)?/g;Array.from(G.matchAll(h)).forEach(([,I])=>J.add(I))}if(!P&&!H)F++}let T="";if(j.forEach((H,P)=>{let N=[...H].filter((G)=>J.has(G));if(N.length>0)T+=`import type { ${N.join(", ")} } from '${P}'\n`}),T)$=`${T}\n${$}`;return m1($)}import{mkdir as kZ,rm as vZ}from"fs/promises";import{dirname as mZ,join as uZ,parse as hZ,relative as dZ}from"path";var wq=X1(Kq(),1),A1=X1(Y1(),1),yq=X1(Y1(),1);import Nq,{posix as N1}from"path";var _Z=/\\(?![()[\]{}!+@])/g;function RZ(q){return Iq(q)}function EZ(q){return Dq(q).replace(_Z,"/")}var _8=process.platform==="win32"?EZ:RZ,SZ=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,AZ=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,Iq=(q)=>q.replace(SZ,"\\$&"),Dq=(q)=>q.replace(AZ,"\\$&"),R8=process.platform==="win32"?Dq:Iq;function xZ(q,Z){if((Z==null?void 0:Z.caseSensitiveMatch)===!1)return!0;let $=yq.default.scan(q);return $.isGlob||$.negated}function Gq(q,Z,$,J,j){var z;let U=q;if(q.endsWith("/"))U=q.slice(0,-1);if(!U.endsWith("*")&&Z)U+="/**";if(Nq.isAbsolute(U.replace(/\\(?=[()[\]{}!*+?@|])/g,"")))U=N1.relative($,U);else U=N1.normalize(U);let B=/^(\/?\.\.)+/.exec(U);if(B==null?void 0:B[0]){let M=N1.join($,B[0]);if(J.root.length>M.length)J.root=M,J.depthOffset=-(B[0].length+1)/3}else if(!j&&J.depthOffset>=0){let M=U.split("/");(z=J.commonPath)!=null||(J.commonPath=M);let K=[];for(let F=0;F<Math.min(J.commonPath.length,M.length);F++){let T=M[F];if(T==="**"&&!M[F+1]){K.pop();break}if(T!==J.commonPath[F]||xZ(T)||F===M.length-1)break;K.push(T)}J.depthOffset=K.length,J.commonPath=K,J.root=K.length>0?`${$}/${K.join("/")}`:$}return U}function bZ({patterns:q,ignore:Z=[],expandDirectories:$=!0},J,j){if(typeof q==="string")q=[q];if(typeof Z==="string")Z=[Z];let z=[],U=Z.map((B)=>Gq(B,$,J,j,!0));if(!q)return{match:["**/*"],ignore:U};for(let B of q)if(B=Gq(B,$,J,j,!1),B.startsWith("!")&&B[1]!=="(")U.push(B.slice(1));else z.push(B);return{match:z,ignore:U}}function x1(q,Z,$){return N1.relative(Z,`${$}/${q}`)}function Mq(q,Z,$,J,j){let z=j?q.slice($.length+1)||".":q;if($===Z)return J&&z!=="."?z.slice(0,-1):z;return x1(z,Z,$)}function gZ(q,Z,$){let J={root:Z,commonPath:null,depthOffset:0},j=bZ(q,Z,J),z=A1.default(j.match,{dot:q.dot,nocase:q.caseSensitiveMatch===!1,ignore:j.ignore}),U=A1.default(j.ignore,{dot:q.dot,nocase:q.caseSensitiveMatch===!1}),B={filters:[(K,F)=>z(Mq(K,Z,J.root,F,q.absolute))],exclude:(K,F)=>U(Mq(F,Z,J.root,!0,!0)),pathSeparator:"/",relativePaths:!0};if(q.deep)B.maxDepth=Math.round(q.deep-J.depthOffset);if(q.absolute)B.relativePaths=!1,B.resolvePaths=!0,B.includeBasePath=!0;if(q.followSymbolicLinks===!1)B.resolveSymlinks=!1,B.excludeSymlinks=!0;if(q.onlyDirectories)B.excludeFiles=!0,B.includeDirs=!0;else if(q.onlyFiles===!1)B.includeDirs=!0;J.root=J.root.replace(/\\/g,"");let M=new wq.fdir(B).crawl(J.root);if(Z===J.root||q.absolute)return $?M.sync():M.withPromise();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("/")?"/":"")))}async function fq(q,Z){if(q&&(Z==null?void 0:Z.patterns))throw new Error("Cannot pass patterns as both an argument and an option");let $=Array.isArray(q)||typeof q==="string"?{...Z,patterns:q}:q,J=$.cwd?Nq.resolve($.cwd).replace(/\\/g,"/"):process.cwd().replace(/\\/g,"/");return gZ($,J,!1)}async function lZ(q){try{if(!await v1(q)){console.error("Error: isolatedModules must be set to true in your tsconfig.json. Ensure `tsc --noEmit` does not output any errors.");return}if(q?.clean)await vZ(q.outdir,{recursive:!0,force:!0});let $;if(q?.entrypoints)$=await fq(q.entrypoints,{cwd:q.root??q.cwd,absolute:!0});else $=await y1(q?.root);for(let J of $){let j=await h1(J);if(j){let z=dZ(q?.root??"./src",J),U=hZ(z),B=uZ(q?.outdir??"./dist",`${U.name}.d.ts`);await kZ(mZ(B),{recursive:!0}),await k1(B,j)}else console.warn(`No declarations extracted for ${J}`)}}catch(Z){console.error("Error generating declarations:",Z)}}async function v8(q){await lZ({...Z1,...q})}export{k1 as writeToFile,y1 as getAllTypeScriptFiles,lZ as generateDeclarationsFromFiles,v8 as generate,m1 as formatDeclarations,u1 as formatComment,h1 as extractTypeFromSource,Q1 as deepMerge,Z1 as config,v1 as checkIsolatedDeclarations};
|
|
2
|
+
var gq=Object.create;var{getPrototypeOf:kq,defineProperty:m1,getOwnPropertyNames:vq}=Object;var hq=Object.prototype.hasOwnProperty;var B1=(q,Z,$)=>{$=q!=null?gq(kq(q)):{};let J=Z||!q||!q.__esModule?m1($,"default",{value:q,enumerable:!0}):$;for(let Y of vq(q))if(!hq.call(J,Y))m1(J,Y,{get:()=>q[Y],enumerable:!0});return J};var O=(q,Z)=>()=>(Z||q((Z={exports:{}}).exports,Z),Z.exports);var R1=O(($0)=>{Object.defineProperty($0,"__esModule",{value:!0});$0.normalizePath=$0.convertSlashes=$0.cleanPath=void 0;var O1=import.meta.require("path");function t1(q){let Z=O1.normalize(q);if(Z.length>1&&Z[Z.length-1]===O1.sep)Z=Z.substring(0,Z.length-1);return Z}$0.cleanPath=t1;var I$=/[\\/]/g;function q0(q,Z){return q.replace(I$,Z)}$0.convertSlashes=q0;function H$(q,Z){let{resolvePaths:$,normalizePath:J,pathSeparator:Y}=Z,W=process.platform==="win32"&&q.includes("/")||q.startsWith(".");if($)q=O1.resolve(q);if(J||W)q=t1(q);if(q===".")return"";let j=q[q.length-1]!==Y;return q0(j?q+Y:q,Y)}$0.normalizePath=H$});var j0=O((Y0)=>{Object.defineProperty(Y0,"__esModule",{value:!0});Y0.build=Y0.joinDirectoryPath=Y0.joinPathWithBasePath=void 0;var L$=import.meta.require("path"),_$=R1();function J0(q,Z){return Z+q}Y0.joinPathWithBasePath=J0;function P$(q,Z){return function($,J){if(J.startsWith(q))return J.replace(q,"")+$;else return _$.convertSlashes(L$.relative(q,J),Z.pathSeparator)+Z.pathSeparator+$}}function C$(q){return q}function O$(q,Z,$){return Z+q+$}Y0.joinDirectoryPath=O$;function R$(q,Z){let{relativePaths:$,includeBasePath:J}=Z;return $&&q?P$(q,Z):J?J0:C$}Y0.build=R$});var Q0=O((z0)=>{Object.defineProperty(z0,"__esModule",{value:!0});z0.build=void 0;function A$(q){return function(Z,$){$.push(Z.substring(q.length)||".")}}function T$(q){return function(Z,$,J){let Y=Z.substring(q.length)||".";if(J.every((W)=>W(Y,!0)))$.push(Y)}}var S$=(q,Z)=>{Z.push(q||".")},b$=(q,Z,$)=>{let J=q||".";if($.every((Y)=>Y(J,!0)))Z.push(J)},y$=()=>{};function g$(q,Z){let{includeDirs:$,filters:J,relativePaths:Y}=Z;if(!$)return y$;if(Y)return J&&J.length?T$(q):A$(q);return J&&J.length?b$:S$}z0.build=g$});var F0=O((X0)=>{Object.defineProperty(X0,"__esModule",{value:!0});X0.build=void 0;var k$=(q,Z,$,J)=>{if(J.every((Y)=>Y(q,!1)))$.files++},v$=(q,Z,$,J)=>{if(J.every((Y)=>Y(q,!1)))Z.push(q)},h$=(q,Z,$,J)=>{$.files++},u$=(q,Z)=>{Z.push(q)},m$=()=>{};function d$(q){let{excludeFiles:Z,filters:$,onlyCounts:J}=q;if(Z)return m$;if($&&$.length)return J?k$:v$;else if(J)return h$;else return u$}X0.build=d$});var G0=O((K0)=>{Object.defineProperty(K0,"__esModule",{value:!0});K0.build=void 0;var l$=(q)=>{return q},c$=()=>{return[""].slice(0,0)};function i$(q){return q.group?c$:l$}K0.build=i$});var N0=O((w0)=>{Object.defineProperty(w0,"__esModule",{value:!0});w0.build=void 0;var n$=(q,Z,$)=>{q.push({directory:Z,files:$,dir:Z})},p$=()=>{};function r$(q){return q.group?n$:p$}w0.build=r$});var D0=O((t)=>{var s$=t&&t.__importDefault||function(q){return q&&q.__esModule?q:{default:q}};Object.defineProperty(t,"__esModule",{value:!0});t.build=void 0;var G1=s$(import.meta.require("fs")),I0=import.meta.require("path"),o$=function(q,Z,$){let{queue:J,options:{suppressErrors:Y}}=Z;J.enqueue(),G1.default.realpath(q,(W,j)=>{if(W)return J.dequeue(Y?null:W,Z);G1.default.stat(j,(z,F)=>{if(z)return J.dequeue(Y?null:z,Z);if(F.isDirectory()&&H0(q,j,Z))return J.dequeue(null,Z);$(F,j),J.dequeue(null,Z)})})},a$=function(q,Z,$){let{queue:J,options:{suppressErrors:Y}}=Z;J.enqueue();try{let W=G1.default.realpathSync(q),j=G1.default.statSync(W);if(j.isDirectory()&&H0(q,W,Z))return;$(j,W)}catch(W){if(!Y)throw W}};function e$(q,Z){if(!q.resolveSymlinks||q.excludeSymlinks)return null;return Z?a$:o$}t.build=e$;function H0(q,Z,$){if($.options.useRealPaths)return t$(Z,$);let J=I0.dirname(q),Y=1;while(J!==$.root&&Y<2){let W=$.symlinks.get(J);if(!!W&&(W===Z||W.startsWith(Z)||Z.startsWith(W)))Y++;else J=I0.dirname(J)}return $.symlinks.set(q,Z),Y>1}function t$(q,Z){return Z.visited.includes(q+Z.options.pathSeparator)}});var _0=O((f0)=>{Object.defineProperty(f0,"__esModule",{value:!0});f0.build=void 0;var qZ=(q)=>{return q.counts},$Z=(q)=>{return q.groups},ZZ=(q)=>{return q.paths},JZ=(q)=>{return q.paths.slice(0,q.options.maxFiles)},YZ=(q,Z,$)=>{return w1(Z,$,q.counts,q.options.suppressErrors),null},WZ=(q,Z,$)=>{return w1(Z,$,q.paths,q.options.suppressErrors),null},jZ=(q,Z,$)=>{return w1(Z,$,q.paths.slice(0,q.options.maxFiles),q.options.suppressErrors),null},zZ=(q,Z,$)=>{return w1(Z,$,q.groups,q.options.suppressErrors),null};function w1(q,Z,$,J){if(q&&!J)Z(q,$);else Z(null,$)}function UZ(q,Z){let{onlyCounts:$,group:J,maxFiles:Y}=q;if($)return Z?qZ:YZ;else if(J)return Z?$Z:zZ;else if(Y)return Z?JZ:jZ;else return Z?ZZ:WZ}f0.build=UZ});var O0=O((q1)=>{var QZ=q1&&q1.__importDefault||function(q){return q&&q.__esModule?q:{default:q}};Object.defineProperty(q1,"__esModule",{value:!0});q1.build=void 0;var P0=QZ(import.meta.require("fs")),C0={withFileTypes:!0},XZ=(q,Z,$,J,Y)=>{if(J<0)return q.queue.dequeue(null,q);q.visited.push(Z),q.counts.directories++,q.queue.enqueue(),P0.default.readdir(Z||".",C0,(W,j=[])=>{Y(j,$,J),q.queue.dequeue(q.options.suppressErrors?null:W,q)})},BZ=(q,Z,$,J,Y)=>{if(J<0)return;q.visited.push(Z),q.counts.directories++;let W=[];try{W=P0.default.readdirSync(Z||".",C0)}catch(j){if(!q.options.suppressErrors)throw j}Y(W,$,J)};function FZ(q){return q?BZ:XZ}q1.build=FZ});var A0=O((E0)=>{Object.defineProperty(E0,"__esModule",{value:!0});E0.Queue=void 0;class R0{onQueueEmpty;count=0;constructor(q){this.onQueueEmpty=q}enqueue(){this.count++}dequeue(q,Z){if(--this.count<=0||q)this.onQueueEmpty(q,Z)}}E0.Queue=R0});var y0=O((S0)=>{Object.defineProperty(S0,"__esModule",{value:!0});S0.Counter=void 0;class T0{_files=0;_directories=0;set files(q){this._files=q}get files(){return this._files}set directories(q){this._directories=q}get directories(){return this._directories}get dirs(){return this._directories}}S0.Counter=T0});var A1=O((c)=>{var KZ=c&&c.__createBinding||(Object.create?function(q,Z,$,J){if(J===void 0)J=$;var Y=Object.getOwnPropertyDescriptor(Z,$);if(!Y||("get"in Y?!Z.__esModule:Y.writable||Y.configurable))Y={enumerable:!0,get:function(){return Z[$]}};Object.defineProperty(q,J,Y)}:function(q,Z,$,J){if(J===void 0)J=$;q[J]=Z[$]}),VZ=c&&c.__setModuleDefault||(Object.create?function(q,Z){Object.defineProperty(q,"default",{enumerable:!0,value:Z})}:function(q,Z){q.default=Z}),o=c&&c.__importStar||function(q){if(q&&q.__esModule)return q;var Z={};if(q!=null){for(var $ in q)if($!=="default"&&Object.prototype.hasOwnProperty.call(q,$))KZ(Z,q,$)}return VZ(Z,q),Z};Object.defineProperty(c,"__esModule",{value:!0});c.Walker=void 0;var g0=import.meta.require("path"),E1=R1(),x1=o(j0()),GZ=o(Q0()),wZ=o(F0()),MZ=o(G0()),NZ=o(N0()),IZ=o(D0()),HZ=o(_0()),DZ=o(O0()),fZ=A0(),LZ=y0();class k0{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(q,Z,$){this.isSynchronous=!$,this.callbackInvoker=HZ.build(Z,this.isSynchronous),this.root=E1.normalizePath(q,Z),this.state={root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new LZ.Counter,options:Z,queue:new fZ.Queue((J,Y)=>this.callbackInvoker(Y,J,$)),symlinks:new Map,visited:[""].slice(0,0)},this.joinPath=x1.build(this.root,Z),this.pushDirectory=GZ.build(this.root,Z),this.pushFile=wZ.build(Z),this.getArray=MZ.build(Z),this.groupFiles=NZ.build(Z),this.resolveSymlink=IZ.build(Z,this.isSynchronous),this.walkDirectory=DZ.build(this.isSynchronous)}start(){return this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(q,Z,$)=>{let{paths:J,options:{filters:Y,resolveSymlinks:W,excludeSymlinks:j,exclude:z,maxFiles:F,signal:G,useRealPaths:V,pathSeparator:f}}=this.state;if(G&&G.aborted||F&&J.length>F)return;this.pushDirectory(Z,J,Y);let D=this.getArray(this.state.paths);for(let S=0;S<q.length;++S){let M=q[S];if(M.isFile()||M.isSymbolicLink()&&!W&&!j){let L=this.joinPath(M.name,Z);this.pushFile(L,D,this.state.counts,Y)}else if(M.isDirectory()){let L=x1.joinDirectoryPath(M.name,Z,this.state.options.pathSeparator);if(z&&z(M.name,L))continue;this.walkDirectory(this.state,L,L,$-1,this.walk)}else if(M.isSymbolicLink()&&this.resolveSymlink){let L=x1.joinPathWithBasePath(M.name,Z);this.resolveSymlink(L,this.state,(n,x)=>{if(n.isDirectory()){if(x=E1.normalizePath(x,this.state.options),z&&z(M.name,x))return;this.walkDirectory(this.state,x,V?x:L+f,$-1,this.walk)}else{x=V?x:L;let _=g0.basename(x),m=E1.normalizePath(g0.dirname(x),this.state.options);x=this.joinPath(_,m),this.pushFile(x,D,this.state.counts,Y)}})}}this.groupFiles(this.state.groups,Z,D)}}c.Walker=k0});var m0=O((h0)=>{Object.defineProperty(h0,"__esModule",{value:!0});h0.callback=h0.promise=void 0;var _Z=A1();function PZ(q,Z){return new Promise(($,J)=>{v0(q,Z,(Y,W)=>{if(Y)return J(Y);$(W)})})}h0.promise=PZ;function v0(q,Z,$){new _Z.Walker(q,Z,$).start()}h0.callback=v0});var c0=O((d0)=>{Object.defineProperty(d0,"__esModule",{value:!0});d0.sync=void 0;var OZ=A1();function RZ(q,Z){return new OZ.Walker(q,Z).start()}d0.sync=RZ});var s0=O((p0)=>{Object.defineProperty(p0,"__esModule",{value:!0});p0.APIBuilder=void 0;var i0=m0(),EZ=c0();class n0{root;options;constructor(q,Z){this.root=q,this.options=Z}withPromise(){return i0.promise(this.root,this.options)}withCallback(q){i0.callback(this.root,this.options,q)}sync(){return EZ.sync(this.root,this.options)}}p0.APIBuilder=n0});var Y1=O((jJ,a0)=>{var o0={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:"/"},xZ={...o0,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:"\\"},AZ={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"};a0.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:AZ,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){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${q.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(q){return q===!0?xZ:o0}}});var W1=O((gZ)=>{var{REGEX_BACKSLASH:TZ,REGEX_REMOVE_BACKSLASH:SZ,REGEX_SPECIAL_CHARS:bZ,REGEX_SPECIAL_CHARS_GLOBAL:yZ}=Y1();gZ.isObject=(q)=>q!==null&&typeof q==="object"&&!Array.isArray(q);gZ.hasRegexChars=(q)=>bZ.test(q);gZ.isRegexChar=(q)=>q.length===1&&gZ.hasRegexChars(q);gZ.escapeRegex=(q)=>q.replace(yZ,"\\$1");gZ.toPosixSlashes=(q)=>q.replace(TZ,"/");gZ.isWindows=()=>{if(typeof navigator!=="undefined"&&navigator.platform){let q=navigator.platform.toLowerCase();return q==="win32"||q==="windows"}if(typeof process!=="undefined"&&process.platform)return process.platform==="win32";return!1};gZ.removeBackslashes=(q)=>{return q.replace(SZ,(Z)=>{return Z==="\\"?"":Z})};gZ.escapeLast=(q,Z,$)=>{let J=q.lastIndexOf(Z,$);if(J===-1)return q;if(q[J-1]==="\\")return gZ.escapeLast(q,Z,J-1);return`${q.slice(0,J)}\\${q.slice(J)}`};gZ.removePrefix=(q,Z={})=>{let $=q;if($.startsWith("./"))$=$.slice(2),Z.prefix="./";return $};gZ.wrapOutput=(q,Z={},$={})=>{let J=$.contains?"":"^",Y=$.contains?"":"$",W=`${J}(?:${q})${Y}`;if(Z.negated===!0)W=`(?:^(?!${W}).*\$)`;return W};gZ.basename=(q,{windows:Z}={})=>{let $=q.split(Z?/[\\/]/:"/"),J=$[$.length-1];if(J==="")return $[$.length-2];return J}});var zq=O((UJ,jq)=>{var qq=W1(),{CHAR_ASTERISK:T1,CHAR_AT:nZ,CHAR_BACKWARD_SLASH:j1,CHAR_COMMA:pZ,CHAR_DOT:S1,CHAR_EXCLAMATION_MARK:b1,CHAR_FORWARD_SLASH:Wq,CHAR_LEFT_CURLY_BRACE:y1,CHAR_LEFT_PARENTHESES:g1,CHAR_LEFT_SQUARE_BRACKET:rZ,CHAR_PLUS:sZ,CHAR_QUESTION_MARK:$q,CHAR_RIGHT_CURLY_BRACE:oZ,CHAR_RIGHT_PARENTHESES:Zq,CHAR_RIGHT_SQUARE_BRACKET:aZ}=Y1(),Jq=(q)=>{return q===Wq||q===j1},Yq=(q)=>{if(q.isPrefix!==!0)q.depth=q.isGlobstar?1/0:1},eZ=(q,Z)=>{let $=Z||{},J=q.length-1,Y=$.parts===!0||$.scanToEnd===!0,W=[],j=[],z=[],F=q,G=-1,V=0,f=0,D=!1,S=!1,M=!1,L=!1,n=!1,x=!1,_=!1,m=!1,a=!1,k=!1,g=0,u,w,I={value:"",depth:0,isGlob:!1},X=()=>G>=J,h=()=>F.charCodeAt(G+1),b=()=>{return u=w,F.charCodeAt(++G)};while(G<J){w=b();let P;if(w===j1){if(_=I.backslashes=!0,w=b(),w===y1)x=!0;continue}if(x===!0||w===y1){g++;while(X()!==!0&&(w=b())){if(w===j1){_=I.backslashes=!0,b();continue}if(w===y1){g++;continue}if(x!==!0&&w===S1&&(w=b())===S1){if(D=I.isBrace=!0,M=I.isGlob=!0,k=!0,Y===!0)continue;break}if(x!==!0&&w===pZ){if(D=I.isBrace=!0,M=I.isGlob=!0,k=!0,Y===!0)continue;break}if(w===oZ){if(g--,g===0){x=!1,D=I.isBrace=!0,k=!0;break}}}if(Y===!0)continue;break}if(w===Wq){if(W.push(G),j.push(I),I={value:"",depth:0,isGlob:!1},k===!0)continue;if(u===S1&&G===V+1){V+=2;continue}f=G+1;continue}if($.noext!==!0){if((w===sZ||w===nZ||w===T1||w===$q||w===b1)===!0&&h()===g1){if(M=I.isGlob=!0,L=I.isExtglob=!0,k=!0,w===b1&&G===V)a=!0;if(Y===!0){while(X()!==!0&&(w=b())){if(w===j1){_=I.backslashes=!0,w=b();continue}if(w===Zq){M=I.isGlob=!0,k=!0;break}}continue}break}}if(w===T1){if(u===T1)n=I.isGlobstar=!0;if(M=I.isGlob=!0,k=!0,Y===!0)continue;break}if(w===$q){if(M=I.isGlob=!0,k=!0,Y===!0)continue;break}if(w===rZ){while(X()!==!0&&(P=b())){if(P===j1){_=I.backslashes=!0,b();continue}if(P===aZ){S=I.isBracket=!0,M=I.isGlob=!0,k=!0;break}}if(Y===!0)continue;break}if($.nonegate!==!0&&w===b1&&G===V){m=I.negated=!0,V++;continue}if($.noparen!==!0&&w===g1){if(M=I.isGlob=!0,Y===!0){while(X()!==!0&&(w=b())){if(w===g1){_=I.backslashes=!0,w=b();continue}if(w===Zq){k=!0;break}}continue}break}if(M===!0){if(k=!0,Y===!0)continue;break}}if($.noext===!0)L=!1,M=!1;let A=F,U="",Q="";if(V>0)U=F.slice(0,V),F=F.slice(V),f-=V;if(A&&M===!0&&f>0)A=F.slice(0,f),Q=F.slice(f);else if(M===!0)A="",Q=F;else A=F;if(A&&A!==""&&A!=="/"&&A!==F){if(Jq(A.charCodeAt(A.length-1)))A=A.slice(0,-1)}if($.unescape===!0){if(Q)Q=qq.removeBackslashes(Q);if(A&&_===!0)A=qq.removeBackslashes(A)}let d={prefix:U,input:q,start:V,base:A,glob:Q,isBrace:D,isBracket:S,isGlob:M,isExtglob:L,isGlobstar:n,negated:m,negatedExtglob:a};if($.tokens===!0){if(d.maxDepth=0,!Jq(w))j.push(I);d.tokens=j}if($.parts===!0||$.tokens===!0){let P;for(let R=0;R<W.length;R++){let p=P?P+1:V,l=W[R],s=q.slice(p,l);if($.tokens){if(R===0&&V!==0)j[R].isPrefix=!0,j[R].value=U;else j[R].value=s;Yq(j[R]),d.maxDepth+=j[R].depth}if(R!==0||s!=="")z.push(s);P=l}if(P&&P+1<q.length){let R=q.slice(P+1);if(z.push(R),$.tokens)j[j.length-1].value=R,Yq(j[j.length-1]),d.maxDepth+=j[j.length-1].depth}d.slashes=W,d.parts=z}return d};jq.exports=eZ});var Xq=O((QJ,Qq)=>{var M1=Y1(),i=W1(),{MAX_LENGTH:N1,POSIX_REGEX_SOURCE:tZ,REGEX_NON_SPECIAL_CHARS:q8,REGEX_SPECIAL_CHARS_BACKREF:$8,REPLACEMENTS:Uq}=M1,Z8=(q,Z)=>{if(typeof Z.expandRange==="function")return Z.expandRange(...q,Z);q.sort();let $=`[${q.join("-")}]`;try{new RegExp($)}catch(J){return q.map((Y)=>i.escapeRegex(Y)).join("..")}return $},$1=(q,Z)=>{return`Missing ${q}: "${Z}" - use "\\\\${Z}" to match literal characters`},k1=(q,Z)=>{if(typeof q!=="string")throw new TypeError("Expected a string");q=Uq[q]||q;let $={...Z},J=typeof $.maxLength==="number"?Math.min(N1,$.maxLength):N1,Y=q.length;if(Y>J)throw new SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${J}`);let W={type:"bos",value:"",output:$.prepend||""},j=[W],z=$.capture?"":"?:",F=M1.globChars($.windows),G=M1.extglobChars(F),{DOT_LITERAL:V,PLUS_LITERAL:f,SLASH_LITERAL:D,ONE_CHAR:S,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:n,NO_DOTS_SLASH:x,QMARK:_,QMARK_NO_DOT:m,STAR:a,START_ANCHOR:k}=F,g=(K)=>{return`(${z}(?:(?!${k}${K.dot?M:V}).)*?)`},u=$.dot?"":L,w=$.dot?_:m,I=$.bash===!0?g($):a;if($.capture)I=`(${I})`;if(typeof $.noext==="boolean")$.noextglob=$.noext;let X={input:q,index:-1,start:0,dot:$.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:j};q=i.removePrefix(q,X),Y=q.length;let h=[],b=[],A=[],U=W,Q,d=()=>X.index===Y-1,P=X.peek=(K=1)=>q[X.index+K],R=X.advance=()=>q[++X.index]||"",p=()=>q.slice(X.index+1),l=(K="",C=0)=>{X.consumed+=K,X.index+=C},s=(K)=>{X.output+=K.output!=null?K.output:K.value,l(K.value)},bq=()=>{let K=1;while(P()==="!"&&(P(2)!=="("||P(3)==="?"))R(),X.start++,K++;if(K%2===0)return!1;return X.negated=!0,X.start++,!0},U1=(K)=>{X[K]++,A.push(K)},e=(K)=>{X[K]--,A.pop()},H=(K)=>{if(U.type==="globstar"){let C=X.braces>0&&(K.type==="comma"||K.type==="brace"),B=K.extglob===!0||h.length&&(K.type==="pipe"||K.type==="paren");if(K.type!=="slash"&&K.type!=="paren"&&!C&&!B)X.output=X.output.slice(0,-U.output.length),U.type="star",U.value="*",U.output=I,X.output+=U.output}if(h.length&&K.type!=="paren")h[h.length-1].inner+=K.value;if(K.value||K.output)s(K);if(U&&U.type==="text"&&K.type==="text"){U.output=(U.output||U.value)+K.value,U.value+=K.value;return}K.prev=U,j.push(K),U=K},Q1=(K,C)=>{let B={...G[C],conditions:1,inner:""};B.prev=U,B.parens=X.parens,B.output=X.output;let N=($.capture?"(":"")+B.open;U1("parens"),H({type:K,value:C,output:X.output?"":S}),H({type:"paren",extglob:!0,value:R(),output:N}),h.push(B)},yq=(K)=>{let C=K.close+($.capture?")":""),B;if(K.type==="negate"){let N=I;if(K.inner&&K.inner.length>1&&K.inner.includes("/"))N=g($);if(N!==I||d()||/^\)+$/.test(p()))C=K.close=`)\$))${N}`;if(K.inner.includes("*")&&(B=p())&&/^\.[^\\/.]+$/.test(B)){let E=k1(B,{...Z,fastpaths:!1}).output;C=K.close=`)${E})${N})`}if(K.prev.type==="bos")X.negatedExtglob=!0}H({type:"paren",extglob:!0,value:Q,output:C}),e("parens")};if($.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(q)){let K=!1,C=q.replace($8,(B,N,E,v,y,H1)=>{if(v==="\\")return K=!0,B;if(v==="?"){if(N)return N+v+(y?_.repeat(y.length):"");if(H1===0)return w+(y?_.repeat(y.length):"");return _.repeat(E.length)}if(v===".")return V.repeat(E.length);if(v==="*"){if(N)return N+v+(y?I:"");return I}return N?B:`\\${B}`});if(K===!0)if($.unescape===!0)C=C.replace(/\\/g,"");else C=C.replace(/\\+/g,(B)=>{return B.length%2===0?"\\\\":B?"\\":""});if(C===q&&$.contains===!0)return X.output=q,X;return X.output=i.wrapOutput(C,X,Z),X}while(!d()){if(Q=R(),Q==="\0")continue;if(Q==="\\"){let B=P();if(B==="/"&&$.bash!==!0)continue;if(B==="."||B===";")continue;if(!B){Q+="\\",H({type:"text",value:Q});continue}let N=/^\\+/.exec(p()),E=0;if(N&&N[0].length>2){if(E=N[0].length,X.index+=E,E%2!==0)Q+="\\"}if($.unescape===!0)Q=R();else Q+=R();if(X.brackets===0){H({type:"text",value:Q});continue}}if(X.brackets>0&&(Q!=="]"||U.value==="["||U.value==="[^")){if($.posix!==!1&&Q===":"){let B=U.value.slice(1);if(B.includes("[")){if(U.posix=!0,B.includes(":")){let N=U.value.lastIndexOf("["),E=U.value.slice(0,N),v=U.value.slice(N+2),y=tZ[v];if(y){if(U.value=E+y,X.backtrack=!0,R(),!W.output&&j.indexOf(U)===1)W.output=S;continue}}}}if(Q==="["&&P()!==":"||Q==="-"&&P()==="]")Q=`\\${Q}`;if(Q==="]"&&(U.value==="["||U.value==="[^"))Q=`\\${Q}`;if($.posix===!0&&Q==="!"&&U.value==="[")Q="^";U.value+=Q,s({value:Q});continue}if(X.quotes===1&&Q!=='"'){Q=i.escapeRegex(Q),U.value+=Q,s({value:Q});continue}if(Q==='"'){if(X.quotes=X.quotes===1?0:1,$.keepQuotes===!0)H({type:"text",value:Q});continue}if(Q==="("){U1("parens"),H({type:"paren",value:Q});continue}if(Q===")"){if(X.parens===0&&$.strictBrackets===!0)throw new SyntaxError($1("opening","("));let B=h[h.length-1];if(B&&X.parens===B.parens+1){yq(h.pop());continue}H({type:"paren",value:Q,output:X.parens?")":"\\)"}),e("parens");continue}if(Q==="["){if($.nobracket===!0||!p().includes("]")){if($.nobracket!==!0&&$.strictBrackets===!0)throw new SyntaxError($1("closing","]"));Q=`\\${Q}`}else U1("brackets");H({type:"bracket",value:Q});continue}if(Q==="]"){if($.nobracket===!0||U&&U.type==="bracket"&&U.value.length===1){H({type:"text",value:Q,output:`\\${Q}`});continue}if(X.brackets===0){if($.strictBrackets===!0)throw new SyntaxError($1("opening","["));H({type:"text",value:Q,output:`\\${Q}`});continue}e("brackets");let B=U.value.slice(1);if(U.posix!==!0&&B[0]==="^"&&!B.includes("/"))Q=`/${Q}`;if(U.value+=Q,s({value:Q}),$.literalBrackets===!1||i.hasRegexChars(B))continue;let N=i.escapeRegex(U.value);if(X.output=X.output.slice(0,-U.value.length),$.literalBrackets===!0){X.output+=N,U.value=N;continue}U.value=`(${z}${N}|${U.value})`,X.output+=U.value;continue}if(Q==="{"&&$.nobrace!==!0){U1("braces");let B={type:"brace",value:Q,output:"(",outputIndex:X.output.length,tokensIndex:X.tokens.length};b.push(B),H(B);continue}if(Q==="}"){let B=b[b.length-1];if($.nobrace===!0||!B){H({type:"text",value:Q,output:Q});continue}let N=")";if(B.dots===!0){let E=j.slice(),v=[];for(let y=E.length-1;y>=0;y--){if(j.pop(),E[y].type==="brace")break;if(E[y].type!=="dots")v.unshift(E[y].value)}N=Z8(v,$),X.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let E=X.output.slice(0,B.outputIndex),v=X.tokens.slice(B.tokensIndex);B.value=B.output="\\{",Q=N="\\}",X.output=E;for(let y of v)X.output+=y.output||y.value}H({type:"brace",value:Q,output:N}),e("braces"),b.pop();continue}if(Q==="|"){if(h.length>0)h[h.length-1].conditions++;H({type:"text",value:Q});continue}if(Q===","){let B=Q,N=b[b.length-1];if(N&&A[A.length-1]==="braces")N.comma=!0,B="|";H({type:"comma",value:Q,output:B});continue}if(Q==="/"){if(U.type==="dot"&&X.index===X.start+1){X.start=X.index+1,X.consumed="",X.output="",j.pop(),U=W;continue}H({type:"slash",value:Q,output:D});continue}if(Q==="."){if(X.braces>0&&U.type==="dot"){if(U.value===".")U.output=V;let B=b[b.length-1];U.type="dots",U.output+=Q,U.value+=Q,B.dots=!0;continue}if(X.braces+X.parens===0&&U.type!=="bos"&&U.type!=="slash"){H({type:"text",value:Q,output:V});continue}H({type:"dot",value:Q,output:V});continue}if(Q==="?"){if(!(U&&U.value==="(")&&$.noextglob!==!0&&P()==="("&&P(2)!=="?"){Q1("qmark",Q);continue}if(U&&U.type==="paren"){let N=P(),E=Q;if(U.value==="("&&!/[!=<:]/.test(N)||N==="<"&&!/<([!=]|\w+>)/.test(p()))E=`\\${Q}`;H({type:"text",value:Q,output:E});continue}if($.dot!==!0&&(U.type==="slash"||U.type==="bos")){H({type:"qmark",value:Q,output:m});continue}H({type:"qmark",value:Q,output:_});continue}if(Q==="!"){if($.noextglob!==!0&&P()==="("){if(P(2)!=="?"||!/[!=<:]/.test(P(3))){Q1("negate",Q);continue}}if($.nonegate!==!0&&X.index===0){bq();continue}}if(Q==="+"){if($.noextglob!==!0&&P()==="("&&P(2)!=="?"){Q1("plus",Q);continue}if(U&&U.value==="("||$.regex===!1){H({type:"plus",value:Q,output:f});continue}if(U&&(U.type==="bracket"||U.type==="paren"||U.type==="brace")||X.parens>0){H({type:"plus",value:Q});continue}H({type:"plus",value:f});continue}if(Q==="@"){if($.noextglob!==!0&&P()==="("&&P(2)!=="?"){H({type:"at",extglob:!0,value:Q,output:""});continue}H({type:"text",value:Q});continue}if(Q!=="*"){if(Q==="$"||Q==="^")Q=`\\${Q}`;let B=q8.exec(p());if(B)Q+=B[0],X.index+=B[0].length;H({type:"text",value:Q});continue}if(U&&(U.type==="globstar"||U.star===!0)){U.type="star",U.star=!0,U.value+=Q,U.output=I,X.backtrack=!0,X.globstar=!0,l(Q);continue}let K=p();if($.noextglob!==!0&&/^\([^?]/.test(K)){Q1("star",Q);continue}if(U.type==="star"){if($.noglobstar===!0){l(Q);continue}let B=U.prev,N=B.prev,E=B.type==="slash"||B.type==="bos",v=N&&(N.type==="star"||N.type==="globstar");if($.bash===!0&&(!E||K[0]&&K[0]!=="/")){H({type:"star",value:Q,output:""});continue}let y=X.braces>0&&(B.type==="comma"||B.type==="brace"),H1=h.length&&(B.type==="pipe"||B.type==="paren");if(!E&&B.type!=="paren"&&!y&&!H1){H({type:"star",value:Q,output:""});continue}while(K.slice(0,3)==="/**"){let X1=q[X.index+4];if(X1&&X1!=="/")break;K=K.slice(3),l("/**",3)}if(B.type==="bos"&&d()){U.type="globstar",U.value+=Q,U.output=g($),X.output=U.output,X.globstar=!0,l(Q);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!v&&d()){X.output=X.output.slice(0,-(B.output+U.output).length),B.output=`(?:${B.output}`,U.type="globstar",U.output=g($)+($.strictSlashes?")":"|$)"),U.value+=Q,X.globstar=!0,X.output+=B.output+U.output,l(Q);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&K[0]==="/"){let X1=K[1]!==void 0?"|$":"";X.output=X.output.slice(0,-(B.output+U.output).length),B.output=`(?:${B.output}`,U.type="globstar",U.output=`${g($)}${D}|${D}${X1})`,U.value+=Q,X.output+=B.output+U.output,X.globstar=!0,l(Q+R()),H({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&K[0]==="/"){U.type="globstar",U.value+=Q,U.output=`(?:^|${D}|${g($)}${D})`,X.output=U.output,X.globstar=!0,l(Q+R()),H({type:"slash",value:"/",output:""});continue}X.output=X.output.slice(0,-U.output.length),U.type="globstar",U.output=g($),U.value+=Q,X.output+=U.output,X.globstar=!0,l(Q);continue}let C={type:"star",value:Q,output:I};if($.bash===!0){if(C.output=".*?",U.type==="bos"||U.type==="slash")C.output=u+C.output;H(C);continue}if(U&&(U.type==="bracket"||U.type==="paren")&&$.regex===!0){C.output=Q,H(C);continue}if(X.index===X.start||U.type==="slash"||U.type==="dot"){if(U.type==="dot")X.output+=n,U.output+=n;else if($.dot===!0)X.output+=x,U.output+=x;else X.output+=u,U.output+=u;if(P()!=="*")X.output+=S,U.output+=S}H(C)}while(X.brackets>0){if($.strictBrackets===!0)throw new SyntaxError($1("closing","]"));X.output=i.escapeLast(X.output,"["),e("brackets")}while(X.parens>0){if($.strictBrackets===!0)throw new SyntaxError($1("closing",")"));X.output=i.escapeLast(X.output,"("),e("parens")}while(X.braces>0){if($.strictBrackets===!0)throw new SyntaxError($1("closing","}"));X.output=i.escapeLast(X.output,"{"),e("braces")}if($.strictSlashes!==!0&&(U.type==="star"||U.type==="bracket"))H({type:"maybe_slash",value:"",output:`${D}?`});if(X.backtrack===!0){X.output="";for(let K of X.tokens)if(X.output+=K.output!=null?K.output:K.value,K.suffix)X.output+=K.suffix}return X};k1.fastpaths=(q,Z)=>{let $={...Z},J=typeof $.maxLength==="number"?Math.min(N1,$.maxLength):N1,Y=q.length;if(Y>J)throw new SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${J}`);q=Uq[q]||q;let{DOT_LITERAL:W,SLASH_LITERAL:j,ONE_CHAR:z,DOTS_SLASH:F,NO_DOT:G,NO_DOTS:V,NO_DOTS_SLASH:f,STAR:D,START_ANCHOR:S}=M1.globChars($.windows),M=$.dot?V:G,L=$.dot?f:G,n=$.capture?"":"?:",x={negated:!1,prefix:""},_=$.bash===!0?".*?":D;if($.capture)_=`(${_})`;let m=(u)=>{if(u.noglobstar===!0)return _;return`(${n}(?:(?!${S}${u.dot?F:W}).)*?)`},a=(u)=>{switch(u){case"*":return`${M}${z}${_}`;case".*":return`${W}${z}${_}`;case"*.*":return`${M}${_}${W}${z}${_}`;case"*/*":return`${M}${_}${j}${z}${L}${_}`;case"**":return M+m($);case"**/*":return`(?:${M}${m($)}${j})?${L}${z}${_}`;case"**/*.*":return`(?:${M}${m($)}${j})?${L}${_}${W}${z}${_}`;case"**/.*":return`(?:${M}${m($)}${j})?${W}${z}${_}`;default:{let w=/^(.*?)\.(\w+)$/.exec(u);if(!w)return;let I=a(w[1]);if(!I)return;return I+W+w[2]}}},k=i.removePrefix(q,x),g=a(k);if(g&&$.strictSlashes!==!0)g+=`${j}?`;return g};Qq.exports=k1});var Kq=O((XJ,Fq)=>{var J8=zq(),v1=Xq(),Bq=W1(),Y8=Y1(),W8=(q)=>q&&typeof q==="object"&&!Array.isArray(q),T=(q,Z,$=!1)=>{if(Array.isArray(q)){let V=q.map((D)=>T(D,Z,$));return(D)=>{for(let S of V){let M=S(D);if(M)return M}return!1}}let J=W8(q)&&q.tokens&&q.input;if(q===""||typeof q!=="string"&&!J)throw new TypeError("Expected pattern to be a non-empty string");let Y=Z||{},W=Y.windows,j=J?T.compileRe(q,Z):T.makeRe(q,Z,!1,!0),z=j.state;delete j.state;let F=()=>!1;if(Y.ignore){let V={...Z,ignore:null,onMatch:null,onResult:null};F=T(Y.ignore,V,$)}let G=(V,f=!1)=>{let{isMatch:D,match:S,output:M}=T.test(V,j,Z,{glob:q,posix:W}),L={glob:q,state:z,regex:j,posix:W,input:V,output:M,match:S,isMatch:D};if(typeof Y.onResult==="function")Y.onResult(L);if(D===!1)return L.isMatch=!1,f?L:!1;if(F(V)){if(typeof Y.onIgnore==="function")Y.onIgnore(L);return L.isMatch=!1,f?L:!1}if(typeof Y.onMatch==="function")Y.onMatch(L);return f?L:!0};if($)G.state=z;return G};T.test=(q,Z,$,{glob:J,posix:Y}={})=>{if(typeof q!=="string")throw new TypeError("Expected input to be a string");if(q==="")return{isMatch:!1,output:""};let W=$||{},j=W.format||(Y?Bq.toPosixSlashes:null),z=q===J,F=z&&j?j(q):q;if(z===!1)F=j?j(q):q,z=F===J;if(z===!1||W.capture===!0)if(W.matchBase===!0||W.basename===!0)z=T.matchBase(q,Z,$,Y);else z=Z.exec(F);return{isMatch:Boolean(z),match:z,output:F}};T.matchBase=(q,Z,$)=>{return(Z instanceof RegExp?Z:T.makeRe(Z,$)).test(Bq.basename(q))};T.isMatch=(q,Z,$)=>T(Z,$)(q);T.parse=(q,Z)=>{if(Array.isArray(q))return q.map(($)=>T.parse($,Z));return v1(q,{...Z,fastpaths:!1})};T.scan=(q,Z)=>J8(q,Z);T.compileRe=(q,Z,$=!1,J=!1)=>{if($===!0)return q.output;let Y=Z||{},W=Y.contains?"":"^",j=Y.contains?"":"$",z=`${W}(?:${q.output})${j}`;if(q&&q.negated===!0)z=`^(?!${z}).*\$`;let F=T.toRegex(z,Z);if(J===!0)F.state=q;return F};T.makeRe=(q,Z={},$=!1,J=!1)=>{if(!q||typeof q!=="string")throw new TypeError("Expected a non-empty string");let Y={negated:!1,fastpaths:!0};if(Z.fastpaths!==!1&&(q[0]==="."||q[0]==="*"))Y.output=v1.fastpaths(q,Z);if(!Y.output)Y=v1(q,Z);return T.compileRe(Y,Z,$,J)};T.toRegex=(q,Z)=>{try{let $=Z||{};return new RegExp(q,$.flags||($.nocase?"i":""))}catch($){if(Z&&Z.debug===!0)throw $;return/$^/}};T.constants=Y8;Fq.exports=T});var z1=O((BJ,wq)=>{var Vq=Kq(),j8=W1();function Gq(q,Z,$=!1){if(Z&&(Z.windows===null||Z.windows===void 0))Z={...Z,windows:j8.isWindows()};return Vq(q,Z,$)}Object.assign(Gq,Vq);wq.exports=Gq});var fq=O((Hq)=>{Object.defineProperty(Hq,"__esModule",{value:!0});Hq.Builder=void 0;var z8=import.meta.require("path"),Mq=s0(),Nq=null;try{import.meta.require.resolve("picomatch"),Nq=z1()}catch(q){}class Iq{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:z8.sep,filters:[]};globFunction;constructor(q){this.options={...this.options,...q},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(q){return this.options.pathSeparator=q,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(q){return this.options.maxDepth=q,this}withMaxFiles(q){return this.options.maxFiles=q,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:q=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=q,this.withFullPaths()}withAbortSignal(q){return this.options.signal=q,this}normalize(){return this.options.normalizePath=!0,this}filter(q){return this.options.filters.push(q),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(q){return this.options.exclude=q,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(q){return new Mq.APIBuilder(q||".",this.options)}withGlobFunction(q){return this.globFunction=q,this}crawlWithOptions(q,Z){return this.options={...this.options,...Z},new Mq.APIBuilder(q||".",this.options)}glob(...q){if(this.globFunction)return this.globWithOptions(q);return this.globWithOptions(q,...[{dot:!0}])}globWithOptions(q,...Z){let $=this.globFunction||Nq;if(!$)throw new Error("Please specify a glob function to use glob matching.");var J=this.globCache[q.join("\0")];if(!J)J=$(q,...Z),this.globCache[q.join("\0")]=J;return this.options.filters.push((Y)=>J(Y)),this}}Hq.Builder=Iq});var _q=O((Lq)=>{Object.defineProperty(Lq,"__esModule",{value:!0})});var Pq=O((r)=>{var U8=r&&r.__createBinding||(Object.create?function(q,Z,$,J){if(J===void 0)J=$;var Y=Object.getOwnPropertyDescriptor(Z,$);if(!Y||("get"in Y?!Z.__esModule:Y.writable||Y.configurable))Y={enumerable:!0,get:function(){return Z[$]}};Object.defineProperty(q,J,Y)}:function(q,Z,$,J){if(J===void 0)J=$;q[J]=Z[$]}),Q8=r&&r.__exportStar||function(q,Z){for(var $ in q)if($!=="default"&&!Object.prototype.hasOwnProperty.call(Z,$))U8(Z,q,$)};Object.defineProperty(r,"__esModule",{value:!0});r.fdir=void 0;var X8=fq();Object.defineProperty(r,"fdir",{enumerable:!0,get:function(){return X8.Builder}});Q8(_q(),r)});import{existsSync as dq}from"fs";import{resolve as lq}from"path";import f1 from"process";import{readdir as uq}from"fs/promises";import{extname as mq,join as l1}from"path";import d1 from"process";async function c1(q,Z){await Bun.write(q,Z)}async function D1(q){let Z=q??Z1.root,$=await uq(Z,{withFileTypes:!0}),J=await Promise.all($.map((Y)=>{let W=l1(Z,Y.name);return Y.isDirectory()?D1(W):W}));return Array.prototype.concat(...J).filter((Y)=>mq(Y)===".ts")}async function i1(q){try{return(await import(q?.tsconfigPath||l1(q?.root??d1.cwd(),"tsconfig.json"))).compilerOptions?.isolatedDeclarations===!0}catch(Z){return console.log("Error reading tsconfig.json:",Z),!1}}function A8(q){let J=q.split("\n").map((Y)=>{if(Y=Y.trimEnd(),Y.startsWith("export interface")||Y.startsWith("export type")){let W=Y.split("{");if(W.length>1)return`${W[0].trim()} {${W[1]}`}if(Y.endsWith(";"))Y=Y.slice(0,-1);return Y}).join("\n");return J=J.replace(/\n{3,}/g,"\n\n"),J=J.replace(/\/\*\*\n([^*]*)(\n \*\/)/g,(Y,W)=>{return`/**\n${W.split("\n").map((z)=>` *${z.trim()?` ${z.trim()}`:""}`).join("\n")}\n */`}),`${J.trim()}\n`}function T8(q){let Z=q.split("\n");return Z.map(($,J)=>{if(J===0)return"/**";if(J===Z.length-1)return" */";return` * ${$.replace(/^\s*\*?\s?/,"").trim()}`}).join("\n")}function K1(q,...Z){if(!Z.length)return q;let $=Z.shift();if(F1(q)&&F1($)){for(let J in $)if(Object.prototype.hasOwnProperty.call($,J)){let Y=$[J];if(F1(Y)&&F1(q[J]))q[J]=K1(q[J],Y);else q[J]=Y}}return K1(q,...Z)}function F1(q){return q&&typeof q==="object"&&!Array.isArray(q)}async function cq({name:q,cwd:Z,defaultConfig:$}){let J=Z??f1.cwd(),Y=lq(J,`${q}.config`);if(dq(Y))try{let W=await import(Y),j=W.default||W;return K1($,j)}catch(W){console.error(`Error loading config from ${Y}:`,W)}return $}var Z1=await cq({name:"dts",cwd:f1.cwd(),defaultConfig:{cwd:f1.cwd(),root:"./src",entrypoints:["**/*.ts"],outdir:"./dist",keepComments:!0,clean:!0,tsconfigPath:"./tsconfig.json"}});var L1={typeImport:/import\s+type\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/,regularImport:/import\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/,returnType:/\):\s*([^{;]+)/,constType:/const([^:=]+):\s*([^=]+)=/,bracketOpen:/[[{]/g,bracketClose:/[\]}]/g,functionReturn:/return\s+([^;]+)/};function iq(){return{dtsLines:[],imports:[],usedTypes:new Set,typeSources:new Map,defaultExport:"",currentDeclaration:"",lastCommentBlock:"",bracketCount:0,isMultiLineDeclaration:!1,moduleImports:new Map,availableTypes:new Map,availableValues:new Map}}function nq(q){let Z=q.match(/:\s*(\{[^=]+\}|\[[^\]]+\]|[^=]+?)\s*=/);return{raw:Z?.[1]?.trim()??null,parsed:Z?.[1]?.trim()??"any"}}async function o1(q){try{let Z=await Bun.file(q).text();return pq(Z)}catch(Z){throw console.error("Failed to extract types:",Z),new Error("Failed to extract and generate .d.ts file")}}function pq(q){let Z=iq(),$=q.split("\n");for(let J of $)rq(J,Z);return F$(Z)}function rq(q,Z){let $=q.trim();if(!$)return;if(U$($)){Q$($,Z);return}if($.startsWith("import")){Z.imports.push(sq(q,Z));return}if($.startsWith("export default")){Z.defaultExport=`\n${$};`;return}if(X$($)||Z.isMultiLineDeclaration)B$($,Z)}function sq(q,Z){let $=q.match(/import\s+type\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/i),J=q.match(/import\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/i);if($||J){let Y=$||J,W=Boolean($),[,j,z]=Y;if(!Z.moduleImports.has(z))Z.moduleImports.set(z,{kind:W?"type":"value",usedTypes:new Set,usedValues:new Set,source:z});let F=Z.moduleImports.get(z);j.split(",").forEach((G)=>{let[V,f]=G.trim().split(/\s+as\s+/).map((S)=>S.trim()),D=f||V;if(W)Z.availableTypes.set(D,z),F.kind=F.kind==="value"?"mixed":"type";else if(Z.availableValues.set(D,z),F.kind=F.kind==="type"?"mixed":"value",Z.currentDeclaration?.includes(D))F.usedValues.add(D)})}return q}function oq(q){let Z=(J)=>{let Y=/\b([a-z_$][\w$]*)\s*(?:[(,;})\s]|$)/gi,W;while((W=Y.exec(J))!==null){let[,z]=W;if(q.availableValues.has(z)){let F=q.availableValues.get(z);q.moduleImports.get(F).usedValues.add(z)}}let j=J.matchAll(/\b([A-Z][\w$]*)\b/g);for(let[,z]of j)if(q.availableTypes.has(z)){let F=q.availableTypes.get(z);q.moduleImports.get(F).usedTypes.add(z)}};if(q.dtsLines.forEach(Z),q.currentDeclaration)Z(q.currentDeclaration);let $=[];for(let[J,Y]of q.moduleImports){let{usedTypes:W,usedValues:j}=Y;if(W.size===0&&j.size===0)continue;if(W.size>0){let z=Array.from(W).sort();$.push(`import type { ${z.join(", ")} } from '${J}';`)}if(j.size>0){let z=Array.from(j).sort();$.push(`import { ${z.join(", ")} } from '${J}';`)}}return $.sort()}function h8(q,Z){let $=new Map,J=new Set;for(let Y of q){let W=Y.match(/import\s+type\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/i),j=Y.match(/import\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/i),z=W||j;if(z){let F=z[1].split(",").map((V)=>{let[f,D]=V.trim().split(/\s+as\s+/);return D||f.trim()}),G=z[2];if(!$.has(G))$.set(G,new Set);F.forEach((V)=>{if($.get(G).add(V),Z.has(V))J.add(V)})}}return Array.from($.entries()).map(([Y,W])=>{let j=Array.from(W).filter((z)=>Z.has(z)||J.has(z));if(j.length===0)return"";return`import type { ${j.sort().join(", ")} } from '${Y}';`}).filter(Boolean).sort()}function aq(q,Z){let $=q.trim();if($.startsWith("export const"))return n1($);if($.startsWith("const"))return n1($,!1);if($.startsWith("export interface"))return p1($);if($.startsWith("interface"))return p1($,!1);if($.startsWith("export type {"))return $;if($.startsWith("export type"))return r1($);if($.startsWith("type"))return r1($,!1);if($.startsWith("export function")||$.startsWith("export async function")){let J=$.replace(/\basync\s+/,"");return s1(J,Z.usedTypes)}if($.startsWith("function")||$.startsWith("async function")){let J=$.replace(/\basync\s+/,"");return s1(J,Z.usedTypes,!1)}if($.startsWith("export default"))return`${$};`;if($.startsWith("export"))return $;return`declare ${$}`}function n1(q,Z=!0){let $=q.split("\n"),J=$[0],Y=J.split("const")[1].split("=")[0].trim().split(":")[0].trim(),W=nq(J);if(W.raw)return`${Z?"export ":""}declare const ${Y}: ${W.raw};`;let j=P1($.slice(1,-1)),z=a1(j);return`${Z?"export ":""}declare const ${Y}: {\n${z}\n};`}function a1(q,Z=2){return q.map(($)=>{let J=" ".repeat(Z);if($.nested&&$.nested.length>0){let Y=a1($.nested,Z+2);return`${J}${$.key}: {\n${Y}\n${J}};`}return`${J}${$.key}: ${$.type};`}).join("\n")}function P1(q){let Z=[],$={content:[]},J=0;for(let Y of q){let W=Y.trim();if(!W||W.startsWith("//")||W.startsWith("/*"))continue;let j=(W.match(L1.bracketOpen)||[]).length,z=(W.match(L1.bracketClose)||[]).length;if(J===0&&W.includes(":")){let[F]=W.split(":");$={key:F.trim(),content:[W]}}else if(J>0||j>0)$.content.push(W);if(J+=j-z,J===0&&$.key){let F=eq($);if(F)Z.push(F);$={content:[]}}}return Z}function eq({key:q,content:Z}){if(!q)return null;let $=Z.join(" ").trim(),J=$.indexOf(":");if(J===-1)return null;let Y=$.substring(J+1).trim();if(Y.startsWith("{")){let W=V1(Y,"{","}");if(W){let j=P1(W.split(",").map((z)=>z.trim()));return{key:q,value:Y,type:C1(j),nested:j}}}if(Y.startsWith("["))return{key:q,value:Y,type:q$(Y).replace(/'+$/,"")};if(tq(Y))return{key:q,value:Y,type:$$(Y)};return Y$(q,Y)}function V1(q,Z,$){let J=0,Y=-1;for(let W=0;W<q.length;W++)if(q[W]===Z){if(J===0)Y=W;J++}else if(q[W]===$){if(J--,J===0&&Y!==-1)return q.substring(Y+1,W)}return null}function tq(q){return q.includes("=>")||q.startsWith("function")||q==="console.log"||q.endsWith(".log")&&!q.includes("[")&&!q.includes("{")}function q$(q){let Z=V1(q,"[","]");if(!Z)return"never[]";let $=_1(Z);if($.length===0)return"never[]";if($.some((W)=>W.trim().startsWith("[")))return`Array<${$.map((j)=>{let z=j.trim();if(z.startsWith("[")){let F=V1(z,"[","]");if(F)return`Array<${_1(F).map((V)=>J1(V.trim())).join(" | ")}>`}return J1(z)}).join(" | ")}>`;let J=$.map((W)=>J1(W.trim()));return`Array<${[...new Set(J)].join(" | ")}>`}function J1(q){let Z=q.trim();if(Z.startsWith("\'")||Z.startsWith('"'))return`'${Z.slice(1,-1).replace(/'+$/,"")}'`;if(!Number.isNaN(Number(Z)))return Z;if(Z.startsWith("{"))return N$(J$(Z));if(Z==="console.log"||Z.endsWith(".log"))return"((...args: any[]) => void)";if(Z.includes("=>"))return"((...args: any[]) => void)";if(Z.endsWith("()"))return"unknown";if(Z.includes("."))return"unknown";if(/^[a-z_]\w*$/i.test(Z))return"unknown";return"unknown"}function u8(q){return q.map(($)=>{let J=$.trim();if(J.startsWith("[")){let Y=V1(J,"[","]");if(Y)return`Array<${_1(Y).map((z)=>J1(z.trim())).join(" | ")}>`;return"never"}return J1(J)}).filter(($)=>$!=="never").join(" | ")}function $$(q){let Z=q.startsWith("async"),$="unknown";if(q.includes("console.log"))$="void";else if(q.includes("return")){let J=q.match(L1.functionReturn)?.[1];if(J)$=Z$(J)}return`${Z?"async ":""}(...args: any[]) => ${$}`}function Z$(q){if(q.startsWith("\'")||q.startsWith('"'))return"string";if(!Number.isNaN(Number(q)))return"number";if(q==="true"||q==="false")return"boolean";if(q.includes("??")){let[,Z]=q.split("??").map(($)=>$.trim());if(Z.startsWith("\'")||Z.startsWith('"'))return"string"}return"unknown"}function _1(q){let Z=[],$="",J=0,Y=!1,W="";for(let j=0;j<q.length;j++){let z=q[j];if((z==='"'||z==="\'")&&(j===0||q[j-1]!=="\\")){if(!Y)Y=!0,W=z;else if(z===W)Y=!1}if(!Y){if(z==="["||z==="{")J++;else if(z==="]"||z==="}")J--}if(z===","&&J===0&&!Y){if($.trim())Z.push($.trim());$=""}else $+=z}if($.trim())Z.push($.trim());return Z.filter(Boolean)}function J$(q){let Z=q.slice(1,-1).trim();return P1([Z])}function m8(q){let Z={genericParams:"",functionName:"",parameters:"",returnType:"void",isAsync:!1};Z.isAsync=q.includes("async");let $=q.replace(/^export\s+/,"").replace(/^async\s+/,"").replace(/^function\s+/,"").trim(),J=$.match(/^([^(<\s]+)(\s*<[^>]+>)?/);if(J){if(Z.functionName=J[1],J[2])Z.genericParams=J[2].trim();$=$.slice(J[0].length).trim()}let Y=$.match(/\(([\s\S]*?)\)/);if(Y)Z.parameters=Y[1].trim(),$=$.slice(Y[0].length).trim();if($.startsWith(":")){let W=$.slice(1).trim();W=W.replace(/:\s*$/,"").replace(/\s+/g," ").trim();let j=W.match(/^([^:]+)/);if(j)Z.returnType=j[1].trim()}return Z}function Y$(q,Z){let $=Z.replace(/,\s*$/,"").trim();if($.startsWith("\'")||$.startsWith('"'))return{key:q,value:$,type:`'${$.slice(1,-1)}'`};if(!Number.isNaN(Number($)))return{key:q,value:$,type:$};if($==="true"||$==="false")return{key:q,value:$,type:$};if($.endsWith("()")||$==="console.log")return{key:q,value:$,type:"(...args: any[]) => void"};return{key:q,value:$,type:"unknown"}}function C1(q){if(q.length===0)return"Object";return`{ ${q.map(($)=>`${$.key}: ${$.nested?C1($.nested):$.type}`).join("; ")} }`}function p1(q,Z=!0){let $=q.split("\n"),J=$[0].split("interface")[1].split("{")[0].trim(),Y=$.slice(1,-1).map((W)=>` ${W.trim().replace(/;?$/,";")}`).join("\n");return`${Z?"export ":""}declare interface ${J} {\n${Y}\n}`}function d8(q,Z,$=!0){let J=q.match(/export\s+type\s*\{([^}]+)\}/);if(J)J[1].split(",").map((W)=>W.trim()).forEach((W)=>Z.usedTypes.add(W));return q.replace("export type",`${$?"export ":""}declare type`).replace(/;$/,"")}function r1(q,Z=!0){let $=q.split("\n"),J=$[0],Y=J.split("type")[1].split("=")[0].trim(),W=J.split("=")[1]?.trim()||$.slice(1).join("\n").trim().replace(/;$/,"");return`${Z?"export ":""}declare type ${Y} = ${W};`}function W$(q){let Z=/^export\s+async\s+function/.test(q)||/^async\s+function/.test(q),$=q.replace(/^export\s+/,"").replace(/^async\s+/,"").replace(/^function\s+/,"").trim(),J=/^([a-z_$][\w$]*)\s*(<[^(]+>)/i,Y=$.match(J),W="",j="";if(Y)j=Y[1],W=Y[2];let z=$.replace(J,j),F=j||z.match(/^([^(<\s]+)/)?.[1]||"",G=z.match(/\(([\s\S]*?)\)(?=\s*:)/),V=G?G[1].trim():"";V=j$(V);let f=z.match(/\)\s*:\s*([\s\S]+?)(?=\{|$)/),D=f?f[1].trim():"void";return D=e1(D),{name:F,params:V,returnType:D,isAsync:Z,generics:W}}function s1(q,Z,$=!0){let{name:J,params:Y,returnType:W,isAsync:j,generics:z}=W$(q);return z$(`${z} ${Y} ${W}`,Z),[$?"export":"","declare",j?"async":"","function",J,z,`(${Y})`,":",W,";"].filter(Boolean).join(" ").replace(/\s+([<>(),;:])/g,"$1").replace(/([<>(),;:])\s+/g,"$1 ").replace(/\s{2,}/g," ").trim()}function j$(q){if(!q.trim())return"";return q.replace(/\{([^}]+)\}:\s*([^,)]+)/g,($,J,Y)=>{return`options: ${e1(Y.trim())}`}).replace(/\s*([,:])\s*/g,"$1 ").replace(/,(\S)/g,", $1").replace(/\s*\?\s*:/g,"?: ").replace(/\s*([<[\]>])\s*/g,"$1").replace(/\s{2,}/g," ").trim()}function e1(q){return q.replace(/\s+/g," ").replace(/\s*([<>])\s*/g,"$1").replace(/\s*,\s*/g,", ").trim()}function z$(q,Z){let $=/(?:typeof\s+)?([A-Z]\w*(?:<[^>]+>)?)|extends\s+([A-Z]\w*(?:<[^>]+>)?)/g,J;while((J=$.exec(q))!==null){let Y=J[1]||J[2];if(Y){let[W,...j]=Y.split(/[<>]/);if(W&&/^[A-Z]/.test(W))Z.add(W);if(j.length>0)j.forEach((z)=>{z.split(/[,\s]/).forEach((G)=>{if(/^[A-Z]/.test(G))Z.add(G)})})}}}function U$(q){return q.startsWith("/**")||q.startsWith("*")||q.startsWith("*/")}function Q$(q,Z){let $=q.startsWith("*")?` ${q}`:q.startsWith("/**")||q.startsWith("*/")?q:` ${q}`;if(q.startsWith("/**"))Z.lastCommentBlock="";Z.lastCommentBlock+=`${$}\n`}function X$(q){return q.startsWith("export")||q.startsWith("const")||q.startsWith("interface")||q.startsWith("type")||q.startsWith("function")}function B$(q,Z){Z.currentDeclaration+=`${q}\n`;let $=q.match(/[[{(]/g),J=q.match(/[\]})]/g),Y=$?$.length:0,W=J?J.length:0;if(Z.bracketCount+=Y-W,Z.isMultiLineDeclaration=Z.bracketCount>0,!Z.isMultiLineDeclaration){if(Z.lastCommentBlock)Z.dtsLines.push(Z.lastCommentBlock.trimEnd()),Z.lastCommentBlock="";let j=aq(Z.currentDeclaration.trim(),Z);if(j)Z.dtsLines.push(j);Z.currentDeclaration="",Z.bracketCount=0}}function F$(q){let Z=oq(q),{regularDeclarations:$,starExports:J}=K$(q.dtsLines),Y=[];if(Z.length>0)Y.push(`${Z.join("\n")}\n`);if($.length>0)Y.push($.join("\n\n"));if(J.length>0)Y.push(J.join("\n"));let W=Y.filter(Boolean).join("\n\n").trim();if(q.defaultExport){let j=q.defaultExport.replace(/^export\s+default\s+/,"").replace(/export\s+default\s+/,"").replace(/;+$/,"").trim();W=W.replace(/\n*$/,"\n\n"),W+=`export default ${j};`}return W+="\n",M$(W)}function K$(q){let Z=[],$=[],J="";return q.forEach((Y)=>{let W=Y.trim();if(W.startsWith("/**")||W.startsWith("*")){J=J?`${J}\n${Y}`:Y;return}if(W.startsWith("export *"))$.push(w$(W));else if(W){let j=V$(J?`${J}\n${Y}`:Y);Z.push(j)}J=""}),{regularDeclarations:Z,starExports:$}}function V$(q){if(!q.trim())return"";let Z=q;if(Z.includes("export declare type {"))Z=Z.replace("export declare type","export type");if(Z.includes("declare")&&Z.includes("async"))Z=Z.replace(/declare\s+async\s+/,"declare ").replace(/export\s+declare\s+async\s+/,"export declare ");if(!Z.endsWith(";")&&!Z.endsWith("{")&&G$(Z))Z=`${Z.trimEnd()};`;return Z}function G$(q){let Z=q.trim();if(Z.startsWith("/*")||Z.startsWith("*")||Z.startsWith("//"))return!1;if(Z.endsWith("{")||Z.endsWith("}"))return!1;if(Z.endsWith(";"))return!1;return!0}function w$(q){return q.trim().replace(/;+$/,"").replace(/\{\s*$/,"{")+(q.trim().endsWith("{")?"":";")}function M$(q){return q.replace(/\r\n/g,"\n").replace(/\{\s*;/g,"{").replace(/;+/g,";").replace(/\n{3,}/g,"\n\n").replace(/^(export (?!.*\{$)[^*{}\n].*[^;\n])$/gm,"$1;").replace(/^(export \* from [^;\n]+);*$/gm,"$1;").replace(/^(export \{[^}]+\} from [^;\n]+);*$/gm,"$1;").replace(/[ \t]+$/gm,"").replace(/\n*$/,"\n")}function N$(q){if(q.length===0)return"Object";return`{ ${q.map(($)=>{let J=$.nested?C1($.nested):$.type;return`${$.key}: ${J}`}).join("; ")} }`}function l8(q){return q.split(",").map((Z)=>{let[$,J]=Z.split("extends").map((Y)=>Y.trim());return J?`${$} extends ${J}`:$}).join(", ")}import{mkdir as I8,rm as H8}from"fs/promises";import{dirname as D8,join as f8,parse as L8,relative as _8}from"path";var Eq=B1(Pq(),1),h1=B1(z1(),1),xq=B1(z1(),1);import Rq,{posix as I1}from"path";var B8=/\\(?![()[\]{}!+@])/g;function F8(q){return Aq(q)}function K8(q){return Tq(q).replace(B8,"/")}var wJ=process.platform==="win32"?K8:F8,V8=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,G8=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,Aq=(q)=>q.replace(V8,"\\$&"),Tq=(q)=>q.replace(G8,"\\$&"),MJ=process.platform==="win32"?Tq:Aq;function w8(q,Z){if((Z==null?void 0:Z.caseSensitiveMatch)===!1)return!0;let $=xq.default.scan(q);return $.isGlob||$.negated}function Cq(q,Z,$,J,Y){var W;let j=q;if(q.endsWith("/"))j=q.slice(0,-1);if(!j.endsWith("*")&&Z)j+="/**";if(Rq.isAbsolute(j.replace(/\\(?=[()[\]{}!*+?@|])/g,"")))j=I1.relative($,j);else j=I1.normalize(j);let z=/^(\/?\.\.)+/.exec(j);if(z==null?void 0:z[0]){let F=I1.join($,z[0]);if(J.root.length>F.length)J.root=F,J.depthOffset=-(z[0].length+1)/3}else if(!Y&&J.depthOffset>=0){let F=j.split("/");(W=J.commonPath)!=null||(J.commonPath=F);let G=[];for(let V=0;V<Math.min(J.commonPath.length,F.length);V++){let f=F[V];if(f==="**"&&!F[V+1]){G.pop();break}if(f!==J.commonPath[V]||w8(f)||V===F.length-1)break;G.push(f)}J.depthOffset=G.length,J.commonPath=G,J.root=G.length>0?`${$}/${G.join("/")}`:$}return j}function M8({patterns:q,ignore:Z=[],expandDirectories:$=!0},J,Y){if(typeof q==="string")q=[q];if(typeof Z==="string")Z=[Z];let W=[],j=Z.map((z)=>Cq(z,$,J,Y,!0));if(!q)return{match:["**/*"],ignore:j};for(let z of q)if(z=Cq(z,$,J,Y,!1),z.startsWith("!")&&z[1]!=="(")j.push(z.slice(1));else W.push(z);return{match:W,ignore:j}}function u1(q,Z,$){return I1.relative(Z,`${$}/${q}`)}function Oq(q,Z,$,J,Y){let W=Y?q.slice($.length+1)||".":q;if($===Z)return J&&W!=="."?W.slice(0,-1):W;return u1(W,Z,$)}function N8(q,Z,$){let J={root:Z,commonPath:null,depthOffset:0},Y=M8(q,Z,J),W=h1.default(Y.match,{dot:q.dot,nocase:q.caseSensitiveMatch===!1,ignore:Y.ignore}),j=h1.default(Y.ignore,{dot:q.dot,nocase:q.caseSensitiveMatch===!1}),z={filters:[(G,V)=>W(Oq(G,Z,J.root,V,q.absolute))],exclude:(G,V)=>j(Oq(V,Z,J.root,!0,!0)),pathSeparator:"/",relativePaths:!0};if(q.deep)z.maxDepth=Math.round(q.deep-J.depthOffset);if(q.absolute)z.relativePaths=!1,z.resolvePaths=!0,z.includeBasePath=!0;if(q.followSymbolicLinks===!1)z.resolveSymlinks=!1,z.excludeSymlinks=!0;if(q.onlyDirectories)z.excludeFiles=!0,z.includeDirs=!0;else if(q.onlyFiles===!1)z.includeDirs=!0;J.root=J.root.replace(/\\/g,"");let F=new Eq.fdir(z).crawl(J.root);if(Z===J.root||q.absolute)return $?F.sync():F.withPromise();return $?F.sync().map((G)=>u1(G,Z,J.root)+(!G||G.endsWith("/")?"/":"")):F.withPromise().then((G)=>G.map((V)=>u1(V,Z,J.root)+(!V||V.endsWith("/")?"/":"")))}async function Sq(q,Z){if(q&&(Z==null?void 0:Z.patterns))throw new Error("Cannot pass patterns as both an argument and an option");let $=Array.isArray(q)||typeof q==="string"?{...Z,patterns:q}:q,J=$.cwd?Rq.resolve($.cwd).replace(/\\/g,"/"):process.cwd().replace(/\\/g,"/");return N8($,J,!1)}async function P8(q){try{if(!await i1(q)){console.error("Error: isolatedModules must be set to true in your tsconfig.json. Ensure `tsc --noEmit` does not output any errors.");return}if(q?.clean)await H8(q.outdir,{recursive:!0,force:!0});let $;if(q?.entrypoints)$=await Sq(q.entrypoints,{cwd:q.root??q.cwd,absolute:!0});else $=await D1(q?.root);for(let J of $){let Y=await o1(J);if(Y){let W=_8(q?.root??"./src",J),j=L8(W),z=f8(q?.outdir??"./dist",`${j.name}.d.ts`);await I8(D8(z),{recursive:!0}),await c1(z,Y)}else console.warn(`No declarations extracted for ${J}`)}}catch(Z){console.error("Error generating declarations:",Z)}}async function PJ(q){await P8({...Z1,...q})}export{c1 as writeToFile,z$ as trackUsedTypes,d8 as processTypeOnlyExport,r1 as processTypeDeclaration,Y$ as processSimpleValue,u8 as processNestedArray,rq as processLine,p1 as processInterfaceDeclaration,h8 as processImports,sq as processImport,s1 as processFunctionDeclaration,B$ as processDeclarationLine,aq as processDeclaration,eq as processCompleteProperty,J$ as parseObjectLiteral,m8 as parseFunctionDeclaration,tq as isFunction,X$ as isDeclarationLine,U$ as isCommentLine,Z$ as inferReturnType,$$ as inferFunctionType,J1 as inferElementType,D1 as getAllTypeScriptFiles,oq as generateImports,P8 as generateDeclarationsFromFiles,PJ as generate,l8 as formatTypeParameters,a1 as formatProperties,F$ as formatOutput,N$ as formatObjectType,C1 as formatNestedType,A8 as formatDeclarations,T8 as formatComment,P1 as extractObjectProperties,V1 as extractNestedContent,W$ as extractFunctionSignature,pq as extractDtsTypes,o1 as extract,K1 as deepMerge,iq as createProcessingState,Z1 as config,j$ as cleanParameters,i1 as checkIsolatedDeclarations,L1 as REGEX};
|
package/dist/types.d.ts
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This is the configuration object for the DTS generation process.
|
|
5
5
|
*/
|
|
6
|
-
export interface DtsGenerationConfig {
|
|
7
|
-
cwd: string
|
|
8
|
-
root: string
|
|
9
|
-
entrypoints: string[]
|
|
10
|
-
outdir: string
|
|
11
|
-
keepComments: boolean
|
|
12
|
-
clean: boolean
|
|
13
|
-
tsconfigPath: string
|
|
6
|
+
export declare interface DtsGenerationConfig {
|
|
7
|
+
cwd: string;
|
|
8
|
+
root: string;
|
|
9
|
+
entrypoints: string[];
|
|
10
|
+
outdir: string;
|
|
11
|
+
keepComments: boolean;
|
|
12
|
+
clean: boolean;
|
|
13
|
+
tsconfigPath: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -18,11 +18,11 @@ export interface DtsGenerationConfig {
|
|
|
18
18
|
*
|
|
19
19
|
* This is the configuration object for the DTS generation process.
|
|
20
20
|
*/
|
|
21
|
-
export type DtsGenerationOption = Partial<DtsGenerationConfig
|
|
21
|
+
export declare type DtsGenerationOption = Partial<DtsGenerationConfig>;
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* DtsGenerationOptions
|
|
25
25
|
*
|
|
26
26
|
* This is the configuration object for the DTS generation process.
|
|
27
27
|
*/
|
|
28
|
-
export type DtsGenerationOptions = DtsGenerationOption | DtsGenerationOption[]
|
|
28
|
+
export declare type DtsGenerationOptions = DtsGenerationOption | DtsGenerationOption[];
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import type { DtsGenerationConfig } from './types'
|
|
1
|
+
import type { DtsGenerationConfig } from './types';
|
|
2
|
+
import { join } from 'node:path';
|
|
2
3
|
|
|
3
|
-
export declare function writeToFile(filePath: string, content: string): Promise<void
|
|
4
|
+
export declare function writeToFile(filePath: string, content: string): Promise<void>;
|
|
4
5
|
|
|
5
|
-
export declare function getAllTypeScriptFiles(directory?: string): Promise<string[]
|
|
6
|
+
export declare function getAllTypeScriptFiles(directory?: string): Promise<string[]>;
|
|
6
7
|
|
|
7
|
-
export declare function checkIsolatedDeclarations(options?: DtsGenerationConfig): Promise<boolean
|
|
8
|
-
|
|
9
|
-
export declare function formatDeclarations(declarations: string): string
|
|
10
|
-
|
|
11
|
-
export declare function formatComment(comment: string): string
|
|
12
|
-
|
|
13
|
-
export declare function deepMerge<T extends object>(target: T, ...sources: Array<Partial<T>>): T
|
|
8
|
+
export declare function checkIsolatedDeclarations(options?: DtsGenerationConfig): Promise<boolean>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/dtsx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"description": "A modern, fast .d.ts generation tool, powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -65,13 +65,12 @@
|
|
|
65
65
|
"@stacksjs/cli": "^0.67.0",
|
|
66
66
|
"@stacksjs/development": "^0.67.0",
|
|
67
67
|
"@stacksjs/eslint-config": "^3.8.1-beta.2",
|
|
68
|
-
"@types/bun": "^1.1.
|
|
68
|
+
"@types/bun": "^1.1.12",
|
|
69
69
|
"tinyglobby": "^0.2.9",
|
|
70
70
|
"vitepress": "^1.4.1"
|
|
71
71
|
},
|
|
72
72
|
"simple-git-hooks": {
|
|
73
|
-
"pre-commit": "bunx lint-staged"
|
|
74
|
-
"commit-msg": "bunx --no -- commitlint --edit $1"
|
|
73
|
+
"pre-commit": "bunx lint-staged"
|
|
75
74
|
},
|
|
76
75
|
"lint-staged": {
|
|
77
76
|
"*.{js,jsx,ts,tsx}": "bunx eslint . --fix"
|