@beforesemicolon/builder 1.8.24 → 2.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.
Files changed (184) hide show
  1. package/README.md +40 -915
  2. package/dist/cjs/build-modules.js +1 -1
  3. package/dist/cjs/index.js +1 -1
  4. package/dist/esm/build-modules.js +1 -1
  5. package/dist/esm/index.js +1 -1
  6. package/dist/types/build-modules.d.ts +2 -21
  7. package/dist/types/index.d.ts +0 -1
  8. package/package.json +5 -25
  9. package/dist/cjs/.declarations.d.js +0 -1
  10. package/dist/cjs/docs/markdown-layout/index.js +0 -1
  11. package/dist/cjs/docs/markdown-layout/marked-extension.js +0 -1
  12. package/dist/cjs/docs/markdown-layout/parser.js +0 -7
  13. package/dist/cjs/docs/markdown-layout/renderer.js +0 -1
  14. package/dist/cjs/docs/markdown-layout/types.js +0 -1
  15. package/dist/cjs/docs/renderer/code.js +0 -11
  16. package/dist/cjs/docs/renderer/heading.js +0 -1
  17. package/dist/cjs/docs/renderer/index.js +0 -1
  18. package/dist/cjs/docs/renderer/link.js +0 -1
  19. package/dist/cjs/docs/run.js +0 -78
  20. package/dist/cjs/docs/templates/default.template.js +0 -17
  21. package/dist/cjs/docs/templates/fading-citrus/README.md +0 -822
  22. package/dist/cjs/docs/templates/fading-citrus/assets/facebook.svg +0 -8
  23. package/dist/cjs/docs/templates/fading-citrus/assets/favicon/android-chrome-192x192.png +0 -0
  24. package/dist/cjs/docs/templates/fading-citrus/assets/favicon/android-chrome-512x512.png +0 -0
  25. package/dist/cjs/docs/templates/fading-citrus/assets/favicon/apple-touch-icon.png +0 -0
  26. package/dist/cjs/docs/templates/fading-citrus/assets/favicon/favicon-16x16.png +0 -0
  27. package/dist/cjs/docs/templates/fading-citrus/assets/favicon/favicon-32x32.png +0 -0
  28. package/dist/cjs/docs/templates/fading-citrus/assets/favicon/favicon.ico +0 -0
  29. package/dist/cjs/docs/templates/fading-citrus/assets/favicon/site.webmanifest +0 -19
  30. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-Black.otf +0 -0
  31. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-BlackItalic.otf +0 -0
  32. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-Bold.otf +0 -0
  33. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-BoldItalic.otf +0 -0
  34. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-ExtraBold.otf +0 -0
  35. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-ExtraBoldItalic.otf +0 -0
  36. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-ExtraLight.otf +0 -0
  37. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-ExtraLightItalic.otf +0 -0
  38. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-Italic.otf +0 -0
  39. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-Light.otf +0 -0
  40. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-LightItalic.otf +0 -0
  41. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-Medium.otf +0 -0
  42. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-MediumItalic.otf +0 -0
  43. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-Regular.otf +0 -0
  44. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-SemiBold.otf +0 -0
  45. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-SemiBoldItalic.otf +0 -0
  46. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-Thin.otf +0 -0
  47. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-ThinItalic.otf +0 -0
  48. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/exo-2/SIL Open Font License.txt +0 -43
  49. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/open-sans/Apache License.txt +0 -201
  50. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-Bold.ttf +0 -0
  51. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-BoldItalic.ttf +0 -0
  52. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-ExtraBold.ttf +0 -0
  53. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-ExtraBoldItalic.ttf +0 -0
  54. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-Italic.ttf +0 -0
  55. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-Light.ttf +0 -0
  56. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-LightItalic.ttf +0 -0
  57. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-Regular.ttf +0 -0
  58. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-Semibold.ttf +0 -0
  59. package/dist/cjs/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-SemiboldItalic.ttf +0 -0
  60. package/dist/cjs/docs/templates/fading-citrus/assets/instagram.svg +0 -28
  61. package/dist/cjs/docs/templates/fading-citrus/assets/logo.dark.svg +0 -8
  62. package/dist/cjs/docs/templates/fading-citrus/assets/logo.light.svg +0 -8
  63. package/dist/cjs/docs/templates/fading-citrus/assets/logo.svg +0 -8
  64. package/dist/cjs/docs/templates/fading-citrus/assets/medium2.svg +0 -18
  65. package/dist/cjs/docs/templates/fading-citrus/assets/reddit.svg +0 -16
  66. package/dist/cjs/docs/templates/fading-citrus/assets/twitter.svg +0 -11
  67. package/dist/cjs/docs/templates/fading-citrus/assets/youtube.svg +0 -10
  68. package/dist/cjs/docs/templates/fading-citrus/layouts/_code-snippet.js +0 -128
  69. package/dist/cjs/docs/templates/fading-citrus/layouts/_footer.js +0 -72
  70. package/dist/cjs/docs/templates/fading-citrus/layouts/_head-meta.js +0 -235
  71. package/dist/cjs/docs/templates/fading-citrus/layouts/_header.js +0 -91
  72. package/dist/cjs/docs/templates/fading-citrus/layouts/_layout-utils.js +0 -109
  73. package/dist/cjs/docs/templates/fading-citrus/layouts/document.js +0 -100
  74. package/dist/cjs/docs/templates/fading-citrus/layouts/landing-cta.js +0 -30
  75. package/dist/cjs/docs/templates/fading-citrus/layouts/landing-ecosystem.js +0 -51
  76. package/dist/cjs/docs/templates/fading-citrus/layouts/landing-features.js +0 -25
  77. package/dist/cjs/docs/templates/fading-citrus/layouts/landing-hero.js +0 -89
  78. package/dist/cjs/docs/templates/fading-citrus/layouts/landing-install.js +0 -116
  79. package/dist/cjs/docs/templates/fading-citrus/layouts/landing-showcase.js +0 -133
  80. package/dist/cjs/docs/templates/fading-citrus/layouts/landing.js +0 -29
  81. package/dist/cjs/docs/templates/fading-citrus/stylesheets/common.css +0 -900
  82. package/dist/cjs/docs/templates/fading-citrus/stylesheets/documentation.css +0 -562
  83. package/dist/cjs/docs/templates/fading-citrus/stylesheets/fonts.css +0 -1
  84. package/dist/cjs/docs/templates/fading-citrus/stylesheets/github-dark.hightlighter.css +0 -107
  85. package/dist/cjs/docs/templates/fading-citrus/stylesheets/github-light.hightlighter.css +0 -107
  86. package/dist/cjs/docs/templates/fading-citrus/stylesheets/hybrid.hightlighter.css +0 -102
  87. package/dist/cjs/docs/templates/fading-citrus/stylesheets/landing.css +0 -1563
  88. package/dist/cjs/docs/templates/fading-citrus/stylesheets/normalize.css +0 -351
  89. package/dist/cjs/docs/templates/fading-citrus/template.config.js +0 -233
  90. package/dist/cjs/docs/types.js +0 -1
  91. package/dist/esm/.declarations.d.js +0 -0
  92. package/dist/esm/docs/markdown-layout/index.js +0 -1
  93. package/dist/esm/docs/markdown-layout/marked-extension.js +0 -1
  94. package/dist/esm/docs/markdown-layout/parser.js +0 -7
  95. package/dist/esm/docs/markdown-layout/renderer.js +0 -1
  96. package/dist/esm/docs/markdown-layout/types.js +0 -0
  97. package/dist/esm/docs/renderer/code.js +0 -11
  98. package/dist/esm/docs/renderer/heading.js +0 -1
  99. package/dist/esm/docs/renderer/index.js +0 -1
  100. package/dist/esm/docs/renderer/link.js +0 -1
  101. package/dist/esm/docs/run.js +0 -78
  102. package/dist/esm/docs/templates/default.template.js +0 -17
  103. package/dist/esm/docs/templates/fading-citrus/README.md +0 -822
  104. package/dist/esm/docs/templates/fading-citrus/assets/facebook.svg +0 -8
  105. package/dist/esm/docs/templates/fading-citrus/assets/favicon/android-chrome-192x192.png +0 -0
  106. package/dist/esm/docs/templates/fading-citrus/assets/favicon/android-chrome-512x512.png +0 -0
  107. package/dist/esm/docs/templates/fading-citrus/assets/favicon/apple-touch-icon.png +0 -0
  108. package/dist/esm/docs/templates/fading-citrus/assets/favicon/favicon-16x16.png +0 -0
  109. package/dist/esm/docs/templates/fading-citrus/assets/favicon/favicon-32x32.png +0 -0
  110. package/dist/esm/docs/templates/fading-citrus/assets/favicon/favicon.ico +0 -0
  111. package/dist/esm/docs/templates/fading-citrus/assets/favicon/site.webmanifest +0 -19
  112. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-Black.otf +0 -0
  113. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-BlackItalic.otf +0 -0
  114. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-Bold.otf +0 -0
  115. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-BoldItalic.otf +0 -0
  116. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-ExtraBold.otf +0 -0
  117. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-ExtraBoldItalic.otf +0 -0
  118. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-ExtraLight.otf +0 -0
  119. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-ExtraLightItalic.otf +0 -0
  120. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-Italic.otf +0 -0
  121. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-Light.otf +0 -0
  122. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-LightItalic.otf +0 -0
  123. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-Medium.otf +0 -0
  124. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-MediumItalic.otf +0 -0
  125. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-Regular.otf +0 -0
  126. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-SemiBold.otf +0 -0
  127. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-SemiBoldItalic.otf +0 -0
  128. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-Thin.otf +0 -0
  129. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/Exo2.0-ThinItalic.otf +0 -0
  130. package/dist/esm/docs/templates/fading-citrus/assets/fonts/exo-2/SIL Open Font License.txt +0 -43
  131. package/dist/esm/docs/templates/fading-citrus/assets/fonts/open-sans/Apache License.txt +0 -201
  132. package/dist/esm/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-Bold.ttf +0 -0
  133. package/dist/esm/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-BoldItalic.ttf +0 -0
  134. package/dist/esm/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-ExtraBold.ttf +0 -0
  135. package/dist/esm/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-ExtraBoldItalic.ttf +0 -0
  136. package/dist/esm/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-Italic.ttf +0 -0
  137. package/dist/esm/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-Light.ttf +0 -0
  138. package/dist/esm/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-LightItalic.ttf +0 -0
  139. package/dist/esm/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-Regular.ttf +0 -0
  140. package/dist/esm/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-Semibold.ttf +0 -0
  141. package/dist/esm/docs/templates/fading-citrus/assets/fonts/open-sans/OpenSans-SemiboldItalic.ttf +0 -0
  142. package/dist/esm/docs/templates/fading-citrus/assets/instagram.svg +0 -28
  143. package/dist/esm/docs/templates/fading-citrus/assets/logo.dark.svg +0 -8
  144. package/dist/esm/docs/templates/fading-citrus/assets/logo.light.svg +0 -8
  145. package/dist/esm/docs/templates/fading-citrus/assets/logo.svg +0 -8
  146. package/dist/esm/docs/templates/fading-citrus/assets/medium2.svg +0 -18
  147. package/dist/esm/docs/templates/fading-citrus/assets/reddit.svg +0 -16
  148. package/dist/esm/docs/templates/fading-citrus/assets/twitter.svg +0 -11
  149. package/dist/esm/docs/templates/fading-citrus/assets/youtube.svg +0 -10
  150. package/dist/esm/docs/templates/fading-citrus/layouts/_code-snippet.js +0 -128
  151. package/dist/esm/docs/templates/fading-citrus/layouts/_footer.js +0 -72
  152. package/dist/esm/docs/templates/fading-citrus/layouts/_head-meta.js +0 -235
  153. package/dist/esm/docs/templates/fading-citrus/layouts/_header.js +0 -91
  154. package/dist/esm/docs/templates/fading-citrus/layouts/_layout-utils.js +0 -109
  155. package/dist/esm/docs/templates/fading-citrus/layouts/document.js +0 -100
  156. package/dist/esm/docs/templates/fading-citrus/layouts/landing-cta.js +0 -30
  157. package/dist/esm/docs/templates/fading-citrus/layouts/landing-ecosystem.js +0 -51
  158. package/dist/esm/docs/templates/fading-citrus/layouts/landing-features.js +0 -25
  159. package/dist/esm/docs/templates/fading-citrus/layouts/landing-hero.js +0 -89
  160. package/dist/esm/docs/templates/fading-citrus/layouts/landing-install.js +0 -116
  161. package/dist/esm/docs/templates/fading-citrus/layouts/landing-showcase.js +0 -133
  162. package/dist/esm/docs/templates/fading-citrus/layouts/landing.js +0 -29
  163. package/dist/esm/docs/templates/fading-citrus/stylesheets/common.css +0 -900
  164. package/dist/esm/docs/templates/fading-citrus/stylesheets/documentation.css +0 -562
  165. package/dist/esm/docs/templates/fading-citrus/stylesheets/fonts.css +0 -1
  166. package/dist/esm/docs/templates/fading-citrus/stylesheets/github-dark.hightlighter.css +0 -107
  167. package/dist/esm/docs/templates/fading-citrus/stylesheets/github-light.hightlighter.css +0 -107
  168. package/dist/esm/docs/templates/fading-citrus/stylesheets/hybrid.hightlighter.css +0 -102
  169. package/dist/esm/docs/templates/fading-citrus/stylesheets/landing.css +0 -1563
  170. package/dist/esm/docs/templates/fading-citrus/stylesheets/normalize.css +0 -351
  171. package/dist/esm/docs/templates/fading-citrus/template.config.js +0 -233
  172. package/dist/esm/docs/types.js +0 -0
  173. package/dist/types/docs/markdown-layout/index.d.ts +0 -4
  174. package/dist/types/docs/markdown-layout/marked-extension.d.ts +0 -9
  175. package/dist/types/docs/markdown-layout/parser.d.ts +0 -12
  176. package/dist/types/docs/markdown-layout/renderer.d.ts +0 -3
  177. package/dist/types/docs/markdown-layout/types.d.ts +0 -36
  178. package/dist/types/docs/renderer/code.d.ts +0 -2
  179. package/dist/types/docs/renderer/heading.d.ts +0 -2
  180. package/dist/types/docs/renderer/index.d.ts +0 -3
  181. package/dist/types/docs/renderer/link.d.ts +0 -2
  182. package/dist/types/docs/run.d.ts +0 -19
  183. package/dist/types/docs/templates/default.template.d.ts +0 -3
  184. package/dist/types/docs/types.d.ts +0 -107
