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,473 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract inline components that use React hooks to snippet files.
|
|
3
|
+
*
|
|
4
|
+
* Inline MDX components are server-rendered and cannot use React hooks.
|
|
5
|
+
* This module detects hook usage and extracts those components to
|
|
6
|
+
* proper snippet files with 'use client' directive.
|
|
7
|
+
*
|
|
8
|
+
* Example transformation:
|
|
9
|
+
*
|
|
10
|
+
* Before (in page.mdx):
|
|
11
|
+
* export const Counter = () => {
|
|
12
|
+
* const [count, setCount] = useState(0);
|
|
13
|
+
* return <button onClick={() => setCount(c => c + 1)}>{count}</button>;
|
|
14
|
+
* };
|
|
15
|
+
*
|
|
16
|
+
* After:
|
|
17
|
+
* - Creates /snippets/counter.tsx with 'use client' and the component
|
|
18
|
+
* - Replaces export with: import { Counter } from '/snippets/counter';
|
|
19
|
+
*/
|
|
20
|
+
import fs from 'fs-extra';
|
|
21
|
+
import path from 'path';
|
|
22
|
+
// React hooks that require client-side rendering
|
|
23
|
+
const REACT_HOOKS = [
|
|
24
|
+
'useState',
|
|
25
|
+
'useEffect',
|
|
26
|
+
'useContext',
|
|
27
|
+
'useReducer',
|
|
28
|
+
'useCallback',
|
|
29
|
+
'useMemo',
|
|
30
|
+
'useRef',
|
|
31
|
+
'useImperativeHandle',
|
|
32
|
+
'useLayoutEffect',
|
|
33
|
+
'useDebugValue',
|
|
34
|
+
'useDeferredValue',
|
|
35
|
+
'useTransition',
|
|
36
|
+
'useId',
|
|
37
|
+
'useSyncExternalStore',
|
|
38
|
+
'useInsertionEffect',
|
|
39
|
+
];
|
|
40
|
+
const HOOKS_PATTERN = new RegExp(`\\b(${REACT_HOOKS.join('|')})\\s*\\(`, 'g');
|
|
41
|
+
/**
|
|
42
|
+
* Find all fenced code block ranges in content.
|
|
43
|
+
* Returns array of [start, end] positions for each code block.
|
|
44
|
+
*/
|
|
45
|
+
function findCodeBlockRanges(content) {
|
|
46
|
+
const ranges = [];
|
|
47
|
+
const fencePattern = /^```/gm;
|
|
48
|
+
let match;
|
|
49
|
+
let openFence = null;
|
|
50
|
+
while ((match = fencePattern.exec(content)) !== null) {
|
|
51
|
+
if (openFence === null) {
|
|
52
|
+
// Opening fence
|
|
53
|
+
openFence = match.index;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
// Closing fence - find end of line
|
|
57
|
+
let endPos = match.index + 3;
|
|
58
|
+
while (endPos < content.length && content[endPos] !== '\n') {
|
|
59
|
+
endPos++;
|
|
60
|
+
}
|
|
61
|
+
ranges.push([openFence, endPos]);
|
|
62
|
+
openFence = null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return ranges;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Check if a position is inside any code block.
|
|
69
|
+
*/
|
|
70
|
+
function isInsideCodeBlock(pos, codeBlockRanges) {
|
|
71
|
+
return codeBlockRanges.some(([start, end]) => pos >= start && pos <= end);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Extract all inline component exports from MDX content.
|
|
75
|
+
* Skips exports inside fenced code blocks.
|
|
76
|
+
*/
|
|
77
|
+
function extractInlineExports(content) {
|
|
78
|
+
const results = [];
|
|
79
|
+
const codeBlockRanges = findCodeBlockRanges(content);
|
|
80
|
+
// Match export const declarations
|
|
81
|
+
const exportPattern = /export\s+const\s+(\w+)\s*=\s*/g;
|
|
82
|
+
let match;
|
|
83
|
+
const matches = [];
|
|
84
|
+
while ((match = exportPattern.exec(content)) !== null) {
|
|
85
|
+
// Skip exports inside code blocks
|
|
86
|
+
if (isInsideCodeBlock(match.index, codeBlockRanges)) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
// Only match PascalCase names (React components)
|
|
90
|
+
if (/^[A-Z][a-zA-Z0-9]*$/.test(match[1])) {
|
|
91
|
+
matches.push({
|
|
92
|
+
name: match[1],
|
|
93
|
+
start: match.index,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Find the end of each export (next export or significant content)
|
|
98
|
+
for (let i = 0; i < matches.length; i++) {
|
|
99
|
+
const current = matches[i];
|
|
100
|
+
const nextStart = i + 1 < matches.length ? matches[i + 1].start : findExportEnd(content, current.start);
|
|
101
|
+
const source = content.slice(current.start, nextStart).trim().replace(/;?\s*$/, ';');
|
|
102
|
+
results.push({
|
|
103
|
+
name: current.name,
|
|
104
|
+
source,
|
|
105
|
+
start: current.start,
|
|
106
|
+
end: nextStart,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return results;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Count preceding backslashes to determine if a quote is escaped.
|
|
113
|
+
* An odd number of backslashes means the quote is escaped.
|
|
114
|
+
*/
|
|
115
|
+
function isEscapedQuote(content, pos) {
|
|
116
|
+
let backslashCount = 0;
|
|
117
|
+
let j = pos - 1;
|
|
118
|
+
while (j >= 0 && content[j] === '\\') {
|
|
119
|
+
backslashCount++;
|
|
120
|
+
j--;
|
|
121
|
+
}
|
|
122
|
+
return backslashCount % 2 === 1;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Find where an export statement ends (before the next non-export content).
|
|
126
|
+
*/
|
|
127
|
+
function findExportEnd(content, start) {
|
|
128
|
+
// Find the semicolon that ends the export, accounting for nested braces
|
|
129
|
+
let depth = 0;
|
|
130
|
+
let inString = null;
|
|
131
|
+
let templateExprDepth = 0; // Track depth inside template literal expressions ${...}
|
|
132
|
+
let i = start;
|
|
133
|
+
// Skip past "export const Name = "
|
|
134
|
+
const declMatch = content.slice(start).match(/^export\s+const\s+\w+\s*=\s*/);
|
|
135
|
+
if (declMatch) {
|
|
136
|
+
i += declMatch[0].length;
|
|
137
|
+
}
|
|
138
|
+
while (i < content.length) {
|
|
139
|
+
const char = content[i];
|
|
140
|
+
// Handle template literal expressions: ${...}
|
|
141
|
+
if (inString === '`') {
|
|
142
|
+
if (char === '$' && content[i + 1] === '{' && !isEscapedQuote(content, i)) {
|
|
143
|
+
templateExprDepth++;
|
|
144
|
+
i += 2;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (templateExprDepth > 0 && char === '}') {
|
|
148
|
+
templateExprDepth--;
|
|
149
|
+
i++;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// Handle strings (only when not inside a template expression)
|
|
154
|
+
if ((char === '"' || char === "'" || char === '`') && !isEscapedQuote(content, i)) {
|
|
155
|
+
if (inString === char && (char !== '`' || templateExprDepth === 0)) {
|
|
156
|
+
inString = null;
|
|
157
|
+
}
|
|
158
|
+
else if (!inString) {
|
|
159
|
+
inString = char;
|
|
160
|
+
}
|
|
161
|
+
i++;
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (inString) {
|
|
165
|
+
i++;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
// Track brace depth (only outside strings)
|
|
169
|
+
if (char === '(' || char === '{' || char === '[') {
|
|
170
|
+
depth++;
|
|
171
|
+
}
|
|
172
|
+
else if (char === ')' || char === '}' || char === ']') {
|
|
173
|
+
depth--;
|
|
174
|
+
}
|
|
175
|
+
// End at semicolon when depth is 0
|
|
176
|
+
if (char === ';' && depth === 0) {
|
|
177
|
+
return i + 1;
|
|
178
|
+
}
|
|
179
|
+
// End at depth 0 when we hit a newline followed by non-whitespace that's not a continuation
|
|
180
|
+
if (char === '\n' && depth === 0) {
|
|
181
|
+
const rest = content.slice(i + 1);
|
|
182
|
+
// Check if next line starts a new statement (not continuation)
|
|
183
|
+
if (/^\s*(?:export|import|const|let|var|function|class|\/\/|\/\*|<[A-Z]|#|---|\n)/.test(rest) ||
|
|
184
|
+
/^\s*\n\s*\n/.test(rest)) {
|
|
185
|
+
return i;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
i++;
|
|
189
|
+
}
|
|
190
|
+
return content.length;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Strip comments from source code to avoid false positives in hook detection.
|
|
194
|
+
* Handles single-line (//) and multi-line (/* */) comments.
|
|
195
|
+
*/
|
|
196
|
+
function stripComments(source) {
|
|
197
|
+
let result = '';
|
|
198
|
+
let i = 0;
|
|
199
|
+
let inString = null;
|
|
200
|
+
while (i < source.length) {
|
|
201
|
+
const char = source[i];
|
|
202
|
+
const nextChar = source[i + 1];
|
|
203
|
+
// Handle strings (don't strip inside strings)
|
|
204
|
+
if ((char === '"' || char === "'" || char === '`') && !isEscapedQuote(source, i)) {
|
|
205
|
+
if (inString === char) {
|
|
206
|
+
inString = null;
|
|
207
|
+
}
|
|
208
|
+
else if (!inString) {
|
|
209
|
+
inString = char;
|
|
210
|
+
}
|
|
211
|
+
result += char;
|
|
212
|
+
i++;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (inString) {
|
|
216
|
+
result += char;
|
|
217
|
+
i++;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
// Single-line comment
|
|
221
|
+
if (char === '/' && nextChar === '/') {
|
|
222
|
+
// Skip to end of line
|
|
223
|
+
while (i < source.length && source[i] !== '\n') {
|
|
224
|
+
i++;
|
|
225
|
+
}
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
// Multi-line comment
|
|
229
|
+
if (char === '/' && nextChar === '*') {
|
|
230
|
+
i += 2;
|
|
231
|
+
while (i < source.length - 1 && !(source[i] === '*' && source[i + 1] === '/')) {
|
|
232
|
+
i++;
|
|
233
|
+
}
|
|
234
|
+
i += 2; // Skip closing */
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
result += char;
|
|
238
|
+
i++;
|
|
239
|
+
}
|
|
240
|
+
return result;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Check if component source uses any React hooks.
|
|
244
|
+
* Strips comments first to avoid false positives.
|
|
245
|
+
*/
|
|
246
|
+
function detectHooks(source) {
|
|
247
|
+
// Strip comments to avoid false positives like "// TODO: add useState"
|
|
248
|
+
const codeOnly = stripComments(source);
|
|
249
|
+
const hooks = [];
|
|
250
|
+
let match;
|
|
251
|
+
HOOKS_PATTERN.lastIndex = 0;
|
|
252
|
+
while ((match = HOOKS_PATTERN.exec(codeOnly)) !== null) {
|
|
253
|
+
if (!hooks.includes(match[1])) {
|
|
254
|
+
hooks.push(match[1]);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return hooks;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Convert component name to snippet filename (kebab-case).
|
|
261
|
+
*/
|
|
262
|
+
function toSnippetFilename(name) {
|
|
263
|
+
return name
|
|
264
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
265
|
+
.replace(/([A-Z])([A-Z][a-z])/g, '$1-$2')
|
|
266
|
+
.toLowerCase();
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Generate a snippet file content from the extracted component.
|
|
270
|
+
*/
|
|
271
|
+
function generateSnippetContent(name, source, hooks) {
|
|
272
|
+
// Extract the function body from "export const Name = <body>;"
|
|
273
|
+
const bodyMatch = source.match(/^export\s+const\s+\w+\s*=\s*([\s\S]+?);?\s*$/);
|
|
274
|
+
if (!bodyMatch) {
|
|
275
|
+
throw new Error(`Could not extract function body from: ${source.slice(0, 100)}...`);
|
|
276
|
+
}
|
|
277
|
+
const body = bodyMatch[1].trim();
|
|
278
|
+
// Build the snippet file
|
|
279
|
+
const lines = [
|
|
280
|
+
"'use client';",
|
|
281
|
+
'',
|
|
282
|
+
`import { ${hooks.join(', ')} } from 'react';`,
|
|
283
|
+
'',
|
|
284
|
+
`export const ${name} = ${body};`,
|
|
285
|
+
'',
|
|
286
|
+
];
|
|
287
|
+
return lines.join('\n');
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Extract components with hooks from MDX content to snippet files.
|
|
291
|
+
*
|
|
292
|
+
* @param content - MDX file content
|
|
293
|
+
* @param snippetsDir - Directory to write snippet files
|
|
294
|
+
* @returns Modified content with imports instead of inline exports
|
|
295
|
+
*/
|
|
296
|
+
export function extractComponentsWithHooks(content, snippetsDir) {
|
|
297
|
+
const exports = extractInlineExports(content);
|
|
298
|
+
const extractedComponents = [];
|
|
299
|
+
// Find components that use hooks
|
|
300
|
+
for (const exp of exports) {
|
|
301
|
+
const hooks = detectHooks(exp.source);
|
|
302
|
+
if (hooks.length > 0) {
|
|
303
|
+
const snippetFilename = toSnippetFilename(exp.name);
|
|
304
|
+
extractedComponents.push({
|
|
305
|
+
name: exp.name,
|
|
306
|
+
source: exp.source,
|
|
307
|
+
hooks,
|
|
308
|
+
snippetPath: `/snippets/${snippetFilename}`,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (extractedComponents.length === 0) {
|
|
313
|
+
return { content, extractedComponents: [], changed: false };
|
|
314
|
+
}
|
|
315
|
+
// Replace exports with imports (process in reverse order to preserve positions)
|
|
316
|
+
let modifiedContent = content;
|
|
317
|
+
const sortedExports = exports
|
|
318
|
+
.filter(exp => extractedComponents.some(ec => ec.name === exp.name))
|
|
319
|
+
.sort((a, b) => b.start - a.start); // Reverse order
|
|
320
|
+
for (const exp of sortedExports) {
|
|
321
|
+
const component = extractedComponents.find(ec => ec.name === exp.name);
|
|
322
|
+
const importStatement = `import { ${exp.name} } from '${component.snippetPath}';`;
|
|
323
|
+
// Replace the export with import
|
|
324
|
+
modifiedContent =
|
|
325
|
+
modifiedContent.slice(0, exp.start) +
|
|
326
|
+
importStatement +
|
|
327
|
+
modifiedContent.slice(exp.end);
|
|
328
|
+
}
|
|
329
|
+
// Clean up any double newlines created by replacement
|
|
330
|
+
modifiedContent = modifiedContent.replace(/\n{3,}/g, '\n\n');
|
|
331
|
+
return {
|
|
332
|
+
content: modifiedContent,
|
|
333
|
+
extractedComponents,
|
|
334
|
+
changed: true,
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Check if a snippet with the given basename already exists (any extension).
|
|
339
|
+
* Returns the filename if found, null otherwise.
|
|
340
|
+
*/
|
|
341
|
+
async function findExistingSnippet(snippetsDir, basename) {
|
|
342
|
+
const extensions = ['.tsx', '.jsx', '.mdx'];
|
|
343
|
+
for (const ext of extensions) {
|
|
344
|
+
const filepath = path.join(snippetsDir, basename + ext);
|
|
345
|
+
if (await fs.pathExists(filepath)) {
|
|
346
|
+
return basename + ext;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return null;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Check if a file contains React hooks that require 'use client'.
|
|
353
|
+
*/
|
|
354
|
+
async function fileUsesHooks(filepath) {
|
|
355
|
+
const content = await fs.readFile(filepath, 'utf-8');
|
|
356
|
+
HOOKS_PATTERN.lastIndex = 0;
|
|
357
|
+
return HOOKS_PATTERN.test(content);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Common language subdirectory names used for translations.
|
|
361
|
+
*/
|
|
362
|
+
const LANG_SUBDIRS = ['es', 'fr', 'zh', 'ja', 'ko', 'de', 'pt', 'it', 'ru', 'nl', 'pl', 'tr', 'ar', 'hi'];
|
|
363
|
+
/**
|
|
364
|
+
* Remove duplicate .mdx files in language subdirectories.
|
|
365
|
+
* These would cause duplicate component definitions in the build.
|
|
366
|
+
*/
|
|
367
|
+
async function removeLangSubdirDuplicates(snippetsDir, basename) {
|
|
368
|
+
const removed = [];
|
|
369
|
+
for (const lang of LANG_SUBDIRS) {
|
|
370
|
+
const langDir = path.join(snippetsDir, lang);
|
|
371
|
+
if (await fs.pathExists(langDir)) {
|
|
372
|
+
const mdxPath = path.join(langDir, basename + '.mdx');
|
|
373
|
+
if (await fs.pathExists(mdxPath)) {
|
|
374
|
+
await fs.remove(mdxPath);
|
|
375
|
+
removed.push(`${lang}/${basename}.mdx`);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return removed;
|
|
380
|
+
}
|
|
381
|
+
export async function writeSnippetFiles(snippetsDir, components) {
|
|
382
|
+
await fs.ensureDir(snippetsDir);
|
|
383
|
+
const overwritten = [];
|
|
384
|
+
const converted = [];
|
|
385
|
+
const skipped = [];
|
|
386
|
+
for (const component of components) {
|
|
387
|
+
const basename = toSnippetFilename(component.name);
|
|
388
|
+
const filename = basename + '.tsx';
|
|
389
|
+
const filepath = path.join(snippetsDir, filename);
|
|
390
|
+
// Check if any snippet with the same basename already exists
|
|
391
|
+
const existing = await findExistingSnippet(snippetsDir, basename);
|
|
392
|
+
if (existing && existing !== filename) {
|
|
393
|
+
const existingPath = path.join(snippetsDir, existing);
|
|
394
|
+
// If existing file is .mdx and uses hooks, convert it to .tsx
|
|
395
|
+
if (existing.endsWith('.mdx') && await fileUsesHooks(existingPath)) {
|
|
396
|
+
// Remove the old .mdx file - we're converting it to proper .tsx
|
|
397
|
+
await fs.remove(existingPath);
|
|
398
|
+
converted.push(existing);
|
|
399
|
+
// Also remove duplicates in language subdirectories
|
|
400
|
+
const langDuplicates = await removeLangSubdirDuplicates(snippetsDir, basename);
|
|
401
|
+
converted.push(...langDuplicates);
|
|
402
|
+
}
|
|
403
|
+
else if (existing.endsWith('.jsx')) {
|
|
404
|
+
// .jsx files are already proper components, skip
|
|
405
|
+
skipped.push({ name: component.name, existingFile: existing });
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
// Other cases (.mdx without hooks), skip
|
|
410
|
+
skipped.push({ name: component.name, existingFile: existing });
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
// Track if we're overwriting an existing .tsx file
|
|
415
|
+
if (existing === filename) {
|
|
416
|
+
overwritten.push(filename);
|
|
417
|
+
// Also remove duplicates in language subdirectories when overwriting
|
|
418
|
+
const langDuplicates = await removeLangSubdirDuplicates(snippetsDir, basename);
|
|
419
|
+
converted.push(...langDuplicates);
|
|
420
|
+
}
|
|
421
|
+
const content = generateSnippetContent(component.name, component.source, component.hooks);
|
|
422
|
+
await fs.writeFile(filepath, content, 'utf-8');
|
|
423
|
+
}
|
|
424
|
+
return { overwritten, converted, skipped };
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Process all MDX files in a directory, extracting hook-using components to snippets.
|
|
428
|
+
*/
|
|
429
|
+
export async function migrateHooksToSnippets(dir, mdxFiles) {
|
|
430
|
+
const snippetsDir = path.join(dir, 'snippets');
|
|
431
|
+
const results = [];
|
|
432
|
+
const allOverwritten = [];
|
|
433
|
+
const allConverted = [];
|
|
434
|
+
const allSkipped = [];
|
|
435
|
+
let filesModified = 0;
|
|
436
|
+
let componentsExtracted = 0;
|
|
437
|
+
for (const file of mdxFiles) {
|
|
438
|
+
const content = await fs.readFile(file, 'utf-8');
|
|
439
|
+
const result = extractComponentsWithHooks(content, snippetsDir);
|
|
440
|
+
if (result.changed) {
|
|
441
|
+
// Write snippet files first to know what was skipped/converted
|
|
442
|
+
const writeResult = await writeSnippetFiles(snippetsDir, result.extractedComponents);
|
|
443
|
+
allOverwritten.push(...writeResult.overwritten);
|
|
444
|
+
allConverted.push(...writeResult.converted);
|
|
445
|
+
allSkipped.push(...writeResult.skipped);
|
|
446
|
+
// Filter out skipped components from the MDX replacement
|
|
447
|
+
const skippedNames = new Set(writeResult.skipped.map(s => s.name));
|
|
448
|
+
const writtenComponents = result.extractedComponents.filter(c => !skippedNames.has(c.name));
|
|
449
|
+
if (writtenComponents.length > 0) {
|
|
450
|
+
// Re-extract with only written components to get correct MDX content
|
|
451
|
+
// Or just write the modified MDX as-is since it still has the imports
|
|
452
|
+
await fs.writeFile(file, result.content, 'utf-8');
|
|
453
|
+
filesModified++;
|
|
454
|
+
componentsExtracted += writtenComponents.length;
|
|
455
|
+
results.push({
|
|
456
|
+
file: path.relative(dir, file),
|
|
457
|
+
components: writtenComponents,
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return {
|
|
463
|
+
filesProcessed: mdxFiles.length,
|
|
464
|
+
filesModified,
|
|
465
|
+
componentsExtracted,
|
|
466
|
+
overwrittenSnippets: [...new Set(allOverwritten)], // Deduplicate
|
|
467
|
+
convertedSnippets: [...new Set(allConverted)], // Deduplicate
|
|
468
|
+
skippedComponents: allSkipped.filter((s, i, arr) => arr.findIndex(x => x.name === s.name) === i // Deduplicate by name
|
|
469
|
+
),
|
|
470
|
+
results,
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
//# sourceMappingURL=extract-hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-hooks.js","sourceRoot":"","sources":["../../../src/commands/migrate/extract-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,iDAAiD;AACjD,MAAM,WAAW,GAAG;IAClB,UAAU;IACV,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,aAAa;IACb,SAAS;IACT,QAAQ;IACR,qBAAqB;IACrB,iBAAiB;IACjB,eAAe;IACf,kBAAkB;IAClB,eAAe;IACf,OAAO;IACP,sBAAsB;IACtB,oBAAoB;CACrB,CAAC;AAEF,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;AA4B9E;;;GAGG;AACH,SAAS,mBAAmB,CAAC,OAAe;IAC1C,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,MAAM,YAAY,GAAG,QAAQ,CAAC;IAC9B,IAAI,KAAK,CAAC;IACV,IAAI,SAAS,GAAkB,IAAI,CAAC;IAEpC,OAAO,CAAC,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACrD,IAAI,SA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;QAC/B,aAAa;QACb,mBAAmB;QACnB,mBAAmB,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,CAAC,EAAE,cAAc;QACjE,iBAAiB,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC,EAAE,cAAc;QAC7D,iBAAiB,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,CACjD,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAE,sBAAsB;SACpE;QACD,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration command for converting documentation from other platforms to Jamdesk.
|
|
3
|
+
*
|
|
4
|
+
* Currently supports:
|
|
5
|
+
* - Mintlify (mint.json) → Jamdesk (docs.json)
|
|
6
|
+
*
|
|
7
|
+
* Usage: jamdesk migrate
|
|
8
|
+
*
|
|
9
|
+
* The command walks users through an interactive migration process:
|
|
10
|
+
* 1. Detects the source platform (Mintlify)
|
|
11
|
+
* 2. Shows backup warning and asks for confirmation
|
|
12
|
+
* 3. Asks for theme preference
|
|
13
|
+
* 4. Converts config in place (modifies files directly)
|
|
14
|
+
*/
|
|
15
|
+
import type { MigrationOptions } from './types.js';
|
|
16
|
+
export declare function migrate(options: MigrationOptions): Promise<void>;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/migrate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAWH,OAAO,KAAK,EAAE,gBAAgB,EAAa,MAAM,YAAY,CAAC;AAE9D,wBAAsB,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoStE"}
|