Skip to content

Commit a2a083e

Browse files
committed
chore: minor aesthetic tweaks
1 parent 1b558b4 commit a2a083e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/extractinator.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export interface ExtractinatorOptions {
1515
}
1616

1717
export async function extractinator(options: ExtractinatorOptions) {
18+
//? ts-morph project
1819
const project = new Project()
1920

20-
//? Generate the .d.ts files
2121
const dts = await emit_dts(options.input)
2222

2323
//? Load all the generated .d.ts files
@@ -27,18 +27,20 @@ export async function extractinator(options: ExtractinatorOptions) {
2727

2828
const tsdoc = createTSDocParser(options.tsdocConfigPath)
2929

30+
//? Parsed Svelte/TS Files
3031
const parsed_files: ParsedFile[] = []
3132

3233
//? Loop over all the loaded source files
3334
for (const source_file of project.getSourceFiles()) {
3435
//? Get the filename e.g. KitchenSink.svelte.d.ts
3536
const dts_file_name = source_file.getBaseName()
3637

37-
//? Get the input file name
38+
//? Find the input file path from the dts file path
3839
const input_file_path = dts.dts_file_map.get(source_file.getFilePath())!
40+
3941
const file_name = basename(input_file_path)
4042

41-
//? Work out the file extension
43+
//? Work out the file extension, needs to be done in specific order since ".d.ts" is shared
4244
const ext = dts_file_name.endsWith('.svelte.d.ts')
4345
? '.svelte.d.ts'
4446
: dts_file_name.endsWith('.d.ts')
@@ -71,12 +73,10 @@ export async function extractinator(options: ExtractinatorOptions) {
7173

7274
//? Handle TS/JS Files
7375
case '.d.ts': {
74-
const basename = dts_file_name.replace(ext, '')
75-
7676
const file = parseTSFile(ctx)
7777
parsed_files.push(file)
7878

79-
l(' ⤷', o(basename))
79+
l(' ⤷', o(dts_file_name.replace(ext, '')))
8080

8181
for (const { name } of file.exports) {
8282
l(' ', g(name))

0 commit comments

Comments
 (0)