polen 0.10.0 → 0.11.0-next.10

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 (357) hide show
  1. package/build/api/api.d.ts +1 -0
  2. package/build/api/api.d.ts.map +1 -1
  3. package/build/api/api.js +1 -0
  4. package/build/api/api.js.map +1 -1
  5. package/build/api/config/configurator.d.ts +55 -26
  6. package/build/api/config/configurator.d.ts.map +1 -1
  7. package/build/api/config/configurator.js +27 -9
  8. package/build/api/config/configurator.js.map +1 -1
  9. package/build/api/config/merge.d.ts.map +1 -1
  10. package/build/api/config/merge.js +0 -11
  11. package/build/api/config/merge.js.map +1 -1
  12. package/build/api/content/metadata.d.ts +8 -2
  13. package/build/api/content/metadata.d.ts.map +1 -1
  14. package/build/api/content/metadata.js +1 -1
  15. package/build/api/content/metadata.js.map +1 -1
  16. package/build/api/schema/data-sources/data-sources.d.ts +1 -0
  17. package/build/api/schema/data-sources/data-sources.d.ts.map +1 -1
  18. package/build/api/schema/data-sources/data-sources.js +1 -0
  19. package/build/api/schema/data-sources/data-sources.js.map +1 -1
  20. package/build/api/schema/data-sources/introspection/introspection.d.ts +83 -0
  21. package/build/api/schema/data-sources/introspection/introspection.d.ts.map +1 -0
  22. package/build/api/schema/data-sources/introspection/introspection.js +110 -0
  23. package/build/api/schema/data-sources/introspection/introspection.js.map +1 -0
  24. package/build/api/schema/data-sources/memory/memory.d.ts +2 -2
  25. package/build/api/schema/data-sources/memory/memory.d.ts.map +1 -1
  26. package/build/api/schema/data-sources/memory/memory.js +1 -3
  27. package/build/api/schema/data-sources/memory/memory.js.map +1 -1
  28. package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.d.ts +7 -3
  29. package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.d.ts.map +1 -1
  30. package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.js +15 -11
  31. package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.js.map +1 -1
  32. package/build/api/schema/data-sources/schema-directory/schema-directory.d.ts +16 -7
  33. package/build/api/schema/data-sources/schema-directory/schema-directory.d.ts.map +1 -1
  34. package/build/api/schema/data-sources/schema-directory/schema-directory.js +26 -7
  35. package/build/api/schema/data-sources/schema-directory/schema-directory.js.map +1 -1
  36. package/build/api/schema/data-sources/schema-file/schema-file.d.ts +7 -2
  37. package/build/api/schema/data-sources/schema-file/schema-file.d.ts.map +1 -1
  38. package/build/api/schema/data-sources/schema-file/schema-file.js +13 -5
  39. package/build/api/schema/data-sources/schema-file/schema-file.js.map +1 -1
  40. package/build/api/schema/metadata.d.ts +16 -0
  41. package/build/api/schema/metadata.d.ts.map +1 -0
  42. package/build/api/schema/metadata.js +19 -0
  43. package/build/api/schema/metadata.js.map +1 -0
  44. package/build/api/schema/read.d.ts +85 -11
  45. package/build/api/schema/read.d.ts.map +1 -1
  46. package/build/api/schema/read.js +15 -6
  47. package/build/api/schema/read.js.map +1 -1
  48. package/build/api/schema/schema.d.ts +33 -2
  49. package/build/api/schema/schema.d.ts.map +1 -1
  50. package/build/api/schema/schema.js +42 -0
  51. package/build/api/schema/schema.js.map +1 -1
  52. package/build/api/schema-source/index.d.ts +2 -0
  53. package/build/api/schema-source/index.d.ts.map +1 -0
  54. package/build/api/schema-source/index.js +2 -0
  55. package/build/api/schema-source/index.js.map +1 -0
  56. package/build/api/schema-source/schema-source.d.ts +33 -0
  57. package/build/api/schema-source/schema-source.d.ts.map +1 -0
  58. package/build/api/schema-source/schema-source.js +137 -0
  59. package/build/api/schema-source/schema-source.js.map +1 -0
  60. package/build/api/static/manifest.d.ts +1 -2
  61. package/build/api/static/manifest.d.ts.map +1 -1
  62. package/build/api/static/manifest.js +1 -1
  63. package/build/api/static/manifest.js.map +1 -1
  64. package/build/api/vite/plugins/build.d.ts.map +1 -1
  65. package/build/api/vite/plugins/build.js +3 -0
  66. package/build/api/vite/plugins/build.js.map +1 -1
  67. package/build/api/vite/plugins/core.d.ts +1 -0
  68. package/build/api/vite/plugins/core.d.ts.map +1 -1
  69. package/build/api/vite/plugins/core.js +25 -22
  70. package/build/api/vite/plugins/core.js.map +1 -1
  71. package/build/api/vite/plugins/main.d.ts.map +1 -1
  72. package/build/api/vite/plugins/main.js +1 -8
  73. package/build/api/vite/plugins/main.js.map +1 -1
  74. package/build/api/vite/plugins/schema-assets.d.ts +22 -0
  75. package/build/api/vite/plugins/schema-assets.d.ts.map +1 -0
  76. package/build/api/vite/plugins/schema-assets.js +310 -0
  77. package/build/api/vite/plugins/schema-assets.js.map +1 -0
  78. package/build/api/vite/plugins/serve.d.ts.map +1 -1
  79. package/build/api/vite/plugins/serve.js +11 -0
  80. package/build/api/vite/plugins/serve.js.map +1 -1
  81. package/build/cli/commands/open.js +1 -1
  82. package/build/cli/commands/open.js.map +1 -1
  83. package/build/lib/grafaid/schema/schema.d.ts +1 -1
  84. package/build/lib/grafaid/schema/schema.d.ts.map +1 -1
  85. package/build/lib/grafaid/schema/schema.js +1 -1
  86. package/build/lib/grafaid/schema/schema.js.map +1 -1
  87. package/build/lib/graphql-change/change-groups.d.ts +2 -0
  88. package/build/lib/graphql-change/change-groups.d.ts.map +1 -1
  89. package/build/lib/graphql-change/change-groups.js +54 -0
  90. package/build/lib/graphql-change/change-groups.js.map +1 -1
  91. package/build/lib/kit-temp.d.ts +9 -0
  92. package/build/lib/kit-temp.d.ts.map +1 -1
  93. package/build/lib/kit-temp.js +14 -2
  94. package/build/lib/kit-temp.js.map +1 -1
  95. package/build/lib/path-map/path-map.d.ts.map +1 -1
  96. package/build/lib/path-map/path-map.js +3 -1
  97. package/build/lib/path-map/path-map.js.map +1 -1
  98. package/build/lib/react-router-aid/react-router-aid.d.ts +5 -3
  99. package/build/lib/react-router-aid/react-router-aid.d.ts.map +1 -1
  100. package/build/lib/react-router-aid/react-router-aid.js +7 -4
  101. package/build/lib/react-router-aid/react-router-aid.js.map +1 -1
  102. package/build/project-data.d.ts +3 -11
  103. package/build/project-data.d.ts.map +1 -1
  104. package/build/template/components/Changelog.d.ts +3 -3
  105. package/build/template/components/Changelog.d.ts.map +1 -1
  106. package/build/template/components/Changelog.js +8 -84
  107. package/build/template/components/Changelog.js.map +1 -1
  108. package/build/template/components/CodeBlock.d.ts +2 -0
  109. package/build/template/components/CodeBlock.d.ts.map +1 -1
  110. package/build/template/components/CodeBlock.js +1 -4
  111. package/build/template/components/CodeBlock.js.map +1 -1
  112. package/build/template/components/ComponentDispatch.d.ts +34 -0
  113. package/build/template/components/ComponentDispatch.d.ts.map +1 -0
  114. package/build/template/components/ComponentDispatch.js +33 -0
  115. package/build/template/components/ComponentDispatch.js.map +1 -0
  116. package/build/template/components/ReferenceLink.d.ts +19 -0
  117. package/build/template/components/ReferenceLink.d.ts.map +1 -0
  118. package/build/template/components/ReferenceLink.js +19 -0
  119. package/build/template/components/ReferenceLink.js.map +1 -0
  120. package/build/template/components/TypeAnnotation.d.ts.map +1 -1
  121. package/build/template/components/TypeAnnotation.js +3 -3
  122. package/build/template/components/TypeAnnotation.js.map +1 -1
  123. package/build/template/components/TypeFieldsLinkList.d.ts.map +1 -1
  124. package/build/template/components/TypeFieldsLinkList.js +4 -4
  125. package/build/template/components/TypeFieldsLinkList.js.map +1 -1
  126. package/build/template/components/TypeIndex.js +2 -2
  127. package/build/template/components/TypeIndex.js.map +1 -1
  128. package/build/template/components/VersionSelector.d.ts +7 -0
  129. package/build/template/components/VersionSelector.d.ts.map +1 -0
  130. package/build/template/components/VersionSelector.js +30 -0
  131. package/build/template/components/VersionSelector.js.map +1 -0
  132. package/build/template/components/graphql/type-link.d.ts.map +1 -1
  133. package/build/template/components/graphql/type-link.js +2 -2
  134. package/build/template/components/graphql/type-link.js.map +1 -1
  135. package/build/template/hooks/useVersionPath.d.ts +6 -0
  136. package/build/template/hooks/useVersionPath.d.ts.map +1 -0
  137. package/build/template/hooks/useVersionPath.js +10 -0
  138. package/build/template/hooks/useVersionPath.js.map +1 -0
  139. package/build/template/layouts/ChangelogLayout.d.ts.map +1 -0
  140. package/build/template/{components → layouts}/ChangelogLayout.js +1 -1
  141. package/build/template/layouts/ChangelogLayout.js.map +1 -0
  142. package/build/template/layouts/index.d.ts +1 -0
  143. package/build/template/layouts/index.d.ts.map +1 -1
  144. package/build/template/layouts/index.js +1 -0
  145. package/build/template/layouts/index.js.map +1 -1
  146. package/build/template/lib/fetch-text.d.ts +8 -0
  147. package/build/template/lib/fetch-text.d.ts.map +1 -0
  148. package/build/template/lib/fetch-text.js +14 -0
  149. package/build/template/lib/fetch-text.js.map +1 -0
  150. package/build/template/lib/polen-url.d.ts +14 -0
  151. package/build/template/lib/polen-url.d.ts.map +1 -1
  152. package/build/template/lib/polen-url.js +16 -0
  153. package/build/template/lib/polen-url.js.map +1 -1
  154. package/build/template/lib/schema-utils/constants.d.ts +5 -0
  155. package/build/template/lib/schema-utils/constants.d.ts.map +1 -0
  156. package/build/template/lib/schema-utils/constants.js +5 -0
  157. package/build/template/lib/schema-utils/constants.js.map +1 -0
  158. package/build/template/lib/schema-utils/schema-utils.d.ts +15 -0
  159. package/build/template/lib/schema-utils/schema-utils.d.ts.map +1 -0
  160. package/build/template/lib/schema-utils/schema-utils.js +37 -0
  161. package/build/template/lib/schema-utils/schema-utils.js.map +1 -0
  162. package/build/template/routes/changelog.d.ts +4 -3
  163. package/build/template/routes/changelog.d.ts.map +1 -1
  164. package/build/template/routes/changelog.js +15 -9
  165. package/build/template/routes/changelog.js.map +1 -1
  166. package/build/template/routes/index.js +2 -2
  167. package/build/template/routes/index.js.map +1 -1
  168. package/build/template/routes/pages.d.ts +10 -0
  169. package/build/template/routes/pages.d.ts.map +1 -0
  170. package/build/template/routes/pages.js +76 -0
  171. package/build/template/routes/pages.js.map +1 -0
  172. package/build/template/routes/reference.d.ts +35 -6
  173. package/build/template/routes/reference.d.ts.map +1 -1
  174. package/build/template/routes/reference.js +97 -14
  175. package/build/template/routes/reference.js.map +1 -1
  176. package/build/template/routes/root.d.ts.map +1 -1
  177. package/build/template/routes/root.js +11 -75
  178. package/build/template/routes/root.js.map +1 -1
  179. package/build/template/server/app.d.ts +22 -1
  180. package/build/template/server/app.d.ts.map +1 -1
  181. package/build/template/server/app.js +19 -9
  182. package/build/template/server/app.js.map +1 -1
  183. package/build/template/server/main.js +9 -1
  184. package/build/template/server/main.js.map +1 -1
  185. package/build/template/server/ssg/generate.js +2 -2
  186. package/build/template/server/ssg/generate.js.map +1 -1
  187. package/build/template/server/ssg/get-route-paths.d.ts +1 -1
  188. package/build/template/server/ssg/get-route-paths.d.ts.map +1 -1
  189. package/build/template/server/ssg/get-route-paths.js +90 -27
  190. package/build/template/server/ssg/get-route-paths.js.map +1 -1
  191. package/build/template/sources/schema-source.d.ts +15 -0
  192. package/build/template/sources/schema-source.d.ts.map +1 -0
  193. package/build/template/sources/schema-source.js +64 -0
  194. package/build/template/sources/schema-source.js.map +1 -0
  195. package/package.json +16 -17
  196. package/src/api/api.ts +1 -0
  197. package/src/api/config/configurator.ts +86 -36
  198. package/src/api/config/merge.ts +0 -16
  199. package/src/api/content/metadata.ts +1 -1
  200. package/src/api/schema/data-sources/data-sources.ts +1 -0
  201. package/src/api/schema/data-sources/introspection/introspection.ts +213 -0
  202. package/src/api/schema/data-sources/memory/memory.ts +3 -5
  203. package/src/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.ts +29 -13
  204. package/src/api/schema/data-sources/schema-directory/schema-directory.ts +56 -16
  205. package/src/api/schema/data-sources/schema-file/schema-file.ts +16 -7
  206. package/src/api/schema/metadata.ts +23 -0
  207. package/src/api/schema/read.ts +109 -18
  208. package/src/api/schema/schema.ts +62 -2
  209. package/src/api/schema-source/index.ts +1 -0
  210. package/src/api/schema-source/schema-source.ts +189 -0
  211. package/src/api/static/manifest.ts +1 -1
  212. package/src/api/vite/plugins/build.ts +3 -0
  213. package/src/api/vite/plugins/core.ts +27 -22
  214. package/src/api/vite/plugins/main.ts +1 -9
  215. package/src/api/vite/plugins/schema-assets.ts +364 -0
  216. package/src/api/vite/plugins/serve.ts +15 -8
  217. package/src/cli/commands/open.ts +1 -1
  218. package/src/lib/grafaid/schema/schema.ts +1 -0
  219. package/src/lib/graphql-change/change-groups.ts +57 -0
  220. package/src/lib/kit-temp.ts +15 -2
  221. package/src/lib/mask/$.test.ts +3 -3
  222. package/src/lib/path-map/$.test.ts +22 -19
  223. package/src/lib/path-map/path-map.ts +3 -1
  224. package/src/lib/react-router-aid/react-router-aid.ts +12 -6
  225. package/src/project-data.ts +3 -11
  226. package/src/template/components/Changelog.tsx +16 -67
  227. package/src/template/components/CodeBlock.tsx +3 -5
  228. package/src/template/components/ComponentDispatch.tsx +42 -0
  229. package/src/template/components/ReferenceLink.tsx +34 -0
  230. package/src/template/components/TypeAnnotation.tsx +5 -7
  231. package/src/template/components/TypeFieldsLinkList.tsx +20 -23
  232. package/src/template/components/TypeIndex.tsx +10 -12
  233. package/src/template/components/VersionSelector.tsx +50 -0
  234. package/src/template/components/graphql/type-link.tsx +4 -3
  235. package/src/template/hooks/useVersionPath.ts +10 -0
  236. package/src/template/{components → layouts}/ChangelogLayout.tsx +1 -1
  237. package/src/template/layouts/index.ts +1 -0
  238. package/src/template/lib/fetch-text.ts +13 -0
  239. package/src/template/lib/polen-url.ts +20 -0
  240. package/src/template/lib/schema-utils/constants.ts +4 -0
  241. package/src/template/lib/schema-utils/schema-utils.ts +42 -0
  242. package/src/template/routes/changelog.tsx +19 -10
  243. package/src/template/routes/index.tsx +2 -2
  244. package/src/template/routes/pages.tsx +109 -0
  245. package/src/template/routes/reference.tsx +112 -12
  246. package/src/template/routes/root.tsx +11 -112
  247. package/src/template/server/app.ts +47 -14
  248. package/src/template/server/main.ts +9 -1
  249. package/src/template/server/ssg/generate.ts +2 -2
  250. package/src/template/server/ssg/get-route-paths.test.ts +132 -0
  251. package/src/template/server/ssg/get-route-paths.ts +91 -27
  252. package/src/template/sources/schema-source.ts +69 -0
  253. package/build/lib/graphql-document/$$.d.ts +0 -5
  254. package/build/lib/graphql-document/$$.d.ts.map +0 -1
  255. package/build/lib/graphql-document/$$.js +0 -5
  256. package/build/lib/graphql-document/$$.js.map +0 -1
  257. package/build/lib/graphql-document/$.d.ts +0 -2
  258. package/build/lib/graphql-document/$.d.ts.map +0 -1
  259. package/build/lib/graphql-document/$.js +0 -2
  260. package/build/lib/graphql-document/$.js.map +0 -1
  261. package/build/lib/graphql-document/analysis.d.ts +0 -44
  262. package/build/lib/graphql-document/analysis.d.ts.map +0 -1
  263. package/build/lib/graphql-document/analysis.js +0 -361
  264. package/build/lib/graphql-document/analysis.js.map +0 -1
  265. package/build/lib/graphql-document/components/GraphQLDocument.d.ts +0 -38
  266. package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +0 -1
  267. package/build/lib/graphql-document/components/GraphQLDocument.js +0 -151
  268. package/build/lib/graphql-document/components/GraphQLDocument.js.map +0 -1
  269. package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts +0 -7
  270. package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts.map +0 -1
  271. package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js +0 -27
  272. package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js.map +0 -1
  273. package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts +0 -33
  274. package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts.map +0 -1
  275. package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js +0 -50
  276. package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js.map +0 -1
  277. package/build/lib/graphql-document/components/IdentifierLink.d.ts +0 -39
  278. package/build/lib/graphql-document/components/IdentifierLink.d.ts.map +0 -1
  279. package/build/lib/graphql-document/components/IdentifierLink.js +0 -75
  280. package/build/lib/graphql-document/components/IdentifierLink.js.map +0 -1
  281. package/build/lib/graphql-document/components/graphql-document-styles.d.ts +0 -5
  282. package/build/lib/graphql-document/components/graphql-document-styles.d.ts.map +0 -1
  283. package/build/lib/graphql-document/components/graphql-document-styles.js +0 -144
  284. package/build/lib/graphql-document/components/graphql-document-styles.js.map +0 -1
  285. package/build/lib/graphql-document/components/index.d.ts +0 -5
  286. package/build/lib/graphql-document/components/index.d.ts.map +0 -1
  287. package/build/lib/graphql-document/components/index.js +0 -5
  288. package/build/lib/graphql-document/components/index.js.map +0 -1
  289. package/build/lib/graphql-document/example.d.ts +0 -25
  290. package/build/lib/graphql-document/example.d.ts.map +0 -1
  291. package/build/lib/graphql-document/example.js +0 -140
  292. package/build/lib/graphql-document/example.js.map +0 -1
  293. package/build/lib/graphql-document/graphql-document.d.ts +0 -35
  294. package/build/lib/graphql-document/graphql-document.d.ts.map +0 -1
  295. package/build/lib/graphql-document/graphql-document.js +0 -36
  296. package/build/lib/graphql-document/graphql-document.js.map +0 -1
  297. package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts +0 -43
  298. package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts.map +0 -1
  299. package/build/lib/graphql-document/hooks/use-tooltip-state.js +0 -132
  300. package/build/lib/graphql-document/hooks/use-tooltip-state.js.map +0 -1
  301. package/build/lib/graphql-document/positioning-simple.d.ts +0 -63
  302. package/build/lib/graphql-document/positioning-simple.d.ts.map +0 -1
  303. package/build/lib/graphql-document/positioning-simple.js +0 -185
  304. package/build/lib/graphql-document/positioning-simple.js.map +0 -1
  305. package/build/lib/graphql-document/schema-context.d.ts +0 -8
  306. package/build/lib/graphql-document/schema-context.d.ts.map +0 -1
  307. package/build/lib/graphql-document/schema-context.js +0 -11
  308. package/build/lib/graphql-document/schema-context.js.map +0 -1
  309. package/build/lib/graphql-document/schema-integration.d.ts +0 -135
  310. package/build/lib/graphql-document/schema-integration.d.ts.map +0 -1
  311. package/build/lib/graphql-document/schema-integration.js +0 -328
  312. package/build/lib/graphql-document/schema-integration.js.map +0 -1
  313. package/build/lib/graphql-document/types.d.ts +0 -117
  314. package/build/lib/graphql-document/types.d.ts.map +0 -1
  315. package/build/lib/graphql-document/types.js +0 -2
  316. package/build/lib/graphql-document/types.js.map +0 -1
  317. package/build/template/components/ChangelogLayout.d.ts.map +0 -1
  318. package/build/template/components/ChangelogLayout.js.map +0 -1
  319. package/build/template/components/CodeHikePre.d.ts +0 -16
  320. package/build/template/components/CodeHikePre.d.ts.map +0 -1
  321. package/build/template/components/CodeHikePre.js +0 -37
  322. package/build/template/components/CodeHikePre.js.map +0 -1
  323. package/build/template/routes/reference.$type.$field.d.ts +0 -5
  324. package/build/template/routes/reference.$type.$field.d.ts.map +0 -1
  325. package/build/template/routes/reference.$type.$field.js +0 -31
  326. package/build/template/routes/reference.$type.$field.js.map +0 -1
  327. package/build/template/routes/reference.$type.d.ts +0 -5
  328. package/build/template/routes/reference.$type.d.ts.map +0 -1
  329. package/build/template/routes/reference.$type.js +0 -23
  330. package/build/template/routes/reference.$type.js.map +0 -1
  331. package/src/lib/graphql-document/$$.ts +0 -4
  332. package/src/lib/graphql-document/$.test.ts +0 -132
  333. package/src/lib/graphql-document/$.ts +0 -1
  334. package/src/lib/graphql-document/README.md +0 -102
  335. package/src/lib/graphql-document/analysis.ts +0 -415
  336. package/src/lib/graphql-document/components/GraphQLDocument.tsx +0 -265
  337. package/src/lib/graphql-document/components/GraphQLDocument.unit.test.ts +0 -188
  338. package/src/lib/graphql-document/components/GraphQLDocumentWithSchema.tsx +0 -46
  339. package/src/lib/graphql-document/components/GraphQLIdentifierPopover.tsx +0 -199
  340. package/src/lib/graphql-document/components/IdentifierLink.tsx +0 -160
  341. package/src/lib/graphql-document/components/graphql-document-styles.ts +0 -144
  342. package/src/lib/graphql-document/components/index.ts +0 -4
  343. package/src/lib/graphql-document/demo.md +0 -155
  344. package/src/lib/graphql-document/example.ts +0 -163
  345. package/src/lib/graphql-document/graphql-document.ts +0 -37
  346. package/src/lib/graphql-document/hooks/use-tooltip-state.test.ts +0 -76
  347. package/src/lib/graphql-document/hooks/use-tooltip-state.ts +0 -191
  348. package/src/lib/graphql-document/positioning-simple.test.ts +0 -248
  349. package/src/lib/graphql-document/positioning-simple.ts +0 -260
  350. package/src/lib/graphql-document/schema-context.tsx +0 -20
  351. package/src/lib/graphql-document/schema-integration.test.ts +0 -365
  352. package/src/lib/graphql-document/schema-integration.ts +0 -488
  353. package/src/lib/graphql-document/types.ts +0 -129
  354. package/src/template/components/CodeHikePre.tsx +0 -51
  355. package/src/template/routes/reference.$type.$field.tsx +0 -34
  356. package/src/template/routes/reference.$type.tsx +0 -27
  357. /package/build/template/{components → layouts}/ChangelogLayout.d.ts +0 -0
