@@ -89,53 +89,3 @@ export async function extractTypeFromSource(filePath: string): Promise<string> {
89
89
// Apply final formatting
90
90
return formatDeclarations ( declarations , false )
91
91
}
92
-
93
- export async function extractConfigTypeFromSource ( filePath : string ) : Promise < string > {
94
- const fileContent = await readFile ( filePath , 'utf-8' )
95
- let declarations = ''
96
-
97
- try {
98
- // Handle type imports
99
- const importRegex = / i m p o r t \s + t y p e \s * \{ ( [ ^ } ] + ) \} \s * f r o m \s * [ ' " ] ( [ ^ ' " ] + ) [ ' " ] / g
100
- let importMatch
101
- while ( ( importMatch = importRegex . exec ( fileContent ) ) !== null ) {
102
- const [ , types , from ] = importMatch
103
- const typeList = types . split ( ',' ) . map ( t => t . trim ( ) )
104
- declarations += `import type { ${ typeList . join ( ', ' ) } } from '${ from } '\n`
105
- }
106
-
107
- if ( declarations ) {
108
- declarations += '\n'
109
- }
110
-
111
- // Handle exports
112
- const exportRegex = / e x p o r t \s + c o n s t \s + ( \w + ) \s * : \s * ( [ ^ = ] + ) \s * = / g
113
- let exportMatch
114
- while ( ( exportMatch = exportRegex . exec ( fileContent ) ) !== null ) {
115
- const [ , name , type ] = exportMatch
116
- declarations += `export declare const ${ name } : ${ type . trim ( ) } \n`
117
- }
118
-
119
- // console.log(`Extracted config declarations for ${filePath}:`, declarations)
120
- return declarations . trim ( ) + '\n'
121
- } catch ( error ) {
122
- console . error ( `Error extracting config declarations from ${ filePath } :` , error )
123
- return ''
124
- }
125
- }
126
-
127
- export async function extractIndexTypeFromSource ( filePath : string ) : Promise < string > {
128
- const fileContent = await readFile ( filePath , 'utf-8' )
129
- let declarations = ''
130
-
131
- // Handle re-exports
132
- const reExportRegex = / e x p o r t \s * (?: \* | \{ [ ^ } ] * \} ) \s * f r o m \s * [ ' " ] ( [ ^ ' " ] + ) [ ' " ] / g
133
- let match
134
- while ( ( match = reExportRegex . exec ( fileContent ) ) !== null ) {
135
- declarations += `${ match [ 0 ] } \n`
136
- }
137
-
138
- // console.log(`Extracted index declarations for ${filePath}:`, declarations)
139
-
140
- return declarations . trim ( ) + '\n'
141
- }
0 commit comments