eddev 2.0.0-beta.9 → 2.0.0-beta.91
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.js +11 -6
- 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.js +4 -5
- package/dist/app/entry/ssr-root-client.d.ts +3 -1
- package/dist/app/entry/ssr-root-client.js +24 -8
- package/dist/app/entry/ssr-root.d.ts +5 -4
- package/dist/app/entry/ssr-root.js +21 -20
- 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/ErrorBoundaryEditor.d.ts +1 -1
- 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 +1 -1
- 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/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 +1014 -1014
- package/dist/app/lib/devtools/hooks/useTailwind.js +1 -1
- package/dist/app/lib/devtools/index.d.ts +1 -1
- 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 +37 -3
- package/dist/app/lib/hooks/queryUtils.js +66 -26
- 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/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.d.ts +1 -1
- 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 +20 -11
- 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 -3
- package/dist/app/server/index.js +5 -3
- package/dist/app/server/proxy-wp-admin.d.ts +1 -2
- package/dist/app/server/proxy-wp-admin.js +32 -14
- package/dist/app/server/render-ssr-page.d.ts +21 -2
- package/dist/app/server/render-ssr-page.js +143 -11
- 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 +42 -4
- package/dist/app/server/server-context.js +196 -30
- package/dist/app/server/utils/replace-host.d.ts +1 -1
- package/dist/app/server/utils/replace-host.js +10 -2
- 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.js +10 -5
- package/dist/node/cli/cli.js +79 -11
- package/dist/node/cli/display/CLIApp.js +3 -6
- package/dist/node/cli/display/boot-cli-app.js +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/version.d.ts +1 -1
- package/dist/node/cli/version.js +1 -1
- package/dist/node/compiler/build-vinxi.js +3 -1
- package/dist/node/compiler/bundler.admin.d.ts +1 -1
- package/dist/node/compiler/bundler.admin.js +1 -1
- package/dist/node/compiler/bundler.frontend.js +1 -1
- package/dist/node/compiler/dev-server.js +10 -0
- package/dist/node/compiler/get-vite-config.d.ts +1 -0
- package/dist/node/compiler/get-vite-config.js +34 -11
- package/dist/node/compiler/vinxi-app.d.ts +12 -0
- package/dist/node/compiler/vinxi-app.js +139 -32
- package/dist/node/compiler/vinxi-codegen.js +321 -108
- package/dist/node/graphql/graphql-codegen.d.ts +11 -1
- package/dist/node/graphql/graphql-codegen.js +210 -33
- package/dist/node/graphql/graphql-schema-loader.d.ts +2 -1
- package/dist/node/graphql/graphql-schema-loader.js +5 -16
- 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 +69 -20
- package/dist/node/project/env.d.ts +4 -0
- package/dist/node/project/env.js +1 -0
- package/dist/node/project/manifest/block-manifest.js +1 -0
- package/dist/node/project/manifest/manifest.d.ts +1 -0
- package/dist/node/project/manifest/manifest.js +14 -10
- 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 +1 -1
- package/dist/node/project/project.d.ts +9 -1
- package/dist/node/project/project.js +37 -6
- package/dist/node/project/wp-info.d.ts +1 -0
- package/dist/node/project/wp-info.js +13 -1
- 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/utils/fetch-wp.d.ts +1 -0
- package/dist/node/utils/fetch-wp.js +27 -0
- package/dist/node/utils/fs-codegen.d.ts +2 -0
- package/dist/node/utils/fs-codegen.js +2 -1
- package/dist/node/utils/is-deploying.js +1 -1
- package/dist/node/utils/stateful-log.js +2 -0
- package/dist/node/utils/watch-file-tree.d.ts +17 -3
- package/dist/node/utils/watch-file-tree.js +12 -5
- package/package.json +17 -13
- 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/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/utils/index.html.d.ts +0 -2
- package/dist/app/server/utils/index.html.js +0 -14
|
@@ -25,18 +25,22 @@ export class DevServer {
|
|
|
25
25
|
}
|
|
26
26
|
async start() {
|
|
27
27
|
console.setWorking(true);
|
|
28
|
+
// console.log("Setting up vinxi codegen")
|
|
28
29
|
const codegen = createVinxiCodegen({
|
|
29
30
|
mode: "development",
|
|
30
31
|
project: this.project,
|
|
31
32
|
serverless: true,
|
|
32
33
|
});
|
|
33
34
|
await codegen.runAndWatch();
|
|
35
|
+
// console.log("Has run once")
|
|
34
36
|
const app = createVinxiApp({
|
|
35
37
|
mode: "development",
|
|
36
38
|
origin: this.origin,
|
|
37
39
|
publicUrl: this.project.publicUrl,
|
|
38
40
|
rootDir: this.project.rootDir,
|
|
39
41
|
log: console,
|
|
42
|
+
rpcBases: (await this.project.serverRoutes.get()).bases,
|
|
43
|
+
config: this.project.config,
|
|
40
44
|
});
|
|
41
45
|
const preset = process.env.TARGET ??
|
|
42
46
|
process.env.PRESET ??
|
|
@@ -45,7 +49,9 @@ export class DevServer {
|
|
|
45
49
|
process.env.NITRO_PRESET ??
|
|
46
50
|
process.env.NITRO_TARGET ??
|
|
47
51
|
(process.versions.bun !== undefined ? "bun" : "node-server");
|
|
52
|
+
// console.log("Ensuring self signed cert")
|
|
48
53
|
const keys = await ensureSelfSignedCert(this.hostname, this.project.rootDir);
|
|
54
|
+
// console.log("Done")
|
|
49
55
|
const httpsConfig = {
|
|
50
56
|
cert: keys.certFile,
|
|
51
57
|
key: keys.keyFile,
|
|
@@ -61,6 +67,7 @@ export class DevServer {
|
|
|
61
67
|
devApp = args.devApp;
|
|
62
68
|
},
|
|
63
69
|
});
|
|
70
|
+
// console.log("Creating dev server")
|
|
64
71
|
await createDevServer(app, {
|
|
65
72
|
force: false,
|
|
66
73
|
devtools: false,
|
|
@@ -71,11 +78,13 @@ export class DevServer {
|
|
|
71
78
|
preset: preset,
|
|
72
79
|
https: httpsConfig,
|
|
73
80
|
});
|
|
81
|
+
// console.log("Rnning listen hook")
|
|
74
82
|
// @ts-ignore
|
|
75
83
|
await app.hooks.callHook("app:dev:server:listener:creating", {
|
|
76
84
|
app,
|
|
77
85
|
devApp,
|
|
78
86
|
});
|
|
87
|
+
// console.log("Creating another listener")
|
|
79
88
|
const listener = await devApp.listen(this.port, {
|
|
80
89
|
hostname: this.hostname,
|
|
81
90
|
port: this.port,
|
|
@@ -88,6 +97,7 @@ export class DevServer {
|
|
|
88
97
|
devApp,
|
|
89
98
|
listener,
|
|
90
99
|
});
|
|
100
|
+
// console.log("Listening")
|
|
91
101
|
console.setWorking(false);
|
|
92
102
|
console.setState({
|
|
93
103
|
serverlessUrl: this.hostOrigin,
|
|
@@ -8,14 +8,14 @@ import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
8
8
|
import { cliMode } from "../cli/cli-mode.js";
|
|
9
9
|
export function envPlugin(args) {
|
|
10
10
|
const envDefines = {
|
|
11
|
-
client: args.
|
|
11
|
+
client: args.client ? "true" : "false",
|
|
12
12
|
serverless: args.serverless ? "true" : "false",
|
|
13
13
|
dev: args.mode === "development" ? "true" : "false",
|
|
14
14
|
admin: args.target === "cms" ? "true" : "false",
|
|
15
15
|
themePath: JSON.stringify(args.publicUrl),
|
|
16
16
|
devUI: args.mode === "development" ? "true" : "false",
|
|
17
17
|
serverlessOrigin: JSON.stringify("http://serverleress-endpoint"),
|
|
18
|
-
rpcEnabled: "
|
|
18
|
+
rpcEnabled: "true",
|
|
19
19
|
origin: JSON.stringify(process.env.SITE_URL ?? "/"),
|
|
20
20
|
};
|
|
21
21
|
const expandDefines = (obj, prefixes = []) => {
|
|
@@ -28,7 +28,9 @@ export function envPlugin(args) {
|
|
|
28
28
|
return result;
|
|
29
29
|
};
|
|
30
30
|
return replace({
|
|
31
|
-
values:
|
|
31
|
+
values: {
|
|
32
|
+
...expandDefines(envDefines, ["process.env.", "process.", "env."]),
|
|
33
|
+
},
|
|
32
34
|
preventAssignment: true,
|
|
33
35
|
});
|
|
34
36
|
}
|
|
@@ -85,8 +87,34 @@ export function ssrPlugin() {
|
|
|
85
87
|
name: "proxy-external-ssr-modules",
|
|
86
88
|
config(config) {
|
|
87
89
|
config.legacy = {
|
|
90
|
+
...config.legacy,
|
|
88
91
|
proxySsrExternalModules: true,
|
|
89
92
|
};
|
|
93
|
+
config.ssr = {
|
|
94
|
+
...config.ssr,
|
|
95
|
+
noExternal: [
|
|
96
|
+
"eddev",
|
|
97
|
+
"vinxi",
|
|
98
|
+
"react-use",
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
...(config?.optimizeDeps?.noExternal ?? []),
|
|
101
|
+
],
|
|
102
|
+
optimizeDeps: {
|
|
103
|
+
exclude: ["eddev", "vinxi"],
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
config.optimizeDeps = {
|
|
107
|
+
...config.optimizeDeps,
|
|
108
|
+
include: [
|
|
109
|
+
"valtio",
|
|
110
|
+
"@tanstack/react-query",
|
|
111
|
+
"qs",
|
|
112
|
+
"react",
|
|
113
|
+
"react-dom/client",
|
|
114
|
+
...(config?.optimizeDeps?.include ?? []),
|
|
115
|
+
],
|
|
116
|
+
exclude: ["eddev", "vinxi", ...(config?.optimizeDeps?.exclude ?? [])],
|
|
117
|
+
};
|
|
90
118
|
return config;
|
|
91
119
|
},
|
|
92
120
|
};
|
|
@@ -113,12 +141,7 @@ function buildStatusPlugin(console) {
|
|
|
113
141
|
};
|
|
114
142
|
}
|
|
115
143
|
export function corePlugins(args) {
|
|
116
|
-
return [
|
|
117
|
-
tsconfigPaths(),
|
|
118
|
-
reactPlugin(),
|
|
119
|
-
args.mode === "development" && args.serverless && ssrPlugin(),
|
|
120
|
-
envPlugin(args),
|
|
121
|
-
].flat();
|
|
144
|
+
return [args.serverless && ssrPlugin(), envPlugin(args), tsconfigPaths(), reactPlugin()].flat();
|
|
122
145
|
}
|
|
123
146
|
export function getViteConfig(args) {
|
|
124
147
|
const console = args.console;
|
|
@@ -152,9 +175,9 @@ export function getViteConfig(args) {
|
|
|
152
175
|
minify: args.mode === "production",
|
|
153
176
|
modulePreload: false,
|
|
154
177
|
outDir: args.outDir,
|
|
155
|
-
watch: {},
|
|
178
|
+
// watch: {},
|
|
156
179
|
rollupOptions: {
|
|
157
|
-
input:
|
|
180
|
+
input: `./.eddev/${args.mode === "production" ? "prod" : "dev"}-spa/entry.${args.target === "cms" ? "admin" : "client"}.tsx`,
|
|
158
181
|
external: args.target === "cms" ? ["react", "react-dom"] : [],
|
|
159
182
|
onwarn(warning, warn) {
|
|
160
183
|
if (!cliMode.verbose &&
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StatefulLog } from "../utils/stateful-log.js";
|
|
2
|
+
import { EDConfig } from "../project/config.js";
|
|
2
3
|
export type AppArgs = {
|
|
3
4
|
mode: "development" | "production";
|
|
4
5
|
publicUrl: string;
|
|
@@ -6,5 +7,16 @@ export type AppArgs = {
|
|
|
6
7
|
origin: string;
|
|
7
8
|
log?: StatefulLog<any>;
|
|
8
9
|
preset?: string;
|
|
10
|
+
routes?: CustomRoute[];
|
|
11
|
+
rpcBases?: string[];
|
|
12
|
+
config: EDConfig;
|
|
13
|
+
};
|
|
14
|
+
type HTTPMethod = "GET" | "POST" | "PUT" | "OPTIONS" | "HEAD";
|
|
15
|
+
type CustomRouteFunction = (req: Request) => Response;
|
|
16
|
+
type CustomRouteModule = Record<HTTPMethod, CustomRouteFunction>;
|
|
17
|
+
type CustomRoute = {
|
|
18
|
+
pattern: string;
|
|
19
|
+
handler: () => Promise<CustomRouteModule>;
|
|
9
20
|
};
|
|
10
21
|
export declare function createVinxiApp(args: AppArgs): import("vinxi").App;
|
|
22
|
+
export {};
|
|
@@ -18,53 +18,140 @@ export function createVinxiApp(args) {
|
|
|
18
18
|
// },
|
|
19
19
|
preset: args.preset,
|
|
20
20
|
routeRules: {
|
|
21
|
+
"/wp-content/uploads/**": {
|
|
22
|
+
proxy: joinURL(args.origin, "wp-content/uploads/**"),
|
|
23
|
+
static: true,
|
|
24
|
+
cache: {
|
|
25
|
+
maxAge: 86400,
|
|
26
|
+
varies: [],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
"/favicon.ico": {
|
|
30
|
+
proxy: joinURL(args.origin, "favicon.ico"),
|
|
31
|
+
static: true,
|
|
32
|
+
cache: {
|
|
33
|
+
maxAge: 3600,
|
|
34
|
+
varies: [],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
"/robots.txt": {
|
|
38
|
+
cache: {
|
|
39
|
+
maxAge: 3600,
|
|
40
|
+
varies: [],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
"/sitemap.xml": {
|
|
44
|
+
cache: {
|
|
45
|
+
maxAge: 3600,
|
|
46
|
+
swr: true,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
"/sitemap*.xml": {
|
|
50
|
+
cache: {
|
|
51
|
+
maxAge: 3600,
|
|
52
|
+
swr: true,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
"/wp-content/plugins/**": {
|
|
56
|
+
proxy: joinURL(args.origin, "wp-content/plugins/**"),
|
|
57
|
+
headers: {
|
|
58
|
+
"Cache-Control": "max-age=86400",
|
|
59
|
+
"CDN-Cache-Control": "max-age=86400",
|
|
60
|
+
"Vercel-CDN-Cache-Control": "max-age=86400",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
21
63
|
"/wp-content/**": { proxy: joinURL(args.origin, "wp-content/**") },
|
|
22
64
|
"/wp-includes/**": { proxy: joinURL(args.origin, "wp-includes/**") },
|
|
65
|
+
"/_data/route/**": {
|
|
66
|
+
isr: 300,
|
|
67
|
+
swr: true,
|
|
68
|
+
cache: {
|
|
69
|
+
maxAge: 300,
|
|
70
|
+
swr: true,
|
|
71
|
+
varies: ["Authorization", "woocommerce-session"],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
"/_data/query/**": {
|
|
75
|
+
isr: false,
|
|
76
|
+
cache: {
|
|
77
|
+
maxAge: 300,
|
|
78
|
+
varies: ["Authorization", "woocommerce-session"],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
...args.rpcBases?.reduce((acc, base) => {
|
|
82
|
+
return {
|
|
83
|
+
...acc,
|
|
84
|
+
["/" + base.replace(/(^\/|\/$)/g, "") + "/**/*"]: {
|
|
85
|
+
isr: false,
|
|
86
|
+
swr: false,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}, {}),
|
|
90
|
+
"/**/*": {
|
|
91
|
+
isr: 300,
|
|
92
|
+
swr: true,
|
|
93
|
+
cache: {
|
|
94
|
+
maxAge: 300,
|
|
95
|
+
swr: true,
|
|
96
|
+
staleMaxAge: 3600,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
vercel: {
|
|
101
|
+
config: {
|
|
102
|
+
bypassToken: process.env.VERCEL_BYPASS_TOKEN,
|
|
103
|
+
},
|
|
23
104
|
},
|
|
24
105
|
},
|
|
25
106
|
routers: [
|
|
107
|
+
...args.config.serverless.themeAssets.map((folder) => {
|
|
108
|
+
const folderName = folder
|
|
109
|
+
.split("/")
|
|
110
|
+
.filter((p) => !p.includes("*") && p !== ".")
|
|
111
|
+
.join("/");
|
|
112
|
+
return {
|
|
113
|
+
name: "public_" + folderName,
|
|
114
|
+
type: "static",
|
|
115
|
+
dir: "./" + folderName,
|
|
116
|
+
base: joinURL(args.publicUrl, folderName),
|
|
117
|
+
};
|
|
118
|
+
}),
|
|
26
119
|
{
|
|
27
|
-
name: "
|
|
28
|
-
type: "static",
|
|
29
|
-
dir: "./assets",
|
|
30
|
-
base: joinURL(args.publicUrl, "assets"),
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "data-api",
|
|
34
|
-
type: "http",
|
|
35
|
-
base: "/_data/",
|
|
36
|
-
handler: `${folder}/handler.data-api.ts`,
|
|
37
|
-
target: "server",
|
|
38
|
-
plugins: () => [
|
|
39
|
-
tsconfigPaths(),
|
|
40
|
-
envPlugin({
|
|
41
|
-
rootDir: args.rootDir,
|
|
42
|
-
console: log,
|
|
43
|
-
mode: "development",
|
|
44
|
-
publicUrl: args.publicUrl,
|
|
45
|
-
serverless: true,
|
|
46
|
-
target: "frontend",
|
|
47
|
-
}),
|
|
48
|
-
],
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: "wp-proxy",
|
|
120
|
+
name: "bypass-api",
|
|
52
121
|
type: "http",
|
|
53
|
-
base: "/
|
|
54
|
-
handler: `${folder}/handler.
|
|
122
|
+
base: "/_bypass/",
|
|
123
|
+
handler: `${folder}/handler.bypass.ts`,
|
|
55
124
|
target: "server",
|
|
56
125
|
plugins: () => [
|
|
57
126
|
tsconfigPaths(),
|
|
58
127
|
envPlugin({
|
|
59
128
|
rootDir: args.rootDir,
|
|
60
129
|
console: log,
|
|
61
|
-
mode:
|
|
130
|
+
mode: args.mode,
|
|
62
131
|
publicUrl: args.publicUrl,
|
|
63
132
|
serverless: true,
|
|
64
133
|
target: "frontend",
|
|
134
|
+
client: false,
|
|
65
135
|
}),
|
|
66
136
|
],
|
|
67
137
|
},
|
|
138
|
+
// {
|
|
139
|
+
// name: "wp-proxy",
|
|
140
|
+
// type: "http",
|
|
141
|
+
// base: "/wp-",
|
|
142
|
+
// handler: `${folder}/handler.wp-proxy.ts`,
|
|
143
|
+
// target: "server",
|
|
144
|
+
// plugins: () => [
|
|
145
|
+
// ...corePlugins({
|
|
146
|
+
// rootDir: args.rootDir,
|
|
147
|
+
// console: log,
|
|
148
|
+
// mode: args.mode,
|
|
149
|
+
// publicUrl: args.publicUrl,
|
|
150
|
+
// serverless: true,
|
|
151
|
+
// target: "frontend",
|
|
152
|
+
// }),
|
|
153
|
+
// ],
|
|
154
|
+
// },
|
|
68
155
|
{
|
|
69
156
|
name: "client",
|
|
70
157
|
type: "client",
|
|
@@ -74,10 +161,11 @@ export function createVinxiApp(args) {
|
|
|
74
161
|
...corePlugins({
|
|
75
162
|
rootDir: args.rootDir,
|
|
76
163
|
console: log,
|
|
77
|
-
mode:
|
|
164
|
+
mode: args.mode,
|
|
78
165
|
publicUrl: args.publicUrl,
|
|
79
166
|
serverless: true,
|
|
80
167
|
target: "frontend",
|
|
168
|
+
client: true,
|
|
81
169
|
}),
|
|
82
170
|
],
|
|
83
171
|
base: "/_build",
|
|
@@ -91,28 +179,47 @@ export function createVinxiApp(args) {
|
|
|
91
179
|
...corePlugins({
|
|
92
180
|
rootDir: args.rootDir,
|
|
93
181
|
console: log,
|
|
94
|
-
mode:
|
|
182
|
+
mode: args.mode,
|
|
95
183
|
publicUrl: args.publicUrl,
|
|
96
184
|
serverless: true,
|
|
97
185
|
target: "cms",
|
|
186
|
+
client: true,
|
|
98
187
|
}),
|
|
99
188
|
],
|
|
100
189
|
base: "/_admin",
|
|
101
190
|
},
|
|
191
|
+
// ...((args.rpcBases ?? []).map((base) => ({
|
|
192
|
+
// name: "trpc" + base.replace(/^\//, "-"),
|
|
193
|
+
// type: "http",
|
|
194
|
+
// base: "/" + base.replace(/^\//, ""),
|
|
195
|
+
// handler: `${folder}/handler.trpc-api.ts`,
|
|
196
|
+
// target: "server",
|
|
197
|
+
// plugins: () => [
|
|
198
|
+
// tsconfigPaths(),
|
|
199
|
+
// envPlugin({
|
|
200
|
+
// rootDir: args.rootDir,
|
|
201
|
+
// console: log,
|
|
202
|
+
// mode: args.mode,
|
|
203
|
+
// publicUrl: args.publicUrl,
|
|
204
|
+
// serverless: true,
|
|
205
|
+
// target: "frontend",
|
|
206
|
+
// }),
|
|
207
|
+
// ],
|
|
208
|
+
// })) as RouterSchemaInput[]),
|
|
102
209
|
{
|
|
103
210
|
name: "ssr",
|
|
104
211
|
type: "http",
|
|
105
212
|
handler: `${folder}/handler.ssr-page.ts`,
|
|
106
213
|
target: "server",
|
|
107
214
|
plugins: () => [
|
|
108
|
-
// reactRefresh(),
|
|
109
215
|
...corePlugins({
|
|
110
216
|
rootDir: args.rootDir,
|
|
111
217
|
console: log,
|
|
112
|
-
mode:
|
|
218
|
+
mode: args.mode,
|
|
113
219
|
publicUrl: args.publicUrl,
|
|
114
220
|
serverless: true,
|
|
115
221
|
target: "frontend",
|
|
222
|
+
client: false,
|
|
116
223
|
}),
|
|
117
224
|
],
|
|
118
225
|
},
|