@@ -0,0 +1,132 @@
1
+ import { beforeEach, describe, expect, test, vi } from 'vitest'
2
+
3
+ // Mock node:fs/promises
4
+ vi.mock('node:fs/promises', () => ({
5
+ readFile: vi.fn(),
6
+ }))
7
+
8
+ // Mock the virtual import
9
+ vi.mock('virtual:polen/project/data.jsonsuper', () => ({
10
+ default: {
11
+ paths: {
12
+ project: {
13
+ absolute: {
14
+ build: {
15
+ assets: {
16
+ schemas: '/mock/schemas',
17
+ },
18
+ },
19
+ },
20
+ },
21
+ },
22
+ },
23
+ }))
24
+
25
+ // Mock the routes
26
+ vi.mock('../../routes.js', () => ({
27
+ routes: [
28
+ {
29
+ path: 'reference',
30
+ children: [
31
+ {
32
+ path: 'version/:version',
33
+ children: [
34
+ {
35
+ path: ':type',
36
+ },
37
+ ],
38
+ },
39
+ {
40
+ path: ':type',
41
+ },
42
+ ],
43
+ },
44
+ ],
45
+ }))
46
+
47
+ // Mock the API
48
+ vi.mock('#api/index', () => ({
49
+ Api: {
50
+ Schema: {
51
+ getMetadata: vi.fn(),
52
+ VERSION_LATEST: 'latest',
53
+ },
54
+ },
55
+ }))
56
+
57
+ describe('getRoutesPaths', () => {
58
+ beforeEach(() => {
59
+ vi.resetAllMocks()
60
+ })
61
+
62
+ test('should handle versioned routes without type parameter', async () => {
63
+ // Mock schema metadata
64
+ const { Api } = await import('#api/index')
65
+ vi.mocked(Api.Schema.getMetadata).mockResolvedValue({
66
+ hasSchema: true,
67
+ versions: ['2024-01-01', '2024-02-01'],
68
+ })
69
+
70
+ // Mock file system reads with proper GraphQL AST
71
+ const NodeFs = await import('node:fs/promises')
72
+ vi.mocked(NodeFs.readFile).mockImplementation(async (path) => {
73
+ if (typeof path === 'string' && path.includes('.json')) {
74
+ // Return a minimal GraphQL document AST
75
+ return JSON.stringify({
76
+ kind: 'Document',
77
+ definitions: [],
78
+ })
79
+ }
80
+ throw new Error(`Unexpected file read: ${path}`)
81
+ })
82
+
83
+ const { getRoutesPaths } = await import('./get-route-paths.js')
84
+
85
+ // This should not throw "Unhandled parameterized path: /reference/version/:version"
86
+ await expect(getRoutesPaths()).resolves.toBeDefined()
87
+ })
88
+
89
+ test('should generate paths for all schema versions', async () => {
90
+ const { Api } = await import('#api/index')
91
+ vi.mocked(Api.Schema.getMetadata).mockResolvedValue({
92
+ hasSchema: true,
93
+ versions: ['2024-01-01', '2024-02-01'],
94
+ })
95
+
96
+ // Mock schema with types - proper GraphQL AST
97
+ const mockSchema = {
98
+ kind: 'Document',
99
+ definitions: [
100
+ {
101
+ kind: 'ObjectTypeDefinition',
102
+ name: { kind: 'Name', value: 'User' },
103
+ },
104
+ {
105
+ kind: 'ObjectTypeDefinition',
106
+ name: { kind: 'Name', value: 'Post' },
107
+ },
108
+ ],
109
+ }
110
+
111
+ const NodeFs = await import('node:fs/promises')
112
+ vi.mocked(NodeFs.readFile).mockImplementation(async (path) => {
113
+ if (typeof path === 'string' && path.includes('.json')) {
114
+ return JSON.stringify(mockSchema)
115
+ }
116
+ throw new Error(`Unexpected file read: ${path}`)
117
+ })
118
+
119
+ const { getRoutesPaths } = await import('./get-route-paths.js')
120
+ const paths = await getRoutesPaths()
121
+
122
+ // Should include versioned paths
123
+ expect(paths).toContain('/reference/version/2024-01-01/User')
124
+ expect(paths).toContain('/reference/version/2024-01-01/Post')
125
+ expect(paths).toContain('/reference/version/2024-02-01/User')
126
+ expect(paths).toContain('/reference/version/2024-02-01/Post')
127
+
128
+ // Should include unversioned paths
129
+ expect(paths).toContain('/reference/User')
130
+ expect(paths).toContain('/reference/Post')
131
+ })
132
+ })
@@ -1,7 +1,8 @@
1
- import { Grafaid } from '#lib/grafaid/index'
2
- import { visit } from 'graphql'
3
- // Or your specific import path for this type
1
+ import { Api } from '#api/index'
4
2
  import { ReactRouterAid } from '#lib/react-router-aid/index'
