eddev 2.0.0-beta.2 → 2.0.0-beta.21
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/boot-admin.d.ts +1 -0
- package/dist/app/entry/{main.admin.js → boot-admin.js} +3 -5
- package/dist/app/entry/spa-root.d.ts +1 -0
- package/dist/app/entry/{Root.js → spa-root.js} +4 -4
- package/dist/app/entry/ssr-root-client.d.ts +4 -0
- package/dist/app/entry/ssr-root-client.js +9 -0
- package/dist/app/entry/ssr-root.d.ts +9 -0
- package/dist/app/entry/ssr-root.js +21 -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.js +4 -4
- package/dist/app/lib/blocks/EditableText.d.ts +1 -1
- package/dist/app/lib/blocks/EditableText.js +2 -2
- package/dist/app/lib/blocks/ErrorBoundaryFrontend.d.ts +1 -1
- package/dist/app/lib/blocks/InnerBlocks.d.ts +2 -2
- package/dist/app/lib/blocks/InnerBlocks.js +4 -4
- package/dist/app/lib/blocks/block-utils.d.ts +1 -1
- package/dist/app/lib/blocks/block-utils.js +1 -1
- package/dist/app/lib/blocks/editor/EditorSupport.js +3 -3
- package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts +1 -1
- package/dist/app/lib/blocks/editor/editor-config.d.ts +1 -1
- package/dist/app/lib/blocks/editor/editor-config.js +1 -1
- package/dist/app/lib/blocks/editor/installGutenbergHooks.js +5 -5
- 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 +3 -3
- package/dist/app/lib/devtools/components/BreakpointIndicator.js +5 -3
- package/dist/app/lib/devtools/components/DevUI.js +1 -1
- 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/useTailwind.d.ts +1078 -1079
- 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 +4 -4
- 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 +5 -5
- package/dist/app/lib/hooks/index.js +5 -5
- package/dist/app/lib/hooks/queryUtils.d.ts +4 -1
- package/dist/app/lib/hooks/queryUtils.js +10 -13
- package/dist/app/lib/hooks/useAppData.js +1 -1
- package/dist/app/lib/internal/index.d.ts +4 -4
- package/dist/app/lib/internal/index.js +4 -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 +3 -511
- 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/BrowserRouter.js +4 -4
- 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.js +5 -5
- package/dist/app/lib/routing/components/RouteRenderer.d.ts +1 -1
- package/dist/app/lib/routing/components/RouteRenderer.js +3 -3
- package/dist/app/lib/routing/components/SSRRouter.d.ts +2 -2
- package/dist/app/lib/routing/components/SSRRouter.js +4 -4
- package/dist/app/lib/routing/components/ScrollRestoration.js +1 -1
- package/dist/app/lib/routing/context.d.ts +2 -2
- package/dist/app/lib/routing/context.js +1 -1
- package/dist/app/lib/routing/hooks/useRestorableState.js +2 -1
- package/dist/app/lib/routing/hooks/useRoute.d.ts +1 -1
- package/dist/app/lib/routing/hooks/useRoute.js +1 -1
- 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 +13 -13
- package/dist/app/lib/routing/index.js +13 -13
- package/dist/app/lib/routing/loader.d.ts +2 -2
- package/dist/app/lib/routing/loader.js +7 -5
- package/dist/app/lib/routing/types.d.ts +2 -2
- package/dist/app/lib/routing/utils.d.ts +1 -1
- package/dist/app/lib/views/index.d.ts +1 -1
- package/dist/app/lib/views/index.js +1 -1
- package/dist/app/server/index.d.ts +3 -0
- package/dist/app/server/index.js +3 -0
- package/dist/app/server/proxy-wp-admin.d.ts +3 -0
- package/dist/app/server/proxy-wp-admin.js +105 -0
- package/dist/app/server/render-ssr-page.d.ts +3 -0
- package/dist/app/server/render-ssr-page.js +21 -0
- package/dist/app/server/server-context.d.ts +37 -0
- package/dist/app/server/server-context.js +118 -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 +58 -11
- package/dist/node/cli/cli-worker.d.ts +1 -1
- package/dist/node/cli/cli-worker.js +7 -2
- package/dist/node/cli/cli.js +83 -12
- package/dist/node/cli/display/CLIApp.d.ts +1 -1
- package/dist/node/cli/display/CLIApp.js +3 -6
- 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 +37 -0
- package/dist/node/compiler/bundler.admin.d.ts +2 -2
- package/dist/node/compiler/bundler.admin.js +3 -4
- package/dist/node/compiler/bundler.frontend.d.ts +1 -1
- package/dist/node/compiler/bundler.frontend.js +3 -4
- package/dist/node/compiler/{serverless.dev.d.ts → dev-server.d.ts} +7 -5
- package/dist/node/compiler/dev-server.js +97 -0
- package/dist/node/compiler/get-vite-config.d.ts +19 -0
- package/dist/node/compiler/get-vite-config.js +201 -0
- package/dist/node/compiler/vinxi-app.d.ts +10 -0
- package/dist/node/compiler/vinxi-app.js +121 -0
- package/dist/node/compiler/vinxi-codegen.d.ts +12 -0
- package/dist/node/compiler/vinxi-codegen.js +417 -0
- package/dist/node/graphql/graphql-codegen.d.ts +1 -1
- package/dist/node/graphql/graphql-codegen.js +3 -3
- package/dist/node/graphql/graphql-schema-loader.js +15 -18
- package/dist/node/project/config.js +1 -1
- package/dist/node/project/env.d.ts +1 -1
- package/dist/node/project/env.js +1 -1
- package/dist/node/project/favicons.d.ts +1 -0
- package/dist/node/project/favicons.js +1 -1
- package/dist/node/project/manifest/block-manifest.js +2 -2
- package/dist/node/project/manifest/manifest.d.ts +1 -1
- package/dist/node/project/manifest/manifest.js +1 -1
- package/dist/node/project/manifest/view-manifest.js +2 -2
- package/dist/node/project/project.d.ts +3 -2
- package/dist/node/project/project.js +17 -19
- package/dist/node/project/wp-info.js +0 -2
- package/dist/node/types/block-type.d.ts +2 -2
- package/dist/node/types/view-type.js +3 -4
- package/dist/node/utils/fs-codegen.d.ts +40 -0
- package/dist/node/utils/fs-codegen.js +97 -0
- package/dist/node/utils/fs.js +2 -0
- package/dist/node/utils/{selfSignedCert.js → self-signed-cert.js} +1 -1
- package/dist/node/utils/{statefulLog.js → stateful-log.js} +1 -1
- package/package.json +29 -31
- package/tsconfig.app.json +2 -2
- package/tsconfig.node.json +2 -2
- package/types.app.d.ts +2 -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/main.admin.d.ts +0 -3
- 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/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/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/{isDeploying.js → is-deploying.js} +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
- /package/dist/node/utils/{watchFileTree.d.ts → watch-file-tree.d.ts} +0 -0
- /package/dist/node/utils/{watchFileTree.js → watch-file-tree.js} +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import * as t from "@babel/types";
|
|
2
|
+
import replace from "@rollup/plugin-replace";
|
|
3
|
+
import react from "@vitejs/plugin-react";
|
|
4
|
+
import { pascalCase } from "change-case-all";
|
|
5
|
+
import { withoutTrailingSlash } from "ufo";
|
|
6
|
+
import { createLogger } from "vite";
|
|
7
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
8
|
+
import { cliMode } from "../cli/cli-mode.js";
|
|
9
|
+
export function envPlugin(args) {
|
|
10
|
+
const envDefines = {
|
|
11
|
+
client: args.serverless ? "!import.meta.env.SSR" : "true",
|
|
12
|
+
serverless: args.serverless ? "true" : "false",
|
|
13
|
+
dev: args.mode === "development" ? "true" : "false",
|
|
14
|
+
admin: args.target === "cms" ? "true" : "false",
|
|
15
|
+
themePath: JSON.stringify(args.publicUrl),
|
|
16
|
+
devUI: args.mode === "development" ? "true" : "false",
|
|
17
|
+
serverlessOrigin: JSON.stringify("http://serverleress-endpoint"),
|
|
18
|
+
rpcEnabled: "false",
|
|
19
|
+
origin: JSON.stringify(process.env.SITE_URL ?? "/"),
|
|
20
|
+
};
|
|
21
|
+
const expandDefines = (obj, prefixes = []) => {
|
|
22
|
+
const result = {};
|
|
23
|
+
for (const prefix of prefixes) {
|
|
24
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
25
|
+
result[prefix + key] = value;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
return replace({
|
|
31
|
+
values: expandDefines(envDefines, ["process.env.", "process.", "env."]),
|
|
32
|
+
preventAssignment: true,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export function reactPlugin() {
|
|
36
|
+
return react({
|
|
37
|
+
babel: {
|
|
38
|
+
overrides: [{ test: /types\./, compact: true }],
|
|
39
|
+
plugins: [
|
|
40
|
+
{
|
|
41
|
+
visitor: {
|
|
42
|
+
ExportNamedDeclaration: (path) => {
|
|
43
|
+
const decl = path.node.declaration;
|
|
44
|
+
if (decl?.type !== "VariableDeclaration")
|
|
45
|
+
return;
|
|
46
|
+
const id = decl.declarations[0].id;
|
|
47
|
+
if (!t.isIdentifier(id))
|
|
48
|
+
return;
|
|
49
|
+
if (id.name === "meta") {
|
|
50
|
+
path.remove();
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
ExportDefaultDeclaration: (path) => {
|
|
54
|
+
if (!path.hub.file.opts.filename.match(/\/(blocks|views)\//))
|
|
55
|
+
return;
|
|
56
|
+
if (path.node.declaration.type === "CallExpression") {
|
|
57
|
+
const call = path.node.declaration;
|
|
58
|
+
if (call.callee.type === "Identifier" && ["defineBlock", "defineView"].includes(call.callee.name)) {
|
|
59
|
+
const type = call.callee.name.replace("define", "");
|
|
60
|
+
const args = call.arguments;
|
|
61
|
+
if (args.length === 2 &&
|
|
62
|
+
args[0].type === "StringLiteral" &&
|
|
63
|
+
args[1].type === "ArrowFunctionExpression") {
|
|
64
|
+
const name = args[0].value;
|
|
65
|
+
let body = args[1].body;
|
|
66
|
+
if (t.isExpression(body)) {
|
|
67
|
+
body = t.blockStatement([t.returnStatement(body)]);
|
|
68
|
+
}
|
|
69
|
+
path.replaceWith(t.exportDefaultDeclaration(t.functionDeclaration(t.identifier(pascalCase(type + "-" + name)), args[1].params, body, args[1].generator, args[1].async)));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Turns on SSR module proxying,
|
|
82
|
+
*/
|
|
83
|
+
export function ssrPlugin() {
|
|
84
|
+
return {
|
|
85
|
+
name: "proxy-external-ssr-modules",
|
|
86
|
+
config(config) {
|
|
87
|
+
config.legacy = {
|
|
88
|
+
...config.legacy,
|
|
89
|
+
proxySsrExternalModules: true,
|
|
90
|
+
};
|
|
91
|
+
config.ssr = {
|
|
92
|
+
...config.ssr,
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
noExternal: ["eddev", "vinxi", "react-use", ...(config?.optimizeDeps?.noExternal ?? [])],
|
|
95
|
+
optimizeDeps: {
|
|
96
|
+
exclude: ["eddev", "vinxi"],
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
config.optimizeDeps = {
|
|
100
|
+
...config.optimizeDeps,
|
|
101
|
+
include: [
|
|
102
|
+
"valtio",
|
|
103
|
+
"zustand",
|
|
104
|
+
"@tanstack/react-query",
|
|
105
|
+
"qs",
|
|
106
|
+
"react",
|
|
107
|
+
"react-dom/client",
|
|
108
|
+
...(config?.optimizeDeps?.include ?? []),
|
|
109
|
+
],
|
|
110
|
+
exclude: ["eddev", "vinxi", ...(config?.optimizeDeps?.exclude ?? [])],
|
|
111
|
+
};
|
|
112
|
+
return config;
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function buildStatusPlugin(console) {
|
|
117
|
+
let timer = 0;
|
|
118
|
+
return {
|
|
119
|
+
name: "eddev:logging",
|
|
120
|
+
enforce: "post",
|
|
121
|
+
watchChange() {
|
|
122
|
+
console.resetLog();
|
|
123
|
+
clearTimeout(timer);
|
|
124
|
+
},
|
|
125
|
+
buildStart() {
|
|
126
|
+
clearTimeout(timer);
|
|
127
|
+
console.setWorking(true);
|
|
128
|
+
},
|
|
129
|
+
buildEnd() {
|
|
130
|
+
clearTimeout(timer);
|
|
131
|
+
timer = setTimeout(() => {
|
|
132
|
+
console.setWorking(false);
|
|
133
|
+
}, 0);
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
export function corePlugins(args) {
|
|
138
|
+
return [args.serverless && ssrPlugin(), envPlugin(args), tsconfigPaths(), reactPlugin()].flat();
|
|
139
|
+
}
|
|
140
|
+
export function getViteConfig(args) {
|
|
141
|
+
const console = args.console;
|
|
142
|
+
const logger = createLogger();
|
|
143
|
+
logger.info = (msg) => args.console.info(msg.replace(/\n/, ""));
|
|
144
|
+
logger.warn = (msg) => {
|
|
145
|
+
if (typeof msg === "string" && msg.includes("Error when using sourcemap for reporting"))
|
|
146
|
+
return;
|
|
147
|
+
return args.console.warn(msg.replace(/\n/, ""));
|
|
148
|
+
};
|
|
149
|
+
logger.error = (msg) => args.console.fail(msg.replace(/\n/, ""));
|
|
150
|
+
logger.warnOnce = (msg) => args.console.warn(msg.replace(/\n/, ""));
|
|
151
|
+
logger.clearScreen = () => {
|
|
152
|
+
args.console.resetLog();
|
|
153
|
+
};
|
|
154
|
+
/** Initial config */
|
|
155
|
+
const config = {
|
|
156
|
+
appType: "custom",
|
|
157
|
+
mode: args.mode,
|
|
158
|
+
root: args.rootDir,
|
|
159
|
+
customLogger: logger,
|
|
160
|
+
logLevel: cliMode.verbose ? "info" : "warn",
|
|
161
|
+
base: withoutTrailingSlash(args.publicUrl) + "/dist/" + args.target,
|
|
162
|
+
define: {
|
|
163
|
+
"process.env.NODE_ENV": JSON.stringify(args.mode),
|
|
164
|
+
},
|
|
165
|
+
plugins: [tsconfigPaths(), envPlugin(args), reactPlugin(), buildStatusPlugin(console)],
|
|
166
|
+
build: {
|
|
167
|
+
manifest: true,
|
|
168
|
+
sourcemap: true,
|
|
169
|
+
minify: args.mode === "production",
|
|
170
|
+
modulePreload: false,
|
|
171
|
+
outDir: args.outDir,
|
|
172
|
+
// watch: {},
|
|
173
|
+
rollupOptions: {
|
|
174
|
+
input: `./.eddev/${args.mode === "production" ? "prod" : "dev"}-spa/entry.${args.target === "cms" ? "admin" : "client"}.tsx`,
|
|
175
|
+
external: args.target === "cms" ? ["react", "react-dom"] : [],
|
|
176
|
+
onwarn(warning, warn) {
|
|
177
|
+
if (!cliMode.verbose &&
|
|
178
|
+
warning.code &&
|
|
179
|
+
["SOURCEMAP_ERROR", "UNUSED_EXTERNAL_IMPORT", "INVALID_ANNOTATION", "EVAL"].includes(warning.code)) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
if (warning.code) {
|
|
183
|
+
warning.message = warning.code + ": " + warning.message;
|
|
184
|
+
}
|
|
185
|
+
warn(warning);
|
|
186
|
+
},
|
|
187
|
+
output: args.target === "cms"
|
|
188
|
+
? {
|
|
189
|
+
entryFileNames: "main.admin.js",
|
|
190
|
+
format: "iife",
|
|
191
|
+
globals: {
|
|
192
|
+
react: "window.React",
|
|
193
|
+
"react-dom": "window.ReactDOM",
|
|
194
|
+
},
|
|
195
|
+
}
|
|
196
|
+
: undefined,
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
return config;
|
|
201
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StatefulLog } from "../utils/stateful-log.js";
|
|
2
|
+
export type AppArgs = {
|
|
3
|
+
mode: "development" | "production";
|
|
4
|
+
publicUrl: string;
|
|
5
|
+
rootDir: string;
|
|
6
|
+
origin: string;
|
|
7
|
+
log?: StatefulLog<any>;
|
|
8
|
+
preset?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function createVinxiApp(args: AppArgs): import("vinxi").App;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { joinURL } from "ufo";
|
|
2
|
+
import { createApp } from "vinxi";
|
|
3
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
4
|
+
import { StatefulLog } from "../utils/stateful-log.js";
|
|
5
|
+
import { corePlugins, envPlugin } from "./get-vite-config.js";
|
|
6
|
+
import { getVinxiFolder } from "./vinxi-codegen.js";
|
|
7
|
+
export function createVinxiApp(args) {
|
|
8
|
+
const log = args.log ?? new StatefulLog({ label: "Build" });
|
|
9
|
+
const folder = "./.eddev/" +
|
|
10
|
+
getVinxiFolder({
|
|
11
|
+
mode: args.mode,
|
|
12
|
+
serverless: true,
|
|
13
|
+
});
|
|
14
|
+
return createApp({
|
|
15
|
+
server: {
|
|
16
|
+
// experimental: {
|
|
17
|
+
// websocket: true,
|
|
18
|
+
// },
|
|
19
|
+
preset: args.preset,
|
|
20
|
+
routeRules: {
|
|
21
|
+
"/wp-content/**": { proxy: joinURL(args.origin, "wp-content/**") },
|
|
22
|
+
"/wp-includes/**": { proxy: joinURL(args.origin, "wp-includes/**") },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
routers: [
|
|
26
|
+
{
|
|
27
|
+
name: "public",
|
|
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",
|
|
52
|
+
type: "http",
|
|
53
|
+
base: "/wp-",
|
|
54
|
+
handler: `${folder}/handler.wp-proxy.ts`,
|
|
55
|
+
target: "server",
|
|
56
|
+
plugins: () => [
|
|
57
|
+
tsconfigPaths(),
|
|
58
|
+
envPlugin({
|
|
59
|
+
rootDir: args.rootDir,
|
|
60
|
+
console: log,
|
|
61
|
+
mode: "development",
|
|
62
|
+
publicUrl: args.publicUrl,
|
|
63
|
+
serverless: true,
|
|
64
|
+
target: "frontend",
|
|
65
|
+
}),
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "client",
|
|
70
|
+
type: "client",
|
|
71
|
+
handler: `${folder}/entry.client.tsx`,
|
|
72
|
+
target: "browser",
|
|
73
|
+
plugins: () => [
|
|
74
|
+
...corePlugins({
|
|
75
|
+
rootDir: args.rootDir,
|
|
76
|
+
console: log,
|
|
77
|
+
mode: "development",
|
|
78
|
+
publicUrl: args.publicUrl,
|
|
79
|
+
serverless: true,
|
|
80
|
+
target: "frontend",
|
|
81
|
+
}),
|
|
82
|
+
],
|
|
83
|
+
base: "/_build",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "admin",
|
|
87
|
+
type: "client",
|
|
88
|
+
handler: `${folder}/entry.admin.tsx`,
|
|
89
|
+
target: "browser",
|
|
90
|
+
plugins: () => [
|
|
91
|
+
...corePlugins({
|
|
92
|
+
rootDir: args.rootDir,
|
|
93
|
+
console: log,
|
|
94
|
+
mode: "development",
|
|
95
|
+
publicUrl: args.publicUrl,
|
|
96
|
+
serverless: true,
|
|
97
|
+
target: "cms",
|
|
98
|
+
}),
|
|
99
|
+
],
|
|
100
|
+
base: "/_admin",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "ssr",
|
|
104
|
+
type: "http",
|
|
105
|
+
handler: `${folder}/handler.ssr-page.ts`,
|
|
106
|
+
target: "server",
|
|
107
|
+
plugins: () => [
|
|
108
|
+
// reactRefresh(),
|
|
109
|
+
...corePlugins({
|
|
110
|
+
rootDir: args.rootDir,
|
|
111
|
+
console: log,
|
|
112
|
+
mode: "development",
|
|
113
|
+
publicUrl: args.publicUrl,
|
|
114
|
+
serverless: true,
|
|
115
|
+
target: "frontend",
|
|
116
|
+
}),
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
});
|
|
121
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Project } from "../project/project.js";
|
|
2
|
+
import { FSCodegen } from "../utils/fs-codegen.js";
|
|
3
|
+
type Options = {
|
|
4
|
+
mode: "development" | "production";
|
|
5
|
+
serverless: boolean;
|
|
6
|
+
project: Project;
|
|
7
|
+
endpoint?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function getVinxiFolder(opts: Pick<Options, "mode" | "serverless">): string;
|
|
10
|
+
export declare function runVinxiCodegen(opts: Options): Promise<void>;
|
|
11
|
+
export declare function createVinxiCodegen(opts: Options): FSCodegen;
|
|
12
|
+
export {};
|