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
@@ -1,488 +0,0 @@
1
- /**
2
- * Layer 2: Schema Integration
3
- *
4
- * Bridge between GraphQL analysis and Polen's schema system.
5
- * Resolves identifiers against the actual schema, extracts documentation,
6
- * and generates reference URLs for navigation.
7
- */
8
-
9
- import {
10
- getNamedType,
11
- type GraphQLField,
12
- type GraphQLInputField,
13
- type GraphQLSchema,
14
- type GraphQLType,
15
- isInputObjectType,
16
- isInterfaceType,
17
- isListType,
18
- isNonNullType,
19
- isObjectType,
20
- } from 'graphql'
21
- import { analyze } from './analysis.js'
22
- import type { Identifier } from './types.js'
23
-
24
- /**
25
- * Documentation extracted from GraphQL schema
26
- */
27
- export interface Documentation {
28
- /** Description from schema SDL or introspection */
29
- description?: string
30
- /** Type signature (e.g., "String!", "[User!]!") */
31
- typeInfo: string
32
- /** Whether this field/type is deprecated */
33
- deprecated?: {
34
- reason: string
35
- replacement?: string
36
- }
37
- /** Default value for arguments */
38
- defaultValue?: string
39
- }
40
-
41
- /**
42
- * Result of resolving an identifier against the schema
43
- */
44
- export interface SchemaResolution {
45
- /** Whether the identifier exists in the schema */
46
- exists: boolean
47
- /** Documentation extracted from schema */
48
- documentation?: Documentation
49
- /** URL to the reference page for this identifier */
50
- referenceUrl: string
51
- /** Whether this identifier is deprecated */
52
- deprecated?: {
53
- reason: string
54
- replacement?: string
55
- }
56
- /** The GraphQL type if this is a type identifier */
57
- graphqlType?: GraphQLType
58
- }
59
-
60
- /**
61
- * Interface for resolving GraphQL identifiers against a schema
62
- */
63
- export interface SchemaResolver {
64
- /**
65
- * Resolve an identifier against the schema
66
- */
67
- resolveIdentifier(identifier: Identifier): SchemaResolution | null
68
-
69
- /**
70
- * Get documentation for a schema path
71
- */
72
- getDocumentation(schemaPath: string[]): Documentation | null
73
-
74
- /**
75
- * Generate a reference URL for a schema path
76
- */
77
- generateReferenceLink(schemaPath: string[]): string
78
-
79
- /**
80
- * Check if a type exists in the schema
81
- */
82
- typeExists(typeName: string): boolean
83
-
84
- /**
85
- * Get all available types for validation
86
- */
87
- getAllTypes(): string[]
88
- }
89
-
90
- /**
91
- * Configuration for URL generation
92
- */
93
- export interface RouteConfig {
94
- /** Base path for reference pages (default: "/reference") */
95
- basePath?: string
96
- /** Whether to include fragments in URLs (default: true) */
97
- includeFragments?: boolean
98
- }
99
-
100
- /**
101
- * Polen's implementation of SchemaResolver
102
- */
103
- export class PolenSchemaResolver implements SchemaResolver {
104
- constructor(
105
- private schema: GraphQLSchema,
106
- private routeConfig: RouteConfig = {},
107
- ) {}
108
-
109
- /**
110
- * Resolve an identifier against the schema
111
- */
112
- resolveIdentifier(identifier: Identifier): SchemaResolution | null {
113
- const basePath = this.routeConfig.basePath || `/reference`
114
-
115
- switch (identifier.kind) {
116
- case `Type`:
117
- return this.resolveType(identifier, basePath)
118
-
119
- case `Field`:
120
- return this.resolveField(identifier, basePath)
121
-
122
- case `Argument`:
123
- return this.resolveArgument(identifier, basePath)
124
-
125
- case `Variable`:
126
- // Variables don't have schema resolution
127
- return {
128
- exists: true,
129
- referenceUrl: `${basePath}#variables`,
130
- documentation: {
131
- typeInfo: `Variable`,
132
- description: `Query variable: $${identifier.name}`,
133
- },
134
- }
135
-
136
- case `Directive`:
137
- return this.resolveDirective(identifier, basePath)
138
-
139
- case `Fragment`:
140
- // Fragments don't have schema resolution
141
- return {
142
- exists: true,
143
- referenceUrl: `${basePath}#fragments`,
144
- documentation: {
145
- typeInfo: `Fragment`,
146
- description: `Fragment: ${identifier.name}`,
147
- },
148
- }
149
-
150
- default:
151
- return null
152
- }
153
- }
154
-
155
- /**
156
- * Get documentation for a schema path
157
- */
158
- getDocumentation(schemaPath: string[]): Documentation | null {
159
- if (schemaPath.length === 0) return null
160
-
161
- const [typeName, fieldName, argName] = schemaPath
162
-
163
- if (!typeName) return null
164
-
165
- const type = this.schema.getType(typeName)
166
- if (!type) return null
167
-
168
- // Type-level documentation
169
- if (schemaPath.length === 1) {
170
- return {
171
- typeInfo: this.getTypeSignature(type),
172
- description: type.description || undefined,
173
- deprecated: `deprecationReason` in type
174
- ? {
175
- reason: (type as any).deprecationReason,
176
- }
177
- : undefined,
178
- }
179
- }
180
-
181
- // Field-level documentation
182
- if (fieldName && schemaPath.length === 2) {
183
- const field = this.getFieldFromType(type, fieldName)
184
- if (!field) return null
185
-
186
- return {
187
- typeInfo: this.getTypeSignature(field.type),
188
- description: field.description || undefined,
189
- deprecated: field.deprecationReason
190
- ? {
191
- reason: field.deprecationReason,
192
- }
193
- : undefined,
194
- }
195
- }
196
-
197
- // Argument-level documentation
198
- if (fieldName && argName && schemaPath.length === 3) {
199
- const field = this.getFieldFromType(type, fieldName)
200
- if (!field || !(`args` in field)) return null
201
-
202
- const arg = field.args.find((a: any) => a.name === argName)
203
- if (!arg) return null
204
-
205
- return {
206
- typeInfo: this.getTypeSignature(arg.type),
207
- description: arg.description || undefined,
208
- defaultValue: arg.defaultValue !== undefined
209
- ? String(arg.defaultValue)
210
- : undefined,
211
- }
212
- }
213
-
214
- return null
215
- }
216
-
217
- /**
218
- * Generate a reference URL for a schema path
219
- */
220
- generateReferenceLink(schemaPath: string[]): string {
221
- const basePath = this.routeConfig.basePath || `/reference`
222
- const includeFragments = this.routeConfig.includeFragments !== false
223
-
224
- if (schemaPath.length === 0) return basePath
225
-
226
- const [typeName, fieldName, argName] = schemaPath
227
-
228
- // Type reference
229
- if (schemaPath.length === 1) {
230
- return `${basePath}/${typeName}`
231
- }
232
-
233
- // Field reference
234
- if (fieldName && schemaPath.length === 2) {
235
- const fragment = includeFragments ? `#${fieldName}` : ``
236
- return `${basePath}/${typeName}${fragment}`
237
- }
238
-
239
- // Argument reference
240
- if (fieldName && argName && schemaPath.length === 3) {
241
- const fragment = includeFragments ? `#${fieldName}-${argName}` : ``
242
- return `${basePath}/${typeName}${fragment}`
243
- }
244
-
245
- return `${basePath}/${typeName}`
246
- }
247
-
248
- /**
249
- * Check if a type exists in the schema
250
- */
251
- typeExists(typeName: string): boolean {
252
- return !!this.schema.getType(typeName)
253
- }
254
-
255
- /**
256
- * Get all available types for validation
257
- */
258
- getAllTypes(): string[] {
259
- return Object.keys(this.schema.getTypeMap())
260
- .filter(name => !name.startsWith(`__`)) // Filter out introspection types
261
- }
262
-
263
- // Private helper methods
264
-
265
- private resolveType(identifier: Identifier, basePath: string): SchemaResolution {
266
- const type = this.schema.getType(identifier.name)
267
-
268
- return {
269
- exists: !!type,
270
- graphqlType: type || undefined,
271
- referenceUrl: `${basePath}/${identifier.name}`,
272
- documentation: type
273
- ? {
274
- typeInfo: this.getTypeSignature(type),
275
- description: type.description || undefined,
276
- }
277
- : undefined,
278
- }
279
- }
280
-
281
- private resolveField(identifier: Identifier, basePath: string): SchemaResolution {
282
- if (!identifier.parentType) {
283
- return {
284
- exists: false,
285
- referenceUrl: `${basePath}#${identifier.name}`,
286
- }
287
- }
288
-
289
- const parentType = this.schema.getType(identifier.parentType)
290
- if (!parentType) {
291
- return {
292
- exists: false,
293
- referenceUrl: `${basePath}/${identifier.parentType}#${identifier.name}`,
294
- }
295
- }
296
-
297
- const field = this.getFieldFromType(parentType, identifier.name)
298
-
299
- return {
300
- exists: !!field,
301
- referenceUrl: `${basePath}/${identifier.parentType}#${identifier.name}`,
302
- documentation: field
303
- ? {
304
- typeInfo: this.getTypeSignature(field.type),
305
- description: field.description || undefined,
306
- deprecated: field.deprecationReason
307
- ? {
308
- reason: field.deprecationReason,
309
- }
310
- : undefined,
311
- }
312
- : undefined,
313
- deprecated: field?.deprecationReason
314
- ? {
315
- reason: field.deprecationReason,
316
- }
317
- : undefined,
318
- }
319
- }
320
-
321
- private resolveArgument(identifier: Identifier, basePath: string): SchemaResolution {
322
- const schemaPath = identifier.schemaPath
323
- if (schemaPath.length < 3) {
324
- return {
325
- exists: false,
326
- referenceUrl: `${basePath}#${identifier.name}`,
327
- }
328
- }
329
-
330
- const [typeName, fieldName] = schemaPath
331
- if (!typeName || !fieldName) {
332
- return {
333
- exists: false,
334
- referenceUrl: `${basePath}#${identifier.name}`,
335
- }
336
- }
337
-
338
- const parentType = this.schema.getType(typeName)
339
- if (!parentType) {
340
- return {
341
- exists: false,
342
- referenceUrl: `${basePath}/${typeName}#${fieldName}-${identifier.name}`,
343
- }
344
- }
345
-
346
- const field = this.getFieldFromType(parentType, fieldName)
347
- if (!field || !(`args` in field)) {
348
- return {
349
- exists: false,
350
- referenceUrl: `${basePath}/${typeName}#${fieldName}-${identifier.name}`,
351
- }
352
- }
353
-
354
- const arg = field.args.find((a: any) => a.name === identifier.name)
355
-
356
- return {
357
- exists: !!arg,
358
- referenceUrl: `${basePath}/${typeName}#${fieldName}-${identifier.name}`,
359
- documentation: arg
360
- ? {
361
- typeInfo: this.getTypeSignature(arg.type),
362
- description: arg.description || undefined,
363
- defaultValue: arg.defaultValue !== undefined
364
- ? String(arg.defaultValue)
365
- : undefined,
366
- }
367
- : undefined,
368
- }
369
- }
370
-
371
- private resolveDirective(identifier: Identifier, basePath: string): SchemaResolution {
372
- const directive = this.schema.getDirective(identifier.name)
373
-
374
- return {
375
- exists: !!directive,
376
- referenceUrl: `${basePath}/directives#${identifier.name}`,
377
- documentation: directive
378
- ? {
379
- typeInfo: `Directive`,
380
- description: directive.description || undefined,
381
- }
382
- : undefined,
383
- }
384
- }
385
-
386
- private getFieldFromType(type: GraphQLType, fieldName: string): GraphQLField<any, any> | GraphQLInputField | null {
387
- if (isObjectType(type) || isInterfaceType(type)) {
388
- return type.getFields()[fieldName] || null
389
- }
390
-
391
- if (isInputObjectType(type)) {
392
- return type.getFields()[fieldName] || null
393
- }
394
-
395
- return null
396
- }
397
-
398
- private getTypeSignature(type: GraphQLType): string {
399
- if (isNonNullType(type)) {
400
- return `${this.getTypeSignature(type.ofType)}!`
401
- }
402
-
403
- if (isListType(type)) {
404
- return `[${this.getTypeSignature(type.ofType)}]`
405
- }
406
-
407
- return getNamedType(type).name
408
- }
409
- }
410
-
411
- /**
412
- * Create a schema resolver for Polen
413
- */
414
- export const createPolenSchemaResolver = (
415
- schema: GraphQLSchema,
416
- routeConfig?: RouteConfig,
417
- ): SchemaResolver => {
418
- return new PolenSchemaResolver(schema, routeConfig)
419
- }
420
-
421
- /**
422
- * Enhanced analysis result with schema resolution
423
- */
424
- export interface SchemaAwareAnalysisResult {
425
- /** Original analysis result */
426
- analysis: import('./types.js').AnalysisResult
427
- /** Schema resolutions for all identifiers */
428
- resolutions: Map<string, SchemaResolution>
429
- /** Validation errors from schema checking */
430
- schemaErrors: {
431
- identifier: Identifier
432
- message: string
433
- severity: `error` | `warning`
434
- }[]
435
- }
436
-
437
- /**
438
- * Perform schema-aware analysis of a GraphQL document
439
- */
440
- export const analyzeWithSchema = (
441
- source: string,
442
- schema: GraphQLSchema,
443
- routeConfig?: RouteConfig,
444
- ): SchemaAwareAnalysisResult => {
445
- const analysis = analyze(source, {
446
- schema,
447
- validateAgainstSchema: true,
448
- includePositions: true,
449
- })
450
-
451
- const resolver = createPolenSchemaResolver(schema, routeConfig)
452
- const resolutions = new Map<string, SchemaResolution>()
453
- const schemaErrors: SchemaAwareAnalysisResult[`schemaErrors`] = []
454
-
455
- // Resolve all identifiers against schema
456
- for (const identifier of analysis.identifiers.all) {
457
- const key = `${identifier.position.start}-${identifier.name}-${identifier.kind}`
458
- const resolution = resolver.resolveIdentifier(identifier)
459
-
460
- if (resolution) {
461
- resolutions.set(key, resolution)
462
-
463
- // Add validation errors for non-existent identifiers
464
- if (!resolution.exists && (identifier.kind === `Type` || identifier.kind === `Field`)) {
465
- schemaErrors.push({
466
- identifier,
467
- message: `${identifier.kind} "${identifier.name}" does not exist in schema`,
468
- severity: `error`,
469
- })
470
- }
471
-
472
- // Add deprecation warnings
473
- if (resolution.deprecated) {
474
- schemaErrors.push({
475
- identifier,
476
- message: `${identifier.kind} "${identifier.name}" is deprecated: ${resolution.deprecated.reason}`,
477
- severity: `warning`,
478
- })
479
- }
480
- }
481
- }
482
-
483
- return {
484
- analysis,
485
- resolutions,
486
- schemaErrors,
487
- }
488
- }
@@ -1,129 +0,0 @@
1
- import type { DocumentNode, GraphQLError, GraphQLSchema } from 'graphql'
2
-
3
- /**
4
- * Represents a GraphQL identifier found in a document
5
- */
6
- export interface Identifier {
7
- /** The name of the identifier (e.g., 'User', 'name', 'id') */
8
- name: string
9
- /** The kind of GraphQL construct this identifier represents */
10
- kind: `Type` | `Field` | `Argument` | `Directive` | `Variable` | `Fragment`
11
- /** Position information in the source document */
12
- position: {
13
- /** Character offset from start of document */
14
- start: number
15
- /** Character offset for end of identifier */
16
- end: number
17
- /** Line number (1-based) */
18
- line: number
19
- /** Column number (1-based) */
20
- column: number
21
- }
22
- /** The parent type name if this is a field or argument */
23
- parentType?: string
24
- /** Path through the schema to this identifier (e.g., ['User', 'posts', 'title']) */
25
- schemaPath: string[]
26
- /** Context about where this identifier appears */
27
- context: IdentifierContext
28
- }
29
-
30
- /**
31
- * Additional context about where an identifier appears in the document
32
- */
33
- export interface IdentifierContext {
34
- /** The operation type if this identifier is within an operation */
35
- operationType?: `query` | `mutation` | `subscription`
36
- /** The operation name if this identifier is within a named operation */
37
- operationName?: string
38
- /** Whether this identifier is in a fragment definition */
39
- inFragment?: string
40
- /** The selection path leading to this identifier */
41
- selectionPath: string[]
42
- }
43
-
44
- /**
45
- * Map of all identifiers found in a GraphQL document
46
- */
47
- export interface IdentifierMap {
48
- /** Quick lookup by character position */
49
- byPosition: Map<number, Identifier>
50
- /** Grouped by identifier kind for easy filtering */
51
- byKind: Map<Identifier[`kind`], Identifier[]>
52
- /** Any validation errors found during analysis */
53
- errors: AnalysisError[]
54
- /** All identifiers as a flat array */
55
- all: Identifier[]
56
- }
57
-
58
- /**
59
- * Analysis error with context about the identifier that caused it
60
- */
61
- export interface AnalysisError {
62
- /** The identifier that caused the error (if applicable) */
63
- identifier?: Identifier
64
- /** Human-readable error message */
65
- message: string
66
- /** Error severity level */
67
- severity: `error` | `warning` | `info`
68
- /** Position in the document where the error occurred */
69
- position?: {
70
- line: number
71
- column: number
72
- }
73
- }
74
-
75
- /**
76
- * Result of analyzing a GraphQL document
77
- */
78
- export interface AnalysisResult {
79
- /** The parsed AST */
80
- ast: DocumentNode
81
- /** Map of all identifiers found */
82
- identifiers: IdentifierMap
83
- /** Whether the document parsed successfully */
84
- isValid: boolean
85
- /** Any parse or validation errors */
86
- errors: GraphQLError[]
87
- }
88
-
89
- /**
90
- * Configuration for GraphQL document analysis
91
- */
92
- export interface AnalysisConfig {
93
- /** Whether to include position information for identifiers */
94
- includePositions?: boolean
95
- /** Whether to validate against a schema (if provided) */
96
- validateAgainstSchema?: boolean
97
- /** Schema to validate against */
98
- schema?: GraphQLSchema
99
- /** Whether to extract fragment information */
100
- includeFragments?: boolean
101
- }
102
-
103
- /**
104
- * Interface for the main GraphQL analyzer
105
- */
106
- export interface GraphQLAnalyzer {
107
- /**
108
- * Parse a GraphQL document string into an AST
109
- */
110
- parse(source: string): DocumentNode
111
-
112
- /**
113
- * Extract all identifiers from a GraphQL AST
114
- */
115
- extractIdentifiers(ast: DocumentNode, config?: AnalysisConfig): IdentifierMap
116
-
117
- /**
118
- * Validate a GraphQL document against a schema
119
- */
120
- validateAgainstSchema(
121
- ast: DocumentNode,
122
- schema: GraphQLSchema,
123
- ): GraphQLError[]
124
-
125
- /**
126
- * Perform complete analysis of a GraphQL document
127
- */
128
- analyze(source: string, config?: AnalysisConfig): AnalysisResult
129
- }
@@ -1,51 +0,0 @@
1
- import { Pre as CodeHikePre } from 'codehike/code'
2
- import React from 'react'
3
- import { GraphQLDocument } from '../../lib/graphql-document/components/GraphQLDocument.js'
4
-
5
- type CodeHikePreProps = React.ComponentProps<typeof CodeHikePre>
6
- type HTMLPreProps = React.ComponentPropsWithoutRef<'pre'>
7
- type PreProps = CodeHikePreProps | HTMLPreProps
8
-
9
- /**
10
- * Custom Pre component that adds interactive GraphQL support to Code Hike
11
- *
12
- * Usage in MDX:
13
- * ```graphql interactive
14
- * query { ... }
15
- * ```
16
- */
17
- export const Pre: React.FC<PreProps> = (props) => {
18
- // Check if this is a Code Hike pre component (has 'code' prop)
19
- if ('code' in props && props.code) {
20
- const { code } = props
21
-
22
- // Check if this is an interactive GraphQL block
23
- if (code.lang === 'graphql' && code.meta?.includes('interactive')) {
24
- // Extract the GraphQL schema if available
25
- const schema = typeof window !== 'undefined'
26
- ? (window as any).__POLEN_GRAPHQL_SCHEMA__
27
- : null
28
-
29
- // For interactive GraphQL blocks, we need to apply Code Hike's styling
30
- // but add GraphQLDocument's interactive features
31
- return (
32
- <GraphQLDocument
33
- schema={schema}
34
- options={{
35
- className: 'ch-code-container',
36
- // Use Code Hike's Pre component for rendering
37
- renderCode: () => <CodeHikePre {...props as CodeHikePreProps} />,
38
- }}
39
- >
40
- {code.code}
41
- </GraphQLDocument>
42
- )
43
- }
44
-
45
- // For other Code Hike code blocks, use Code Hike's Pre
46
- return <CodeHikePre {...props as CodeHikePreProps} />
47
- }
48
-
49
- // For standard HTML pre elements, render as-is
50
- return <pre {...props as HTMLPreProps} />
51
- }
@@ -1,34 +0,0 @@
1
- import { Grafaid } from '#lib/grafaid/index'
2
- import { ReactRouterAid } from '#lib/react-router-aid/index'
3
- import { useLoaderData } from '#lib/react-router-loader/react-router-loader'
4
- import { useParams } from 'react-router'
5
- import { Field } from '../components/Field.js'
6
- import { MissingSchema } from '../components/MissingSchema.js'
7
- import type { reference } from './reference.js'
8
-
9
- const Component = () => {
10
- const params = useParams() as { type: string; field: string }
11
- const data = useLoaderData<typeof reference.loader>(`reference`)
12
- if (!data.schema) {
13
- return <MissingSchema />
14
- }
15
-
16
- const type = data.schema.getType(params.type)
17
- if (!type) return `Could not find type ${params.type}`
18
- if (!Grafaid.Schema.TypesLike.isFielded(type)) {
19
- return `Type ${params.type} does not have fields`
20
- }
21
-
22
- const fields = type.getFields()
23
- const field = fields[params.field]
24
- if (!field) {
25
- return `Could not find field ${params.field} on type ${params.type}`
26
- }
27
-
28
- return <Field data={field} />
29
- }
30
-
31
- export const reference$type$field = ReactRouterAid.createRoute({
32
- path: `:type/:field`,
33
- Component,
34
- })