eddev 2.0.0-beta.15 → 2.0.0-beta.152

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 (458) hide show
  1. package/css/editor-styles.css +4 -0
  2. package/dist/app/entry/HydrationOverlay.d.ts +2 -0
  3. package/dist/app/entry/HydrationOverlay.d.ts.map +1 -0
  4. package/dist/app/entry/HydrationOverlay.js +2 -0
  5. package/dist/app/entry/MetaTags.d.ts +8 -0
  6. package/dist/app/entry/MetaTags.d.ts.map +1 -0
  7. package/dist/app/entry/MetaTags.js +30 -0
  8. package/dist/app/entry/boot-admin.d.ts +1 -0
  9. package/dist/app/entry/boot-admin.d.ts.map +1 -0
  10. package/dist/app/entry/boot-admin.js +7 -3
  11. package/dist/app/entry/hydration-script.d.ts +2 -0
  12. package/dist/app/entry/hydration-script.d.ts.map +1 -0
  13. package/dist/app/entry/hydration-script.js +18 -0
  14. package/dist/app/entry/spa-root.d.ts +1 -0
  15. package/dist/app/entry/spa-root.d.ts.map +1 -0
  16. package/dist/app/entry/spa-root.js +3 -5
  17. package/dist/app/entry/ssr-root-client.d.ts +4 -1
  18. package/dist/app/entry/ssr-root-client.d.ts.map +1 -0
  19. package/dist/app/entry/ssr-root-client.js +18 -6
  20. package/dist/app/entry/ssr-root.d.ts +4 -4
  21. package/dist/app/entry/ssr-root.d.ts.map +1 -0
  22. package/dist/app/entry/ssr-root.js +19 -19
  23. package/dist/app/lib/admin/defineField.d.ts +1 -0
  24. package/dist/app/lib/admin/defineField.d.ts.map +1 -0
  25. package/dist/app/lib/admin/defineWidget.d.ts +1 -0
  26. package/dist/app/lib/admin/defineWidget.d.ts.map +1 -0
  27. package/dist/app/lib/admin/index.d.ts +1 -0
  28. package/dist/app/lib/admin/index.d.ts.map +1 -0
  29. package/dist/app/lib/admin/installFieldTypes.d.ts +1 -0
  30. package/dist/app/lib/admin/installFieldTypes.d.ts.map +1 -0
  31. package/dist/app/lib/admin/installFieldTypes.js +3 -1
  32. package/dist/app/lib/admin/runWidgets.d.ts +1 -0
  33. package/dist/app/lib/admin/runWidgets.d.ts.map +1 -0
  34. package/dist/app/lib/admin/runWidgets.js +8 -3
  35. package/dist/app/lib/blocks/ContentBlocks.d.ts +7 -4
  36. package/dist/app/lib/blocks/ContentBlocks.d.ts.map +1 -0
  37. package/dist/app/lib/blocks/ContentBlocks.js +6 -5
  38. package/dist/app/lib/blocks/EditableText.d.ts +16 -2
  39. package/dist/app/lib/blocks/EditableText.d.ts.map +1 -0
  40. package/dist/app/lib/blocks/EditableText.js +11 -4
  41. package/dist/app/lib/blocks/InnerBlocks.d.ts +22 -7
  42. package/dist/app/lib/blocks/InnerBlocks.d.ts.map +1 -0
  43. package/dist/app/lib/blocks/InnerBlocks.js +75 -28
  44. package/dist/app/lib/blocks/block-utils.d.ts +3 -2
  45. package/dist/app/lib/blocks/block-utils.d.ts.map +1 -0
  46. package/dist/app/lib/blocks/block-utils.js +2 -2
  47. package/dist/app/lib/blocks/defineBlock.d.ts +4 -0
  48. package/dist/app/lib/blocks/defineBlock.d.ts.map +1 -0
  49. package/dist/app/lib/blocks/defineBlock.js +9 -0
  50. package/dist/app/lib/blocks/editor/EditorHighlights.d.ts +8 -0
  51. package/dist/app/lib/blocks/editor/EditorHighlights.d.ts.map +1 -0
  52. package/dist/app/lib/blocks/editor/EditorHighlights.js +164 -0
  53. package/dist/app/lib/blocks/editor/EditorSupport.d.ts +1 -0
  54. package/dist/app/lib/blocks/editor/EditorSupport.d.ts.map +1 -0
  55. package/dist/app/lib/blocks/editor/EditorSupport.js +17 -12
  56. package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts +2 -1
  57. package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts.map +1 -0
  58. package/dist/app/lib/blocks/editor/block-templates.d.ts +7 -0
  59. package/dist/app/lib/blocks/editor/block-templates.d.ts.map +1 -0
  60. package/dist/app/lib/blocks/editor/block-templates.js +64 -0
  61. package/dist/app/lib/blocks/editor/blocks-by-tag.d.ts +1 -0
  62. package/dist/app/lib/blocks/editor/blocks-by-tag.d.ts.map +1 -0
  63. package/dist/app/lib/blocks/editor/controls.d.ts +1 -0
  64. package/dist/app/lib/blocks/editor/controls.d.ts.map +1 -0
  65. package/dist/app/lib/blocks/editor/create-block.d.ts +10 -0
  66. package/dist/app/lib/blocks/editor/create-block.d.ts.map +1 -0
  67. package/dist/app/lib/blocks/editor/create-block.js +13 -0
  68. package/dist/app/lib/blocks/editor/editor-config.d.ts +74 -7
  69. package/dist/app/lib/blocks/editor/editor-config.d.ts.map +1 -0
  70. package/dist/app/lib/blocks/editor/editor-config.js +29 -62
  71. package/dist/app/lib/blocks/editor/installGutenbergHooks.d.ts +4 -0
  72. package/dist/app/lib/blocks/editor/installGutenbergHooks.d.ts.map +1 -0
  73. package/dist/app/lib/blocks/editor/installGutenbergHooks.js +96 -18
  74. package/dist/app/lib/blocks/editor/root-blocks.d.ts +7 -0
  75. package/dist/app/lib/blocks/editor/root-blocks.d.ts.map +1 -0
  76. package/dist/app/lib/blocks/editor/root-blocks.js +30 -0
  77. package/dist/app/lib/blocks/editor/usePostEditor.d.ts +13 -2
  78. package/dist/app/lib/blocks/editor/usePostEditor.d.ts.map +1 -0
  79. package/dist/app/lib/blocks/editor/usePostEditor.js +28 -13
  80. package/dist/app/lib/blocks/index.d.ts +11 -9
  81. package/dist/app/lib/blocks/index.d.ts.map +1 -0
  82. package/dist/app/lib/blocks/index.js +10 -9
  83. package/dist/app/lib/blocks/inline-editing.d.ts +11 -1
  84. package/dist/app/lib/blocks/inline-editing.d.ts.map +1 -0
  85. package/dist/app/lib/blocks/inline-editing.js +15 -5
  86. package/dist/app/lib/devtools/components/BreakpointIndicator.d.ts +1 -0
  87. package/dist/app/lib/devtools/components/BreakpointIndicator.d.ts.map +1 -0
  88. package/dist/app/lib/devtools/components/BreakpointIndicator.js +2 -2
  89. package/dist/app/lib/devtools/components/DevUI.d.ts +1 -0
  90. package/dist/app/lib/devtools/components/DevUI.d.ts.map +1 -0
  91. package/dist/app/lib/devtools/components/DevUI.js +4 -3
  92. package/dist/app/lib/devtools/components/GridIndicator.d.ts +2 -0
  93. package/dist/app/lib/devtools/components/GridIndicator.d.ts.map +1 -0
  94. package/dist/app/lib/devtools/components/GridIndicator.js +29 -0
  95. package/dist/app/lib/devtools/dev-tools-store.d.ts +1 -0
  96. package/dist/app/lib/devtools/dev-tools-store.d.ts.map +1 -0
  97. package/dist/app/lib/devtools/hooks/usePersistState.d.ts +2 -1
  98. package/dist/app/lib/devtools/hooks/usePersistState.d.ts.map +1 -0
  99. package/dist/app/lib/devtools/hooks/usePersistState.js +11 -2
  100. package/dist/app/lib/devtools/hooks/useTailwind.d.ts +2306 -1261
  101. package/dist/app/lib/devtools/hooks/useTailwind.d.ts.map +1 -0
  102. package/dist/app/lib/devtools/hooks/useTailwind.js +1 -1
  103. package/dist/app/lib/devtools/index.d.ts +2 -1
  104. package/dist/app/lib/devtools/index.d.ts.map +1 -0
  105. package/dist/app/lib/devtools/index.js +1 -1
  106. package/dist/app/lib/devtools/loader.d.ts +1 -0
  107. package/dist/app/lib/devtools/loader.d.ts.map +1 -0
  108. package/dist/app/lib/devtools/loader.js +8 -7
  109. package/dist/app/lib/devtools/tailwind.config.d.ts +1 -0
  110. package/dist/app/lib/devtools/tailwind.config.d.ts.map +1 -0
  111. package/dist/app/lib/devtools/useQueryDebug.d.ts +8 -1
  112. package/dist/app/lib/devtools/useQueryDebug.d.ts.map +1 -0
  113. package/dist/app/lib/devtools/useQueryDebug.js +5 -8
  114. package/dist/app/lib/dynamic/dynamic.d.ts +2 -1
  115. package/dist/app/lib/dynamic/dynamic.d.ts.map +1 -0
  116. package/dist/app/lib/dynamic/dynamic.js +5 -1
  117. package/dist/app/lib/dynamic/index.d.ts +2 -1
  118. package/dist/app/lib/dynamic/index.d.ts.map +1 -0
  119. package/dist/app/lib/dynamic/index.js +1 -1
  120. package/dist/app/lib/hooks/index.d.ts +5 -5
  121. package/dist/app/lib/hooks/index.d.ts.map +1 -0
  122. package/dist/app/lib/hooks/index.js +4 -5
  123. package/dist/app/lib/hooks/{queryUtils.d.ts → query-hooks.d.ts} +38 -3
  124. package/dist/app/lib/hooks/query-hooks.d.ts.map +1 -0
  125. package/dist/app/lib/hooks/{queryUtils.js → query-hooks.js} +83 -29
  126. package/dist/app/lib/hooks/useAppData.d.ts +1 -0
  127. package/dist/app/lib/hooks/useAppData.d.ts.map +1 -0
  128. package/dist/app/lib/hooks/useAppData.js +12 -1
  129. package/dist/app/lib/hooks/useRPC.d.ts +1 -4
  130. package/dist/app/lib/hooks/useRPC.d.ts.map +1 -0
  131. package/dist/app/lib/hooks/useRPC.js +1 -8
  132. package/dist/app/lib/integrations/gravityforms/index.d.ts +3 -0
  133. package/dist/app/lib/integrations/gravityforms/index.d.ts.map +1 -0
  134. package/dist/app/lib/integrations/gravityforms/index.js +2 -0
  135. package/dist/app/lib/integrations/gravityforms/types.d.ts +141 -0
  136. package/dist/app/lib/integrations/gravityforms/types.d.ts.map +1 -0
  137. package/dist/app/lib/integrations/gravityforms/types.js +1 -0
  138. package/dist/app/lib/integrations/gravityforms/useGravityForm.d.ts +31 -0
  139. package/dist/app/lib/integrations/gravityforms/useGravityForm.d.ts.map +1 -0
  140. package/dist/app/lib/integrations/gravityforms/useGravityForm.js +285 -0
  141. package/dist/app/lib/internal/finalize-rpc.d.ts +18 -0
  142. package/dist/app/lib/internal/finalize-rpc.d.ts.map +1 -0
  143. package/dist/app/lib/internal/finalize-rpc.js +3 -0
  144. package/dist/app/lib/internal/index.d.ts +2 -0
  145. package/dist/app/lib/internal/index.d.ts.map +1 -0
  146. package/dist/app/lib/internal/index.js +1 -0
  147. package/dist/app/lib/internal/internal-store.d.ts +1 -0
  148. package/dist/app/lib/internal/internal-store.d.ts.map +1 -0
  149. package/dist/app/lib/internal/read-admin-manifest.d.ts +2 -1
  150. package/dist/app/lib/internal/read-admin-manifest.d.ts.map +1 -0
  151. package/dist/app/lib/internal/read-block-manifest.d.ts +1 -0
  152. package/dist/app/lib/internal/read-block-manifest.d.ts.map +1 -0
  153. package/dist/app/lib/internal/read-view-manifest.d.ts +1 -0
  154. package/dist/app/lib/internal/read-view-manifest.d.ts.map +1 -0
  155. package/dist/app/lib/legacy-stitches/createStitches.d.ts +22 -21
  156. package/dist/app/lib/legacy-stitches/createStitches.d.ts.map +1 -0
  157. package/dist/app/lib/legacy-stitches/createStitches.js +1 -1
  158. package/dist/app/lib/legacy-stitches/index.d.ts +2 -1
  159. package/dist/app/lib/legacy-stitches/index.d.ts.map +1 -0
  160. package/dist/app/lib/legacy-stitches/index.js +1 -1
  161. package/dist/app/lib/routing/components/BackButton.d.ts +50 -0
  162. package/dist/app/lib/routing/components/BackButton.d.ts.map +1 -0
  163. package/dist/app/lib/routing/components/BackButton.js +47 -0
  164. package/dist/app/lib/routing/components/BrowserRouter.d.ts +6 -1
  165. package/dist/app/lib/routing/components/BrowserRouter.d.ts.map +1 -0
  166. package/dist/app/lib/routing/components/BrowserRouter.js +98 -19
  167. package/dist/app/lib/routing/components/ClientOnly.d.ts +2 -1
  168. package/dist/app/lib/routing/components/ClientOnly.d.ts.map +1 -0
  169. package/dist/app/lib/routing/components/ClientOnly.js +2 -2
  170. package/dist/app/lib/routing/components/Link.d.ts +2 -0
  171. package/dist/app/lib/routing/components/Link.d.ts.map +1 -0
  172. package/dist/app/lib/routing/components/Link.js +14 -12
  173. package/dist/app/lib/routing/components/RouteRenderer.d.ts +2 -1
  174. package/dist/app/lib/routing/components/RouteRenderer.d.ts.map +1 -0
  175. package/dist/app/lib/routing/components/RouteRenderer.js +7 -6
  176. package/dist/app/lib/routing/components/SSRRouter.d.ts +3 -2
  177. package/dist/app/lib/routing/components/SSRRouter.d.ts.map +1 -0
  178. package/dist/app/lib/routing/components/SSRRouter.js +5 -6
  179. package/dist/app/lib/routing/components/ScrollRestoration.d.ts +1 -0
  180. package/dist/app/lib/routing/components/ScrollRestoration.d.ts.map +1 -0
  181. package/dist/app/lib/routing/components/ScrollRestoration.js +5 -2
  182. package/dist/app/lib/routing/context.d.ts +9 -5
  183. package/dist/app/lib/routing/context.d.ts.map +1 -0
  184. package/dist/app/lib/routing/context.js +13 -96
  185. package/dist/app/lib/routing/hooks/useIsSSR.d.ts +1 -0
  186. package/dist/app/lib/routing/hooks/useIsSSR.d.ts.map +1 -0
  187. package/dist/app/lib/routing/hooks/useRestorableState.d.ts +3 -1
  188. package/dist/app/lib/routing/hooks/useRestorableState.d.ts.map +1 -0
  189. package/dist/app/lib/routing/hooks/useRestorableState.js +2 -1
  190. package/dist/app/lib/routing/hooks/useRoute.d.ts +17 -1
  191. package/dist/app/lib/routing/hooks/useRoute.d.ts.map +1 -0
  192. package/dist/app/lib/routing/hooks/useRoute.js +22 -1
  193. package/dist/app/lib/routing/hooks/useRouteMeta.d.ts +6 -0
  194. package/dist/app/lib/routing/hooks/useRouteMeta.d.ts.map +1 -0
  195. package/dist/app/lib/routing/hooks/useRouteMeta.js +9 -0
  196. package/dist/app/lib/routing/hooks/useRouteTransition.d.ts +2 -1
  197. package/dist/app/lib/routing/hooks/useRouteTransition.d.ts.map +1 -0
  198. package/dist/app/lib/routing/hooks/useRouteTransition.js +1 -1
  199. package/dist/app/lib/routing/hooks/useRouter.d.ts +2 -1
  200. package/dist/app/lib/routing/hooks/useRouter.d.ts.map +1 -0
  201. package/dist/app/lib/routing/hooks/useRouter.js +1 -1
  202. package/dist/app/lib/routing/hooks/useRouterEvents.d.ts +2 -1
  203. package/dist/app/lib/routing/hooks/useRouterEvents.d.ts.map +1 -0
  204. package/dist/app/lib/routing/hooks/useRouterEvents.js +1 -1
  205. package/dist/app/lib/routing/hooks/useRouterState.d.ts +2 -1
  206. package/dist/app/lib/routing/hooks/useRouterState.d.ts.map +1 -0
  207. package/dist/app/lib/routing/hooks/useRouterState.js +1 -1
  208. package/dist/app/lib/routing/hooks/useSearchParams.d.ts +76 -4
  209. package/dist/app/lib/routing/hooks/useSearchParams.d.ts.map +1 -0
  210. package/dist/app/lib/routing/hooks/useSearchParams.js +72 -13
  211. package/dist/app/lib/routing/index.d.ts +15 -13
  212. package/dist/app/lib/routing/index.d.ts.map +1 -0
  213. package/dist/app/lib/routing/index.js +14 -13
  214. package/dist/app/lib/routing/loader.d.ts +3 -2
  215. package/dist/app/lib/routing/loader.d.ts.map +1 -0
  216. package/dist/app/lib/routing/loader.js +20 -11
  217. package/dist/app/lib/routing/types.d.ts +51 -10
  218. package/dist/app/lib/routing/types.d.ts.map +1 -0
  219. package/dist/app/lib/routing/utils.d.ts +6 -2
  220. package/dist/app/lib/routing/utils.d.ts.map +1 -0
  221. package/dist/app/lib/routing/utils.js +37 -4
  222. package/dist/app/lib/{hooks → runtime}/apiConfig.d.ts +11 -2
  223. package/dist/app/lib/runtime/apiConfig.d.ts.map +1 -0
  224. package/dist/app/lib/runtime/apiConfig.js +6 -0
  225. package/dist/app/lib/runtime/errorHandling.d.ts +40 -0
  226. package/dist/app/lib/runtime/errorHandling.d.ts.map +1 -0
  227. package/dist/app/lib/runtime/errorHandling.js +6 -0
  228. package/dist/app/lib/runtime/index.d.ts +3 -0
  229. package/dist/app/lib/runtime/index.d.ts.map +1 -0
  230. package/dist/app/lib/runtime/index.js +2 -0
  231. package/dist/app/lib/views/defineView.d.ts +2 -1
  232. package/dist/app/lib/views/defineView.d.ts.map +1 -0
  233. package/dist/app/lib/views/index.d.ts +2 -1
  234. package/dist/app/lib/views/index.d.ts.map +1 -0
  235. package/dist/app/lib/views/index.js +1 -1
  236. package/dist/app/server/index.d.ts +2 -0
  237. package/dist/app/server/index.d.ts.map +1 -0
  238. package/dist/app/server/index.js +1 -0
  239. package/dist/app/server/proxy-wp-admin.d.ts +2 -2
  240. package/dist/app/server/proxy-wp-admin.d.ts.map +1 -0
  241. package/dist/app/server/proxy-wp-admin.js +43 -13
  242. package/dist/app/server/render-ssr-page.d.ts +28 -3
  243. package/dist/app/server/render-ssr-page.d.ts.map +1 -0
  244. package/dist/app/server/render-ssr-page.js +224 -11
  245. package/dist/app/server/rpc.d.ts +49 -0
  246. package/dist/app/server/rpc.d.ts.map +1 -0
  247. package/dist/app/server/rpc.js +18 -0
  248. package/dist/app/server/server-context.d.ts +44 -6
  249. package/dist/app/server/server-context.d.ts.map +1 -0
  250. package/dist/app/server/server-context.js +329 -35
  251. package/dist/app/server/server-custom-config.d.ts +3 -0
  252. package/dist/app/server/server-custom-config.d.ts.map +1 -0
  253. package/dist/app/server/server-custom-config.js +1 -0
  254. package/dist/app/server/utils/content-security.d.ts +26 -0
  255. package/dist/app/server/utils/content-security.d.ts.map +1 -0
  256. package/dist/app/server/utils/content-security.js +124 -0
  257. package/dist/app/server/utils/headers.d.ts +1 -0
  258. package/dist/app/server/utils/headers.d.ts.map +1 -0
  259. package/dist/app/server/utils/replace-host.d.ts +2 -1
  260. package/dist/app/server/utils/replace-host.d.ts.map +1 -0
  261. package/dist/app/server/utils/replace-host.js +10 -2
  262. package/dist/app/server/utils/swr-cache.d.ts +5 -0
  263. package/dist/app/server/utils/swr-cache.d.ts.map +1 -0
  264. package/dist/app/server/utils/swr-cache.js +31 -0
  265. package/dist/app/utils/APIProvider.d.ts +3 -0
  266. package/dist/app/utils/APIProvider.d.ts.map +1 -0
  267. package/dist/app/utils/APIProvider.js +5 -0
  268. package/dist/app/utils/BlockErrorBoundary.d.ts +20 -0
  269. package/dist/app/utils/BlockErrorBoundary.d.ts.map +1 -0
  270. package/dist/app/utils/BlockErrorBoundary.js +38 -0
  271. package/dist/app/utils/ErrorMessage.d.ts +6 -0
  272. package/dist/app/utils/ErrorMessage.d.ts.map +1 -0
  273. package/dist/app/utils/ErrorMessage.js +14 -0
  274. package/dist/app/utils/RouteErrorBoundary.d.ts +19 -0
  275. package/dist/app/utils/RouteErrorBoundary.d.ts.map +1 -0
  276. package/dist/app/utils/RouteErrorBoundary.js +38 -0
  277. package/dist/app/utils/asset-capture.d.ts +3 -0
  278. package/dist/app/utils/asset-capture.d.ts.map +1 -0
  279. package/dist/app/utils/asset-capture.js +5 -0
  280. package/dist/app/utils/hydration-debugger.d.ts +14 -0
  281. package/dist/app/utils/hydration-debugger.d.ts.map +1 -0
  282. package/dist/app/utils/hydration-debugger.js +11 -0
  283. package/dist/app/utils/query-client.d.ts +3 -0
  284. package/dist/app/utils/query-client.d.ts.map +1 -0
  285. package/dist/app/utils/query-client.js +5 -1
  286. package/dist/app/utils/query-monitor.d.ts +27 -0
  287. package/dist/app/utils/query-monitor.d.ts.map +1 -0
  288. package/dist/app/utils/query-monitor.js +7 -0
  289. package/dist/app/utils/trpc-client.d.ts +3 -0
  290. package/dist/app/utils/trpc-client.d.ts.map +1 -0
  291. package/dist/app/utils/trpc-client.js +39 -0
  292. package/dist/app/utils/wp.d.ts +11 -10
  293. package/dist/app/utils/wp.d.ts.map +1 -0
  294. package/dist/node/cli/cli-mode.d.ts +1 -0
  295. package/dist/node/cli/cli-mode.d.ts.map +1 -0
  296. package/dist/node/cli/cli-worker.d.ts +1 -0
  297. package/dist/node/cli/cli-worker.d.ts.map +1 -0
  298. package/dist/node/cli/cli-worker.js +11 -5
  299. package/dist/node/cli/cli.d.ts +1 -0
  300. package/dist/node/cli/cli.d.ts.map +1 -0
  301. package/dist/node/cli/cli.js +85 -11
  302. package/dist/node/cli/display/CLIApp.d.ts +1 -0
  303. package/dist/node/cli/display/CLIApp.d.ts.map +1 -0
  304. package/dist/node/cli/display/CLIApp.js +3 -6
  305. package/dist/node/cli/display/boot-cli-app.d.ts +1 -0
  306. package/dist/node/cli/display/boot-cli-app.d.ts.map +1 -0
  307. package/dist/node/cli/display/boot-cli-app.js +1 -1
  308. package/dist/node/cli/display/components/Fullscreen.d.ts +1 -0
  309. package/dist/node/cli/display/components/Fullscreen.d.ts.map +1 -0
  310. package/dist/node/cli/display/components/LogEntries.d.ts +1 -0
  311. package/dist/node/cli/display/components/LogEntries.d.ts.map +1 -0
  312. package/dist/node/cli/display/components/MenuItem.d.ts +1 -0
  313. package/dist/node/cli/display/components/MenuItem.d.ts.map +1 -0
  314. package/dist/node/cli/display/components/TextInput.d.ts +1 -0
  315. package/dist/node/cli/display/components/TextInput.d.ts.map +1 -0
  316. package/dist/node/cli/display/hooks/useManifest.d.ts +1 -0
  317. package/dist/node/cli/display/hooks/useManifest.d.ts.map +1 -0
  318. package/dist/node/cli/display/hooks/useStatefulLog.d.ts +1 -0
  319. package/dist/node/cli/display/hooks/useStatefulLog.d.ts.map +1 -0
  320. package/dist/node/cli/display/tools/BlockList.d.ts +1 -0
  321. package/dist/node/cli/display/tools/BlockList.d.ts.map +1 -0
  322. package/dist/node/cli/display/tools/CreateBlock.d.ts +2 -1
  323. package/dist/node/cli/display/tools/CreateBlock.d.ts.map +1 -0
  324. package/dist/node/cli/display/tools/cli-tool-list.d.ts +1 -0
  325. package/dist/node/cli/display/tools/cli-tool-list.d.ts.map +1 -0
  326. package/dist/node/cli/display/tools/cli-tools.d.ts +2 -11
  327. package/dist/node/cli/display/tools/cli-tools.d.ts.map +1 -0
  328. package/dist/node/cli/display/tools/cli-tools.js +9 -9
  329. package/dist/node/cli/display/util/colors.d.ts +1 -0
  330. package/dist/node/cli/display/util/colors.d.ts.map +1 -0
  331. package/dist/node/cli/version.d.ts +2 -1
  332. package/dist/node/cli/version.d.ts.map +1 -0
  333. package/dist/node/cli/version.js +1 -1
  334. package/dist/node/compiler/build-vinxi.d.ts +1 -0
  335. package/dist/node/compiler/build-vinxi.d.ts.map +1 -0
  336. package/dist/node/compiler/build-vinxi.js +2 -1
  337. package/dist/node/compiler/bundler.admin.d.ts +2 -1
  338. package/dist/node/compiler/bundler.admin.d.ts.map +1 -0
  339. package/dist/node/compiler/bundler.admin.js +1 -1
  340. package/dist/node/compiler/bundler.frontend.d.ts +1 -0
  341. package/dist/node/compiler/bundler.frontend.d.ts.map +1 -0
  342. package/dist/node/compiler/bundler.frontend.js +1 -1
  343. package/dist/node/compiler/dev-server.d.ts +1 -0
  344. package/dist/node/compiler/dev-server.d.ts.map +1 -0
  345. package/dist/node/compiler/dev-server.js +11 -0
  346. package/dist/node/compiler/get-vite-config.d.ts +12 -1
  347. package/dist/node/compiler/get-vite-config.d.ts.map +1 -0
  348. package/dist/node/compiler/get-vite-config.js +162 -48
  349. package/dist/node/compiler/vinxi-app.d.ts +13 -0
  350. package/dist/node/compiler/vinxi-app.d.ts.map +1 -0
  351. package/dist/node/compiler/vinxi-app.js +140 -32
  352. package/dist/node/compiler/vinxi-codegen.d.ts +1 -0
  353. package/dist/node/compiler/vinxi-codegen.d.ts.map +1 -0
  354. package/dist/node/compiler/vinxi-codegen.js +351 -99
  355. package/dist/node/graphql/graphql-codegen.d.ts +12 -1
  356. package/dist/node/graphql/graphql-codegen.d.ts.map +1 -0
  357. package/dist/node/graphql/graphql-codegen.js +216 -34
  358. package/dist/node/graphql/graphql-schema-loader.d.ts +3 -1
  359. package/dist/node/graphql/graphql-schema-loader.d.ts.map +1 -0
  360. package/dist/node/graphql/graphql-schema-loader.js +5 -16
  361. package/dist/node/graphql/plugins/gql-plugin-files.d.ts +2 -0
  362. package/dist/node/graphql/plugins/gql-plugin-files.d.ts.map +1 -0
  363. package/dist/node/graphql/plugins/gql-plugin-files.js +1 -0
  364. package/dist/node/graphql/plugins/gql-plugin-no-duplicates.d.ts +1 -0
  365. package/dist/node/graphql/plugins/gql-plugin-no-duplicates.d.ts.map +1 -0
  366. package/dist/node/graphql/plugins/gql-plugin-queries.d.ts +1 -0
  367. package/dist/node/graphql/plugins/gql-plugin-queries.d.ts.map +1 -0
  368. package/dist/node/graphql/plugins/gql-plugin-queries.js +1 -1
  369. package/dist/node/graphql/query-files-loader.d.ts +4 -0
  370. package/dist/node/graphql/query-files-loader.d.ts.map +1 -0
  371. package/dist/node/graphql/query-files-loader.js +5 -0
  372. package/dist/node/graphql/wp-info-query.d.ts +1 -0
  373. package/dist/node/graphql/wp-info-query.d.ts.map +1 -0
  374. package/dist/node/project/config.d.ts +207 -73
  375. package/dist/node/project/config.d.ts.map +1 -0
  376. package/dist/node/project/config.js +94 -20
  377. package/dist/node/project/eddev-build-file.d.ts +1 -0
  378. package/dist/node/project/eddev-build-file.d.ts.map +1 -0
  379. package/dist/node/project/eddev-build-file.js +2 -2
  380. package/dist/node/project/env.d.ts +5 -0
  381. package/dist/node/project/env.d.ts.map +1 -0
  382. package/dist/node/project/env.js +1 -0
  383. package/dist/node/project/favicons.d.ts +1 -0
  384. package/dist/node/project/favicons.d.ts.map +1 -0
  385. package/dist/node/project/manifest/block-manifest.d.ts +1 -0
  386. package/dist/node/project/manifest/block-manifest.d.ts.map +1 -0
  387. package/dist/node/project/manifest/block-manifest.js +3 -1
  388. package/dist/node/project/manifest/field-manifest.d.ts +1 -0
  389. package/dist/node/project/manifest/field-manifest.d.ts.map +1 -0
  390. package/dist/node/project/manifest/manifest.d.ts +2 -0
  391. package/dist/node/project/manifest/manifest.d.ts.map +1 -0
  392. package/dist/node/project/manifest/manifest.js +14 -10
  393. package/dist/node/project/manifest/routes-manifest.d.ts +21 -0
  394. package/dist/node/project/manifest/routes-manifest.d.ts.map +1 -0
  395. package/dist/node/project/manifest/routes-manifest.js +74 -0
  396. package/dist/node/project/manifest/view-manifest.d.ts +1 -0
  397. package/dist/node/project/manifest/view-manifest.d.ts.map +1 -0
  398. package/dist/node/project/manifest/view-manifest.js +1 -1
  399. package/dist/node/project/manifest/widget-manifest.d.ts +1 -0
  400. package/dist/node/project/manifest/widget-manifest.d.ts.map +1 -0
  401. package/dist/node/project/project.d.ts +12 -1
  402. package/dist/node/project/project.d.ts.map +1 -0
  403. package/dist/node/project/project.js +61 -7
  404. package/dist/node/project/wp-info.d.ts +2 -0
  405. package/dist/node/project/wp-info.d.ts.map +1 -0
  406. package/dist/node/project/wp-info.js +13 -1
  407. package/dist/node/storybook/index.d.ts +3 -0
  408. package/dist/node/storybook/index.d.ts.map +1 -0
  409. package/dist/node/storybook/index.js +13 -0
  410. package/dist/node/types/block-type.d.ts +22 -16
  411. package/dist/node/types/block-type.d.ts.map +1 -0
  412. package/dist/node/types/block-type.js +1 -0
  413. package/dist/node/types/view-type.d.ts +8 -7
  414. package/dist/node/types/view-type.d.ts.map +1 -0
  415. package/dist/node/utils/fetch-wp.d.ts +2 -0
  416. package/dist/node/utils/fetch-wp.d.ts.map +1 -0
  417. package/dist/node/utils/fetch-wp.js +27 -0
  418. package/dist/node/utils/format-zod-error.d.ts +1 -0
  419. package/dist/node/utils/format-zod-error.d.ts.map +1 -0
  420. package/dist/node/utils/fs-codegen.d.ts +4 -0
  421. package/dist/node/utils/fs-codegen.d.ts.map +1 -0
  422. package/dist/node/utils/fs-codegen.js +10 -2
  423. package/dist/node/utils/fs.d.ts +5 -0
  424. package/dist/node/utils/fs.d.ts.map +1 -0
  425. package/dist/node/utils/get-repo-info.d.ts +1 -0
  426. package/dist/node/utils/get-repo-info.d.ts.map +1 -0
  427. package/dist/node/utils/helpers.d.ts +1 -0
  428. package/dist/node/utils/helpers.d.ts.map +1 -0
  429. package/dist/node/utils/highlight-code.d.ts +1 -0
  430. package/dist/node/utils/highlight-code.d.ts.map +1 -0
  431. package/dist/node/utils/is-deploying.d.ts +1 -0
  432. package/dist/node/utils/is-deploying.d.ts.map +1 -0
  433. package/dist/node/utils/is-deploying.js +1 -1
  434. package/dist/node/utils/report-builder.d.ts +7 -6
  435. package/dist/node/utils/report-builder.d.ts.map +1 -0
  436. package/dist/node/utils/self-signed-cert.d.ts +3 -0
  437. package/dist/node/utils/self-signed-cert.d.ts.map +1 -0
  438. package/dist/node/utils/self-signed-cert.js +10 -2
  439. package/dist/node/utils/stateful-log.d.ts +1 -0
  440. package/dist/node/utils/stateful-log.d.ts.map +1 -0
  441. package/dist/node/utils/stateful-log.js +2 -0
  442. package/dist/node/utils/ts-export-extractor.d.ts +1 -0
  443. package/dist/node/utils/ts-export-extractor.d.ts.map +1 -0
  444. package/dist/node/utils/watch-file-tree.d.ts +18 -3
  445. package/dist/node/utils/watch-file-tree.d.ts.map +1 -0
  446. package/dist/node/utils/watch-file-tree.js +12 -5
  447. package/package.json +38 -25
  448. package/tsconfig.app.json +8 -3
  449. package/tsconfig.node.json +1 -0
  450. package/types.app.d.ts +4 -2
  451. package/types.app.internal.d.ts +2 -2
  452. package/types.meta.d.ts +116 -0
  453. package/types.node.d.ts +3 -3
  454. package/dist/app/lib/blocks/ErrorBoundaryFrontend.d.ts +0 -15
  455. package/dist/app/lib/blocks/ErrorBoundaryFrontend.js +0 -35
  456. package/dist/app/lib/hooks/apiConfig.js +0 -4
  457. package/dist/app/lib/hooks/usePageLoad.d.ts +0 -6
  458. package/dist/app/lib/hooks/usePageLoad.js +0 -5
