@writedocs/generator 0.10.20 → 0.11.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.
Files changed (52) hide show
  1. package/astro.config.mjs +32 -8
  2. package/package.json +1 -1
  3. package/src/cli/base-path-layout.js +44 -0
  4. package/src/cli/build.js +177 -168
  5. package/src/cli/check-built-styles.js +41 -33
  6. package/src/cli/dev.js +261 -244
  7. package/src/cli/run-pagefind.js +154 -148
  8. package/src/cli/write-mcp-files.js +103 -96
  9. package/src/cli/write-redirects-file.js +25 -8
  10. package/src/components/AppIcon.astro +51 -50
  11. package/src/components/Card.astro +193 -192
  12. package/src/components/CopyPageMenu.astro +374 -370
  13. package/src/components/Hint.astro +188 -187
  14. package/src/components/Icon.astro +72 -71
  15. package/src/components/Image.astro +3 -2
  16. package/src/components/Tile.astro +67 -66
  17. package/src/components/Video.astro +137 -136
  18. package/src/layout/BaseLayout.astro +21 -12
  19. package/src/layout/components/AnalyticsScripts.astro +6 -2
  20. package/src/layout/components/Breadcrumbs.astro +98 -97
  21. package/src/layout/components/ConsentBanner.astro +119 -118
  22. package/src/layout/components/MobileMenu.astro +229 -228
  23. package/src/layout/components/NavTree.astro +393 -392
  24. package/src/layout/components/Sidebar.astro +232 -231
  25. package/src/layout/components/SiteFooter.astro +87 -86
  26. package/src/layout/components/TopBar.astro +386 -385
  27. package/src/lib/agent-markdown.js +164 -162
  28. package/src/lib/asset-dimensions.js +89 -89
  29. package/src/lib/base-path.js +90 -0
  30. package/src/lib/config-schema.js +10 -0
  31. package/src/lib/config-schema.ts +17 -0
  32. package/src/lib/config.ts +1314 -1289
  33. package/src/lib/consent.js +108 -102
  34. package/src/lib/json-schema-descriptions.js +1 -0
  35. package/src/lib/link-check.js +7 -2
  36. package/src/lib/llms-index.ts +90 -88
  37. package/src/lib/mcp-dev-integration.js +65 -60
  38. package/src/lib/mcp-index.ts +102 -101
  39. package/src/lib/project-files-integration.js +2 -2
  40. package/src/lib/rehype-base-path.js +62 -0
  41. package/src/lib/robots-txt.js +21 -16
  42. package/src/lib/seo-tags.js +155 -140
  43. package/src/lib/site-base.ts +27 -0
  44. package/src/lib/styles-asset-integration.js +23 -10
  45. package/src/lib/wdignore-cases.json +195 -195
  46. package/src/lib/wdignore.js +177 -177
  47. package/src/pages/404.astro +63 -62
  48. package/src/pages/[...slug].astro +1604 -1597
  49. package/src/pages/[...slug].md.ts +93 -93
  50. package/src/pages/llms-full.txt.ts +88 -86
  51. package/src/scripts/search.ts +241 -237
  52. package/writedocs.schema.json +6 -0
@@ -31,6 +31,8 @@ import { z } from 'zod';
31
31
  // foi tentado e deu errado (perdia todo caminho aninhado, que e justamente o que
32
32
  // importa aqui) - nao repita.
33
33
  import { findNodeAtLocation, parseTree } from 'jsonc-parser';
34
+ // The form of `basePath`. Plain JS with no `node:` import, like this file.
35
+ import { BASE_PATH_FIELD_PATTERN } from './base-path.js';
34
36
 
35
37
  // ---------------------------------------------------------------------
36
38
  // Pages & groups - the leaf content any container ultimately bottoms out
@@ -1224,6 +1226,18 @@ export const docsConfigSchema = z.object({
1224
1226
  // every one of those call sites when unset - most fixtures/local builds
1225
1227
  // have no real deployed domain yet.
1226
1228
  domain: z.string().optional(),
1229
+ // The path the site is served under on `domain`, like "/docs" for
1230
+ // empresa.com/docs (usually behind the customer's own proxy). Every
1231
+ // address the site makes starts with it, and the build writes the site to
1232
+ // dist/<basePath>/ - see src/lib/base-path.js. Absent, "" or "/": the site
1233
+ // at the root, exactly as without the field.
1234
+ basePath: z
1235
+ .string()
1236
+ .regex(BASE_PATH_FIELD_PATTERN, {
1237
+ message:
1238
+ '"basePath" must be a path like "/docs" or "/help/docs": it starts with "/", has no "/" at the end, and each part has only lowercase letters, digits, "-" and "_".',
1239
+ })
1240
+ .optional(),
1227
1241
  // Site-wide meta tag defaults - see seoFieldsSchema above. A page's own
1228
1242
  // frontmatter `seo` (content.config.ts's docsSchema) overrides these
1229
1243
  // field by field via mergeSeo(), rather than needing to repeat every
@@ -1753,6 +1767,9 @@ function humanizar(issue: IssuePlano, raiz: unknown): { humanMessage?: string; s
1753
1767
  return { humanMessage: `${campo} allows at most ${maximo} ${unidade}${maximo === 1 ? '' : 's'}.` };
1754
1768
  }
1755
1769
  case 'invalid_format':
1770
+ // A field with a pattern of its own (`basePath`) says what's wrong in
1771
+ // its own words.
1772
+ if (issue.format === 'regex' && issue.message) return { humanMessage: issue.message };
1756
1773
  return {
1757
1774
  humanMessage: `${campo} is not a valid ${issue.format ?? 'value'}.`,
1758
1775
  suggestion: 'Check the format against the documentation for this field.',