create-fumadocs-app 16.2.28 → 16.2.29

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 (41) hide show
  1. package/dist/bin.js +4 -4
  2. package/dist/bin.js.map +1 -1
  3. package/dist/{constants-CprVC8qU.js → constants-BGeuHcdV.js} +15 -52
  4. package/dist/constants-BGeuHcdV.js.map +1 -0
  5. package/dist/{feature-DJaEJkld.js → feature-DB9zShId.js} +2 -2
  6. package/dist/{feature-DJaEJkld.js.map → feature-DB9zShId.js.map} +1 -1
  7. package/dist/{index-oGVLdt_F.d.ts → index-DHK1sZ4O.d.ts} +3 -3
  8. package/dist/{index-oGVLdt_F.d.ts.map → index-DHK1sZ4O.d.ts.map} +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +1 -1
  11. package/dist/plugins/feature.d.ts +1 -1
  12. package/dist/plugins/feature.js +1 -1
  13. package/dist/plugins/next-use-src.d.ts +1 -1
  14. package/dist/{src-DW8s8ZAf.js → src-G2bUVbwQ.js} +2 -2
  15. package/dist/{src-DW8s8ZAf.js.map → src-G2bUVbwQ.js.map} +1 -1
  16. package/package.json +2 -2
  17. package/template/+next+fuma-docs-mdx/package.json +1 -1
  18. package/template/+next+fuma-docs-mdx+static/package.json +1 -1
  19. package/template/astro/astro.config.mjs +1 -1
  20. package/template/astro/package.json +3 -2
  21. package/template/astro/public/favicon.svg +33 -0
  22. package/template/astro/src/components/docs.tsx +53 -0
  23. package/template/astro/src/components/home.tsx +23 -0
  24. package/template/astro/src/components/mdx.tsx +3 -1
  25. package/template/astro/src/components/provider.tsx +20 -0
  26. package/template/astro/src/components/search.tsx +34 -0
  27. package/template/astro/src/layouts/Layout.astro +27 -0
  28. package/template/astro/src/lib/layout.shared.tsx +4 -1
  29. package/template/astro/src/lib/shared.ts +33 -0
  30. package/template/astro/src/lib/source.ts +9 -2
  31. package/template/astro/src/pages/404.astro +8 -0
  32. package/template/astro/src/pages/api/search.ts +10 -0
  33. package/template/astro/src/pages/docs/[...slug].astro +43 -0
  34. package/template/astro/src/pages/docs/[...slug].md.ts +21 -0
  35. package/template/astro/src/pages/index.astro +17 -13
  36. package/template/astro/src/pages/llms-full.txt.ts +4 -0
  37. package/template/astro/src/pages/llms.txt.ts +4 -0
  38. package/template/astro/src/pages/og/docs/[...slug]/image.webp.ts +24 -0
  39. package/template/astro/src/styles/global.css +9 -0
  40. package/dist/constants-CprVC8qU.js.map +0 -1
  41. package/template/astro/src/fumadocs.config.ts +0 -7
package/dist/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { i as templates, n as isCI } from "./constants-CprVC8qU.js";
3
- import { n as getPackageManager, r as managers, t as create } from "./src-DW8s8ZAf.js";
4
- import { t as feature } from "./feature-DJaEJkld.js";
2
+ import { i as templates, n as isCI } from "./constants-BGeuHcdV.js";
3
+ import { n as getPackageManager, r as managers, t as create } from "./src-G2bUVbwQ.js";
4
+ import { t as feature } from "./feature-DB9zShId.js";
5
5
  import fs from "node:fs/promises";
6
6
  import path from "node:path";
7
7
  import { cancel, confirm, group, intro, isCancel, outro, select, spinner, text } from "@clack/prompts";
@@ -222,7 +222,7 @@ async function main(defaultName, config) {
222
222
  }
223
223
  if (options.search !== "orama") plugins.push(feature(search, { provider: options.search }));
224
224
  if (options.lint !== "disabled") plugins.push(feature(lint, { linter: options.lint }));
225
- if (options.template === "astro" || options.ogImage === "takumi" && options.template.startsWith("+next")) plugins.push(feature(og, { engine: "takumi" }));
225
+ if (options.ogImage === "takumi" && options.template.startsWith("+next")) plugins.push(feature(og, { engine: "takumi" }));
226
226
  if (options.aiChat) plugins.push(feature(ai, { provider: options.aiChat }));