@@ -1,5 +1,5 @@
1
1
  import { codegen } from "@graphql-codegen/core";
2
- import { Kind } from "graphql";
2
+ import { Kind, visit, print, } from "graphql";
3
3
  import { NoUnusedFragmentsRule, specifiedRules, validate } from "graphql/validation/index.js";
4
4
  import { join, relative, resolve } from "path";
5
5
  import { ProjectEnvUtils } from "../project/env.js";
@@ -9,13 +9,15 @@ import { createGraphQLFileLoader } from "./query-files-loader.js";
9
9
  import * as typescriptPlugin from "@graphql-codegen/typescript";
10
10
  import * as typescriptOperationsPlugin from "@graphql-codegen/typescript-operations";
11
11
  import chalk from "chalk";
12
- import { code } from "ts-poet";
12
+ import { code, imp } from "ts-poet";
13
13
  import { highlightCode } from "../utils/highlight-code.js";
14
14
  import { createConsole } from "../utils/stateful-log.js";
15
15
  import { watchFileTreeForChanges } from "../utils/watch-file-tree.js";
16
16
  import pluginFiles from "./plugins/gql-plugin-files.js";
17
17
  import pluginNoDuplicates from "./plugins/gql-plugin-no-duplicates.js";
18
18
  import pluginQueries from "./plugins/gql-plugin-queries.js";
