eddev 2.0.0-beta.9 → 2.0.0-beta.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/entry/HydrationOverlay.d.ts +1 -0
- package/dist/app/entry/HydrationOverlay.js +2 -0
- package/dist/app/entry/MetaTags.d.ts +7 -0
- package/dist/app/entry/MetaTags.js +17 -0
- package/dist/app/entry/boot-admin.js +11 -6
- package/dist/app/entry/hydration-script.d.ts +1 -0
- package/dist/app/entry/hydration-script.js +18 -0
- package/dist/app/entry/spa-root.js +4 -5
- package/dist/app/entry/ssr-root-client.d.ts +3 -1
- package/dist/app/entry/ssr-root-client.js +24 -8
- package/dist/app/entry/ssr-root.d.ts +5 -4
- package/dist/app/entry/ssr-root.js +21 -20
- package/dist/app/lib/admin/index.d.ts +2 -2
- package/dist/app/lib/admin/index.js +2 -2
- package/dist/app/lib/admin/installFieldTypes.js +1 -1
- package/dist/app/lib/admin/runWidgets.js +1 -1
- package/dist/app/lib/blocks/ContentBlocks.d.ts +1 -1
- package/dist/app/lib/blocks/ContentBlocks.js +5 -5
- package/dist/app/lib/blocks/EditableText.d.ts +1 -1
- package/dist/app/lib/blocks/EditableText.js +3 -3
- package/dist/app/lib/blocks/InnerBlocks.d.ts +13 -3
- package/dist/app/lib/blocks/InnerBlocks.js +13 -5
- package/dist/app/lib/blocks/block-utils.d.ts +2 -2
- package/dist/app/lib/blocks/block-utils.js +2 -2
- package/dist/app/lib/blocks/editor/EditorHighlights.d.ts +7 -0
- package/dist/app/lib/blocks/editor/EditorHighlights.js +130 -0
- package/dist/app/lib/blocks/editor/EditorSupport.js +4 -5
- package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts +1 -1
- package/dist/app/lib/blocks/editor/editor-config.d.ts +17 -4
- package/dist/app/lib/blocks/editor/editor-config.js +21 -9
- package/dist/app/lib/blocks/editor/installGutenbergHooks.js +20 -14
- package/dist/app/lib/blocks/editor/root-blocks.d.ts +6 -0
- package/dist/app/lib/blocks/editor/root-blocks.js +30 -0
- package/dist/app/lib/blocks/editor/usePostEditor.d.ts +1 -1
- package/dist/app/lib/blocks/index.d.ts +9 -9
- package/dist/app/lib/blocks/index.js +9 -9
- package/dist/app/lib/blocks/inline-editing.d.ts +1 -1
- package/dist/app/lib/blocks/inline-editing.js +7 -5
- package/dist/app/lib/devtools/components/BreakpointIndicator.js +1 -1
- package/dist/app/lib/devtools/components/DevUI.js +4 -3
- package/dist/app/lib/devtools/components/GridIndicator.d.ts +1 -0
- package/dist/app/lib/devtools/components/GridIndicator.js +29 -0
- package/dist/app/lib/devtools/hooks/usePersistState.d.ts +1 -1
- package/dist/app/lib/devtools/hooks/usePersistState.js +11 -2
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts +1014 -1014
- package/dist/app/lib/devtools/hooks/useTailwind.js +1 -1
- package/dist/app/lib/devtools/index.d.ts +1 -1
- package/dist/app/lib/devtools/index.js +1 -1
- package/dist/app/lib/devtools/loader.js +8 -7
- package/dist/app/lib/devtools/useQueryDebug.d.ts +7 -1
- package/dist/app/lib/devtools/useQueryDebug.js +5 -8
- package/dist/app/lib/dynamic/dynamic.d.ts +1 -1
- package/dist/app/lib/dynamic/dynamic.js +5 -1
- package/dist/app/lib/dynamic/index.d.ts +1 -1
- package/dist/app/lib/dynamic/index.js +1 -1
- package/dist/app/lib/hooks/index.d.ts +4 -5
- package/dist/app/lib/hooks/index.js +4 -5
- package/dist/app/lib/hooks/queryUtils.d.ts +37 -3
- package/dist/app/lib/hooks/queryUtils.js +66 -26
- package/dist/app/lib/hooks/useAppData.js +1 -1
- package/dist/app/lib/hooks/useRPC.d.ts +0 -4
- package/dist/app/lib/hooks/useRPC.js +1 -8
- package/dist/app/lib/internal/finalize-rpc.d.ts +17 -0
- package/dist/app/lib/internal/finalize-rpc.js +3 -0
- package/dist/app/lib/internal/index.d.ts +5 -4
- package/dist/app/lib/internal/index.js +5 -4
- package/dist/app/lib/internal/read-admin-manifest.d.ts +1 -1
- package/dist/app/lib/legacy-stitches/createStitches.d.ts +21 -21
- package/dist/app/lib/legacy-stitches/createStitches.js +1 -1
- package/dist/app/lib/legacy-stitches/index.d.ts +1 -1
- package/dist/app/lib/legacy-stitches/index.js +1 -1
- package/dist/app/lib/routing/components/BackButton.d.ts +49 -0
- package/dist/app/lib/routing/components/BackButton.js +47 -0
- package/dist/app/lib/routing/components/BrowserRouter.d.ts +4 -1
- package/dist/app/lib/routing/components/BrowserRouter.js +95 -19
- package/dist/app/lib/routing/components/ClientOnly.d.ts +1 -1
- package/dist/app/lib/routing/components/ClientOnly.js +1 -1
- package/dist/app/lib/routing/components/Link.d.ts +1 -0
- package/dist/app/lib/routing/components/Link.js +11 -12
- package/dist/app/lib/routing/components/RouteRenderer.d.ts +1 -1
- package/dist/app/lib/routing/components/RouteRenderer.js +7 -6
- package/dist/app/lib/routing/components/SSRRouter.d.ts +2 -2
- package/dist/app/lib/routing/components/SSRRouter.js +5 -6
- package/dist/app/lib/routing/components/ScrollRestoration.js +5 -2
- package/dist/app/lib/routing/context.d.ts +8 -5
- package/dist/app/lib/routing/context.js +13 -96
- package/dist/app/lib/routing/hooks/useRestorableState.d.ts +2 -1
- package/dist/app/lib/routing/hooks/useRestorableState.js +2 -1
- package/dist/app/lib/routing/hooks/useRoute.d.ts +16 -1
- package/dist/app/lib/routing/hooks/useRoute.js +22 -1
- package/dist/app/lib/routing/hooks/useRouteMeta.d.ts +5 -0
- package/dist/app/lib/routing/hooks/useRouteMeta.js +9 -0
- package/dist/app/lib/routing/hooks/useRouteTransition.d.ts +1 -1
- package/dist/app/lib/routing/hooks/useRouteTransition.js +1 -1
- package/dist/app/lib/routing/hooks/useRouter.d.ts +1 -1
- package/dist/app/lib/routing/hooks/useRouter.js +1 -1
- package/dist/app/lib/routing/hooks/useRouterEvents.d.ts +1 -1
- package/dist/app/lib/routing/hooks/useRouterEvents.js +1 -1
- package/dist/app/lib/routing/hooks/useRouterState.d.ts +1 -1
- package/dist/app/lib/routing/hooks/useRouterState.js +1 -1
- package/dist/app/lib/routing/hooks/useSearchParams.js +2 -2
- package/dist/app/lib/routing/index.d.ts +14 -13
- package/dist/app/lib/routing/index.js +14 -13
- package/dist/app/lib/routing/loader.d.ts +2 -2
- package/dist/app/lib/routing/loader.js +20 -11
- package/dist/app/lib/routing/types.d.ts +36 -10
- package/dist/app/lib/routing/utils.d.ts +5 -2
- package/dist/app/lib/routing/utils.js +37 -4
- package/dist/app/lib/{hooks → runtime}/apiConfig.d.ts +6 -2
- package/dist/app/lib/runtime/apiConfig.js +6 -0
- package/dist/app/lib/runtime/errorHandling.d.ts +39 -0
- package/dist/app/lib/runtime/errorHandling.js +6 -0
- package/dist/app/lib/runtime/index.d.ts +2 -0
- package/dist/app/lib/runtime/index.js +2 -0
- package/dist/app/lib/views/index.d.ts +1 -1
- package/dist/app/lib/views/index.js +1 -1
- package/dist/app/server/defineRouter.d.ts +2 -0
- package/dist/app/server/defineRouter.js +4 -0
- package/dist/app/server/index.d.ts +5 -3
- package/dist/app/server/index.js +5 -3
- package/dist/app/server/proxy-wp-admin.d.ts +1 -2
- package/dist/app/server/proxy-wp-admin.js +32 -14
- package/dist/app/server/render-ssr-page.d.ts +21 -2
- package/dist/app/server/render-ssr-page.js +143 -11
- package/dist/app/server/rpc.d.ts +56 -0
- package/dist/app/server/rpc.js +18 -0
- package/dist/app/server/server-context.d.ts +42 -4
- package/dist/app/server/server-context.js +196 -30
- package/dist/app/server/utils/replace-host.d.ts +1 -1
- package/dist/app/server/utils/replace-host.js +10 -2
- package/dist/app/server/utils/swr-cache.d.ts +4 -0
- package/dist/app/server/utils/swr-cache.js +31 -0
- package/dist/app/utils/APIProvider.d.ts +2 -0
- package/dist/app/utils/APIProvider.js +5 -0
- package/dist/app/utils/BlockErrorBoundary.d.ts +19 -0
- package/dist/app/utils/BlockErrorBoundary.js +38 -0
- package/dist/app/utils/ErrorMessage.d.ts +5 -0
- package/dist/app/utils/ErrorMessage.js +14 -0
- package/dist/app/utils/RouteErrorBoundary.d.ts +18 -0
- package/dist/app/utils/RouteErrorBoundary.js +38 -0
- package/dist/app/utils/asset-capture.d.ts +2 -0
- package/dist/app/utils/asset-capture.js +5 -0
- package/dist/app/utils/hydration-debugger.d.ts +13 -0
- package/dist/app/utils/hydration-debugger.js +11 -0
- package/dist/app/utils/query-client.d.ts +2 -0
- package/dist/app/utils/query-client.js +5 -1
- package/dist/app/utils/trpc-client.d.ts +2 -0
- package/dist/app/utils/trpc-client.js +39 -0
- package/dist/node/cli/cli-worker.js +10 -5
- package/dist/node/cli/cli.js +79 -11
- package/dist/node/cli/display/CLIApp.js +3 -6
- package/dist/node/cli/display/boot-cli-app.js +1 -1
- package/dist/node/cli/display/tools/CreateBlock.d.ts +1 -1
- package/dist/node/cli/display/tools/cli-tools.d.ts +1 -11
- package/dist/node/cli/display/tools/cli-tools.js +9 -9
- package/dist/node/cli/version.d.ts +1 -1
- package/dist/node/cli/version.js +1 -1
- package/dist/node/compiler/build-vinxi.js +3 -1
- package/dist/node/compiler/bundler.admin.d.ts +1 -1
- package/dist/node/compiler/bundler.admin.js +1 -1
- package/dist/node/compiler/bundler.frontend.js +1 -1
- package/dist/node/compiler/dev-server.js +10 -0
- package/dist/node/compiler/get-vite-config.d.ts +1 -0
- package/dist/node/compiler/get-vite-config.js +34 -11
- package/dist/node/compiler/vinxi-app.d.ts +12 -0
- package/dist/node/compiler/vinxi-app.js +139 -32
- package/dist/node/compiler/vinxi-codegen.js +321 -108
- package/dist/node/graphql/graphql-codegen.d.ts +11 -1
- package/dist/node/graphql/graphql-codegen.js +210 -33
- package/dist/node/graphql/graphql-schema-loader.d.ts +2 -1
- package/dist/node/graphql/graphql-schema-loader.js +5 -16
- package/dist/node/graphql/plugins/gql-plugin-queries.js +1 -1
- package/dist/node/graphql/query-files-loader.d.ts +3 -0
- package/dist/node/graphql/query-files-loader.js +5 -0
- package/dist/node/project/config.d.ts +159 -73
- package/dist/node/project/config.js +69 -20
- package/dist/node/project/env.d.ts +4 -0
- package/dist/node/project/env.js +1 -0
- package/dist/node/project/manifest/block-manifest.js +1 -0
- package/dist/node/project/manifest/manifest.d.ts +1 -0
- package/dist/node/project/manifest/manifest.js +14 -10
- package/dist/node/project/manifest/routes-manifest.d.ts +20 -0
- package/dist/node/project/manifest/routes-manifest.js +74 -0
- package/dist/node/project/manifest/view-manifest.js +1 -1
- package/dist/node/project/project.d.ts +9 -1
- package/dist/node/project/project.js +37 -6
- package/dist/node/project/wp-info.d.ts +1 -0
- package/dist/node/project/wp-info.js +13 -1
- package/dist/node/types/block-type.d.ts +25 -20
- package/dist/node/types/block-type.js +1 -0
- package/dist/node/types/view-type.d.ts +7 -7
- package/dist/node/utils/fetch-wp.d.ts +1 -0
- package/dist/node/utils/fetch-wp.js +27 -0
- package/dist/node/utils/fs-codegen.d.ts +2 -0
- package/dist/node/utils/fs-codegen.js +2 -1
- package/dist/node/utils/is-deploying.js +1 -1
- package/dist/node/utils/stateful-log.js +2 -0
- package/dist/node/utils/watch-file-tree.d.ts +17 -3
- package/dist/node/utils/watch-file-tree.js +12 -5
- package/package.json +17 -13
- package/types.app.d.ts +4 -2
- package/types.app.internal.d.ts +2 -2
- package/types.node.d.ts +3 -3
- package/dist/app/lib/blocks/ErrorBoundaryFrontend.d.ts +0 -15
- package/dist/app/lib/blocks/ErrorBoundaryFrontend.js +0 -35
- package/dist/app/lib/hooks/apiConfig.js +0 -4
- package/dist/app/lib/hooks/usePageLoad.d.ts +0 -6
- package/dist/app/lib/hooks/usePageLoad.js +0 -5
- package/dist/app/server/utils/index.html.d.ts +0 -2
- package/dist/app/server/utils/index.html.js +0 -14
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component, ErrorInfo, ReactNode } from "react";
|
|
2
|
+
import { BlocksContext, ContentBlock } from "../lib/blocks/ContentBlocks.js";
|
|
3
|
+
interface Props {
|
|
4
|
+
block: ContentBlock;
|
|
5
|
+
blockContext: BlocksContext;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
interface State {
|
|
9
|
+
hasError: boolean;
|
|
10
|
+
error?: Error;
|
|
11
|
+
errorInfo?: ErrorInfo;
|
|
12
|
+
}
|
|
13
|
+
export declare class BlockErrorBoundary extends Component<Props, State> {
|
|
14
|
+
state: State;
|
|
15
|
+
static getDerivedStateFromError(error: Error): State;
|
|
16
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
17
|
+
render(): ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Component } from "react";
|
|
3
|
+
import { errorHandling } from "../lib/runtime/errorHandling.js";
|
|
4
|
+
import { ErrorMessage } from "./ErrorMessage.js";
|
|
5
|
+
export class BlockErrorBoundary extends Component {
|
|
6
|
+
state = {
|
|
7
|
+
hasError: false,
|
|
8
|
+
};
|
|
9
|
+
static getDerivedStateFromError(error) {
|
|
10
|
+
// Update state so the next render will show the fallback UI.
|
|
11
|
+
return { hasError: true, error: error };
|
|
12
|
+
}
|
|
13
|
+
componentDidCatch(error, errorInfo) {
|
|
14
|
+
if (errorHandling.onReactError) {
|
|
15
|
+
errorHandling.onReactError({
|
|
16
|
+
type: "block",
|
|
17
|
+
block: this.props.block,
|
|
18
|
+
error,
|
|
19
|
+
componentStack: errorInfo.componentStack,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
if (this.state.hasError) {
|
|
25
|
+
const err = this.state.error;
|
|
26
|
+
let display = env.dev ? _jsx(ErrorMessage, { error: err }) : null;
|
|
27
|
+
if (errorHandling.renderFallback) {
|
|
28
|
+
display = errorHandling.renderFallback({
|
|
29
|
+
type: "block",
|
|
30
|
+
block: this.props.block,
|
|
31
|
+
error: err,
|
|
32
|
+
}, display);
|
|
33
|
+
}
|
|
34
|
+
return display;
|
|
35
|
+
}
|
|
36
|
+
return this.props.children;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function ErrorMessage({ error }) {
|
|
3
|
+
return (_jsx("pre", { style: {
|
|
4
|
+
backgroundColor: "#060309",
|
|
5
|
+
fontSize: "12px",
|
|
6
|
+
color: "#d92a0b",
|
|
7
|
+
outline: "1px solid #d92a0b",
|
|
8
|
+
outlineOffset: "-4px",
|
|
9
|
+
borderRadius: "6px",
|
|
10
|
+
padding: "12px 16px",
|
|
11
|
+
overflowX: "auto",
|
|
12
|
+
fontFamily: '"Roboto Mono", Menlo, monospace',
|
|
13
|
+
}, children: error.stack ?? String(error) }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Component, ErrorInfo, ReactNode } from "react";
|
|
2
|
+
import { RouteState } from "../lib/routing/types.js";
|
|
3
|
+
interface Props {
|
|
4
|
+
route: RouteState;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
interface State {
|
|
8
|
+
hasError: boolean;
|
|
9
|
+
error?: Error;
|
|
10
|
+
errorInfo?: ErrorInfo;
|
|
11
|
+
}
|
|
12
|
+
export declare class RouteErrorBoundary extends Component<Props, State> {
|
|
13
|
+
state: State;
|
|
14
|
+
static getDerivedStateFromError(error: Error): State;
|
|
15
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
16
|
+
render(): ReactNode;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Component } from "react";
|
|
3
|
+
import { errorHandling } from "../lib/runtime/errorHandling.js";
|
|
4
|
+
import { ErrorMessage } from "./ErrorMessage.js";
|
|
5
|
+
export class RouteErrorBoundary extends Component {
|
|
6
|
+
state = {
|
|
7
|
+
hasError: false,
|
|
8
|
+
};
|
|
9
|
+
static getDerivedStateFromError(error) {
|
|
10
|
+
// Update state so the next render will show the fallback UI.
|
|
11
|
+
return { hasError: true, error: error };
|
|
12
|
+
}
|
|
13
|
+
componentDidCatch(error, errorInfo) {
|
|
14
|
+
if (errorHandling.onReactError) {
|
|
15
|
+
errorHandling.onReactError({
|
|
16
|
+
type: "route",
|
|
17
|
+
route: this.props.route,
|
|
18
|
+
error,
|
|
19
|
+
componentStack: errorInfo.componentStack,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
if (this.state.hasError) {
|
|
25
|
+
const err = this.state.error;
|
|
26
|
+
let display = env.dev ? _jsx(ErrorMessage, { error: err }) : null;
|
|
27
|
+
if (errorHandling.renderFallback) {
|
|
28
|
+
display = errorHandling.renderFallback({
|
|
29
|
+
type: "route",
|
|
30
|
+
route: this.props.route,
|
|
31
|
+
error: err,
|
|
32
|
+
}, display);
|
|
33
|
+
}
|
|
34
|
+
return display;
|
|
35
|
+
}
|
|
36
|
+
return this.props.children;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -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,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();
|
|
@@ -138,6 +156,9 @@ program
|
|
|
138
156
|
.option("-s, --serverless", 'Build in "serverless" mode', false)
|
|
139
157
|
.option("--verbose", "Show extra debugging info", false)
|
|
140
158
|
.action(async (options) => {
|
|
159
|
+
process.env["NODE_ENV"] = "production";
|
|
160
|
+
/** Ignore self-signed certificate errors in dev mode */
|
|
161
|
+
// process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0"
|
|
141
162
|
init(options.verbose);
|
|
142
163
|
configureCliMode({
|
|
143
164
|
interactive: false,
|
|
@@ -155,18 +176,65 @@ program
|
|
|
155
176
|
});
|
|
156
177
|
const buildServerless = options.serverless || process.env.VERCEL;
|
|
157
178
|
if (buildServerless) {
|
|
179
|
+
// Verify that the we have access to the origin
|
|
180
|
+
const result = await project.verifyOriginAccess();
|
|
181
|
+
if (!result.success) {
|
|
182
|
+
console.error(result.message);
|
|
183
|
+
process.exit(1);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
158
186
|
await buildVinxi({
|
|
159
187
|
project,
|
|
160
188
|
console,
|
|
161
189
|
});
|
|
162
190
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
191
|
+
else {
|
|
192
|
+
const infoWriter = new BuildInfoWriter(project);
|
|
193
|
+
// Generate bootstrap files
|
|
194
|
+
const codegen = createVinxiCodegen({
|
|
195
|
+
mode: "production",
|
|
196
|
+
project: project,
|
|
197
|
+
serverless: false,
|
|
198
|
+
});
|
|
199
|
+
await codegen.run();
|
|
200
|
+
console.info("Building for SPA WordPress (Frontend and Admin)");
|
|
201
|
+
// Load the compiler
|
|
202
|
+
const admin = new AdminBundler(project, {
|
|
203
|
+
mode: "production",
|
|
204
|
+
});
|
|
205
|
+
const frontend = new FrontendBundler(project, {
|
|
206
|
+
mode: "production",
|
|
207
|
+
});
|
|
208
|
+
const graphql = new GraphQLGenerator(project, {
|
|
209
|
+
optimize: true,
|
|
210
|
+
});
|
|
211
|
+
await Promise.all([infoWriter.write(), admin.start(), frontend.start(), graphql.start()]);
|
|
212
|
+
console.log("Done building SPA WordPress");
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
program
|
|
216
|
+
.command("preview")
|
|
217
|
+
.description("Run a local production build, which was previously built with `eddev build --serverless`")
|
|
218
|
+
.option("--host", "Hostname to serve the application", "127.0.0.1")
|
|
219
|
+
.option("--port", "Port to serve the application", "3000")
|
|
220
|
+
.action(async (options) => {
|
|
221
|
+
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
222
|
+
process.env["NODE_ENV"] = "production";
|
|
223
|
+
process.env["HOST"] = options.host;
|
|
224
|
+
process.env["PORT"] = options.port;
|
|
225
|
+
init(options.verbose);
|
|
226
|
+
configureCliMode({
|
|
227
|
+
interactive: true,
|
|
228
|
+
readonly: false,
|
|
229
|
+
exitOnValidationError: true,
|
|
230
|
+
detailed: true,
|
|
231
|
+
verbose: options.verbose,
|
|
232
|
+
watch: false,
|
|
233
|
+
rootDir: process.cwd(),
|
|
234
|
+
});
|
|
235
|
+
const entry = ".output/server/index.mjs";
|
|
236
|
+
console.info("Looking for production serverless build in: " + entry + "...");
|
|
237
|
+
await import(join(process.cwd(), ".output/server/index.mjs"));
|
|
170
238
|
});
|
|
171
239
|
program
|
|
172
240
|
.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.89";
|
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.89";
|
|
@@ -9,14 +9,16 @@ export async function buildVinxi(opts) {
|
|
|
9
9
|
process.env.SERVER_TARGET ??
|
|
10
10
|
process.env.NITRO_PRESET ??
|
|
11
11
|
process.env.NITRO_TARGET ??
|
|
12
|
+
(process.env.VERCEL ? "vercel" : undefined) ??
|
|
12
13
|
(process.versions.bun !== undefined ? "bun" : "node-server");
|
|
13
14
|
const appConf = {
|
|
14
15
|
mode: "production",
|
|
15
16
|
origin: project.origin,
|
|
16
17
|
publicUrl: project.publicUrl,
|
|
17
18
|
rootDir: project.rootDir,
|
|
18
|
-
|
|
19
|
+
rpcBases: (await project.serverRoutes.get()).bases,
|
|
19
20
|
preset,
|
|
21
|
+
config: project.config,
|
|
20
22
|
};
|
|
21
23
|
const codegen = createVinxiCodegen({
|
|
22
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({
|