package/README.md CHANGED
@@ -1,960 +1,85 @@
1
- # @beforesemicolon/builder
1
+ # Before Semicolon Builder
2
2
 
3
- Utilities to build npm packages and static documentation websites for Before Semicolon projects.
3
+ Package-building utilities for Before Semicolon projects.
4
4
 
5
- This package provides three public helpers:
6
-
7
- - `buildModules()` builds TypeScript sources into `dist/esm` and `dist/cjs`.
8
- - `buildBrowser()` builds a browser bundle, usually for demos or docs.
9
- - `buildDocs()` renders a static Markdown documentation site.
10
-
11
- The docs builder supports reusable templates, Markdown layout blocks, source-level template extension, generated SEO/AI files, theme variables, page scripts, assets, stylesheets, and custom `marked` options.
12
-
13
- ## Requirements
14
-
15
- - Node.js `>=18.16.0`
16
- - ESM projects are supported directly.
17
- - CommonJS consumers can use the package `require` export.
5
+ Builder 2.0 is focused exclusively on producing JavaScript packages. The
6
+ Markdown documentation builder and its templates were removed. Documentation
7
+ sites now belong to
8
+ [`@beforesemicolon/site-builder`](https://www.npmjs.com/package/@beforesemicolon/site-builder).
18
9
 
19
10
  ## Installation
20
11
 
21
- ```sh
12
+ ```bash
22
13
  npm install --save-dev @beforesemicolon/builder
23
14
  ```
24
15
 
25
- ## Quick Start
26
-
27
- ```js
28
- import { buildModules, buildBrowser, buildDocs } from '@beforesemicolon/builder'
29
-
30
- await buildModules()
31
- await buildBrowser()
32
- await buildDocs()
33
- ```
34
-
35
- Common project script:
36
-
37
- ```js
38
- import { buildModules, buildBrowser, buildDocs } from '@beforesemicolon/builder'
39
-
40
- const docsOptions = {
41
- template: 'fading-citrus',
42
- siteUrl: 'https://example.com',
43
- generatedFiles: {
44
- netlify: true,
45
- },
46
- }
47
-
48
- const run = async () => {
49
- await Promise.all([buildModules(), buildBrowser(), buildDocs(docsOptions)])
50
- }
51
-
52
- run()
53
- ```
54
-
55
- ## API
56
-
57
- ### buildModules(options?)
58
-
59
- ```ts
60
- buildModules(options?: {
61
- directoryPath?: string
62
- }): Promise<void>
63
- ```
64
-
65
- Builds source files into server-friendly ESM and CommonJS output.
66
-
67
- Defaults:
68
-
69
- - `directoryPath`: `process.cwd()/src`
70
- - ESM output: `dist/esm`
71
- - CommonJS output: `dist/cjs`
72
-
73
- Behavior:
74
-
75
- - Recursively scans the source directory.
76
- - Skips files ending in `.spec.ts`.
77
- - Skips `/client.ts` from module builds.
78
- - Uses `esbuild`.
79
- - Minifies output.
80
- - Keeps symbol names for better stack traces.
81
-
82
- ### buildBrowser(options?)
83
-
84
- ```ts
85
- buildBrowser(options?: {
86
- entry?: string
87
- out?: string
88
- }): Promise<void>
89
- ```
90
-
91
- Builds a single browser bundle.
92
-
93
- Defaults:
94
-
95
- - `entry`: `src/client`
96
- - `out`: `dist/client.js`
97
-
98
- Behavior:
99
-
100
- - Uses `esbuild`.
101
- - Generates sourcemaps.
102
- - Minifies output.
103
- - Includes a small internal plugin that removes the `Doc` export from `@beforesemicolon/html-parser` when bundling.
104
-
105
- ### buildDocs(options?)
106
-
107
- ```ts
108
- buildDocs(options?: {
109
- srcDir?: string
110
- publicDir?: string
111
- markedOptions?: MarkedExtension
112
- template?: string
113
- siteUrl?: string
114
- generatedFiles?:
115
- | boolean
116
- | {
117
- sitemap?: boolean
118
- robots?: boolean
119
- llms?: boolean
120
- llmsFull?: boolean
121
- netlify?: boolean
122
- }
123
- }): Promise<void>
124
- ```
125
-
126
- Builds a static documentation site from Markdown.
127
-
128
- Defaults:
129
-
130
- - `srcDir`: `process.cwd()/docs`
131
- - `publicDir`: `process.cwd()/website`
132
- - `template`: no named template, uses the built-in `default` layout
133
- - `generatedFiles`: enabled for `sitemap`, `robots`, `llms`, and `llmsFull`
134
- - `generatedFiles.netlify`: `false`
135
-
136
- Example:
137
-
138
- ```js
139
- await buildDocs({
140
- template: 'fading-citrus',
141
- siteUrl: 'https://docs.example.com',
142
- generatedFiles: {
143
- netlify: true,
144
- },
145
- })
146
- ```
147
-
148
- ## Docs Directory Structure
149
-
150
- The default source directory is `docs/`.
151
-
152
- ```txt
153
- docs/
154
- index.md
155
- guide/
156
- getting-started.md
157
- assets/
158
- stylesheets/
159
- scripts/
160
- _layouts/
161
- _template/
162
- template.config.js
163
- assets/
164
- stylesheets/
165
- scripts/
166
- layouts/
167
- robots.txt
168
- sitemap.xml
169
- llms.txt
170
- llms-full.txt
171
- _redirects
172
- netlify.toml
173
- ```
174
-
175
- Supported folders:
176
-
177
- - `assets/`: copied to the same relative location in the output directory.
178
- - `stylesheets/`: CSS files are minified and copied to output.
179
- - `scripts/`: JS files are minified and copied to output.
180
- - `_layouts/`: page layout modules. Each file default-exports a page layout function.
181
- - `_template/`: source-level extension for the selected template.
182
- - `_template/assets/`: copied into `publicDir/assets`, overriding or extending template assets.
183
- - `_template/stylesheets/`: copied into `publicDir/stylesheets`, overriding or extending template styles.
184
- - `_template/scripts/`: copied into `publicDir/scripts`, overriding or extending template scripts.
185
- - `_template/layouts/`: custom page layouts that can override or extend selected template layouts.
186
- - `_template/template.config.js`: source-level template config merged with the selected template config.
187
-
188
- Files and folders starting with `.` or `_` are skipped during Markdown page discovery. `_template` and `_layouts` are used explicitly by the docs builder.
189
-
190
- ## Page Front Matter
191
-
192
- Each Markdown page can include front matter:
193
-
194
- ```md
195
- ---
196
- name: Get Started
197
- title: Get Started with Example
198
- description: Learn how to install and use Example.
199
- order: 1
200
- layout: document
201
- ---
202
-
203
- # Get Started
204
- ```
205
-
206
- Common fields:
207
-
208
- - `name`: label used in the generated site map.
209
- - `title`: HTML title and generated metadata title.
210
- - `description`: meta description and generated metadata description.
211
- - `order`: numeric sort order for site map and generated files.
212
- - `layout`: page layout name. Defaults to `default`.
213
-
214
- The final page props include:
215
-
216
- ```ts
217
- interface PageProps {
218
- name?: string
219
- path?: string
220
- order?: number
221
- title?: string
222
- description?: string
223
- content?: string
224
- siteMap?: SiteMap
225
- tableOfContent?: Array<{
226
- path: string
227
- label: string
228
- level: string
229
- }>
230
- projectMeta?: {
231
- name: string
232
- version: string
233
- [key: string]: unknown
234
- }
235
- renderMarkdown?: (markdown: string) => string
236
- scripts?: string[]
237
- themeStylesheet?: string
238
- }
239
- ```
240
-
241
- ## Page Layouts
242
-
243
- Page layouts render complete HTML documents. A layout file must default-export a function that receives `PageProps` and returns an HTML string.
244
-
245
- Example `docs/_layouts/document.js`:
246
-
247
- ```js
248
- export default ({
249
- title,
250
- description,
251
- content,
252
- scripts = [],
253
- }) => `<!doctype html>
254
- <html>
255
- <head>
256
- <meta charset="utf-8">
257
- <meta name="description" content="${description || ''}">
258
- <title>${title || ''}</title>
259
- </head>
260
- <body>
261
- ${content || ''}
262
- ${scripts.join('')}
263
- </body>
264
- </html>`
265
- ```
266
-
267
- Layout lookup order:
268
-
269
- 1. Built-in layouts.
270
- 2. Selected template layouts.
271
- 3. `docs/_layouts`.
272
- 4. `docs/_template/layouts`.
273
-
274
- Later layout files with the same basename override earlier ones.
275
-
276
- ## Templates
277
-
278
- Named templates are loaded from:
279
-
280
- ```txt
281
- src/docs/templates/<template-name>/
282
- ```
283
-
284
- Available templates:
285
-
286
- - `fading-citrus`: a complete landing and documentation template with Markdown layout handlers, theme variables, assets, and page scripts. See [fading-citrus template README](./src/docs/templates/fading-citrus/README.md).
287
-
288
- A template can provide:
289
-
290
- ```txt
291
- template.config.js
292
- assets/
293
- stylesheets/
294
- scripts/
295
- layouts/
296
- ```
297
-
298
- The selected template is a complete out-of-the-box docs site shell. A docs source can extend it through `docs/_template`. Template-specific layouts, assets, options, and assumptions should be documented by each template.
299
-
300
- ## Template Config
301
-
302
- A template config exports an object:
303
-
304
- ```js
305
- export default {
306
- meta: {},
307
- site: {},
308
- markedOptions: {},
309
- markdownLayouts: {},
310
- headScripts: {},
311
- scripts: {},
312
- theme: {
313
- light: {},
314
- dark: {},
315
- },
316
- }
317
- ```
318
-
319
- Config from `docs/_template/template.config.js` is merged into the selected template config.
320
-
321
- Merge behavior:
16
+ ## Build modules
322
17
 
323
- - `markdownLayouts` are shallow-merged by layout name.
324
- - `headScripts` and `scripts` are shallow-merged by script name.
325
- - `meta` is shallow-merged by metadata field.
326
- - `site` is shallow-merged by site field.
327
- - `theme.light` and `theme.dark` are shallow-merged by CSS variable name.
328
- - Other top-level config values use the docs source config value when provided.
329
-
330
- Example docs source extension:
18
+ `buildModules` compiles the TypeScript and JavaScript files under `src` into
19
+ ES modules and CommonJS modules. Specification files and `client.ts` are not
20
+ included in the module output.
331
21
 
332
22
  ```js
333
- import pricingCards from './layouts/pricing-cards.js'
334
-
335
- export default {
336
- meta: {
337
- siteName: 'Example',
338
- title: 'Example Docs',
339
- description: 'Documentation for Example.',
340
- image: '/assets/site-image.jpg',
341
- },
342
- site: {
343
- name: 'Example',
344
- packageName: '@example/docs',
345
- repositoryUrl: 'https://github.com/example/docs',
346
- repositoryLabel: 'Example GitHub repository',
347
- docsEditUrl: 'https://github.com/example/docs/tree/main/docs',
348
- footerDescription: 'Documentation for Example.',
349
- footerGroups: [
350
- {
351
- title: 'Learning Resources',
352
- links: [{ label: 'Documentation', href: '/documentation' }],
353
- },
354
- ],
355
- },
356
- markdownLayouts: {
357
- 'pricing-cards': pricingCards,
358
- },
359
- theme: {
360
- light: {
361
- '--primary': 'oklch(0.62 0.18 250)',
362
- },
363
- dark: {
364
- '--primary': 'oklch(0.76 0.16 250)',
365
- },
366
- },
367
- }
368
- ```
369
-
370
- Common `site` fields:
371
-
372
- - `name`: display name used by shared layouts.
373
- - `packageName`: package name used by templates that render install commands.
374
- - `repositoryUrl` and `repositoryLabel`: repository link and accessible label.
375
- - `docsEditUrl`: base URL for edit links, usually a repository `docs` folder URL.
376
- - `navLinks` and `actionLinks`: landing header links.
377
- - `footerDescription`, `footerGroups`, `socialLinks`, and `copyright`: footer content.
378
- - `landingHeroVersionHref` and `landingHeroSecondaryLabel`: optional landing hero overrides.
379
-
380
- ## Markdown Layout Syntax
381
-
382
- The docs renderer extends `marked` with a custom block syntax:
383
-
384
- ```md
385
- ::: layout <type> [options]
386
-
387
- === <name> [options]
388
-
389
- Markdown content for this part.
390
-
391
- === <name> [options]
392
-
393
- More Markdown content.
394
-
395
- :::
396
- ```
397
-
398
- Example:
399
-
400
- ```md
401
- ::: layout grid columns=3 gap=lg
402
-
403
- === card span=2
404
-
405
- ## First card
406
-
407
- Markdown content.
408
-
409
- === card sticky
410
-
411
- ## Second card
412
-
413
- More Markdown content.
414
-
415
- ===
416
-
417
- Unnamed item.
418
-
419
- :::
420
- ```
421
-
422
- Header parsing:
423
-
424
- ```txt
425
- ::: layout grid columns=3 gap=lg
426
- ```
427
-
428
- Produces:
429
-
430
- ```js
431
- {
432
- type: 'grid',
433
- options: {
434
- columns: 3,
435
- gap: 'lg',
436
- },
437
- }
438
- ```
439
-
440
- Item header parsing:
441
-
442
- ```txt
443
- === hero span=2 sticky
444
- ```
445
-
446
- Produces:
447
-
448
- ```js
449
- {
450
- name: 'hero',
451
- options: {
452
- span: 2,
453
- sticky: true,
454
- },
455
- }
456
- ```
457
-
458
- Unnamed items are supported:
459
-
460
- ```md
461
- ===
462
-
463
- Content
464
- ```
465
-
466
- Produces:
23
+ import { buildModules } from '@beforesemicolon/builder'
467
24
 
468
- ```js
469
- {
470
- name: null,
471
- options: {},
472
- }
25
+ await buildModules()
473
26
  ```
474
27
 
475
- Option parsing rules:
476
-
477
- - `key=value` becomes a keyed option.
478
- - Bare words become boolean `true`.
479
- - Numeric values become numbers.
480
- - `true` and `false` become booleans.
481
- - Quoted values are supported.
28
+ The default output is:
482
29
 
483
- Examples:
484
-
485
- ```txt
486
- columns=3
487
- gap=lg
488
- sticky
489
- label="Get Started"
490
- enabled=false
30
+ ```text
31
+ dist/
32
+ esm/
33
+ cjs/
491
34
  ```
492
35
 
493
- Nested layout blocks are supported. Nested blocks are preserved inside the parent item body and rendered through the same Markdown renderer.
494
-
495
- ## Markdown Layout Handlers
496
-
497
- Markdown layout handlers are registered through `template.config.js`:
36
+ Use another source directory when needed:
498
37
 
499
38
  ```js
500
- import pricingCards from './layouts/pricing-cards.js'
501
-
502
- export default {
503
- markdownLayouts: {
504
- 'pricing-cards': pricingCards,
505
- },
506
- }
39
+ await buildModules({ directoryPath: './source' })
507
40
  ```
508
41
 
509
- A handler receives parsed layout data and a rendering context:
510
-
511
- ```ts
512
- type MarkdownLayoutHandler = (
513
- layout: {
514
- type: string
515
- options: Record<string, string | number | boolean>
516
- parts: Array<{
517
- name: string | null
518
- options: Record<string, string | number | boolean>
519
- body: string
520
- html: string
521
- }>
522
- raw: string
523
- },
524
- context: {
525
- renderMarkdown(markdown: string): string
526
- renderDefault(node): string
527
- renderParts(node): Array<{ html: string }>
528
- }
529
- ) => string
530
- ```
42
+ ## Build a browser bundle
531
43
 
532
- Each part body is rendered from Markdown to HTML before the handler receives it. Use `part.html` when injecting content.
533
-
534
- Example handler:
44
+ `buildBrowser` bundles a browser entry point with esbuild. It defaults to
45
+ `src/client` and writes `dist/client.js` with a source map.
535
46
 
536
47
  ```js
537
- export default ({ parts, options }) => {
538
- const tierClass = options.featured ? ' pricing-cards-featured' : ''
539
-
540
- return `<div class="pricing-cards${tierClass}">
541
- ${parts
542
- .map(
543
- (
544
- part,
545
- index
546
- ) => `<section class="pricing-card option-${index + 1}">
547
- ${part.html}
548
- </section>`
549
- )
550
- .join('')}
551
- </div>`
552
- }
553
- ```
554
-
555
- Markdown:
556
-
557
- ```md
558
- ::: layout pricing-cards featured
559
-
560
- ===
561
-
562
- ## Starter
563
-
564
- $10/month
48
+ import { buildBrowser } from '@beforesemicolon/builder'
565
49
 
566
- ===
567
-
568
- ## Pro
569
-
570
- $30/month
571
-
572
- :::
573
- ```
574
-
575
- Generated HTML is entirely controlled by the handler.
576
-
577
- ## Default Markdown Layout Rendering
578
-
579
- If a layout type has no custom handler, builder renders a generic structure:
580
-
581
- ```html
582
- <div
583
- class="bfs-layout bfs-layout-grid"
584
- data-layout="grid"
585
- style="--columns: 3; --gap: lg;"
586
- >
587
- <section class="bfs-layout-item" data-name="card" style="--span: 2;">
588
- ...
589
- </section>
590
- </div>
50
+ await buildBrowser()
591
51
  ```
592
52
 
593
- Boolean options are omitted from inline styles. Non-boolean options are converted to CSS custom properties.
594
-
595
- ## marked Options
596
-
597
- The docs builder uses `marked`, `marked-highlight`, and a custom renderer for headings, code, and links.
598
-
599
- You can extend `marked` globally for docs generation:
53
+ Custom entry and output paths are supported:
600
54
 
601
55
  ```js
602
- await buildDocs({
603
- markedOptions: {
604
- renderer: {
605
- codespan({ text }) {
606
- return `<code data-inline>${text}</code>`
607
- },
608
- },
609
- },
56
+ await buildBrowser({
57
+ entry: './src/browser.ts',
58
+ out: './dist/browser.js',
610
59
  })
611
60
  ```
612
61
 
613
- Templates can also provide `markedOptions` through `template.config.js`.
614
-
615
- ## Page Scripts
62
+ ## Migrating from Builder 1.x
616
63
 
617
- Template scripts are declared in `template.config.js`.
64
+ `buildDocs` and `src/docs` are intentionally absent from Builder 2.0. Replace
65
+ the old import:
618
66
 
619
67
  ```js
620
- import { renderCodeCopyScript } from './layouts/_code-snippet.js'
621
-
622
- export default {
623
- scripts: {
624
- 'code-copy': {
625
- match: 'code-copy-btn',
626
- render: renderCodeCopyScript,
627
- },
628
- },
629
- }
68
+ import { buildDocs } from '@beforesemicolon/builder'
630
69
  ```
631
70
 
632
- Use `headScripts` for scripts that must render in `<head>`, such as analytics bootstrap tags. Use `scripts` for scripts that can render near `</body>`, such as interaction handlers.
633
-
634
- Script definitions:
635
-
636
- ```ts
637
- type DocsScriptMatcher =
638
- | string
639
- | string[]
640
- | RegExp
641
- | ((html: string) => boolean)
642
-
643
- interface DocsScriptDefinition {
644
- match?: DocsScriptMatcher
645
- render: () => string
646
- }
647
-
648
- type DocsScriptRegistry = Record<
649
- string,
650
- false | DocsScriptDefinition | (() => string)
651
- >
652
- ```
653
-
654
- Behavior:
655
-
656
- - Scripts are rendered per page after Markdown has been rendered.
657
- - If `match` is omitted, the script is included on every page.
658
- - A string matcher checks `html.includes(match)`.
659
- - An array matcher checks whether any string is present.
660
- - A RegExp matcher tests the rendered page HTML.
661
- - A function matcher receives the rendered page HTML and returns a boolean.
662
- - A script can be disabled by setting its registry value to `false` in an extending config.
663
-
664
- Layouts receive scripts through `props.headScripts` and `props.scripts`. Template layouts must insert them where appropriate.
71
+ with:
665
72
 
666
73
  ```js
667
- export default (props) => `
668
- <!doctype html>
669
- <html>
670
- <head>
671
- ${props.headScripts?.join('') || ''}
672
- </head>
673
- <body>
674
- ${props.content}
675
- ${props.scripts?.join('') || ''}
676
- </body>
677
- </html>`
678
- ```
679
-
680
- ## Theme Variables
681
-
682
- Templates can define theme variables in `template.config.js`:
683
-
684
- ```js
685
- export default {
686
- theme: {
687
- light: {
688
- '--background': 'oklch(0.98 0.006 250)',
689
- '--foreground': 'oklch(0.18 0.015 250)',
690
- '--primary': 'oklch(0.66 0.18 45)',
691
- },
692
- dark: {
693
- '--background': 'oklch(0.18 0.015 250)',
694
- '--foreground': 'oklch(0.96 0.005 250)',
695
- '--primary': 'oklch(0.74 0.18 45)',
696
- },
697
- },
698
- }
699
- ```
700
-
701
- Builder converts theme variables into:
702
-
703
- ```txt
704
- website/stylesheets/theme.css
705
- ```
706
-
707
- The generated file includes:
708
-
709
- - `:root` variables.
710
- - `@media (prefers-color-scheme: dark)` variables.
711
- - `[data-theme="light"]` variables.
712
- - `[data-theme="dark"]` variables.
713
-
714
- A theme mode can be disabled with `false`:
74
+ import { buildDocs } from '@beforesemicolon/site-builder/build-docs'
715
75
 
716
- ```js
717
- export default {
718
- theme: {
719
- light: false,
720
- },
721
- }
722
- ```
723
-
724
- When one mode is disabled, the remaining mode is emitted as `:root`. For example, `light: false` makes the dark theme the default theme and skips light-mode selectors and `prefers-color-scheme` switching.
725
-
726
- Page layouts receive:
727
-
728
- ```ts
729
- themeStylesheet?: string
730
- ```
731
-
732
- Templates should include it in `<head>`:
733
-
734
- ```js
735
- ${props.themeStylesheet ? `<link rel="stylesheet" href="${props.themeStylesheet}">` : ''}
736
- ```
737
-
738
- Docs sources can override only variable values by adding `docs/_template/template.config.js`.
739
-
740
- ## Generated Files
741
-
742
- `buildDocs()` can generate common root-level files into `publicDir`.
743
-
744
- Defaults:
745
-
746
- ```js
747
- generatedFiles: {
748
- sitemap: true,
749
- robots: true,
750
- llms: true,
751
- llmsFull: true,
752
- netlify: false,
753
- }
754
- ```
755
-
756
- Disable all generated files:
757
-
758
- ```js
759
- await buildDocs({
760
- generatedFiles: false,
761
- })
762
- ```
763
-
764
- Enable Netlify files:
765
-
766
- ```js
767
- await buildDocs({
768
- siteUrl: 'https://docs.example.com',
769
- generatedFiles: {
770
- netlify: true,
771
- },
772
- })
773
- ```
774
-
775
- Generated files:
776
-
777
- - `sitemap.xml`: generated from discovered Markdown pages. Requires `siteUrl`.
778
- - `robots.txt`: generated with `Allow: /` and a sitemap URL when `siteUrl` is provided.
779
- - `llms.txt`: generated page index for AI tools.
780
- - `llms-full.txt`: generated expanded page index with source paths, descriptions, and summaries.
781
- - `_redirects`: generated only when `generatedFiles.netlify` is `true`.
782
- - `netlify.toml`: generated only when `generatedFiles.netlify` is `true`.
783
-
784
- Source-first behavior:
785
-
786
- - If `docs/sitemap.xml` exists, it is copied to `publicDir/sitemap.xml` instead of generated.
787
- - If `docs/robots.txt` exists, it is copied to `publicDir/robots.txt` instead of generated.
788
- - If `docs/llms.txt` exists, it is copied to `publicDir/llms.txt` instead of generated.
789
- - If `docs/llms-full.txt` exists, it is copied to `publicDir/llms-full.txt` instead of generated.
790
- - If `generatedFiles.netlify` is `true` and `docs/_redirects` exists, it is copied to `publicDir/_redirects` instead of generated.
791
- - If `generatedFiles.netlify` is `true` and `docs/netlify.toml` exists, it is copied to `publicDir/netlify.toml` instead of generated.
792
-
793
- Netlify notes:
794
-
795
- - `_redirects` is treated as Netlify-specific.
796
- - `netlify.toml` is written to `publicDir`, not the project root.
797
- - Generated `netlify.toml` defaults to `command = "node build-docs.js"` and `publish = "website"` unless `publicDir` has a different basename.
798
-
799
- ## llms-full.txt Content
800
-
801
- The generated `llms-full.txt` is derived from discovered Markdown pages.
802
-
803
- For each page it uses:
804
-
805
- - `title`: front matter `title`, fallback to `name`, fallback to `Documentation`.
806
- - `description`: front matter `description`, fallback to stripped Markdown body text.
807
- - `URL`: file-derived page URL joined with `siteUrl`.
808
- - `Source`: relative Markdown source path.
809
- - `summary`: first 320 characters of stripped Markdown body text.
810
-
811
- The body summary is not the final rendered HTML. It is a lightweight Markdown text extraction used for AI-facing page discovery.
812
-
813
- ## Extension Example
814
-
815
- Project docs:
816
-
817
- ```txt
818
- docs/
819
- index.md
820
- _template/
821
- template.config.js
822
- assets/
823
- logo.svg
824
- layouts/
825
- pricing-cards.js
826
- ```
827
-
828
- `docs/_template/template.config.js`:
829
-
830
- ```js
831
- import pricingCards from './layouts/pricing-cards.js'
832
-
833
- export default {
834
- markdownLayouts: {
835
- 'pricing-cards': pricingCards,
836
- },
837
- headScripts: {
838
- analytics: () =>
839
- `<script async src="https://example.com/analytics.js"></script>`,
840
- },
841
- scripts: {
842
- pageView: {
843
- match: '<main',
844
- render: () => `<script>console.log('page viewed')</script>`,
845
- },
846
- },
847
- theme: {
848
- light: {
849
- '--primary': 'oklch(0.62 0.18 250)',
850
- },
851
- dark: {
852
- '--primary': 'oklch(0.78 0.16 250)',
853
- },
854
- },
855
- }
856
- ```
857
-
858
- `docs/index.md`:
859
-
860
- ```md
861
- ---
862
- title: Example
863
- description: Example documentation.
864
- layout: landing
865
- ---
866
-
867
- ::: layout pricing-cards featured
868
-
869
- ===
870
-
871
- ## Starter
872
-
873
- For small teams.
874
-
875
- ===
876
-
877
- ## Pro
878
-
879
- For growing teams.
880
-
881
- :::
882
- ```
883
-
884
- ## Build Output
885
-
886
- Given default options, output is written to:
887
-
888
- ```txt
889
- website/
890
- index.html
891
- guide/
892
- getting-started.html
893
- assets/
894
- stylesheets/
895
- scripts/
896
- robots.txt
897
- sitemap.xml
898
- llms.txt
899
- llms-full.txt
900
- ```
901
-
902
- If `generatedFiles.netlify` is `true`, output also includes:
903
-
904
- ```txt
905
- website/
906
- _redirects
907
- netlify.toml
908
- ```
909
-
910
- ## Package Scripts
911
-
912
- This repo provides:
913
-
914
- - `npm run build`: removes `dist`, emits TypeScript declarations, then builds package outputs.
915
- - `npm run lint`: runs ESLint and Prettier checks.
916
- - `npm run format`: runs ESLint autofix and Prettier write.
917
- - `npm test`: runs the Markdown layout parser/renderer tests.
918
-
919
- ## Development
920
-
921
- Install dependencies:
922
-
923
- ```sh
924
- npm install
925
- ```
926
-
927
- Run checks:
928
-
929
- ```sh
930
- npm run lint
931
- npm test
932
- npm run build
933
- ```
934
-
935
- Pack locally:
936
-
937
- ```sh
938
- npm pack
939
- ```
940
-
941
- Install the packed artifact into a sibling project:
942
-
943
- ```sh
944
- npm install ../builder/beforesemicolon-builder-<version>.tgz
76
+ await buildDocs()
945
77
  ```
946
78
 
947
- ## Implementation Notes
948
-
949
- - Markdown rendering uses `marked`.
950
- - Syntax highlighting uses `marked-highlight` and `highlight.js`.
951
- - Front matter parsing uses `front-matter`.
952
- - HTML is sanitized with `isomorphic-dompurify`.
953
- - HTML output is minified with `html-minifier`.
954
- - CSS output is minified with `clean-css`.
955
- - JS output copied from docs script folders is minified with `@putout/minify`.
956
- - Static module and browser builds use `esbuild`.
79
+ Configure Markdown documentation builds with `site.config.json` in the target
80
+ project. Builder does not retain a deprecated alias or compatibility layer for
81
+ the removed documentation API.
957
82
 
958
83
  ## License
959
84
 
960
- BSD-3-Clause. See `package.json`.
85
+ BSD-3-Clause