3
+ import { visit } from 'graphql'
4
+ import * as NodeFs from 'node:fs/promises'
5
+ import * as NodePath from 'node:path'
5
6
  import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper'
6
7
  import { routes } from '../../routes.js'
7
8
 
@@ -10,37 +11,100 @@ import { routes } from '../../routes.js'
10
11
  // Maybe we can figure something out too.
11
12
  const knownParameterizedRouteExpressions = {
12
13
  reference_type: `/reference/:type`,
14
+ reference_type_field: `/reference/:type/:field`,
15
+ reference_version: `/reference/version/:version`,
16
+ reference_versioned_type: `/reference/version/:version/:type`,
17
+ reference_versioned_type_field: `/reference/version/:version/:type/:field`,
13
18
  }
14
19
 
15
- export const getRoutesPaths = (): string[] => {
20
+ export const getRoutesPaths = async (): Promise<string[]> => {
16
21
  const paths = new Set<string>()
17
22
  const routeExpressions = ReactRouterAid.getRouteExpressions(routes)
18
23
 
24
+ // Helper function to load schema from filesystem and add type paths
25
+ const addTypePathsForVersion = async (version: string, pathPrefix: string, includeFields = false) => {
26
+ try {
27
+ const schemaFilePath = NodePath.join(PROJECT_DATA.paths.project.absolute.build.assets.schemas, `${version}.json`)
28
+ const schemaContent = await NodeFs.readFile(schemaFilePath, 'utf-8')
29
+ const schemaAst = JSON.parse(schemaContent)
30
+
31
+ visit(schemaAst, {
32
+ ObjectTypeDefinition(node) {
33
+ const typePath = `${pathPrefix}/${node.name.value}`
34
+ paths.add(typePath)
35
+
36
+ // Add field paths if requested
37
+ if (includeFields && node.fields) {
38
+ for (const field of node.fields) {
39
+ paths.add(`${typePath}/${field.name.value}`)
40
+ }
41
+ }
42
+ },
43
+ InterfaceTypeDefinition(node) {
44
+ const typePath = `${pathPrefix}/${node.name.value}`
45
+ paths.add(typePath)
46
+
47
+ // Add field paths if requested
48
+ if (includeFields && node.fields) {
49
+ for (const field of node.fields) {
50
+ paths.add(`${typePath}/${field.name.value}`)
51
+ }
52
+ }
53
+ },
54
+ EnumTypeDefinition(node) {
55
+ paths.add(`${pathPrefix}/${node.name.value}`)
56
+ },
57
+ InputObjectTypeDefinition(node) {
58
+ paths.add(`${pathPrefix}/${node.name.value}`)
59
+ },
60
+ UnionTypeDefinition(node) {
61
+ paths.add(`${pathPrefix}/${node.name.value}`)
62
+ },
63
+ ScalarTypeDefinition(node) {
64
+ paths.add(`${pathPrefix}/${node.name.value}`)
65
+ },
66
+ })
67
+ } catch (error) {
68
+ throw new Error(`SSG failed to load schema for version ${version}. Ensure schema assets are built. ${error}`)
69
+ }
70
+ }
71
+
72
+ const schemaMetadataPath = NodePath.join(PROJECT_DATA.paths.project.absolute.build.assets.schemas, 'metadata.json')
73
+
74
+ const schemaMetadata = await Api.Schema.getMetadata(schemaMetadataPath)
75
+ const { hasSchema, versions: availableVersions } = schemaMetadata
76
+
19
77
  for (const exp of routeExpressions) {
20
78
  if (exp === knownParameterizedRouteExpressions.reference_type) {
21
- if (PROJECT_DATA.schema) {
22
- const schema = PROJECT_DATA.schema.versions[0].after
23
- const ast = Grafaid.Schema.AST.parse(Grafaid.Schema.print(schema))
24
- visit(ast, {
25
- ObjectTypeDefinition(node) {
26
- paths.add(`/reference/${node.name.value}`)
27
- },
28
- InterfaceTypeDefinition(node) {
29
- paths.add(`/reference/${node.name.value}`)
30
- },
31
- EnumTypeDefinition(node) {
32
- paths.add(`/reference/${node.name.value}`)
33
- },
34
- InputObjectTypeDefinition(node) {
35
- paths.add(`/reference/${node.name.value}`)
36
- },
37
- UnionTypeDefinition(node) {
38
- paths.add(`/reference/${node.name.value}`)
39
- },
40
- ScalarTypeDefinition(node) {
41
- paths.add(`/reference/${node.name.value}`)
42
- },
43
- })
79
+ if (hasSchema) {
80
+ // Add paths for latest version (no version in URL)
81
+ await addTypePathsForVersion(Api.Schema.VERSION_LATEST, `/reference`)
82
+ }
83
+ } else if (exp === knownParameterizedRouteExpressions.reference_version) {
84
+ if (hasSchema) {
85
+ // Add paths for version pages themselves (without type)
86
+ for (const version of availableVersions) {
87
+ paths.add(`/reference/version/${version}`)
88
+ }
89
+ }
90
+ } else if (exp === knownParameterizedRouteExpressions.reference_type_field) {
91
+ if (hasSchema) {
92
+ // Add paths for latest version fields
93
+ await addTypePathsForVersion(Api.Schema.VERSION_LATEST, `/reference`, true)
94
+ }
95
+ } else if (exp === knownParameterizedRouteExpressions.reference_versioned_type) {
96
+ if (hasSchema) {
97
+ // Add paths for all versions using new route structure
98
+ for (const version of availableVersions) {
99
+ await addTypePathsForVersion(version, `/reference/version/${version}`)
100
+ }
101
+ }
102
+ } else if (exp === knownParameterizedRouteExpressions.reference_versioned_type_field) {
103
+ if (hasSchema) {
104
+ // Add paths for all versions with fields
105
+ for (const version of availableVersions) {
106
+ await addTypePathsForVersion(version, `/reference/version/${version}`, true)
107
+ }
44
108
  }
45
109
  } else if (ReactRouterAid.isParameterizedPath(exp)) {
46
110
  throw new Error(`Unhandled parameterized path: ${exp}`)
@@ -0,0 +1,69 @@
1
+ import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper'
2
+ import PROJECT_SCHEMA_METADATA from 'virtual:polen/project/schema-metadata'
3
+ import { createSchemaSource } from '../../api/schema-source/index.js'
4
+ import { polenUrlPathAssets } from '../lib/polen-url.js'
5
+
6
+ // Environment-specific IO implementation
7
+ const io = import.meta.env.SSR
8
+ ? {
9
+ // Server-side: Read from filesystem
10
+ read: async (path: string) => {
11
+ // Dynamic import to keep fs out of client bundle
12
+ const { readFile } = await import('node:fs/promises')
13
+
14
+ // Extract the path after the assets route
15
+ // e.g., "/assets/schemas/latest.json" -> "schemas/latest.json"
16
+ // e.g., "/demos/pokemon/assets/schemas/latest.json" -> "schemas/latest.json"
17
+ const assetsRoute = PROJECT_DATA.server.routes.assets
18
+ const routePattern = new RegExp(`${assetsRoute}/(.+)$`)
19
+ const match = path.match(routePattern)
20
+ const assetPath = match ? match[1] : path
21
+
22
+ // In SSR, we need to read from the correct location
23
+ // During dev, assets are served from Polen's node_modules
24
+ // In production, they're in the build output directory
25
+ let fullPath: string
26
+ if (import.meta.env.DEV) {
27
+ // Development: Read from Polen's Vite cache
28
+ fullPath = `${PROJECT_DATA.paths.framework.devAssets.absolute}/${assetPath}`
29
+ } else {
30
+ // Production: Read from build output
31
+ // The server runs from the project root, and assets are in build/assets/
32
+ fullPath =
33
+ `${PROJECT_DATA.paths.project.relative.build.root}/${PROJECT_DATA.paths.project.relative.build.relative.assets.root}/${assetPath}`
34
+ }
35
+
36
+ return readFile(fullPath, 'utf-8')
37
+ },
38
+ }
39
+ : {
40
+ // Client-side: Fetch from HTTP
41
+ read: async (path: string) => {
42
+ const response = await fetch(path)
43
+ if (!response.ok) {
44
+ throw new Error(`Failed to fetch: ${path} (${response.status} ${response.statusText})`)
45
+ }
46
+ return response.text()
47
+ },
48
+ }
49
+
50
+ // Create and export the source object directly
51
+ export const schemaSource = createSchemaSource({
52
+ io,
53
+ versions: PROJECT_SCHEMA_METADATA.versions,
54
+ assetsPath: polenUrlPathAssets(),
55
+ })
56
+
57
+ // HMR cache invalidation for development
58
+ if (import.meta.hot) {
59
+ import.meta.hot.on('polen:schema-invalidate', () => {
60
+ console.log('[HMR] Schema cache invalidated')
61
+ schemaSource.clearCache()
62
+
63
+ // Brute force approach: reload the page to ensure fresh data
64
+ // This guarantees all components see the updated schema immediately
65
+ // TODO: When we have reactive data fetching, remove this reload
66
+ // and let the reactive system handle updates gracefully
67
+ window.location.reload()
68
+ })
69
+ }
@@ -1,5 +0,0 @@
1
- export * from './analysis.js';
2
- export * from './positioning-simple.js';
3
- export * from './schema-integration.js';
4
- export * from './types.js';
5
- //# sourceMappingURL=$$.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"$$.d.ts","sourceRoot":"","sources":["../../../src/lib/graphql-document/$$.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,YAAY,CAAA"}
@@ -1,5 +0,0 @@
1
- export * from './analysis.js';
2
- export * from './positioning-simple.js';
3
- export * from './schema-integration.js';
4
- export * from './types.js';
5
- //# sourceMappingURL=$$.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"$$.js","sourceRoot":"","sources":["../../../src/lib/graphql-document/$$.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,YAAY,CAAA"}
@@ -1,2 +0,0 @@
1
- export * as GraphQLDocument from './graphql-document.js';
2
- //# sourceMappingURL=$.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/lib/graphql-document/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * as GraphQLDocument from './graphql-document.js';
2
- //# sourceMappingURL=$.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"$.js","sourceRoot":"","sources":["../../../src/lib/graphql-document/$.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAA"}
@@ -1,44 +0,0 @@
1
- import { type DocumentNode, type GraphQLError, type GraphQLSchema } from 'graphql';
2
- import type { AnalysisConfig, AnalysisResult, GraphQLAnalyzer, IdentifierMap } from './types.js';
3
- /**
4
- * Default GraphQL document analyzer implementation
5
- */
6
- export declare class DefaultGraphQLAnalyzer implements GraphQLAnalyzer {
7
- /**
8
- * Parse a GraphQL document string into an AST
9
- */
10
- parse(source: string): DocumentNode;
11
- /**
12
- * Validate a GraphQL document against a schema
13
- */
14
- validateAgainstSchema(ast: DocumentNode, schema: GraphQLSchema): GraphQLError[];
15
- /**
16
- * Extract all identifiers from a GraphQL AST
17
- */
18
- extractIdentifiers(ast: DocumentNode, config?: AnalysisConfig): IdentifierMap;
19
- /**
20
- * Perform complete analysis of a GraphQL document
21
- */
22
- analyze(source: string, config?: AnalysisConfig): AnalysisResult;
23
- private addIdentifier;
24
- private getPosition;
25
- private getTypePosition;
26
- private extractTypeName;
27
- private isObjectField;
28
- private inferReturnType;
29
- private createContext;
30
- private createIdentifierMap;
31
- }
32
- /**
33
- * Default analyzer instance
34
- */
35
- export declare const analyzer: DefaultGraphQLAnalyzer;
36
- /**
37
- * Convenience function to analyze a GraphQL document
38
- */
39
- export declare const analyze: (source: string, config?: AnalysisConfig) => AnalysisResult;
40
- /**
41
- * Convenience function to extract identifiers from a GraphQL document
42
- */
43
- export declare const extractIdentifiers: (source: string, config?: AnalysisConfig) => IdentifierMap;
44
- //# sourceMappingURL=analysis.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analysis.d.ts","sourceRoot":"","sources":["../../../src/lib/graphql-document/analysis.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EAGjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAMnB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EACV,cAAc,EAEd,cAAc,EACd,eAAe,EAGf,aAAa,EACd,MAAM,YAAY,CAAA;AAEnB;;GAEG;AACH,qBAAa,sBAAuB,YAAW,eAAe;IAC5D;;OAEG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAUnC;;OAEG;IACH,qBAAqB,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,GAAG,YAAY,EAAE;IAI/E;;OAEG;IACH,kBAAkB,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,GAAE,cAAmB,GAAG,aAAa;IA4MjF;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,cAAmB,GAAG,cAAc;IA+BpE,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,aAAa;IAyBrB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,mBAAmB;CAsB5B;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,wBAA+B,CAAA;AAEpD;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,QAAQ,MAAM,EAAE,SAAS,cAAc,KAAG,cAEjE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,EAAE,SAAS,cAAc,KAAG,aAG5E,CAAA"}