Skip to content

Commit b65a005

Browse files
chore: wip
1 parent 097bede commit b65a005

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

packages/bun-plugin/src/index.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { DtsGenerationOption, GenerationStats } from '@stacksjs/dtsx'
22
import type { BunPlugin } from 'bun'
33
import { createHash } from 'node:crypto'
44
import { existsSync, readFileSync, writeFileSync } from 'node:fs'
5-
import { join, resolve } from 'node:path'
5+
import { basename, join, resolve } from 'node:path'
66
import process from 'node:process'
77
import { generate } from '@stacksjs/dtsx'
88

@@ -102,6 +102,7 @@ export interface PluginConfig extends DtsGenerationOption {
102102
config: {
103103
root?: string
104104
outdir?: string
105+
entrypoints?: string[]
105106
}
106107
}
107108

@@ -468,11 +469,32 @@ function normalizeConfig(options: PluginConfig, build: PluginConfig['build']): D
468469
)
469470
}
470471

472+
// Derive entrypoints from Bun's build config if not explicitly provided.
473+
// Using '**/*.ts' as default causes dtsx to process every .ts file individually,
474+
// which hangs on large codebases. Instead, derive from Bun's entrypoints
475+
// or fall back to 'index.ts'.
476+
let entrypoints = options.entrypoints
477+
if (!entrypoints) {
478+
const bunEntrypoints = build?.config?.entrypoints
479+
if (bunEntrypoints?.length) {
480+
const resolvedRoot = resolve(options.cwd || process.cwd(), root)
481+
entrypoints = bunEntrypoints.map((ep: string) => {
482+
const resolved = resolve(ep)
483+
return resolved.startsWith(resolvedRoot)
484+
? resolved.slice(resolvedRoot.length + 1)
485+
: basename(resolved)
486+
})
487+
}
488+
else {
489+
entrypoints = ['index.ts']
490+
}
491+
}
492+
471493
return {
472494
...options,
473495
cwd: options.cwd || process.cwd(),
474496
root,
475-
entrypoints: options.entrypoints || ['**/*.ts'],
497+
entrypoints,
476498
outdir,
477499
clean: options.clean,
478500
tsconfigPath: options.tsconfigPath,

packages/dtsx/.test-cli/docs-test/api-docs/API.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# API Documentation
22

3-
> Generated on 2026-03-03T16:13:54.773Z
3+
> Generated on 2026-03-11T12:43:22.438Z
44
55
## Table of Contents
66

0 commit comments

Comments
 (0)