Skip to content

Commit 855f255

Browse files
authored
chore(docs): upgrade typedoc to 0.28.11, decouple from mkdocs (#1570)
1 parent 4b775d1 commit 855f255

File tree

11 files changed

+342
-74
lines changed

11 files changed

+342
-74
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
diff --git a/dist/lib/converter/converter.js b/dist/lib/converter/converter.js
2+
index 2438a37c1ce94b8b2b2537965c374a6471a7e729..3855e44031a41c27b52ed00566dc735605fc5a60 100644
3+
--- a/dist/lib/converter/converter.js
4+
+++ b/dist/lib/converter/converter.js
5+
@@ -442,7 +442,8 @@ let Converter = (() => {
6+
// Clone context in case deferred conversion uses different programs
7+
const entryContext = context.withScope(context.scope);
8+
entryContext.setActiveProgram(entry.program);
9+
- this.convertExports(entryContext, entry, createModuleReflections);
10+
+ // Hack 3, make sure that we flatten `index` into the root module
11+
+ this.convertExports(entryContext, entry, entry.displayName === "index" ? false : createModuleReflections);
12+
}
13+
this.finalizeDeferredConversion();
14+
}
15+
diff --git a/dist/lib/converter/plugins/GroupPlugin.js b/dist/lib/converter/plugins/GroupPlugin.js
16+
index 1f5ab57d619ff2a20f4b59e26d8d234f6553d9af..e879fe67665906ff2b7c901737bc4da9b3076b62 100644
17+
--- a/dist/lib/converter/plugins/GroupPlugin.js
18+
+++ b/dist/lib/converter/plugins/GroupPlugin.js
19+
@@ -193,6 +193,10 @@ let GroupPlugin = (() => {
20+
groups.add(String(reflection.frontmatter["group"]));
21+
}
22+
groups.delete("");
23+
+ // Hack: we want to group deprecated items in a separate group
24+
+ if (reflection.isDeprecated()) {
25+
+ groups.add("Deprecated");
26+
+ }
27+
if (groups.size === 0) {
28+
if (reflection instanceof ReferenceReflection &&
29+
groupReferencesByType) {
30+
diff --git a/dist/lib/output/router.js b/dist/lib/output/router.js
31+
index 2dadd8df70cefca52fb2d1cc104c8bf5783d1195..50c5f263740b52639681baa16abce8ccec629c6b 100644
32+
--- a/dist/lib/output/router.js
33+
+++ b/dist/lib/output/router.js
34+
@@ -359,6 +359,8 @@ export class KindRouter extends BaseRouter {
35+
reflection = reflection.parent;
36+
parts.unshift(createNormalizedUrl(reflection.name));
37+
}
38+
+ const prefix = createNormalizedUrl("@langchain/");
39+
+ if (parts[0].startsWith(prefix)) parts[0] = parts[0].slice(prefix.length);
40+
const baseName = parts.join(".");
41+
return `${dir}/${baseName}`;
42+
}
43+
@@ -396,6 +398,8 @@ export class StructureRouter extends BaseRouter {
44+
reflection = reflection.parent;
45+
parts.unshift(...reflection.name.split("/").map(createNormalizedUrl));
46+
}
47+
+ // Hack: Make sure that we're not creating a dummy _langchain folder
48+
+ if (parts[0] === createNormalizedUrl("@langchain")) parts.shift()
49+
// This should only happen if someone tries to break things with @module
50+
// I don't think it will ever occur in normal usage.
51+
if (parts.includes("..")) {
52+
diff --git a/dist/lib/output/themes/default/DefaultTheme.js b/dist/lib/output/themes/default/DefaultTheme.js
53+
index b6c97e6cd7c832256ed861f2da1c414c1485f8a8..7202ab3f44ca5db6353cbae64e3a4f2a1bd6923a 100644
54+
--- a/dist/lib/output/themes/default/DefaultTheme.js
55+
+++ b/dist/lib/output/themes/default/DefaultTheme.js
56+
@@ -234,7 +234,11 @@ let DefaultTheme = (() => {
57+
return filterMapWithNoneCollection(parent.categories);
58+
}
59+
if (parent.groups && shouldShowGroups(parent, opts)) {
60+
- return filterMapWithNoneCollection(parent.groups);
61+
+ // Hack: We want to group only certain groups, not all
62+
+ const includeGroups = ["Interfaces", "Type Aliases", "Deprecated", "Errors", "Graphs", "Functional API", "Pregel", "Constants", "Storage"];
63+
+ const grouped = parent.groups.filter(g => includeGroups.includes(g.title))
64+
+ const notGrouped = parent.groups.filter(g => !includeGroups.includes(g.title))
65+
+ return [...filterMap(notGrouped.flatMap(g => g.children), toNavigation), ...filterMapWithNoneCollection(grouped)];
66+
}
67+
if (opts.includeFolders && parent.childrenIncludingDocuments?.some((child) => child.name.includes("/"))) {
68+
return deriveModuleFolders(parent.childrenIncludingDocuments);
69+
diff --git a/dist/lib/utils/entry-point.js b/dist/lib/utils/entry-point.js
70+
index 0ba34b1f0d960ae1aef109c7b5bd7e2522fce418..c4d324bda6abc540f0a78647bc50f66ed2dae0a0 100644
71+
--- a/dist/lib/utils/entry-point.js
72+
+++ b/dist/lib/utils/entry-point.js
73+
@@ -6,6 +6,7 @@ import { deriveRootDir, getCommonDirectory, MinimatchSet, nicePath, normalizePat
74+
import { discoverPackageJson, glob, inferPackageEntryPointPaths, isDir } from "./fs.js";
75+
import { assertNever, i18n } from "#utils";
76+
import { addInferredDeclarationMapPaths, resolveDeclarationMaps } from "./declaration-maps.js";
77+
+import { createRequire } from "node:module";
78+
/**
79+
* Defines how entry points are interpreted.
80+
* @enum
81+
@@ -37,8 +38,25 @@ export function inferEntryPoints(logger, options, programs) {
82+
logger.warn(i18n.no_entry_points_provided());
83+
return [];
84+
}
85+
- const pathEntries = inferPackageEntryPointPaths(packageJson.file);
86+
+ let pathEntries = inferPackageEntryPointPaths(packageJson.file);
87+
const entryPoints = [];
88+
+ // Hack 1: see if we can rewrite to source files
89+
+ try {
90+
+ const lcRootDir = getCommonDirectory(pathEntries.map((p) => p[1]));
91+
+ const lcConfig = createRequire(import.meta.url)(join(lcRootDir, "langchain.config.js"));
92+
+
93+
+ pathEntries = pathEntries.map(([origName, origPath]) => {
94+
+ let lcName = origName;
95+
+ if (lcName.startsWith("./")) lcName = lcName.slice(2);
96+
+ if (lcName.startsWith(".")) lcName = "index";
97+
+
98+
+ const lcEntryPoint = lcConfig.config.entrypoints[lcName];
99+
+ if (lcEntryPoint) return [origName, resolve(lcRootDir, "src", lcEntryPoint + ".ts")];
100+
+ return [origName, origPath];
101+
+ });
102+
+ } catch {
103+
+ // pass
104+
+ }
105+
programs ||= getEntryPrograms(pathEntries.map((p) => p[1]), logger, options);
106+
// See also: addInferredDeclarationMapPaths in symbol-id factory
107+
const jsToTsSource = new Map();
108+
@@ -53,7 +71,10 @@ export function inferEntryPoints(logger, options, programs) {
109+
}
110+
for (const [name, path] of pathEntries) {
111+
// Strip leading ./ from the display name
112+
- const displayName = name.replace(/^\.\/?/, "");
113+
+ let displayName = name.replace(/^\.\/?/, "");
114+
+ // Hack 2: make sure we resolve displayName to "." for "index"
115+
+ // That will allow us to collapse the URL
116+
+ displayName ||= "index"
117+
const targetPath = jsToTsSource.get(path) || resolveDeclarationMaps(path) || path;
118+
const program = programs.find((p) => p.getSourceFile(targetPath));
119+
if (program) {

docs/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ build-docs: generate-prebuilt-page
1414
fi \
1515
fi
1616
python -m mkdocs build --clean -f mkdocs.yml --strict -d site
17+
yarn run build
1718

1819
generate-prebuilt-page:
1920
# Use to create an update to date prebuilt page.

docs/mkdocs.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ plugins:
5252
- search:
5353
separator: '[\s\u200b\-_,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])'
5454
- autorefs
55-
- typedoc:
56-
# One level of globbing is intentional
57-
source: "../libs/*/*.d.ts"
58-
output_dir: "./reference"
59-
tsconfig: "../tsconfig.json"
60-
options: "typedoc.json"
61-
name: "API Reference"
62-
title_link: "/" # optional, default: '/'
6355
- open-in-new-tab
6456

6557
nav:

docs/package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "docs",
3+
"type": "module",
4+
"private": true,
5+
"description": "Dependencies for LangGraph docs.",
6+
"scripts": {
7+
"build": "typedoc --options typedoc.jsonc"
8+
},
9+
"devDependencies": {
10+
"typedoc": "patch:typedoc@npm%3A0.28.11#~/.yarn/patches/typedoc-npm-0.28.11-18b71eb2e0.patch"
11+
}
12+
}

docs/typedoc.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/typedoc.jsonc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"navigationLinks": {
3+
"Back to documentation": "/langgraphjs/"
4+
},
5+
"out": "./site/reference",
6+
"sort": [
7+
"kind",
8+
"visibility",
9+
"required-first",
10+
"instance-first",
11+
"alphabetical"
12+
],
13+
"entryPoints": [
14+
"../libs/checkpoint",
15+
"../libs/checkpoint-mongodb",
16+
"../libs/checkpoint-postgres",
17+
"../libs/checkpoint-sqlite",
18+
"../libs/checkpoint-validation",
19+
"../libs/langgraph",
20+
"../libs/langgraph-cua",
21+
"../libs/langgraph-supervisor",
22+
"../libs/langgraph-swarm",
23+
"../libs/sdk"
24+
],
25+
"entryPointStrategy": "packages",
26+
"packageOptions": {
27+
"excludePrivate": true,
28+
"excludeInternal": true,
29+
"excludeExternals": false,
30+
"excludeNotDocumented": false,
31+
"skipErrorChecking": true
32+
},
33+
"navigation": {
34+
"includeFolders": false,
35+
"includeGroups": true,
36+
"includeCategories": true,
37+
"excludeReferences": true
38+
},
39+
"name": "LangGraph.js API Reference",
40+
"plugin": ["./plugins/typedoc/google_analytics/index.js"],
41+
"gtmId": "G-WR87FQLG9F"
42+
}

libs/langgraph/src/channels/base.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export function isBaseChannel(obj: unknown): obj is BaseChannel {
99
return obj != null && (obj as BaseChannel).lg_is_channel === true;
1010
}
1111

12+
/** @internal */
1213
export abstract class BaseChannel<
1314
ValueType = unknown,
1415
UpdateType = unknown,

libs/langgraph/src/errors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export type BaseLangGraphErrorFields = {
1212
};
1313

1414
// TODO: Merge with base LangChain error class when we drop support for [email protected]
15+
/** @category Errors */
1516
export class BaseLangGraphError extends Error {
1617
lc_error_code?: string;
1718

libs/langgraph/src/func/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export interface TaskOptions {
9797
* return results;
9898
* });
9999
* ```
100+
* @category Functional API
100101
*/
101102
export function task<ArgsT extends unknown[], OutputT>(
102103
optionsOrName: TaskOptions | string,
@@ -159,6 +160,7 @@ export type EntrypointOptions = {
159160

160161
/**
161162
* Type declaration for the entrypoint function with its properties
163+
* @category Functional API
162164
*/
163165
export interface EntrypointFunction {
164166
<InputT, OutputT>(
@@ -335,6 +337,7 @@ export interface EntrypointFunction {
335337
* await myWorkflow.invoke(3, config); // 0 (previous was undefined)
336338
* await myWorkflow.invoke(1, config); // 6 (previous was 3 * 2 from the previous invocation)
337339
* ```
340+
* @category Functional API
338341
*/
339342
export const entrypoint = function entrypoint<InputT, OutputT>(
340343
optionsOrName: EntrypointOptions | string,
@@ -451,6 +454,7 @@ entrypoint.final = function final<ValueT, SaveT>({
451454
* const previousState = getPreviousState<{ counter: number }>();
452455
* const newCount = (previousState?.counter ?? 0) + 1;
453456
* ```
457+
* @category Functional API
454458
*/
455459
export function getPreviousState<StateT>(): StateT {
456460
const config: LangGraphRunnableConfig =

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
"url": "[email protected]:langchain-ai/langgraphjs.git"
1515
},
1616
"workspaces": [
17-
"libs/*",
17+
"docs",
1818
"examples",
19+
"libs/*",
1920
"internal/*"
2021
],
2122
"scripts": {
@@ -50,7 +51,6 @@
5051
"tslab": "^1.0.21",
5152
"tsx": "^4.19.3",
5253
"turbo": "^2.5.4",
53-
"typedoc": "^0.25.13",
5454
"typescript": "^4.9.5 || ^5.4.5"
5555
},
5656
"resolutions": {

0 commit comments

Comments
 (0)