Skip to content

Commit 182ef52

Browse files
committed
Fix inferring watch entry points from package.json
#2899
1 parent 19fe465 commit 182ef52

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

.config/typedoc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"name": "TypeDoc API",
1717

1818
// Don't document the debug entry point
19-
"entryPoints": ["../src/index.ts"],
19+
// "entryPoints": ["../src/index.ts"],
2020
"outputs": [
2121
{
2222
"name": "html",

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ title: Changelog
44

55
## Unreleased
66

7+
### Bug Fixes
8+
9+
- `--watch` can now infer entry points from `package.json` as supported in non-watch mode, #2899/
10+
711
## v0.28.0 (2025-03-15)
812

913
### Breaking Changes

src/lib/utils/entry-point.ts

+22-14
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export interface DocumentEntryPoint {
4646
path: NormalizedPath;
4747
}
4848

49-
export function inferEntryPoints(logger: Logger, options: Options) {
49+
export function inferEntryPoints(logger: Logger, options: Options, programs?: ts.Program[]) {
5050
const packageJson = discoverPackageJson(
5151
options.packageDir ?? process.cwd(),
5252
);
@@ -59,7 +59,7 @@ export function inferEntryPoints(logger: Logger, options: Options) {
5959

6060
const entryPoints: DocumentationEntryPoint[] = [];
6161

62-
const programs = getEntryPrograms(
62+
programs ||= getEntryPrograms(
6363
pathEntries.map((p) => p[1]),
6464
logger,
6565
options,
@@ -213,21 +213,29 @@ export function getWatchEntryPoints(
213213

214214
switch (strategy) {
215215
case EntryPointStrategy.Resolve:
216-
result = getEntryPointsForPaths(
217-
logger,
218-
expandGlobs(entryPoints, exclude, logger),
219-
options,
220-
[program],
221-
);
216+
if (options.isSet("entryPoints")) {
217+
result = getEntryPointsForPaths(
218+
logger,
219+
expandGlobs(entryPoints, exclude, logger),
220+
options,
221+
[program],
222+
);
223+
} else {
224+
result = inferEntryPoints(logger, options, [program]);
225+
}
222226
break;
223227

224228
case EntryPointStrategy.Expand:
225-
result = getExpandedEntryPointsForPaths(
226-
logger,
227-
expandGlobs(entryPoints, exclude, logger),
228-
options,
229-
[program],
230-
);
229+
if (options.isSet("entryPoints")) {
230+
result = getExpandedEntryPointsForPaths(
231+
logger,
232+
expandGlobs(entryPoints, exclude, logger),
233+
options,
234+
[program],
235+
);
236+
} else {
237+
result = inferEntryPoints(logger, options, [program]);
238+
}
231239
break;
232240

233241
case EntryPointStrategy.Packages:

0 commit comments

Comments
 (0)