eddev 2.0.0-beta.1 → 2.0.0-beta.100
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/dist/app/entry/HydrationOverlay.d.ts +1 -0
- package/dist/app/entry/HydrationOverlay.js +2 -0
- package/dist/app/entry/MetaTags.d.ts +7 -0
- package/dist/app/entry/MetaTags.js +17 -0
- package/dist/app/entry/boot-admin.d.ts +1 -0
- package/dist/app/entry/boot-admin.js +13 -0
- package/dist/app/entry/hydration-script.d.ts +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.js +8 -0
- package/dist/app/entry/ssr-root-client.d.ts +6 -0
- package/dist/app/entry/ssr-root-client.js +20 -0
- package/dist/app/entry/ssr-root.d.ts +8 -0
- package/dist/app/entry/ssr-root.js +22 -0
- package/dist/app/lib/admin/index.d.ts +2 -2
- package/dist/app/lib/admin/index.js +2 -2
- package/dist/app/lib/admin/installFieldTypes.js +1 -1
- package/dist/app/lib/admin/runWidgets.js +1 -1
- package/dist/app/lib/blocks/ContentBlocks.d.ts +1 -1
- package/dist/app/lib/blocks/ContentBlocks.js +5 -5
- package/dist/app/lib/blocks/EditableText.d.ts +1 -1
- package/dist/app/lib/blocks/EditableText.js +3 -3
- package/dist/app/lib/blocks/InnerBlocks.d.ts +13 -3
- package/dist/app/lib/blocks/InnerBlocks.js +13 -5
- package/dist/app/lib/blocks/block-utils.d.ts +2 -2
- package/dist/app/lib/blocks/block-utils.js +2 -2
- package/dist/app/lib/blocks/editor/EditorHighlights.d.ts +7 -0
- package/dist/app/lib/blocks/editor/EditorHighlights.js +130 -0
- package/dist/app/lib/blocks/editor/EditorSupport.js +4 -5
- package/dist/app/lib/blocks/editor/editor-config.d.ts +17 -4
- package/dist/app/lib/blocks/editor/editor-config.js +21 -9
- package/dist/app/lib/blocks/editor/installGutenbergHooks.js +20 -14
- package/dist/app/lib/blocks/editor/root-blocks.d.ts +6 -0
- package/dist/app/lib/blocks/editor/root-blocks.js +30 -0
- package/dist/app/lib/blocks/editor/usePostEditor.d.ts +1 -1
- package/dist/app/lib/blocks/index.d.ts +9 -9
- package/dist/app/lib/blocks/index.js +9 -9
- package/dist/app/lib/blocks/inline-editing.d.ts +1 -1
- package/dist/app/lib/blocks/inline-editing.js +7 -5
- package/dist/app/lib/devtools/components/BreakpointIndicator.js +6 -4
- package/dist/app/lib/devtools/components/DevUI.js +4 -3
- package/dist/app/lib/devtools/components/GridIndicator.d.ts +1 -0
- package/dist/app/lib/devtools/components/GridIndicator.js +29 -0
- package/dist/app/lib/devtools/dev-tools-store.d.ts +9 -0
- package/dist/app/lib/devtools/dev-tools-store.js +8 -0
- package/dist/app/lib/devtools/hooks/usePersistState.d.ts +1 -1
- package/dist/app/lib/devtools/hooks/usePersistState.js +11 -2
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts +1102 -1103
- package/dist/app/lib/devtools/hooks/useTailwind.js +6 -3
- package/dist/app/lib/devtools/index.d.ts +1 -0
- package/dist/app/lib/devtools/index.js +1 -1
- package/dist/app/lib/devtools/loader.js +8 -7
- package/dist/app/lib/devtools/useQueryDebug.d.ts +7 -1
- package/dist/app/lib/devtools/useQueryDebug.js +5 -8
- package/dist/app/lib/dynamic/dynamic.d.ts +1 -1
- package/dist/app/lib/dynamic/dynamic.js +5 -1
- package/dist/app/lib/dynamic/index.d.ts +1 -1
- package/dist/app/lib/dynamic/index.js +1 -1
- package/dist/app/lib/hooks/index.d.ts +4 -5
- package/dist/app/lib/hooks/index.js +4 -5
- package/dist/app/lib/hooks/queryUtils.d.ts +41 -4
- package/dist/app/lib/hooks/queryUtils.js +74 -37
- package/dist/app/lib/hooks/useAppData.js +1 -1
- package/dist/app/lib/hooks/useRPC.d.ts +0 -4
- package/dist/app/lib/hooks/useRPC.js +1 -8
- package/dist/app/lib/internal/finalize-rpc.d.ts +17 -0
- package/dist/app/lib/internal/finalize-rpc.js +3 -0
- package/dist/app/lib/internal/index.d.ts +5 -4
- package/dist/app/lib/internal/index.js +5 -4
- package/dist/app/lib/internal/internal-store.d.ts +0 -2
- package/dist/app/lib/internal/internal-store.js +1 -3
- package/dist/app/lib/internal/read-admin-manifest.d.ts +1 -1
- package/dist/app/lib/legacy-stitches/createStitches.d.ts +21 -21
- package/dist/app/lib/legacy-stitches/createStitches.js +1 -1
- package/dist/app/lib/legacy-stitches/index.d.ts +1 -1
- package/dist/app/lib/legacy-stitches/index.js +1 -1
- package/dist/app/lib/routing/components/BackButton.d.ts +49 -0
- package/dist/app/lib/routing/components/BackButton.js +47 -0
- package/dist/app/lib/routing/components/BrowserRouter.d.ts +4 -1
- package/dist/app/lib/routing/components/BrowserRouter.js +95 -19
- package/dist/app/lib/routing/components/ClientOnly.js +1 -1
- package/dist/app/lib/routing/components/Link.d.ts +1 -0
- package/dist/app/lib/routing/components/Link.js +11 -12
- package/dist/app/lib/routing/components/RouteRenderer.d.ts +1 -1
- package/dist/app/lib/routing/components/RouteRenderer.js +7 -6
- package/dist/app/lib/routing/components/SSRRouter.d.ts +2 -2
- package/dist/app/lib/routing/components/SSRRouter.js +5 -6
- package/dist/app/lib/routing/components/ScrollRestoration.js +5 -2
- package/dist/app/lib/routing/context.d.ts +8 -5
- package/dist/app/lib/routing/context.js +13 -96
- package/dist/app/lib/routing/hooks/useRestorableState.d.ts +2 -1
- package/dist/app/lib/routing/hooks/useRestorableState.js +2 -1
- package/dist/app/lib/routing/hooks/useRoute.d.ts +16 -1
- package/dist/app/lib/routing/hooks/useRoute.js +22 -1
- package/dist/app/lib/routing/hooks/useRouteMeta.d.ts +5 -0
- package/dist/app/lib/routing/hooks/useRouteMeta.js +9 -0
- package/dist/app/lib/routing/hooks/useRouteTransition.d.ts +1 -1
- package/dist/app/lib/routing/hooks/useRouteTransition.js +1 -1
- package/dist/app/lib/routing/hooks/useRouter.d.ts +1 -1
- package/dist/app/lib/routing/hooks/useRouter.js +1 -1
- package/dist/app/lib/routing/hooks/useRouterEvents.d.ts +1 -1
- package/dist/app/lib/routing/hooks/useRouterEvents.js +1 -1
- package/dist/app/lib/routing/hooks/useRouterState.d.ts +1 -1
- package/dist/app/lib/routing/hooks/useRouterState.js +1 -1
- package/dist/app/lib/routing/hooks/useSearchParams.js +2 -2
- package/dist/app/lib/routing/index.d.ts +14 -13
- package/dist/app/lib/routing/index.js +14 -13
- package/dist/app/lib/routing/loader.d.ts +2 -2
- package/dist/app/lib/routing/loader.js +26 -15
- package/dist/app/lib/routing/types.d.ts +36 -10
- package/dist/app/lib/routing/utils.d.ts +5 -2
- package/dist/app/lib/routing/utils.js +37 -4
- package/dist/app/lib/{hooks → runtime}/apiConfig.d.ts +6 -2
- package/dist/app/lib/runtime/apiConfig.js +6 -0
- package/dist/app/lib/runtime/errorHandling.d.ts +39 -0
- package/dist/app/lib/runtime/errorHandling.js +6 -0
- package/dist/app/lib/runtime/index.d.ts +2 -0
- package/dist/app/lib/runtime/index.js +2 -0
- package/dist/app/lib/views/index.d.ts +1 -1
- package/dist/app/lib/views/index.js +1 -1
- package/dist/app/server/defineRouter.d.ts +2 -0
- package/dist/app/server/defineRouter.js +4 -0
- package/dist/app/server/index.d.ts +5 -0
- package/dist/app/server/index.js +5 -0
- package/dist/app/server/proxy-wp-admin.d.ts +2 -0
- package/dist/app/server/proxy-wp-admin.js +124 -0
- package/dist/app/server/render-ssr-page.d.ts +21 -0
- package/dist/app/server/render-ssr-page.js +166 -0
- package/dist/app/server/rpc.d.ts +56 -0
- package/dist/app/server/rpc.js +18 -0
- package/dist/app/server/server-context.d.ts +72 -0
- package/dist/app/server/server-context.js +283 -0
- package/dist/app/server/utils/headers.d.ts +1 -0
- package/dist/app/server/utils/headers.js +17 -0
- package/dist/app/server/utils/replace-host.d.ts +6 -4
- package/dist/app/server/utils/replace-host.js +66 -11
- package/dist/app/server/utils/swr-cache.d.ts +4 -0
- package/dist/app/server/utils/swr-cache.js +31 -0
- package/dist/app/utils/APIProvider.d.ts +2 -0
- package/dist/app/utils/APIProvider.js +5 -0
- package/dist/app/utils/BlockErrorBoundary.d.ts +19 -0
- package/dist/app/utils/BlockErrorBoundary.js +38 -0
- package/dist/app/utils/ErrorMessage.d.ts +5 -0
- package/dist/app/utils/ErrorMessage.js +14 -0
- package/dist/app/utils/RouteErrorBoundary.d.ts +18 -0
- package/dist/app/utils/RouteErrorBoundary.js +38 -0
- package/dist/app/utils/asset-capture.d.ts +2 -0
- package/dist/app/utils/asset-capture.js +5 -0
- package/dist/app/utils/hydration-debugger.d.ts +13 -0
- package/dist/app/utils/hydration-debugger.js +11 -0
- package/dist/app/utils/query-client.d.ts +2 -0
- package/dist/app/utils/query-client.js +5 -1
- package/dist/app/utils/trpc-client.d.ts +2 -0
- package/dist/app/utils/trpc-client.js +39 -0
- package/dist/node/cli/cli-worker.d.ts +1 -1
- package/dist/node/cli/cli-worker.js +11 -3
- package/dist/node/cli/cli.js +112 -13
- package/dist/node/cli/display/CLIApp.d.ts +1 -1
- package/dist/node/cli/display/CLIApp.js +4 -7
- package/dist/node/cli/display/boot-cli-app.js +1 -1
- package/dist/node/cli/display/components/LogEntries.d.ts +1 -1
- package/dist/node/cli/display/hooks/useStatefulLog.d.ts +1 -1
- package/dist/node/cli/display/tools/CreateBlock.d.ts +1 -1
- package/dist/node/cli/display/tools/cli-tools.d.ts +1 -11
- package/dist/node/cli/display/tools/cli-tools.js +9 -9
- package/dist/node/cli/display/util/colors.d.ts +2 -2
- package/dist/node/cli/version.d.ts +1 -1
- package/dist/node/cli/version.js +1 -1
- package/dist/node/compiler/build-vinxi.d.ts +8 -0
- package/dist/node/compiler/build-vinxi.js +38 -0
- package/dist/node/compiler/bundler.admin.d.ts +2 -2
- package/dist/node/compiler/bundler.admin.js +4 -4
- package/dist/node/compiler/bundler.frontend.d.ts +1 -1
- package/dist/node/compiler/bundler.frontend.js +4 -4
- package/dist/node/compiler/{serverless.dev.d.ts → dev-server.d.ts} +7 -5
- package/dist/node/compiler/dev-server.js +107 -0
- package/dist/node/compiler/get-vite-config.d.ts +20 -0
- package/dist/node/compiler/get-vite-config.js +207 -0
- package/dist/node/compiler/vinxi-app.d.ts +22 -0
- package/dist/node/compiler/vinxi-app.js +228 -0
- package/dist/node/compiler/vinxi-codegen.d.ts +12 -0
- package/dist/node/compiler/vinxi-codegen.js +638 -0
- package/dist/node/graphql/graphql-codegen.d.ts +12 -2
- package/dist/node/graphql/graphql-codegen.js +213 -36
- package/dist/node/graphql/graphql-schema-loader.d.ts +2 -1
- package/dist/node/graphql/graphql-schema-loader.js +5 -19
- package/dist/node/graphql/plugins/gql-plugin-queries.js +1 -1
- package/dist/node/graphql/query-files-loader.d.ts +3 -0
- package/dist/node/graphql/query-files-loader.js +5 -0
- package/dist/node/project/config.d.ts +159 -73
- package/dist/node/project/config.js +70 -21
- package/dist/node/project/env.d.ts +5 -1
- package/dist/node/project/env.js +2 -1
- package/dist/node/project/manifest/block-manifest.js +3 -2
- package/dist/node/project/manifest/manifest.d.ts +2 -1
- package/dist/node/project/manifest/manifest.js +15 -11
- package/dist/node/project/manifest/routes-manifest.d.ts +20 -0
- package/dist/node/project/manifest/routes-manifest.js +74 -0
- package/dist/node/project/manifest/view-manifest.js +2 -2
- package/dist/node/project/project.d.ts +11 -2
- package/dist/node/project/project.js +49 -20
- package/dist/node/project/wp-info.d.ts +1 -0
- package/dist/node/project/wp-info.js +13 -3
- package/dist/node/types/block-type.d.ts +25 -20
- package/dist/node/types/block-type.js +1 -0
- package/dist/node/types/view-type.d.ts +7 -7
- package/dist/node/types/view-type.js +3 -4
- package/dist/node/utils/fetch-wp.d.ts +1 -0
- package/dist/node/utils/fetch-wp.js +27 -0
- package/dist/node/utils/fs-codegen.d.ts +42 -0
- package/dist/node/utils/fs-codegen.js +98 -0
- package/dist/node/utils/fs.js +2 -0
- package/dist/node/utils/{isDeploying.js → is-deploying.js} +1 -1
- package/dist/node/utils/{selfSignedCert.js → self-signed-cert.js} +1 -1
- package/dist/node/utils/{statefulLog.js → stateful-log.js} +3 -1
- package/dist/node/utils/watch-file-tree.d.ts +25 -0
- package/dist/node/utils/{watchFileTree.js → watch-file-tree.js} +12 -5
- package/package.json +40 -38
- package/types.app.d.ts +4 -2
- package/types.app.internal.d.ts +2 -2
- package/types.node.d.ts +3 -3
- package/dist/app/entry/Root.d.ts +0 -1
- package/dist/app/entry/Root.js +0 -9
- package/dist/app/entry/main.admin.d.ts +0 -3
- package/dist/app/entry/main.admin.js +0 -10
- package/dist/app/entry/main.frontend.spa.d.ts +0 -3
- package/dist/app/entry/main.frontend.spa.js +0 -13
- package/dist/app/entry/main.frontend.ssr.d.ts +0 -21
- package/dist/app/entry/main.frontend.ssr.js +0 -79
- package/dist/app/entry/main.serverless.dev.d.ts +0 -4
- package/dist/app/entry/main.serverless.dev.js +0 -21
- 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
- package/dist/app/server/create-api-builtin-hono.d.ts +0 -8
- package/dist/app/server/create-api-builtin-hono.js +0 -80
- package/dist/app/server/create-ssr-hono.d.ts +0 -18
- package/dist/app/server/create-ssr-hono.js +0 -104
- package/dist/app/server/utils/index.html.d.ts +0 -2
- package/dist/app/server/utils/index.html.js +0 -14
- package/dist/node/compiler/index.html.d.ts +0 -2
- package/dist/node/compiler/index.html.js +0 -15
- package/dist/node/compiler/serverless.dev.js +0 -215
- package/dist/node/compiler/vite/get-vite-config.d.ts +0 -13
- package/dist/node/compiler/vite/get-vite-config.js +0 -315
- package/dist/node/compiler/vite/plugin-admin.d.ts +0 -4
- package/dist/node/compiler/vite/plugin-admin.js +0 -67
- package/dist/node/compiler/vite/plugin-blocks.d.ts +0 -4
- package/dist/node/compiler/vite/plugin-blocks.js +0 -73
- package/dist/node/compiler/vite/plugin-entry.d.ts +0 -6
- package/dist/node/compiler/vite/plugin-entry.js +0 -16
- package/dist/node/compiler/vite/plugin-resolved-tailwind.d.ts +0 -4
- package/dist/node/compiler/vite/plugin-resolved-tailwind.js +0 -29
- package/dist/node/compiler/vite/plugin-theme.d.ts +0 -4
- package/dist/node/compiler/vite/plugin-theme.js +0 -40
- package/dist/node/compiler/vite/plugin-views.d.ts +0 -4
- package/dist/node/compiler/vite/plugin-views.js +0 -51
- package/dist/node/utils/console.d.ts +0 -21
- package/dist/node/utils/console.js +0 -28
- package/dist/node/utils/unsafe-fetch.d.ts +0 -2
- package/dist/node/utils/unsafe-fetch.js +0 -19
- package/dist/node/utils/watchFileTree.d.ts +0 -11
- package/tsup.config.ts +0 -40
- package/types.manifests.d.ts +0 -22
- /package/dist/node/utils/{formatZodError.d.ts → format-zod-error.d.ts} +0 -0
- /package/dist/node/utils/{formatZodError.js → format-zod-error.js} +0 -0
- /package/dist/node/utils/{getRepoInfo.d.ts → get-repo-info.d.ts} +0 -0
- /package/dist/node/utils/{getRepoInfo.js → get-repo-info.js} +0 -0
- /package/dist/node/utils/{highlightCode.d.ts → highlight-code.d.ts} +0 -0
- /package/dist/node/utils/{highlightCode.js → highlight-code.js} +0 -0
- /package/dist/node/utils/{isDeploying.d.ts → is-deploying.d.ts} +0 -0
- /package/dist/node/utils/{selfSignedCert.d.ts → self-signed-cert.d.ts} +0 -0
- /package/dist/node/utils/{statefulLog.d.ts → stateful-log.d.ts} +0 -0
- /package/dist/node/utils/{export-extractor.d.ts → ts-export-extractor.d.ts} +0 -0
- /package/dist/node/utils/{export-extractor.js → ts-export-extractor.js} +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ContentBlock } from "../blocks";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { RouteState } from "../routing";
|
|
4
|
+
export type ErrorEvent = {
|
|
5
|
+
/** The runtime error that occurred */
|
|
6
|
+
error: Error;
|
|
7
|
+
/** The Component stack (not available in renderBlockError) */
|
|
8
|
+
componentStack?: string;
|
|
9
|
+
} & ({
|
|
10
|
+
type: "block";
|
|
11
|
+
/** The block which had an error, including it's type information, props, content and children */
|
|
12
|
+
block: ContentBlock;
|
|
13
|
+
} | {
|
|
14
|
+
type: "route";
|
|
15
|
+
/** The route which had an error */
|
|
16
|
+
route: RouteState;
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Configuration options for manipulating how the client interacts with the GraphQL API
|
|
20
|
+
*/
|
|
21
|
+
export type ErrorHandlingConfig = {
|
|
22
|
+
/**
|
|
23
|
+
* Triggered when a runtime error occurs in a block
|
|
24
|
+
* @param event The error event, containing the error and block information
|
|
25
|
+
**/
|
|
26
|
+
onReactError?(event: ErrorEvent): void;
|
|
27
|
+
/**
|
|
28
|
+
* Triggered when a React rendering error occurs, and allows you to return some JSX to render as a fallback.
|
|
29
|
+
* If not provided, the block will be hidden from the user.
|
|
30
|
+
* @param error The error event, containing the error and contextual information
|
|
31
|
+
* @param defaultDisplay The default display for the block — in development, this will display the error message. In production, this will be `null`.
|
|
32
|
+
*/
|
|
33
|
+
renderFallback?(event: ErrorEvent, defaultDisplay: ReactNode): ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Update the error handling configuration all at once
|
|
36
|
+
*/
|
|
37
|
+
set: (config: Partial<ErrorHandlingConfig>) => void;
|
|
38
|
+
};
|
|
39
|
+
export declare const errorHandling: ErrorHandlingConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./defineView";
|
|
1
|
+
export * from "./defineView.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./defineView";
|
|
1
|
+
export * from "./defineView.js";
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/// <reference types="vinxi/types/server" />
|
|
2
|
+
import { splitSetCookieString } from "cookie-es";
|
|
3
|
+
import { getProxyRequestHeaders, getRequestURL, getWebRequest } from "vinxi/http";
|
|
4
|
+
import { ServerContext } from "./server-context.js";
|
|
5
|
+
import { renderErrorPage } from "./render-ssr-page.js";
|
|
6
|
+
export async function proxyWpAdmin(event) {
|
|
7
|
+
const serverContext = ServerContext.main;
|
|
8
|
+
const req = getWebRequest(event);
|
|
9
|
+
const reqUrl = getRequestURL(event);
|
|
10
|
+
const serverlessConfig = serverContext.config.serverless;
|
|
11
|
+
if (!serverContext.dev) {
|
|
12
|
+
if (reqUrl.pathname.toLowerCase().match(/\/+(graphql|xmlrpc|index\.php|wp\-(admin|login|json))/)) {
|
|
13
|
+
if (serverlessConfig.admin === "hide") {
|
|
14
|
+
return renderErrorPage({
|
|
15
|
+
code: 404,
|
|
16
|
+
pathname: reqUrl.pathname,
|
|
17
|
+
title: "Not Found",
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const proxyUrl = serverContext.getOriginUrl(reqUrl.href);
|
|
23
|
+
// Prepare request headers to be sent to the origin server
|
|
24
|
+
const proxyHeaders = getProxyRequestHeaders(event);
|
|
25
|
+
proxyHeaders["X-ED-Dev-Proxy"] = "true";
|
|
26
|
+
const followRedirects = !reqUrl.pathname.match(/\.[a-z0-9]$/);
|
|
27
|
+
// Forward the request to the origin server
|
|
28
|
+
const response = await fetch(proxyUrl, {
|
|
29
|
+
method: req.method,
|
|
30
|
+
referrer: req.referrer,
|
|
31
|
+
referrerPolicy: req.referrerPolicy,
|
|
32
|
+
headers: proxyHeaders,
|
|
33
|
+
body: req.method.match(/get|head|options/i) ? undefined : await req.blob(),
|
|
34
|
+
redirect: followRedirects ? "follow" : "manual",
|
|
35
|
+
cache: "no-cache",
|
|
36
|
+
});
|
|
37
|
+
const contentType = response.headers.get("content-type");
|
|
38
|
+
let body;
|
|
39
|
+
let res = { status: response.status, statusText: response.statusText, headers: new Headers() };
|
|
40
|
+
const cookies = [];
|
|
41
|
+
response.headers.forEach((value, key) => {
|
|
42
|
+
if (key === "content-encoding" || key === "content-length" || key === "transfer-encoding") {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (key === "set-cookie") {
|
|
46
|
+
cookies.push(...splitSetCookieString(value));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (key === "location") {
|
|
50
|
+
value = serverContext.replaceUrls(value);
|
|
51
|
+
}
|
|
52
|
+
res.headers.set(key, value);
|
|
53
|
+
});
|
|
54
|
+
// Set cookies in the response headers
|
|
55
|
+
// TODO: May need to rewrite cookie domain here before setting.
|
|
56
|
+
if (cookies.length > 0) {
|
|
57
|
+
for (const cookie of cookies) {
|
|
58
|
+
res.headers.append("set-cookie", cookie);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Replace URLs pointing to the origin server from the response itself
|
|
62
|
+
// This is only done for text-based content types, like application/json, text/plain, text/html etc
|
|
63
|
+
if (contentType?.match(/(application|text)\//)) {
|
|
64
|
+
body = serverContext.replaceUrls((await response.text()) ?? "", reqUrl.origin);
|
|
65
|
+
// If the content type is text/html, inject the Vite assets into the response — assuming the placeholder comments are found
|
|
66
|
+
if (contentType.startsWith("text/html")) {
|
|
67
|
+
const clientManifest = serverContext.runtime.getManifest("admin");
|
|
68
|
+
const assets = await clientManifest.inputs[clientManifest.handler].assets();
|
|
69
|
+
const getViteHeader = () => assets.map((asset) => renderAsset(asset)).join("\n");
|
|
70
|
+
const getViteFooter = () => renderAsset({
|
|
71
|
+
tag: "script",
|
|
72
|
+
attrs: {
|
|
73
|
+
type: "module",
|
|
74
|
+
src: clientManifest.inputs[clientManifest.handler].output.path,
|
|
75
|
+
},
|
|
76
|
+
children: "",
|
|
77
|
+
});
|
|
78
|
+
const encodeForJSON = (str) => JSON.stringify(str).slice(1, -1).replace(/\"/g, "'");
|
|
79
|
+
body = body.replace(/<!---VITE_HEADER--->/g, getViteHeader);
|
|
80
|
+
body = body.replace(/<!---VITE_FOOTER--->/g, getViteFooter);
|
|
81
|
+
body = body.replace(/<!---VITE_HEADER_ENCODED--->/g, encodeForJSON(getViteHeader()));
|
|
82
|
+
body = body.replace(/<!---VITE_FOOTER_ENCODED--->/g, encodeForJSON(getViteFooter()));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
// Otherwise just stream the response as is
|
|
87
|
+
body = response.body;
|
|
88
|
+
}
|
|
89
|
+
return new Response(body, res);
|
|
90
|
+
}
|
|
91
|
+
function printElement(element, props, innerText) {
|
|
92
|
+
if (typeof innerText === "string") {
|
|
93
|
+
return `<${element}${Object.entries(props)
|
|
94
|
+
.map(([key, value]) => ` ${key}="${value}"`)
|
|
95
|
+
.join("")}>${innerText}</${element}>`;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
return `<${element}${Object.entries(props)
|
|
99
|
+
.map(([key, value]) => ` ${key}="${value}"`)
|
|
100
|
+
.join("")} />`;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function renderAsset({ tag, attrs: { key, ...attrs } = {}, children, }) {
|
|
104
|
+
switch (tag) {
|
|
105
|
+
case "script":
|
|
106
|
+
if (attrs.src) {
|
|
107
|
+
return printElement("script", { ...attrs, key: attrs.src }, "");
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
return printElement("script", {
|
|
111
|
+
...attrs,
|
|
112
|
+
key: key,
|
|
113
|
+
}, children ?? "");
|
|
114
|
+
}
|
|
115
|
+
case "link":
|
|
116
|
+
return printElement("link", { ...attrs, key: key });
|
|
117
|
+
case "style":
|
|
118
|
+
return printElement("style", {
|
|
119
|
+
...attrs,
|
|
120
|
+
key: key,
|
|
121
|
+
}, children ?? "");
|
|
122
|
+
}
|
|
123
|
+
return "";
|
|
124
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RouteDataWithTrackers } from "../lib/routing/types.js";
|
|
2
|
+
type SSRArgs = {
|
|
3
|
+
pathname: string;
|
|
4
|
+
initialData: RouteDataWithTrackers;
|
|
5
|
+
};
|
|
6
|
+
export declare function getSsrStream(args: SSRArgs): Promise<ReadableStream<Uint8Array>>;
|
|
7
|
+
type RenderArgs = {
|
|
8
|
+
pathname: string;
|
|
9
|
+
statusCode?: number;
|
|
10
|
+
newOrigin?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function renderPage(args: RenderArgs): Promise<Response>;
|
|
13
|
+
type RenderErrorPageArgs = {
|
|
14
|
+
pathname: string;
|
|
15
|
+
code: number;
|
|
16
|
+
title: string;
|
|
17
|
+
newOrigin?: string;
|
|
18
|
+
realError?: Error;
|
|
19
|
+
};
|
|
20
|
+
export declare function renderErrorPage(args: RenderErrorPageArgs): Promise<Response>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { renderAsset } from "@vinxi/react";
|
|
3
|
+
import { renderToPipeableStream, renderToString } from "react-dom/server";
|
|
4
|
+
import { Writable } from "stream";
|
|
5
|
+
import { MetaTags } from "../entry/MetaTags.js";
|
|
6
|
+
import { SSRRoot } from "../entry/ssr-root.js";
|
|
7
|
+
import { RouteLoader } from "../lib/routing/loader.js";
|
|
8
|
+
import { AssetCaptureContext } from "../utils/asset-capture.js";
|
|
9
|
+
import { ServerContext } from "./server-context.js";
|
|
10
|
+
export async function getSsrStream(args) {
|
|
11
|
+
const clientManifest = ServerContext.main.runtime.getManifest("client");
|
|
12
|
+
const assets = await clientManifest.inputs[clientManifest.handler].assets();
|
|
13
|
+
// console.log(
|
|
14
|
+
// "M",
|
|
15
|
+
// assets.filter((f) => (f as any).tag === "script"),
|
|
16
|
+
// clientManifest.inputs[clientManifest.handler],
|
|
17
|
+
// )
|
|
18
|
+
// for (let k in clientManifest.chunks) {
|
|
19
|
+
// console.log(k)
|
|
20
|
+
// }
|
|
21
|
+
const dynamicAssets = new Set([]);
|
|
22
|
+
const jsx = (_jsx(AssetCaptureContext.Provider, { value: dynamicAssets, children: _jsx(SSRRoot, { metaTags: args.initialData?.meta?.head || [], pathname: args.pathname, initialData: args.initialData, loader: new RouteLoader() }) }));
|
|
23
|
+
const stream = await new Promise(async (resolve, reject) => {
|
|
24
|
+
// console.log("Rendering to pipable")
|
|
25
|
+
const stream = renderToPipeableStream(jsx, {
|
|
26
|
+
onShellReady() {
|
|
27
|
+
// console.log("Shell ready")
|
|
28
|
+
resolve(stream);
|
|
29
|
+
},
|
|
30
|
+
onShellError(err) {
|
|
31
|
+
console.log("onShellError", err);
|
|
32
|
+
reject(err);
|
|
33
|
+
},
|
|
34
|
+
onError(err, errInfo) {
|
|
35
|
+
console.log("Error occurred after shell ready", err, errInfo);
|
|
36
|
+
console.error(err);
|
|
37
|
+
},
|
|
38
|
+
bootstrapModules: [clientManifest.inputs[clientManifest.handler].output.path],
|
|
39
|
+
bootstrapScriptContent: `\nwindow.manifest = ${JSON.stringify(await clientManifest.json())};\nwindow._PAGE_DATA = ${JSON.stringify({
|
|
40
|
+
...args.initialData,
|
|
41
|
+
trackers: undefined,
|
|
42
|
+
})};\n`,
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
const [initial, middle, end] = renderToString(_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx(MetaTags, { tags: args.initialData.meta?.head ?? [] }), "%%trackers_head%%", assets.map((m) => renderAsset(m)), "%%$%%"] }), _jsxs("body", { children: ["%%trackers_body%%", _jsx("div", { id: "_root", children: "%%$%%" }), "%%trackers_footer%%"] })] }))
|
|
46
|
+
.replace(/%%trackers_(head|body|footer)%%/g, (_, name) => {
|
|
47
|
+
return args.initialData.trackers?.[name] || "";
|
|
48
|
+
})
|
|
49
|
+
.split("%%$%%");
|
|
50
|
+
return new ReadableStream({
|
|
51
|
+
async start(controller) {
|
|
52
|
+
controller.enqueue(new TextEncoder().encode(initial));
|
|
53
|
+
const inner = await new Promise((resolve, reject) => {
|
|
54
|
+
let buffer = [];
|
|
55
|
+
const writableStream = new Writable({
|
|
56
|
+
emitClose: true,
|
|
57
|
+
write(chunk, encoding, callback) {
|
|
58
|
+
buffer.push(chunk);
|
|
59
|
+
// controller.enqueue(chunk)
|
|
60
|
+
callback();
|
|
61
|
+
},
|
|
62
|
+
final(callback) {
|
|
63
|
+
resolve(buffer);
|
|
64
|
+
// controller.close()
|
|
65
|
+
callback();
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
stream.pipe(writableStream);
|
|
69
|
+
});
|
|
70
|
+
for (const asset of dynamicAssets) {
|
|
71
|
+
const assets = await clientManifest.inputs[asset].assets();
|
|
72
|
+
// console.log(assets)
|
|
73
|
+
// console.log("A", assets.output, (await assets.assets())?.[0])
|
|
74
|
+
// const assets = await clientManifest.inputs[assets.output.path!]?.assets()
|
|
75
|
+
// console.log("F?", inputs)
|
|
76
|
+
controller.enqueue(new TextEncoder().encode(`\n<!-- for ${asset} -->`));
|
|
77
|
+
controller.enqueue(new TextEncoder().encode(`\n<!-- ${JSON.stringify(assets)} -->`));
|
|
78
|
+
// controller.enqueue(new TextEncoder().encode(`\n<script>${JSON.stringify(assets)}</script>`))
|
|
79
|
+
controller.enqueue(new TextEncoder().encode(renderToString(_jsx(_Fragment, { children: assets.map((a) => renderAsset(asset)) }))));
|
|
80
|
+
}
|
|
81
|
+
// console.log("ASSETS", await clientManifest)
|
|
82
|
+
controller.enqueue(new TextEncoder().encode(middle));
|
|
83
|
+
for (const chunk of inner) {
|
|
84
|
+
controller.enqueue(chunk);
|
|
85
|
+
}
|
|
86
|
+
controller.enqueue(new TextEncoder().encode(end));
|
|
87
|
+
// console.log("Assets", dynamicAssets)
|
|
88
|
+
controller.close();
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export async function renderPage(args) {
|
|
93
|
+
const serverContext = ServerContext.main;
|
|
94
|
+
let headers = new Headers();
|
|
95
|
+
let responseInit = {
|
|
96
|
+
headers,
|
|
97
|
+
};
|
|
98
|
+
try {
|
|
99
|
+
const [{ appData, trackers }, response] = await Promise.all([
|
|
100
|
+
serverContext.fetchAppData(),
|
|
101
|
+
serverContext.fetchRouteData({
|
|
102
|
+
pathname: args.pathname,
|
|
103
|
+
newOrigin: args.newOrigin,
|
|
104
|
+
}),
|
|
105
|
+
]);
|
|
106
|
+
let data;
|
|
107
|
+
try {
|
|
108
|
+
data = await response.json();
|
|
109
|
+
data.appData = appData;
|
|
110
|
+
data.trackers = trackers;
|
|
111
|
+
responseInit.status = response.status;
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
console.error(err);
|
|
115
|
+
return renderErrorPage({
|
|
116
|
+
pathname: args.pathname,
|
|
117
|
+
code: 500,
|
|
118
|
+
newOrigin: args.newOrigin,
|
|
119
|
+
realError: err,
|
|
120
|
+
title: "Internal Server Error",
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (data.redirect) {
|
|
124
|
+
return new Response(null, {
|
|
125
|
+
status: data.status || 302,
|
|
126
|
+
headers: {
|
|
127
|
+
Location: data.redirect,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
headers.set("Content-Type", "text/html; charset=utf-8");
|
|
132
|
+
const stream = await getSsrStream({
|
|
133
|
+
...args,
|
|
134
|
+
initialData: data,
|
|
135
|
+
});
|
|
136
|
+
return new Response(stream, responseInit);
|
|
137
|
+
}
|
|
138
|
+
catch (err) {
|
|
139
|
+
console.error(err);
|
|
140
|
+
if (args.statusCode !== 500) {
|
|
141
|
+
return renderErrorPage({
|
|
142
|
+
pathname: args.pathname,
|
|
143
|
+
code: 500,
|
|
144
|
+
newOrigin: args.newOrigin,
|
|
145
|
+
realError: err,
|
|
146
|
+
title: "Internal Server Error",
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return new Response('<!DOCTYPE html><html><head><title>500 Internal Server Error</title></head><body><h1>500 Internal Server Error</h1><p>"' +
|
|
150
|
+
String(err) +
|
|
151
|
+
'"</p></body></html>', {
|
|
152
|
+
status: 500,
|
|
153
|
+
statusText: "Internal Server Error",
|
|
154
|
+
headers: {
|
|
155
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
export async function renderErrorPage(args) {
|
|
161
|
+
return renderPage({
|
|
162
|
+
pathname: "/_error",
|
|
163
|
+
statusCode: args.code,
|
|
164
|
+
newOrigin: args.newOrigin,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { AnyProcedure } from "@trpc/server";
|
|
2
|
+
import { FetchCreateContextFnOptions } from "@trpc/server/adapters/fetch";
|
|
3
|
+
export declare const rpcApi: {
|
|
4
|
+
_config: import("@trpc/server/unstable-core-do-not-import").RootConfig<{
|
|
5
|
+
ctx: RPCContext;
|
|
6
|
+
meta: object;
|
|
7
|
+
errorShape: import("@trpc/server/unstable-core-do-not-import").DefaultErrorShape;
|
|
8
|
+
transformer: true;
|
|
9
|
+
}>;
|
|
10
|
+
procedure: import("@trpc/server/unstable-core-do-not-import").ProcedureBuilder<RPCContext, object, object, typeof import("@trpc/server/unstable-core-do-not-import").unsetMarker, typeof import("@trpc/server/unstable-core-do-not-import").unsetMarker, typeof import("@trpc/server/unstable-core-do-not-import").unsetMarker, typeof import("@trpc/server/unstable-core-do-not-import").unsetMarker, false>;
|
|
11
|
+
middleware: <$ContextOverrides>(fn: import("@trpc/server/unstable-core-do-not-import").MiddlewareFunction<RPCContext, object, object, $ContextOverrides, unknown>) => import("@trpc/server/unstable-core-do-not-import").MiddlewareBuilder<RPCContext, object, $ContextOverrides, unknown>;
|
|
12
|
+
router: {
|
|
13
|
+
<TInput extends import("@trpc/server").RouterRecord>(input: TInput): import("@trpc/server/unstable-core-do-not-import").BuiltRouter<{
|
|
14
|
+
ctx: RPCContext;
|
|
15
|
+
meta: object;
|
|
16
|
+
errorShape: import("@trpc/server/unstable-core-do-not-import").DefaultErrorShape;
|
|
17
|
+
transformer: true;
|
|
18
|
+
}, TInput>;
|
|
19
|
+
<TInput extends import("@trpc/server/unstable-core-do-not-import").CreateRouterOptions>(input: TInput): import("@trpc/server/unstable-core-do-not-import").BuiltRouter<{
|
|
20
|
+
ctx: RPCContext;
|
|
21
|
+
meta: object;
|
|
22
|
+
errorShape: import("@trpc/server/unstable-core-do-not-import").DefaultErrorShape;
|
|
23
|
+
transformer: true;
|
|
24
|
+
}, import("@trpc/server/unstable-core-do-not-import").DecorateCreateRouterOptions<TInput>>;
|
|
25
|
+
};
|
|
26
|
+
mergeRouters: typeof import("@trpc/server/unstable-core-do-not-import").mergeRouters;
|
|
27
|
+
createCallerFactory: <TRecord extends import("@trpc/server").RouterRecord>(router: Pick<import("@trpc/server/unstable-core-do-not-import").Router<{
|
|
28
|
+
ctx: RPCContext;
|
|
29
|
+
meta: object;
|
|
30
|
+
errorShape: import("@trpc/server/unstable-core-do-not-import").DefaultErrorShape;
|
|
31
|
+
transformer: true;
|
|
32
|
+
}, TRecord>, "_def">) => import("@trpc/server/unstable-core-do-not-import").RouterCaller<{
|
|
33
|
+
ctx: RPCContext;
|
|
34
|
+
meta: object;
|
|
35
|
+
errorShape: import("@trpc/server/unstable-core-do-not-import").DefaultErrorShape;
|
|
36
|
+
transformer: true;
|
|
37
|
+
}, TRecord>;
|
|
38
|
+
};
|
|
39
|
+
type RouterSchema = Record<string, Record<string, AnyProcedure> | AnyProcedure>;
|
|
40
|
+
export declare const rpc: {
|
|
41
|
+
middleware: <$ContextOverrides>(fn: import("@trpc/server/unstable-core-do-not-import").MiddlewareFunction<RPCContext, object, object, $ContextOverrides, unknown>) => import("@trpc/server/unstable-core-do-not-import").MiddlewareBuilder<RPCContext, object, $ContextOverrides, unknown>;
|
|
42
|
+
procedure: import("@trpc/server/unstable-core-do-not-import").ProcedureBuilder<RPCContext, object, object, typeof import("@trpc/server/unstable-core-do-not-import").unsetMarker, typeof import("@trpc/server/unstable-core-do-not-import").unsetMarker, typeof import("@trpc/server/unstable-core-do-not-import").unsetMarker, typeof import("@trpc/server/unstable-core-do-not-import").unsetMarker, false>;
|
|
43
|
+
router<T extends RouterSchema>(routes: T): T;
|
|
44
|
+
};
|
|
45
|
+
export declare function defineServerContext<T>(func: (opts: FetchCreateContextFnOptions) => T): (opts: FetchCreateContextFnOptions) => T;
|
|
46
|
+
export declare function instantiateRouter<T extends RouterSchema>(routes: T): import("@trpc/server/unstable-core-do-not-import").BuiltRouter<{
|
|
47
|
+
ctx: RPCContext;
|
|
48
|
+
meta: object;
|
|
49
|
+
errorShape: import("@trpc/server/unstable-core-do-not-import").DefaultErrorShape;
|
|
50
|
+
transformer: true;
|
|
51
|
+
}, T>;
|
|
52
|
+
export type InferRPCServerContext<TFunc extends null | ((opts: FetchCreateContextFnOptions) => any)> = {
|
|
53
|
+
req: Request;
|
|
54
|
+
resHeaders: Headers;
|
|
55
|
+
} & (TFunc extends (opts: FetchCreateContextFnOptions) => infer T ? T : {});
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { initTRPC } from "@trpc/server";
|
|
2
|
+
import superjson from "superjson";
|
|
3
|
+
export const rpcApi = initTRPC.context().create({
|
|
4
|
+
transformer: superjson,
|
|
5
|
+
});
|
|
6
|
+
export const rpc = {
|
|
7
|
+
middleware: rpcApi.middleware,
|
|
8
|
+
procedure: rpcApi.procedure,
|
|
9
|
+
router(routes) {
|
|
10
|
+
return routes;
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
export function defineServerContext(func) {
|
|
14
|
+
return func;
|
|
15
|
+
}
|
|
16
|
+
export function instantiateRouter(routes) {
|
|
17
|
+
return rpcApi.router(routes);
|
|
18
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Manifest } from "vinxi/dist/types/types/manifest";
|
|
2
|
+
import { RequestHeaders } from "vinxi/http";
|
|
3
|
+
import type { EDConfig } from "../../node/project/config.js";
|
|
4
|
+
import { TrackerTags } from "../lib/routing/types.js";
|
|
5
|
+
import { UrlReplacerConf } from "./utils/replace-host.js";
|
|
6
|
+
export type ServerContextArgs = {
|
|
7
|
+
dev: boolean;
|
|
8
|
+
origin: string;
|
|
9
|
+
replaceUrls?: UrlReplacerConf;
|
|
10
|
+
rpcBases?: string[];
|
|
11
|
+
config: EDConfig;
|
|
12
|
+
};
|
|
13
|
+
export type ServerContextRuntime = {
|
|
14
|
+
getManifest: (name: string) => Manifest;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Data returned from WordPress origin /_appdata route
|
|
18
|
+
*/
|
|
19
|
+
type ServerAppData = {
|
|
20
|
+
appData: any;
|
|
21
|
+
trackers: TrackerTags;
|
|
22
|
+
};
|
|
23
|
+
export declare class ServerContext {
|
|
24
|
+
dev: boolean;
|
|
25
|
+
origin: string;
|
|
26
|
+
_urlReplacer?: (text: string, origin?: string) => string;
|
|
27
|
+
rpcBases: string[];
|
|
28
|
+
config: EDConfig;
|
|
29
|
+
static main: ServerContext;
|
|
30
|
+
constructor(conf: ServerContextArgs);
|
|
31
|
+
replaceUrls(text: string, origin?: string): string;
|
|
32
|
+
get runtime(): ServerContextRuntime;
|
|
33
|
+
static setRuntime(rt: ServerContextRuntime): void;
|
|
34
|
+
getOriginUrl(url: string): string;
|
|
35
|
+
fetchOrigin(url: string, opts?: RequestInit & {
|
|
36
|
+
replaceUrls?: boolean;
|
|
37
|
+
newOrigin?: string;
|
|
38
|
+
}): Promise<Response>;
|
|
39
|
+
fetchRouteData(req: {
|
|
40
|
+
pathname: string;
|
|
41
|
+
headers?: RequestHeaders;
|
|
42
|
+
newOrigin?: string;
|
|
43
|
+
}): Promise<Response>;
|
|
44
|
+
fetchAppData(): Promise<ServerAppData>;
|
|
45
|
+
extractRequestHeaders(req?: RequestHeaders): Partial<Record<import("vinxi/http").HTTPHeaderName, string | undefined>>;
|
|
46
|
+
fetchNamedQuery(req: {
|
|
47
|
+
name: string;
|
|
48
|
+
params: object;
|
|
49
|
+
headers: RequestHeaders;
|
|
50
|
+
}): Promise<Response>;
|
|
51
|
+
fetchMutation(req: {
|
|
52
|
+
name: string;
|
|
53
|
+
body: object;
|
|
54
|
+
headers: RequestHeaders;
|
|
55
|
+
}): Promise<Response>;
|
|
56
|
+
get allowedCorsOrigins(): string[];
|
|
57
|
+
getCorsOrigin(originHeader: string): string | undefined;
|
|
58
|
+
getCorsHeaders(origin: string): {
|
|
59
|
+
"Access-Control-Allow-Methods"?: undefined;
|
|
60
|
+
"Access-Control-Allow-Origin"?: undefined;
|
|
61
|
+
"Access-Control-Allow-Credentials"?: undefined;
|
|
62
|
+
"Access-Control-Allow-Headers"?: undefined;
|
|
63
|
+
"Access-Control-Expose-Headers"?: undefined;
|
|
64
|
+
} | {
|
|
65
|
+
"Access-Control-Allow-Methods": string;
|
|
66
|
+
"Access-Control-Allow-Origin": string;
|
|
67
|
+
"Access-Control-Allow-Credentials": string;
|
|
68
|
+
"Access-Control-Allow-Headers": string;
|
|
69
|
+
"Access-Control-Expose-Headers": string;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export {};
|