jamdesk 1.0.0
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/LICENSE +21 -0
- package/README.md +323 -0
- package/bin/jamdesk.js +76 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.d.ts +8 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.js +165 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.js.map +1 -0
- package/dist/__tests__/integration/migrate.integration.test.d.ts +2 -0
- package/dist/__tests__/integration/migrate.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/migrate.integration.test.js +64 -0
- package/dist/__tests__/integration/migrate.integration.test.js.map +1 -0
- package/dist/__tests__/integration/prepublish.integration.test.d.ts +2 -0
- package/dist/__tests__/integration/prepublish.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/prepublish.integration.test.js +27 -0
- package/dist/__tests__/integration/prepublish.integration.test.js.map +1 -0
- package/dist/__tests__/integration/validate.integration.test.d.ts +2 -0
- package/dist/__tests__/integration/validate.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/validate.integration.test.js +56 -0
- package/dist/__tests__/integration/validate.integration.test.js.map +1 -0
- package/dist/__tests__/unit/deploy-templates.test.d.ts +2 -0
- package/dist/__tests__/unit/deploy-templates.test.d.ts.map +1 -0
- package/dist/__tests__/unit/deploy-templates.test.js +124 -0
- package/dist/__tests__/unit/deploy-templates.test.js.map +1 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.d.ts +2 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.js +69 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.js.map +1 -0
- package/dist/__tests__/unit/deps-sync.test.d.ts +14 -0
- package/dist/__tests__/unit/deps-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/deps-sync.test.js +166 -0
- package/dist/__tests__/unit/deps-sync.test.js.map +1 -0
- package/dist/__tests__/unit/docs-config.test.d.ts +2 -0
- package/dist/__tests__/unit/docs-config.test.d.ts.map +1 -0
- package/dist/__tests__/unit/docs-config.test.js +288 -0
- package/dist/__tests__/unit/docs-config.test.js.map +1 -0
- package/dist/__tests__/unit/errors.test.d.ts +2 -0
- package/dist/__tests__/unit/errors.test.d.ts.map +1 -0
- package/dist/__tests__/unit/errors.test.js +27 -0
- package/dist/__tests__/unit/errors.test.js.map +1 -0
- package/dist/__tests__/unit/extract-hooks.test.d.ts +5 -0
- package/dist/__tests__/unit/extract-hooks.test.d.ts.map +1 -0
- package/dist/__tests__/unit/extract-hooks.test.js +205 -0
- package/dist/__tests__/unit/extract-hooks.test.js.map +1 -0
- package/dist/__tests__/unit/frontmatter-sync.test.d.ts +8 -0
- package/dist/__tests__/unit/frontmatter-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/frontmatter-sync.test.js +26 -0
- package/dist/__tests__/unit/frontmatter-sync.test.js.map +1 -0
- package/dist/__tests__/unit/mdx-validator.test.d.ts +2 -0
- package/dist/__tests__/unit/mdx-validator.test.d.ts.map +1 -0
- package/dist/__tests__/unit/mdx-validator.test.js +264 -0
- package/dist/__tests__/unit/mdx-validator.test.js.map +1 -0
- package/dist/__tests__/unit/migrate-convert.test.d.ts +2 -0
- package/dist/__tests__/unit/migrate-convert.test.d.ts.map +1 -0
- package/dist/__tests__/unit/migrate-convert.test.js +297 -0
- package/dist/__tests__/unit/migrate-convert.test.js.map +1 -0
- package/dist/__tests__/unit/migrate-detect.test.d.ts +2 -0
- package/dist/__tests__/unit/migrate-detect.test.d.ts.map +1 -0
- package/dist/__tests__/unit/migrate-detect.test.js +35 -0
- package/dist/__tests__/unit/migrate-detect.test.js.map +1 -0
- package/dist/__tests__/unit/migrate-mdx.test.d.ts +2 -0
- package/dist/__tests__/unit/migrate-mdx.test.d.ts.map +1 -0
- package/dist/__tests__/unit/migrate-mdx.test.js +158 -0
- package/dist/__tests__/unit/migrate-mdx.test.js.map +1 -0
- package/dist/__tests__/unit/openapi.test.d.ts +2 -0
- package/dist/__tests__/unit/openapi.test.d.ts.map +1 -0
- package/dist/__tests__/unit/openapi.test.js +52 -0
- package/dist/__tests__/unit/openapi.test.js.map +1 -0
- package/dist/__tests__/unit/package-config.test.d.ts +2 -0
- package/dist/__tests__/unit/package-config.test.d.ts.map +1 -0
- package/dist/__tests__/unit/package-config.test.js +63 -0
- package/dist/__tests__/unit/package-config.test.js.map +1 -0
- package/dist/__tests__/unit/port.test.d.ts +2 -0
- package/dist/__tests__/unit/port.test.d.ts.map +1 -0
- package/dist/__tests__/unit/port.test.js +20 -0
- package/dist/__tests__/unit/port.test.js.map +1 -0
- package/dist/__tests__/unit/vendored-sync.test.d.ts +14 -0
- package/dist/__tests__/unit/vendored-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/vendored-sync.test.js +90 -0
- package/dist/__tests__/unit/vendored-sync.test.js.map +1 -0
- package/dist/commands/broken-links.d.ts +11 -0
- package/dist/commands/broken-links.d.ts.map +1 -0
- package/dist/commands/broken-links.js +95 -0
- package/dist/commands/broken-links.js.map +1 -0
- package/dist/commands/clean.d.ts +7 -0
- package/dist/commands/clean.d.ts.map +1 -0
- package/dist/commands/clean.js +59 -0
- package/dist/commands/clean.js.map +1 -0
- package/dist/commands/deploy/cloudflare.d.ts +12 -0
- package/dist/commands/deploy/cloudflare.d.ts.map +1 -0
- package/dist/commands/deploy/cloudflare.js +409 -0
- package/dist/commands/deploy/cloudflare.js.map +1 -0
- package/dist/commands/deploy/templates.d.ts +23 -0
- package/dist/commands/deploy/templates.d.ts.map +1 -0
- package/dist/commands/deploy/templates.js +179 -0
- package/dist/commands/deploy/templates.js.map +1 -0
- package/dist/commands/deploy/types.d.ts +19 -0
- package/dist/commands/deploy/types.d.ts.map +1 -0
- package/dist/commands/deploy/types.js +5 -0
- package/dist/commands/deploy/types.js.map +1 -0
- package/dist/commands/dev.d.ts +14 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +817 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/doctor.d.ts +7 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +159 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +96 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/migrate/convert-mdx.d.ts +50 -0
- package/dist/commands/migrate/convert-mdx.d.ts.map +1 -0
- package/dist/commands/migrate/convert-mdx.js +108 -0
- package/dist/commands/migrate/convert-mdx.js.map +1 -0
- package/dist/commands/migrate/convert.d.ts +80 -0
- package/dist/commands/migrate/convert.d.ts.map +1 -0
- package/dist/commands/migrate/convert.js +158 -0
- package/dist/commands/migrate/convert.js.map +1 -0
- package/dist/commands/migrate/detect.d.ts +31 -0
- package/dist/commands/migrate/detect.d.ts.map +1 -0
- package/dist/commands/migrate/detect.js +62 -0
- package/dist/commands/migrate/detect.js.map +1 -0
- package/dist/commands/migrate/extract-hooks.d.ts +71 -0
- package/dist/commands/migrate/extract-hooks.d.ts.map +1 -0
- package/dist/commands/migrate/extract-hooks.js +473 -0
- package/dist/commands/migrate/extract-hooks.js.map +1 -0
- package/dist/commands/migrate/index.d.ts +17 -0
- package/dist/commands/migrate/index.d.ts.map +1 -0
- package/dist/commands/migrate/index.js +282 -0
- package/dist/commands/migrate/index.js.map +1 -0
- package/dist/commands/migrate/prompts.d.ts +22 -0
- package/dist/commands/migrate/prompts.d.ts.map +1 -0
- package/dist/commands/migrate/prompts.js +67 -0
- package/dist/commands/migrate/prompts.js.map +1 -0
- package/dist/commands/migrate/types.d.ts +22 -0
- package/dist/commands/migrate/types.d.ts.map +1 -0
- package/dist/commands/migrate/types.js +26 -0
- package/dist/commands/migrate/types.js.map +1 -0
- package/dist/commands/openapi-check.d.ts +11 -0
- package/dist/commands/openapi-check.d.ts.map +1 -0
- package/dist/commands/openapi-check.js +88 -0
- package/dist/commands/openapi-check.js.map +1 -0
- package/dist/commands/rename.d.ts +10 -0
- package/dist/commands/rename.d.ts.map +1 -0
- package/dist/commands/rename.js +125 -0
- package/dist/commands/rename.js.map +1 -0
- package/dist/commands/update.d.ts +10 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +57 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.d.ts +12 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +163 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +334 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/config.d.ts +7 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +18 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/deprecated-components.d.ts +72 -0
- package/dist/lib/deprecated-components.d.ts.map +1 -0
- package/dist/lib/deprecated-components.js +138 -0
- package/dist/lib/deprecated-components.js.map +1 -0
- package/dist/lib/deps.d.ts +17 -0
- package/dist/lib/deps.d.ts.map +1 -0
- package/dist/lib/deps.js +186 -0
- package/dist/lib/deps.js.map +1 -0
- package/dist/lib/docs-config.d.ts +67 -0
- package/dist/lib/docs-config.d.ts.map +1 -0
- package/dist/lib/docs-config.js +294 -0
- package/dist/lib/docs-config.js.map +1 -0
- package/dist/lib/errors.d.ts +23 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +32 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/frontmatter-utils.d.ts +25 -0
- package/dist/lib/frontmatter-utils.d.ts.map +1 -0
- package/dist/lib/frontmatter-utils.js +64 -0
- package/dist/lib/frontmatter-utils.js.map +1 -0
- package/dist/lib/mdx-validator.d.ts +27 -0
- package/dist/lib/mdx-validator.d.ts.map +1 -0
- package/dist/lib/mdx-validator.js +148 -0
- package/dist/lib/mdx-validator.js.map +1 -0
- package/dist/lib/navigation-validator.d.ts +31 -0
- package/dist/lib/navigation-validator.d.ts.map +1 -0
- package/dist/lib/navigation-validator.js +75 -0
- package/dist/lib/navigation-validator.js.map +1 -0
- package/dist/lib/normalize-config.d.ts +57 -0
- package/dist/lib/normalize-config.d.ts.map +1 -0
- package/dist/lib/normalize-config.js +63 -0
- package/dist/lib/normalize-config.js.map +1 -0
- package/dist/lib/openapi/cache.d.ts +40 -0
- package/dist/lib/openapi/cache.d.ts.map +1 -0
- package/dist/lib/openapi/cache.js +76 -0
- package/dist/lib/openapi/cache.js.map +1 -0
- package/dist/lib/openapi/errors.d.ts +36 -0
- package/dist/lib/openapi/errors.d.ts.map +1 -0
- package/dist/lib/openapi/errors.js +162 -0
- package/dist/lib/openapi/errors.js.map +1 -0
- package/dist/lib/openapi/index.d.ts +10 -0
- package/dist/lib/openapi/index.d.ts.map +1 -0
- package/dist/lib/openapi/index.js +12 -0
- package/dist/lib/openapi/index.js.map +1 -0
- package/dist/lib/openapi/types.d.ts +198 -0
- package/dist/lib/openapi/types.d.ts.map +1 -0
- package/dist/lib/openapi/types.js +8 -0
- package/dist/lib/openapi/types.js.map +1 -0
- package/dist/lib/openapi/validator.d.ts +45 -0
- package/dist/lib/openapi/validator.d.ts.map +1 -0
- package/dist/lib/openapi/validator.js +128 -0
- package/dist/lib/openapi/validator.js.map +1 -0
- package/dist/lib/openapi.d.ts +7 -0
- package/dist/lib/openapi.d.ts.map +1 -0
- package/dist/lib/openapi.js +7 -0
- package/dist/lib/openapi.js.map +1 -0
- package/dist/lib/output.d.ts +14 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +19 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/path-security.d.ts +23 -0
- package/dist/lib/path-security.d.ts.map +1 -0
- package/dist/lib/path-security.js +35 -0
- package/dist/lib/path-security.js.map +1 -0
- package/dist/lib/port.d.ts +18 -0
- package/dist/lib/port.d.ts.map +1 -0
- package/dist/lib/port.js +65 -0
- package/dist/lib/port.js.map +1 -0
- package/dist/lib/spinner.d.ts +4 -0
- package/dist/lib/spinner.d.ts.map +1 -0
- package/dist/lib/spinner.js +16 -0
- package/dist/lib/spinner.js.map +1 -0
- package/dist/lib/version.d.ts +2 -0
- package/dist/lib/version.d.ts.map +1 -0
- package/dist/lib/version.js +49 -0
- package/dist/lib/version.js.map +1 -0
- package/dist/utils/update-checker.d.ts +34 -0
- package/dist/utils/update-checker.d.ts.map +1 -0
- package/dist/utils/update-checker.js +142 -0
- package/dist/utils/update-checker.js.map +1 -0
- package/package.json +125 -0
- package/templates/docs.json +11 -0
- package/templates/introduction.mdx +19 -0
- package/templates/quickstart.mdx +20 -0
- package/vendored/app/[[...slug]]/error.tsx +103 -0
- package/vendored/app/[[...slug]]/page.tsx +690 -0
- package/vendored/app/api/assets/[...path]/route.ts +78 -0
- package/vendored/app/api/ev/route.ts +61 -0
- package/vendored/app/api/isr-health/route.ts +66 -0
- package/vendored/app/api/mcp/[project]/route.ts +435 -0
- package/vendored/app/api/og/route.tsx +167 -0
- package/vendored/app/api/r2/[project]/[...path]/route.ts +214 -0
- package/vendored/app/api/revalidate/route.ts +76 -0
- package/vendored/app/globals.css +37 -0
- package/vendored/app/layout.tsx +571 -0
- package/vendored/app/not-found.tsx +47 -0
- package/vendored/components/CodeBlockCopyButton.tsx +146 -0
- package/vendored/components/HeaderLinkCopy.tsx +135 -0
- package/vendored/components/errors/NotFoundContent.tsx +147 -0
- package/vendored/components/layout/LayoutWrapper.tsx +128 -0
- package/vendored/components/mdx/Accordion.tsx +91 -0
- package/vendored/components/mdx/ApiCodePanel.tsx +51 -0
- package/vendored/components/mdx/ApiEndpoint.tsx +104 -0
- package/vendored/components/mdx/ApiPage.tsx +379 -0
- package/vendored/components/mdx/Badge.tsx +169 -0
- package/vendored/components/mdx/Callouts.tsx +140 -0
- package/vendored/components/mdx/Card.tsx +214 -0
- package/vendored/components/mdx/CodeGroup.tsx +136 -0
- package/vendored/components/mdx/Color.tsx +244 -0
- package/vendored/components/mdx/Columns.tsx +37 -0
- package/vendored/components/mdx/Expandable.tsx +37 -0
- package/vendored/components/mdx/Frame.tsx +51 -0
- package/vendored/components/mdx/Icon.tsx +132 -0
- package/vendored/components/mdx/Latex.tsx +75 -0
- package/vendored/components/mdx/MDXComponents.tsx +414 -0
- package/vendored/components/mdx/Mermaid.tsx +35 -0
- package/vendored/components/mdx/MermaidInner.tsx +342 -0
- package/vendored/components/mdx/OpenApiEndpoint.tsx +971 -0
- package/vendored/components/mdx/Panel.tsx +26 -0
- package/vendored/components/mdx/PanelWrapper.tsx +100 -0
- package/vendored/components/mdx/ParamField.tsx +75 -0
- package/vendored/components/mdx/RequestExample.tsx +91 -0
- package/vendored/components/mdx/ResponseExample.tsx +145 -0
- package/vendored/components/mdx/ResponseField.tsx +109 -0
- package/vendored/components/mdx/Steps.tsx +173 -0
- package/vendored/components/mdx/Table.tsx +352 -0
- package/vendored/components/mdx/Tabs.tsx +147 -0
- package/vendored/components/mdx/Tile.tsx +127 -0
- package/vendored/components/mdx/Tooltip.tsx +111 -0
- package/vendored/components/mdx/Tree.tsx +484 -0
- package/vendored/components/mdx/Update.tsx +90 -0
- package/vendored/components/mdx/View.tsx +354 -0
- package/vendored/components/mdx/YouTube.tsx +35 -0
- package/vendored/components/mdx/ZoomableImage.tsx +83 -0
- package/vendored/components/navigation/Breadcrumb.tsx +241 -0
- package/vendored/components/navigation/DefaultLogo.tsx +81 -0
- package/vendored/components/navigation/Header.tsx +512 -0
- package/vendored/components/navigation/LanguageSelector.tsx +249 -0
- package/vendored/components/navigation/PageNavigation.tsx +174 -0
- package/vendored/components/navigation/Sidebar.tsx +713 -0
- package/vendored/components/navigation/SocialFooter.tsx +186 -0
- package/vendored/components/navigation/TableOfContents.tsx +435 -0
- package/vendored/components/navigation/TabsNav.tsx +182 -0
- package/vendored/components/search/LazySearchModal.tsx +19 -0
- package/vendored/components/search/SearchModal.tsx +573 -0
- package/vendored/components/snippets/ProjectSnippets.tsx +4 -0
- package/vendored/components/theme/ThemeProvider.tsx +31 -0
- package/vendored/components/theme/ThemeToggle.tsx +134 -0
- package/vendored/components/ui/CodePanel.tsx +517 -0
- package/vendored/components/ui/CodePanelModal.tsx +342 -0
- package/vendored/contexts/TabSyncContext.tsx +30 -0
- package/vendored/hooks/useFocusTrap.ts +42 -0
- package/vendored/hooks/useHashNavigation.ts +39 -0
- package/vendored/hooks/useShikiHighlight.ts +101 -0
- package/vendored/lib/analytics-client.ts +77 -0
- package/vendored/lib/build/cache.ts +138 -0
- package/vendored/lib/build/error-parser.ts +690 -0
- package/vendored/lib/build/estimation.ts +113 -0
- package/vendored/lib/build/index.ts +17 -0
- package/vendored/lib/build/page-file-map.ts +48 -0
- package/vendored/lib/build/r2-upload.ts +179 -0
- package/vendored/lib/cache-keys.ts +117 -0
- package/vendored/lib/code-utils.ts +42 -0
- package/vendored/lib/content-loader.ts +176 -0
- package/vendored/lib/deprecated-components.ts +185 -0
- package/vendored/lib/docs-isr.ts +180 -0
- package/vendored/lib/docs-types.ts +874 -0
- package/vendored/lib/docs.ts +203 -0
- package/vendored/lib/domain-helpers.ts +107 -0
- package/vendored/lib/email-notifier.ts +102 -0
- package/vendored/lib/email-templates/build-failure.tsx +193 -0
- package/vendored/lib/email-templates/components/base-layout.tsx +150 -0
- package/vendored/lib/email-templates/components/error-box.tsx +88 -0
- package/vendored/lib/email-templates/components/info-row.tsx +63 -0
- package/vendored/lib/email-templates/index.ts +13 -0
- package/vendored/lib/empty-polyfill.js +3 -0
- package/vendored/lib/extract-highlights.ts +124 -0
- package/vendored/lib/fonts.ts +227 -0
- package/vendored/lib/frontmatter-utils.ts +77 -0
- package/vendored/lib/fs-utils.ts +20 -0
- package/vendored/lib/git-utils.ts +87 -0
- package/vendored/lib/health-checks.ts +224 -0
- package/vendored/lib/icon-utils.ts +492 -0
- package/vendored/lib/infer-page-type.ts +14 -0
- package/vendored/lib/isr-build-executor.ts +185 -0
- package/vendored/lib/language-icons.ts +152 -0
- package/vendored/lib/language-utils.ts +338 -0
- package/vendored/lib/latex-config.ts +64 -0
- package/vendored/lib/link-prefix-context.tsx +32 -0
- package/vendored/lib/logger.ts +63 -0
- package/vendored/lib/mcp-search.ts +255 -0
- package/vendored/lib/mdx-inline-components.ts +155 -0
- package/vendored/lib/mdx.ts +100 -0
- package/vendored/lib/middleware-helpers.ts +519 -0
- package/vendored/lib/navigation-resolver.ts +621 -0
- package/vendored/lib/navigation-utils.ts +103 -0
- package/vendored/lib/normalize-config.ts +94 -0
- package/vendored/lib/openapi/cache.ts +92 -0
- package/vendored/lib/openapi/code-examples.ts +389 -0
- package/vendored/lib/openapi/errors.ts +253 -0
- package/vendored/lib/openapi/generator.ts +230 -0
- package/vendored/lib/openapi/index.ts +84 -0
- package/vendored/lib/openapi/parser.ts +474 -0
- package/vendored/lib/openapi/types.ts +232 -0
- package/vendored/lib/openapi/validator.ts +156 -0
- package/vendored/lib/openapi-isr.ts +121 -0
- package/vendored/lib/page-isr-helpers.ts +137 -0
- package/vendored/lib/path-safety.ts +130 -0
- package/vendored/lib/paths.ts +35 -0
- package/vendored/lib/preprocess-mdx.ts +951 -0
- package/vendored/lib/process-mdx-with-exports.ts +75 -0
- package/vendored/lib/project-resolver.ts +165 -0
- package/vendored/lib/r2-content.ts +60 -0
- package/vendored/lib/r2-manifest.ts +84 -0
- package/vendored/lib/recent-searches.ts +41 -0
- package/vendored/lib/recma-compound-components.ts +84 -0
- package/vendored/lib/redirect-compiler.ts +160 -0
- package/vendored/lib/redirect-matcher.ts +296 -0
- package/vendored/lib/redis.ts +23 -0
- package/vendored/lib/rehype-class-to-classname.ts +31 -0
- package/vendored/lib/rehype-code-meta.ts +275 -0
- package/vendored/lib/rehype-nozoom-to-data.ts +45 -0
- package/vendored/lib/remark-extract-exports.ts +104 -0
- package/vendored/lib/resilience.ts +260 -0
- package/vendored/lib/revalidation-helpers.ts +200 -0
- package/vendored/lib/revalidation-trigger.ts +150 -0
- package/vendored/lib/screenshot-capture.ts +229 -0
- package/vendored/lib/search-client.ts +91 -0
- package/vendored/lib/search-suggestions.ts +38 -0
- package/vendored/lib/search.ts +158 -0
- package/vendored/lib/seo.ts +264 -0
- package/vendored/lib/shiki-client.ts +131 -0
- package/vendored/lib/shiki-config.ts +289 -0
- package/vendored/lib/shiki-css-theme.ts +46 -0
- package/vendored/lib/shiki-highlighter.ts +62 -0
- package/vendored/lib/shiki-transformers.ts +337 -0
- package/vendored/lib/slack-notifier.ts +248 -0
- package/vendored/lib/snippet-compiler-isr.ts +114 -0
- package/vendored/lib/snippet-loader-isr.ts +276 -0
- package/vendored/lib/static-artifacts.ts +375 -0
- package/vendored/lib/static-file-route.ts +72 -0
- package/vendored/lib/tracking-script.ts +19 -0
- package/vendored/lib/typography-config.ts +42 -0
- package/vendored/lib/validate-config.ts +268 -0
- package/vendored/next.config.js +45 -0
- package/vendored/postcss.config.js +6 -0
- package/vendored/schema/README.md +28 -0
- package/vendored/schema/docs-schema.json +4631 -0
- package/vendored/scripts/build-project.cjs +174 -0
- package/vendored/scripts/build-search-index.cjs +347 -0
- package/vendored/scripts/compile-snippets.cjs +488 -0
- package/vendored/scripts/copy-files.cjs +295 -0
- package/vendored/scripts/dev-project.cjs +534 -0
- package/vendored/scripts/enhance-navigation.cjs +354 -0
- package/vendored/scripts/validate-links.cjs +423 -0
- package/vendored/shared/constants.ts +6 -0
- package/vendored/shared/index.ts +19 -0
- package/vendored/shared/logger.ts +62 -0
- package/vendored/shared/memory-monitor.ts +190 -0
- package/vendored/shared/navigation-validator.ts +101 -0
- package/vendored/shared/path-security.ts +39 -0
- package/vendored/shared/status-reporter.ts +199 -0
- package/vendored/shared/timer.ts +51 -0
- package/vendored/shared/types.ts +102 -0
- package/vendored/tailwind.config.ts +39 -0
- package/vendored/themes/base.css +1311 -0
- package/vendored/themes/index.ts +119 -0
- package/vendored/themes/jam/variables.css +835 -0
- package/vendored/themes/nebula/variables.css +282 -0
- package/vendored/themes/pulsar/variables.css +1009 -0
- package/vendored/themes/types.ts +89 -0
- package/vendored/tsconfig.json +48 -0
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static Artifact Generator for ISR Mode
|
|
3
|
+
*
|
|
4
|
+
* Generates sitemap.xml, llms.txt, and robots.txt for ISR projects.
|
|
5
|
+
* These are uploaded to R2 alongside the MDX content.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Page metadata for artifact generation.
|
|
10
|
+
*/
|
|
11
|
+
export interface PageMetadata {
|
|
12
|
+
/** Page path without extension (e.g., 'introduction', 'api/auth') */
|
|
13
|
+
path: string;
|
|
14
|
+
/** Page title */
|
|
15
|
+
title: string;
|
|
16
|
+
/** Page description */
|
|
17
|
+
description?: string;
|
|
18
|
+
/** Exclude from sitemap/llms.txt */
|
|
19
|
+
noindex?: boolean;
|
|
20
|
+
/** Hidden page (also excluded) */
|
|
21
|
+
hidden?: boolean;
|
|
22
|
+
/** Last modified date (ISO string or YYYY-MM-DD) */
|
|
23
|
+
lastModified?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Options for generating sitemap.
|
|
28
|
+
*/
|
|
29
|
+
export interface SitemapOptions {
|
|
30
|
+
/** Base URL for the site (e.g., 'https://acme.jamdesk.app') */
|
|
31
|
+
baseUrl: string;
|
|
32
|
+
/** Array of page metadata */
|
|
33
|
+
pages: PageMetadata[];
|
|
34
|
+
/** Whether docs are hosted at /docs path */
|
|
35
|
+
hostAtDocs?: boolean;
|
|
36
|
+
/** Block all crawlers - generates empty sitemap */
|
|
37
|
+
noindex?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Generate sitemap.xml from page metadata.
|
|
42
|
+
*
|
|
43
|
+
* @param options - Sitemap options
|
|
44
|
+
* @returns XML string
|
|
45
|
+
*/
|
|
46
|
+
export function generateSitemap(options: SitemapOptions): string {
|
|
47
|
+
const { baseUrl, pages, hostAtDocs = false, noindex = false } = options;
|
|
48
|
+
|
|
49
|
+
if (noindex) {
|
|
50
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
51
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
52
|
+
</urlset>`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const urlPrefix = hostAtDocs ? '/docs' : '';
|
|
56
|
+
|
|
57
|
+
const entries = pages
|
|
58
|
+
.filter(p => !p.noindex && !p.hidden)
|
|
59
|
+
.map(p => {
|
|
60
|
+
const url = `${baseUrl}${urlPrefix}/${p.path}`;
|
|
61
|
+
const lastmod = p.lastModified || new Date().toISOString().split('T')[0];
|
|
62
|
+
const priority = p.path === 'introduction' ? '1.0' : '0.8';
|
|
63
|
+
|
|
64
|
+
return ` <url>
|
|
65
|
+
<loc>${url}</loc>
|
|
66
|
+
<lastmod>${lastmod}</lastmod>
|
|
67
|
+
<changefreq>weekly</changefreq>
|
|
68
|
+
<priority>${priority}</priority>
|
|
69
|
+
</url>`;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
73
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
74
|
+
${entries.join('\n')}
|
|
75
|
+
</urlset>`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Options for generating llms.txt.
|
|
80
|
+
*/
|
|
81
|
+
export interface LlmsTxtOptions {
|
|
82
|
+
/** Documentation name */
|
|
83
|
+
name: string;
|
|
84
|
+
/** Documentation description */
|
|
85
|
+
description?: string;
|
|
86
|
+
/** Base URL for the site */
|
|
87
|
+
baseUrl: string;
|
|
88
|
+
/** Array of page metadata */
|
|
89
|
+
pages: PageMetadata[];
|
|
90
|
+
/** Whether docs are hosted at /docs path */
|
|
91
|
+
hostAtDocs?: boolean;
|
|
92
|
+
/** Block all crawlers - generates empty llms.txt */
|
|
93
|
+
noindex?: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Generate llms.txt following https://llmstxt.org/ spec.
|
|
98
|
+
*
|
|
99
|
+
* @param options - LLMs.txt options
|
|
100
|
+
* @returns Plain text string
|
|
101
|
+
*/
|
|
102
|
+
export function generateLlmsTxt(options: LlmsTxtOptions): string {
|
|
103
|
+
const { name, description, baseUrl, pages, hostAtDocs = false, noindex = false } = options;
|
|
104
|
+
|
|
105
|
+
if (noindex) {
|
|
106
|
+
return '';
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const urlPrefix = hostAtDocs ? '/docs' : '';
|
|
110
|
+
|
|
111
|
+
let output = `# ${name}\n\n`;
|
|
112
|
+
|
|
113
|
+
if (description) {
|
|
114
|
+
output += `> ${description}\n\n`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
for (const page of pages) {
|
|
118
|
+
if (page.noindex || page.hidden) continue;
|
|
119
|
+
|
|
120
|
+
const url = `${baseUrl}${urlPrefix}/${page.path}.md`;
|
|
121
|
+
const desc = page.description ? `: ${page.description}` : '';
|
|
122
|
+
output += `- [${page.title}](${url})${desc}\n`;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return output.trim();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Options for generating robots.txt.
|
|
130
|
+
*/
|
|
131
|
+
export interface RobotsTxtOptions {
|
|
132
|
+
/** Base URL for the site */
|
|
133
|
+
baseUrl: string;
|
|
134
|
+
/** Custom sitemap URL (defaults to {baseUrl}/sitemap.xml) */
|
|
135
|
+
sitemapUrl?: string;
|
|
136
|
+
/** Whether docs are hosted at /docs path */
|
|
137
|
+
hostAtDocs?: boolean;
|
|
138
|
+
/** Block all crawlers (seo.metatags.robots: "noindex") */
|
|
139
|
+
noindex?: boolean;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Generate robots.txt.
|
|
144
|
+
*
|
|
145
|
+
* @param options - Robots.txt options
|
|
146
|
+
* @returns Plain text string
|
|
147
|
+
*/
|
|
148
|
+
export function generateRobotsTxt(options: RobotsTxtOptions): string {
|
|
149
|
+
const { baseUrl, sitemapUrl, hostAtDocs = false, noindex = false } = options;
|
|
150
|
+
|
|
151
|
+
if (noindex) {
|
|
152
|
+
return `User-agent: *
|
|
153
|
+
Disallow: /
|
|
154
|
+
`;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const defaultSitemapUrl = hostAtDocs
|
|
158
|
+
? `${baseUrl}/docs/sitemap.xml`
|
|
159
|
+
: `${baseUrl}/sitemap.xml`;
|
|
160
|
+
|
|
161
|
+
return `User-agent: *
|
|
162
|
+
Allow: /
|
|
163
|
+
|
|
164
|
+
Sitemap: ${sitemapUrl || defaultSitemapUrl}
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Raw page info from file system or R2.
|
|
170
|
+
*/
|
|
171
|
+
export interface RawPageInfo {
|
|
172
|
+
/** File path with extension */
|
|
173
|
+
path: string;
|
|
174
|
+
/** Frontmatter from MDX file */
|
|
175
|
+
frontmatter: {
|
|
176
|
+
title?: string;
|
|
177
|
+
description?: string;
|
|
178
|
+
noindex?: boolean;
|
|
179
|
+
hidden?: boolean;
|
|
180
|
+
lastModified?: string;
|
|
181
|
+
seo?: {
|
|
182
|
+
noindex?: boolean;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Extract page metadata from raw page info.
|
|
189
|
+
*
|
|
190
|
+
* @param pages - Array of raw page info
|
|
191
|
+
* @returns Array of page metadata
|
|
192
|
+
*/
|
|
193
|
+
export function extractPageMetadata(pages: RawPageInfo[]): PageMetadata[] {
|
|
194
|
+
return pages.map(page => {
|
|
195
|
+
const pathWithoutExt = page.path.replace(/\.mdx?$/, '');
|
|
196
|
+
|
|
197
|
+
return {
|
|
198
|
+
path: pathWithoutExt,
|
|
199
|
+
title: page.frontmatter.title || pathWithoutExt,
|
|
200
|
+
description: page.frontmatter.description,
|
|
201
|
+
noindex: page.frontmatter.noindex || page.frontmatter.seo?.noindex,
|
|
202
|
+
hidden: page.frontmatter.hidden,
|
|
203
|
+
lastModified: page.frontmatter.lastModified,
|
|
204
|
+
};
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Options for generating all artifacts.
|
|
210
|
+
*/
|
|
211
|
+
export interface GenerateAllOptions {
|
|
212
|
+
/** Project slug */
|
|
213
|
+
projectSlug: string;
|
|
214
|
+
/** Base URL for the site */
|
|
215
|
+
baseUrl: string;
|
|
216
|
+
/** Documentation name */
|
|
217
|
+
name: string;
|
|
218
|
+
/** Documentation description */
|
|
219
|
+
description?: string;
|
|
220
|
+
/** Array of page metadata */
|
|
221
|
+
pages: PageMetadata[];
|
|
222
|
+
/** Whether docs are hosted at /docs path */
|
|
223
|
+
hostAtDocs?: boolean;
|
|
224
|
+
/** Block all crawlers (seo.metatags.robots: "noindex") */
|
|
225
|
+
noindex?: boolean;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Generated artifacts.
|
|
230
|
+
*/
|
|
231
|
+
export interface GeneratedArtifacts {
|
|
232
|
+
sitemap: string;
|
|
233
|
+
llmsTxt: string;
|
|
234
|
+
robotsTxt: string;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Generate all static artifacts for a project.
|
|
239
|
+
*
|
|
240
|
+
* @param options - Generation options
|
|
241
|
+
* @returns Object with all generated artifacts
|
|
242
|
+
*/
|
|
243
|
+
export function generateAllArtifacts(options: GenerateAllOptions): GeneratedArtifacts {
|
|
244
|
+
const { baseUrl, name, description, pages, hostAtDocs, noindex } = options;
|
|
245
|
+
|
|
246
|
+
const sitemap = generateSitemap({ baseUrl, pages, hostAtDocs, noindex });
|
|
247
|
+
const llmsTxt = generateLlmsTxt({ name, description, baseUrl, pages, hostAtDocs, noindex });
|
|
248
|
+
const robotsTxt = generateRobotsTxt({ baseUrl, hostAtDocs, noindex });
|
|
249
|
+
|
|
250
|
+
return { sitemap, llmsTxt, robotsTxt };
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Search document entry.
|
|
255
|
+
*/
|
|
256
|
+
export interface SearchDocument {
|
|
257
|
+
id: string;
|
|
258
|
+
title: string;
|
|
259
|
+
description?: string;
|
|
260
|
+
content: string;
|
|
261
|
+
slug: string;
|
|
262
|
+
section?: string;
|
|
263
|
+
type: string;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Raw page info with content for search index generation.
|
|
268
|
+
*/
|
|
269
|
+
export interface SearchPageInfo {
|
|
270
|
+
/** File path with extension */
|
|
271
|
+
path: string;
|
|
272
|
+
/** Raw MDX content */
|
|
273
|
+
content: string;
|
|
274
|
+
/** Frontmatter from MDX file */
|
|
275
|
+
frontmatter: {
|
|
276
|
+
title?: string;
|
|
277
|
+
description?: string;
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Infer page type from slug path.
|
|
283
|
+
*/
|
|
284
|
+
function inferPageType(slug: string): string {
|
|
285
|
+
if (slug.startsWith('api/') || slug.startsWith('api-reference/')) return 'api';
|
|
286
|
+
if (slug.includes('changelog')) return 'changelog';
|
|
287
|
+
if (slug.includes('quickstart') || slug.includes('getting-started')) return 'quickstart';
|
|
288
|
+
return 'guide';
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Strip markdown formatting from text.
|
|
293
|
+
*/
|
|
294
|
+
function stripMarkdown(text: string): string {
|
|
295
|
+
return text
|
|
296
|
+
.replace(/```[\s\S]*?```/g, '') // code blocks
|
|
297
|
+
.replace(/`[^`]+`/g, '') // inline code
|
|
298
|
+
.replace(/#{1,6}\s/g, '') // headings
|
|
299
|
+
.replace(/\*\*([^*]+)\*\*/g, '$1') // bold
|
|
300
|
+
.replace(/\*([^*]+)\*/g, '$1') // italic
|
|
301
|
+
.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1') // links
|
|
302
|
+
.replace(/<[^>]+>/g, '') // HTML tags
|
|
303
|
+
.replace(/!\[([^\]]*)\]\([^)]+\)/g, '') // images
|
|
304
|
+
.replace(/\n+/g, ' ') // newlines
|
|
305
|
+
.trim();
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Extract sections from MDX content.
|
|
310
|
+
*/
|
|
311
|
+
function extractSections(content: string): Array<{ heading: string; content: string }> {
|
|
312
|
+
const sections: Array<{ heading: string; content: string }> = [];
|
|
313
|
+
const lines = content.split('\n');
|
|
314
|
+
let currentHeading = '';
|
|
315
|
+
let currentContent: string[] = [];
|
|
316
|
+
|
|
317
|
+
for (const line of lines) {
|
|
318
|
+
const headingMatch = line.match(/^#{1,6}\s+(.+)$/);
|
|
319
|
+
if (headingMatch) {
|
|
320
|
+
if (currentHeading || currentContent.length > 0) {
|
|
321
|
+
sections.push({
|
|
322
|
+
heading: currentHeading,
|
|
323
|
+
content: currentContent.join('\n'),
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
currentHeading = headingMatch[1];
|
|
327
|
+
currentContent = [];
|
|
328
|
+
} else {
|
|
329
|
+
currentContent.push(line);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
if (currentHeading || currentContent.length > 0) {
|
|
334
|
+
sections.push({
|
|
335
|
+
heading: currentHeading,
|
|
336
|
+
content: currentContent.join('\n'),
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return sections;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Generate search data from page content.
|
|
345
|
+
*
|
|
346
|
+
* @param pages - Array of page info with content
|
|
347
|
+
* @returns JSON string of search documents
|
|
348
|
+
*/
|
|
349
|
+
export function generateSearchData(pages: SearchPageInfo[]): string {
|
|
350
|
+
const documents: SearchDocument[] = [];
|
|
351
|
+
|
|
352
|
+
for (const page of pages) {
|
|
353
|
+
const pathWithoutExt = page.path.replace(/\.mdx?$/, '');
|
|
354
|
+
const slug = pathWithoutExt.replace(/\\/g, '/');
|
|
355
|
+
const pageType = inferPageType(slug);
|
|
356
|
+
const sections = extractSections(page.content);
|
|
357
|
+
|
|
358
|
+
sections.forEach((section, idx) => {
|
|
359
|
+
const cleanContent = stripMarkdown(section.content);
|
|
360
|
+
if (cleanContent.trim()) {
|
|
361
|
+
documents.push({
|
|
362
|
+
id: `${slug}-${idx}`,
|
|
363
|
+
title: page.frontmatter.title || slug.split('/').pop() || '',
|
|
364
|
+
description: page.frontmatter.description,
|
|
365
|
+
content: cleanContent.substring(0, 300),
|
|
366
|
+
slug,
|
|
367
|
+
section: section.heading || undefined,
|
|
368
|
+
type: pageType,
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return JSON.stringify(documents);
|
|
375
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared handler for static file routes (sitemap.xml, robots.txt, llms.txt, search-data.json).
|
|
3
|
+
*
|
|
4
|
+
* All static file routes follow the same pattern: check ISR mode, extract project slug,
|
|
5
|
+
* fetch from R2, and return with appropriate headers. This helper eliminates the
|
|
6
|
+
* duplication across 8 route files (4 at root + 4 at /docs).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
10
|
+
|
|
11
|
+
import { log } from '@/lib/logger';
|
|
12
|
+
import { isIsrMode } from '@/lib/page-isr-helpers';
|
|
13
|
+
import { fetchStaticFile } from '@/lib/r2-content';
|
|
14
|
+
|
|
15
|
+
const CONTENT_TYPES: Record<string, string> = {
|
|
16
|
+
'.xml': 'application/xml',
|
|
17
|
+
'.json': 'application/json',
|
|
18
|
+
'.txt': 'text/plain',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Infer content type from filename extension.
|
|
23
|
+
*/
|
|
24
|
+
function getContentType(filename: string): string {
|
|
25
|
+
const ext = filename.slice(filename.lastIndexOf('.'));
|
|
26
|
+
return CONTENT_TYPES[ext] || 'application/octet-stream';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Create a GET handler that serves a static file from R2.
|
|
31
|
+
*
|
|
32
|
+
* @param filename - The R2 filename (e.g., 'sitemap.xml', 'search-data.json')
|
|
33
|
+
* @param label - Human-readable label for log messages (e.g., 'Sitemap', 'Search data')
|
|
34
|
+
*/
|
|
35
|
+
export function createStaticFileHandler(
|
|
36
|
+
filename: string,
|
|
37
|
+
label: string
|
|
38
|
+
): (request: NextRequest) => Promise<NextResponse> {
|
|
39
|
+
const contentType = getContentType(filename);
|
|
40
|
+
|
|
41
|
+
return async function GET(request: NextRequest): Promise<NextResponse> {
|
|
42
|
+
if (!isIsrMode()) {
|
|
43
|
+
return new NextResponse('Not found', { status: 404 });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const projectSlug = request.headers.get('x-project-slug');
|
|
47
|
+
|
|
48
|
+
if (!projectSlug) {
|
|
49
|
+
log('warn', `${label} request missing project slug`);
|
|
50
|
+
return new NextResponse('Project not found', { status: 404 });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
const content = await fetchStaticFile(projectSlug, filename);
|
|
55
|
+
|
|
56
|
+
if (!content) {
|
|
57
|
+
log('warn', `${label} not found in R2`, { projectSlug });
|
|
58
|
+
return new NextResponse(`${label} not found`, { status: 404 });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return new NextResponse(content, {
|
|
62
|
+
headers: {
|
|
63
|
+
'Content-Type': contentType,
|
|
64
|
+
'Cache-Control': 'public, max-age=3600, s-maxage=86400',
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
} catch (error) {
|
|
68
|
+
log('error', `Error serving ${label.toLowerCase()}`, { projectSlug, error: String(error) });
|
|
69
|
+
return new NextResponse(`Error serving ${label.toLowerCase()}`, { status: 500 });
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minified tracking script for analytics injection
|
|
3
|
+
*
|
|
4
|
+
* This script is injected into HTML pages to track page views.
|
|
5
|
+
* Source: see route.ts injectTrackingScript for readable version (git history)
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Session ID generation using crypto API
|
|
9
|
+
* - SPA navigation tracking (pushState, replaceState, popstate)
|
|
10
|
+
* - Referrer extraction (filters self-referrals)
|
|
11
|
+
* - Timezone detection for country fallback
|
|
12
|
+
* - Debouncing to prevent duplicate events
|
|
13
|
+
* - sendBeacon with fetch fallback
|
|
14
|
+
*/
|
|
15
|
+
export const TRACKING_SCRIPT = `<script>(function(){function e(){let e=sessionStorage.getItem("jamdesk_session_id");if(!e){const t=new Uint8Array(16);crypto.getRandomValues(t),e=Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")+Date.now().toString(36),sessionStorage.setItem("jamdesk_session_id",e)}return e}let t="",n=0;function a(a){const i=Date.now(),s=window.location.pathname;if(s===t&&i-n<500)return;t=s,n=i;const o=e();let r=null;if(document.referrer)try{const e=new URL(document.referrer);e.hostname!==window.location.hostname&&(r=e.hostname)}catch(e){}let c=null;try{c=Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){}const d={projectSlug:"__PROJECT__",path:a||s,referrer:r,userAgent:navigator.userAgent,sessionId:o,type:"pageview",eventId:o+":"+i.toString(36),timezone:c},l=JSON.stringify(d);navigator.sendBeacon?navigator.sendBeacon("/_jd/ev",new Blob([l],{type:"application/json"})):fetch("/_jd/ev",{method:"POST",headers:{"Content-Type":"application/json"},body:l,keepalive:!0}).catch(()=>{})}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{a()}):a();const i=history.pushState,s=history.replaceState;history.pushState=function(){i.apply(this,arguments),a()},history.replaceState=function(){s.apply(this,arguments),a()},window.addEventListener("popstate",()=>{a()})})();</script>`;
|
|
16
|
+
|
|
17
|
+
export function getTrackingScript(projectSlug: string): string {
|
|
18
|
+
return TRACKING_SCRIPT.replace('__PROJECT__', projectSlug);
|
|
19
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typography Configuration Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides helper functions to conditionally include typography plugins
|
|
5
|
+
* in the MDX processing pipeline based on docs.json configuration.
|
|
6
|
+
*
|
|
7
|
+
* Typography is enabled via: styling.typography: true in docs.json
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { DocsConfig } from './docs-types';
|
|
11
|
+
import remarkSmartypants from 'remark-smartypants';
|
|
12
|
+
import type { PluggableList } from 'unified';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Check if typography enhancements are enabled in the docs config.
|
|
16
|
+
*
|
|
17
|
+
* @param config - The docs.json configuration
|
|
18
|
+
* @returns true if styling.typography is explicitly set to true
|
|
19
|
+
*/
|
|
20
|
+
export function isTypographyEnabled(config?: DocsConfig): boolean {
|
|
21
|
+
return config?.styling?.typography === true;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get remark plugins for typography processing.
|
|
26
|
+
* Returns remark-smartypants if typography is enabled, otherwise empty array.
|
|
27
|
+
*
|
|
28
|
+
* remark-smartypants converts:
|
|
29
|
+
* - "quotes" to "curly quotes"
|
|
30
|
+
* - -- to en-dash (–)
|
|
31
|
+
* - --- to em-dash (—)
|
|
32
|
+
* - ... to ellipsis (…)
|
|
33
|
+
*
|
|
34
|
+
* @param config - The docs.json configuration
|
|
35
|
+
* @returns Array of remark plugins
|
|
36
|
+
*/
|
|
37
|
+
export function getTypographyRemarkPlugins(config?: DocsConfig): PluggableList {
|
|
38
|
+
if (!isTypographyEnabled(config)) {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
return [remarkSmartypants];
|
|
42
|
+
}
|