jamdesk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (435) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +323 -0
  3. package/bin/jamdesk.js +76 -0
  4. package/dist/__tests__/integration/deprecated-components.integration.test.d.ts +8 -0
  5. package/dist/__tests__/integration/deprecated-components.integration.test.d.ts.map +1 -0
  6. package/dist/__tests__/integration/deprecated-components.integration.test.js +165 -0
  7. package/dist/__tests__/integration/deprecated-components.integration.test.js.map +1 -0
  8. package/dist/__tests__/integration/migrate.integration.test.d.ts +2 -0
  9. package/dist/__tests__/integration/migrate.integration.test.d.ts.map +1 -0
  10. package/dist/__tests__/integration/migrate.integration.test.js +64 -0
  11. package/dist/__tests__/integration/migrate.integration.test.js.map +1 -0
  12. package/dist/__tests__/integration/prepublish.integration.test.d.ts +2 -0
  13. package/dist/__tests__/integration/prepublish.integration.test.d.ts.map +1 -0
  14. package/dist/__tests__/integration/prepublish.integration.test.js +27 -0
  15. package/dist/__tests__/integration/prepublish.integration.test.js.map +1 -0
  16. package/dist/__tests__/integration/validate.integration.test.d.ts +2 -0
  17. package/dist/__tests__/integration/validate.integration.test.d.ts.map +1 -0
  18. package/dist/__tests__/integration/validate.integration.test.js +56 -0
  19. package/dist/__tests__/integration/validate.integration.test.js.map +1 -0
  20. package/dist/__tests__/unit/deploy-templates.test.d.ts +2 -0
  21. package/dist/__tests__/unit/deploy-templates.test.d.ts.map +1 -0
  22. package/dist/__tests__/unit/deploy-templates.test.js +124 -0
  23. package/dist/__tests__/unit/deploy-templates.test.js.map +1 -0
  24. package/dist/__tests__/unit/deprecated-components-sync.test.d.ts +2 -0
  25. package/dist/__tests__/unit/deprecated-components-sync.test.d.ts.map +1 -0
  26. package/dist/__tests__/unit/deprecated-components-sync.test.js +69 -0
  27. package/dist/__tests__/unit/deprecated-components-sync.test.js.map +1 -0
  28. package/dist/__tests__/unit/deps-sync.test.d.ts +14 -0
  29. package/dist/__tests__/unit/deps-sync.test.d.ts.map +1 -0
  30. package/dist/__tests__/unit/deps-sync.test.js +166 -0
  31. package/dist/__tests__/unit/deps-sync.test.js.map +1 -0
  32. package/dist/__tests__/unit/docs-config.test.d.ts +2 -0
  33. package/dist/__tests__/unit/docs-config.test.d.ts.map +1 -0
  34. package/dist/__tests__/unit/docs-config.test.js +288 -0
  35. package/dist/__tests__/unit/docs-config.test.js.map +1 -0
  36. package/dist/__tests__/unit/errors.test.d.ts +2 -0
  37. package/dist/__tests__/unit/errors.test.d.ts.map +1 -0
  38. package/dist/__tests__/unit/errors.test.js +27 -0
  39. package/dist/__tests__/unit/errors.test.js.map +1 -0
  40. package/dist/__tests__/unit/extract-hooks.test.d.ts +5 -0
  41. package/dist/__tests__/unit/extract-hooks.test.d.ts.map +1 -0
  42. package/dist/__tests__/unit/extract-hooks.test.js +205 -0
  43. package/dist/__tests__/unit/extract-hooks.test.js.map +1 -0
  44. package/dist/__tests__/unit/frontmatter-sync.test.d.ts +8 -0
  45. package/dist/__tests__/unit/frontmatter-sync.test.d.ts.map +1 -0
  46. package/dist/__tests__/unit/frontmatter-sync.test.js +26 -0
  47. package/dist/__tests__/unit/frontmatter-sync.test.js.map +1 -0
  48. package/dist/__tests__/unit/mdx-validator.test.d.ts +2 -0
  49. package/dist/__tests__/unit/mdx-validator.test.d.ts.map +1 -0
  50. package/dist/__tests__/unit/mdx-validator.test.js +264 -0
  51. package/dist/__tests__/unit/mdx-validator.test.js.map +1 -0
  52. package/dist/__tests__/unit/migrate-convert.test.d.ts +2 -0
  53. package/dist/__tests__/unit/migrate-convert.test.d.ts.map +1 -0
  54. package/dist/__tests__/unit/migrate-convert.test.js +297 -0
  55. package/dist/__tests__/unit/migrate-convert.test.js.map +1 -0
  56. package/dist/__tests__/unit/migrate-detect.test.d.ts +2 -0
  57. package/dist/__tests__/unit/migrate-detect.test.d.ts.map +1 -0
  58. package/dist/__tests__/unit/migrate-detect.test.js +35 -0
  59. package/dist/__tests__/unit/migrate-detect.test.js.map +1 -0
  60. package/dist/__tests__/unit/migrate-mdx.test.d.ts +2 -0
  61. package/dist/__tests__/unit/migrate-mdx.test.d.ts.map +1 -0
  62. package/dist/__tests__/unit/migrate-mdx.test.js +158 -0
  63. package/dist/__tests__/unit/migrate-mdx.test.js.map +1 -0
  64. package/dist/__tests__/unit/openapi.test.d.ts +2 -0
  65. package/dist/__tests__/unit/openapi.test.d.ts.map +1 -0
  66. package/dist/__tests__/unit/openapi.test.js +52 -0
  67. package/dist/__tests__/unit/openapi.test.js.map +1 -0
  68. package/dist/__tests__/unit/package-config.test.d.ts +2 -0
  69. package/dist/__tests__/unit/package-config.test.d.ts.map +1 -0
  70. package/dist/__tests__/unit/package-config.test.js +63 -0
  71. package/dist/__tests__/unit/package-config.test.js.map +1 -0
  72. package/dist/__tests__/unit/port.test.d.ts +2 -0
  73. package/dist/__tests__/unit/port.test.d.ts.map +1 -0
  74. package/dist/__tests__/unit/port.test.js +20 -0
  75. package/dist/__tests__/unit/port.test.js.map +1 -0
  76. package/dist/__tests__/unit/vendored-sync.test.d.ts +14 -0
  77. package/dist/__tests__/unit/vendored-sync.test.d.ts.map +1 -0
  78. package/dist/__tests__/unit/vendored-sync.test.js +90 -0
  79. package/dist/__tests__/unit/vendored-sync.test.js.map +1 -0
  80. package/dist/commands/broken-links.d.ts +11 -0
  81. package/dist/commands/broken-links.d.ts.map +1 -0
  82. package/dist/commands/broken-links.js +95 -0
  83. package/dist/commands/broken-links.js.map +1 -0
  84. package/dist/commands/clean.d.ts +7 -0
  85. package/dist/commands/clean.d.ts.map +1 -0
  86. package/dist/commands/clean.js +59 -0
  87. package/dist/commands/clean.js.map +1 -0
  88. package/dist/commands/deploy/cloudflare.d.ts +12 -0
  89. package/dist/commands/deploy/cloudflare.d.ts.map +1 -0
  90. package/dist/commands/deploy/cloudflare.js +409 -0
  91. package/dist/commands/deploy/cloudflare.js.map +1 -0
  92. package/dist/commands/deploy/templates.d.ts +23 -0
  93. package/dist/commands/deploy/templates.d.ts.map +1 -0
  94. package/dist/commands/deploy/templates.js +179 -0
  95. package/dist/commands/deploy/templates.js.map +1 -0
  96. package/dist/commands/deploy/types.d.ts +19 -0
  97. package/dist/commands/deploy/types.d.ts.map +1 -0
  98. package/dist/commands/deploy/types.js +5 -0
  99. package/dist/commands/deploy/types.js.map +1 -0
  100. package/dist/commands/dev.d.ts +14 -0
  101. package/dist/commands/dev.d.ts.map +1 -0
  102. package/dist/commands/dev.js +817 -0
  103. package/dist/commands/dev.js.map +1 -0
  104. package/dist/commands/doctor.d.ts +7 -0
  105. package/dist/commands/doctor.d.ts.map +1 -0
  106. package/dist/commands/doctor.js +159 -0
  107. package/dist/commands/doctor.js.map +1 -0
  108. package/dist/commands/init.d.ts +7 -0
  109. package/dist/commands/init.d.ts.map +1 -0
  110. package/dist/commands/init.js +96 -0
  111. package/dist/commands/init.js.map +1 -0
  112. package/dist/commands/migrate/convert-mdx.d.ts +50 -0
  113. package/dist/commands/migrate/convert-mdx.d.ts.map +1 -0
  114. package/dist/commands/migrate/convert-mdx.js +108 -0
  115. package/dist/commands/migrate/convert-mdx.js.map +1 -0
  116. package/dist/commands/migrate/convert.d.ts +80 -0
  117. package/dist/commands/migrate/convert.d.ts.map +1 -0
  118. package/dist/commands/migrate/convert.js +158 -0
  119. package/dist/commands/migrate/convert.js.map +1 -0
  120. package/dist/commands/migrate/detect.d.ts +31 -0
  121. package/dist/commands/migrate/detect.d.ts.map +1 -0
  122. package/dist/commands/migrate/detect.js +62 -0
  123. package/dist/commands/migrate/detect.js.map +1 -0
  124. package/dist/commands/migrate/extract-hooks.d.ts +71 -0
  125. package/dist/commands/migrate/extract-hooks.d.ts.map +1 -0
  126. package/dist/commands/migrate/extract-hooks.js +473 -0
  127. package/dist/commands/migrate/extract-hooks.js.map +1 -0
  128. package/dist/commands/migrate/index.d.ts +17 -0
  129. package/dist/commands/migrate/index.d.ts.map +1 -0
  130. package/dist/commands/migrate/index.js +282 -0
  131. package/dist/commands/migrate/index.js.map +1 -0
  132. package/dist/commands/migrate/prompts.d.ts +22 -0
  133. package/dist/commands/migrate/prompts.d.ts.map +1 -0
  134. package/dist/commands/migrate/prompts.js +67 -0
  135. package/dist/commands/migrate/prompts.js.map +1 -0
  136. package/dist/commands/migrate/types.d.ts +22 -0
  137. package/dist/commands/migrate/types.d.ts.map +1 -0
  138. package/dist/commands/migrate/types.js +26 -0
  139. package/dist/commands/migrate/types.js.map +1 -0
  140. package/dist/commands/openapi-check.d.ts +11 -0
  141. package/dist/commands/openapi-check.d.ts.map +1 -0
  142. package/dist/commands/openapi-check.js +88 -0
  143. package/dist/commands/openapi-check.js.map +1 -0
  144. package/dist/commands/rename.d.ts +10 -0
  145. package/dist/commands/rename.d.ts.map +1 -0
  146. package/dist/commands/rename.js +125 -0
  147. package/dist/commands/rename.js.map +1 -0
  148. package/dist/commands/update.d.ts +10 -0
  149. package/dist/commands/update.d.ts.map +1 -0
  150. package/dist/commands/update.js +57 -0
  151. package/dist/commands/update.js.map +1 -0
  152. package/dist/commands/validate.d.ts +12 -0
  153. package/dist/commands/validate.d.ts.map +1 -0
  154. package/dist/commands/validate.js +163 -0
  155. package/dist/commands/validate.js.map +1 -0
  156. package/dist/index.d.ts +9 -0
  157. package/dist/index.d.ts.map +1 -0
  158. package/dist/index.js +334 -0
  159. package/dist/index.js.map +1 -0
  160. package/dist/lib/config.d.ts +7 -0
  161. package/dist/lib/config.d.ts.map +1 -0
  162. package/dist/lib/config.js +18 -0
  163. package/dist/lib/config.js.map +1 -0
  164. package/dist/lib/deprecated-components.d.ts +72 -0
  165. package/dist/lib/deprecated-components.d.ts.map +1 -0
  166. package/dist/lib/deprecated-components.js +138 -0
  167. package/dist/lib/deprecated-components.js.map +1 -0
  168. package/dist/lib/deps.d.ts +17 -0
  169. package/dist/lib/deps.d.ts.map +1 -0
  170. package/dist/lib/deps.js +186 -0
  171. package/dist/lib/deps.js.map +1 -0
  172. package/dist/lib/docs-config.d.ts +67 -0
  173. package/dist/lib/docs-config.d.ts.map +1 -0
  174. package/dist/lib/docs-config.js +294 -0
  175. package/dist/lib/docs-config.js.map +1 -0
  176. package/dist/lib/errors.d.ts +23 -0
  177. package/dist/lib/errors.d.ts.map +1 -0
  178. package/dist/lib/errors.js +32 -0
  179. package/dist/lib/errors.js.map +1 -0
  180. package/dist/lib/frontmatter-utils.d.ts +25 -0
  181. package/dist/lib/frontmatter-utils.d.ts.map +1 -0
  182. package/dist/lib/frontmatter-utils.js +64 -0
  183. package/dist/lib/frontmatter-utils.js.map +1 -0
  184. package/dist/lib/mdx-validator.d.ts +27 -0
  185. package/dist/lib/mdx-validator.d.ts.map +1 -0
  186. package/dist/lib/mdx-validator.js +148 -0
  187. package/dist/lib/mdx-validator.js.map +1 -0
  188. package/dist/lib/navigation-validator.d.ts +31 -0
  189. package/dist/lib/navigation-validator.d.ts.map +1 -0
  190. package/dist/lib/navigation-validator.js +75 -0
  191. package/dist/lib/navigation-validator.js.map +1 -0
  192. package/dist/lib/normalize-config.d.ts +57 -0
  193. package/dist/lib/normalize-config.d.ts.map +1 -0
  194. package/dist/lib/normalize-config.js +63 -0
  195. package/dist/lib/normalize-config.js.map +1 -0
  196. package/dist/lib/openapi/cache.d.ts +40 -0
  197. package/dist/lib/openapi/cache.d.ts.map +1 -0
  198. package/dist/lib/openapi/cache.js +76 -0
  199. package/dist/lib/openapi/cache.js.map +1 -0
  200. package/dist/lib/openapi/errors.d.ts +36 -0
  201. package/dist/lib/openapi/errors.d.ts.map +1 -0
  202. package/dist/lib/openapi/errors.js +162 -0
  203. package/dist/lib/openapi/errors.js.map +1 -0
  204. package/dist/lib/openapi/index.d.ts +10 -0
  205. package/dist/lib/openapi/index.d.ts.map +1 -0
  206. package/dist/lib/openapi/index.js +12 -0
  207. package/dist/lib/openapi/index.js.map +1 -0
  208. package/dist/lib/openapi/types.d.ts +198 -0
  209. package/dist/lib/openapi/types.d.ts.map +1 -0
  210. package/dist/lib/openapi/types.js +8 -0
  211. package/dist/lib/openapi/types.js.map +1 -0
  212. package/dist/lib/openapi/validator.d.ts +45 -0
  213. package/dist/lib/openapi/validator.d.ts.map +1 -0
  214. package/dist/lib/openapi/validator.js +128 -0
  215. package/dist/lib/openapi/validator.js.map +1 -0
  216. package/dist/lib/openapi.d.ts +7 -0
  217. package/dist/lib/openapi.d.ts.map +1 -0
  218. package/dist/lib/openapi.js +7 -0
  219. package/dist/lib/openapi.js.map +1 -0
  220. package/dist/lib/output.d.ts +14 -0
  221. package/dist/lib/output.d.ts.map +1 -0
  222. package/dist/lib/output.js +19 -0
  223. package/dist/lib/output.js.map +1 -0
  224. package/dist/lib/path-security.d.ts +23 -0
  225. package/dist/lib/path-security.d.ts.map +1 -0
  226. package/dist/lib/path-security.js +35 -0
  227. package/dist/lib/path-security.js.map +1 -0
  228. package/dist/lib/port.d.ts +18 -0
  229. package/dist/lib/port.d.ts.map +1 -0
  230. package/dist/lib/port.js +65 -0
  231. package/dist/lib/port.js.map +1 -0
  232. package/dist/lib/spinner.d.ts +4 -0
  233. package/dist/lib/spinner.d.ts.map +1 -0
  234. package/dist/lib/spinner.js +16 -0
  235. package/dist/lib/spinner.js.map +1 -0
  236. package/dist/lib/version.d.ts +2 -0
  237. package/dist/lib/version.d.ts.map +1 -0
  238. package/dist/lib/version.js +49 -0
  239. package/dist/lib/version.js.map +1 -0
  240. package/dist/utils/update-checker.d.ts +34 -0
  241. package/dist/utils/update-checker.d.ts.map +1 -0
  242. package/dist/utils/update-checker.js +142 -0
  243. package/dist/utils/update-checker.js.map +1 -0
  244. package/package.json +125 -0
  245. package/templates/docs.json +11 -0
  246. package/templates/introduction.mdx +19 -0
  247. package/templates/quickstart.mdx +20 -0
  248. package/vendored/app/[[...slug]]/error.tsx +103 -0
  249. package/vendored/app/[[...slug]]/page.tsx +690 -0
  250. package/vendored/app/api/assets/[...path]/route.ts +78 -0
  251. package/vendored/app/api/ev/route.ts +61 -0
  252. package/vendored/app/api/isr-health/route.ts +66 -0
  253. package/vendored/app/api/mcp/[project]/route.ts +435 -0
  254. package/vendored/app/api/og/route.tsx +167 -0
  255. package/vendored/app/api/r2/[project]/[...path]/route.ts +214 -0
  256. package/vendored/app/api/revalidate/route.ts +76 -0
  257. package/vendored/app/globals.css +37 -0
  258. package/vendored/app/layout.tsx +571 -0
  259. package/vendored/app/not-found.tsx +47 -0
  260. package/vendored/components/CodeBlockCopyButton.tsx +146 -0
  261. package/vendored/components/HeaderLinkCopy.tsx +135 -0
  262. package/vendored/components/errors/NotFoundContent.tsx +147 -0
  263. package/vendored/components/layout/LayoutWrapper.tsx +128 -0
  264. package/vendored/components/mdx/Accordion.tsx +91 -0
  265. package/vendored/components/mdx/ApiCodePanel.tsx +51 -0
  266. package/vendored/components/mdx/ApiEndpoint.tsx +104 -0
  267. package/vendored/components/mdx/ApiPage.tsx +379 -0
  268. package/vendored/components/mdx/Badge.tsx +169 -0
  269. package/vendored/components/mdx/Callouts.tsx +140 -0
  270. package/vendored/components/mdx/Card.tsx +214 -0
  271. package/vendored/components/mdx/CodeGroup.tsx +136 -0
  272. package/vendored/components/mdx/Color.tsx +244 -0
  273. package/vendored/components/mdx/Columns.tsx +37 -0
  274. package/vendored/components/mdx/Expandable.tsx +37 -0
  275. package/vendored/components/mdx/Frame.tsx +51 -0
  276. package/vendored/components/mdx/Icon.tsx +132 -0
  277. package/vendored/components/mdx/Latex.tsx +75 -0
  278. package/vendored/components/mdx/MDXComponents.tsx +414 -0
  279. package/vendored/components/mdx/Mermaid.tsx +35 -0
  280. package/vendored/components/mdx/MermaidInner.tsx +342 -0
  281. package/vendored/components/mdx/OpenApiEndpoint.tsx +971 -0
  282. package/vendored/components/mdx/Panel.tsx +26 -0
  283. package/vendored/components/mdx/PanelWrapper.tsx +100 -0
  284. package/vendored/components/mdx/ParamField.tsx +75 -0
  285. package/vendored/components/mdx/RequestExample.tsx +91 -0
  286. package/vendored/components/mdx/ResponseExample.tsx +145 -0
  287. package/vendored/components/mdx/ResponseField.tsx +109 -0
  288. package/vendored/components/mdx/Steps.tsx +173 -0
  289. package/vendored/components/mdx/Table.tsx +352 -0
  290. package/vendored/components/mdx/Tabs.tsx +147 -0
  291. package/vendored/components/mdx/Tile.tsx +127 -0
  292. package/vendored/components/mdx/Tooltip.tsx +111 -0
  293. package/vendored/components/mdx/Tree.tsx +484 -0
  294. package/vendored/components/mdx/Update.tsx +90 -0
  295. package/vendored/components/mdx/View.tsx +354 -0
  296. package/vendored/components/mdx/YouTube.tsx +35 -0
  297. package/vendored/components/mdx/ZoomableImage.tsx +83 -0
  298. package/vendored/components/navigation/Breadcrumb.tsx +241 -0
  299. package/vendored/components/navigation/DefaultLogo.tsx +81 -0
  300. package/vendored/components/navigation/Header.tsx +512 -0
  301. package/vendored/components/navigation/LanguageSelector.tsx +249 -0
  302. package/vendored/components/navigation/PageNavigation.tsx +174 -0
  303. package/vendored/components/navigation/Sidebar.tsx +713 -0
  304. package/vendored/components/navigation/SocialFooter.tsx +186 -0
  305. package/vendored/components/navigation/TableOfContents.tsx +435 -0
  306. package/vendored/components/navigation/TabsNav.tsx +182 -0
  307. package/vendored/components/search/LazySearchModal.tsx +19 -0
  308. package/vendored/components/search/SearchModal.tsx +573 -0
  309. package/vendored/components/snippets/ProjectSnippets.tsx +4 -0
  310. package/vendored/components/theme/ThemeProvider.tsx +31 -0
  311. package/vendored/components/theme/ThemeToggle.tsx +134 -0
  312. package/vendored/components/ui/CodePanel.tsx +517 -0
  313. package/vendored/components/ui/CodePanelModal.tsx +342 -0
  314. package/vendored/contexts/TabSyncContext.tsx +30 -0
  315. package/vendored/hooks/useFocusTrap.ts +42 -0
  316. package/vendored/hooks/useHashNavigation.ts +39 -0
  317. package/vendored/hooks/useShikiHighlight.ts +101 -0
  318. package/vendored/lib/analytics-client.ts +77 -0
  319. package/vendored/lib/build/cache.ts +138 -0
  320. package/vendored/lib/build/error-parser.ts +690 -0
  321. package/vendored/lib/build/estimation.ts +113 -0
  322. package/vendored/lib/build/index.ts +17 -0
  323. package/vendored/lib/build/page-file-map.ts +48 -0
  324. package/vendored/lib/build/r2-upload.ts +179 -0
  325. package/vendored/lib/cache-keys.ts +117 -0
  326. package/vendored/lib/code-utils.ts +42 -0
  327. package/vendored/lib/content-loader.ts +176 -0
  328. package/vendored/lib/deprecated-components.ts +185 -0
  329. package/vendored/lib/docs-isr.ts +180 -0
  330. package/vendored/lib/docs-types.ts +874 -0
  331. package/vendored/lib/docs.ts +203 -0
  332. package/vendored/lib/domain-helpers.ts +107 -0
  333. package/vendored/lib/email-notifier.ts +102 -0
  334. package/vendored/lib/email-templates/build-failure.tsx +193 -0
  335. package/vendored/lib/email-templates/components/base-layout.tsx +150 -0
  336. package/vendored/lib/email-templates/components/error-box.tsx +88 -0
  337. package/vendored/lib/email-templates/components/info-row.tsx +63 -0
  338. package/vendored/lib/email-templates/index.ts +13 -0
  339. package/vendored/lib/empty-polyfill.js +3 -0
  340. package/vendored/lib/extract-highlights.ts +124 -0
  341. package/vendored/lib/fonts.ts +227 -0
  342. package/vendored/lib/frontmatter-utils.ts +77 -0
  343. package/vendored/lib/fs-utils.ts +20 -0
  344. package/vendored/lib/git-utils.ts +87 -0
  345. package/vendored/lib/health-checks.ts +224 -0
  346. package/vendored/lib/icon-utils.ts +492 -0
  347. package/vendored/lib/infer-page-type.ts +14 -0
  348. package/vendored/lib/isr-build-executor.ts +185 -0
  349. package/vendored/lib/language-icons.ts +152 -0
  350. package/vendored/lib/language-utils.ts +338 -0
  351. package/vendored/lib/latex-config.ts +64 -0
  352. package/vendored/lib/link-prefix-context.tsx +32 -0
  353. package/vendored/lib/logger.ts +63 -0
  354. package/vendored/lib/mcp-search.ts +255 -0
  355. package/vendored/lib/mdx-inline-components.ts +155 -0
  356. package/vendored/lib/mdx.ts +100 -0
  357. package/vendored/lib/middleware-helpers.ts +519 -0
  358. package/vendored/lib/navigation-resolver.ts +621 -0
  359. package/vendored/lib/navigation-utils.ts +103 -0
  360. package/vendored/lib/normalize-config.ts +94 -0
  361. package/vendored/lib/openapi/cache.ts +92 -0
  362. package/vendored/lib/openapi/code-examples.ts +389 -0
  363. package/vendored/lib/openapi/errors.ts +253 -0
  364. package/vendored/lib/openapi/generator.ts +230 -0
  365. package/vendored/lib/openapi/index.ts +84 -0
  366. package/vendored/lib/openapi/parser.ts +474 -0
  367. package/vendored/lib/openapi/types.ts +232 -0
  368. package/vendored/lib/openapi/validator.ts +156 -0
  369. package/vendored/lib/openapi-isr.ts +121 -0
  370. package/vendored/lib/page-isr-helpers.ts +137 -0
  371. package/vendored/lib/path-safety.ts +130 -0
  372. package/vendored/lib/paths.ts +35 -0
  373. package/vendored/lib/preprocess-mdx.ts +951 -0
  374. package/vendored/lib/process-mdx-with-exports.ts +75 -0
  375. package/vendored/lib/project-resolver.ts +165 -0
  376. package/vendored/lib/r2-content.ts +60 -0
  377. package/vendored/lib/r2-manifest.ts +84 -0
  378. package/vendored/lib/recent-searches.ts +41 -0
  379. package/vendored/lib/recma-compound-components.ts +84 -0
  380. package/vendored/lib/redirect-compiler.ts +160 -0
  381. package/vendored/lib/redirect-matcher.ts +296 -0
  382. package/vendored/lib/redis.ts +23 -0
  383. package/vendored/lib/rehype-class-to-classname.ts +31 -0
  384. package/vendored/lib/rehype-code-meta.ts +275 -0
  385. package/vendored/lib/rehype-nozoom-to-data.ts +45 -0
  386. package/vendored/lib/remark-extract-exports.ts +104 -0
  387. package/vendored/lib/resilience.ts +260 -0
  388. package/vendored/lib/revalidation-helpers.ts +200 -0
  389. package/vendored/lib/revalidation-trigger.ts +150 -0
  390. package/vendored/lib/screenshot-capture.ts +229 -0
  391. package/vendored/lib/search-client.ts +91 -0
  392. package/vendored/lib/search-suggestions.ts +38 -0
  393. package/vendored/lib/search.ts +158 -0
  394. package/vendored/lib/seo.ts +264 -0
  395. package/vendored/lib/shiki-client.ts +131 -0
  396. package/vendored/lib/shiki-config.ts +289 -0
  397. package/vendored/lib/shiki-css-theme.ts +46 -0
  398. package/vendored/lib/shiki-highlighter.ts +62 -0
  399. package/vendored/lib/shiki-transformers.ts +337 -0
  400. package/vendored/lib/slack-notifier.ts +248 -0
  401. package/vendored/lib/snippet-compiler-isr.ts +114 -0
  402. package/vendored/lib/snippet-loader-isr.ts +276 -0
  403. package/vendored/lib/static-artifacts.ts +375 -0
  404. package/vendored/lib/static-file-route.ts +72 -0
  405. package/vendored/lib/tracking-script.ts +19 -0
  406. package/vendored/lib/typography-config.ts +42 -0
  407. package/vendored/lib/validate-config.ts +268 -0
  408. package/vendored/next.config.js +45 -0
  409. package/vendored/postcss.config.js +6 -0
  410. package/vendored/schema/README.md +28 -0
  411. package/vendored/schema/docs-schema.json +4631 -0
  412. package/vendored/scripts/build-project.cjs +174 -0
  413. package/vendored/scripts/build-search-index.cjs +347 -0
  414. package/vendored/scripts/compile-snippets.cjs +488 -0
  415. package/vendored/scripts/copy-files.cjs +295 -0
  416. package/vendored/scripts/dev-project.cjs +534 -0
  417. package/vendored/scripts/enhance-navigation.cjs +354 -0
  418. package/vendored/scripts/validate-links.cjs +423 -0
  419. package/vendored/shared/constants.ts +6 -0
  420. package/vendored/shared/index.ts +19 -0
  421. package/vendored/shared/logger.ts +62 -0
  422. package/vendored/shared/memory-monitor.ts +190 -0
  423. package/vendored/shared/navigation-validator.ts +101 -0
  424. package/vendored/shared/path-security.ts +39 -0
  425. package/vendored/shared/status-reporter.ts +199 -0
  426. package/vendored/shared/timer.ts +51 -0
  427. package/vendored/shared/types.ts +102 -0
  428. package/vendored/tailwind.config.ts +39 -0
  429. package/vendored/themes/base.css +1311 -0
  430. package/vendored/themes/index.ts +119 -0
  431. package/vendored/themes/jam/variables.css +835 -0
  432. package/vendored/themes/nebula/variables.css +282 -0
  433. package/vendored/themes/pulsar/variables.css +1009 -0
  434. package/vendored/themes/types.ts +89 -0
  435. package/vendored/tsconfig.json +48 -0