19
+ import { FSCodegen } from "../utils/fs-codegen.js";
20
+ import { camelCase } from "change-case-all";
19
21
  export const graphqlLog = createConsole("GraphQL Codegen", "graphql");
20
22
  const console = graphqlLog;
21
23
  class GraphQLValidationError {
@@ -49,6 +51,7 @@ class GraphQLValidationError {
49
51
  }
50
52
  export class GraphQLGenerator {
51
53
  project;
54
+ opts;
52
55
  needsRegenerate = false;
53
56
  needsReload = true;
54
57
  regenerateReason = "";
@@ -56,12 +59,19 @@ export class GraphQLGenerator {
56
59
  isGenerating = false;
57
60
  schemaLoader;
58
61
  fileLoader;
62
+ optimizeWriter;
59
63
  debouncer;
60
64
  retryTimer;
61
- constructor(project) {
65
+ constructor(project, opts) {
62
66
  this.project = project;
63
- this.schemaLoader = new GraphQLSchemaLoader(ProjectEnvUtils.get("DEBUG_GRAPHQL_URL"));
67
+ this.opts = opts;
68
+ this.schemaLoader = new GraphQLSchemaLoader(ProjectEnvUtils.getSafe("DEBUG_GRAPHQL_URL"), ProjectEnvUtils.getSafe("SITE_API_KEY"));
64
69
  this.fileLoader = createGraphQLFileLoader(this.project, [
70
+ {
71
+ baseFolder: "queries/fragments",
72
+ pattern: "**/*.graphql",
73
+ key: "fragments",
74
+ },
65
75
  {
66
76
  baseFolder: "blocks",
67
77
  pattern: "**/*.graphql",
@@ -72,17 +82,44 @@ export class GraphQLGenerator {
72
82
  pattern: "**/*.graphql",
73
83
  key: "views",
74
84
  },
75
- {
76
- baseFolder: "queries/fragments",
77
- pattern: "**/*.graphql",
78
- key: "fragments",
79
- },
80
85
  {
81
86
  baseFolder: "queries",
82
87
  pattern: "**/*.graphql",
83
88
  key: "queries",
84
89
  },
85
90
  ]);
91
+ this.optimizeWriter = new FSCodegen(project, {
92
+ outDir: "./.eddev/queries",
93
+ });
94
+ this.optimizeWriter.register({
95
+ getFiles: async () => {
96
+ const files = await this.fileLoader.get();
97
+ const { queries, fragments } = this.getOptimizedQueries(files, true);
98
+ const optimizedQueries = Object.entries(queries).flatMap(([_, group]) => {
99
+ return Object.entries(group).flatMap(([name, ast]) => {
100
+ let content = [
101
+ ast.leadingComments ? ast.leadingComments + "\n" : "",
102
+ print(ast),
103
+ ast.trailingComments ? "\n" + ast.trailingComments : "",
104
+ ].join("");
105
+ return {
106
+ name,
107
+ content,
108
+ };
109
+ });
110
+ });
111
+ return [
112
+ ...optimizedQueries,
113
+ {
114
+ name: "fragments.json",
115
+ content: JSON.stringify(Object.values(fragments).map(print), null, 2),
116
+ },
117
+ ];
118
+ },
119
+ susbcribe: (callback) => {
120
+ return this.fileLoader.subscribe(callback);
121
+ },
122
+ });
86
123
  }
87
124
  async queueRegenerate(full, reason, info) {
88
125
  this.needsRegenerate = true;
@@ -107,14 +144,29 @@ export class GraphQLGenerator {
107
144
  // Do initial load of blocks
108
145
  await this.project.blocks.get();
109
146
  await this.project.views.get();
110
- try {
111
- await this.generate();
147
+ if (this.opts.generate) {
148
+ try {
149
+ await this.generate();
150
+ }
151
+ catch (err) { }
152
+ }
153
+ if (this.opts.watch) {
154
+ this.project.blocks.subscribeFuture(() => {
155
+ this.generateUtilTypes();
156
+ });
157
+ this.project.serverRoutes.subscribeFuture(() => {
158
+ this.generateAPITypes();
159
+ });
160
+ this.listen();
161
+ }
162
+ if (this.opts.optimize) {
163
+ if (this.opts.watch) {
164
+ await this.optimizeWriter.runAndWatch();
165
+ }
166
+ else {
167
+ await this.optimizeWriter.run();
168
+ }
112
169
  }
113
- catch (err) { }
114
- this.project.blocks.subscribeFuture(() => {
115
- this.generateUtilTypes();
116
- });
117
- this.listen();
118
170
  }
119
171
  async listen() {
120
172
  // Subscribe to changes in block names
@@ -138,14 +190,23 @@ export class GraphQLGenerator {
138
190
  this.queueRegenerate(false, "GraphQL file(s) modifed", events?.map(stringifyFileEvent));
139
191
  });
140
192
  // Look out for PHP and acf-json file changes
141
- watchFileTreeForChanges(["backend/**/*.php"], (event) => {
142
- this.queueRegenerate(true, "PHP file change detected", stringifyFileEvent(event));
193
+ watchFileTreeForChanges({
194
+ pattern: ["backend/**/*.php"],
195
+ callback: (event) => {
196
+ this.queueRegenerate(true, "PHP file change detected", stringifyFileEvent(event));
197
+ },
143
198
  });
144
- watchFileTreeForChanges(["vendor/**/*.php"], (change) => {
145
- this.queueRegenerate(true, "PHP Vendor folder change detected", stringifyFileEvent(change));
199
+ watchFileTreeForChanges({
200
+ pattern: ["vendor/**/*.php"],
201
+ callback: (change) => {
202
+ this.queueRegenerate(true, "PHP Vendor folder change detected", stringifyFileEvent(change));
203
+ },
146
204
  });
147
- watchFileTreeForChanges(["acf-json/**/*.json"], (change) => {
148
- this.queueRegenerate(true, "ACF Field change detected", stringifyFileEvent(change));
205
+ watchFileTreeForChanges({
206
+ pattern: ["acf-json/**/*.json"],
207
+ callback: (change) => {
208
+ this.queueRegenerate(true, "ACF Field change detected", stringifyFileEvent(change));
209
+ },
149
210
  });
150
211
  }
151
212
  scheduleRetry() {
@@ -223,10 +284,14 @@ export class GraphQLGenerator {
223
284
  };
224
285
  const errors = (await Promise.all([
225
286
  this.generateUtilTypes(),
287
+ this.generateAPITypes(),
226
288
  this.generateTS("types.graphql.ts", schemaResult.rawSchema, {
227
289
  documents: getDocuments(["queries", "views", "blocks", "fragments"]),
228
290
  hasDocuments: true,
229
291
  banner: `import { ContentBlock } from "eddev/blocks"`,
292
+ footer: Object.keys(wp.scalarTypes)
293
+ .map((name) => `export type ${name.endsWith("Option") ? name : name + "Scalar"} = Scalars["${name}"]["output"]`)
294
+ .join("\n"),
230
295
  plugins: {
231
296
  typescript: [typescriptPlugin, {}],
232
297
  typescriptOperations: [typescriptOperationsPlugin, {}],
@@ -269,7 +334,12 @@ export class GraphQLGenerator {
269
334
  rootDir: this.project.rootDir,
270
335
  folderName: "views",
271
336
  globalName: "ViewProps",
272
- additionalTypes: {},
337
+ additionalTypes: {
338
+ _error: "ErrorRouteProps",
339
+ },
340
+ banner: `
341
+ import { ErrorRouteProps } from "eddev/routing"
342
+ `,
273
343
  },
274
344
  }),
275
345
  this.generateTS("types.blocks.ts", schemaResult.rawSchema, {
@@ -334,6 +404,69 @@ export class GraphQLGenerator {
334
404
  this.generate();
335
405
  }
336
406
  }
407
+ getOptimizedQueries(graphQLFiles, rewrite = false) {
408
+ const result = {};
409
+ const allFragments = {};
410
+ /**
411
+ * Get all the base fragment definitions
412
+ */
413
+ const baseFragments = new Map();
414
+ Object.values(graphQLFiles.fragments)
415
+ .map((file) => file?.ast?.definitions ?? [])
416
+ .filter((def) => def.length > 0)
417
+ .flat()
418
+ .filter((n) => n.kind === Kind.FRAGMENT_DEFINITION)
419
+ .forEach((node) => baseFragments.set(node.name.value, node));
420
+ baseFragments.forEach((node) => {
421
+ allFragments[node.name.value] = node;
422
+ });
423
+ function findFragments(defs, map = new Map()) {
424
+ // console.log("findFragments", defs.length)
425
+ for (let def of defs) {
426
+ if (def.kind === Kind.FRAGMENT_DEFINITION) {
427
+ map.set(def.name.value, def);
428
+ }
429
+ }
430
+ for (let def of defs) {
431
+ visit(def, {
432
+ FragmentSpread: {
433
+ enter: (node) => {
434
+ const match = baseFragments.get(node.name.value);
435
+ if (match && !map.has(node.name.value)) {
436
+ map.set(node.name.value, match);
437
+ findFragments([match], map);
438
+ }
439
+ },
440
+ },
441
+ });
442
+ }
443
+ return {
444
+ fragments: [...map.values()],
445
+ definitions: defs.filter((n) => n.kind !== Kind.FRAGMENT_DEFINITION),
446
+ };
447
+ }
448
+ for (let [groupName, fileMap] of Object.entries(graphQLFiles)) {
449
+ result[groupName] = {};
450
+ for (let [path, file] of Object.entries(fileMap)) {
451
+ if (!file.parseError) {
452
+ // Find all fragments
453
+ const { fragments, definitions } = findFragments(file?.ast?.definitions ?? []);
454
+ const ast = {
455
+ kind: Kind.DOCUMENT,
456
+ definitions: [...definitions, ...fragments],
457
+ loc: file.ast.loc,
458
+ leadingComments: file.leadingComments,
459
+ trailingComments: file.trailingComments,
460
+ };
461
+ result[groupName][path] = ast;
462
+ }
463
+ }
464
+ }
465
+ return {
466
+ queries: result,
467
+ fragments: allFragments,
468
+ };
469
+ }
337
470
  /**
338
471
  * Validates a GraphQL manifest against a schema, ensuring there are no user errors.
339
472
  */
@@ -342,30 +475,43 @@ export class GraphQLGenerator {
342
475
  * Use all rules, except for No Unused Fragments — since we prepend those fragments to every test
343
476
  */
344
477
  const validationRules = specifiedRules.filter((rule) => rule !== NoUnusedFragmentsRule);
478
+ /**
479
+ * Get the optimized files — queries with all fragments included
480
+ */
481
+ const { queries } = this.getOptimizedQueries(graphQLFiles);
482
+ /**
483
+ * Only report the same error once (mostly for preventing repeats of the same fragment errors)
484
+ */
485
+ const errorsShown = new Map();
345
486
  /**
346
487
  * Validate everything
347
488
  */
348
489
  const report = [];
349
490
  for (let [groupName, fileMap] of Object.entries(graphQLFiles)) {
491
+ const group = queries[groupName];
350
492
  for (let [path, file] of Object.entries(fileMap)) {
351
493
  if (file.parseError) {
352
494
  report.push(new GraphQLValidationError(file.parseError.message, path, file.parseError.line, file.parseError.column, file.contents));
353
495
  }
354
496
  else {
355
497
  // Find all fragments
356
- const fragments = Object.values(graphQLFiles.fragments)
357
- .map((file) => file.ast.definitions)
358
- .filter((def) => def.length > 0)
359
- .filter((def) => def !== file.ast.definitions)
360
- .flat();
361
- const validationAST = {
362
- kind: Kind.DOCUMENT,
363
- definitions: [...fragments, ...file.ast.definitions],
364
- loc: file.ast.loc,
365
- };
498
+ const validationAST = group[path];
499
+ if (!validationAST) {
500
+ continue;
501
+ }
366
502
  const errors = validate(schema, validationAST, validationRules);
367
503
  if (errors.length > 0) {
368
504
  for (let error of errors) {
505
+ if (error.nodes && error.nodes[0]) {
506
+ const node = error.nodes[0];
507
+ if (errorsShown.has(node) && errorsShown.get(node)?.includes(error.message)) {
508
+ continue;
509
+ }
510
+ else {
511
+ errorsShown.set(node, [...(errorsShown.get(node) ?? []), error.message]);
512
+ }
513
+ }
514
+ // console.log(error.nodes?.map((n) => n.kind))
369
515
  report.push(new GraphQLValidationError(error.message, path, error.locations?.[0].line || 1, error.locations?.[0].column || 1, error.source?.body || ""));
370
516
  }
371
517
  }
@@ -400,7 +546,7 @@ export class GraphQLGenerator {
400
546
  errors.push(String(err));
401
547
  }
402
548
  if (args.banner) {
403
- output = args.banner + "\n\n" + output;
549
+ output = args.banner + "\n\n" + output + "\n" + (args.footer ?? "");
404
550
  }
405
551
  if (errors.length === 0) {
406
552
  const didWrite = await fs.writeIfUnchanged(config.filename, output);
@@ -488,6 +634,42 @@ export class GraphQLGenerator {
488
634
  }
489
635
  return [];
490
636
  }
637
+ async generateAPITypes() {
638
+ const filename = join(this.project.rootDir, "types.api.ts");
639
+ try {
640
+ const routeManifest = await this.project.serverRoutes.get();
641
+ const contents = code /*ts*/ `
642
+ import "eddev/types.app.public";
643
+ import { InferRPCServerContext, rpc } from "eddev/server"
644
+ import { finalizeRPCRouter } from "eddev/_internal"
645
+ ${routeManifest.contextFileName
646
+ ? code /*ts*/ `
647
+ import createContext from "./${routeManifest.contextFileName.replace(/\.tsx?$/, "")}"
648
+ `
649
+ : code /*ts*/ `
650
+ const createContext = () => ({})
651
+ `}
652
+
653
+ function createRouter() {
654
+ return finalizeRPCRouter({${Object.entries(routeManifest.routes).map(([name, route]) => {
655
+ const src = "./" + route.fileName;
656
+ const importStatement = imp(camelCase(name) + "=" + src.replace(/\.tsx?$/, ""));
657
+ return code `${JSON.stringify(route.prefix)}: ${importStatement},\n`;
658
+ })}})
659
+ }
660
+
661
+ declare global {
662
+ interface RPCContext extends InferRPCServerContext<typeof createContext> {}
663
+ interface RPCRouter extends ReturnType<typeof createRouter> {}
664
+ }
665
+ `;
666
+ await fs.writeIfUnchanged(filename, contents.toString());
667
+ }
668
+ catch (err) {
669
+ return [err];
670
+ }
671
+ return [];
672
+ }
491
673
  /**
492
674
  * Saves the schema to a file, for use by the VSCode GraphQL extension
493
675
  */
@@ -6,8 +6,9 @@ type LoadResult = {
6
6
  };
7
7
  export declare class GraphQLSchemaLoader {
8
8
  url: string;
9
+ apiKey?: string | undefined;
9
10
  lastHash: string;
10
- constructor(url: string);
11
+ constructor(url: string, apiKey?: string | undefined);
11
12
  private cachedResult;
12
13
  get(forceReload?: boolean): Promise<Error | LoadResult>;
13
14
  load(): Promise<Error | LoadResult>;
@@ -15,3 +16,4 @@ export declare class GraphQLSchemaLoader {
15
16
  private processSchema;
16
17
  }
17
18
  export {};
19
+ //# sourceMappingURL=graphql-schema-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-schema-loader.d.ts","sourceRoot":"","sources":["../../../src/node/graphql/graphql-schema-loader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAA2B,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAOpF,KAAK,UAAU,GAAG;IAChB,MAAM,EAAE,kBAAkB,CAAA;IAC1B,SAAS,EAAE,aAAa,CAAA;IACxB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,qBAAa,mBAAmB;IAGrB,GAAG,EAAE,MAAM;IACX,MAAM,CAAC,EAAE,MAAM;IAHxB,QAAQ,SAAK;gBAEJ,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,YAAA;IAGxB,OAAO,CAAC,YAAY,CAA0B;IAExC,GAAG,CAAC,WAAW,UAAQ;IAOvB,IAAI;IAgCV,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,aAAa;CA4BtB"}
@@ -4,11 +4,14 @@ import { introspectionFromSchema } from "graphql";
4
4
  import { graphqlLog as console } from "./graphql-codegen.js";
5
5
  import chalk from "chalk";
6
6
  import { hash } from "object-code";
7
+ import { fetchWP } from "../utils/fetch-wp.js";
7
8
  export class GraphQLSchemaLoader {
8
9
  url;
10
+ apiKey;
9
11
  lastHash = "";
10
- constructor(url) {
12
+ constructor(url, apiKey) {
11
13
  this.url = url;
14
+ this.apiKey = apiKey;
12
15
  }
13
16
  cachedResult = null;
14
17
  async get(forceReload = false) {
@@ -21,21 +24,7 @@ export class GraphQLSchemaLoader {
21
24
  console.info(`${this.lastHash ? "Reloading" : "Loading"} GraphQL schema from ${chalk.yellowBright(this.url)}`);
22
25
  const rawSchema = await loadSchema(this.url, {
23
26
  loaders: [new UrlLoader()],
24
- // fetch: (url: string, opts: any) => {
25
- // const httpsAgent = new Agent({
26
- // rejectUnauthorized: false,
27
- // })
28
- // return fetch(url, {
29
- // ...opts,
30
- // agent: function (_parsedURL) {
31
- // if (_parsedURL.protocol == "http:") {
32
- // return undefined
33
- // } else {
34
- // return httpsAgent
35
- // }
36
- // },
37
- // })
38
- // },
27
+ fetch: fetchWP,
39
28
  }).catch((e) => {
40
29
  return e;
41
30
  });
@@ -7,8 +7,10 @@ type PluginConfig = {
7
7
  additionalTypes: {
8
8
  [key: string]: string;
9
9
  };
10
+ banner: string;
10
11
  };
11
12
  declare const _default: {
12
13
  plugin: (schema: any, documents: any, config: PluginConfig, info: any) => string;
13
14
  };
14
15
  export default _default;
16
+ //# sourceMappingURL=gql-plugin-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gql-plugin-files.d.ts","sourceRoot":"","sources":["../../../../src/node/graphql/plugins/gql-plugin-files.ts"],"names":[],"mappings":"AAKA,KAAK,YAAY,GAAG;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,MAAM,CAAA;IAC3D,eAAe,EAAE;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KACtB,CAAA;IACD,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;;qBAGkB,GAAG,aAAa,GAAG,UAAU,YAAY,QAAQ,GAAG;;AADvE,wBAkEC"}
@@ -51,6 +51,7 @@ export default {
51
51
  */
52
52
  import 'eddev/types.app.public'
53
53
  ${imports.length > 0 ? code `import { ${imports.sort().join(", ")} } from "./types.graphql"` : ""}
54
+ ${config.banner || ""}
54
55
 
55
56
  declare global {
56
57
  interface ${config.globalName} {
@@ -6,3 +6,4 @@ declare const _default: {
6
6
  validate: (schema: any, documents: any, config: PluginConfig, info: any) => void;
7
7
  };
8
8
  export default _default;
9
+ //# sourceMappingURL=gql-plugin-no-duplicates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gql-plugin-no-duplicates.d.ts","sourceRoot":"","sources":["../../../../src/node/graphql/plugins/gql-plugin-no-duplicates.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;;;uBAIoB,GAAG,aAAa,GAAG,UAAU,YAAY,QAAQ,GAAG;;AAFzE,wBASC"}
@@ -6,3 +6,4 @@ declare const _default: {
6
6
  plugin: (schema: any, documents: any, config: PluginConfig, info: any) => string;
7
7
  };
8
8
  export default _default;
9
+ //# sourceMappingURL=gql-plugin-queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gql-plugin-queries.d.ts","sourceRoot":"","sources":["../../../../src/node/graphql/plugins/gql-plugin-queries.ts"],"names":[],"mappings":"AAYA,KAAK,YAAY,GAAG;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;;qBAKkB,GAAG,aAAa,GAAG,UAAU,YAAY,QAAQ,GAAG;;AADvE,wBA2TC"}
@@ -67,7 +67,7 @@ export default {
67
67
  // Another convention, the query name and file name should be the same
68
68
  const baseName = basename(fileName);
69
69
  if (baseName.replace(".graphql", "") !== name) {
70
- throwErrorAtLocation(item.name.loc, `Expected your query name and file name to match, for conventions sake (eg. '${baseName}' should be '${name}.graphql')`);
70
+ throwErrorAtLocation(item.name.loc, `Expected GraphQL operation name to match the filename.\nYou should either:\na) rename the file to '${name}.graphql'\nb) rename the operation to '${baseName}'`);
71
71
  }
72
72
  // Only import variables if the operation has variables
73
73
  if (variablesTypeName) {
@@ -10,6 +10,8 @@ type Entry = {
10
10
  line?: number;
11
11
  column?: number;
12
12
  } | null;
13
+ leadingComments?: string;
14
+ trailingComments?: string;
13
15
  };
14
16
  export type GraphQLManifest<TKeys extends string> = {
15
17
  [K in TKeys]: {
@@ -21,6 +23,8 @@ type PatternMap<TKeys extends string> = {
21
23
  key: TKeys;
22
24
  baseFolder: string;
23
25
  pattern: string;
26
+ ignore?: string[];
24
27
  }[];
25
28
  export declare function createGraphQLFileLoader<TKeys extends string>(project: Project, patterns: PatternMap<TKeys>): import("../project/manifest/manifest.js").ManifestGenerator<Entry, GraphQLManifest<TKeys>>;
26
29
  export {};
30
+ //# sourceMappingURL=query-files-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-files-loader.d.ts","sourceRoot":"","sources":["../../../src/node/graphql/query-files-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAS,MAAM,SAAS,CAAA;AAI7C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAG/C,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,YAAY,CAAA;IACjB,UAAU,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IACtE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,MAAM,IAAI;KACjD,CAAC,IAAI,KAAK,GAAG;QACZ,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAA;KACrB;CACF,CAAA;AAED,MAAM,MAAM,iBAAiB,CAAC,KAAK,SAAS,MAAM,IAAI,UAAU,CAAC,OAAO,uBAAuB,CAAC,KAAK,CAAC,CAAC,CAAA;AAEvG,KAAK,UAAU,CAAC,KAAK,SAAS,MAAM,IAAI;IACtC,GAAG,EAAE,KAAK,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAClB,EAAE,CAAA;AAEH,wBAAgB,uBAAuB,CAAC,KAAK,SAAS,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,8FAyD1G"}
@@ -7,6 +7,7 @@ export function createGraphQLFileLoader(project, patterns) {
7
7
  return createManifestGenerator({
8
8
  baseDir: project.rootDir,
9
9
  pattern: patterns.map((p) => join(p.baseFolder, p.pattern)),
10
+ ignore: patterns.flatMap((p) => p.ignore?.map((ignore) => join(p.baseFolder, ignore)) ?? []),
10
11
  watch: cliMode.watch,
11
12
  async generateManifest(entries) {
12
13
  let result = {};
@@ -32,6 +33,8 @@ export function createGraphQLFileLoader(project, patterns) {
32
33
  const contents = await fs.readFile(path, "utf8");
33
34
  let ast = null;
34
35
  let parseError = null;
36
+ const leadingComments = contents.match(/^(\n|#[^\n]*)+\n/)?.[0].trim();
37
+ const trailingComments = contents.match(/(\n|#[^\n]*)+$/)?.[0].trim();
35
38
  try {
36
39
  ast = parse(contents);
37
40
  }
@@ -48,6 +51,8 @@ export function createGraphQLFileLoader(project, patterns) {
48
51
  contents,
49
52
  ast,
50
53
  parseError,
54
+ leadingComments,
55
+ trailingComments,
51
56
  };
52
57
  },
53
58
  });
@@ -1 +1,2 @@
1
1
  export declare const WPInfoQuery = "\n query WPInfo {\n contentTypes(first: 100) {\n nodes {\n name\n label\n hasArchive\n graphqlSingleName\n graphqlPluralName\n excludeFromSearch\n }\n }\n taxonomies(first: 100) {\n nodes {\n graphqlPluralName\n graphqlSingleName\n name\n label\n }\n }\n plugins(first: 100) {\n nodes {\n name\n pluginUri\n version\n }\n }\n }\n";
2
+ //# sourceMappingURL=wp-info-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wp-info-query.d.ts","sourceRoot":"","sources":["../../../src/node/graphql/wp-info-query.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,2dA4BvB,CAAA"}