eddev 2.0.0-beta.12 → 2.0.0-beta.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/editor-styles.css +4 -0
- package/dist/app/entry/HydrationOverlay.d.ts +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 +9 -3
- 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 +3 -5
- package/dist/app/entry/ssr-root-client.d.ts +3 -1
- package/dist/app/entry/ssr-root-client.js +18 -6
- package/dist/app/entry/ssr-root.d.ts +3 -4
- package/dist/app/entry/ssr-root.js +19 -19
- 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 +3 -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 +15 -2
- package/dist/app/lib/blocks/EditableText.js +10 -4
- package/dist/app/lib/blocks/InnerBlocks.d.ts +21 -7
- package/dist/app/lib/blocks/InnerBlocks.js +75 -28
- 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/defineBlock.d.ts +3 -0
- package/dist/app/lib/blocks/defineBlock.js +7 -0
- package/dist/app/lib/blocks/editor/EditorHighlights.d.ts +7 -0
- package/dist/app/lib/blocks/editor/EditorHighlights.js +164 -0
- package/dist/app/lib/blocks/editor/EditorSupport.js +17 -12
- package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts +1 -1
- package/dist/app/lib/blocks/editor/block-templates.d.ts +6 -0
- package/dist/app/lib/blocks/editor/block-templates.js +64 -0
- package/dist/app/lib/blocks/editor/create-block.d.ts +9 -0
- package/dist/app/lib/blocks/editor/create-block.js +13 -0
- package/dist/app/lib/blocks/editor/editor-config.d.ts +70 -7
- package/dist/app/lib/blocks/editor/editor-config.js +29 -62
- package/dist/app/lib/blocks/editor/installGutenbergHooks.d.ts +3 -0
- package/dist/app/lib/blocks/editor/installGutenbergHooks.js +105 -16
- 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 +10 -9
- package/dist/app/lib/blocks/index.js +10 -9
- package/dist/app/lib/blocks/inline-editing.d.ts +9 -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 +2305 -1261
- 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 +12 -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 +5 -1
- package/dist/app/lib/routing/components/BrowserRouter.js +98 -19
- package/dist/app/lib/routing/components/ClientOnly.d.ts +1 -1
- package/dist/app/lib/routing/components/ClientOnly.js +2 -2
- 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 +37 -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 +41 -14
- package/dist/app/server/render-ssr-page.d.ts +27 -2
- package/dist/app/server/render-ssr-page.js +192 -12
- 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 +44 -4
- package/dist/app/server/server-context.js +305 -28
- 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/query-monitor.d.ts +26 -0
- package/dist/app/utils/query-monitor.js +7 -0
- 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 +81 -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 +2 -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 +7 -1
- package/dist/node/compiler/get-vite-config.js +96 -16
- 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 +345 -112
- 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 +2 -1
- 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 +11 -1
- package/dist/node/project/project.js +61 -7
- package/dist/node/project/wp-info.d.ts +1 -0
- package/dist/node/project/wp-info.js +13 -1
- package/dist/node/storybook/index.d.ts +2 -0
- package/dist/node/storybook/index.js +13 -0
- 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/report-builder.d.ts +6 -6
- package/dist/node/utils/self-signed-cert.d.ts +2 -0
- package/dist/node/utils/self-signed-cert.js +10 -2
- 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 +21 -12
- package/types.app.d.ts +4 -2
- package/types.app.internal.d.ts +2 -2
- package/types.meta.d.ts +105 -0
- 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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { QueryClientProvider, QueryClient } from "@tanstack/react-query";
|
|
2
3
|
let queryClient = null;
|
|
3
4
|
export function getQueryClient() {
|
|
4
5
|
if (!queryClient) {
|
|
@@ -14,3 +15,6 @@ export function getQueryClient() {
|
|
|
14
15
|
}
|
|
15
16
|
return queryClient;
|
|
16
17
|
}
|
|
18
|
+
export function QueryProvider(props) {
|
|
19
|
+
return _jsx(QueryClientProvider, { client: getQueryClient(), children: props.children });
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare namespace QueryMonitor {
|
|
2
|
+
type LogEntry = {
|
|
3
|
+
type: "php_warning" | "php_error" | "php_notice" | "error" | "GRAPHQL_DEBUG" | (string & {});
|
|
4
|
+
message: any;
|
|
5
|
+
line?: number;
|
|
6
|
+
file?: string;
|
|
7
|
+
stack?: string[];
|
|
8
|
+
locations?: {
|
|
9
|
+
line: number;
|
|
10
|
+
column: number;
|
|
11
|
+
}[];
|
|
12
|
+
path?: string[];
|
|
13
|
+
extensions?: {
|
|
14
|
+
category?: string;
|
|
15
|
+
};
|
|
16
|
+
debugMessage?: string;
|
|
17
|
+
};
|
|
18
|
+
type Entry = {
|
|
19
|
+
file: string;
|
|
20
|
+
duration: number;
|
|
21
|
+
label?: "app" | "page" | "block" | "query" | "mutation" | (string & {});
|
|
22
|
+
log: LogEntry[];
|
|
23
|
+
children?: Entry[];
|
|
24
|
+
};
|
|
25
|
+
function hasLogEntries(entry: Entry[]): boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var QueryMonitor;
|
|
2
|
+
(function (QueryMonitor) {
|
|
3
|
+
function hasLogEntries(entry) {
|
|
4
|
+
return entry.some((e) => e.log.length > 0 || (e.children && hasLogEntries(e.children)));
|
|
5
|
+
}
|
|
6
|
+
QueryMonitor.hasLogEntries = hasLogEntries;
|
|
7
|
+
})(QueryMonitor || (QueryMonitor = {}));
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createTRPCUntypedClient, httpLink, splitLink, unstable_httpSubscriptionLink, } from "@trpc/client";
|
|
2
|
+
import SuperJSON from "superjson";
|
|
3
|
+
import { parseURL, stringifyParsedURL } from "ufo";
|
|
4
|
+
const updatePath = (url) => {
|
|
5
|
+
const parsed = parseURL(url);
|
|
6
|
+
parsed.pathname = "/" + parsed.pathname.replace(/(^\/|\/$)/g, "").replace(/\./g, "/") + "/";
|
|
7
|
+
return stringifyParsedURL(parsed);
|
|
8
|
+
};
|
|
9
|
+
let client;
|
|
10
|
+
export function getRPCClient() {
|
|
11
|
+
if (env.rpcEnabled) {
|
|
12
|
+
if (!client) {
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
const endpoint = env.serverless ? "/" : window.SERVERLESS_ENDPOINT ?? "/";
|
|
15
|
+
client = createTRPCUntypedClient({
|
|
16
|
+
links: [
|
|
17
|
+
splitLink({
|
|
18
|
+
condition: (op) => op.type === "subscription",
|
|
19
|
+
true: unstable_httpSubscriptionLink({
|
|
20
|
+
url: endpoint,
|
|
21
|
+
transformer: SuperJSON,
|
|
22
|
+
}),
|
|
23
|
+
false: httpLink({
|
|
24
|
+
url: endpoint,
|
|
25
|
+
fetch: (url, opts) => {
|
|
26
|
+
return fetch(updatePath(url), {
|
|
27
|
+
...opts,
|
|
28
|
+
credentials: "omit",
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
transformer: SuperJSON,
|
|
32
|
+
}),
|
|
33
|
+
}),
|
|
34
|
+
],
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return client;
|
|
39
|
+
}
|
|
@@ -47,7 +47,7 @@ export class CLIWorker {
|
|
|
47
47
|
if (!isMainThread) {
|
|
48
48
|
const mode = workerData.mode;
|
|
49
49
|
/** Ignore self-signed certificate errors in dev mode */
|
|
50
|
-
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0"
|
|
50
|
+
// process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0"
|
|
51
51
|
configureCliMode({
|
|
52
52
|
interactive: true,
|
|
53
53
|
readonly: false,
|
|
@@ -86,25 +86,30 @@ if (!isMainThread) {
|
|
|
86
86
|
}
|
|
87
87
|
function pipeLog(log) {
|
|
88
88
|
log.subscribe((log) => {
|
|
89
|
-
// We ignore SSL errors in dev mode.
|
|
90
89
|
parentPort?.postMessage(JSON.stringify({ type: "log", log: serializeLogData(log) }));
|
|
91
90
|
});
|
|
92
91
|
}
|
|
93
92
|
if (mode === "admin") {
|
|
94
|
-
new AdminBundler(project, {
|
|
93
|
+
const bundler = new AdminBundler(project, {
|
|
95
94
|
mode: "development",
|
|
96
95
|
});
|
|
96
|
+
bundler.start();
|
|
97
97
|
pipeLog(adminLog);
|
|
98
98
|
}
|
|
99
99
|
else if (mode === "frontend") {
|
|
100
|
-
new FrontendBundler(project, {
|
|
100
|
+
const bundler = new FrontendBundler(project, {
|
|
101
101
|
mode: "development",
|
|
102
102
|
watch: true,
|
|
103
103
|
});
|
|
104
|
+
bundler.start();
|
|
104
105
|
pipeLog(frontendLog);
|
|
105
106
|
}
|
|
106
107
|
else if (mode === "graphql") {
|
|
107
|
-
const codegen = new GraphQLGenerator(project
|
|
108
|
+
const codegen = new GraphQLGenerator(project, {
|
|
109
|
+
generate: true,
|
|
110
|
+
optimize: true,
|
|
111
|
+
watch: true,
|
|
112
|
+
});
|
|
108
113
|
codegen.start();
|
|
109
114
|
pipeLog(graphqlLog);
|
|
110
115
|
}
|
package/dist/node/cli/cli.js
CHANGED
|
@@ -2,11 +2,11 @@ import chalk from "chalk";
|
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { setDefaultResultOrder } from "dns";
|
|
4
4
|
import { config as importDotEnv } from "dotenv";
|
|
5
|
-
import { adminLog } from "../compiler/bundler.admin.js";
|
|
6
|
-
import { frontendLog } from "../compiler/bundler.frontend.js";
|
|
5
|
+
import { AdminBundler, adminLog } from "../compiler/bundler.admin.js";
|
|
6
|
+
import { FrontendBundler, frontendLog } from "../compiler/bundler.frontend.js";
|
|
7
7
|
import { DevServer, serverlessLog } from "../compiler/dev-server.js";
|
|
8
8
|
import { createVinxiCodegen } from "../compiler/vinxi-codegen.js";
|
|
9
|
-
import { graphqlLog } from "../graphql/graphql-codegen.js";
|
|
9
|
+
import { GraphQLGenerator, graphqlLog } from "../graphql/graphql-codegen.js";
|
|
10
10
|
import { BuildInfoWriter } from "../project/eddev-build-file.js";
|
|
11
11
|
import { Project, projectLog } from "../project/project.js";
|
|
12
12
|
import { describeBlockManifest } from "../types/block-type.js";
|
|
@@ -17,6 +17,7 @@ import { bootCLIUI } from "./display/boot-cli-app.js";
|
|
|
17
17
|
import { VERSION } from "./version.js";
|
|
18
18
|
import { buildVinxi } from "../compiler/build-vinxi.js";
|
|
19
19
|
import { createConsole } from "../utils/stateful-log.js";
|
|
20
|
+
import { join } from "path";
|
|
20
21
|
importDotEnv();
|
|
21
22
|
const program = new Command()
|
|
22
23
|
.version(VERSION)
|
|
@@ -29,12 +30,23 @@ program
|
|
|
29
30
|
.command("dev")
|
|
30
31
|
.description("Run in dev mode")
|
|
31
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)
|
|
32
34
|
.option("--verbose", "Show extra debugging info", false)
|
|
33
35
|
.action(async (options) => {
|
|
36
|
+
console.error = (...args) => { };
|
|
37
|
+
console.log = (...args) => { };
|
|
38
|
+
console.info = (...args) => { };
|
|
39
|
+
console.warn = (...args) => { };
|
|
40
|
+
// if (typeof args[0] === "string" && args[0].includes("NODE_TLS_REJECT_UNAUTHORIZED")) return
|
|
41
|
+
// serverlessLog.error(...args)
|
|
42
|
+
// }
|
|
34
43
|
process.env["NODE_ENV"] = "development";
|
|
35
44
|
/** Ignore self-signed certificate errors in dev mode */
|
|
36
|
-
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0"
|
|
45
|
+
// process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0"
|
|
37
46
|
serverlessLog.info(chalk.yellowBright(`⚡️ ED. Stack v${VERSION}`));
|
|
47
|
+
if (options.fast) {
|
|
48
|
+
options.mode = "graphql,serverless";
|
|
49
|
+
}
|
|
38
50
|
const tasks = {
|
|
39
51
|
admin: !options.mode || options.mode.includes("admin"),
|
|
40
52
|
frontend: !options.mode || options.mode.includes("frontend"),
|
|
@@ -67,6 +79,12 @@ program
|
|
|
67
79
|
rootDir: process.cwd(),
|
|
68
80
|
reportPluginCompatibility: true,
|
|
69
81
|
});
|
|
82
|
+
// const result = await project.verifyOriginAccess()
|
|
83
|
+
// if (!result.success) {
|
|
84
|
+
// projectLog.fail(result.message)
|
|
85
|
+
// process.exit(1)
|
|
86
|
+
// return
|
|
87
|
+
// }
|
|
70
88
|
const infoWriter = new BuildInfoWriter(project);
|
|
71
89
|
infoWriter.watch();
|
|
72
90
|
infoWriter.write();
|
|
@@ -104,6 +122,8 @@ program
|
|
|
104
122
|
// We ignore SSL errors in dev mode.
|
|
105
123
|
if (typeof args[0] === "string" && args[0].includes("NODE_TLS_REJECT_UNAUTHORIZED"))
|
|
106
124
|
return;
|
|
125
|
+
if (typeof args[0] === "string" && args[0].includes("useLayoutEffect does nothing"))
|
|
126
|
+
return;
|
|
107
127
|
serverlessLog.error(...args);
|
|
108
128
|
};
|
|
109
129
|
console.warn = (...args) => {
|
|
@@ -138,6 +158,9 @@ program
|
|
|
138
158
|
.option("-s, --serverless", 'Build in "serverless" mode', false)
|
|
139
159
|
.option("--verbose", "Show extra debugging info", false)
|
|
140
160
|
.action(async (options) => {
|
|
161
|
+
process.env["NODE_ENV"] = "production";
|
|
162
|
+
/** Ignore self-signed certificate errors in dev mode */
|
|
163
|
+
// process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0"
|
|
141
164
|
init(options.verbose);
|
|
142
165
|
configureCliMode({
|
|
143
166
|
interactive: false,
|
|
@@ -155,18 +178,65 @@ program
|
|
|
155
178
|
});
|
|
156
179
|
const buildServerless = options.serverless || process.env.VERCEL;
|
|
157
180
|
if (buildServerless) {
|
|
181
|
+
// Verify that the we have access to the origin
|
|
182
|
+
const result = await project.verifyOriginAccess();
|
|
183
|
+
if (!result.success) {
|
|
184
|
+
console.error(result.message);
|
|
185
|
+
process.exit(1);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
158
188
|
await buildVinxi({
|
|
159
189
|
project,
|
|
160
190
|
console,
|
|
161
191
|
});
|
|
162
192
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
193
|
+
else {
|
|
194
|
+
const infoWriter = new BuildInfoWriter(project);
|
|
195
|
+
// Generate bootstrap files
|
|
196
|
+
const codegen = createVinxiCodegen({
|
|
197
|
+
mode: "production",
|
|
198
|
+
project: project,
|
|
199
|
+
serverless: false,
|
|
200
|
+
});
|
|
201
|
+
await codegen.run();
|
|
202
|
+
console.info("Building for SPA WordPress (Frontend and Admin)");
|
|
203
|
+
// Load the compiler
|
|
204
|
+
const admin = new AdminBundler(project, {
|
|
205
|
+
mode: "production",
|
|
206
|
+
});
|
|
207
|
+
const frontend = new FrontendBundler(project, {
|
|
208
|
+
mode: "production",
|
|
209
|
+
});
|
|
210
|
+
const graphql = new GraphQLGenerator(project, {
|
|
211
|
+
optimize: true,
|
|
212
|
+
});
|
|
213
|
+
await Promise.all([infoWriter.write(), admin.start(), frontend.start(), graphql.start()]);
|
|
214
|
+
console.log("Done building SPA WordPress");
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
program
|
|
218
|
+
.command("preview")
|
|
219
|
+
.description("Run a local production build, which was previously built with `eddev build --serverless`")
|
|
220
|
+
.option("--host", "Hostname to serve the application", "127.0.0.1")
|
|
221
|
+
.option("--port", "Port to serve the application", "3000")
|
|
222
|
+
.action(async (options) => {
|
|
223
|
+
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
224
|
+
process.env["NODE_ENV"] = "production";
|
|
225
|
+
process.env["HOST"] = options.host;
|
|
226
|
+
process.env["PORT"] = options.port;
|
|
227
|
+
init(options.verbose);
|
|
228
|
+
configureCliMode({
|
|
229
|
+
interactive: true,
|
|
230
|
+
readonly: false,
|
|
231
|
+
exitOnValidationError: true,
|
|
232
|
+
detailed: true,
|
|
233
|
+
verbose: options.verbose,
|
|
234
|
+
watch: false,
|
|
235
|
+
rootDir: process.cwd(),
|
|
236
|
+
});
|
|
237
|
+
const entry = ".output/server/index.mjs";
|
|
238
|
+
console.info("Looking for production serverless build in: " + entry + "...");
|
|
239
|
+
await import(join(process.cwd(), ".output/server/index.mjs"));
|
|
170
240
|
});
|
|
171
241
|
program
|
|
172
242
|
.command("info")
|
|
@@ -37,7 +37,7 @@ export function CLIApp(props) {
|
|
|
37
37
|
process.stdout.write("\u001b[3J\u001b[1J");
|
|
38
38
|
console.clear();
|
|
39
39
|
props.logs.serverless?.resetLog();
|
|
40
|
-
redraw
|
|
40
|
+
setImmediate(redraw);
|
|
41
41
|
}
|
|
42
42
|
else if (input === "q") {
|
|
43
43
|
process.exit(0);
|
|
@@ -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,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 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.0-beta.
|
|
1
|
+
export declare const VERSION = "2.0.0-beta.120";
|
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.120";
|
|
@@ -16,8 +16,9 @@ export async function buildVinxi(opts) {
|
|
|
16
16
|
origin: project.origin,
|
|
17
17
|
publicUrl: project.publicUrl,
|
|
18
18
|
rootDir: project.rootDir,
|
|
19
|
-
|
|
19
|
+
rpcBases: (await project.serverRoutes.get()).bases,
|
|
20
20
|
preset,
|
|
21
|
+
config: project.config,
|
|
21
22
|
};
|
|
22
23
|
const codegen = createVinxiCodegen({
|
|
23
24
|
mode: "production",
|
|
@@ -10,7 +10,6 @@ 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...`);
|
|
@@ -22,6 +21,7 @@ export class AdminBundler {
|
|
|
22
21
|
outDir: relative(this.project.rootDir, "./dist/cms/"),
|
|
23
22
|
serverless: false,
|
|
24
23
|
target: "cms",
|
|
24
|
+
client: true,
|
|
25
25
|
});
|
|
26
26
|
console.verbose("Vite config:", baseConfig);
|
|
27
27
|
await build(mergeConfig(baseConfig, defineConfig({
|
|
@@ -10,7 +10,6 @@ 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...`);
|
|
@@ -22,6 +21,7 @@ export class FrontendBundler {
|
|
|
22
21
|
outDir: relative(this.project.rootDir, "./dist/frontend/"),
|
|
23
22
|
serverless: false,
|
|
24
23
|
target: "frontend",
|
|
24
|
+
client: true,
|
|
25
25
|
});
|
|
26
26
|
console.verbose("Vite config:", baseConfig);
|
|
27
27
|
await build(mergeConfig(baseConfig, defineConfig({
|
|
@@ -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,12 +8,18 @@ export type Args = {
|
|
|
8
8
|
outDir?: string;
|
|
9
9
|
publicUrl: string;
|
|
10
10
|
console: StatefulLog<any>;
|
|
11
|
+
client: boolean;
|
|
11
12
|
};
|
|
12
13
|
export declare function envPlugin(args: Args): PluginOption;
|
|
13
|
-
|
|
14
|
+
type ReactPluginArgs = {
|
|
15
|
+
retainBlockMeta?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare function reactPlugin(args?: ReactPluginArgs): PluginOption[];
|
|
14
18
|
/**
|
|
15
19
|
* Turns on SSR module proxying,
|
|
16
20
|
*/
|
|
17
21
|
export declare function ssrPlugin(): PluginOption;
|
|
18
22
|
export declare function corePlugins(args: Args): PluginOption[];
|
|
23
|
+
export declare function storybookVitePlugins(args: Args): PluginOption[];
|
|
19
24
|
export declare function getViteConfig(args: Args): InlineConfig;
|
|
25
|
+
export {};
|