radiant-docs 0.1.59 → 0.1.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/astro.config.mjs +24 -2
- package/template/package-lock.json +121 -508
- package/template/package.json +3 -2
- package/template/scripts/generate-og-images.mjs +338 -6
- package/template/scripts/generate-og-metadata.mjs +29 -0
- package/template/src/components/Footer.astro +1 -1
- package/template/src/components/Header.astro +3 -10
- package/template/src/components/OpenApiPage.astro +181 -843
- package/template/src/components/SidebarGroup.astro +1 -1
- package/template/src/components/ThemeSwitcher.astro +5 -15
- package/template/src/components/chat/AssistantEmbedPanel.tsx +18 -7
- package/template/src/components/endpoint/PlaygroundBar.astro +54 -9
- package/template/src/components/endpoint/PlaygroundField.astro +1 -1
- package/template/src/components/endpoint/PlaygroundForm.astro +9 -5
- package/template/src/components/endpoint/RequestSnippets.astro +6 -1
- package/template/src/components/endpoint/ResponseFieldTree.astro +17 -13
- package/template/src/components/endpoint/ResponseFields.astro +4 -6
- package/template/src/components/endpoint/ResponseSnippets.astro +6 -1
- package/template/src/components/sidebar/SidebarEndpointLink.astro +9 -12
- package/template/src/components/sidebar/SidebarOpenApi.astro +3 -9
- package/template/src/components/ui/Field.astro +18 -15
- package/template/src/components/ui/Tag.astro +16 -2
- package/template/src/layouts/Layout.astro +6 -12
- package/template/src/lib/ai-artifacts.ts +792 -0
- package/template/src/lib/mdx/remark-resolve-internal-links.ts +22 -8
- package/template/src/lib/oas.ts +5 -1
- package/template/src/lib/openapi/operation-doc.ts +1150 -0
- package/template/src/lib/page-description.ts +20 -0
- package/template/src/lib/routes.ts +73 -18
- package/template/src/lib/utils.ts +11 -0
- package/template/src/pages/[...slug]/index.md.ts +35 -0
- package/template/src/pages/[...spec].json.ts +33 -0
- package/template/src/pages/[...spec].yaml.ts +33 -0
- package/template/src/pages/[...spec].yml.ts +33 -0
- package/template/src/pages/index.md.ts +17 -0
- package/template/src/pages/llms-full.txt.ts +11 -0
- package/template/src/pages/llms.txt.ts +11 -0
- package/template/src/styles/global.css +18 -15
- package/template/src/styles/vaul.css +0 -255
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
loadOpenApiSpec,
|
|
9
9
|
resolveDocsHref,
|
|
10
10
|
type DocsConfig,
|
|
11
|
-
type HiddenPageRoute,
|
|
12
11
|
type NavGroup,
|
|
13
12
|
type NavMenuItem,
|
|
14
13
|
type NavOpenApi,
|
|
@@ -28,6 +27,15 @@ import {
|
|
|
28
27
|
|
|
29
28
|
type MdxNavItem = string | NavPage | NavGroup | NavOpenApiPage;
|
|
30
29
|
|
|
30
|
+
type AuxiliaryPageRef = {
|
|
31
|
+
filePath: string;
|
|
32
|
+
href: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type DocsConfigWithAuxiliaryRefs = DocsConfig & {
|
|
36
|
+
auxiliaryPageRefs?: AuxiliaryPageRef[];
|
|
37
|
+
};
|
|
38
|
+
|
|
31
39
|
type ResolvedRouteIndex = {
|
|
32
40
|
canonicalHrefByFilePath: Map<string, string>;
|
|
33
41
|
allHrefsByFilePath: Map<string, string[]>;
|
|
@@ -230,14 +238,14 @@ function addOpenApiEndpointRoute(args: {
|
|
|
230
238
|
);
|
|
231
239
|
}
|
|
232
240
|
|
|
233
|
-
function
|
|
241
|
+
function addAuxiliaryPageRef(
|
|
234
242
|
index: ResolvedRouteIndex,
|
|
235
|
-
|
|
243
|
+
ref: AuxiliaryPageRef,
|
|
236
244
|
): void {
|
|
237
|
-
const normalizedFilePath = normalizeDocsFilePath(
|
|
245
|
+
const normalizedFilePath = normalizeDocsFilePath(ref.filePath);
|
|
238
246
|
if (!normalizedFilePath) return;
|
|
239
247
|
|
|
240
|
-
const href = addValidRoutePath(index, prependBasePath(
|
|
248
|
+
const href = addValidRoutePath(index, prependBasePath(ref.href));
|
|
241
249
|
if (!index.canonicalHrefByFilePath.has(normalizedFilePath)) {
|
|
242
250
|
index.canonicalHrefByFilePath.set(normalizedFilePath, href);
|
|
243
251
|
}
|
|
@@ -249,6 +257,12 @@ function addHiddenPageRoute(
|
|
|
249
257
|
index.allHrefsByFilePath.set(normalizedFilePath, aliases);
|
|
250
258
|
}
|
|
251
259
|
|
|
260
|
+
function getAuxiliaryPageRefs(
|
|
261
|
+
config: DocsConfigWithAuxiliaryRefs,
|
|
262
|
+
): AuxiliaryPageRef[] {
|
|
263
|
+
return config.auxiliaryPageRefs ?? [];
|
|
264
|
+
}
|
|
265
|
+
|
|
252
266
|
function shouldIncludeEndpoint(
|
|
253
267
|
method: string,
|
|
254
268
|
pathStr: string,
|
|
@@ -474,14 +488,14 @@ async function buildRouteIndex(
|
|
|
474
488
|
}
|
|
475
489
|
|
|
476
490
|
if (homePath) {
|
|
477
|
-
|
|
491
|
+
addAuxiliaryPageRef(index, {
|
|
478
492
|
filePath: homePath,
|
|
479
493
|
href: "/",
|
|
480
494
|
});
|
|
481
495
|
}
|
|
482
496
|
|
|
483
|
-
for (const
|
|
484
|
-
|
|
497
|
+
for (const auxiliaryPageRef of getAuxiliaryPageRefs(config)) {
|
|
498
|
+
addAuxiliaryPageRef(index, auxiliaryPageRef);
|
|
485
499
|
}
|
|
486
500
|
|
|
487
501
|
return index;
|
package/template/src/lib/oas.ts
CHANGED
|
@@ -4,6 +4,10 @@ import { loadOpenApiSpec } from "./validation";
|
|
|
4
4
|
// Cache for dereferenced Oas instances (key: filePathOrUrl, value: Oas instance)
|
|
5
5
|
const oasInstanceCache = new Map<string, Oas>();
|
|
6
6
|
|
|
7
|
+
function cloneOpenApiDocument<T>(document: T): T {
|
|
8
|
+
return JSON.parse(JSON.stringify(document));
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
export async function getOasInstance(filePathOrUrl: string): Promise<Oas> {
|
|
8
12
|
// Check cache first
|
|
9
13
|
if (oasInstanceCache.has(filePathOrUrl)) {
|
|
@@ -14,7 +18,7 @@ export async function getOasInstance(filePathOrUrl: string): Promise<Oas> {
|
|
|
14
18
|
const openApiDoc = await loadOpenApiSpec(filePathOrUrl);
|
|
15
19
|
|
|
16
20
|
// Create and dereference Oas instance
|
|
17
|
-
const api = new Oas(openApiDoc);
|
|
21
|
+
const api = new Oas(cloneOpenApiDocument(openApiDoc));
|
|
18
22
|
await api.dereference();
|
|
19
23
|
|
|
20
24
|
// Cache the dereferenced instance
|