eddev 2.0.0-beta.14 → 2.0.0-beta.140
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 +8 -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 +4 -4
- package/dist/app/entry/ssr-root.d.ts.map +1 -0
- package/dist/app/entry/ssr-root.js +19 -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 +4 -3
- package/dist/app/lib/blocks/EditableText.d.ts +15 -1
- package/dist/app/lib/blocks/EditableText.d.ts.map +1 -0
- package/dist/app/lib/blocks/EditableText.js +10 -3
- package/dist/app/lib/blocks/InnerBlocks.d.ts +20 -5
- package/dist/app/lib/blocks/InnerBlocks.d.ts.map +1 -0
- package/dist/app/lib/blocks/InnerBlocks.js +72 -25
- 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 +1 -1
- 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 +15 -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 +7 -0
- package/dist/app/lib/blocks/editor/block-templates.d.ts.map +1 -0
- package/dist/app/lib/blocks/editor/block-templates.js +64 -0
- 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 +70 -6
- 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 +92 -14
- 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 +6 -4
- package/dist/app/lib/blocks/index.d.ts.map +1 -0
- package/dist/app/lib/blocks/index.js +5 -4
- 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 +13 -3
- 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 +1376 -331
- 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 +7 -6
- 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 +2 -2
- package/dist/app/lib/hooks/index.d.ts.map +1 -0
- package/dist/app/lib/hooks/index.js +1 -2
- package/dist/app/lib/hooks/queryUtils.d.ts +38 -2
- package/dist/app/lib/hooks/queryUtils.d.ts.map +1 -0
- package/dist/app/lib/hooks/queryUtils.js +73 -24
- 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 +12 -1
- 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 +1 -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 +141 -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 +285 -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 +1 -0
- package/dist/app/lib/internal/read-block-manifest.d.ts.map +1 -0
- package/dist/app/lib/internal/read-view-manifest.d.ts +1 -0
- package/dist/app/lib/internal/read-view-manifest.d.ts.map +1 -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/createStitches.js +1 -1
- 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 +6 -1
- package/dist/app/lib/routing/components/BrowserRouter.d.ts.map +1 -0
- package/dist/app/lib/routing/components/BrowserRouter.js +96 -17
- 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 +2 -0
- package/dist/app/lib/routing/components/Link.d.ts.map +1 -0
- package/dist/app/lib/routing/components/Link.js +11 -9
- 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 +4 -3
- package/dist/app/lib/routing/components/SSRRouter.d.ts +1 -0
- package/dist/app/lib/routing/components/SSRRouter.d.ts.map +1 -0
- package/dist/app/lib/routing/components/SSRRouter.js +1 -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 +6 -1
- package/dist/app/lib/routing/context.d.ts.map +1 -0
- package/dist/app/lib/routing/context.js +12 -0
- 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/useRestorableState.js +2 -1
- package/dist/app/lib/routing/hooks/useRoute.d.ts +17 -1
- 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 +76 -4
- package/dist/app/lib/routing/hooks/useSearchParams.d.ts.map +1 -0
- package/dist/app/lib/routing/hooks/useSearchParams.js +70 -11
- package/dist/app/lib/routing/index.d.ts +2 -0
- package/dist/app/lib/routing/index.d.ts.map +1 -0
- package/dist/app/lib/routing/index.js +1 -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 +49 -8
- package/dist/app/lib/routing/types.d.ts.map +1 -0
- package/dist/app/lib/routing/utils.d.ts +6 -2
- package/dist/app/lib/routing/utils.d.ts.map +1 -0
- package/dist/app/lib/routing/utils.js +36 -3
- package/dist/app/lib/{hooks → runtime}/apiConfig.d.ts +7 -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 +2 -0
- package/dist/app/server/index.d.ts.map +1 -0
- package/dist/app/server/index.js +1 -0
- 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 +43 -14
- package/dist/app/server/render-ssr-page.d.ts +27 -2
- package/dist/app/server/render-ssr-page.d.ts.map +1 -0
- package/dist/app/server/render-ssr-page.js +212 -12
- package/dist/app/server/rpc.d.ts +49 -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 +45 -4
- package/dist/app/server/server-context.d.ts.map +1 -0
- package/dist/app/server/server-context.js +329 -33
- 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 +19 -0
- package/dist/app/utils/RouteErrorBoundary.d.ts.map +1 -0
- package/dist/app/utils/RouteErrorBoundary.js +38 -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 +11 -5
- 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 +85 -11
- 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 +3 -6
- 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 +2 -1
- 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 +2 -1
- package/dist/node/compiler/bundler.admin.d.ts.map +1 -0
- package/dist/node/compiler/bundler.admin.js +1 -1
- package/dist/node/compiler/bundler.frontend.d.ts +1 -0
- package/dist/node/compiler/bundler.frontend.d.ts.map +1 -0
- package/dist/node/compiler/bundler.frontend.js +1 -1
- 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 +11 -0
- 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 +170 -41
- 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 +140 -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 +367 -111
- 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 +216 -34
- 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 +2 -0
- package/dist/node/graphql/plugins/gql-plugin-files.d.ts.map +1 -0
- package/dist/node/graphql/plugins/gql-plugin-files.js +1 -0
- 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 +1 -1
- 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 +160 -73
- package/dist/node/project/config.d.ts.map +1 -0
- package/dist/node/project/config.js +69 -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 +2 -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 +3 -1
- 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/view-manifest.js +1 -1
- 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 -1
- package/dist/node/project/project.d.ts.map +1 -0
- package/dist/node/project/project.js +61 -7
- package/dist/node/project/wp-info.d.ts +2 -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 +22 -16
- package/dist/node/types/block-type.d.ts.map +1 -0
- package/dist/node/types/block-type.js +1 -0
- 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 +27 -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 +3 -0
- package/dist/node/utils/fs-codegen.d.ts.map +1 -0
- package/dist/node/utils/fs-codegen.js +2 -1
- 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 +7 -6
- package/dist/node/utils/report-builder.d.ts.map +1 -0
- package/dist/node/utils/self-signed-cert.d.ts +3 -0
- package/dist/node/utils/self-signed-cert.d.ts.map +1 -0
- package/dist/node/utils/self-signed-cert.js +10 -2
- 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 +36 -24
- package/tsconfig.app.json +10 -5
- package/tsconfig.node.json +3 -2
- package/types.app.d.ts +2 -0
- package/types.meta.d.ts +116 -0
- 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,7 +1,12 @@
|
|
|
1
|
-
import { parseURL, stringifyParsedURL, withQuery } from "ufo";
|
|
1
|
+
import { parseURL, stringifyParsedURL, withQuery, withTrailingSlash } from "ufo";
|
|
2
|
+
import { fetchWP } from "../../node/utils/fetch-wp.js";
|
|
2
3
|
import { filterHeader } from "./utils/headers.js";
|
|
3
4
|
import { createUrlReplacer } from "./utils/replace-host.js";
|
|
4
|
-
|
|
5
|
+
import { pageCache, queryCache, swr } from "./utils/swr-cache.js";
|
|
6
|
+
import { QueryMonitor } from "../utils/query-monitor.js";
|
|
7
|
+
import chalk from "chalk";
|
|
8
|
+
import { inspect } from "node:util";
|
|
9
|
+
const PROXY_RESPONSE_HEADERS = ["content-type", "set-cookie", /^x-/, "cache-control", /woocommerce/, "location"];
|
|
5
10
|
const PROXY_REQUEST_HEADERS = [
|
|
6
11
|
"content-type",
|
|
7
12
|
"accept",
|
|
@@ -11,34 +16,50 @@ const PROXY_REQUEST_HEADERS = [
|
|
|
11
16
|
"referer",
|
|
12
17
|
"user-agent",
|
|
13
18
|
"authorization",
|
|
19
|
+
"woocommerce-session",
|
|
14
20
|
];
|
|
21
|
+
const VARIES_HEADERS = ["Authorization", "woocommerce-session"];
|
|
22
|
+
let runtime;
|
|
15
23
|
export class ServerContext {
|
|
16
24
|
dev;
|
|
17
25
|
origin;
|
|
18
|
-
|
|
26
|
+
_urlReplacer;
|
|
27
|
+
rpcBases = [];
|
|
28
|
+
config;
|
|
29
|
+
static main;
|
|
19
30
|
constructor(conf) {
|
|
20
31
|
this.dev = conf.dev;
|
|
21
32
|
this.origin = conf.origin;
|
|
33
|
+
this.rpcBases = conf.rpcBases ?? [];
|
|
34
|
+
this.config = conf.config;
|
|
22
35
|
if (conf.replaceUrls) {
|
|
23
|
-
this.
|
|
36
|
+
this._urlReplacer = createUrlReplacer(conf.replaceUrls);
|
|
24
37
|
}
|
|
38
|
+
ServerContext.main = this;
|
|
39
|
+
}
|
|
40
|
+
replaceUrls(text, origin) {
|
|
41
|
+
if (this._urlReplacer) {
|
|
42
|
+
return this._urlReplacer(text, origin);
|
|
43
|
+
}
|
|
44
|
+
return text;
|
|
45
|
+
}
|
|
46
|
+
get runtime() {
|
|
47
|
+
return runtime;
|
|
48
|
+
}
|
|
49
|
+
static setRuntime(rt) {
|
|
50
|
+
runtime = rt;
|
|
25
51
|
}
|
|
26
52
|
getOriginUrl(url) {
|
|
27
53
|
const parsed = parseURL(url);
|
|
28
|
-
const parsedOrigin = parseURL(
|
|
54
|
+
const parsedOrigin = parseURL(this.origin);
|
|
29
55
|
parsed.host = parsedOrigin.host;
|
|
30
56
|
parsed.protocol = parsedOrigin.protocol;
|
|
31
57
|
return stringifyParsedURL(parsed);
|
|
32
58
|
}
|
|
33
59
|
async fetchOrigin(url, opts) {
|
|
34
60
|
url = this.getOriginUrl(url);
|
|
35
|
-
const response = await
|
|
61
|
+
const response = await fetchWP(url, {
|
|
36
62
|
...opts,
|
|
37
|
-
headers: {
|
|
38
|
-
"Content-Type": "application/json",
|
|
39
|
-
Accept: "application/json",
|
|
40
|
-
...opts?.headers,
|
|
41
|
-
},
|
|
42
63
|
});
|
|
43
64
|
if (!response.ok) {
|
|
44
65
|
return response;
|
|
@@ -50,8 +71,8 @@ export class ServerContext {
|
|
|
50
71
|
}
|
|
51
72
|
});
|
|
52
73
|
let text = await response.text();
|
|
53
|
-
if (opts?.replaceUrls
|
|
54
|
-
text = this.replaceUrls(text);
|
|
74
|
+
if (opts?.replaceUrls) {
|
|
75
|
+
text = this.replaceUrls(text, opts.newOrigin);
|
|
55
76
|
}
|
|
56
77
|
return new Response(text, {
|
|
57
78
|
status: response.status,
|
|
@@ -59,22 +80,209 @@ export class ServerContext {
|
|
|
59
80
|
headers,
|
|
60
81
|
});
|
|
61
82
|
}
|
|
83
|
+
debugLogQueryMonitor(kind, uri, monitor) {
|
|
84
|
+
if (!QueryMonitor.hasLogEntries(monitor))
|
|
85
|
+
return;
|
|
86
|
+
let indentLevel = 2;
|
|
87
|
+
const finalOutput = [];
|
|
88
|
+
let label = "";
|
|
89
|
+
if (kind === "props") {
|
|
90
|
+
label = "While fetching props for route '" + uri + "'";
|
|
91
|
+
}
|
|
92
|
+
else if (kind === "query") {
|
|
93
|
+
label = "While querying " + uri + " via REST API";
|
|
94
|
+
}
|
|
95
|
+
else if (kind === "mutation") {
|
|
96
|
+
label = "While mutating " + uri + " via REST API";
|
|
97
|
+
}
|
|
98
|
+
else if (kind === "app") {
|
|
99
|
+
label = "While fetching app data";
|
|
100
|
+
}
|
|
101
|
+
finalOutput.push(chalk.whiteBright("➜ " + label));
|
|
102
|
+
function printEntry(entry) {
|
|
103
|
+
finalOutput.push(indent(indentLevel, chalk.whiteBright("➜ " + entry.file) + " " + chalk.gray(entry.label ? `(${entry.label})` : "")));
|
|
104
|
+
indentLevel += 2;
|
|
105
|
+
if (entry.log && entry.log.length) {
|
|
106
|
+
for (let item of entry.log) {
|
|
107
|
+
let output = "";
|
|
108
|
+
let prefix = "";
|
|
109
|
+
let message = item.message;
|
|
110
|
+
let stack = [];
|
|
111
|
+
if (item.type === "php_error") {
|
|
112
|
+
prefix = chalk.red("PHP Error:");
|
|
113
|
+
}
|
|
114
|
+
else if (item.type === "php_warning") {
|
|
115
|
+
prefix = chalk.yellow("PHP Warning:");
|
|
116
|
+
}
|
|
117
|
+
else if (item.type === "php_notice") {
|
|
118
|
+
prefix = chalk.yellow("PHP Notice:");
|
|
119
|
+
}
|
|
120
|
+
else if (item.type === "GRAPHQL_DEBUG") {
|
|
121
|
+
prefix = chalk.cyan("debug:");
|
|
122
|
+
}
|
|
123
|
+
else if (item.type === "error" && item.extensions?.category === "user") {
|
|
124
|
+
prefix = chalk.red("UserError:");
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
prefix = chalk.gray((item.type || "Log") + ":");
|
|
128
|
+
}
|
|
129
|
+
if (typeof message !== "string") {
|
|
130
|
+
message = inspect(message, { depth: 4 });
|
|
131
|
+
}
|
|
132
|
+
if (item.debugMessage) {
|
|
133
|
+
message += "\n" + chalk.gray(item.debugMessage);
|
|
134
|
+
}
|
|
135
|
+
output += prefix + " " + message;
|
|
136
|
+
if (item.path) {
|
|
137
|
+
stack.push(chalk.gray(" at path " + JSON.stringify(item.path)));
|
|
138
|
+
}
|
|
139
|
+
if (item.file) {
|
|
140
|
+
stack.push(chalk.gray(`at ${chalk.white(item.file)} line ${item.line || "??"}`));
|
|
141
|
+
}
|
|
142
|
+
if (item.stack?.length) {
|
|
143
|
+
stack.push(item.stack
|
|
144
|
+
.filter((line) => {
|
|
145
|
+
return line !== item.file + ":" + item.line;
|
|
146
|
+
})
|
|
147
|
+
.slice(0, 4)
|
|
148
|
+
.map((line) => " " + chalk.gray(line))
|
|
149
|
+
.join("\n"));
|
|
150
|
+
}
|
|
151
|
+
if (stack.length > 0) {
|
|
152
|
+
output += indent(2, "\n" + stack.join("\n"));
|
|
153
|
+
}
|
|
154
|
+
finalOutput.push(indent(indentLevel, "➜ " + output));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
for (let child of entry.children ?? []) {
|
|
158
|
+
printEntry(child);
|
|
159
|
+
}
|
|
160
|
+
indentLevel -= 2;
|
|
161
|
+
}
|
|
162
|
+
for (let entry of monitor) {
|
|
163
|
+
printEntry(entry);
|
|
164
|
+
}
|
|
165
|
+
console.debug(finalOutput.join("\n"));
|
|
166
|
+
}
|
|
62
167
|
async fetchRouteData(req) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Calculcate the cache key.
|
|
170
|
+
* For route data, the cache key is the pathname.
|
|
171
|
+
* TODO: Potential support for Vercel draft mode.
|
|
172
|
+
*/
|
|
173
|
+
let cacheKey = "fetchRouteData:" + req.pathname;
|
|
174
|
+
const result = await swr({
|
|
175
|
+
key: cacheKey,
|
|
176
|
+
cache: pageCache,
|
|
177
|
+
forceFresh: this.dev,
|
|
178
|
+
getFreshValue: async (ctx) => {
|
|
179
|
+
ctx.metadata.createdTime;
|
|
180
|
+
const fetchUrl = withQuery(withTrailingSlash(req.pathname), {
|
|
181
|
+
_props: "1",
|
|
182
|
+
_ssr: "1",
|
|
183
|
+
_debug: this.dev ? "1" : undefined,
|
|
184
|
+
});
|
|
185
|
+
const result = await this.fetchOrigin(fetchUrl, {
|
|
186
|
+
cache: "no-cache",
|
|
187
|
+
replaceUrls: true,
|
|
188
|
+
newOrigin: req.newOrigin,
|
|
189
|
+
headers: {
|
|
190
|
+
"Content-Type": "application/json",
|
|
191
|
+
Accept: "application/json",
|
|
192
|
+
},
|
|
193
|
+
redirect: "manual",
|
|
194
|
+
});
|
|
195
|
+
const preferredCacheDuration = parseInt(result.headers.get("x-ed-cache-duration") ?? "");
|
|
196
|
+
if (isFinite(preferredCacheDuration)) {
|
|
197
|
+
ctx.metadata.ttl = preferredCacheDuration * 1000;
|
|
198
|
+
}
|
|
199
|
+
let resultStatus = result.status;
|
|
200
|
+
let resultHeaders = new Headers(result.headers);
|
|
201
|
+
let resultData = {};
|
|
202
|
+
// Special case for redirects
|
|
203
|
+
if (result.headers.get("location")) {
|
|
204
|
+
let location = result.headers.get("location");
|
|
205
|
+
let status = result.status;
|
|
206
|
+
if (this.replaceUrls) {
|
|
207
|
+
location = this.replaceUrls(location);
|
|
208
|
+
}
|
|
209
|
+
resultHeaders.delete("location");
|
|
210
|
+
return {
|
|
211
|
+
status: 200,
|
|
212
|
+
headers: resultHeaders,
|
|
213
|
+
data: JSON.stringify({ redirect: location, status: status }),
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
try {
|
|
217
|
+
resultData = await result.json();
|
|
218
|
+
}
|
|
219
|
+
catch (err) {
|
|
220
|
+
console.error(`Invalid JSON response from '${fetchUrl}'. An error page will be displayed.`);
|
|
221
|
+
ctx.metadata.ttl = 0;
|
|
222
|
+
return {
|
|
223
|
+
status: 500,
|
|
224
|
+
headers: resultHeaders,
|
|
225
|
+
data: JSON.stringify({
|
|
226
|
+
view: "_error",
|
|
227
|
+
viewData: {
|
|
228
|
+
data: {
|
|
229
|
+
statusCode: 500,
|
|
230
|
+
title: "Internal Server Error",
|
|
231
|
+
userMessage: "An internal server error occurred.",
|
|
232
|
+
report: {
|
|
233
|
+
details: "A JSON parsing error occurred while fetching route data.",
|
|
234
|
+
message: err.message,
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
}),
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
if (resultData && typeof resultData === "object") {
|
|
242
|
+
resultData.__generated = new Date().toISOString();
|
|
243
|
+
}
|
|
244
|
+
if (resultData.queryMonitor) {
|
|
245
|
+
this.debugLogQueryMonitor("props", req.pathname, resultData.queryMonitor);
|
|
246
|
+
}
|
|
247
|
+
return {
|
|
248
|
+
status: resultStatus,
|
|
249
|
+
headers: resultHeaders,
|
|
250
|
+
data: JSON.stringify(resultData),
|
|
251
|
+
};
|
|
252
|
+
},
|
|
68
253
|
});
|
|
69
|
-
return
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
254
|
+
return new Response(result.data, {
|
|
255
|
+
status: result.status,
|
|
256
|
+
headers: result.headers,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
async fetchAppData() {
|
|
260
|
+
const data = await swr({
|
|
261
|
+
key: "fetchAppData",
|
|
262
|
+
cache: pageCache,
|
|
263
|
+
getFreshValue: async (ctx) => {
|
|
264
|
+
const response = await this.fetchOrigin("/_appdata", {
|
|
265
|
+
cache: "no-cache",
|
|
266
|
+
replaceUrls: true,
|
|
267
|
+
headers: {
|
|
268
|
+
"Content-Type": "application/json",
|
|
269
|
+
Accept: "application/json",
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
const result = await response.json();
|
|
273
|
+
const preferredCacheDuration = parseInt(response.headers.get("x-ed-cache-duration") ?? "");
|
|
274
|
+
if (isFinite(preferredCacheDuration)) {
|
|
275
|
+
ctx.metadata.ttl = preferredCacheDuration * 1000;
|
|
276
|
+
}
|
|
277
|
+
if (result.queryMonitor) {
|
|
278
|
+
this.debugLogQueryMonitor("app", "", result.queryMonitor);
|
|
279
|
+
}
|
|
280
|
+
result.__generated = new Date().toISOString();
|
|
281
|
+
return result;
|
|
76
282
|
},
|
|
283
|
+
forceFresh: this.dev,
|
|
77
284
|
});
|
|
285
|
+
return data;
|
|
78
286
|
}
|
|
79
287
|
extractRequestHeaders(req) {
|
|
80
288
|
const headers = {};
|
|
@@ -89,14 +297,52 @@ export class ServerContext {
|
|
|
89
297
|
}
|
|
90
298
|
async fetchNamedQuery(req) {
|
|
91
299
|
const url = `/wp-json/ed/v1/query/${req.name}?params=${encodeURIComponent(JSON.stringify(req.params))}`;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
300
|
+
const key = `fetchNamedQuery:${req.name}:${JSON.stringify(req.params)}`;
|
|
301
|
+
const fetch = async () => {
|
|
302
|
+
const result = await this.fetchOrigin(url, {
|
|
303
|
+
cache: "no-cache",
|
|
304
|
+
replaceUrls: true,
|
|
305
|
+
headers: {
|
|
306
|
+
...this.extractRequestHeaders(req.headers),
|
|
307
|
+
"Content-Type": "application/json",
|
|
308
|
+
Accept: "application/json",
|
|
309
|
+
},
|
|
310
|
+
});
|
|
311
|
+
const preferredCacheDuration = parseInt(result.headers.get("x-ed-cache-duration") ?? "");
|
|
312
|
+
let resultStatus = result.status;
|
|
313
|
+
let resultHeaders = result.headers;
|
|
314
|
+
let resultData = await result.json();
|
|
315
|
+
if (resultData && typeof resultData === "object") {
|
|
316
|
+
resultData.__generated = new Date().toISOString();
|
|
317
|
+
}
|
|
318
|
+
if (resultData.queryMonitor) {
|
|
319
|
+
this.debugLogQueryMonitor("query", req.name, resultData.queryMonitor);
|
|
320
|
+
}
|
|
321
|
+
return {
|
|
322
|
+
status: resultStatus,
|
|
323
|
+
headers: resultHeaders,
|
|
324
|
+
data: JSON.stringify(resultData),
|
|
325
|
+
cacheTime: isFinite(preferredCacheDuration) ? preferredCacheDuration * 1000 : undefined,
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
// If headers like 'Authorization' are set, then we shouldn't cache.
|
|
329
|
+
const hasVariedHeaders = VARIES_HEADERS.some((key) => !!req.headers[key]);
|
|
330
|
+
// Get the result, either from cache or by fetching.
|
|
331
|
+
const result = hasVariedHeaders
|
|
332
|
+
? await fetch()
|
|
333
|
+
: await swr({
|
|
334
|
+
key,
|
|
335
|
+
cache: queryCache,
|
|
336
|
+
forceFresh: this.dev,
|
|
337
|
+
getFreshValue: async (ctx) => {
|
|
338
|
+
const result = await fetch();
|
|
339
|
+
ctx.metadata.ttl = result.cacheTime;
|
|
340
|
+
return result;
|
|
341
|
+
},
|
|
342
|
+
});
|
|
343
|
+
return new Response(result.data, {
|
|
344
|
+
status: result.status,
|
|
345
|
+
headers: result.headers,
|
|
100
346
|
});
|
|
101
347
|
}
|
|
102
348
|
async fetchMutation(req) {
|
|
@@ -113,4 +359,54 @@ export class ServerContext {
|
|
|
113
359
|
body: JSON.stringify(req.body),
|
|
114
360
|
});
|
|
115
361
|
}
|
|
362
|
+
get allowedCorsOrigins() {
|
|
363
|
+
let result = [];
|
|
364
|
+
if (this.config.serverless.endpoints) {
|
|
365
|
+
result.push(...Object.keys(this.config.serverless.endpoints));
|
|
366
|
+
result.push(...Object.values(this.config.serverless.endpoints));
|
|
367
|
+
result = result.filter((origin) => origin !== "*");
|
|
368
|
+
}
|
|
369
|
+
if (this.config.serverless.cors?.origins) {
|
|
370
|
+
result.push(...this.config.serverless.cors.origins);
|
|
371
|
+
}
|
|
372
|
+
return result;
|
|
373
|
+
}
|
|
374
|
+
getCorsOrigin(originHeader) {
|
|
375
|
+
const parsed = parseURL(originHeader);
|
|
376
|
+
if (this.allowedCorsOrigins.includes(parsed.host)) {
|
|
377
|
+
return originHeader;
|
|
378
|
+
}
|
|
379
|
+
if (this.allowedCorsOrigins.includes("*")) {
|
|
380
|
+
return "*";
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
getCorsHeaders(origin) {
|
|
384
|
+
if (!origin)
|
|
385
|
+
return {};
|
|
386
|
+
const allowedOrigin = this.getCorsOrigin(origin);
|
|
387
|
+
if (allowedOrigin) {
|
|
388
|
+
return {
|
|
389
|
+
"Access-Control-Allow-Methods": "OPTIONS,GET,HEAD,PUT,PATCH,POST,DELETE",
|
|
390
|
+
"Access-Control-Allow-Origin": allowedOrigin,
|
|
391
|
+
"Access-Control-Allow-Credentials": "true",
|
|
392
|
+
"Access-Control-Allow-Headers": "*",
|
|
393
|
+
"Access-Control-Expose-Headers": "*",
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
return {};
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
function indent(count, str) {
|
|
400
|
+
const indent = " ".repeat(count);
|
|
401
|
+
return str
|
|
402
|
+
.split("\n")
|
|
403
|
+
.map((line) => indent + line)
|
|
404
|
+
.join("\n");
|
|
405
|
+
}
|
|
406
|
+
function indentAllButFirst(count, str) {
|
|
407
|
+
const indent = " ".repeat(count);
|
|
408
|
+
return str
|
|
409
|
+
.split("\n")
|
|
410
|
+
.map((line, i) => (i === 0 ? line : indent + line))
|
|
411
|
+
.join("\n");
|
|
116
412
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../../../src/app/server/utils/headers.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,WAOrE;AAED,eAAO,MAAM,eAAe;;CAE3B,CAAA;AAYD,wBAAgB,cAAc,CAAC,UAAU,EAAE,OAAO,0BAOjD"}
|
|
@@ -7,4 +7,5 @@ export type UrlReplacerConf = {
|
|
|
7
7
|
replace: boolean;
|
|
8
8
|
}[];
|
|
9
9
|
};
|
|
10
|
-
export declare function createUrlReplacer(conf: UrlReplacerConf): (text: string) => string;
|
|
10
|
+
export declare function createUrlReplacer(conf: UrlReplacerConf): (text: string, newOrigin?: string) => string;
|
|
11
|
+
//# sourceMappingURL=replace-host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace-host.d.ts","sourceRoot":"","sources":["../../../../src/app/server/utils/replace-host.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,0FAA0F;IAC1F,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;CACjD,CAAA;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,UAIvC,MAAM,cAAc,MAAM,YAiEzC"}
|
|
@@ -2,7 +2,7 @@ export function createUrlReplacer(conf) {
|
|
|
2
2
|
// Create a regular expression to match the URL
|
|
3
3
|
// Note that that the regex doesn't necessarily match the entire URL
|
|
4
4
|
const lookup = new RegExp(conf.from.replace(/https?[:\\\/]+/, "https?[:\\/\\\\]+") + "([a-z0-9\\-_/\\\\]+)", "ig");
|
|
5
|
-
return (text) => {
|
|
5
|
+
return (text, newOrigin) => {
|
|
6
6
|
return text.replace(lookup, (url) => {
|
|
7
7
|
// Strip out the origin, to create a relative path
|
|
8
8
|
const path = url.replace(/https?:[\/\\]+[^\/\\]+/, "");
|
|
@@ -18,10 +18,18 @@ export function createUrlReplacer(conf) {
|
|
|
18
18
|
return url;
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
|
-
|
|
21
|
+
break;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
if (newOrigin) {
|
|
26
|
+
if (isEscaped) {
|
|
27
|
+
return newOrigin.replace(/\//g, "\\/") + path;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return newOrigin + path;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
25
33
|
return path;
|
|
26
34
|
// if (path.startsWith("/wp-content/uploads/")) {
|
|
27
35
|
// if (!conf.ignoreUploads) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swr-cache.d.ts","sourceRoot":"","sources":["../../../../src/app/server/utils/swr-cache.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,EAAY,gBAAgB,EAAmB,MAAM,qBAAqB,CAAA;AAuB/G,eAAO,MAAM,SAAS,YAAgB,CAAA;AACtC,eAAO,MAAM,UAAU,YAAgB,CAAA;AAEvC,wBAAgB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,cAO/C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LRUCache } from "lru-cache";
|
|
2
|
+
import { cachified, totalTtl } from "@epic-web/cachified";
|
|
3
|
+
function createCache() {
|
|
4
|
+
const lruInstance = new LRUCache({ max: 1000 });
|
|
5
|
+
const lru = {
|
|
6
|
+
set(key, value) {
|
|
7
|
+
const ttl = totalTtl(value?.metadata);
|
|
8
|
+
return lruInstance.set(key, value, {
|
|
9
|
+
ttl: ttl === Infinity ? undefined : ttl,
|
|
10
|
+
start: value?.metadata?.createdTime,
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
get(key) {
|
|
14
|
+
return lruInstance.get(key);
|
|
15
|
+
},
|
|
16
|
+
delete(key) {
|
|
17
|
+
return lruInstance.delete(key);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
return lru;
|
|
21
|
+
}
|
|
22
|
+
export const pageCache = createCache();
|
|
23
|
+
export const queryCache = createCache();
|
|
24
|
+
export function swr(args) {
|
|
25
|
+
return cachified({
|
|
26
|
+
ttl: args.ttl ?? 10_000,
|
|
27
|
+
swr: 3600_000,
|
|
28
|
+
fallbackToCache: 15_000,
|
|
29
|
+
...args,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"APIProvider.d.ts","sourceRoot":"","sources":["../../../src/app/utils/APIProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAGzC,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,CAAC,EAAE,CAAC,2CAEvD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component, ErrorInfo, ReactNode } from "react";
|
|
2
|
+
import { BlocksContext, ContentBlock } from "../lib/blocks/ContentBlocks.js";
|
|
3
|
+
interface Props {
|
|
4
|
+
block: ContentBlock;
|
|
5
|
+
blockContext: BlocksContext;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
interface State {
|
|
9
|
+
hasError: boolean;
|
|
10
|
+
error?: Error;
|
|
11
|
+
errorInfo?: ErrorInfo;
|
|
12
|
+
}
|
|
13
|
+
export declare class BlockErrorBoundary extends Component<Props, State> {
|
|
14
|
+
state: State;
|
|
15
|
+
static getDerivedStateFromError(error: Error): State;
|
|
16
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
17
|
+
render(): ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=BlockErrorBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/app/utils/BlockErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAG5E,UAAU,KAAK;IACb,KAAK,EAAE,YAAY,CAAA;IACnB,YAAY,EAAE,aAAa,CAAA;IAC3B,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,UAAU,KAAK;IACb,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB;AAED,qBAAa,kBAAmB,SAAQ,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IACtD,KAAK,EAAE,KAAK,CAElB;WAEa,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;IAKpD,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS;IAWpD,MAAM;CAmBd"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Component } from "react";
|
|
3
|
+
import { errorHandling } from "../lib/runtime/errorHandling.js";
|
|
4
|
+
import { ErrorMessage } from "./ErrorMessage.js";
|
|
5
|
+
export class BlockErrorBoundary extends Component {
|
|
6
|
+
state = {
|
|
7
|
+
hasError: false,
|
|
8
|
+
};
|
|
9
|
+
static getDerivedStateFromError(error) {
|
|
10
|
+
// Update state so the next render will show the fallback UI.
|
|
11
|
+
return { hasError: true, error: error };
|
|
12
|
+
}
|
|
13
|
+
componentDidCatch(error, errorInfo) {
|
|
14
|
+
if (errorHandling.onReactError) {
|
|
15
|
+
errorHandling.onReactError({
|
|
16
|
+
type: "block",
|
|
17
|
+
block: this.props.block,
|
|
18
|
+
error,
|
|
19
|
+
componentStack: errorInfo.componentStack,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
if (this.state.hasError) {
|
|
25
|
+
const err = this.state.error;
|
|
26
|
+
let display = env.dev ? _jsx(ErrorMessage, { error: err }) : null;
|
|
27
|
+
if (errorHandling.renderFallback) {
|
|
28
|
+
display = errorHandling.renderFallback({
|
|
29
|
+
type: "block",
|
|
30
|
+
block: this.props.block,
|
|
31
|
+
error: err,
|
|
32
|
+
}, display);
|
|
33
|
+
}
|
|
34
|
+
return display;
|
|
35
|
+
}
|
|
36
|
+
return this.props.children;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorMessage.d.ts","sourceRoot":"","sources":["../../../src/app/utils/ErrorMessage.tsx"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAED,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,KAAK,2CAkB5C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function ErrorMessage({ error }) {
|
|
3
|
+
return (_jsx("pre", { style: {
|
|
4
|
+
backgroundColor: "#060309",
|
|
5
|
+
fontSize: "12px",
|
|
6
|
+
color: "#d92a0b",
|
|
7
|
+
outline: "1px solid #d92a0b",
|
|
8
|
+
outlineOffset: "-4px",
|
|
9
|
+
borderRadius: "6px",
|
|
10
|
+
padding: "12px 16px",
|
|
11
|
+
overflowX: "auto",
|
|
12
|
+
fontFamily: '"Roboto Mono", Menlo, monospace',
|
|
13
|
+
}, children: error.stack ?? String(error) }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component, ErrorInfo, ReactNode } from "react";
|
|
2
|
+
import { RouteState } from "../lib/routing/types.js";
|
|
3
|
+
interface Props {
|
|
4
|
+
route: RouteState;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
interface State {
|
|
8
|
+
hasError: boolean;
|
|
9
|
+
error?: Error;
|
|
10
|
+
errorInfo?: ErrorInfo;
|
|
11
|
+
}
|
|
12
|
+
export declare class RouteErrorBoundary extends Component<Props, State> {
|
|
13
|
+
state: State;
|
|
14
|
+
static getDerivedStateFromError(error: Error): State;
|
|
15
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
16
|
+
render(): ReactNode;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=RouteErrorBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouteErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/app/utils/RouteErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAIpD,UAAU,KAAK;IACb,KAAK,EAAE,UAAU,CAAA;IACjB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,UAAU,KAAK;IACb,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB;AAED,qBAAa,kBAAmB,SAAQ,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IACtD,KAAK,EAAE,KAAK,CAElB;WAEa,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;IAKpD,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS;IAWpD,MAAM;CAmBd"}
|