radiant-docs 0.1.34 → 0.1.38

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.
Files changed (56) hide show
  1. package/package.json +1 -1
  2. package/template/astro.config.mjs +27 -0
  3. package/template/package-lock.json +1027 -513
  4. package/template/package.json +3 -2
  5. package/template/scripts/generate-proxy-allowed-origins.mjs +217 -0
  6. package/template/scripts/generate-robots-txt.mjs +19 -0
  7. package/template/scripts/stamp-image-versions.mjs +63 -11
  8. package/template/src/components/Footer.astro +1 -1
  9. package/template/src/components/Header.astro +9 -9
  10. package/template/src/components/LogoLink.astro +2 -1
  11. package/template/src/components/OpenApiPage.astro +18 -18
  12. package/template/src/components/Search.astro +18 -18
  13. package/template/src/components/Sidebar.astro +4 -2
  14. package/template/src/components/SidebarDropdown.astro +82 -79
  15. package/template/src/components/SidebarGroup.astro +3 -0
  16. package/template/src/components/SidebarMenu.astro +14 -1
  17. package/template/src/components/SidebarSegmented.astro +5 -5
  18. package/template/src/components/SidebarSubgroup.astro +35 -12
  19. package/template/src/components/TableOfContents.astro +24 -15
  20. package/template/src/components/ThemeSwitcher.astro +15 -8
  21. package/template/src/components/chat/AskAiWidget.tsx +10 -5
  22. package/template/src/components/endpoint/PlaygroundBar.astro +3 -3
  23. package/template/src/components/endpoint/PlaygroundButton.astro +3 -3
  24. package/template/src/components/endpoint/PlaygroundField.astro +53 -53
  25. package/template/src/components/endpoint/PlaygroundForm.astro +51 -37
  26. package/template/src/components/endpoint/RequestSnippets.astro +54 -21
  27. package/template/src/components/endpoint/ResponseDisplay.astro +24 -24
  28. package/template/src/components/endpoint/ResponseFieldTree.astro +12 -12
  29. package/template/src/components/endpoint/ResponseFields.astro +19 -19
  30. package/template/src/components/endpoint/ResponseSnippets.astro +66 -29
  31. package/template/src/components/sidebar/SidebarEndpointLink.astro +18 -15
  32. package/template/src/components/sidebar/SidebarOpenApiPageLink.astro +56 -0
  33. package/template/src/components/ui/CodeTabEdge.astro +6 -4
  34. package/template/src/components/ui/Field.astro +7 -7
  35. package/template/src/components/ui/Icon.astro +2 -1
  36. package/template/src/components/ui/demo/Demo.astro +1 -1
  37. package/template/src/components/user/Accordion.astro +3 -3
  38. package/template/src/components/user/Callout.astro +8 -8
  39. package/template/src/components/user/CodeBlock.astro +57 -22
  40. package/template/src/components/user/CodeGroup.astro +14 -10
  41. package/template/src/components/user/ComponentPreviewBlock.astro +38 -12
  42. package/template/src/components/user/Image.astro +6 -2
  43. package/template/src/components/user/Step.astro +4 -4
  44. package/template/src/components/user/Tab.astro +1 -1
  45. package/template/src/components/user/Tabs.astro +15 -20
  46. package/template/src/layouts/Layout.astro +9 -4
  47. package/template/src/lib/code/code-block.ts +150 -15
  48. package/template/src/lib/mdx/remark-resolve-internal-links.ts +639 -0
  49. package/template/src/lib/pagefind.ts +2 -1
  50. package/template/src/lib/routes.ts +134 -58
  51. package/template/src/lib/static-asset-url.ts +62 -0
  52. package/template/src/lib/utils.ts +48 -0
  53. package/template/src/lib/validation.ts +115 -27
  54. package/template/src/pages/404.astro +44 -0
  55. package/template/src/styles/global.css +28 -19
  56. package/template/scripts/rewrite-static-asset-host.mjs +0 -408
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "radiant-docs",
3
- "version": "0.1.34",
3
+ "version": "0.1.38",
4
4
  "description": "CLI tool for previewing Radiant documentation locally",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,5 +1,6 @@
1
1
  // @ts-check
2
2
  import { defineConfig } from "astro/config";
3
+ import sitemap from "@astrojs/sitemap";
3
4
  import tailwindcss from "@tailwindcss/vite";
4
5
  import mdx from "@astrojs/mdx";
5
6
  import alpine from "@astrojs/alpinejs";
@@ -10,6 +11,7 @@ import path from "path";
10
11
  import { getConfig, validateMdxContent } from "./src/lib/validation";
11
12
  import remarkCodeBlockComponent from "./src/lib/mdx/remark-code-block-component";
12
13
  import remarkDemoteH1 from "./src/lib/mdx/remark-demote-h1";
14
+ import remarkResolveInternalLinks from "./src/lib/mdx/remark-resolve-internal-links";
13
15
  import remarkStandaloneImageComponent from "./src/lib/mdx/remark-standalone-image-component";
14
16
  import rehypeExternalLinks from "./src/lib/mdx/rehype-external-links";
15
17
  import remarkGfm from "remark-gfm";
@@ -258,6 +260,28 @@ const configuredSite =
258
260
  ? process.env.DOCS_SITE_URL.trim()
259
261
  : undefined;
260
262
 
263
+ const configuredStaticAssetHost =
264
+ typeof process.env.STATIC_ASSET_HOST === "string" &&
265
+ process.env.STATIC_ASSET_HOST.trim().length > 0
266
+ ? process.env.STATIC_ASSET_HOST.trim().replace(/\/+$/, "")
267
+ : undefined;
268
+
269
+ const configuredStaticAssetPrefix =
270
+ typeof process.env.R2_BUCKET_PREFIX === "string" &&
271
+ process.env.R2_BUCKET_PREFIX.trim().length > 0
272
+ ? process.env.R2_BUCKET_PREFIX.trim().replace(/^\/+|\/+$/g, "")
273
+ : undefined;
274
+
275
+ const configuredAssetsPrefix =
276
+ configuredStaticAssetHost && configuredStaticAssetPrefix
277
+ ? (() => {
278
+ const withScheme = /^https?:\/\//i.test(configuredStaticAssetHost)
279
+ ? configuredStaticAssetHost
280
+ : `https://${configuredStaticAssetHost}`;
281
+ return `${withScheme}/${configuredStaticAssetPrefix}`;
282
+ })()
283
+ : undefined;
284
+
261
285
  // https://astro.build/config
262
286
  export default defineConfig({
263
287
  site: configuredSite,
@@ -270,14 +294,17 @@ export default defineConfig({
270
294
  output: "static",
271
295
  build: {
272
296
  format: "directory",
297
+ assetsPrefix: configuredAssetsPrefix,
273
298
  },
274
299
  integrations: [
300
+ sitemap(),
275
301
  preact({
276
302
  compat: true,
277
303
  }),
278
304
  mdx({
279
305
  remarkPlugins: [
280
306
  remarkGfm,
307
+ remarkResolveInternalLinks,
281
308
  remarkDemoteH1,
282
309
  remarkStandaloneImageComponent,
283
310
  remarkCodeBlockComponent,