{"record":{"id":"4893819e1d54ee38","repo":"saadeghi/daisyui","slug":"no-component-docs-page-maps-to-cssfilename","errorCode":null,"errorMessage":"No component docs page maps to ${cssFilename}","messagePattern":"No component docs page maps to (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tailwind-play-share/pr-preview.mjs","lineNumber":521,"sourceCode":"  }\n\n  const cssFiles = plan.headCssPaths.map((filePath) => {\n    const css = readFileAtRevision(headSha, filePath)\n    assertSafePrCss(css, filePath)\n    return { componentName: componentNameFromPath(filePath), css }\n  })\n\n  const headDocs = buildDocsIndex(headSha)\n  const baseDocs = buildDocsIndex(baseSha)\n  const pagesByPath = new Map()\n\n  for (const target of plan.docsTargets) {\n    const preferred = target.preferredCssFilename && headDocs.get(target.preferredCssFilename)\n    const fallback = target.fallbackCssFilename && baseDocs.get(target.fallbackCssFilename)\n    const pages = preferred?.length ? preferred : fallback\n    if (!pages?.length) {\n      const cssFilename = target.preferredCssFilename ?? target.fallbackCssFilename\n      throw new Error(`No component docs page maps to ${cssFilename}`)\n    }\n    for (const page of pages) pagesByPath.set(page.filePath, page)\n  }\n\n  const pages = [...pagesByPath.values()].sort((left, right) =>\n    left.filePath.localeCompare(right.filePath),\n  )\n  return {\n    afterCss: buildAfterCss(plan.excludeNames, cssFiles),\n    beforeCss: buildBeforeCss(),\n    components: plan.excludeNames,\n    docsPages: pages.map(({ filePath }) => filePath),\n    html: combineHtmlExamples(pages),\n  }\n}\n\nexport async function generatePrPreview({\n  baseSha,","sourceCodeStart":503,"sourceCodeEnd":539,"githubUrl":"https://github.com/saadeghi/daisyui/blob/42b09e637e09467aa54a813a5aea53c1179aec75/packages/tailwind-play-share/pr-preview.mjs#L503-L539","documentation":"Thrown by buildPreviewInputs when a planned component change could not be mapped to any docs page: neither the preferred head docs index (for <name>.css) nor the fallback base docs index had a +page.md whose `source:` frontmatter references that CSS filename.","triggerScenarios":"For a docsTargets entry, headDocs.get(target.preferredCssFilename) is empty/undefined and baseDocs.get(target.fallbackCssFilename) is also empty/undefined, so `!pages?.length` fires.","commonSituations":"A PR adds/renames a component CSS file (e.g. new-comp.css) without a corresponding docs page whose `source:` line points at new-comp.css, a renamed component whose docs page was not renamed, or a docs page missing the `source:` frontmatter line.","solutions":["Add or update a docs page under packages/docs/src/routes/(routes)/components/<name>/+page.md with a `source: .../<name>.css` frontmatter line.","For renamed components, update the docs page route/source to match the new CSS filename.","Re-run; the error names the cssFilename that lacks a mapping."],"exampleFix":"<!-- before: no docs page maps to new-comp.css -->\n\n<!-- after: packages/docs/src/routes/(routes)/components/new-comp/+page.md -->\n---\nsource: ../components/new-comp.css\n---\n\n```html\n<div class=\"new-comp\">...</div>\n```","handlingStrategy":"validation","validationCode":"import { execSync } from \"node:child_process\"\nfunction assertDocsMappingExists(cssFilename, revision = \"HEAD\") {\n  const pages = execSync(`git ls-tree -r --name-only -z ${revision} -- packages/docs/src/routes/(routes)/components`, { encoding: \"utf8\" }).split(\"\\0\").filter((p) => p.endsWith(\"/+page.md\"))\n  for (const p of pages) {\n    const md = execSync(`git show ${revision}:${p}`, { encoding: \"utf8\" })\n    if (new RegExp(`^source:\\\\s+\\\\S*\\\\/\\\\Q${cssFilename}\\\\E\\\\s*$`, \"m\").test(md)) return\n  }\n  throw new Error(`No component docs page maps to ${cssFilename}`)\n}","typeGuard":null,"tryCatchPattern":"try {\n  inputs = buildPreviewInputs(baseSha, headSha)\n} catch (error) {\n  if (/No component docs page maps to /.test(error.message)) {\n  // add a +page.md with `source: .../<name>.css` for the named component, then re-run\n  }\n  throw error\n}","preventionTips":["When adding/renaming a component CSS file, add/update a docs +page.md whose `source:` references it.","Lint for a docs-to-component mapping in CI.","Use the cssFilename named in the error to locate the missing mapping."],"tags":["docs","pr-preview","components","mapping"],"backgroundTag":null,"analyzedSha":"42b09e637e09467aa54a813a5aea53c1179aec75","analyzedAt":"2026-08-13T04:10:09.555Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}