eddev 2.0.0-beta.4 → 2.0.0-beta.41
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/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/{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 +6 -0
- package/dist/app/entry/ssr-root-client.js +16 -0
- package/dist/app/entry/ssr-root.d.ts +10 -0
- package/dist/app/entry/ssr-root.js +24 -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 +3 -3
- package/dist/app/lib/blocks/ErrorBoundaryFrontend.js +1 -0
- 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/EditorSupport.js +3 -3
- 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 +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 +24 -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 +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 +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/index.d.ts +1 -1
- package/dist/app/lib/dynamic/index.js +1 -1
- package/dist/app/lib/hooks/apiConfig.d.ts +3 -1
- package/dist/app/lib/hooks/apiConfig.js +9 -4
- 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 +5 -2
- package/dist/app/lib/hooks/queryUtils.js +19 -20
- 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 +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 +68 -11
- 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 +9 -10
- 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 +1 -1
- package/dist/app/lib/routing/context.d.ts +2 -2
- package/dist/app/lib/routing/context.js +6 -96
- 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 +7 -5
- package/dist/app/lib/routing/types.d.ts +28 -8
- package/dist/app/lib/routing/utils.d.ts +3 -1
- package/dist/app/lib/routing/utils.js +11 -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 +4 -0
- package/dist/app/server/index.js +4 -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 +5 -0
- package/dist/app/server/render-ssr-page.js +31 -0
- package/dist/app/server/server-context.d.ts +50 -0
- package/dist/app/server/server-context.js +145 -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 +84 -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 +105 -0
- package/dist/node/compiler/get-vite-config.d.ts +19 -0
- package/dist/node/compiler/get-vite-config.js +200 -0
- package/dist/node/compiler/vinxi-app.d.ts +19 -0
- package/dist/node/compiler/vinxi-app.js +159 -0
- package/dist/node/compiler/vinxi-codegen.d.ts +12 -0
- package/dist/node/compiler/vinxi-codegen.js +464 -0
- package/dist/node/graphql/graphql-codegen.d.ts +1 -1
- package/dist/node/graphql/graphql-codegen.js +63 -16
- 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/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 +18 -20
- package/dist/node/project/wp-info.js +3 -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 +31 -32
- 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/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 -323
- 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
|
@@ -46,6 +46,8 @@ export class CLIWorker {
|
|
|
46
46
|
}
|
|
47
47
|
if (!isMainThread) {
|
|
48
48
|
const mode = workerData.mode;
|
|
49
|
+
/** Ignore self-signed certificate errors in dev mode */
|
|
50
|
+
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
49
51
|
configureCliMode({
|
|
50
52
|
interactive: true,
|
|
51
53
|
readonly: false,
|
|
@@ -84,20 +86,23 @@ if (!isMainThread) {
|
|
|
84
86
|
}
|
|
85
87
|
function pipeLog(log) {
|
|
86
88
|
log.subscribe((log) => {
|
|
89
|
+
// We ignore SSL errors in dev mode.
|
|
87
90
|
parentPort?.postMessage(JSON.stringify({ type: "log", log: serializeLogData(log) }));
|
|
88
91
|
});
|
|
89
92
|
}
|
|
90
93
|
if (mode === "admin") {
|
|
91
|
-
new AdminBundler(project, {
|
|
94
|
+
const bundler = new AdminBundler(project, {
|
|
92
95
|
mode: "development",
|
|
93
96
|
});
|
|
97
|
+
bundler.start();
|
|
94
98
|
pipeLog(adminLog);
|
|
95
99
|
}
|
|
96
100
|
else if (mode === "frontend") {
|
|
97
|
-
new FrontendBundler(project, {
|
|
101
|
+
const bundler = new FrontendBundler(project, {
|
|
98
102
|
mode: "development",
|
|
99
103
|
watch: true,
|
|
100
104
|
});
|
|
105
|
+
bundler.start();
|
|
101
106
|
pipeLog(frontendLog);
|
|
102
107
|
}
|
|
103
108
|
else if (mode === "graphql") {
|
package/dist/node/cli/cli.js
CHANGED
|
@@ -4,7 +4,8 @@ import { setDefaultResultOrder } from "dns";
|
|
|
4
4
|
import { config as importDotEnv } from "dotenv";
|
|
5
5
|
import { AdminBundler, adminLog } from "../compiler/bundler.admin.js";
|
|
6
6
|
import { FrontendBundler, frontendLog } from "../compiler/bundler.frontend.js";
|
|
7
|
-
import {
|
|
7
|
+
import { DevServer, serverlessLog } from "../compiler/dev-server.js";
|
|
8
|
+
import { createVinxiCodegen } from "../compiler/vinxi-codegen.js";
|
|
8
9
|
import { graphqlLog } from "../graphql/graphql-codegen.js";
|
|
9
10
|
import { BuildInfoWriter } from "../project/eddev-build-file.js";
|
|
10
11
|
import { Project, projectLog } from "../project/project.js";
|
|
@@ -14,6 +15,9 @@ import { configureCliMode } from "./cli-mode.js";
|
|
|
14
15
|
import { CLIWorker } from "./cli-worker.js";
|
|
15
16
|
import { bootCLIUI } from "./display/boot-cli-app.js";
|
|
16
17
|
import { VERSION } from "./version.js";
|
|
18
|
+
import { buildVinxi } from "../compiler/build-vinxi.js";
|
|
19
|
+
import { createConsole } from "../utils/stateful-log.js";
|
|
20
|
+
import { join } from "path";
|
|
17
21
|
importDotEnv();
|
|
18
22
|
const program = new Command()
|
|
19
23
|
.version(VERSION)
|
|
@@ -24,13 +28,18 @@ const init = (verbose) => {
|
|
|
24
28
|
};
|
|
25
29
|
program
|
|
26
30
|
.command("dev")
|
|
27
|
-
.description("
|
|
28
|
-
.option("-
|
|
29
|
-
.option("
|
|
31
|
+
.description("Run in dev mode")
|
|
32
|
+
.option("-m, --mode <mode>", "Comma separated list of modes, or a single mode.", "frontend,admin,graphql,serverless")
|
|
33
|
+
.option("--fast", "Shorthand for --mode graphql,serverless", false)
|
|
30
34
|
.option("--verbose", "Show extra debugging info", false)
|
|
31
35
|
.action(async (options) => {
|
|
32
|
-
process.env
|
|
36
|
+
process.env["NODE_ENV"] = "development";
|
|
37
|
+
/** Ignore self-signed certificate errors in dev mode */
|
|
38
|
+
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
33
39
|
serverlessLog.info(chalk.yellowBright(`⚡️ ED. Stack v${VERSION}`));
|
|
40
|
+
if (options.fast) {
|
|
41
|
+
options.mode = "graphql,serverless";
|
|
42
|
+
}
|
|
34
43
|
const tasks = {
|
|
35
44
|
admin: !options.mode || options.mode.includes("admin"),
|
|
36
45
|
frontend: !options.mode || options.mode.includes("frontend"),
|
|
@@ -66,6 +75,15 @@ program
|
|
|
66
75
|
const infoWriter = new BuildInfoWriter(project);
|
|
67
76
|
infoWriter.watch();
|
|
68
77
|
infoWriter.write();
|
|
78
|
+
if (tasks.admin || tasks.frontend) {
|
|
79
|
+
const spaStaging = createVinxiCodegen({
|
|
80
|
+
mode: "development",
|
|
81
|
+
project,
|
|
82
|
+
serverless: false,
|
|
83
|
+
endpoint: "",
|
|
84
|
+
});
|
|
85
|
+
spaStaging.runAndWatch();
|
|
86
|
+
}
|
|
69
87
|
// Boot up admin in a worker
|
|
70
88
|
if (tasks.admin) {
|
|
71
89
|
new CLIWorker({
|
|
@@ -88,6 +106,9 @@ program
|
|
|
88
106
|
serverlessLog.log(...args);
|
|
89
107
|
};
|
|
90
108
|
console.error = (...args) => {
|
|
109
|
+
// We ignore SSL errors in dev mode.
|
|
110
|
+
if (typeof args[0] === "string" && args[0].includes("NODE_TLS_REJECT_UNAUTHORIZED"))
|
|
111
|
+
return;
|
|
91
112
|
serverlessLog.error(...args);
|
|
92
113
|
};
|
|
93
114
|
console.warn = (...args) => {
|
|
@@ -96,7 +117,14 @@ program
|
|
|
96
117
|
console.info = (...args) => {
|
|
97
118
|
serverlessLog.info(...args);
|
|
98
119
|
};
|
|
99
|
-
|
|
120
|
+
const serverlessStaging = createVinxiCodegen({
|
|
121
|
+
mode: "development",
|
|
122
|
+
project,
|
|
123
|
+
serverless: true,
|
|
124
|
+
endpoint: "",
|
|
125
|
+
});
|
|
126
|
+
await serverlessStaging.runAndWatch();
|
|
127
|
+
new DevServer(project, {
|
|
100
128
|
mode: "development",
|
|
101
129
|
});
|
|
102
130
|
}
|
|
@@ -125,17 +153,61 @@ program
|
|
|
125
153
|
watch: false,
|
|
126
154
|
rootDir: process.cwd(),
|
|
127
155
|
});
|
|
156
|
+
const console = createConsole("build");
|
|
128
157
|
// Load the project info
|
|
129
158
|
const project = await Project.create({
|
|
130
159
|
rootDir: process.cwd(),
|
|
131
160
|
});
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
161
|
+
const buildServerless = options.serverless || process.env.VERCEL;
|
|
162
|
+
if (buildServerless) {
|
|
163
|
+
await buildVinxi({
|
|
164
|
+
project,
|
|
165
|
+
console,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
// Generate bootstrap files
|
|
170
|
+
const codegen = createVinxiCodegen({
|
|
171
|
+
mode: "production",
|
|
172
|
+
project: project,
|
|
173
|
+
serverless: false,
|
|
174
|
+
});
|
|
175
|
+
await codegen.run();
|
|
176
|
+
console.info("Building for SPA WordPress (Frontend and Admin)");
|
|
177
|
+
// Load the compiler
|
|
178
|
+
const admin = new AdminBundler(project, {
|
|
179
|
+
mode: "production",
|
|
180
|
+
});
|
|
181
|
+
const frontend = new FrontendBundler(project, {
|
|
182
|
+
mode: "production",
|
|
183
|
+
});
|
|
184
|
+
await Promise.all([admin.start(), frontend.start()]);
|
|
185
|
+
console.log("Done building SPA WordPress");
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
program
|
|
189
|
+
.command("preview")
|
|
190
|
+
.description("Run a local production build, which was previously built with `eddev build --serverless`")
|
|
191
|
+
.option("--host", "Hostname to serve the application", "127.0.0.1")
|
|
192
|
+
.option("--port", "Port to serve the application", "3000")
|
|
193
|
+
.action(async (options) => {
|
|
194
|
+
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
195
|
+
process.env["NODE_ENV"] = "production";
|
|
196
|
+
process.env["HOST"] = options.host;
|
|
197
|
+
process.env["PORT"] = options.port;
|
|
198
|
+
init(options.verbose);
|
|
199
|
+
configureCliMode({
|
|
200
|
+
interactive: true,
|
|
201
|
+
readonly: false,
|
|
202
|
+
exitOnValidationError: true,
|
|
203
|
+
detailed: true,
|
|
204
|
+
verbose: options.verbose,
|
|
205
|
+
watch: false,
|
|
206
|
+
rootDir: process.cwd(),
|
|
138
207
|
});
|
|
208
|
+
const entry = ".output/server/index.mjs";
|
|
209
|
+
console.info("Looking for production serverless build in: " + entry + "...");
|
|
210
|
+
await import(join(process.cwd(), ".output/server/index.mjs"));
|
|
139
211
|
});
|
|
140
212
|
program
|
|
141
213
|
.command("info")
|
|
@@ -2,7 +2,7 @@ import type { graphqlLog } from "../../graphql/graphql-codegen.js";
|
|
|
2
2
|
import type { Project, projectLog } from "../../project/project.js";
|
|
3
3
|
import type { adminLog } from "../../compiler/bundler.admin.js";
|
|
4
4
|
import type { frontendLog } from "../../compiler/bundler.frontend.js";
|
|
5
|
-
import { serverlessLog } from "../../compiler/
|
|
5
|
+
import { serverlessLog } from "../../compiler/dev-server.js";
|
|
6
6
|
export type CLIDisplayProps = {
|
|
7
7
|
getProject: () => Project;
|
|
8
8
|
logs: {
|
|
@@ -5,7 +5,7 @@ import { VERSION } from "../version.js";
|
|
|
5
5
|
import { LogEntries, LogItem } from "./components/LogEntries.js";
|
|
6
6
|
import { useStatefulLogs } from "./hooks/useStatefulLog.js";
|
|
7
7
|
import { statusColor, statusIcon } from "./util/colors.js";
|
|
8
|
-
import { serverlessLog } from "../../compiler/
|
|
8
|
+
import { serverlessLog } from "../../compiler/dev-server.js";
|
|
9
9
|
import { useEffect, useState } from "react";
|
|
10
10
|
import TextInput from "./components/TextInput.js";
|
|
11
11
|
import { findTools } from "./tools/cli-tools.js";
|
|
@@ -83,17 +83,14 @@ function MainMenu(props) {
|
|
|
83
83
|
else if (key.return) {
|
|
84
84
|
const match = matches[focusIndex];
|
|
85
85
|
if (match) {
|
|
86
|
-
props.onSelect(match.tool.id)
|
|
86
|
+
// props.onSelect(match.tool.id)
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
return (_jsx(Panel, { label: "Main Menu", icon: "\u25C8", color: "yellow", info: "[ESC] to close", children: _jsxs(Box, { width: "100%", flexDirection: "column", paddingX: 1, paddingY: 0, children: [_jsxs(Box, { gap: 1, flexDirection: "row", children: [_jsx(Text, { color: "whiteBright", children: "What would you like to do?" }), _jsx(Text, { color: "gray", children: "[ESC] to close" })] }), _jsxs(Box, { paddingBottom: 1, children: [_jsx(Text, { color: "white", children: "> " }), _jsx(TextInput, { value: search, onChange: (value) => {
|
|
91
91
|
setSearch(value);
|
|
92
92
|
setFocusIndex(0);
|
|
93
|
-
}, showCursor: true, focus: true, placeholder: "Search..." })] }), matches.length === 0 ? _jsx(Text, { color: "redBright", children: "😓 No results" }) : null
|
|
94
|
-
const focused = focusIndex === index;
|
|
95
|
-
return (_jsxs(Box, { children: [_jsx(Box, { width: 3, children: _jsx(Text, { children: focused ? "👉" : "" }) }), _jsxs(Box, { children: [_jsx(Text, { color: focused ? "yellow" : "white", children: item.tool.name }), _jsx(Text, { children: String(item.score) })] })] }, item.tool.id));
|
|
96
|
-
})] }) }));
|
|
93
|
+
}, showCursor: true, focus: true, placeholder: "Search..." })] }), matches.length === 0 ? _jsx(Text, { color: "redBright", children: "😓 No results" }) : null] }) }));
|
|
97
94
|
}
|
|
98
95
|
function MiniLog({ log, border }) {
|
|
99
96
|
const color = statusColor(log.status);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LogEntry, LogGroup, LogGroupOrEntry } from "../../../utils/
|
|
1
|
+
import type { LogEntry, LogGroup, LogGroupOrEntry } from "../../../utils/stateful-log.js";
|
|
2
2
|
export declare function LogEntries(props: {
|
|
3
3
|
entries: LogGroupOrEntry[];
|
|
4
4
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ToolProps } from "./cli-tools";
|
|
1
|
+
import { ToolProps } from "./cli-tools.js";
|
|
2
2
|
export declare function CreateBlock(props: ToolProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,15 +12,5 @@ export type ToolInfo = {
|
|
|
12
12
|
keywords?: string[];
|
|
13
13
|
component: FunctionComponent<ToolProps>;
|
|
14
14
|
};
|
|
15
|
-
export declare function findTools(term: string):
|
|
16
|
-
tool: {
|
|
17
|
-
id: string;
|
|
18
|
-
type: ToolType;
|
|
19
|
-
keywords?: string[] | undefined;
|
|
20
|
-
name: string;
|
|
21
|
-
component: FunctionComponent<ToolProps>;
|
|
22
|
-
};
|
|
23
|
-
score: number;
|
|
24
|
-
matches: import("@nozbe/microfuzz").FuzzyMatches;
|
|
25
|
-
}[];
|
|
15
|
+
export declare function findTools(term: string): ToolInfo[];
|
|
26
16
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import microfuzz from "@nozbe/microfuzz";
|
|
2
1
|
import { TOOLS } from "./cli-tool-list.js";
|
|
3
2
|
const toolList = Object.entries(TOOLS).map(([key, value]) => ({ ...value, id: key }));
|
|
4
3
|
// https://github.com/Nozbe/microfuzz/issues/1
|
|
5
4
|
// @ts-ignore
|
|
6
|
-
const fuzzy = (typeof microfuzz === "function" ? microfuzz : microfuzz.default)
|
|
7
|
-
const fuzzyIndex = fuzzy(toolList, {
|
|
8
|
-
|
|
9
|
-
})
|
|
5
|
+
// const fuzzy = (typeof microfuzz === "function" ? microfuzz : microfuzz.default) as typeof microfuzz
|
|
6
|
+
// const fuzzyIndex = fuzzy(toolList, {
|
|
7
|
+
// getText: (tool) => [tool.name, ...(tool.keywords ? tool.keywords : [])],
|
|
8
|
+
// })
|
|
10
9
|
export function findTools(term) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
10
|
+
return [];
|
|
11
|
+
// if (!term) {
|
|
12
|
+
// return toolList.map((tool) => ({ tool, score: 1, matches: [] }))
|
|
13
|
+
// }
|
|
14
|
+
// return fuzzyIndex(term).map((result) => ({ tool: result.item, score: result.score, matches: result.matches }))
|
|
15
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LogStatus } from "../../../utils/
|
|
2
|
-
export declare function statusColor(status: LogStatus): "greenBright" | "redBright" | "
|
|
1
|
+
import { LogStatus } from "../../../utils/stateful-log.js";
|
|
2
|
+
export declare function statusColor(status: LogStatus): "greenBright" | "redBright" | "#FF890C" | "blueBright" | "#0C86FF" | "grayBright" | "whiteBright";
|
|
3
3
|
export declare function statusIcon(status: LogStatus): "✖" | "✔" | "⚠" | "ℹ" | "⚙" | "v" | "?" | "➜";
|
|
4
4
|
export declare function statusLabel(status: LogStatus): "Error" | "Warning" | "Info" | "Working" | "Fail" | "Success" | "Verbose" | "Help" | "Log";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.0-beta.
|
|
1
|
+
export declare const VERSION = "2.0.0-beta.40";
|
package/dist/node/cli/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.0.0-beta.
|
|
1
|
+
export const VERSION = "2.0.0-beta.40";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { code } from "ts-poet";
|
|
2
|
+
import { createVinxiApp } from "./vinxi-app.js";
|
|
3
|
+
import { createVinxiCodegen } from "./vinxi-codegen.js";
|
|
4
|
+
export async function buildVinxi(opts) {
|
|
5
|
+
const { project, console } = opts;
|
|
6
|
+
const preset = process.env.TARGET ??
|
|
7
|
+
process.env.PRESET ??
|
|
8
|
+
process.env.SERVER_PRESET ??
|
|
9
|
+
process.env.SERVER_TARGET ??
|
|
10
|
+
process.env.NITRO_PRESET ??
|
|
11
|
+
process.env.NITRO_TARGET ??
|
|
12
|
+
(process.env.VERCEL ? "vercel" : undefined) ??
|
|
13
|
+
(process.versions.bun !== undefined ? "bun" : "node-server");
|
|
14
|
+
const appConf = {
|
|
15
|
+
mode: "production",
|
|
16
|
+
origin: project.origin,
|
|
17
|
+
publicUrl: project.publicUrl,
|
|
18
|
+
rootDir: project.rootDir,
|
|
19
|
+
// log: console,
|
|
20
|
+
preset,
|
|
21
|
+
};
|
|
22
|
+
const codegen = createVinxiCodegen({
|
|
23
|
+
mode: "production",
|
|
24
|
+
project: project,
|
|
25
|
+
serverless: true,
|
|
26
|
+
});
|
|
27
|
+
codegen.registerFile({
|
|
28
|
+
name: "../../app.config.mjs",
|
|
29
|
+
generate: code /* ts */ `
|
|
30
|
+
import { createVinxiApp } from 'eddev/_internal/create-vinxi-app.js'
|
|
31
|
+
export default createVinxiApp(${JSON.stringify(appConf)})
|
|
32
|
+
`,
|
|
33
|
+
});
|
|
34
|
+
await codegen.runAndWatch();
|
|
35
|
+
const app = createVinxiApp(appConf);
|
|
36
|
+
await app.build();
|
|
37
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Project } from "../project/project.js";
|
|
2
|
-
export declare const adminLog: import("../utils/
|
|
2
|
+
export declare const adminLog: import("../utils/stateful-log.js").StatefulLog<unknown>;
|
|
3
3
|
type Options = {
|
|
4
4
|
mode: "development" | "production";
|
|
5
5
|
watch?: boolean;
|
|
@@ -8,6 +8,6 @@ export declare class AdminBundler {
|
|
|
8
8
|
project: Project;
|
|
9
9
|
opts: Options;
|
|
10
10
|
constructor(project: Project, opts: Options);
|
|
11
|
-
|
|
11
|
+
start(): Promise<void>;
|
|
12
12
|
}
|
|
13
13
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { relative } from "path";
|
|
2
2
|
import { build, defineConfig, mergeConfig } from "vite";
|
|
3
|
-
import { createConsole } from "../utils/
|
|
4
|
-
import { getViteConfig } from "./
|
|
3
|
+
import { createConsole } from "../utils/stateful-log.js";
|
|
4
|
+
import { getViteConfig } from "./get-vite-config.js";
|
|
5
5
|
const console = createConsole("Admin Bundle", "admin");
|
|
6
6
|
export const adminLog = console;
|
|
7
7
|
export class AdminBundler {
|
|
@@ -10,14 +10,13 @@ export class AdminBundler {
|
|
|
10
10
|
constructor(project, opts) {
|
|
11
11
|
this.project = project;
|
|
12
12
|
this.opts = opts;
|
|
13
|
-
this.start();
|
|
14
13
|
}
|
|
15
14
|
async start() {
|
|
16
15
|
console.info(`Creating ${this.opts.mode} WordPress admin build...`);
|
|
17
16
|
const baseConfig = getViteConfig({
|
|
18
17
|
console,
|
|
19
18
|
mode: this.opts.mode,
|
|
20
|
-
|
|
19
|
+
publicUrl: this.project.publicUrl,
|
|
21
20
|
rootDir: this.project.rootDir,
|
|
22
21
|
outDir: relative(this.project.rootDir, "./dist/cms/"),
|
|
23
22
|
serverless: false,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Project } from "../project/project.js";
|
|
2
|
-
export declare const frontendLog: import("../utils/
|
|
2
|
+
export declare const frontendLog: import("../utils/stateful-log.js").StatefulLog<unknown>;
|
|
3
3
|
type Options = {
|
|
4
4
|
mode: "development" | "production";
|
|
5
5
|
watch?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { relative } from "path";
|
|
2
2
|
import { build, defineConfig, mergeConfig } from "vite";
|
|
3
|
-
import { createConsole } from "../utils/
|
|
4
|
-
import { getViteConfig } from "./
|
|
3
|
+
import { createConsole } from "../utils/stateful-log.js";
|
|
4
|
+
import { getViteConfig } from "./get-vite-config.js";
|
|
5
5
|
const console = createConsole("Frontend Bundler", "spa");
|
|
6
6
|
export const frontendLog = console;
|
|
7
7
|
export class FrontendBundler {
|
|
@@ -10,14 +10,13 @@ export class FrontendBundler {
|
|
|
10
10
|
constructor(project, opts) {
|
|
11
11
|
this.project = project;
|
|
12
12
|
this.opts = opts;
|
|
13
|
-
this.start();
|
|
14
13
|
}
|
|
15
14
|
async start() {
|
|
16
15
|
console.info(`Creating ${this.opts.mode} SPA build...`);
|
|
17
16
|
const baseConfig = getViteConfig({
|
|
18
17
|
console,
|
|
19
18
|
mode: this.opts.mode,
|
|
20
|
-
|
|
19
|
+
publicUrl: this.project.publicUrl,
|
|
21
20
|
rootDir: this.project.rootDir,
|
|
22
21
|
outDir: relative(this.project.rootDir, "./dist/frontend/"),
|
|
23
22
|
serverless: false,
|
|
@@ -3,13 +3,15 @@ export type ServerlessDevStatus = {
|
|
|
3
3
|
serverlessUrl: string;
|
|
4
4
|
wordpressUrl: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const serverlessLog: import("../utils/
|
|
7
|
-
type Options = {
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
export declare class ServerlessDevServer {
|
|
6
|
+
export declare const serverlessLog: import("../utils/stateful-log.js").StatefulLog<ServerlessDevStatus>;
|
|
7
|
+
type Options = {};
|
|
8
|
+
export declare class DevServer {
|
|
11
9
|
project: Project;
|
|
12
10
|
opts: Options;
|
|
11
|
+
origin: string;
|
|
12
|
+
hostname: string;
|
|
13
|
+
hostOrigin: string;
|
|
14
|
+
port: number;
|
|
13
15
|
constructor(project: Project, opts: Options);
|
|
14
16
|
start(): Promise<void>;
|
|
15
17
|
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { parseURL } from "ufo";
|
|
2
|
+
import { createDevServer } from "vinxi/dev-server";
|
|
3
|
+
import { ProjectEnvUtils } from "../project/env.js";
|
|
4
|
+
import { ensureSelfSignedCert } from "../utils/self-signed-cert.js";
|
|
5
|
+
import { createConsole } from "../utils/stateful-log.js";
|
|
6
|
+
import { createVinxiApp } from "./vinxi-app.js";
|
|
7
|
+
import { createVinxiCodegen } from "./vinxi-codegen.js";
|
|
8
|
+
const console = createConsole("Dev Server", "dev");
|
|
9
|
+
export const serverlessLog = console;
|
|
10
|
+
export class DevServer {
|
|
11
|
+
project;
|
|
12
|
+
opts;
|
|
13
|
+
origin;
|
|
14
|
+
hostname;
|
|
15
|
+
hostOrigin;
|
|
16
|
+
port = 8080;
|
|
17
|
+
constructor(project, opts) {
|
|
18
|
+
this.project = project;
|
|
19
|
+
this.opts = opts;
|
|
20
|
+
this.start();
|
|
21
|
+
this.origin = ProjectEnvUtils.get("SITE_URL");
|
|
22
|
+
const parsedSiteURL = parseURL(this.origin);
|
|
23
|
+
this.hostname = parsedSiteURL.host?.endsWith(".local") ? parsedSiteURL.host : "localhost";
|
|
24
|
+
this.hostOrigin = "https://" + this.hostname + ":" + this.port;
|
|
25
|
+
}
|
|
26
|
+
async start() {
|
|
27
|
+
console.setWorking(true);
|
|
28
|
+
// console.log("Setting up vinxi codegen")
|
|
29
|
+
const codegen = createVinxiCodegen({
|
|
30
|
+
mode: "development",
|
|
31
|
+
project: this.project,
|
|
32
|
+
serverless: true,
|
|
33
|
+
});
|
|
34
|
+
await codegen.runAndWatch();
|
|
35
|
+
// console.log("Has run once")
|
|
36
|
+
const app = createVinxiApp({
|
|
37
|
+
mode: "development",
|
|
38
|
+
origin: this.origin,
|
|
39
|
+
publicUrl: this.project.publicUrl,
|
|
40
|
+
rootDir: this.project.rootDir,
|
|
41
|
+
log: console,
|
|
42
|
+
});
|
|
43
|
+
const preset = process.env.TARGET ??
|
|
44
|
+
process.env.PRESET ??
|
|
45
|
+
process.env.SERVER_PRESET ??
|
|
46
|
+
process.env.SERVER_TARGET ??
|
|
47
|
+
process.env.NITRO_PRESET ??
|
|
48
|
+
process.env.NITRO_TARGET ??
|
|
49
|
+
(process.versions.bun !== undefined ? "bun" : "node-server");
|
|
50
|
+
// console.log("Ensuring self signed cert")
|
|
51
|
+
const keys = await ensureSelfSignedCert(this.hostname, this.project.rootDir);
|
|
52
|
+
// console.log("Done")
|
|
53
|
+
const httpsConfig = {
|
|
54
|
+
cert: keys.certFile,
|
|
55
|
+
key: keys.keyFile,
|
|
56
|
+
domains: [this.hostname, "localhost"],
|
|
57
|
+
};
|
|
58
|
+
let devApp = null;
|
|
59
|
+
app.hooks.addHooks({
|
|
60
|
+
"app:dev:start": async ({ app, serveConfig }) => {
|
|
61
|
+
serveConfig.https = httpsConfig;
|
|
62
|
+
serveConfig.hostname = this.hostname;
|
|
63
|
+
},
|
|
64
|
+
"app:dev:server:created": async (args) => {
|
|
65
|
+
devApp = args.devApp;
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
// console.log("Creating dev server")
|
|
69
|
+
await createDevServer(app, {
|
|
70
|
+
force: false,
|
|
71
|
+
devtools: false,
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
hostname: this.hostname,
|
|
74
|
+
port: this.port,
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
preset: preset,
|
|
77
|
+
https: httpsConfig,
|
|
78
|
+
});
|
|
79
|
+
// console.log("Rnning listen hook")
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
await app.hooks.callHook("app:dev:server:listener:creating", {
|
|
82
|
+
app,
|
|
83
|
+
devApp,
|
|
84
|
+
});
|
|
85
|
+
// console.log("Creating another listener")
|
|
86
|
+
const listener = await devApp.listen(this.port, {
|
|
87
|
+
hostname: this.hostname,
|
|
88
|
+
port: this.port,
|
|
89
|
+
https: httpsConfig,
|
|
90
|
+
qr: false,
|
|
91
|
+
showURL: false,
|
|
92
|
+
});
|
|
93
|
+
await app.hooks.callHook("app:dev:server:listener:created", {
|
|
94
|
+
app,
|
|
95
|
+
devApp,
|
|
96
|
+
listener,
|
|
97
|
+
});
|
|
98
|
+
// console.log("Listening")
|
|
99
|
+
console.setWorking(false);
|
|
100
|
+
console.setState({
|
|
101
|
+
serverlessUrl: this.hostOrigin,
|
|
102
|
+
wordpressUrl: this.origin,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { InlineConfig, PluginOption } from "vite";
|
|
2
|
+
import { StatefulLog } from "../utils/stateful-log.js";
|
|
3
|
+
export type Args = {
|
|
4
|
+
mode: "development" | "production";
|
|
5
|
+
serverless: boolean;
|
|
6
|
+
target: "frontend" | "cms";
|
|
7
|
+
rootDir: string;
|
|
8
|
+
outDir?: string;
|
|
9
|
+
publicUrl: string;
|
|
10
|
+
console: StatefulLog<any>;
|
|
11
|
+
};
|
|
12
|
+
export declare function envPlugin(args: Args): PluginOption;
|
|
13
|
+
export declare function reactPlugin(): PluginOption[];
|
|
14
|
+
/**
|
|
15
|
+
* Turns on SSR module proxying,
|
|
16
|
+
*/
|
|
17
|
+
export declare function ssrPlugin(): PluginOption;
|
|
18
|
+
export declare function corePlugins(args: Args): PluginOption[];
|
|
19
|
+
export declare function getViteConfig(args: Args): InlineConfig;
|