@@ -0,0 +1,288 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = path.dirname(__filename);
6
+ const fixturesDir = path.join(__dirname, '../fixtures');
7
+ import { parseConfig, formatValidationErrors, validateConfig, getAllPagePaths, } from '../../lib/docs-config.js';
8
+ describe('docs-config', () => {
9
+ describe('parseConfig', () => {
10
+ it('parses valid JSON', () => {
11
+ const config = parseConfig('{"name": "Test", "theme": "pulsar"}');
12
+ expect(config.name).toBe('Test');
13
+ expect(config.theme).toBe('pulsar');
14
+ });
15
+ it('parses JSON5 with comments', () => {
16
+ const json5 = `{
17
+ // Site configuration
18
+ "name": "My Docs",
19
+ /* Multi-line
20
+ comment */
21
+ "theme": "jam",
22
+ }`;
23
+ const config = parseConfig(json5);
24
+ expect(config.name).toBe('My Docs');
25
+ expect(config.theme).toBe('jam');
26
+ });
27
+ it('parses JSON5 with unquoted keys', () => {
28
+ const json5 = `{
29
+ name: "Test",
30
+ theme: "nebula",
31
+ }`;
32
+ const config = parseConfig(json5);
33
+ expect(config.name).toBe('Test');
34
+ });
35
+ it('throws on completely invalid input', () => {
36
+ expect(() => parseConfig('{{{{not valid')).toThrow();
37
+ });
38
+ });
39
+ describe('formatValidationErrors', () => {
40
+ it('returns unknown error for empty array', () => {
41
+ expect(formatValidationErrors([])).toBe('Unknown validation error');
42
+ });
43
+ it('returns unknown error for null', () => {
44
+ expect(formatValidationErrors(null)).toBe('Unknown validation error');
45
+ });
46
+ it('formats required property errors', () => {
47
+ const errors = [{
48
+ keyword: 'required',
49
+ instancePath: '',
50
+ params: { missingProperty: 'name' },
51
+ message: 'must have required property',
52
+ schemaPath: '#/required',
53
+ }];
54
+ const result = formatValidationErrors(errors);
55
+ expect(result).toContain('Missing required field');
56
+ expect(result).toContain('name');
57
+ });
58
+ it('formats additionalProperties errors', () => {
59
+ const errors = [{
60
+ keyword: 'additionalProperties',
61
+ instancePath: '',
62
+ params: { additionalProperty: 'unknownField' },
63
+ message: 'must NOT have additional properties',
64
+ schemaPath: '#/additionalProperties',
65
+ }];
66
+ const result = formatValidationErrors(errors);
67
+ expect(result).toContain('Unknown property');
68
+ expect(result).toContain('unknownField');
69
+ });
70
+ it('shows ...and X more for many errors', () => {
71
+ // Create 13 errors to exceed the 10-error limit
72
+ const errors = Array(13).fill(null).map((_, i) => ({
73
+ keyword: 'type',
74
+ instancePath: `/field${i}`,
75
+ params: { type: 'string' },
76
+ message: 'must be string',
77
+ schemaPath: '#/type',
78
+ }));
79
+ const result = formatValidationErrors(errors);
80
+ expect(result).toContain('...and 3 more error(s)');
81
+ });
82
+ it('filters out theme const errors from wrong anyOf branches', () => {
83
+ // Simulate AJV errors when theme is "jam" but schema has anyOf for jam/nebula/pulsar
84
+ const errors = [
85
+ // Real error from the matching branch
86
+ {
87
+ keyword: 'required',
88
+ instancePath: '/colors',
89
+ params: { missingProperty: 'primary' },
90
+ message: 'must have required property',
91
+ schemaPath: '#/anyOf/0/required',
92
+ },
93
+ // Noise: const error from wrong branch (nebula)
94
+ {
95
+ keyword: 'const',
96
+ instancePath: '/theme',
97
+ params: { allowedValue: 'nebula' },
98
+ message: 'must be equal to constant',
99
+ schemaPath: '#/anyOf/1/properties/theme/const',
100
+ },
101
+ // Noise: const error from wrong branch (pulsar)
102
+ {
103
+ keyword: 'const',
104
+ instancePath: '/theme',
105
+ params: { allowedValue: 'pulsar' },
106
+ message: 'must be equal to constant',
107
+ schemaPath: '#/anyOf/2/properties/theme/const',
108
+ },
109
+ ];
110
+ const result = formatValidationErrors(errors);
111
+ expect(result).toContain('Missing required field "primary"');
112
+ expect(result).not.toContain('nebula');
113
+ expect(result).not.toContain('pulsar');
114
+ });
115
+ it('filters out generic anyOf errors', () => {
116
+ const errors = [
117
+ {
118
+ keyword: 'required',
119
+ instancePath: '/colors',
120
+ params: { missingProperty: 'primary' },
121
+ message: 'must have required property',
122
+ schemaPath: '#/anyOf/0/required',
123
+ },
124
+ // Generic anyOf error that's not actionable
125
+ {
126
+ keyword: 'anyOf',
127
+ instancePath: '',
128
+ params: {},
129
+ message: 'must match a schema in anyOf',
130
+ schemaPath: '#/anyOf',
131
+ },
132
+ ];
133
+ const result = formatValidationErrors(errors);
134
+ expect(result).toContain('Missing required field "primary"');
135
+ expect(result).not.toContain('must match a schema');
136
+ });
137
+ it('deduplicates identical errors', () => {
138
+ // Same error appearing multiple times (from different anyOf branches)
139
+ const errors = [
140
+ {
141
+ keyword: 'required',
142
+ instancePath: '/colors',
143
+ params: { missingProperty: 'primary' },
144
+ message: 'must have required property',
145
+ schemaPath: '#/anyOf/0/required',
146
+ },
147
+ {
148
+ keyword: 'required',
149
+ instancePath: '/colors',
150
+ params: { missingProperty: 'primary' },
151
+ message: 'must have required property',
152
+ schemaPath: '#/anyOf/1/required',
153
+ },
154
+ {
155
+ keyword: 'required',
156
+ instancePath: '/colors',
157
+ params: { missingProperty: 'primary' },
158
+ message: 'must have required property',
159
+ schemaPath: '#/anyOf/2/required',
160
+ },
161
+ ];
162
+ const result = formatValidationErrors(errors);
163
+ // Should only appear once
164
+ const matches = result.match(/Missing required field "primary"/g);
165
+ expect(matches).toHaveLength(1);
166
+ });
167
+ });
168
+ describe('validateConfig', () => {
169
+ it('returns error for missing file', async () => {
170
+ const result = await validateConfig('/does/not/exist/docs.json');
171
+ expect(result.valid).toBe(false);
172
+ expect(result.error).toContain('not found');
173
+ });
174
+ it('validates valid config', async () => {
175
+ const configPath = path.join(fixturesDir, 'valid-project/docs.json');
176
+ const result = await validateConfig(configPath);
177
+ expect(result.valid).toBe(true);
178
+ expect(result.config?.name).toBe('Valid Project');
179
+ expect(result.config?.theme).toBe('nebula');
180
+ });
181
+ it('rejects config without name', async () => {
182
+ const configPath = path.join(fixturesDir, 'invalid-project/docs.json');
183
+ const result = await validateConfig(configPath);
184
+ expect(result.valid).toBe(false);
185
+ expect(result.error).toContain('name');
186
+ });
187
+ it('rejects array navigation format', async () => {
188
+ const configPath = path.join(fixturesDir, 'legacy-project/docs.json');
189
+ const result = await validateConfig(configPath);
190
+ expect(result.valid).toBe(false);
191
+ expect(result.error).toContain('Array of groups is not supported');
192
+ });
193
+ });
194
+ describe('getAllPagePaths', () => {
195
+ it('extracts paths from anchors with groups', () => {
196
+ const config = {
197
+ name: 'Test',
198
+ navigation: {
199
+ anchors: [
200
+ {
201
+ anchor: 'Docs',
202
+ groups: [
203
+ { group: 'Start', pages: ['intro', 'setup'] },
204
+ { group: 'Advanced', pages: ['api', 'config'] },
205
+ ],
206
+ },
207
+ ],
208
+ },
209
+ };
210
+ const paths = getAllPagePaths(config);
211
+ expect(paths).toContain('intro');
212
+ expect(paths).toContain('setup');
213
+ expect(paths).toContain('api');
214
+ expect(paths).toContain('config');
215
+ expect(paths).toHaveLength(4);
216
+ });
217
+ it('extracts paths from tabs', () => {
218
+ const config = {
219
+ name: 'Test',
220
+ navigation: {
221
+ tabs: [
222
+ { tab: 'Guide', pages: ['guide1', 'guide2'] },
223
+ ],
224
+ },
225
+ };
226
+ const paths = getAllPagePaths(config);
227
+ expect(paths).toContain('guide1');
228
+ expect(paths).toContain('guide2');
229
+ });
230
+ it('extracts paths from flat groups', () => {
231
+ const config = {
232
+ name: 'Test',
233
+ navigation: {
234
+ groups: [
235
+ { group: 'Main', pages: ['page1', 'page2'] },
236
+ ],
237
+ },
238
+ };
239
+ const paths = getAllPagePaths(config);
240
+ expect(paths).toContain('page1');
241
+ expect(paths).toContain('page2');
242
+ });
243
+ it('extracts paths from flat pages array', () => {
244
+ const config = {
245
+ name: 'Test',
246
+ navigation: {
247
+ pages: ['standalone1', 'standalone2'],
248
+ },
249
+ };
250
+ const paths = getAllPagePaths(config);
251
+ expect(paths).toContain('standalone1');
252
+ expect(paths).toContain('standalone2');
253
+ });
254
+ it('handles nested groups', () => {
255
+ const config = {
256
+ name: 'Test',
257
+ navigation: {
258
+ anchors: [
259
+ {
260
+ anchor: 'Docs',
261
+ groups: [
262
+ {
263
+ group: 'Parent',
264
+ pages: [
265
+ 'parent-page',
266
+ { group: 'Child', pages: ['child-page'] },
267
+ ],
268
+ },
269
+ ],
270
+ },
271
+ ],
272
+ },
273
+ };
274
+ const paths = getAllPagePaths(config);
275
+ expect(paths).toContain('parent-page');
276
+ expect(paths).toContain('child-page');
277
+ });
278
+ it('returns empty array for empty navigation', () => {
279
+ const config = {
280
+ name: 'Test',
281
+ navigation: {},
282
+ };
283
+ const paths = getAllPagePaths(config);
284
+ expect(paths).toEqual([]);
285
+ });
286
+ });
287
+ });
288
+ //# sourceMappingURL=docs-config.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs-config.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/docs-config.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AAExD,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,cAAc,EACd,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAElC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;YAC3B,MAAM,MAAM,GAAG,WAAW,CAAC,qCAAqC,CAAC,CAAC;YAClE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACjC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,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AS,CAAC,aAAa,CAAC,CAAC;YACvC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;YAC/B,MAAM,MAAM,GAAG;gBACb,IAAI,EAAE,MAAM;gBACZ,UAAU,EAAE;oBACV,OAAO,EAAE;wBACP;4BACE,MAAM,EAAE,MAAM;4BACd,MAAM,EAAE;gCACN;oCACE,KAAK,EAAE,QAAQ;oCACf,KAAK,EAAE;wCACL,aAAa;wCACb,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE;qCAC1C;iCACF;6BACF;yBACF;qBACF;iBACF;aACF,CAAC;YACF,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;YACtC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;YACvC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;YAClD,MAAM,MAAM,GAAG;gBACb,IAAI,EAAE,MAAM;gBACZ,UAAU,EAAE,EAAE;aACf,CAAC;YACF,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;YACtC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=errors.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/errors.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { CLIError, isUserError } from '../../lib/errors.js';
3
+ describe('CLIError', () => {
4
+ it('creates error with message and code', () => {
5
+ const error = new CLIError('File not found', 'FILE_NOT_FOUND');
6
+ expect(error.message).toBe('File not found');
7
+ expect(error.code).toBe('FILE_NOT_FOUND');
8
+ expect(error.exitCode).toBe(1);
9
+ });
10
+ it('supports custom exit code', () => {
11
+ const error = new CLIError('Config error', 'CONFIG_ERROR', 2);
12
+ expect(error.exitCode).toBe(2);
13
+ });
14
+ it('includes hint when provided', () => {
15
+ const error = new CLIError('Missing file', 'MISSING_FILE', 1, 'Run jamdesk init first');
16
+ expect(error.hint).toBe('Run jamdesk init first');
17
+ });
18
+ });
19
+ describe('isUserError', () => {
20
+ it('returns true for CLIError', () => {
21
+ expect(isUserError(new CLIError('test', 'TEST'))).toBe(true);
22
+ });
23
+ it('returns false for regular Error', () => {
24
+ expect(isUserError(new Error('test'))).toBe(false);
25
+ });
26
+ });
27
+ //# sourceMappingURL=errors.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/errors.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE5D,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;QAC/D,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC7C,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC1C,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,cAAc,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;QAC9D,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,cAAc,EAAE,cAAc,EAAE,CAAC,EAAE,wBAAwB,CAAC,CAAC;QACxF,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Tests for extract-hooks.ts - React hook extraction from inline MDX components
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=extract-hooks.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-hooks.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/extract-hooks.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,205 @@
1
+ /**
2
+ * Tests for extract-hooks.ts - React hook extraction from inline MDX components
3
+ */
4
+ import { describe, it, expect } from 'vitest';
5
+ import { extractComponentsWithHooks } from '../../commands/migrate/extract-hooks.js';
6
+ describe('extractComponentsWithHooks', () => {
7
+ const mockSnippetsDir = '/snippets';
8
+ describe('hook detection', () => {
9
+ it('detects useState in inline component', () => {
10
+ const content = `---
11
+ title: Test
12
+ ---
13
+
14
+ export const Counter = () => {
15
+ const [count, setCount] = useState(0);
16
+ return <button onClick={() => setCount(c => c + 1)}>{count}</button>;
17
+ };
18
+
19
+ # My Page
20
+
21
+ <Counter />
22
+ `;
23
+ const result = extractComponentsWithHooks(content, mockSnippetsDir);
24
+ expect(result.changed).toBe(true);
25
+ expect(result.extractedComponents).toHaveLength(1);
26
+ expect(result.extractedComponents[0].name).toBe('Counter');
27
+ expect(result.extractedComponents[0].hooks).toContain('useState');
28
+ });
29
+ it('detects multiple hooks', () => {
30
+ const content = `export const Component = () => {
31
+ const [state, setState] = useState(0);
32
+ const ref = useRef(null);
33
+ useEffect(() => {}, []);
34
+ return null;
35
+ };`;
36
+ const result = extractComponentsWithHooks(content, mockSnippetsDir);
37
+ expect(result.extractedComponents[0].hooks).toContain('useState');
38
+ expect(result.extractedComponents[0].hooks).toContain('useRef');
39
+ expect(result.extractedComponents[0].hooks).toContain('useEffect');
40
+ });
41
+ it('ignores hooks in comments', () => {
42
+ const content = `export const Example = () => {
43
+ // TODO: add useState later
44
+ /* useEffect should go here */
45
+ return <div>Static content</div>;
46
+ };`;
47
+ const result = extractComponentsWithHooks(content, mockSnippetsDir);
48
+ expect(result.changed).toBe(false);
49
+ expect(result.extractedComponents).toHaveLength(0);
50
+ });
51
+ it('does not extract components without hooks', () => {
52
+ const content = `export const StaticCard = ({ title }) => (
53
+ <div className="card">{title}</div>
54
+ );`;
55
+ const result = extractComponentsWithHooks(content, mockSnippetsDir);
56
+ expect(result.changed).toBe(false);
57
+ expect(result.extractedComponents).toHaveLength(0);
58
+ });
59
+ });
60
+ describe('content transformation', () => {
61
+ it('replaces export with import statement', () => {
62
+ const content = `export const Counter = () => {
63
+ const [count, setCount] = useState(0);
64
+ return <span>{count}</span>;
65
+ };
66
+
67
+ <Counter />`;
68
+ const result = extractComponentsWithHooks(content, mockSnippetsDir);
69
+ expect(result.content).toContain("import { Counter } from '/snippets/counter';");
70
+ expect(result.content).not.toContain('export const Counter');
71
+ expect(result.content).toContain('<Counter />');
72
+ });
73
+ it('handles multiple hook-using components', () => {
74
+ const content = `export const Counter = () => {
75
+ const [count] = useState(0);
76
+ return <span>{count}</span>;
77
+ };
78
+
79
+ export const Timer = () => {
80
+ useEffect(() => {}, []);
81
+ return <span>Timer</span>;
82
+ };
83
+
84
+ <Counter />
85
+ <Timer />`;
86
+ const result = extractComponentsWithHooks(content, mockSnippetsDir);
87
+ expect(result.extractedComponents).toHaveLength(2);
88
+ expect(result.content).toContain("import { Counter } from '/snippets/counter';");
89
+ expect(result.content).toContain("import { Timer } from '/snippets/timer';");
90
+ });
91
+ it('preserves non-hook components', () => {
92
+ const content = `export const Static = ({ text }) => <span>{text}</span>;
93
+
94
+ export const Interactive = () => {
95
+ const [val] = useState(0);
96
+ return <span>{val}</span>;
97
+ };
98
+
99
+ <Static text="hello" />
100
+ <Interactive />`;
101
+ const result = extractComponentsWithHooks(content, mockSnippetsDir);
102
+ expect(result.extractedComponents).toHaveLength(1);
103
+ expect(result.extractedComponents[0].name).toBe('Interactive');
104
+ // Static component should remain as export
105
+ expect(result.content).toContain('export const Static');
106
+ });
107
+ });
108
+ describe('snippet path generation', () => {
109
+ it('converts PascalCase to kebab-case', () => {
110
+ const content = `export const MyAwesomeComponent = () => {
111
+ useState(0);
112
+ return null;
113
+ };`;
114
+ const result = extractComponentsWithHooks(content, mockSnippetsDir);
115
+ expect(result.extractedComponents[0].snippetPath).toBe('/snippets/my-awesome-component');
116
+ });
117
+ });
118
+ describe('edge cases', () => {
119
+ it('handles template literals with expressions', () => {
120
+ const content = `export const Template = () => {
121
+ const [name] = useState('world');
122
+ return <span>{\`Hello \${name}!\`}</span>;
123
+ };`;
124
+ const result = extractComponentsWithHooks(content, mockSnippetsDir);
125
+ expect(result.changed).toBe(true);
126
+ expect(result.extractedComponents[0].hooks).toContain('useState');
127
+ });
128
+ it('handles nested functions', () => {
129
+ const content = `export const Nested = () => {
130
+ const [items] = useState([]);
131
+ const renderItem = (item) => <li>{item}</li>;
132
+ return <ul>{items.map(renderItem)}</ul>;
133
+ };`;
134
+ const result = extractComponentsWithHooks(content, mockSnippetsDir);
135
+ expect(result.changed).toBe(true);
136
+ expect(result.extractedComponents).toHaveLength(1);
137
+ });
138
+ it('handles escaped quotes in strings', () => {
139
+ const content = `export const Escaped = () => {
140
+ const [text] = useState("He said \\"hello\\"");
141
+ return <span>{text}</span>;
142
+ };`;
143
+ const result = extractComponentsWithHooks(content, mockSnippetsDir);
144
+ expect(result.changed).toBe(true);
145
+ expect(result.extractedComponents[0].hooks).toContain('useState');
146
+ });
147
+ it('ignores exports inside fenced code blocks', () => {
148
+ const content = `---
149
+ title: React Components
150
+ ---
151
+
152
+ Here's an example:
153
+
154
+ \`\`\`mdx
155
+ export const Counter = () => {
156
+ const [count, setCount] = useState(0);
157
+ return <button>{count}</button>;
158
+ };
159
+
160
+ <Counter />
161
+ \`\`\`
162
+
163
+ export const RealCounter = () => {
164
+ const [count, setCount] = useState(0);
165
+ return <button>{count}</button>;
166
+ };
167
+
168
+ <RealCounter />
169
+ `;
170
+ const result = extractComponentsWithHooks(content, mockSnippetsDir);
171
+ // Should only extract RealCounter, not the one inside the code block
172
+ expect(result.extractedComponents).toHaveLength(1);
173
+ expect(result.extractedComponents[0].name).toBe('RealCounter');
174
+ // Code block example should be preserved
175
+ expect(result.content).toContain('```mdx');
176
+ expect(result.content).toContain('export const Counter');
177
+ });
178
+ it('handles multiple code blocks with exports', () => {
179
+ const content = `
180
+ \`\`\`jsx
181
+ export const Example1 = () => {
182
+ useState(0);
183
+ return null;
184
+ };
185
+ \`\`\`
186
+
187
+ \`\`\`tsx
188
+ export const Example2 = () => {
189
+ useEffect(() => {}, []);
190
+ return null;
191
+ };
192
+ \`\`\`
193
+
194
+ export const ActualComponent = () => {
195
+ const [state] = useState(0);
196
+ return <div>{state}</div>;
197
+ };
198
+ `;
199
+ const result = extractComponentsWithHooks(content, mockSnippetsDir);
200
+ expect(result.extractedComponents).toHaveLength(1);
201
+ expect(result.extractedComponents[0].name).toBe('ActualComponent');
202
+ });
203
+ });
204
+ });
205
+ //# sourceMappingURL=extract-hooks.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-hooks.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/extract-hooks.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,MAAM,eAAe,GAAG,WAAW,CAAC;IAEpC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC9B,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC9C,MAAM,OAAO,GAAG;;;;;;;;;;;;CAYrB,CAAC;YAEI,MAAM,MAAM,GAAG,0BAA0B,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;YAEpE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClC,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YACnD,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC3D,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC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AC,CAAC;YAEpE,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YACnD,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Sync Verification Test
3
+ *
4
+ * Ensures the frontmatter-utils.ts file stays in sync with build-service.
5
+ * Catches drift if someone forgets to run `npm run vendor`.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=frontmatter-sync.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter-sync.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/frontmatter-sync.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Sync Verification Test
3
+ *
4
+ * Ensures the frontmatter-utils.ts file stays in sync with build-service.
5
+ * Catches drift if someone forgets to run `npm run vendor`.
6
+ */
7
+ import { describe, it, expect } from 'vitest';
8
+ import fs from 'fs';
9
+ import path from 'path';
10
+ import { fileURLToPath } from 'url';
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+ describe('frontmatter-utils sync verification', () => {
14
+ it('CLI frontmatter-utils matches build-service source (excluding header)', () => {
15
+ const cliPath = path.join(__dirname, '../../lib/frontmatter-utils.ts');
16
+ const buildServicePath = path.join(__dirname, '../../../../build-service/lib/frontmatter-utils.ts');
17
+ const cliContent = fs.readFileSync(cliPath, 'utf-8');
18
+ const buildServiceContent = fs.readFileSync(buildServicePath, 'utf-8');
19
+ // Remove the AUTO-SYNCED header from CLI version for comparison
20
+ const cliWithoutHeader = cliContent.replace(/^\/\*\*\n \* Frontmatter Utilities[\s\S]*?AUTO-SYNCED[\s\S]*?\*\/\n\n/, '');
21
+ // Remove the original header from build-service version
22
+ const buildServiceWithoutHeader = buildServiceContent.replace(/^\/\*\*[\s\S]*?\*\/\s*\n/, '');
23
+ expect(cliWithoutHeader).toBe(buildServiceWithoutHeader);
24
+ });
25
+ });
26
+ //# sourceMappingURL=frontmatter-sync.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter-sync.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/frontmatter-sync.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,EAAE,CAAC,uEAAuE,EAAE,GAAG,EAAE;QAC/E,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,gCAAgC,CAAC,CAAC;QACvE,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oDAAoD,CAAC,CAAC;QAEpG,MAAM,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrD,MAAM,mBAAmB,GAAG,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;QAEvE,gEAAgE;QAChE,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,CAAC,uEAAuE,EAAE,EAAE,CAAC,CAAC;QAEzH,wDAAwD;QACxD,MAAM,yBAAyB,GAAG,mBAAmB,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;QAE9F,MAAM,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mdx-validator.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdx-validator.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/mdx-validator.test.ts"],"names":[],"mappings":""}