eddev 2.0.0-beta.21 → 2.0.0-beta.211
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.
- package/css/editor-styles.css +4 -0
- package/dist/app/entry/HydrationOverlay.d.ts +2 -0
- package/dist/app/entry/HydrationOverlay.d.ts.map +1 -0
- package/dist/app/entry/HydrationOverlay.js +2 -0
- package/dist/app/entry/MetaTags.d.ts +8 -0
- package/dist/app/entry/MetaTags.d.ts.map +1 -0
- package/dist/app/entry/MetaTags.js +30 -0
- package/dist/app/entry/boot-admin.d.ts +1 -0
- package/dist/app/entry/boot-admin.d.ts.map +1 -0
- package/dist/app/entry/boot-admin.js +7 -3
- package/dist/app/entry/hydration-script.d.ts +2 -0
- package/dist/app/entry/hydration-script.d.ts.map +1 -0
- package/dist/app/entry/hydration-script.js +18 -0
- package/dist/app/entry/spa-root.d.ts +1 -0
- package/dist/app/entry/spa-root.d.ts.map +1 -0
- package/dist/app/entry/spa-root.js +3 -5
- package/dist/app/entry/ssr-root-client.d.ts +4 -1
- package/dist/app/entry/ssr-root-client.d.ts.map +1 -0
- package/dist/app/entry/ssr-root-client.js +18 -6
- package/dist/app/entry/ssr-root.d.ts +6 -4
- package/dist/app/entry/ssr-root.d.ts.map +1 -0
- package/dist/app/entry/ssr-root.js +20 -19
- package/dist/app/lib/admin/defineField.d.ts +1 -0
- package/dist/app/lib/admin/defineField.d.ts.map +1 -0
- package/dist/app/lib/admin/defineWidget.d.ts +1 -0
- package/dist/app/lib/admin/defineWidget.d.ts.map +1 -0
- package/dist/app/lib/admin/index.d.ts +1 -0
- package/dist/app/lib/admin/index.d.ts.map +1 -0
- package/dist/app/lib/admin/installFieldTypes.d.ts +1 -0
- package/dist/app/lib/admin/installFieldTypes.d.ts.map +1 -0
- package/dist/app/lib/admin/installFieldTypes.js +2 -0
- package/dist/app/lib/admin/runWidgets.d.ts +1 -0
- package/dist/app/lib/admin/runWidgets.d.ts.map +1 -0
- package/dist/app/lib/admin/runWidgets.js +7 -2
- package/dist/app/lib/blocks/ContentBlocks.d.ts +7 -4
- package/dist/app/lib/blocks/ContentBlocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/ContentBlocks.js +16 -3
- package/dist/app/lib/blocks/EditableText.d.ts +30 -5
- package/dist/app/lib/blocks/EditableText.d.ts.map +1 -0
- package/dist/app/lib/blocks/EditableText.js +34 -5
- package/dist/app/lib/blocks/InnerBlocks.d.ts +21 -6
- package/dist/app/lib/blocks/InnerBlocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/InnerBlocks.js +73 -25
- package/dist/app/lib/blocks/SlotBlocks.d.ts +8 -0
- package/dist/app/lib/blocks/SlotBlocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/SlotBlocks.js +46 -0
- package/dist/app/lib/blocks/block-utils.d.ts +2 -1
- package/dist/app/lib/blocks/block-utils.d.ts.map +1 -0
- package/dist/app/lib/blocks/block-utils.js +3 -1
- package/dist/app/lib/blocks/builtin-blocks.d.ts +2 -0
- package/dist/app/lib/blocks/builtin-blocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/builtin-blocks.js +55 -0
- package/dist/app/lib/blocks/defineBlock.d.ts +4 -0
- package/dist/app/lib/blocks/defineBlock.d.ts.map +1 -0
- package/dist/app/lib/blocks/defineBlock.js +9 -0
- package/dist/app/lib/blocks/editor/EditorHighlights.d.ts +8 -0
- package/dist/app/lib/blocks/editor/EditorHighlights.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/EditorHighlights.js +164 -0
- package/dist/app/lib/blocks/editor/EditorSupport.d.ts +1 -0
- package/dist/app/lib/blocks/editor/EditorSupport.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/EditorSupport.js +17 -10
- package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts +2 -1
- package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/block-templates.d.ts +8 -1
- package/dist/app/lib/blocks/editor/block-templates.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/block-templates.js +71 -2
- package/dist/app/lib/blocks/editor/blocks-by-tag.d.ts +1 -0
- package/dist/app/lib/blocks/editor/blocks-by-tag.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/controls.d.ts +1 -0
- package/dist/app/lib/blocks/editor/controls.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/create-block.d.ts +10 -0
- package/dist/app/lib/blocks/editor/create-block.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/create-block.js +13 -0
- package/dist/app/lib/blocks/editor/editor-config.d.ts +77 -8
- package/dist/app/lib/blocks/editor/editor-config.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/editor-config.js +29 -62
- package/dist/app/lib/blocks/editor/installGutenbergHooks.d.ts +4 -0
- package/dist/app/lib/blocks/editor/installGutenbergHooks.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/installGutenbergHooks.js +126 -21
- package/dist/app/lib/blocks/editor/root-blocks.d.ts +7 -0
- package/dist/app/lib/blocks/editor/root-blocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/root-blocks.js +30 -0
- package/dist/app/lib/blocks/editor/usePostEditor.d.ts +12 -1
- package/dist/app/lib/blocks/editor/usePostEditor.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/usePostEditor.js +28 -13
- package/dist/app/lib/blocks/index.d.ts +8 -5
- package/dist/app/lib/blocks/index.d.ts.map +1 -0
- package/dist/app/lib/blocks/index.js +7 -5
- package/dist/app/lib/blocks/inline-editing.d.ts +10 -0
- package/dist/app/lib/blocks/inline-editing.d.ts.map +1 -0
- package/dist/app/lib/blocks/inline-editing.js +12 -2
- package/dist/app/lib/devtools/components/BreakpointIndicator.d.ts +1 -0
- package/dist/app/lib/devtools/components/BreakpointIndicator.d.ts.map +1 -0
- package/dist/app/lib/devtools/components/BreakpointIndicator.js +2 -2
- package/dist/app/lib/devtools/components/DevUI.d.ts +1 -0
- package/dist/app/lib/devtools/components/DevUI.d.ts.map +1 -0
- package/dist/app/lib/devtools/components/DevUI.js +3 -2
- package/dist/app/lib/devtools/components/GridIndicator.d.ts +2 -0
- package/dist/app/lib/devtools/components/GridIndicator.d.ts.map +1 -0
- package/dist/app/lib/devtools/components/GridIndicator.js +29 -0
- package/dist/app/lib/devtools/dev-tools-store.d.ts +1 -0
- package/dist/app/lib/devtools/dev-tools-store.d.ts.map +1 -0
- package/dist/app/lib/devtools/hooks/usePersistState.d.ts +2 -1
- package/dist/app/lib/devtools/hooks/usePersistState.d.ts.map +1 -0
- package/dist/app/lib/devtools/hooks/usePersistState.js +11 -2
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts +77 -76
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts.map +1 -0
- package/dist/app/lib/devtools/index.d.ts +1 -0
- package/dist/app/lib/devtools/index.d.ts.map +1 -0
- package/dist/app/lib/devtools/loader.d.ts +1 -0
- package/dist/app/lib/devtools/loader.d.ts.map +1 -0
- package/dist/app/lib/devtools/loader.js +6 -5
- package/dist/app/lib/devtools/tailwind.config.d.ts +1 -0
- package/dist/app/lib/devtools/tailwind.config.d.ts.map +1 -0
- package/dist/app/lib/devtools/useQueryDebug.d.ts +8 -1
- package/dist/app/lib/devtools/useQueryDebug.d.ts.map +1 -0
- package/dist/app/lib/devtools/useQueryDebug.js +5 -8
- package/dist/app/lib/dynamic/dynamic.d.ts +2 -1
- package/dist/app/lib/dynamic/dynamic.d.ts.map +1 -0
- package/dist/app/lib/dynamic/dynamic.js +5 -1
- package/dist/app/lib/dynamic/index.d.ts +1 -0
- package/dist/app/lib/dynamic/index.d.ts.map +1 -0
- package/dist/app/lib/hooks/index.d.ts +3 -3
- package/dist/app/lib/hooks/index.d.ts.map +1 -0
- package/dist/app/lib/hooks/index.js +2 -3
- package/dist/app/lib/hooks/{queryUtils.d.ts → query-hooks.d.ts} +42 -3
- package/dist/app/lib/hooks/query-hooks.d.ts.map +1 -0
- package/dist/app/lib/hooks/{queryUtils.js → query-hooks.js} +90 -28
- package/dist/app/lib/hooks/useAppData.d.ts +1 -0
- package/dist/app/lib/hooks/useAppData.d.ts.map +1 -0
- package/dist/app/lib/hooks/useAppData.js +11 -0
- package/dist/app/lib/hooks/useRPC.d.ts +1 -4
- package/dist/app/lib/hooks/useRPC.d.ts.map +1 -0
- package/dist/app/lib/hooks/useRPC.js +0 -8
- package/dist/app/lib/integrations/gravityforms/index.d.ts +3 -0
- package/dist/app/lib/integrations/gravityforms/index.d.ts.map +1 -0
- package/dist/app/lib/integrations/gravityforms/index.js +2 -0
- package/dist/app/lib/integrations/gravityforms/types.d.ts +145 -0
- package/dist/app/lib/integrations/gravityforms/types.d.ts.map +1 -0
- package/dist/app/lib/integrations/gravityforms/types.js +1 -0
- package/dist/app/lib/integrations/gravityforms/useGravityForm.d.ts +31 -0
- package/dist/app/lib/integrations/gravityforms/useGravityForm.d.ts.map +1 -0
- package/dist/app/lib/integrations/gravityforms/useGravityForm.js +295 -0
- package/dist/app/lib/internal/finalize-rpc.d.ts +18 -0
- package/dist/app/lib/internal/finalize-rpc.d.ts.map +1 -0
- package/dist/app/lib/internal/finalize-rpc.js +3 -0
- package/dist/app/lib/internal/index.d.ts +2 -0
- package/dist/app/lib/internal/index.d.ts.map +1 -0
- package/dist/app/lib/internal/index.js +1 -0
- package/dist/app/lib/internal/internal-store.d.ts +1 -0
- package/dist/app/lib/internal/internal-store.d.ts.map +1 -0
- package/dist/app/lib/internal/read-admin-manifest.d.ts +1 -0
- package/dist/app/lib/internal/read-admin-manifest.d.ts.map +1 -0
- package/dist/app/lib/internal/read-block-manifest.d.ts +2 -0
- package/dist/app/lib/internal/read-block-manifest.d.ts.map +1 -0
- package/dist/app/lib/internal/read-block-manifest.js +7 -0
- package/dist/app/lib/internal/read-view-manifest.d.ts +7 -4
- package/dist/app/lib/internal/read-view-manifest.d.ts.map +1 -0
- package/dist/app/lib/internal/read-view-manifest.js +18 -0
- package/dist/app/lib/legacy-stitches/createStitches.d.ts +510 -1
- package/dist/app/lib/legacy-stitches/createStitches.d.ts.map +1 -0
- package/dist/app/lib/legacy-stitches/index.d.ts +1 -0
- package/dist/app/lib/legacy-stitches/index.d.ts.map +1 -0
- package/dist/app/lib/routing/components/BackButton.d.ts +50 -0
- package/dist/app/lib/routing/components/BackButton.d.ts.map +1 -0
- package/dist/app/lib/routing/components/BackButton.js +47 -0
- package/dist/app/lib/routing/components/BrowserRouter.d.ts +10 -1
- package/dist/app/lib/routing/components/BrowserRouter.d.ts.map +1 -0
- package/dist/app/lib/routing/components/BrowserRouter.js +136 -21
- package/dist/app/lib/routing/components/ClientOnly.d.ts +2 -1
- package/dist/app/lib/routing/components/ClientOnly.d.ts.map +1 -0
- package/dist/app/lib/routing/components/ClientOnly.js +1 -1
- package/dist/app/lib/routing/components/Link.d.ts +19 -2
- package/dist/app/lib/routing/components/Link.d.ts.map +1 -0
- package/dist/app/lib/routing/components/Link.js +43 -23
- package/dist/app/lib/routing/components/NativeLinkHandler.d.ts +10 -0
- package/dist/app/lib/routing/components/NativeLinkHandler.d.ts.map +1 -0
- package/dist/app/lib/routing/components/NativeLinkHandler.js +23 -0
- package/dist/app/lib/routing/components/RouteRenderer.d.ts +1 -0
- package/dist/app/lib/routing/components/RouteRenderer.d.ts.map +1 -0
- package/dist/app/lib/routing/components/RouteRenderer.js +17 -3
- package/dist/app/lib/routing/components/SSRRouter.d.ts +3 -0
- package/dist/app/lib/routing/components/SSRRouter.d.ts.map +1 -0
- package/dist/app/lib/routing/components/SSRRouter.js +3 -2
- package/dist/app/lib/routing/components/ScrollRestoration.d.ts +1 -0
- package/dist/app/lib/routing/components/ScrollRestoration.d.ts.map +1 -0
- package/dist/app/lib/routing/components/ScrollRestoration.js +4 -1
- package/dist/app/lib/routing/context.d.ts +9 -5
- package/dist/app/lib/routing/context.d.ts.map +1 -0
- package/dist/app/lib/routing/context.js +12 -95
- package/dist/app/lib/routing/hooks/useIsSSR.d.ts +1 -0
- package/dist/app/lib/routing/hooks/useIsSSR.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRestorableState.d.ts +3 -1
- package/dist/app/lib/routing/hooks/useRestorableState.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRoute.d.ts +16 -0
- package/dist/app/lib/routing/hooks/useRoute.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRoute.js +21 -0
- package/dist/app/lib/routing/hooks/useRouteMeta.d.ts +6 -0
- package/dist/app/lib/routing/hooks/useRouteMeta.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouteMeta.js +9 -0
- package/dist/app/lib/routing/hooks/useRouteTransition.d.ts +1 -0
- package/dist/app/lib/routing/hooks/useRouteTransition.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouter.d.ts +1 -0
- package/dist/app/lib/routing/hooks/useRouter.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouterEvents.d.ts +1 -0
- package/dist/app/lib/routing/hooks/useRouterEvents.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useRouterState.d.ts +1 -0
- package/dist/app/lib/routing/hooks/useRouterState.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useSearchParams.d.ts +78 -6
- package/dist/app/lib/routing/hooks/useSearchParams.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useSearchParams.js +75 -15
- package/dist/app/lib/routing/index.d.ts +3 -0
- package/dist/app/lib/routing/index.d.ts.map +1 -0
- package/dist/app/lib/routing/index.js +2 -0
- package/dist/app/lib/routing/loader.d.ts +1 -0
- package/dist/app/lib/routing/loader.d.ts.map +1 -0
- package/dist/app/lib/routing/loader.js +19 -10
- package/dist/app/lib/routing/types.d.ts +60 -12
- package/dist/app/lib/routing/types.d.ts.map +1 -0
- package/dist/app/lib/routing/utils.d.ts +7 -2
- package/dist/app/lib/routing/utils.d.ts.map +1 -0
- package/dist/app/lib/routing/utils.js +41 -4
- package/dist/app/lib/{hooks → runtime}/apiConfig.d.ts +11 -2
- package/dist/app/lib/runtime/apiConfig.d.ts.map +1 -0
- package/dist/app/lib/runtime/apiConfig.js +6 -0
- package/dist/app/lib/runtime/errorHandling.d.ts +40 -0
- package/dist/app/lib/runtime/errorHandling.d.ts.map +1 -0
- package/dist/app/lib/runtime/errorHandling.js +6 -0
- package/dist/app/lib/runtime/index.d.ts +3 -0
- package/dist/app/lib/runtime/index.d.ts.map +1 -0
- package/dist/app/lib/runtime/index.js +2 -0
- package/dist/app/lib/views/defineView.d.ts +2 -1
- package/dist/app/lib/views/defineView.d.ts.map +1 -0
- package/dist/app/lib/views/index.d.ts +1 -0
- package/dist/app/lib/views/index.d.ts.map +1 -0
- package/dist/app/server/index.d.ts +4 -1
- package/dist/app/server/index.d.ts.map +1 -0
- package/dist/app/server/index.js +3 -1
- package/dist/app/server/proxy-wp-admin.d.ts +2 -2
- package/dist/app/server/proxy-wp-admin.d.ts.map +1 -0
- package/dist/app/server/proxy-wp-admin.js +46 -13
- package/dist/app/server/render-ai-page.d.ts +13 -0
- package/dist/app/server/render-ai-page.d.ts.map +1 -0
- package/dist/app/server/render-ai-page.js +100 -0
- package/dist/app/server/render-ssr-page.d.ts +31 -3
- package/dist/app/server/render-ssr-page.d.ts.map +1 -0
- package/dist/app/server/render-ssr-page.js +226 -10
- package/dist/app/server/rpc.d.ts +60 -0
- package/dist/app/server/rpc.d.ts.map +1 -0
- package/dist/app/server/rpc.js +18 -0
- package/dist/app/server/server-context.d.ts +44 -6
- package/dist/app/server/server-context.d.ts.map +1 -0
- package/dist/app/server/server-context.js +334 -37
- package/dist/app/server/server-custom-config.d.ts +3 -0
- package/dist/app/server/server-custom-config.d.ts.map +1 -0
- package/dist/app/server/server-custom-config.js +1 -0
- package/dist/app/server/utils/content-security.d.ts +26 -0
- package/dist/app/server/utils/content-security.d.ts.map +1 -0
- package/dist/app/server/utils/content-security.js +124 -0
- package/dist/app/server/utils/headers.d.ts +1 -0
- package/dist/app/server/utils/headers.d.ts.map +1 -0
- package/dist/app/server/utils/replace-host.d.ts +2 -1
- package/dist/app/server/utils/replace-host.d.ts.map +1 -0
- package/dist/app/server/utils/replace-host.js +10 -2
- package/dist/app/server/utils/swr-cache.d.ts +5 -0
- package/dist/app/server/utils/swr-cache.d.ts.map +1 -0
- package/dist/app/server/utils/swr-cache.js +31 -0
- package/dist/app/utils/APIProvider.d.ts +3 -0
- package/dist/app/utils/APIProvider.d.ts.map +1 -0
- package/dist/app/utils/APIProvider.js +5 -0
- package/dist/app/utils/BlockErrorBoundary.d.ts +20 -0
- package/dist/app/utils/BlockErrorBoundary.d.ts.map +1 -0
- package/dist/app/utils/BlockErrorBoundary.js +38 -0
- package/dist/app/utils/ErrorMessage.d.ts +6 -0
- package/dist/app/utils/ErrorMessage.d.ts.map +1 -0
- package/dist/app/utils/ErrorMessage.js +14 -0
- package/dist/app/utils/RouteErrorBoundary.d.ts +20 -0
- package/dist/app/utils/RouteErrorBoundary.d.ts.map +1 -0
- package/dist/app/utils/RouteErrorBoundary.js +41 -0
- package/dist/app/utils/asset-capture.d.ts +3 -0
- package/dist/app/utils/asset-capture.d.ts.map +1 -0
- package/dist/app/utils/asset-capture.js +5 -0
- package/dist/app/utils/hydration-debugger.d.ts +14 -0
- package/dist/app/utils/hydration-debugger.d.ts.map +1 -0
- package/dist/app/utils/hydration-debugger.js +11 -0
- package/dist/app/utils/query-client.d.ts +3 -0
- package/dist/app/utils/query-client.d.ts.map +1 -0
- package/dist/app/utils/query-client.js +5 -1
- package/dist/app/utils/query-monitor.d.ts +27 -0
- package/dist/app/utils/query-monitor.d.ts.map +1 -0
- package/dist/app/utils/query-monitor.js +7 -0
- package/dist/app/utils/trpc-client.d.ts +3 -0
- package/dist/app/utils/trpc-client.d.ts.map +1 -0
- package/dist/app/utils/trpc-client.js +39 -0
- package/dist/app/utils/wp.d.ts +11 -10
- package/dist/app/utils/wp.d.ts.map +1 -0
- package/dist/node/cli/cli-mode.d.ts +1 -0
- package/dist/node/cli/cli-mode.d.ts.map +1 -0
- package/dist/node/cli/cli-worker.d.ts +1 -0
- package/dist/node/cli/cli-worker.d.ts.map +1 -0
- package/dist/node/cli/cli-worker.js +7 -3
- package/dist/node/cli/cli.d.ts +1 -0
- package/dist/node/cli/cli.d.ts.map +1 -0
- package/dist/node/cli/cli.js +120 -7
- package/dist/node/cli/display/CLIApp.d.ts +1 -0
- package/dist/node/cli/display/CLIApp.d.ts.map +1 -0
- package/dist/node/cli/display/CLIApp.js +1 -1
- package/dist/node/cli/display/boot-cli-app.d.ts +1 -0
- package/dist/node/cli/display/boot-cli-app.d.ts.map +1 -0
- package/dist/node/cli/display/boot-cli-app.js +1 -1
- package/dist/node/cli/display/components/Fullscreen.d.ts +1 -0
- package/dist/node/cli/display/components/Fullscreen.d.ts.map +1 -0
- package/dist/node/cli/display/components/LogEntries.d.ts +1 -0
- package/dist/node/cli/display/components/LogEntries.d.ts.map +1 -0
- package/dist/node/cli/display/components/MenuItem.d.ts +1 -0
- package/dist/node/cli/display/components/MenuItem.d.ts.map +1 -0
- package/dist/node/cli/display/components/TextInput.d.ts +1 -0
- package/dist/node/cli/display/components/TextInput.d.ts.map +1 -0
- package/dist/node/cli/display/hooks/useManifest.d.ts +1 -0
- package/dist/node/cli/display/hooks/useManifest.d.ts.map +1 -0
- package/dist/node/cli/display/hooks/useStatefulLog.d.ts +1 -0
- package/dist/node/cli/display/hooks/useStatefulLog.d.ts.map +1 -0
- package/dist/node/cli/display/tools/BlockList.d.ts +1 -0
- package/dist/node/cli/display/tools/BlockList.d.ts.map +1 -0
- package/dist/node/cli/display/tools/CreateBlock.d.ts +1 -0
- package/dist/node/cli/display/tools/CreateBlock.d.ts.map +1 -0
- package/dist/node/cli/display/tools/cli-tool-list.d.ts +1 -0
- package/dist/node/cli/display/tools/cli-tool-list.d.ts.map +1 -0
- package/dist/node/cli/display/tools/cli-tools.d.ts +1 -0
- package/dist/node/cli/display/tools/cli-tools.d.ts.map +1 -0
- package/dist/node/cli/display/util/colors.d.ts +1 -0
- package/dist/node/cli/display/util/colors.d.ts.map +1 -0
- package/dist/node/cli/version.d.ts +2 -1
- package/dist/node/cli/version.d.ts.map +1 -0
- package/dist/node/cli/version.js +1 -1
- package/dist/node/compiler/build-vinxi.d.ts +1 -0
- package/dist/node/compiler/build-vinxi.d.ts.map +1 -0
- package/dist/node/compiler/build-vinxi.js +2 -1
- package/dist/node/compiler/bundler.admin.d.ts +1 -0
- package/dist/node/compiler/bundler.admin.d.ts.map +1 -0
- package/dist/node/compiler/bundler.admin.js +1 -0
- package/dist/node/compiler/bundler.frontend.d.ts +2 -0
- package/dist/node/compiler/bundler.frontend.d.ts.map +1 -0
- package/dist/node/compiler/bundler.frontend.js +26 -11
- package/dist/node/compiler/dev-server.d.ts +1 -0
- package/dist/node/compiler/dev-server.d.ts.map +1 -0
- package/dist/node/compiler/dev-server.js +17 -1
- package/dist/node/compiler/get-vite-config.d.ts +12 -1
- package/dist/node/compiler/get-vite-config.d.ts.map +1 -0
- package/dist/node/compiler/get-vite-config.js +173 -42
- package/dist/node/compiler/vinxi-app.d.ts +13 -0
- package/dist/node/compiler/vinxi-app.d.ts.map +1 -0
- package/dist/node/compiler/vinxi-app.js +142 -32
- package/dist/node/compiler/vinxi-codegen.d.ts +1 -0
- package/dist/node/compiler/vinxi-codegen.d.ts.map +1 -0
- package/dist/node/compiler/vinxi-codegen.js +371 -108
- package/dist/node/graphql/graphql-codegen.d.ts +12 -1
- package/dist/node/graphql/graphql-codegen.d.ts.map +1 -0
- package/dist/node/graphql/graphql-codegen.js +239 -37
- package/dist/node/graphql/graphql-schema-loader.d.ts +3 -1
- package/dist/node/graphql/graphql-schema-loader.d.ts.map +1 -0
- package/dist/node/graphql/graphql-schema-loader.js +5 -16
- package/dist/node/graphql/plugins/gql-plugin-files.d.ts +3 -1
- package/dist/node/graphql/plugins/gql-plugin-files.d.ts.map +1 -0
- package/dist/node/graphql/plugins/gql-plugin-files.js +3 -2
- package/dist/node/graphql/plugins/gql-plugin-no-duplicates.d.ts +1 -0
- package/dist/node/graphql/plugins/gql-plugin-no-duplicates.d.ts.map +1 -0
- package/dist/node/graphql/plugins/gql-plugin-queries.d.ts +1 -0
- package/dist/node/graphql/plugins/gql-plugin-queries.d.ts.map +1 -0
- package/dist/node/graphql/plugins/gql-plugin-queries.js +2 -2
- package/dist/node/graphql/query-files-loader.d.ts +4 -0
- package/dist/node/graphql/query-files-loader.d.ts.map +1 -0
- package/dist/node/graphql/query-files-loader.js +5 -0
- package/dist/node/graphql/wp-info-query.d.ts +1 -0
- package/dist/node/graphql/wp-info-query.d.ts.map +1 -0
- package/dist/node/project/config.d.ts +207 -73
- package/dist/node/project/config.d.ts.map +1 -0
- package/dist/node/project/config.js +94 -20
- package/dist/node/project/eddev-build-file.d.ts +1 -0
- package/dist/node/project/eddev-build-file.d.ts.map +1 -0
- package/dist/node/project/eddev-build-file.js +4 -2
- package/dist/node/project/env.d.ts +5 -0
- package/dist/node/project/env.d.ts.map +1 -0
- package/dist/node/project/env.js +1 -0
- package/dist/node/project/favicons.d.ts +1 -1
- package/dist/node/project/favicons.d.ts.map +1 -0
- package/dist/node/project/favicons.js +1 -1
- package/dist/node/project/manifest/block-manifest.d.ts +1 -0
- package/dist/node/project/manifest/block-manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/block-manifest.js +6 -2
- package/dist/node/project/manifest/field-manifest.d.ts +1 -0
- package/dist/node/project/manifest/field-manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/manifest.d.ts +2 -0
- package/dist/node/project/manifest/manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/manifest.js +14 -10
- package/dist/node/project/manifest/routes-manifest.d.ts +21 -0
- package/dist/node/project/manifest/routes-manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/routes-manifest.js +74 -0
- package/dist/node/project/manifest/view-manifest.d.ts +1 -0
- package/dist/node/project/manifest/view-manifest.d.ts.map +1 -0
- package/dist/node/project/manifest/widget-manifest.d.ts +1 -0
- package/dist/node/project/manifest/widget-manifest.d.ts.map +1 -0
- package/dist/node/project/project.d.ts +12 -0
- package/dist/node/project/project.d.ts.map +1 -0
- package/dist/node/project/project.js +57 -3
- package/dist/node/project/wp-info.d.ts +3 -0
- package/dist/node/project/wp-info.d.ts.map +1 -0
- package/dist/node/project/wp-info.js +13 -1
- package/dist/node/storybook/index.d.ts +3 -0
- package/dist/node/storybook/index.d.ts.map +1 -0
- package/dist/node/storybook/index.js +13 -0
- package/dist/node/types/block-type.d.ts +57 -25
- package/dist/node/types/block-type.d.ts.map +1 -0
- package/dist/node/types/block-type.js +4 -1
- package/dist/node/types/view-type.d.ts +8 -7
- package/dist/node/types/view-type.d.ts.map +1 -0
- package/dist/node/utils/fetch-wp.d.ts +2 -0
- package/dist/node/utils/fetch-wp.d.ts.map +1 -0
- package/dist/node/utils/fetch-wp.js +28 -0
- package/dist/node/utils/format-zod-error.d.ts +1 -0
- package/dist/node/utils/format-zod-error.d.ts.map +1 -0
- package/dist/node/utils/fs-codegen.d.ts +4 -0
- package/dist/node/utils/fs-codegen.d.ts.map +1 -0
- package/dist/node/utils/fs-codegen.js +10 -2
- package/dist/node/utils/fs.d.ts +5 -0
- package/dist/node/utils/fs.d.ts.map +1 -0
- package/dist/node/utils/get-repo-info.d.ts +1 -0
- package/dist/node/utils/get-repo-info.d.ts.map +1 -0
- package/dist/node/utils/helpers.d.ts +1 -0
- package/dist/node/utils/helpers.d.ts.map +1 -0
- package/dist/node/utils/highlight-code.d.ts +1 -0
- package/dist/node/utils/highlight-code.d.ts.map +1 -0
- package/dist/node/utils/is-deploying.d.ts +1 -0
- package/dist/node/utils/is-deploying.d.ts.map +1 -0
- package/dist/node/utils/is-deploying.js +1 -1
- package/dist/node/utils/report-builder.d.ts +1 -0
- package/dist/node/utils/report-builder.d.ts.map +1 -0
- package/dist/node/utils/self-signed-cert.d.ts +5 -0
- package/dist/node/utils/self-signed-cert.d.ts.map +1 -0
- package/dist/node/utils/self-signed-cert.js +28 -4
- package/dist/node/utils/stateful-log.d.ts +1 -0
- package/dist/node/utils/stateful-log.d.ts.map +1 -0
- package/dist/node/utils/stateful-log.js +2 -0
- package/dist/node/utils/ts-export-extractor.d.ts +1 -0
- package/dist/node/utils/ts-export-extractor.d.ts.map +1 -0
- package/dist/node/utils/watch-file-tree.d.ts +18 -3
- package/dist/node/utils/watch-file-tree.d.ts.map +1 -0
- package/dist/node/utils/watch-file-tree.js +12 -5
- package/package.json +42 -25
- package/tsconfig.app.json +10 -5
- package/tsconfig.node.json +3 -2
- package/types.app.d.ts +2 -0
- package/types.meta.d.ts +449 -136
- package/dist/app/lib/blocks/ErrorBoundaryFrontend.d.ts +0 -15
- package/dist/app/lib/blocks/ErrorBoundaryFrontend.js +0 -35
- package/dist/app/lib/hooks/apiConfig.js +0 -4
- package/dist/app/lib/hooks/usePageLoad.d.ts +0 -6
- 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, pascalCase } 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.
|
|
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
|
-
|
|
111
|
-
|
|
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(
|
|
142
|
-
|
|
193
|
+
watchFileTreeForChanges({
|
|
194
|
+
pattern: ["backend/**/*.php"],
|
|
195
|
+
callback: (event) => {
|
|
196
|
+
this.queueRegenerate(true, "PHP file change detected", stringifyFileEvent(event));
|
|
197
|
+
},
|
|
143
198
|
});
|
|
144
|
-
watchFileTreeForChanges(
|
|
145
|
-
|
|
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(
|
|
148
|
-
|
|
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() {
|
|
@@ -186,6 +247,19 @@ export class GraphQLGenerator {
|
|
|
186
247
|
this.writeSchemaFile(schemaResult.schema);
|
|
187
248
|
// Get GraphQL files
|
|
188
249
|
const graphQLFiles = await this.fileLoader.get();
|
|
250
|
+
// Fill in any missing operation names
|
|
251
|
+
for (let [key, entry] of Object.entries(graphQLFiles.blocks)) {
|
|
252
|
+
if (entry.ast) {
|
|
253
|
+
const main = entry.ast.definitions[0];
|
|
254
|
+
if (main?.kind === Kind.OPERATION_DEFINITION && !main.name) {
|
|
255
|
+
// @ts-ignore
|
|
256
|
+
main.name = {
|
|
257
|
+
kind: Kind.NAME,
|
|
258
|
+
value: pascalCase(key.replace(".graphql", "").split(/\//).join("-")),
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
189
263
|
// Validate them against the schema
|
|
190
264
|
const validationErrors = this.validateGraphQLFiles(graphQLFiles, schemaResult.rawSchema);
|
|
191
265
|
if (validationErrors.length > 0) {
|
|
@@ -223,10 +297,14 @@ export class GraphQLGenerator {
|
|
|
223
297
|
};
|
|
224
298
|
const errors = (await Promise.all([
|
|
225
299
|
this.generateUtilTypes(),
|
|
300
|
+
this.generateAPITypes(),
|
|
226
301
|
this.generateTS("types.graphql.ts", schemaResult.rawSchema, {
|
|
227
302
|
documents: getDocuments(["queries", "views", "blocks", "fragments"]),
|
|
228
303
|
hasDocuments: true,
|
|
229
|
-
banner: `import { ContentBlock } from "eddev/blocks"`,
|
|
304
|
+
banner: [`import { ContentBlock } from "eddev/blocks"`, ...(wp.scalarTypeImports ?? [])].join("\n"),
|
|
305
|
+
footer: Object.keys(wp.scalarTypes)
|
|
306
|
+
.map((name) => `export type ${name.endsWith("Option") ? name : name + "Scalar"} = Scalars["${name}"]["output"]`)
|
|
307
|
+
.join("\n"),
|
|
230
308
|
plugins: {
|
|
231
309
|
typescript: [typescriptPlugin, {}],
|
|
232
310
|
typescriptOperations: [typescriptOperationsPlugin, {}],
|
|
@@ -269,7 +347,12 @@ export class GraphQLGenerator {
|
|
|
269
347
|
rootDir: this.project.rootDir,
|
|
270
348
|
folderName: "views",
|
|
271
349
|
globalName: "ViewProps",
|
|
272
|
-
additionalTypes: {
|
|
350
|
+
additionalTypes: {
|
|
351
|
+
_error: "ErrorRouteProps",
|
|
352
|
+
},
|
|
353
|
+
banner: `
|
|
354
|
+
import { ErrorRouteProps } from "eddev/routing"
|
|
355
|
+
`,
|
|
273
356
|
},
|
|
274
357
|
}),
|
|
275
358
|
this.generateTS("types.blocks.ts", schemaResult.rawSchema, {
|
|
@@ -287,7 +370,7 @@ export class GraphQLGenerator {
|
|
|
287
370
|
rootDir: this.project.rootDir,
|
|
288
371
|
globalName: "BlockProps",
|
|
289
372
|
folderName: "blocks",
|
|
290
|
-
getType: (importedName, def) => {
|
|
373
|
+
getType: (importedName, def, name) => {
|
|
291
374
|
// const queryKeyVals: any[] = []
|
|
292
375
|
let blockSelection = "";
|
|
293
376
|
let hasOthers = false;
|
|
@@ -309,6 +392,13 @@ export class GraphQLGenerator {
|
|
|
309
392
|
return {};
|
|
310
393
|
return type.join(" & ");
|
|
311
394
|
},
|
|
395
|
+
additionalTypes: Object.fromEntries(Object.entries(blockManifest.blocks).map(([key, block]) => {
|
|
396
|
+
const styleNames = new Set(block.blockStyles
|
|
397
|
+
?.map((s) => s.name)
|
|
398
|
+
.filter(Boolean)
|
|
399
|
+
.map((name) => JSON.stringify(name)) ?? []);
|
|
400
|
+
return [key, styleNames.size > 0 ? `{ "blockStyle": ${[...styleNames].join("|")} }` : null];
|
|
401
|
+
})),
|
|
312
402
|
},
|
|
313
403
|
}),
|
|
314
404
|
this.generateTS("hooks/queries.ts", schemaResult.rawSchema, {
|
|
@@ -334,6 +424,69 @@ export class GraphQLGenerator {
|
|
|
334
424
|
this.generate();
|
|
335
425
|
}
|
|
336
426
|
}
|
|
427
|
+
getOptimizedQueries(graphQLFiles, rewrite = false) {
|
|
428
|
+
const result = {};
|
|
429
|
+
const allFragments = {};
|
|
430
|
+
/**
|
|
431
|
+
* Get all the base fragment definitions
|
|
432
|
+
*/
|
|
433
|
+
const baseFragments = new Map();
|
|
434
|
+
Object.values(graphQLFiles.fragments)
|
|
435
|
+
.map((file) => file?.ast?.definitions ?? [])
|
|
436
|
+
.filter((def) => def.length > 0)
|
|
437
|
+
.flat()
|
|
438
|
+
.filter((n) => n.kind === Kind.FRAGMENT_DEFINITION)
|
|
439
|
+
.forEach((node) => baseFragments.set(node.name.value, node));
|
|
440
|
+
baseFragments.forEach((node) => {
|
|
441
|
+
allFragments[node.name.value] = node;
|
|
442
|
+
});
|
|
443
|
+
function findFragments(defs, map = new Map()) {
|
|
444
|
+
// console.log("findFragments", defs.length)
|
|
445
|
+
for (let def of defs) {
|
|
446
|
+
if (def.kind === Kind.FRAGMENT_DEFINITION) {
|
|
447
|
+
map.set(def.name.value, def);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
for (let def of defs) {
|
|
451
|
+
visit(def, {
|
|
452
|
+
FragmentSpread: {
|
|
453
|
+
enter: (node) => {
|
|
454
|
+
const match = baseFragments.get(node.name.value);
|
|
455
|
+
if (match && !map.has(node.name.value)) {
|
|
456
|
+
map.set(node.name.value, match);
|
|
457
|
+
findFragments([match], map);
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
},
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
return {
|
|
464
|
+
fragments: [...map.values()],
|
|
465
|
+
definitions: defs.filter((n) => n.kind !== Kind.FRAGMENT_DEFINITION),
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
for (let [groupName, fileMap] of Object.entries(graphQLFiles)) {
|
|
469
|
+
result[groupName] = {};
|
|
470
|
+
for (let [path, file] of Object.entries(fileMap)) {
|
|
471
|
+
if (!file.parseError) {
|
|
472
|
+
// Find all fragments
|
|
473
|
+
const { fragments, definitions } = findFragments(file?.ast?.definitions ?? []);
|
|
474
|
+
const ast = {
|
|
475
|
+
kind: Kind.DOCUMENT,
|
|
476
|
+
definitions: [...definitions, ...fragments],
|
|
477
|
+
loc: file.ast.loc,
|
|
478
|
+
leadingComments: file.leadingComments,
|
|
479
|
+
trailingComments: file.trailingComments,
|
|
480
|
+
};
|
|
481
|
+
result[groupName][path.replace(".graphql", ".txt")] = ast;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
return {
|
|
486
|
+
queries: result,
|
|
487
|
+
fragments: allFragments,
|
|
488
|
+
};
|
|
489
|
+
}
|
|
337
490
|
/**
|
|
338
491
|
* Validates a GraphQL manifest against a schema, ensuring there are no user errors.
|
|
339
492
|
*/
|
|
@@ -342,30 +495,43 @@ export class GraphQLGenerator {
|
|
|
342
495
|
* Use all rules, except for No Unused Fragments — since we prepend those fragments to every test
|
|
343
496
|
*/
|
|
344
497
|
const validationRules = specifiedRules.filter((rule) => rule !== NoUnusedFragmentsRule);
|
|
498
|
+
/**
|
|
499
|
+
* Get the optimized files — queries with all fragments included
|
|
500
|
+
*/
|
|
501
|
+
const { queries } = this.getOptimizedQueries(graphQLFiles);
|
|
502
|
+
/**
|
|
503
|
+
* Only report the same error once (mostly for preventing repeats of the same fragment errors)
|
|
504
|
+
*/
|
|
505
|
+
const errorsShown = new Map();
|
|
345
506
|
/**
|
|
346
507
|
* Validate everything
|
|
347
508
|
*/
|
|
348
509
|
const report = [];
|
|
349
510
|
for (let [groupName, fileMap] of Object.entries(graphQLFiles)) {
|
|
511
|
+
const group = queries[groupName];
|
|
350
512
|
for (let [path, file] of Object.entries(fileMap)) {
|
|
351
513
|
if (file.parseError) {
|
|
352
514
|
report.push(new GraphQLValidationError(file.parseError.message, path, file.parseError.line, file.parseError.column, file.contents));
|
|
353
515
|
}
|
|
354
516
|
else {
|
|
355
517
|
// Find all fragments
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
.flat();
|
|
361
|
-
const validationAST = {
|
|
362
|
-
kind: Kind.DOCUMENT,
|
|
363
|
-
definitions: [...fragments, ...file.ast.definitions],
|
|
364
|
-
loc: file.ast.loc,
|
|
365
|
-
};
|
|
518
|
+
const validationAST = group[path];
|
|
519
|
+
if (!validationAST) {
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
366
522
|
const errors = validate(schema, validationAST, validationRules);
|
|
367
523
|
if (errors.length > 0) {
|
|
368
524
|
for (let error of errors) {
|
|
525
|
+
if (error.nodes && error.nodes[0]) {
|
|
526
|
+
const node = error.nodes[0];
|
|
527
|
+
if (errorsShown.has(node) && errorsShown.get(node)?.includes(error.message)) {
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
errorsShown.set(node, [...(errorsShown.get(node) ?? []), error.message]);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
// console.log(error.nodes?.map((n) => n.kind))
|
|
369
535
|
report.push(new GraphQLValidationError(error.message, path, error.locations?.[0].line || 1, error.locations?.[0].column || 1, error.source?.body || ""));
|
|
370
536
|
}
|
|
371
537
|
}
|
|
@@ -397,10 +563,10 @@ export class GraphQLGenerator {
|
|
|
397
563
|
output = await codegen(config);
|
|
398
564
|
}
|
|
399
565
|
catch (err) {
|
|
400
|
-
errors.push(
|
|
566
|
+
errors.push(err);
|
|
401
567
|
}
|
|
402
568
|
if (args.banner) {
|
|
403
|
-
output = args.banner + "\n\n" + output;
|
|
569
|
+
output = args.banner + "\n\n" + output + "\n" + (args.footer ?? "");
|
|
404
570
|
}
|
|
405
571
|
if (errors.length === 0) {
|
|
406
572
|
const didWrite = await fs.writeIfUnchanged(config.filename, output);
|
|
@@ -488,6 +654,42 @@ export class GraphQLGenerator {
|
|
|
488
654
|
}
|
|
489
655
|
return [];
|
|
490
656
|
}
|
|
657
|
+
async generateAPITypes() {
|
|
658
|
+
const filename = join(this.project.rootDir, "types.api.ts");
|
|
659
|
+
try {
|
|
660
|
+
const routeManifest = await this.project.serverRoutes.get();
|
|
661
|
+
const contents = code /*ts*/ `
|
|
662
|
+
import "eddev/types.app.public";
|
|
663
|
+
import { InferRPCServerContext, rpc } from "eddev/server"
|
|
664
|
+
import { finalizeRPCRouter } from "eddev/_internal"
|
|
665
|
+
${routeManifest.contextFileName
|
|
666
|
+
? code /*ts*/ `
|
|
667
|
+
import createContext from "./${routeManifest.contextFileName.replace(/\.tsx?$/, "")}"
|
|
668
|
+
`
|
|
669
|
+
: code /*ts*/ `
|
|
670
|
+
const createContext = () => ({})
|
|
671
|
+
`}
|
|
672
|
+
|
|
673
|
+
function createRouter() {
|
|
674
|
+
return finalizeRPCRouter({${Object.entries(routeManifest.routes).map(([name, route]) => {
|
|
675
|
+
const src = "./" + route.fileName;
|
|
676
|
+
const importStatement = imp(camelCase(name) + "=" + src.replace(/\.tsx?$/, ""));
|
|
677
|
+
return code `${JSON.stringify(route.prefix)}: ${importStatement},\n`;
|
|
678
|
+
})}})
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
declare global {
|
|
682
|
+
interface RPCContext extends InferRPCServerContext<typeof createContext> {}
|
|
683
|
+
interface RPCRouter extends ReturnType<typeof createRouter> {}
|
|
684
|
+
}
|
|
685
|
+
`;
|
|
686
|
+
await fs.writeIfUnchanged(filename, contents.toString());
|
|
687
|
+
}
|
|
688
|
+
catch (err) {
|
|
689
|
+
return [err];
|
|
690
|
+
}
|
|
691
|
+
return [];
|
|
692
|
+
}
|
|
491
693
|
/**
|
|
492
694
|
* Saves the schema to a file, for use by the VSCode GraphQL extension
|
|
493
695
|
*/
|
|
@@ -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
|
-
|
|
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
|
});
|
|
@@ -3,12 +3,14 @@ type PluginConfig = {
|
|
|
3
3
|
rootDir: string;
|
|
4
4
|
fallbackType: string;
|
|
5
5
|
globalName: string;
|
|
6
|
-
getType?: (importedName: string, definition: any) => string;
|
|
6
|
+
getType?: (importedName: string, definition: any, name: string) => string;
|
|
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":"AAIA,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,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACzE,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"}
|
|
@@ -31,9 +31,9 @@ export default {
|
|
|
31
31
|
filesFound[relative.replace(/\.graphql/, "")] = true;
|
|
32
32
|
if (relative && doc.document.definitions.length) {
|
|
33
33
|
let importedName = doc.document.definitions[0].name.value + "Query";
|
|
34
|
-
let typeName = config.getType?.(importedName, doc.document.definitions[0]) || importedName;
|
|
35
|
-
imports.push(importedName);
|
|
36
34
|
const key = relative.replace(/\.graphql/, "");
|
|
35
|
+
let typeName = config.getType?.(importedName, doc.document.definitions[0], key) || importedName;
|
|
36
|
+
imports.push(importedName);
|
|
37
37
|
items.push(`${JSON.stringify(key)}: ${typeForFile(key, typeName)}`);
|
|
38
38
|
}
|
|
39
39
|
});
|
|
@@ -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} {
|
|
@@ -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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gql-plugin-queries.d.ts","sourceRoot":"","sources":["../../../../src/node/graphql/plugins/gql-plugin-queries.ts"],"names":[],"mappings":"AAWA,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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { printSourceLocation, visit, } from "graphql";
|
|
2
|
-
import { code, imp } from "ts-poet";
|
|
3
2
|
import { basename } from "path";
|
|
3
|
+
import { code, imp } from "ts-poet";
|
|
4
4
|
export default {
|
|
5
5
|
plugin: (schema, documents, config, info) => {
|
|
6
6
|
const hooks = {};
|
|
@@ -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
|
|
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"}
|