227
227
  await create({
228
228
  packageManager: config.pm,
package/dist/bin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.js","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport {\n cancel,\n confirm,\n group,\n intro,\n isCancel,\n outro,\n select,\n spinner,\n text,\n} from '@clack/prompts';\nimport pc from 'picocolors';\nimport { getPackageManager, managers, type PackageManager } from './auto-install';\nimport { create, type Template, type TemplatePlugin } from './index';\nimport { isCI, templates } from './constants';\nimport { cac } from 'cac';\nimport { feature } from './plugins/feature';\nimport { ai, type AIProvider } from '@fumadocs/cli/features/ai';\nimport { lint } from '@fumadocs/cli/features/lint';\nimport { og } from '@fumadocs/cli/features/og';\nimport { search, type SearchProvider } from '@fumadocs/cli/features/search';\n\nconst linters = ['eslint', 'oxlint', 'biome'] as const;\nconst searchProviders = [\n 'orama',\n 'orama-cloud',\n 'algolia',\n 'meilisearch',\n 'typesense',\n 'mixedbread',\n] as const;\nconst ogImages = ['next-og', 'takumi'] as const;\nconst aiChats = ['openrouter', 'llmgateway', 'inkeep'] as const;\nconst templateNames = templates.map((item) => item.value);\n\ninterface CliOptions {\n src?: boolean;\n install?: boolean;\n git: boolean;\n yes?: boolean;\n linter?: (typeof linters)[number];\n search?: SearchProvider | 'orama';\n ogImage?: (typeof ogImages)[number];\n aiChat?: AIProvider;\n template?: Template;\n pm: PackageManager;\n}\n\nconst cli = cac('create-fumadocs-app');\n\ncli\n .command('[name]', 'create a Fumadocs app, [name] is the project name')\n .option('--src', '(Next.js only) enable `src/` directory')\n .option('--install', 'install packages automatically')\n .option('--no-git', 'disable auto Git repository initialization')\n .option('-y, --yes', 'skip prompts and use defaults for unspecified options')\n .option(\n '--linter <name>',\n `configure a linter/formatter, ESLint is currently Next.js only. (${linters.join(', ')})`,\n )\n .option('--search <name>', `configure a search solution (${searchProviders.join(', ')})`)\n .option('--og-image <name>', `configure OG image generation (${ogImages.join(', ')})`)\n .option('--ai-chat <name>', `configure AI chat (${aiChats.join(', ')})`)\n .option('--template <name>', `choose a template (${templateNames.join(', ')})`)\n .option('--pm <name>', `choose a package manager (${managers.join(', ')})`, {\n default: getPackageManager(),\n })\n .action(main);\n\n/** templates without a server at runtime */\nconst isStatic = (template: Template) =>\n template === 'astro' || template === '+next+fuma-docs-mdx+static' || template.endsWith('-spa');\n\nfunction checkOption(name: string, value: string | undefined, choices: readonly string[]) {\n if (value !== undefined && !choices.includes(value))\n throw new Error(`invalid value for --${name}: ${value}, expected: ${choices.join(', ')}`);\n}\n\nasync function main(defaultName: string | undefined, config: CliOptions): Promise<void> {\n checkOption('linter', config.linter, linters);\n checkOption('search', config.search, searchProviders);\n checkOption('og-image', config.ogImage, ogImages);\n checkOption('ai-chat', config.aiChat, aiChats);\n checkOption('template', config.template, templateNames);\n checkOption('pm', config.pm, managers);\n const skipPrompts = isCI || config.yes === true;\n intro(pc.bgCyan(pc.bold('Create Fumadocs App')));\n\n const options = await group(\n {\n name: async () => {\n if (defaultName) return defaultName;\n if (skipPrompts) return 'untitled';\n\n return text({\n message: 'Project name',\n placeholder: 'my-app',\n defaultValue: 'my-app',\n });\n },\n template: async () => {\n if (config.template) return config.template;\n if (skipPrompts) return '+next+fuma-docs-mdx';\n\n return select<Template>({\n message: 'Choose a template',\n initialValue: '+next+fuma-docs-mdx',\n options: templates,\n });\n },\n src: async ({ results }: { results: { template?: Template } }) => {\n if (config.src !== undefined) return config.src;\n if (skipPrompts || !results.template?.startsWith('+next')) return false;\n\n return confirm({\n message: 'Use `/src` directory?',\n initialValue: false,\n });\n },\n lint: async ({ results }: { results: { template?: Template } }) => {\n if (config.linter !== undefined) return config.linter;\n if (skipPrompts) return 'disabled';\n\n return select({\n message: 'Configure linter?',\n options: results.template?.startsWith('+next')\n ? [\n {\n value: 'disabled',\n label: 'Disabled',\n },\n {\n value: 'eslint',\n label: 'ESLint',\n },\n {\n value: 'biome',\n label: 'Biome',\n },\n {\n value: 'oxlint',\n label: 'Oxlint',\n },\n ]\n : [\n {\n value: 'disabled',\n label: 'Disabled',\n },\n {\n value: 'biome',\n label: 'Biome',\n },\n {\n value: 'oxlint',\n label: 'Oxlint',\n },\n ],\n });\n },\n search: async ({ results }: { results: { template?: Template } }) => {\n if (config.search !== undefined) return config.search;\n if (skipPrompts) return 'orama';\n\n return select({\n message: 'Choose a search solution?',\n options: [\n {\n value: 'orama',\n label: 'Default',\n hint: 'local search powered by ZBSearch, recommended',\n },\n {\n value: 'orama-cloud',\n label: 'Orama Cloud',\n hint: '3rd party search solution, signup needed',\n },\n { value: 'algolia', label: 'Algolia', hint: 'signup needed' },\n { value: 'meilisearch', label: 'Meilisearch', hint: 'self-hosted or cloud' },\n { value: 'typesense', label: 'Typesense', hint: 'self-hosted or cloud' },\n // searches on a server\n ...(isStatic(results.template!)\n ? []\n : [{ value: 'mixedbread', label: 'Mixedbread', hint: 'AI search, signup needed' }]),\n ],\n });\n },\n ogImage: async ({ results }: { results: { template?: Template } }) => {\n if (config.ogImage !== undefined) return config.ogImage;\n if (!results.template?.startsWith('+next')) return 'takumi';\n if (skipPrompts) return 'next/og';\n\n return select({\n message: 'Configure Open Graph Image generation?',\n options: [\n {\n value: 'next/og',\n label: 'next/og',\n hint: 'Next.js built-in solution',\n },\n {\n value: 'takumi',\n label: 'Takumi',\n hint: 'Output WebP format, framework-agnostic',\n },\n ],\n });\n },\n aiChat: async ({ results }: { results: { template?: Template } }) => {\n if (config.aiChat !== undefined) return config.aiChat;\n if (skipPrompts || isStatic(results.template!)) return false;\n\n return select<false | 'openrouter' | 'llmgateway' | 'inkeep'>({\n message: 'Configure AI Chat?',\n options: [\n {\n value: false,\n label: 'No',\n },\n {\n value: 'openrouter',\n label: 'AI SDK',\n hint: 'default to OpenRouter',\n },\n {\n value: 'llmgateway',\n label: 'LLMGateway',\n hint: 'open-source LLM gateway, API key required',\n },\n {\n value: 'inkeep',\n label: 'Inkeep AI',\n hint: 'API key required',\n },\n ],\n });\n },\n installDeps: async () => {\n if (config.install !== undefined) return config.install;\n if (skipPrompts) return false;\n\n return confirm({\n message: `Do you want to install packages automatically? (detected as ${config.pm})`,\n });\n },\n },\n {\n onCancel: () => {\n cancel('Installation Stopped.');\n process.exit(0);\n },\n },\n );\n\n const projectName = options.name.toLowerCase().replace(/\\s/, '-');\n if (options.aiChat && isStatic(options.template)) {\n console.warn(pc.yellow('AI Chat needs a server, the template is static, skipping it.'));\n options.aiChat = false;\n }\n if (options.ogImage === 'next-og' && !options.template.startsWith('+next')) {\n console.warn(\n pc.yellow('next/og is only available on Next.js, the template uses Takumi instead.'),\n );\n }\n\n if (!isCI) await checkDir(projectName, skipPrompts);\n\n const info = spinner();\n info.start(`Generating Project`);\n const plugins: TemplatePlugin[] = [];\n\n if (options.src) {\n const { nextUseSrc } = await import('./plugins/next-use-src');\n plugins.push(nextUseSrc());\n }\n\n if (options.search !== 'orama') plugins.push(feature(search, { provider: options.search }));\n if (options.lint !== 'disabled') plugins.push(feature(lint, { linter: options.lint }));\n // the other templates come with OG images, Astro always uses Takumi\n if (\n options.template === 'astro' ||\n (options.ogImage === 'takumi' && options.template.startsWith('+next'))\n )\n plugins.push(feature(og, { engine: 'takumi' }));\n if (options.aiChat) plugins.push(feature(ai, { provider: options.aiChat }));\n\n await create({\n packageManager: config.pm,\n template: options.template,\n outputDir: projectName,\n installDeps: options.installDeps,\n initializeGit: config.git,\n plugins,\n log: (message) => {\n info.message(message);\n },\n });\n\n info.stop('Project Generated');\n\n outro(pc.bgGreen(pc.bold('Done')));\n\n console.log(pc.bold('\\nOpen the project'));\n console.log(pc.cyan(`cd ${projectName}`));\n\n console.log(pc.bold('\\nRun Development Server'));\n if (config.pm === 'npm' || config.pm === 'bun') {\n console.log(pc.cyan(`${config.pm} run dev`));\n } else {\n console.log(pc.cyan(`${config.pm} dev`));\n }\n console.log(pc.bold('\\nYou can now open the project and start writing documents'));\n\n process.exit(0);\n}\n\nasync function checkDir(outputDir: string, skipPrompts: boolean) {\n const destDir = await fs.readdir(outputDir).catch(() => null);\n if (!destDir || destDir.length === 0) return;\n if (skipPrompts) {\n cancel(`directory ${outputDir} already exists and is not empty.`);\n process.exit(1);\n }\n const del = await confirm({\n message: `directory ${outputDir} already exists, do you want to delete its files?`,\n });\n\n if (isCancel(del)) {\n cancel();\n process.exit(1);\n }\n\n if (!del) return;\n\n const info = spinner();\n info.start(`Deleting files in ${outputDir}`);\n\n await Promise.all(\n destDir.map((item) => {\n return fs.rm(path.join(outputDir, item), {\n recursive: true,\n force: true,\n });\n }),\n );\n\n info.stop(`Deleted files in ${outputDir}`);\n}\n\ncli.help();\n\ntry {\n cli.parse(process.argv, { run: false });\n await cli.runMatchedCommand();\n} catch (e) {\n console.error(pc.red(e instanceof Error ? e.message : String(e)));\n process.exit(1);\n}\n"],"mappings":";;;;;;;;;;;;;;AAyBA,MAAM,UAAU;CAAC;CAAU;CAAU;AAAO;AAC5C,MAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,WAAW,CAAC,WAAW,QAAQ;AACrC,MAAM,UAAU;CAAC;CAAc;CAAc;AAAQ;AACrD,MAAM,gBAAgB,UAAU,KAAK,SAAS,KAAK,KAAK;AAexD,MAAM,MAAM,IAAI,qBAAqB;AAErC,IACG,QAAQ,UAAU,mDAAmD,CAAC,CACtE,OAAO,SAAS,wCAAwC,CAAC,CACzD,OAAO,aAAa,gCAAgC,CAAC,CACrD,OAAO,YAAY,4CAA4C,CAAC,CAChE,OAAO,aAAa,uDAAuD,CAAC,CAC5E,OACC,mBACA,oEAAoE,QAAQ,KAAK,IAAI,EAAE,EACzF,CAAC,CACA,OAAO,mBAAmB,gCAAgC,gBAAgB,KAAK,IAAI,EAAE,EAAE,CAAC,CACxF,OAAO,qBAAqB,kCAAkC,SAAS,KAAK,IAAI,EAAE,EAAE,CAAC,CACrF,OAAO,oBAAoB,sBAAsB,QAAQ,KAAK,IAAI,EAAE,EAAE,CAAC,CACvE,OAAO,qBAAqB,sBAAsB,cAAc,KAAK,IAAI,EAAE,EAAE,CAAC,CAC9E,OAAO,eAAe,6BAA6B,SAAS,KAAK,IAAI,EAAE,IAAI,EAC1E,SAAS,kBAAkB,EAC7B,CAAC,CAAC,CACD,OAAO,IAAI;;A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M,OAAO,QAAQ;CACrB,KAAK,MAAM,qBAAqB,WAAW;CAE3C,MAAM,QAAQ,IACZ,QAAQ,KAAK,SAAS;EACpB,OAAO,GAAG,GAAG,KAAK,KAAK,WAAW,IAAI,GAAG;GACvC,WAAW;GACX,OAAO;EACT,CAAC;CACH,CAAC,CACH;CAEA,KAAK,KAAK,oBAAoB,WAAW;AAC3C;AAEA,IAAI,KAAK;AAET,IAAI;CACF,IAAI,MAAM,QAAQ,MAAM,EAAE,KAAK,MAAM,CAAC;CACtC,MAAM,IAAI,kBAAkB;AAC9B,SAAS,GAAG;CACV,QAAQ,MAAM,GAAG,IAAI,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC,CAAC;CAChE,QAAQ,KAAK,CAAC;AAChB"}
1
+ {"version":3,"file":"bin.js","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport {\n cancel,\n confirm,\n group,\n intro,\n isCancel,\n outro,\n select,\n spinner,\n text,\n} from '@clack/prompts';\nimport pc from 'picocolors';\nimport { getPackageManager, managers, type PackageManager } from './auto-install';\nimport { create, type Template, type TemplatePlugin } from './index';\nimport { isCI, templates } from './constants';\nimport { cac } from 'cac';\nimport { feature } from './plugins/feature';\nimport { ai, type AIProvider } from '@fumadocs/cli/features/ai';\nimport { lint } from '@fumadocs/cli/features/lint';\nimport { og } from '@fumadocs/cli/features/og';\nimport { search, type SearchProvider } from '@fumadocs/cli/features/search';\n\nconst linters = ['eslint', 'oxlint', 'biome'] as const;\nconst searchProviders = [\n 'orama',\n 'orama-cloud',\n 'algolia',\n 'meilisearch',\n 'typesense',\n 'mixedbread',\n] as const;\nconst ogImages = ['next-og', 'takumi'] as const;\nconst aiChats = ['openrouter', 'llmgateway', 'inkeep'] as const;\nconst templateNames = templates.map((item) => item.value);\n\ninterface CliOptions {\n src?: boolean;\n install?: boolean;\n git: boolean;\n yes?: boolean;\n linter?: (typeof linters)[number];\n search?: SearchProvider | 'orama';\n ogImage?: (typeof ogImages)[number];\n aiChat?: AIProvider;\n template?: Template;\n pm: PackageManager;\n}\n\nconst cli = cac('create-fumadocs-app');\n\ncli\n .command('[name]', 'create a Fumadocs app, [name] is the project name')\n .option('--src', '(Next.js only) enable `src/` directory')\n .option('--install', 'install packages automatically')\n .option('--no-git', 'disable auto Git repository initialization')\n .option('-y, --yes', 'skip prompts and use defaults for unspecified options')\n .option(\n '--linter <name>',\n `configure a linter/formatter, ESLint is currently Next.js only. (${linters.join(', ')})`,\n )\n .option('--search <name>', `configure a search solution (${searchProviders.join(', ')})`)\n .option('--og-image <name>', `configure OG image generation (${ogImages.join(', ')})`)\n .option('--ai-chat <name>', `configure AI chat (${aiChats.join(', ')})`)\n .option('--template <name>', `choose a template (${templateNames.join(', ')})`)\n .option('--pm <name>', `choose a package manager (${managers.join(', ')})`, {\n default: getPackageManager(),\n })\n .action(main);\n\n/** templates without a server at runtime */\nconst isStatic = (template: Template) =>\n template === 'astro' || template === '+next+fuma-docs-mdx+static' || template.endsWith('-spa');\n\nfunction checkOption(name: string, value: string | undefined, choices: readonly string[]) {\n if (value !== undefined && !choices.includes(value))\n throw new Error(`invalid value for --${name}: ${value}, expected: ${choices.join(', ')}`);\n}\n\nasync function main(defaultName: string | undefined, config: CliOptions): Promise<void> {\n checkOption('linter', config.linter, linters);\n checkOption('search', config.search, searchProviders);\n checkOption('og-image', config.ogImage, ogImages);\n checkOption('ai-chat', config.aiChat, aiChats);\n checkOption('template', config.template, templateNames);\n checkOption('pm', config.pm, managers);\n const skipPrompts = isCI || config.yes === true;\n intro(pc.bgCyan(pc.bold('Create Fumadocs App')));\n\n const options = await group(\n {\n name: async () => {\n if (defaultName) return defaultName;\n if (skipPrompts) return 'untitled';\n\n return text({\n message: 'Project name',\n placeholder: 'my-app',\n defaultValue: 'my-app',\n });\n },\n template: async () => {\n if (config.template) return config.template;\n if (skipPrompts) return '+next+fuma-docs-mdx';\n\n return select<Template>({\n message: 'Choose a template',\n initialValue: '+next+fuma-docs-mdx',\n options: templates,\n });\n },\n src: async ({ results }: { results: { template?: Template } }) => {\n if (config.src !== undefined) return config.src;\n if (skipPrompts || !results.template?.startsWith('+next')) return false;\n\n return confirm({\n message: 'Use `/src` directory?',\n initialValue: false,\n });\n },\n lint: async ({ results }: { results: { template?: Template } }) => {\n if (config.linter !== undefined) return config.linter;\n if (skipPrompts) return 'disabled';\n\n return select({\n message: 'Configure linter?',\n options: results.template?.startsWith('+next')\n ? [\n {\n value: 'disabled',\n label: 'Disabled',\n },\n {\n value: 'eslint',\n label: 'ESLint',\n },\n {\n value: 'biome',\n label: 'Biome',\n },\n {\n value: 'oxlint',\n label: 'Oxlint',\n },\n ]\n : [\n {\n value: 'disabled',\n label: 'Disabled',\n },\n {\n value: 'biome',\n label: 'Biome',\n },\n {\n value: 'oxlint',\n label: 'Oxlint',\n },\n ],\n });\n },\n search: async ({ results }: { results: { template?: Template } }) => {\n if (config.search !== undefined) return config.search;\n if (skipPrompts) return 'orama';\n\n return select({\n message: 'Choose a search solution?',\n options: [\n {\n value: 'orama',\n label: 'Default',\n hint: 'local search powered by ZBSearch, recommended',\n },\n {\n value: 'orama-cloud',\n label: 'Orama Cloud',\n hint: '3rd party search solution, signup needed',\n },\n { value: 'algolia', label: 'Algolia', hint: 'signup needed' },\n { value: 'meilisearch', label: 'Meilisearch', hint: 'self-hosted or cloud' },\n { value: 'typesense', label: 'Typesense', hint: 'self-hosted or cloud' },\n // searches on a server\n ...(isStatic(results.template!)\n ? []\n : [{ value: 'mixedbread', label: 'Mixedbread', hint: 'AI search, signup needed' }]),\n ],\n });\n },\n ogImage: async ({ results }: { results: { template?: Template } }) => {\n if (config.ogImage !== undefined) return config.ogImage;\n if (!results.template?.startsWith('+next')) return 'takumi';\n if (skipPrompts) return 'next/og';\n\n return select({\n message: 'Configure Open Graph Image generation?',\n options: [\n {\n value: 'next/og',\n label: 'next/og',\n hint: 'Next.js built-in solution',\n },\n {\n value: 'takumi',\n label: 'Takumi',\n hint: 'Output WebP format, framework-agnostic',\n },\n ],\n });\n },\n aiChat: async ({ results }: { results: { template?: Template } }) => {\n if (config.aiChat !== undefined) return config.aiChat;\n if (skipPrompts || isStatic(results.template!)) return false;\n\n return select<false | 'openrouter' | 'llmgateway' | 'inkeep'>({\n message: 'Configure AI Chat?',\n options: [\n {\n value: false,\n label: 'No',\n },\n {\n value: 'openrouter',\n label: 'AI SDK',\n hint: 'default to OpenRouter',\n },\n {\n value: 'llmgateway',\n label: 'LLMGateway',\n hint: 'open-source LLM gateway, API key required',\n },\n {\n value: 'inkeep',\n label: 'Inkeep AI',\n hint: 'API key required',\n },\n ],\n });\n },\n installDeps: async () => {\n if (config.install !== undefined) return config.install;\n if (skipPrompts) return false;\n\n return confirm({\n message: `Do you want to install packages automatically? (detected as ${config.pm})`,\n });\n },\n },\n {\n onCancel: () => {\n cancel('Installation Stopped.');\n process.exit(0);\n },\n },\n );\n\n const projectName = options.name.toLowerCase().replace(/\\s/, '-');\n if (options.aiChat && isStatic(options.template)) {\n console.warn(pc.yellow('AI Chat needs a server, the template is static, skipping it.'));\n options.aiChat = false;\n }\n if (options.ogImage === 'next-og' && !options.template.startsWith('+next')) {\n console.warn(\n pc.yellow('next/og is only available on Next.js, the template uses Takumi instead.'),\n );\n }\n\n if (!isCI) await checkDir(projectName, skipPrompts);\n\n const info = spinner();\n info.start(`Generating Project`);\n const plugins: TemplatePlugin[] = [];\n\n if (options.src) {\n const { nextUseSrc } = await import('./plugins/next-use-src');\n plugins.push(nextUseSrc());\n }\n\n if (options.search !== 'orama') plugins.push(feature(search, { provider: options.search }));\n if (options.lint !== 'disabled') plugins.push(feature(lint, { linter: options.lint }));\n if (options.ogImage === 'takumi' && options.template.startsWith('+next'))\n plugins.push(feature(og, { engine: 'takumi' }));\n if (options.aiChat) plugins.push(feature(ai, { provider: options.aiChat }));\n\n await create({\n packageManager: config.pm,\n template: options.template,\n outputDir: projectName,\n installDeps: options.installDeps,\n initializeGit: config.git,\n plugins,\n log: (message) => {\n info.message(message);\n },\n });\n\n info.stop('Project Generated');\n\n outro(pc.bgGreen(pc.bold('Done')));\n\n console.log(pc.bold('\\nOpen the project'));\n console.log(pc.cyan(`cd ${projectName}`));\n\n console.log(pc.bold('\\nRun Development Server'));\n if (config.pm === 'npm' || config.pm === 'bun') {\n console.log(pc.cyan(`${config.pm} run dev`));\n } else {\n console.log(pc.cyan(`${config.pm} dev`));\n }\n console.log(pc.bold('\\nYou can now open the project and start writing documents'));\n\n process.exit(0);\n}\n\nasync function checkDir(outputDir: string, skipPrompts: boolean) {\n const destDir = await fs.readdir(outputDir).catch(() => null);\n if (!destDir || destDir.length === 0) return;\n if (skipPrompts) {\n cancel(`directory ${outputDir} already exists and is not empty.`);\n process.exit(1);\n }\n const del = await confirm({\n message: `directory ${outputDir} already exists, do you want to delete its files?`,\n });\n\n if (isCancel(del)) {\n cancel();\n process.exit(1);\n }\n\n if (!del) return;\n\n const info = spinner();\n info.start(`Deleting files in ${outputDir}`);\n\n await Promise.all(\n destDir.map((item) => {\n return fs.rm(path.join(outputDir, item), {\n recursive: true,\n force: true,\n });\n }),\n );\n\n info.stop(`Deleted files in ${outputDir}`);\n}\n\ncli.help();\n\ntry {\n cli.parse(process.argv, { run: false });\n await cli.runMatchedCommand();\n} catch (e) {\n console.error(pc.red(e instanceof Error ? e.message : String(e)));\n process.exit(1);\n}\n"],"mappings":";;;;;;;;;;;;;;AAyBA,MAAM,UAAU;CAAC;CAAU;CAAU;AAAO;AAC5C,MAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,WAAW,CAAC,WAAW,QAAQ;AACrC,MAAM,UAAU;CAAC;CAAc;CAAc;AAAQ;AACrD,MAAM,gBAAgB,UAAU,KAAK,SAAS,KAAK,KAAK;AAexD,MAAM,MAAM,IAAI,qBAAqB;AAErC,IACG,QAAQ,UAAU,mDAAmD,CAAC,CACtE,OAAO,SAAS,wCAAwC,CAAC,CACz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AAG,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC;CAEzC,QAAQ,IAAI,GAAG,KAAK,4DAA4D,CAAC;CAEjF,QAAQ,KAAK,CAAC;AAChB;AAEA,eAAe,SAAS,WAAmB,aAAsB;CAC/D,MAAM,UAAU,MAAM,GAAG,QAAQ,SAAS,CAAC,CAAC,YAAY,IAAI;CAC5D,IAAI,CAAC,WAAW,QAAQ,WAAW,GAAG;CACtC,IAAI,aAAa;EACf,OAAO,aAAa,UAAU,kCAAkC;EAChE,QAAQ,KAAK,CAAC;CAChB;CACA,MAAM,MAAM,MAAM,QAAQ,EACxB,SAAS,aAAa,UAAU,mDAClC,CAAC;CAED,IAAI,SAAS,GAAG,GAAG;EACjB,OAAO;EACP,QAAQ,KAAK,CAAC;CAChB;CAEA,IAAI,CAAC,KAAK;CAEV,MAAM,OAAO,QAAQ;CACrB,KAAK,MAAM,qBAAqB,WAAW;CAE3C,MAAM,QAAQ,IACZ,QAAQ,KAAK,SAAS;EACpB,OAAO,GAAG,GAAG,KAAK,KAAK,WAAW,IAAI,GAAG;GACvC,WAAW;GACX,OAAO;EACT,CAAC;CACH,CAAC,CACH;CAEA,KAAK,KAAK,oBAAoB,WAAW;AAC3C;AAEA,IAAI,KAAK;AAET,IAAI;CACF,IAAI,MAAM,QAAQ,MAAM,EAAE,KAAK,MAAM,CAAC;CACtC,MAAM,IAAI,kBAAkB;AAC9B,SAAS,GAAG;CACV,QAAQ,MAAM,GAAG,IAAI,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC,CAAC;CAChE,QAAQ,KAAK,CAAC;AAChB"}
@@ -51,7 +51,7 @@ var package_exports$3 = /* @__PURE__ */ __exportAll({
51
51
  version: () => version$3
52
52
  });
53
53
  var name$3 = "fumadocs-core";
54
- var version$3 = "16.17.10";
54
+ var version$3 = "16.18.0";
55
55
  var description$3 = "The React.js library for building a documentation website";
56
56
  var keywords$3 = ["Docs", "Fumadocs"];
57
57
  var homepage$3 = "https://fumadocs.dev";
@@ -74,6 +74,7 @@ var exports$3 = {
74
74
  "./framework": "./dist/framework/index.js",
75
75
  "./framework/astro": "./dist/framework/astro.js",
76
76
  "./framework/next": "./dist/framework/next.js",
77
+ "./framework/plugin": "./dist/framework/plugin.js",
77
78
  "./framework/react-router": "./dist/framework/react-router.js",
78
79
  "./framework/tanstack": "./dist/framework/tanstack.js",
79
80
  "./framework/waku": "./dist/framework/waku.js",
@@ -313,7 +314,7 @@ var package_exports$2 = /* @__PURE__ */ __exportAll({
313
314
  version: () => version$2
314
315
  });
315
316
  var name$2 = "fumadocs-mdx";
316
- var version$2 = "15.4.10";
317
+ var version$2 = "15.5.0";
317
318
  var description$2 = "The built-in source for Fumadocs";
318
319
  var keywords$2 = ["Docs", "fumadocs"];
319
320
  var homepage$2 = "https://fumadocs.dev";
@@ -338,6 +339,7 @@ var exports$2 = {
338
339
  "./plugins/index-file": "./dist/plugins/index-file.js",
339
340
  "./plugins/json-schema": "./dist/plugins/json-schema.js",
340
341
  "./plugins/last-modified": "./dist/plugins/last-modified.js",
342
+ "./press": "./dist/press.js",
341
343
  "./rolldown": "./dist/rolldown/index.js",
342
344
  "./runtime/browser": "./dist/runtime/browser.js",
343
345
  "./runtime/dynamic": "./dist/runtime/dynamic.js",
@@ -387,6 +389,7 @@ var devDependencies$2 = {
387
389
  "@types/node": "^26.6.5",
388
390
  "@types/picomatch": "^4.0.3",
389
391
  "@types/react": "^19.3.0",
392
+ "@vitejs/plugin-rsc": "^0.5.38",
390
393
  "fumadocs-core": "workspace:*",
391
394
  "mdast-util-directive": "^3.1.1",
392
395
  "next": "^16.4.2",
@@ -406,7 +409,8 @@ var peerDependencies$2 = {
406
409
  "@types/mdast": "*",
407
410
  "@types/mdx": "*",
408
411
  "@types/react": "*",
409
- "fumadocs-core": "^16.17.8",
412
+ "@vitejs/plugin-rsc": "^0.5.34",
413
+ "fumadocs-core": "^16.17.11",
410
414
  "mdast-util-directive": "*",
411
415
  "next": "^15.3.0 || ^16.0.0",
412
416
  "react": "^19.2.0",
@@ -416,6 +420,7 @@ var peerDependencies$2 = {
416
420
  };
417
421
  var peerDependenciesMeta$2 = {
418
422
  "@fumadocs/satteri": { "optional": true },
423
+ "@vitejs/plugin-rsc": { "optional": true },
419
424
  "satteri": { "optional": true },
420
425
  "rolldown": { "optional": true },
421
426
  "mdast-util-directive": { "optional": true },
@@ -472,7 +477,7 @@ var package_exports$1 = /* @__PURE__ */ __exportAll({
472
477
  version: () => version$1
473
478
  });
474
479
  var name$1 = "@fumadocs/base-ui";
475
- var version$1 = "16.17.10";
480
+ var version$1 = "16.18.0";
476
481
  var description$1 = "The Base UI version of Fumadocs UI";
477
482
  var keywords$1 = ["Docs", "Fumadocs"];
478
483
  var homepage$1 = "https://fumadocs.dev";
@@ -691,7 +696,7 @@ var package_exports = /* @__PURE__ */ __exportAll({
691
696
  version: () => version
692
697
  });
693
698
  var name = "@fumadocs/astro";
694
- var version = "0.1.2";
699
+ var version = "0.2.0";
695
700
  var description = "The Astro integration for Fumadocs";
696
701
  var keywords = [
697
702
  "Astro",
@@ -709,24 +714,9 @@ var type = "module";
709
714
  var sideEffects = false;
710
715
  var exports = {
711
716
  ".": "./dist/index.js",
712
- "./config": "./dist/config.js",
713
717
  "./loaders": "./dist/loaders.js",
714
- "./plugins/asyncapi": "./dist/plugins/asyncapi.js",
715
- "./plugins/content-source": "./dist/plugins/content-source.js",
716
- "./plugins/flexsearch": "./dist/plugins/flexsearch.js",
717
- "./plugins/git": "./dist/plugins/git.js",
718
- "./plugins/graphql": "./dist/plugins/graphql.js",
719
- "./plugins/link-validation": "./dist/plugins/link-validation.js",
720
- "./plugins/llms.txt": "./dist/plugins/llms.txt.js",
721
- "./plugins/mcp": "./dist/plugins/mcp.js",
722
- "./plugins/notion": "./dist/plugins/notion.js",
723
- "./plugins/openapi": "./dist/plugins/openapi.js",
724
- "./plugins/orama-search": "./dist/plugins/orama-search.js",
725
- "./plugins/sanity": "./dist/plugins/sanity.js",
726
- "./plugins/takumi": "./dist/plugins/takumi.js",
727
718
  "./source": "./dist/source.js",
728
- "./package.json": "./package.json",
729
- "./components/*": "./dist/components/*"
719
+ "./package.json": "./package.json"
730
720
  };
731
721
  var publishConfig = { "access": "public" };
732
722
  var scripts = {
@@ -747,12 +737,6 @@ var dependencies = {
747
737
  var devDependencies = {
748
738
  "@astrojs/markdown-satteri": "^0.4.5",
749
739
  "@astrojs/react": "^7.1.1",
750
- "@fumadocs/asyncapi": "workspace:*",
751
- "@fumadocs/graphql": "workspace:*",
752
- "@fumadocs/notion": "workspace:*",
753
- "@fumadocs/sanity": "workspace:*",
754
- "@modelcontextprotocol/server": "2.3.1",
755
- "@portabletext/react": "^8.0.1",
756
740
  "@types/estree-jsx": "^1.0.5",
757
741
  "@types/hast": "^3.0.5",
758
742
  "@types/mdx": "^2.0.14",
@@ -761,9 +745,7 @@ var devDependencies = {
761
745
  "@types/react-dom": "^19.3.0",
762
746
  "astro": "^7.4.2",
763
747
  "fumadocs-core": "workspace:*",
764
- "fumadocs-openapi": "workspace:*",
765
748
  "fumadocs-ui": "workspace:@fumadocs/base-ui@*",
766
- "next-validate-link": "^1.6.7",
767
749
  "react": "^19.3.1",
768
750
  "react-dom": "^19.3.1",
769
751
  "tsconfig": "workspace:*",
@@ -774,33 +756,13 @@ var devDependencies = {
774
756
  };
775
757
  var peerDependencies = {
776
758
  "@astrojs/react": "^7.0.0",
777
- "@fumadocs/asyncapi": "^0.5.4",
778
- "@fumadocs/graphql": "^0.4.2",
779
- "@fumadocs/notion": "^0.2.3",
780
- "@fumadocs/sanity": "^0.2.3",
781
- "@modelcontextprotocol/server": "2.x.x",
782
- "@portabletext/react": "^8.0.0",
783
759
  "@types/mdx": "*",
784
760
  "astro": "^7.4.0",
785
761
  "fumadocs-core": "^16.17.8",
786
- "fumadocs-openapi": "^12.5.7",
787
- "fumadocs-ui": "^16.17.8",
788
- "next-validate-link": "^1.6.7",
789
762
  "react": "^19.2.0",
790
763
  "react-dom": "^19.2.0"
791
764
  };
792
- var peerDependenciesMeta = {
793
- "@fumadocs/asyncapi": { "optional": true },
794
- "@fumadocs/graphql": { "optional": true },
795
- "@fumadocs/notion": { "optional": true },
796
- "@fumadocs/sanity": { "optional": true },
797
- "@modelcontextprotocol/server": { "optional": true },
798
- "@portabletext/react": { "optional": true },
799
- "@types/mdx": { "optional": true },
800
- "fumadocs-openapi": { "optional": true },
801
- "fumadocs-ui": { "optional": true },
802
- "next-validate-link": { "optional": true }
803
- };
765
+ var peerDependenciesMeta = { "@types/mdx": { "optional": true } };
804
766
  var package_default = {
805
767
  name,
806
768
  version,
@@ -874,7 +836,8 @@ const templates = [
874
836
  {
875
837
  value: "astro",
876
838
  label: "Astro: Content Collections",
877
- appDir: "src"
839
+ appDir: "src",
840
+ rootProviderPath: "components/provider.tsx"
878
841
  }
879
842
  ];
880
843
  const workspaces = [
@@ -888,4 +851,4 @@ for (const workspace of workspaces) depVersions[workspace.name] = workspace.vers
888
851
  depVersions["fumadocs-ui"] = `npm:${name$1}@${version$1}`;
889
852
  export { templates as i, isCI as n, sourceDir as r, depVersions as t };
890
853
 
891
- //# sourceMappingURL=constants-CprVC8qU.js.map
854
+ //# sourceMappingURL=constants-BGeuHcdV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-BGeuHcdV.js","names":["corePkg","mdxPkg","basePkg","astroPkg","versionPkg.dependencies","basePkg.name","basePkg.version"],"sources":["../../create-app-versions/package.json","../../core/package.json","../../mdx/package.json","../../base-ui/package.json","../../astro/package.json","../src/constants.ts"],"sourcesContent":["","","","","","import { fileURLToPath } from 'node:url';\nimport versionPkg from '../../create-app-versions/package.json';\nimport * as corePkg from '../../core/package.json';\nimport * as mdxPkg from '../../mdx/package.json';\nimport * as basePkg from '../../base-ui/package.json';\nimport * as astroPkg from '../../astro/package.json';\n\nexport const sourceDir = fileURLToPath(new URL(`../`, import.meta.url).href);\n\nexport const isCI = Boolean(process.env.CI);\n\nexport interface TemplateInfo {\n value:\n | '+next+fuma-docs-mdx'\n | 'astro'\n | 'waku'\n | 'react-router'\n | 'react-router-spa'\n | 'tanstack-start'\n | 'tanstack-start-spa'\n | '+next+fuma-docs-mdx+static';\n label: string;\n appDir: string;\n /**\n * path to root provider, relative to `appDir`\n */\n rootProviderPath: string;\n hint?: string;\n /**\n * rename files when copying from template\n */\n rename?: (name: string) => string;\n}\n\nexport const templates: TemplateInfo[] = [\n {\n value: '+next+fuma-docs-mdx',\n label: 'Next.js: Fumadocs MDX',\n hint: 'recommended: powerful and mature',\n appDir: '',\n rootProviderPath: 'app/layout.tsx',\n },\n {\n value: 'waku',\n label: 'Waku: Fumadocs MDX',\n hint: 'recommended: fast and simple',\n appDir: 'src',\n rootProviderPath: 'components/provider.tsx',\n },\n {\n value: '+next+fuma-docs-mdx+static',\n label: 'Next.js Static: Fumadocs MDX',\n appDir: '',\n rootProviderPath: 'components/provider.tsx',\n },\n {\n value: 'react-router',\n label: 'React Router: Fumadocs MDX (not RSC)',\n appDir: 'app',\n rootProviderPath: 'root.tsx',\n },\n {\n value: 'react-router-spa',\n label: 'React Router SPA: Fumadocs MDX (not RSC)',\n hint: 'SPA mode allows you to host the site statically, compatible with a CDN.',\n appDir: 'app',\n rootProviderPath: 'root.tsx',\n },\n {\n value: 'tanstack-start',\n label: 'Tanstack Start: Fumadocs MDX (not RSC)',\n appDir: 'src',\n rootProviderPath: 'routes/__root.tsx',\n },\n {\n value: 'tanstack-start-spa',\n label: 'Tanstack Start SPA: Fumadocs MDX (not RSC)',\n hint: 'SPA mode allows you to host the site statically, compatible with a CDN.',\n appDir: 'src',\n rootProviderPath: 'routes/__root.tsx',\n },\n {\n value: 'astro',\n label: 'Astro: Content Collections',\n appDir: 'src',\n rootProviderPath: 'components/provider.tsx',\n },\n];\n\nconst workspaces = [corePkg, mdxPkg, basePkg, astroPkg];\n\nexport const depVersions = versionPkg.dependencies;\n\nfor (const workspace of workspaces) {\n depVersions[workspace.name as keyof typeof depVersions] = workspace.version;\n}\n\ndepVersions['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;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;CACpB;CACA;EACE,OAAO;EACP,OAAO;EACP,QAAQ;EACR,kBAAkB;CACpB;CACA;EACE,OAAO;EACP,OAAO;EACP,QAAQ;EACR,kBAAkB;CACpB;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;CACpB;CACA;EACE,OAAO;EACP,OAAO;EACP,QAAQ;EACR,kBAAkB;CACpB;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;CACpB;CACA;EACE,OAAO;EACP,OAAO;EACP,QAAQ;EACR,kBAAkB;CACpB;AACF;AAEA,MAAM,aAAa;CAACA;CAASC;CAAQC;CAASC;AAAQ;AAEtD,MAAa,cAAcC;AAE3B,KAAK,MAAM,aAAa,YACtB,YAAY,UAAU,QAAoC,UAAU;AAGtE,YAAY,iBAAiB,OAAOC,OAAa,GAAGC"}
@@ -1,4 +1,4 @@
1
- import { t as depVersions } from "./constants-CprVC8qU.js";
1
+ import { t as depVersions } from "./constants-BGeuHcdV.js";
2
2
  import { HttpRegistryConnector } from "fuma-cli/registry/connector";
3
3
  import { getDefaultConfig } from "@fumadocs/cli/config";
4
4
  import { runFeature } from "@fumadocs/cli/features";
@@ -23,4 +23,4 @@ function feature(feature, options) {
23
23
  }
24
24
  export { feature as t };
25
25
 
26
- //# sourceMappingURL=feature-DJaEJkld.js.map
26
+ //# sourceMappingURL=feature-DB9zShId.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature-DJaEJkld.js","names":[],"sources":["../src/plugins/feature.ts"],"sourcesContent":["import type { TemplatePlugin } from '@/index';\nimport { HttpRegistryConnector } from 'fuma-cli/registry/connector';\nimport { getDefaultConfig } from '@fumadocs/cli/config';\nimport { type Feature, runFeature } from '@fumadocs/cli/features';\nimport { loadProject } from '@fumadocs/cli/project';\nimport { depVersions } from '@/constants';\n\n/** apply a Fumadocs CLI feature to the generated project */\nexport function feature<O extends object>(feature: Feature<O>, options: O): TemplatePlugin {\n return {\n async afterWrite() {\n const config = await getDefaultConfig(this.dest);\n const project = await loadProject(config, this.dest);\n\n await runFeature(feature, options, {\n project,\n connector: new HttpRegistryConnector('https://fumadocs.dev/registry'),\n versions: depVersions,\n io: { log: this.log, installDependencies: false, confirmOverwrite: async () => true },\n });\n },\n };\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,QAA0B,SAAqB,SAA4B;CACzF,OAAO,EACL,MAAM,aAAa;EACjB,MAAM,SAAS,MAAM,iBAAiB,KAAK,IAAI;EAC/C,MAAM,UAAU,MAAM,YAAY,QAAQ,KAAK,IAAI;EAEnD,MAAM,WAAW,SAAS,SAAS;GACjC;GACA,WAAW,IAAI,sBAAsB,+BAA+B;GACpE,UAAU;GACV,IAAI;IAAE,KAAK,KAAK;IAAK,qBAAqB;IAAO,kBAAkB,YAAY;GAAK;EACtF,CAAC;CACH,EACF;AACF"}
1
+ {"version":3,"file":"feature-DB9zShId.js","names":[],"sources":["../src/plugins/feature.ts"],"sourcesContent":["import type { TemplatePlugin } from '@/index';\nimport { HttpRegistryConnector } from 'fuma-cli/registry/connector';\nimport { getDefaultConfig } from '@fumadocs/cli/config';\nimport { type Feature, runFeature } from '@fumadocs/cli/features';\nimport { loadProject } from '@fumadocs/cli/project';\nimport { depVersions } from '@/constants';\n\n/** apply a Fumadocs CLI feature to the generated project */\nexport function feature<O extends object>(feature: Feature<O>, options: O): TemplatePlugin {\n return {\n async afterWrite() {\n const config = await getDefaultConfig(this.dest);\n const project = await loadProject(config, this.dest);\n\n await runFeature(feature, options, {\n project,\n connector: new HttpRegistryConnector('https://fumadocs.dev/registry'),\n versions: depVersions,\n io: { log: this.log, installDependencies: false, confirmOverwrite: async () => true },\n });\n },\n };\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,QAA0B,SAAqB,SAA4B;CACzF,OAAO,EACL,MAAM,aAAa;EACjB,MAAM,SAAS,MAAM,iBAAiB,KAAK,IAAI;EAC/C,MAAM,UAAU,MAAM,YAAY,QAAQ,KAAK,IAAI;EAEnD,MAAM,WAAW,SAAS,SAAS;GACjC;GACA,WAAW,IAAI,sBAAsB,+BAA+B;GACpE,UAAU;GACV,IAAI;IAAE,KAAK,KAAK;IAAK,qBAAqB;IAAO,kBAAkB,YAAY;GAAK;EACtF,CAAC;CACH,EACF;AACF"}
@@ -5,9 +5,9 @@ interface TemplateInfo {
5
5
  label: string;
6
6
  appDir: string;
7
7
  /**
8
- * path to root provider, relative to `appDir`, none when the framework integration renders it
8
+ * path to root provider, relative to `appDir`
9
9
  */
10
- rootProviderPath?: string;
10
+ rootProviderPath: string;
11
11
  hint?: string;
12
12
  /**
13
13
  * rename files when copying from template
@@ -58,4 +58,4 @@ interface TemplatePlugin {
58
58
  }
59
59
  declare function create(createOptions: Options): Promise<void>;
60
60
  export { TemplatePluginContext as a, TemplatePlugin as i, PackageJsonType as n, create as o, Template as r, Options as t };
61
- //# sourceMappingURL=index-oGVLdt_F.d.ts.map
61
+ //# sourceMappingURL=index-DHK1sZ4O.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-oGVLdt_F.d.ts","names":[],"sources":["../src/auto-install.ts","../src/constants.ts","../src/index.ts"],"mappings":"A,KAEY,yBAAyB;cAExB;UCOI;EACf;EASA;EACA;;;;EAIA;EACA;;;;EAIA,UAAU;;KCxBA,WAAW;UACN;EACf;EACA,UAAU;;;;;;EAOV,iBAAiB;EAEjB;EACA;EACA,OAAO;EACP,UAAU;;UAGK;EACf,UAAU;EACV,MAAM;;;;EAIN;;;;EAKA;;KAGU;EACV;EACA;EACA;EACA,UAAU;EACV,eAAe;EACf,kBAAkB;IAChB;KAEC,UAAU,KAAK,IAAI,QAAQ;UAEf;EACf,YACE,MAAM,KAAK,gCACX,MAAM,iBACH,iBAAiB;EACtB,eACE,MAAM,uBACN,aAAa,oBACV,iBAAiB;EACtB,cAAc,MAAM,0BAA0B;EAC9C,UAAU,MAAM,uBAAuB,oBAAoB;;iBAGvC,OAAO,eAAe,UAAU"}
1
+ {"version":3,"file":"index-DHK1sZ4O.d.ts","names":[],"sources":["../src/auto-install.ts","../src/constants.ts","../src/index.ts"],"mappings":"A,KAEY,yBAAyB;cAExB;UCOI;EACf;EASA;EACA;;;;EAIA;EACA;;;;EAIA,UAAU;;KCxBA,WAAW;UACN;EACf;EACA,UAAU;;;;;;EAOV,iBAAiB;EAEjB;EACA;EACA,OAAO;EACP,UAAU;;UAGK;EACf,UAAU;EACV,MAAM;;;;EAIN;;;;EAKA;;KAGU;EACV;EACA;EACA;EACA,UAAU;EACV,eAAe;EACf,kBAAkB;IAChB;KAEC,UAAU,KAAK,IAAI,QAAQ;UAEf;EACf,YACE,MAAM,KAAK,gCACX,MAAM,iBACH,iBAAiB;EACtB,eACE,MAAM,uBACN,aAAa,oBACV,iBAAiB;EACtB,cAAc,MAAM,0BAA0B;EAC9C,UAAU,MAAM,uBAAuB,oBAAoB;;iBAGvC,OAAO,eAAe,UAAU"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as TemplatePluginContext, i as TemplatePlugin, n as PackageJsonType, o as create, r as Template, t as Options } from "./index-oGVLdt_F.js";
1
+ import { a as TemplatePluginContext, i as TemplatePlugin, n as PackageJsonType, o as create, r as Template, t as Options } from "./index-DHK1sZ4O.js";
2
2
  export { Options, PackageJsonType, Template, TemplatePlugin, TemplatePluginContext, create };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { t as create } from "./src-DW8s8ZAf.js";
1
+ export { t as create } from "./src-G2bUVbwQ.js";
@@ -1,4 +1,4 @@
1
- import { i as TemplatePlugin } from "../index-oGVLdt_F.js";
1
+ import { i as TemplatePlugin } from "../index-DHK1sZ4O.js";
2
2
  import { Feature } from "@fumadocs/cli/features";
3
3
  /** apply a Fumadocs CLI feature to the generated project */
4
4
  export declare function feature<O extends object>(feature: Feature<O>, options: O): TemplatePlugin;
@@ -1 +1 @@
1
- export { t as feature } from "../feature-DJaEJkld.js";
1
+ export { t as feature } from "../feature-DB9zShId.js";
@@ -1,4 +1,4 @@
1
- import { i as TemplatePlugin } from "../index-oGVLdt_F.js";
1
+ import { i as TemplatePlugin } from "../index-DHK1sZ4O.js";
2
2
  /**
3
3
  * Use `src` for app directory
4
4
  */
@@ -1,4 +1,4 @@
1
- import { i as templates, r as sourceDir, t as depVersions } from "./constants-CprVC8qU.js";
1
+ import { i as templates, r as sourceDir, t as depVersions } from "./constants-BGeuHcdV.js";
2
2
  import fs from "node:fs/promises";
3
3
  import path, { join } from "node:path";
4
4
  import { x } from "tinyexec";
@@ -142,4 +142,4 @@ async function initPackageJson(projectName, packageJsonPath) {
142
142
  }
143
143
  export { getPackageManager as n, managers as r, create as t };
144
144
 
145
- //# sourceMappingURL=src-DW8s8ZAf.js.map
145
+ //# sourceMappingURL=src-G2bUVbwQ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"src-DW8s8ZAf.js","names":[],"sources":["../src/auto-install.ts","../src/utils.ts","../src/index.ts"],"sourcesContent":["import { x } from 'tinyexec';\n\nexport type PackageManager = (typeof managers)[number];\n\nexport const managers = ['npm', 'yarn', 'bun', 'pnpm'] as const;\n\nexport function getPackageManager(): PackageManager {\n const userAgent = process.env.npm_config_user_agent ?? '';\n\n if (userAgent.startsWith('yarn')) {\n return 'yarn';\n }\n\n if (userAgent.startsWith('pnpm')) {\n return 'pnpm';\n }\n\n if (userAgent.startsWith('bun')) {\n return 'bun';\n }\n\n return 'npm';\n}\n\nexport async function autoInstall(manager: PackageManager, dest: string) {\n await x(manager, ['install'], {\n throwOnError: true,\n nodeOptions: {\n env: {\n ...process.env,\n NODE_ENV: 'development',\n DISABLE_OPENCOLLECTIVE: '1',\n },\n cwd: dest,\n },\n });\n}\n","import fs from 'node:fs/promises';\nimport path, { join } from 'node:path';\nimport { x } from 'tinyexec';\n\nexport async function copy(\n from: string,\n to: string,\n options: {\n rename?: (s: string) => string;\n filter?: (s: string) => boolean;\n filterDir?: (dir: string) => boolean;\n } = {},\n): Promise<void> {\n const { rename = (s) => s, filterDir = () => true, filter = () => true } = options;\n const stats = await fs.stat(from);\n\n if (stats.isDirectory() && filterDir(from)) {\n const files = await fs.readdir(from);\n\n await Promise.all(\n files.map((file) => copy(path.join(from, file), path.join(to, file), options)),\n );\n }\n\n if (stats.isFile() && filter(from)) {\n to = rename(to);\n await fs.mkdir(path.dirname(to), { recursive: true });\n await fs.copyFile(from, to);\n }\n}\n\nasync function isInGitRepository(cwd: string) {\n const { exitCode } = await x('git', ['rev-parse', '--is-inside-work-tree'], {\n nodeOptions: { cwd },\n });\n\n return exitCode === 0;\n}\n\nasync function isDefaultBranchSet(cwd: string) {\n const { exitCode } = await x('git', ['config', 'init.defaultBranch'], {\n nodeOptions: { cwd },\n });\n\n return exitCode === 0;\n}\n\n/*\nInitialize a Git repo on the project.\n\nBased on https://github.com/vercel/next.js/blob/canary/packages/create-next-app/helpers/git.ts\n*/\nexport async function tryGitInit(cwd: string): Promise<boolean> {\n const { exitCode } = await x('git', ['--version']);\n if (exitCode !== 0) return false;\n\n if (await isInGitRepository(cwd)) return false;\n\n try {\n await x('git', ['init'], {\n throwOnError: true,\n nodeOptions: { cwd },\n });\n\n if (!(await isDefaultBranchSet(cwd))) {\n await x('git', ['checkout', '-b', 'main'], {\n throwOnError: true,\n nodeOptions: {\n cwd,\n },\n });\n }\n\n await x('git', ['add', '-A'], {\n throwOnError: true,\n nodeOptions: {\n cwd,\n },\n });\n\n await x('git', ['commit', '-m', 'Initial commit from Create Fumadocs App'], {\n throwOnError: true,\n nodeOptions: {\n cwd,\n },\n });\n return true;\n } catch {\n await fs.rm(join(cwd, '.git'), { recursive: true, force: true });\n\n return false;\n }\n}\n","import path from 'node:path';\nimport fs from 'node:fs/promises';\nimport { copy, tryGitInit } from '@/utils';\nimport type { PackageManager } from './auto-install';\nimport { autoInstall } from './auto-install';\nimport { depVersions, sourceDir, type TemplateInfo, templates } from './constants';\n\nexport type Template = TemplateInfo['value'];\nexport interface Options {\n outputDir: string;\n template: Template;\n\n /**\n * the package manager to use\n *\n * @defaultValue 'npm'\n */\n packageManager?: PackageManager;\n\n installDeps?: boolean;\n initializeGit?: boolean;\n log?: (message: string) => void;\n plugins?: TemplatePlugin[];\n}\n\nexport interface TemplatePluginContext {\n template: TemplateInfo;\n log: (message: string) => void;\n /**\n * output directory\n */\n dest: string;\n\n /**\n * output directory for app code (e.g. under `/src`)\n */\n appDir: string;\n}\n\nexport type PackageJsonType = {\n name?: string;\n version?: string;\n private?: boolean;\n scripts?: Record<string, string>;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n} & Record<string, unknown>;\n\ntype Awaitable<T> = T | Promise<T>;\n\nexport interface TemplatePlugin {\n template?: (\n this: Pick<TemplatePluginContext, 'dest'>,\n info: TemplateInfo,\n ) => Awaitable<void | TemplateInfo>;\n packageJson?: (\n this: TemplatePluginContext,\n packageJson: PackageJsonType,\n ) => Awaitable<void | PackageJsonType>;\n afterWrite?: (this: TemplatePluginContext) => Awaitable<void>;\n readme?: (this: TemplatePluginContext, content: string) => Awaitable<void | string>;\n}\n\nexport async function create(createOptions: Options): Promise<void> {\n const {\n outputDir,\n plugins = [],\n packageManager = 'npm',\n initializeGit = false,\n installDeps = false,\n log = console.log,\n } = createOptions;\n\n let template = templates.find((item) => item.value === createOptions.template)!;\n for (const plugin of plugins) {\n template = (await plugin.template?.call({ dest: outputDir }, template)) ?? template;\n }\n\n const appDir = path.join(outputDir, template.appDir);\n const projectName = path.basename(outputDir);\n const pluginContext: TemplatePluginContext = {\n template,\n dest: outputDir,\n log,\n appDir,\n };\n\n await copy(path.join(sourceDir, 'template', template.value), outputDir, {\n rename(file) {\n file = file.replace('example.gitignore', '.gitignore');\n\n return template.rename?.(file) ?? file;\n },\n });\n\n const packageJsonPath = path.join(outputDir, 'package.json');\n let packageJson = await initPackageJson(projectName, packageJsonPath);\n for (const plugin of plugins) {\n packageJson = (await plugin.packageJson?.call(pluginContext, packageJson)) ?? packageJson;\n }\n await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));\n\n const readmePath = path.join(outputDir, 'README.md');\n let readme = `# ${projectName}\\n\\n${await fs.readFile(readmePath)}`;\n for (const plugin of plugins) {\n readme = (await plugin.readme?.call(pluginContext, readme)) ?? readme;\n }\n await fs.writeFile(readmePath, readme);\n\n for (const plugin of plugins) {\n await plugin.afterWrite?.call(pluginContext);\n }\n\n if (installDeps) {\n try {\n await autoInstall(packageManager, outputDir);\n log('Installed dependencies');\n } catch (err) {\n log(`Failed to install dependencies: ${err}`);\n }\n }\n\n if (initializeGit && (await tryGitInit(outputDir))) {\n log('Initialized Git repository');\n }\n}\n\nasync function initPackageJson(\n projectName: string,\n packageJsonPath: string,\n): Promise<PackageJsonType> {\n function replaceWorkspaceDeps(deps: Record<string, string> = {}) {\n for (const k in deps) {\n if (deps[k].startsWith('workspace:') && k in depVersions) {\n deps[k] = depVersions[k as keyof typeof depVersions];\n }\n }\n\n return deps;\n }\n\n const packageJson: PackageJsonType = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));\n const dependencies = replaceWorkspaceDeps(packageJson.dependencies);\n const devDependencies = replaceWorkspaceDeps(packageJson.devDependencies);\n const scripts = { ...packageJson.scripts };\n\n return {\n ...packageJson,\n name: projectName,\n scripts,\n dependencies,\n devDependencies,\n };\n}\n"],"mappings":";;;;;AAIA,MAAa,WAAW;CAAC;CAAO;CAAQ;CAAO;AAAM;AAErD,SAAgB,oBAAoC;CAClD,MAAM,YAAY,QAAQ,IAAI,yBAAyB;CAEvD,IAAI,UAAU,WAAW,MAAM,GAC7B,OAAO;CAGT,IAAI,UAAU,WAAW,MAAM,GAC7B,OAAO;CAGT,IAAI,UAAU,WAAW,KAAK,GAC5B,OAAO;CAGT,OAAO;AACT;AAEA,eAAsB,YAAY,SAAyB,MAAc;CACvE,MAAM,EAAE,SAAS,CAAC,SAAS,GAAG;EAC5B,cAAc;EACd,aAAa;GACX,KAAK;IACH,GAAG,QAAQ;IACX,UAAU;IACV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UAAU,aAAa,MAAM,CAAC,CAAC;CAExE,MAAM,aAAa,KAAK,KAAK,WAAW,WAAW;CACnD,IAAI,SAAS,KAAK,YAAY,MAAM,MAAM,GAAG,SAAS,UAAU;CAChE,KAAK,MAAM,UAAU,SACnB,SAAU,MAAM,OAAO,QAAQ,KAAK,eAAe,MAAM,KAAM;CAEjE,MAAM,GAAG,UAAU,YAAY,MAAM;CAErC,KAAK,MAAM,UAAU,SACnB,MAAM,OAAO,YAAY,KAAK,aAAa;CAG7C,IAAI,aACF,IAAI;EACF,MAAM,YAAY,gBAAgB,SAAS;EAC3C,IAAI,wBAAwB;CAC9B,SAAS,KAAK;EACZ,IAAI,mCAAmC,KAAK;CAC9C;CAGF,IAAI,iBAAkB,MAAM,WAAW,SAAS,GAC9C,IAAI,4BAA4B;AAEpC;AAEA,eAAe,gBACb,aACA,iBAC0B;CAC1B,SAAS,qBAAqB,OAA+B,CAAC,GAAG;EAC/D,KAAK,MAAM,KAAK,MACd,IAAI,KAAK,EAAE,CAAC,WAAW,YAAY,KAAK,KAAK,aAC3C,KAAK,KAAK,YAAY;EAI1B,OAAO;CACT;CAEA,MAAM,cAA+B,KAAK,MAAM,MAAM,GAAG,SAAS,iBAAiB,OAAO,CAAC;CAC3F,MAAM,eAAe,qBAAqB,YAAY,YAAY;CAClE,MAAM,kBAAkB,qBAAqB,YAAY,eAAe;CACxE,MAAM,UAAU,EAAE,GAAG,YAAY,QAAQ;CAEzC,OAAO;EACL,GAAG;EACH,MAAM;EACN;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"src-G2bUVbwQ.js","names":[],"sources":["../src/auto-install.ts","../src/utils.ts","../src/index.ts"],"sourcesContent":["import { x } from 'tinyexec';\n\nexport type PackageManager = (typeof managers)[number];\n\nexport const managers = ['npm', 'yarn', 'bun', 'pnpm'] as const;\n\nexport function getPackageManager(): PackageManager {\n const userAgent = process.env.npm_config_user_agent ?? '';\n\n if (userAgent.startsWith('yarn')) {\n return 'yarn';\n }\n\n if (userAgent.startsWith('pnpm')) {\n return 'pnpm';\n }\n\n if (userAgent.startsWith('bun')) {\n return 'bun';\n }\n\n return 'npm';\n}\n\nexport async function autoInstall(manager: PackageManager, dest: string) {\n await x(manager, ['install'], {\n throwOnError: true,\n nodeOptions: {\n env: {\n ...process.env,\n NODE_ENV: 'development',\n DISABLE_OPENCOLLECTIVE: '1',\n },\n cwd: dest,\n },\n });\n}\n","import fs from 'node:fs/promises';\nimport path, { join } from 'node:path';\nimport { x } from 'tinyexec';\n\nexport async function copy(\n from: string,\n to: string,\n options: {\n rename?: (s: string) => string;\n filter?: (s: string) => boolean;\n filterDir?: (dir: string) => boolean;\n } = {},\n): Promise<void> {\n const { rename = (s) => s, filterDir = () => true, filter = () => true } = options;\n const stats = await fs.stat(from);\n\n if (stats.isDirectory() && filterDir(from)) {\n const files = await fs.readdir(from);\n\n await Promise.all(\n files.map((file) => copy(path.join(from, file), path.join(to, file), options)),\n );\n }\n\n if (stats.isFile() && filter(from)) {\n to = rename(to);\n await fs.mkdir(path.dirname(to), { recursive: true });\n await fs.copyFile(from, to);\n }\n}\n\nasync function isInGitRepository(cwd: string) {\n const { exitCode } = await x('git', ['rev-parse', '--is-inside-work-tree'], {\n nodeOptions: { cwd },\n });\n\n return exitCode === 0;\n}\n\nasync function isDefaultBranchSet(cwd: string) {\n const { exitCode } = await x('git', ['config', 'init.defaultBranch'], {\n nodeOptions: { cwd },\n });\n\n return exitCode === 0;\n}\n\n/*\nInitialize a Git repo on the project.\n\nBased on https://github.com/vercel/next.js/blob/canary/packages/create-next-app/helpers/git.ts\n*/\nexport async function tryGitInit(cwd: string): Promise<boolean> {\n const { exitCode } = await x('git', ['--version']);\n if (exitCode !== 0) return false;\n\n if (await isInGitRepository(cwd)) return false;\n\n try {\n await x('git', ['init'], {\n throwOnError: true,\n nodeOptions: { cwd },\n });\n\n if (!(await isDefaultBranchSet(cwd))) {\n await x('git', ['checkout', '-b', 'main'], {\n throwOnError: true,\n nodeOptions: {\n cwd,\n },\n });\n }\n\n await x('git', ['add', '-A'], {\n throwOnError: true,\n nodeOptions: {\n cwd,\n },\n });\n\n await x('git', ['commit', '-m', 'Initial commit from Create Fumadocs App'], {\n throwOnError: true,\n nodeOptions: {\n cwd,\n },\n });\n return true;\n } catch {\n await fs.rm(join(cwd, '.git'), { recursive: true, force: true });\n\n return false;\n }\n}\n","import path from 'node:path';\nimport fs from 'node:fs/promises';\nimport { copy, tryGitInit } from '@/utils';\nimport type { PackageManager } from './auto-install';\nimport { autoInstall } from './auto-install';\nimport { depVersions, sourceDir, type TemplateInfo, templates } from './constants';\n\nexport type Template = TemplateInfo['value'];\nexport interface Options {\n outputDir: string;\n template: Template;\n\n /**\n * the package manager to use\n *\n * @defaultValue 'npm'\n */\n packageManager?: PackageManager;\n\n installDeps?: boolean;\n initializeGit?: boolean;\n log?: (message: string) => void;\n plugins?: TemplatePlugin[];\n}\n\nexport interface TemplatePluginContext {\n template: TemplateInfo;\n log: (message: string) => void;\n /**\n * output directory\n */\n dest: string;\n\n /**\n * output directory for app code (e.g. under `/src`)\n */\n appDir: string;\n}\n\nexport type PackageJsonType = {\n name?: string;\n version?: string;\n private?: boolean;\n scripts?: Record<string, string>;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n} & Record<string, unknown>;\n\ntype Awaitable<T> = T | Promise<T>;\n\nexport interface TemplatePlugin {\n template?: (\n this: Pick<TemplatePluginContext, 'dest'>,\n info: TemplateInfo,\n ) => Awaitable<void | TemplateInfo>;\n packageJson?: (\n this: TemplatePluginContext,\n packageJson: PackageJsonType,\n ) => Awaitable<void | PackageJsonType>;\n afterWrite?: (this: TemplatePluginContext) => Awaitable<void>;\n readme?: (this: TemplatePluginContext, content: string) => Awaitable<void | string>;\n}\n\nexport async function create(createOptions: Options): Promise<void> {\n const {\n outputDir,\n plugins = [],\n packageManager = 'npm',\n initializeGit = false,\n installDeps = false,\n log = console.log,\n } = createOptions;\n\n let template = templates.find((item) => item.value === createOptions.template)!;\n for (const plugin of plugins) {\n template = (await plugin.template?.call({ dest: outputDir }, template)) ?? template;\n }\n\n const appDir = path.join(outputDir, template.appDir);\n const projectName = path.basename(outputDir);\n const pluginContext: TemplatePluginContext = {\n template,\n dest: outputDir,\n log,\n appDir,\n };\n\n await copy(path.join(sourceDir, 'template', template.value), outputDir, {\n rename(file) {\n file = file.replace('example.gitignore', '.gitignore');\n\n return template.rename?.(file) ?? file;\n },\n });\n\n const packageJsonPath = path.join(outputDir, 'package.json');\n let packageJson = await initPackageJson(projectName, packageJsonPath);\n for (const plugin of plugins) {\n packageJson = (await plugin.packageJson?.call(pluginContext, packageJson)) ?? packageJson;\n }\n await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));\n\n const readmePath = path.join(outputDir, 'README.md');\n let readme = `# ${projectName}\\n\\n${await fs.readFile(readmePath)}`;\n for (const plugin of plugins) {\n readme = (await plugin.readme?.call(pluginContext, readme)) ?? readme;\n }\n await fs.writeFile(readmePath, readme);\n\n for (const plugin of plugins) {\n await plugin.afterWrite?.call(pluginContext);\n }\n\n if (installDeps) {\n try {\n await autoInstall(packageManager, outputDir);\n log('Installed dependencies');\n } catch (err) {\n log(`Failed to install dependencies: ${err}`);\n }\n }\n\n if (initializeGit && (await tryGitInit(outputDir))) {\n log('Initialized Git repository');\n }\n}\n\nasync function initPackageJson(\n projectName: string,\n packageJsonPath: string,\n): Promise<PackageJsonType> {\n function replaceWorkspaceDeps(deps: Record<string, string> = {}) {\n for (const k in deps) {\n if (deps[k].startsWith('workspace:') && k in depVersions) {\n deps[k] = depVersions[k as keyof typeof depVersions];\n }\n }\n\n return deps;\n }\n\n const packageJson: PackageJsonType = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));\n const dependencies = replaceWorkspaceDeps(packageJson.dependencies);\n const devDependencies = replaceWorkspaceDeps(packageJson.devDependencies);\n const scripts = { ...packageJson.scripts };\n\n return {\n ...packageJson,\n name: projectName,\n scripts,\n dependencies,\n devDependencies,\n };\n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E,MAAM,kBAAkB,qBAAqB,YAAY,eAAe;CACxE,MAAM,UAAU,EAAE,GAAG,YAAY,QAAQ;CAEzC,OAAO;EACL,GAAG;EACH,MAAM;EACN;EACA;EACA;CACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fumadocs-app",
3
- "version": "16.2.28",
3
+ "version": "16.2.29",
4
4
  "description": "Create a new documentation site with Fumadocs",
5
5
  "keywords": [
6
6
  "Docs",
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@clack/prompts": "^1.8.1",
43
- "@fumadocs/cli": "1.7.7",
43
+ "@fumadocs/cli": "1.8.0",
44
44
  "cac": "^7.1.0",
45
45
  "fuma-cli": "^0.3.1",
46
46
  "picocolors": "^1.1.1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "example-next",
3
- "version": "0.0.53",
3
+ "version": "0.0.54",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "build": "next build",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "example-next-static",
3
- "version": "0.0.53",
3
+ "version": "0.0.54",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "build": "next build",
@@ -7,7 +7,7 @@ export default defineConfig({
7
7
  integrations: [
8
8
  fumadocs({
9
9
  components: './src/components/mdx.tsx',
10
- layout: './src/lib/layout.shared.tsx',
10
+ includeProcessedMarkdown: { output: 'function' },
11
11
  }),
12
12
  ],
13
13
  vite: {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "example-astro",
3
- "version": "0.0.47",
3
+ "version": "0.0.50",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -19,7 +19,8 @@
19
19
  "fumadocs-ui": "workspace:@fumadocs/base-ui@*",
20
20
  "react": "^19.3.1",
21
21
  "react-dom": "^19.3.1",
22
- "sharp": "^0.35.5"
22
+ "sharp": "^0.35.5",
23
+ "takumi-js": "^2.17.1"
23
24
  },
24
25
  "devDependencies": {
25
26
  "@tailwindcss/vite": "^4.3.3",
@@ -0,0 +1,33 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128">
2
+ <g>
3
+ <path
4
+ d="M47.7 107.1c-5.5-5-7.2-15.7-4.9-23.4 4 4.9 9.6 6.4 15.4 7.3 8.9 1.3 17.6.8 25.9-3.2l2.8-1.7a18 18 0 0 1-7.2 20l-5.5 3.8c-5.6 3.8-7.2 8.2-5 14.7l.2.7a14 14 0 0 1-6.6-5.6 15.8 15.8 0 0 1-2.6-8.6c0-1.5 0-3-.2-4.5-.5-3.7-2.2-5.3-5.5-5.4-3.3-.1-5.9 2-6.6 5.2l-.2.7Z"
5
+ />
6
+ <path
7
+ d="M16 82.4s16.5-8 33-8l12.4-38.3c.5-2 1.8-3.2 3.3-3.2 1.6 0 3 1.3 3.4 3.2l12.4 38.3c19.6 0 33 8 33 8l-28-76c-.8-2.3-2.2-3.7-4-3.7H48c-1.8 0-3.1 1.4-4 3.7l-28 76Z"
8
+ />
9
+ </g>
10
+ <path
11
+ fill="url(#a)"
12
+ d="M47.7 107.1c-5.5-5-7.2-15.7-4.9-23.4 4 4.9 9.6 6.4 15.4 7.3 8.9 1.3 17.6.8 25.9-3.2l2.8-1.7a18 18 0 0 1-7.2 20l-5.5 3.8c-5.6 3.8-7.2 8.2-5 14.7l.2.7a14 14 0 0 1-6.6-5.6 15.8 15.8 0 0 1-2.6-8.6c0-1.5 0-3-.2-4.5-.5-3.7-2.2-5.3-5.5-5.4-3.3-.1-5.9 2-6.6 5.2l-.2.7Z"
13
+ />
14
+
15
+ <defs>
16
+ <linearGradient id="a" x1="64.7" x2="77.4" y1="119.2" y2="77.4" gradientUnits="userSpaceOnUse">
17
+ <stop stop-color="#D83333" />
18
+ <stop offset="1" stop-color="#F041FF" />
19
+ </linearGradient>
20
+ </defs>
21
+
22
+ <style>
23
+ g {
24
+ fill: #000;
25
+ }
26
+
27
+ @media (prefers-color-scheme: dark) {
28
+ g {
29
+ fill: #FFF;
30
+ }
31
+ }
32
+ </style>
33
+ </svg>
@@ -0,0 +1,53 @@
1
+ import { type SerializedPageTree, useFumadocsLoader } from 'fumadocs-core/source/client';
2
+ import type { TOCItemType } from 'fumadocs-core/toc';
3
+ import { DocsLayout } from 'fumadocs-ui/layouts/docs';
4
+ import {
5
+ DocsDescription,
6
+ DocsPage,
7
+ DocsTitle,
8
+ MarkdownCopyButton,
9
+ ViewOptionsPopover,
10
+ } from 'fumadocs-ui/layouts/docs/page';
11
+ import { Provider, type ProviderProps } from '@/components/provider';
12
+ import { baseOptions } from '@/lib/layout.shared';
13
+
14
+ export interface DocsProps extends ProviderProps {
15
+ tree: SerializedPageTree;
16
+ title: string;
17
+ description?: string;
18
+ toc: TOCItemType[];
19
+ markdownUrl: string;
20
+ githubUrl: string;
21
+ }
22
+
23
+ /**
24
+ * The React island of docs pages, the content is passed as children.
25
+ */
26
+ export function Docs({
27
+ tree,
28
+ title,
29
+ description,
30
+ toc,
31
+ markdownUrl,
32
+ githubUrl,
33
+ children,
34
+ ...props
35
+ }: DocsProps) {
36
+ const data = useFumadocsLoader({ tree });
37
+
38
+ return (
39
+ <Provider {...props}>
40
+ <DocsLayout {...baseOptions()} tree={data.tree}>
41
+ <DocsPage toc={toc}>
42
+ <DocsTitle>{title}</DocsTitle>
43
+ <DocsDescription>{description}</DocsDescription>
44
+ <div className="flex flex-row gap-2 items-center border-b -mt-4 pb-6">
45
+ <MarkdownCopyButton markdownUrl={markdownUrl} />
46
+ <ViewOptionsPopover markdownUrl={markdownUrl} githubUrl={githubUrl} />
47
+ </div>
48
+ {children}
49
+ </DocsPage>
50
+ </DocsLayout>
51
+ </Provider>
52
+ );
53
+ }
@@ -0,0 +1,23 @@
1
+ import { HomeLayout } from 'fumadocs-ui/layouts/home';
2
+ import { DefaultNotFound } from 'fumadocs-ui/layouts/home/not-found';
3
+ import { Provider, type ProviderProps } from '@/components/provider';
4
+ import { baseOptions } from '@/lib/layout.shared';
5
+
6
+ /**
7
+ * The React island of pages in the home layout, the content is passed as children.
8
+ */
9
+ export function Home({ children, ...props }: ProviderProps) {
10
+ return (
11
+ <Provider {...props}>
12
+ <HomeLayout {...baseOptions()}>{children}</HomeLayout>
13
+ </Provider>
14
+ );
15
+ }
16
+
17
+ export function NotFound(props: ProviderProps) {
18
+ return (
19
+ <Home {...props}>
20
+ <DefaultNotFound />
21
+ </Home>
22
+ );
23
+ }
@@ -1,4 +1,5 @@
1
1
  import defaultMdxComponents from 'fumadocs-ui/mdx';
2
+ import { DocsBody } from 'fumadocs-ui/layouts/docs/page';
2
3
  import type { MDXComponents } from 'mdx/types';
3
4
 
4
5
  export function getMDXComponents(components?: MDXComponents) {
@@ -8,4 +9,5 @@ export function getMDXComponents(components?: MDXComponents) {
8
9
  } satisfies MDXComponents;
9
10
  }
10
11
 
11
- export default getMDXComponents();
12
+ // for the Fumadocs integration, `wrapper` gives the content its prose styles
13
+ export default getMDXComponents({ wrapper: DocsBody });
@@ -0,0 +1,20 @@
1
+ import { navigate } from 'astro:transitions/client';
2
+ import type { ReactNode } from 'react';
3
+ import { RootProvider } from 'fumadocs-ui/provider/astro';
4
+ import SearchDialog from '@/components/search';
5
+
6
+ export interface ProviderProps {
7
+ /** `Astro.url.pathname` */
8
+ pathname: string;
9
+ /** `Astro.params` */
10
+ params: Record<string, string | undefined>;
11
+ children?: ReactNode;
12
+ }
13
+
14
+ export function Provider({ pathname, params, children }: ProviderProps) {
15
+ return (
16
+ <RootProvider pathname={pathname} params={params} navigate={navigate} search={{ SearchDialog }}>
17
+ {children}
18
+ </RootProvider>
19
+ );
20
+ }
@@ -0,0 +1,34 @@
1
+ import {
2
+ SearchDialog,
3
+ SearchDialogClose,
4
+ SearchDialogContent,
5
+ SearchDialogHeader,
6
+ SearchDialogIcon,
7
+ SearchDialogInput,
8
+ SearchDialogList,
9
+ SearchDialogOverlay,
10
+ type SharedProps,
11
+ } from 'fumadocs-ui/components/dialog/search';
12
+ import { useStaticSearch } from 'fumadocs-core/search/client';
13
+ import { useI18n } from 'fumadocs-ui/contexts/i18n';
14
+
15
+ export default function DefaultSearchDialog(props: SharedProps) {
16
+ const { locale } = useI18n(); // (optional) for i18n
17
+ const search = useStaticSearch({
18
+ locale,
19
+ });
20
+
21
+ return (
22
+ <SearchDialog {...search} {...props}>
23
+ <SearchDialogOverlay />
24
+ <SearchDialogContent>
25
+ <SearchDialogHeader>
26
+ <SearchDialogIcon />
27
+ <SearchDialogInput />
28
+ <SearchDialogClose />
29
+ </SearchDialogHeader>
30
+ <SearchDialogList />
31
+ </SearchDialogContent>
32
+ </SearchDialog>
33
+ );
34
+ }
@@ -0,0 +1,27 @@
1
+ ---
2
+ import { ClientRouter } from 'astro:transitions';
3
+ import '@/styles/global.css';
4
+
5
+ interface Props {
6
+ title: string;
7
+ description?: string;
8
+ image?: string;
9
+ }
10
+
11
+ const { title, description, image } = Astro.props;
12
+ ---
13
+
14
+ <html lang="en" transition:animate="none">
15
+ <head>
16
+ <meta charset="utf-8" />
17
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
18
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
19
+ <title>{title}</title>
20
+ {description && <meta name="description" content={description} />}
21
+ {image && <meta property="og:image" content={image} />}
22
+ <ClientRouter />
23
+ </head>
24
+ <body class="flex flex-col min-h-screen">
25
+ <slot />
26
+ </body>
27
+ </html>
@@ -1,9 +1,12 @@
1
1
  import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
2
+ import { appName, gitConfig } from './shared';
2
3
 
3
4
  export function baseOptions(): BaseLayoutProps {
4
5
  return {
5
6
  nav: {
6
- title: 'My App',
7
+ // JSX supported
8
+ title: appName,
7
9
  },
10
+ githubUrl: `https://github.com/${gitConfig.user}/${gitConfig.repo}`,
8
11
  };
9
12
  }
@@ -0,0 +1,33 @@
1
+ import { createGetUrl } from 'fumadocs-core/source';
2
+
3
+ export const appName = 'Astro';
4
+ export const docsRoute = '/docs';
5
+ export const docsImageRoute = '/og/docs';
6
+
7
+ // fill this with your actual GitHub info, for example:
8
+ export const gitConfig = {
9
+ user: 'fuma-nama',
10
+ repo: 'fumadocs',
11
+ branch: 'main',
12
+ };
13
+
14
+ const getDocsUrl = createGetUrl(docsRoute);
15
+
16
+ export function getPageMarkdownUrl(page: { slugs: string[]; locale?: string }) {
17
+ const segments = [...page.slugs];
18
+ if (segments.length === 0) {
19
+ segments.push('index.md');
20
+ } else {
21
+ segments[segments.length - 1] += '.md';
22
+ }
23
+
24
+ return { segments, url: getDocsUrl(segments, page.locale) };
25
+ }
26
+
27
+ const getImageUrl = createGetUrl(docsImageRoute);
28
+
29
+ export function getPageImageUrl(page: { slugs: string[]; locale?: string }) {
30
+ const segments = [...page.slugs, 'image.webp'];
31
+
32
+ return { segments, url: getImageUrl(segments, page.locale) };
33
+ }
@@ -1,8 +1,15 @@
1
1
  import { getCollection } from 'astro:content';
2
- import { loader } from 'fumadocs-core/source';
2
+ import { llms, loader } from 'fumadocs-core/source';
3
3
  import { toFumadocsSource } from '@fumadocs/astro/source';
4
+ import { docsRoute } from './shared';
4
5
 
5
6
  export const source = loader({
6
7
  source: toFumadocsSource(await getCollection('docs'), await getCollection('meta')),
7
- baseUrl: '/docs',
8
+ baseUrl: docsRoute,
9
+ });
10
+
11
+ export const docsLlms = llms(source, {
12
+ renderPage: async (page) => `# ${page.data.title} (${page.url})
13
+
14
+ ${await page.data.getText('processed')}`,
8
15
  });
@@ -0,0 +1,8 @@
1
+ ---
2
+ import Layout from '@/layouts/Layout.astro';
3
+ import { NotFound } from '@/components/home';
4
+ ---
5
+
6
+ <Layout title="Not Found">
7
+ <NotFound client:load pathname={Astro.url.pathname} params={Astro.params} />
8
+ </Layout>
@@ -0,0 +1,10 @@
1
+ import type { APIRoute } from 'astro';
2
+ import { createFromSource } from 'fumadocs-core/search/server';
3
+ import { source } from '@/lib/source';
4
+
5
+ const server = createFromSource(source, {
6
+ // https://docs.orama.com/docs/orama-js/supported-languages
7
+ language: 'english',
8
+ });
9
+
10
+ export const GET: APIRoute = () => server.staticGET();
@@ -0,0 +1,43 @@
1
+ ---
2
+ import type { GetStaticPaths, InferGetStaticPropsType } from 'astro';
3
+ import Layout from '@/layouts/Layout.astro';
4
+ import { Docs } from '@/components/docs';
5
+ import { source } from '@/lib/source';
6
+ import { getPageImageUrl, getPageMarkdownUrl, gitConfig } from '@/lib/shared';
7
+
8
+ export const prerender = true;
9
+
10
+ export const getStaticPaths = (() => {
11
+ return source.getPages().map((page) => ({
12
+ params: { slug: decodeURI(page.slugs.join('/')) || undefined },
13
+ props: { page },
14
+ }));
15
+ }) satisfies GetStaticPaths;
16
+
17
+ type Props = InferGetStaticPropsType<typeof getStaticPaths>;
18
+
19
+ const { page } = Astro.props;
20
+ const { body: Content, toc } = await page.data.load();
21
+ const pageTree = await source.serializePageTree(source.getPageTree());
22
+ ---
23
+
24
+ <Layout
25
+ title={page.data.title}
26
+ description={page.data.description}
27
+ image={getPageImageUrl(page).url}
28
+ >
29
+ <Docs
30
+ client:load
31
+ transition:persist="docs"
32
+ pathname={Astro.url.pathname}
33
+ params={Astro.params}
34
+ tree={pageTree}
35
+ title={page.data.title}
36
+ description={page.data.description}
37
+ toc={toc}
38
+ markdownUrl={getPageMarkdownUrl(page).url}
39
+ githubUrl={`https://github.com/${gitConfig.user}/${gitConfig.repo}/blob/${gitConfig.branch}/content/docs/${page.path}`}
40
+ >
41
+ <Content />
42
+ </Docs>
43
+ </Layout>
@@ -0,0 +1,21 @@
1
+ import type { APIRoute, GetStaticPaths, InferGetStaticPropsType } from 'astro';
2
+ import { docsLlms, source } from '@/lib/source';
3
+
4
+ export const prerender = true;
5
+
6
+ export const getStaticPaths = (() => {
7
+ return source.getPages().map((page) => ({
8
+ params: { slug: decodeURI(page.slugs.join('/')) || 'index' },
9
+ props: { page },
10
+ }));
11
+ }) satisfies GetStaticPaths;
12
+
13
+ export const GET: APIRoute<InferGetStaticPropsType<typeof getStaticPaths>> = async ({
14
+ props: { page },
15
+ }) => {
16
+ return new Response(await docsLlms.page(page), {
17
+ headers: {
18
+ 'Content-Type': 'text/markdown',
19
+ },
20
+ });
21
+ };
@@ -1,16 +1,20 @@
1
1
  ---
2
- import HomeLayout from '@fumadocs/astro/components/HomeLayout.astro';
2
+ import Layout from '@/layouts/Layout.astro';
3
+ import { Home } from '@/components/home';
4
+ import { docsRoute } from '@/lib/shared';
3
5
  ---
4
6
 
5
- <HomeLayout>
6
- <div class="p-4 flex flex-col items-center justify-center text-center flex-1">
7
- <h1 class="text-xl font-bold mb-2">Fumadocs on Astro.</h1>
8
- <p class="text-fd-muted-foreground mb-4">The truly flexible docs framework on React.js.</p>
9
- <a
10
- class="text-sm bg-fd-primary text-fd-primary-foreground rounded-full font-medium px-4 py-2.5"
11
- href="/docs"
12
- >
13
- Open Docs
14
- </a>
15
- </div>
16
- </HomeLayout>
7
+ <Layout title="Fumadocs on Astro" description="The truly flexible docs framework on React.js.">
8
+ <Home client:load pathname={Astro.url.pathname} params={Astro.params}>
9
+ <div class="p-4 flex flex-col items-center justify-center text-center flex-1">
10
+ <h1 class="text-xl font-bold mb-2">Fumadocs on Astro.</h1>
11
+ <p class="text-fd-muted-foreground mb-4">The truly flexible docs framework on React.js.</p>
12
+ <a
13
+ class="text-sm bg-fd-primary text-fd-primary-foreground rounded-full font-medium px-4 py-2.5"
14
+ href={docsRoute}
15
+ >
16
+ Open Docs
17
+ </a>
18
+ </div>
19
+ </Home>
20
+ </Layout>
@@ -0,0 +1,4 @@
1
+ import type { APIRoute } from 'astro';
2
+ import { docsLlms } from '@/lib/source';
3
+
4
+ export const GET: APIRoute = async () => new Response(await docsLlms.full());
@@ -0,0 +1,4 @@
1
+ import type { APIRoute } from 'astro';
2
+ import { docsLlms } from '@/lib/source';
3
+
4
+ export const GET: APIRoute = () => new Response(docsLlms.index());
@@ -0,0 +1,24 @@
1
+ import type { APIRoute, GetStaticPaths, InferGetStaticPropsType } from 'astro';
2
+ import { generateOGImage } from 'fumadocs-ui/og/takumi';
3
+ import { source } from '@/lib/source';
4
+ import { appName } from '@/lib/shared';
5
+
6
+ export const prerender = true;
7
+
8
+ export const getStaticPaths = (() => {
9
+ return source.getPages().map((page) => ({
10
+ params: { slug: decodeURI(page.slugs.join('/')) || undefined },
11
+ props: { page },
12
+ }));
13
+ }) satisfies GetStaticPaths;
14
+
15
+ export const GET: APIRoute<InferGetStaticPropsType<typeof getStaticPaths>> = ({
16
+ props: { page },
17
+ }) => {
18
+ return generateOGImage({
19
+ title: page.data.title,
20
+ description: page.data.description,
21
+ site: appName,
22
+ format: 'webp',
23
+ });
24
+ };
@@ -1,3 +1,12 @@
1
1
  @import 'tailwindcss';
2
2
  @import 'fumadocs-ui/css/neutral.css';
3
3
  @import 'fumadocs-ui/css/preset.css';
4
+
5
+ html {
6
+ scrollbar-gutter: stable;
7
+ }
8
+
9
+ html > body[data-scroll-locked] {
10
+ margin-right: 0px !important;
11
+ --removed-body-scroll-bar-size: 0px !important;
12
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants-CprVC8qU.js","names":["corePkg","mdxPkg","basePkg","astroPkg","versionPkg.dependencies","basePkg.name","basePkg.version"],"sources":["../../create-app-versions/package.json","../../core/package.json","../../mdx/package.json","../../base-ui/package.json","../../astro/package.json","../src/constants.ts"],"sourcesContent":["","","","","","import { fileURLToPath } from 'node:url';\nimport versionPkg from '../../create-app-versions/package.json';\nimport * as corePkg from '../../core/package.json';\nimport * as mdxPkg from '../../mdx/package.json';\nimport * as basePkg from '../../base-ui/package.json';\nimport * as astroPkg from '../../astro/package.json';\n\nexport const sourceDir = fileURLToPath(new URL(`../`, import.meta.url).href);\n\nexport const isCI = Boolean(process.env.CI);\n\nexport interface TemplateInfo {\n value:\n | '+next+fuma-docs-mdx'\n | 'astro'\n | 'waku'\n | 'react-router'\n | 'react-router-spa'\n | 'tanstack-start'\n | 'tanstack-start-spa'\n | '+next+fuma-docs-mdx+static';\n label: string;\n appDir: string;\n /**\n * path to root provider, relative to `appDir`, none when the framework integration renders it\n */\n rootProviderPath?: string;\n hint?: string;\n /**\n * rename files when copying from template\n */\n rename?: (name: string) => string;\n}\n\nexport const templates: TemplateInfo[] = [\n {\n value: '+next+fuma-docs-mdx',\n label: 'Next.js: Fumadocs MDX',\n hint: 'recommended: powerful and mature',\n appDir: '',\n rootProviderPath: 'app/layout.tsx',\n },\n {\n value: 'waku',\n label: 'Waku: Fumadocs MDX',\n hint: 'recommended: fast and simple',\n appDir: 'src',\n rootProviderPath: 'components/provider.tsx',\n },\n {\n value: '+next+fuma-docs-mdx+static',\n label: 'Next.js Static: Fumadocs MDX',\n appDir: '',\n rootProviderPath: 'components/provider.tsx',\n },\n {\n value: 'react-router',\n label: 'React Router: Fumadocs MDX (not RSC)',\n appDir: 'app',\n rootProviderPath: 'root.tsx',\n },\n {\n value: 'react-router-spa',\n label: 'React Router SPA: Fumadocs MDX (not RSC)',\n hint: 'SPA mode allows you to host the site statically, compatible with a CDN.',\n appDir: 'app',\n rootProviderPath: 'root.tsx',\n },\n {\n value: 'tanstack-start',\n label: 'Tanstack Start: Fumadocs MDX (not RSC)',\n appDir: 'src',\n rootProviderPath: 'routes/__root.tsx',\n },\n {\n value: 'tanstack-start-spa',\n label: 'Tanstack Start SPA: Fumadocs MDX (not RSC)',\n hint: 'SPA mode allows you to host the site statically, compatible with a CDN.',\n appDir: 'src',\n rootProviderPath: 'routes/__root.tsx',\n },\n {\n value: 'astro',\n label: 'Astro: Content Collections',\n appDir: 'src',\n },\n];\n\nconst workspaces = [corePkg, mdxPkg, basePkg, astroPkg];\n\nexport const depVersions = versionPkg.dependencies;\n\nfor (const workspace of workspaces) {\n depVersions[workspace.name as keyof typeof depVersions] = workspace.version;\n}\n\ndepVersions['fumadocs-ui'] = `npm:${basePkg.name}@${basePkg.version}`;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAO;EACP,QAAQ;EACR,kBAAkB;CACpB;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;CACpB;CACA;EACE,OAAO;EACP,OAAO;EACP,QAAQ;EACR,kBAAkB;CACpB;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;CACpB;CACA;EACE,OAAO;EACP,OAAO;EACP,QAAQ;CACV;AACF;AAEA,MAAM,aAAa;CAACA;CAASC;CAAQC;CAASC;AAAQ;AAEtD,MAAa,cAAcC;AAE3B,KAAK,MAAM,aAAa,YACtB,YAAY,UAAU,QAAoC,UAAU;AAGtE,YAAY,iBAAiB,OAAOC,OAAa,GAAGC"}
@@ -1,7 +0,0 @@
1
- import { defineConfig } from '@fumadocs/astro/config';
2
- import { source } from './lib/source';
3
-
4
- export default defineConfig({
5
- source,
6
- title: 'My App',
7
- });