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.
Files changed (210) hide show
  1. package/dist/app/entry/HydrationOverlay.d.ts +1 -0
  2. package/dist/app/entry/HydrationOverlay.js +2 -0
  3. package/dist/app/entry/MetaTags.d.ts +7 -0
  4. package/dist/app/entry/MetaTags.js +17 -0
  5. package/dist/app/entry/boot-admin.js +11 -6
  6. package/dist/app/entry/hydration-script.d.ts +1 -0
  7. package/dist/app/entry/hydration-script.js +18 -0
  8. package/dist/app/entry/spa-root.js +4 -5
  9. package/dist/app/entry/ssr-root-client.d.ts +3 -1
  10. package/dist/app/entry/ssr-root-client.js +24 -8
  11. package/dist/app/entry/ssr-root.d.ts +5 -4
  12. package/dist/app/entry/ssr-root.js +21 -20
  13. package/dist/app/lib/admin/index.d.ts +2 -2
  14. package/dist/app/lib/admin/index.js +2 -2
  15. package/dist/app/lib/admin/installFieldTypes.js +1 -1
  16. package/dist/app/lib/admin/runWidgets.js +1 -1
  17. package/dist/app/lib/blocks/ContentBlocks.d.ts +1 -1
  18. package/dist/app/lib/blocks/ContentBlocks.js +5 -5
  19. package/dist/app/lib/blocks/EditableText.d.ts +1 -1
  20. package/dist/app/lib/blocks/EditableText.js +3 -3
  21. package/dist/app/lib/blocks/InnerBlocks.d.ts +13 -3
  22. package/dist/app/lib/blocks/InnerBlocks.js +13 -5
  23. package/dist/app/lib/blocks/block-utils.d.ts +2 -2
  24. package/dist/app/lib/blocks/block-utils.js +2 -2
  25. package/dist/app/lib/blocks/editor/EditorHighlights.d.ts +7 -0
  26. package/dist/app/lib/blocks/editor/EditorHighlights.js +130 -0
  27. package/dist/app/lib/blocks/editor/EditorSupport.js +4 -5
  28. package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts +1 -1
  29. package/dist/app/lib/blocks/editor/editor-config.d.ts +17 -4
  30. package/dist/app/lib/blocks/editor/editor-config.js +21 -9
  31. package/dist/app/lib/blocks/editor/installGutenbergHooks.js +20 -14
  32. package/dist/app/lib/blocks/editor/root-blocks.d.ts +6 -0
  33. package/dist/app/lib/blocks/editor/root-blocks.js +30 -0
  34. package/dist/app/lib/blocks/editor/usePostEditor.d.ts +1 -1
  35. package/dist/app/lib/blocks/index.d.ts +9 -9
  36. package/dist/app/lib/blocks/index.js +9 -9
  37. package/dist/app/lib/blocks/inline-editing.d.ts +1 -1
  38. package/dist/app/lib/blocks/inline-editing.js +7 -5
  39. package/dist/app/lib/devtools/components/BreakpointIndicator.js +1 -1
  40. package/dist/app/lib/devtools/components/DevUI.js +4 -3
  41. package/dist/app/lib/devtools/components/GridIndicator.d.ts +1 -0
  42. package/dist/app/lib/devtools/components/GridIndicator.js +29 -0
  43. package/dist/app/lib/devtools/hooks/usePersistState.d.ts +1 -1
  44. package/dist/app/lib/devtools/hooks/usePersistState.js +11 -2
  45. package/dist/app/lib/devtools/hooks/useTailwind.d.ts +1014 -1014
  46. package/dist/app/lib/devtools/hooks/useTailwind.js +1 -1
  47. package/dist/app/lib/devtools/index.d.ts +1 -1
  48. package/dist/app/lib/devtools/index.js +1 -1
  49. package/dist/app/lib/devtools/loader.js +8 -7
  50. package/dist/app/lib/devtools/useQueryDebug.d.ts +7 -1
  51. package/dist/app/lib/devtools/useQueryDebug.js +5 -8
  52. package/dist/app/lib/dynamic/dynamic.d.ts +1 -1
  53. package/dist/app/lib/dynamic/dynamic.js +5 -1
  54. package/dist/app/lib/dynamic/index.d.ts +1 -1
  55. package/dist/app/lib/dynamic/index.js +1 -1
  56. package/dist/app/lib/hooks/index.d.ts +4 -5
  57. package/dist/app/lib/hooks/index.js +4 -5
  58. package/dist/app/lib/hooks/queryUtils.d.ts +37 -3
  59. package/dist/app/lib/hooks/queryUtils.js +66 -26
  60. package/dist/app/lib/hooks/useAppData.js +1 -1
  61. package/dist/app/lib/hooks/useRPC.d.ts +0 -4
  62. package/dist/app/lib/hooks/useRPC.js +1 -8
  63. package/dist/app/lib/internal/finalize-rpc.d.ts +17 -0
  64. package/dist/app/lib/internal/finalize-rpc.js +3 -0
  65. package/dist/app/lib/internal/index.d.ts +5 -4
  66. package/dist/app/lib/internal/index.js +5 -4
  67. package/dist/app/lib/internal/read-admin-manifest.d.ts +1 -1
  68. package/dist/app/lib/legacy-stitches/createStitches.d.ts +21 -21
  69. package/dist/app/lib/legacy-stitches/createStitches.js +1 -1
  70. package/dist/app/lib/legacy-stitches/index.d.ts +1 -1
  71. package/dist/app/lib/legacy-stitches/index.js +1 -1
  72. package/dist/app/lib/routing/components/BackButton.d.ts +49 -0
  73. package/dist/app/lib/routing/components/BackButton.js +47 -0
  74. package/dist/app/lib/routing/components/BrowserRouter.d.ts +4 -1
  75. package/dist/app/lib/routing/components/BrowserRouter.js +95 -19
  76. package/dist/app/lib/routing/components/ClientOnly.d.ts +1 -1
  77. package/dist/app/lib/routing/components/ClientOnly.js +1 -1
  78. package/dist/app/lib/routing/components/Link.d.ts +1 -0
  79. package/dist/app/lib/routing/components/Link.js +11 -12
  80. package/dist/app/lib/routing/components/RouteRenderer.d.ts +1 -1
  81. package/dist/app/lib/routing/components/RouteRenderer.js +7 -6
  82. package/dist/app/lib/routing/components/SSRRouter.d.ts +2 -2
  83. package/dist/app/lib/routing/components/SSRRouter.js +5 -6
  84. package/dist/app/lib/routing/components/ScrollRestoration.js +5 -2
  85. package/dist/app/lib/routing/context.d.ts +8 -5
  86. package/dist/app/lib/routing/context.js +13 -96
  87. package/dist/app/lib/routing/hooks/useRestorableState.d.ts +2 -1
  88. package/dist/app/lib/routing/hooks/useRestorableState.js +2 -1
  89. package/dist/app/lib/routing/hooks/useRoute.d.ts +16 -1
  90. package/dist/app/lib/routing/hooks/useRoute.js +22 -1
  91. package/dist/app/lib/routing/hooks/useRouteMeta.d.ts +5 -0
  92. package/dist/app/lib/routing/hooks/useRouteMeta.js +9 -0
  93. package/dist/app/lib/routing/hooks/useRouteTransition.d.ts +1 -1
  94. package/dist/app/lib/routing/hooks/useRouteTransition.js +1 -1
  95. package/dist/app/lib/routing/hooks/useRouter.d.ts +1 -1
  96. package/dist/app/lib/routing/hooks/useRouter.js +1 -1
  97. package/dist/app/lib/routing/hooks/useRouterEvents.d.ts +1 -1
  98. package/dist/app/lib/routing/hooks/useRouterEvents.js +1 -1
  99. package/dist/app/lib/routing/hooks/useRouterState.d.ts +1 -1
  100. package/dist/app/lib/routing/hooks/useRouterState.js +1 -1
  101. package/dist/app/lib/routing/hooks/useSearchParams.js +2 -2
  102. package/dist/app/lib/routing/index.d.ts +14 -13
  103. package/dist/app/lib/routing/index.js +14 -13
  104. package/dist/app/lib/routing/loader.d.ts +2 -2
  105. package/dist/app/lib/routing/loader.js +20 -11
  106. package/dist/app/lib/routing/types.d.ts +36 -10
  107. package/dist/app/lib/routing/utils.d.ts +5 -2
  108. package/dist/app/lib/routing/utils.js +37 -4
  109. package/dist/app/lib/{hooks → runtime}/apiConfig.d.ts +6 -2
  110. package/dist/app/lib/runtime/apiConfig.js +6 -0
  111. package/dist/app/lib/runtime/errorHandling.d.ts +39 -0
  112. package/dist/app/lib/runtime/errorHandling.js +6 -0
  113. package/dist/app/lib/runtime/index.d.ts +2 -0
  114. package/dist/app/lib/runtime/index.js +2 -0
  115. package/dist/app/lib/views/index.d.ts +1 -1
  116. package/dist/app/lib/views/index.js +1 -1
  117. package/dist/app/server/defineRouter.d.ts +2 -0
  118. package/dist/app/server/defineRouter.js +4 -0
  119. package/dist/app/server/index.d.ts +5 -3
  120. package/dist/app/server/index.js +5 -3
  121. package/dist/app/server/proxy-wp-admin.d.ts +1 -2
  122. package/dist/app/server/proxy-wp-admin.js +32 -14
  123. package/dist/app/server/render-ssr-page.d.ts +21 -2
  124. package/dist/app/server/render-ssr-page.js +143 -11
  125. package/dist/app/server/rpc.d.ts +56 -0
  126. package/dist/app/server/rpc.js +18 -0
  127. package/dist/app/server/server-context.d.ts +42 -4
  128. package/dist/app/server/server-context.js +196 -30
  129. package/dist/app/server/utils/replace-host.d.ts +1 -1
  130. package/dist/app/server/utils/replace-host.js +10 -2
  131. package/dist/app/server/utils/swr-cache.d.ts +4 -0
  132. package/dist/app/server/utils/swr-cache.js +31 -0
  133. package/dist/app/utils/APIProvider.d.ts +2 -0
  134. package/dist/app/utils/APIProvider.js +5 -0
  135. package/dist/app/utils/BlockErrorBoundary.d.ts +19 -0
  136. package/dist/app/utils/BlockErrorBoundary.js +38 -0
  137. package/dist/app/utils/ErrorMessage.d.ts +5 -0
  138. package/dist/app/utils/ErrorMessage.js +14 -0
  139. package/dist/app/utils/RouteErrorBoundary.d.ts +18 -0
  140. package/dist/app/utils/RouteErrorBoundary.js +38 -0
  141. package/dist/app/utils/asset-capture.d.ts +2 -0
  142. package/dist/app/utils/asset-capture.js +5 -0
  143. package/dist/app/utils/hydration-debugger.d.ts +13 -0
  144. package/dist/app/utils/hydration-debugger.js +11 -0
  145. package/dist/app/utils/query-client.d.ts +2 -0
  146. package/dist/app/utils/query-client.js +5 -1
  147. package/dist/app/utils/trpc-client.d.ts +2 -0
  148. package/dist/app/utils/trpc-client.js +39 -0
  149. package/dist/node/cli/cli-worker.js +10 -5
  150. package/dist/node/cli/cli.js +79 -11
  151. package/dist/node/cli/display/CLIApp.js +3 -6
  152. package/dist/node/cli/display/boot-cli-app.js +1 -1
  153. package/dist/node/cli/display/tools/CreateBlock.d.ts +1 -1
  154. package/dist/node/cli/display/tools/cli-tools.d.ts +1 -11
  155. package/dist/node/cli/display/tools/cli-tools.js +9 -9
  156. package/dist/node/cli/version.d.ts +1 -1
  157. package/dist/node/cli/version.js +1 -1
  158. package/dist/node/compiler/build-vinxi.js +3 -1
  159. package/dist/node/compiler/bundler.admin.d.ts +1 -1
  160. package/dist/node/compiler/bundler.admin.js +1 -1
  161. package/dist/node/compiler/bundler.frontend.js +1 -1
  162. package/dist/node/compiler/dev-server.js +10 -0
  163. package/dist/node/compiler/get-vite-config.d.ts +1 -0
  164. package/dist/node/compiler/get-vite-config.js +34 -11
  165. package/dist/node/compiler/vinxi-app.d.ts +12 -0
  166. package/dist/node/compiler/vinxi-app.js +139 -32
  167. package/dist/node/compiler/vinxi-codegen.js +321 -108
  168. package/dist/node/graphql/graphql-codegen.d.ts +11 -1
  169. package/dist/node/graphql/graphql-codegen.js +210 -33
  170. package/dist/node/graphql/graphql-schema-loader.d.ts +2 -1
  171. package/dist/node/graphql/graphql-schema-loader.js +5 -16
  172. package/dist/node/graphql/plugins/gql-plugin-queries.js +1 -1
  173. package/dist/node/graphql/query-files-loader.d.ts +3 -0
  174. package/dist/node/graphql/query-files-loader.js +5 -0
  175. package/dist/node/project/config.d.ts +159 -73
  176. package/dist/node/project/config.js +69 -20
  177. package/dist/node/project/env.d.ts +4 -0
  178. package/dist/node/project/env.js +1 -0
  179. package/dist/node/project/manifest/block-manifest.js +1 -0
  180. package/dist/node/project/manifest/manifest.d.ts +1 -0
  181. package/dist/node/project/manifest/manifest.js +14 -10
  182. package/dist/node/project/manifest/routes-manifest.d.ts +20 -0
  183. package/dist/node/project/manifest/routes-manifest.js +74 -0
  184. package/dist/node/project/manifest/view-manifest.js +1 -1
  185. package/dist/node/project/project.d.ts +9 -1
  186. package/dist/node/project/project.js +37 -6
  187. package/dist/node/project/wp-info.d.ts +1 -0
  188. package/dist/node/project/wp-info.js +13 -1
  189. package/dist/node/types/block-type.d.ts +25 -20
  190. package/dist/node/types/block-type.js +1 -0
  191. package/dist/node/types/view-type.d.ts +7 -7
  192. package/dist/node/utils/fetch-wp.d.ts +1 -0
  193. package/dist/node/utils/fetch-wp.js +27 -0
  194. package/dist/node/utils/fs-codegen.d.ts +2 -0
  195. package/dist/node/utils/fs-codegen.js +2 -1
  196. package/dist/node/utils/is-deploying.js +1 -1
  197. package/dist/node/utils/stateful-log.js +2 -0
  198. package/dist/node/utils/watch-file-tree.d.ts +17 -3
  199. package/dist/node/utils/watch-file-tree.js +12 -5
  200. package/package.json +17 -13
  201. package/types.app.d.ts +4 -2
  202. package/types.app.internal.d.ts +2 -2
  203. package/types.node.d.ts +3 -3
  204. package/dist/app/lib/blocks/ErrorBoundaryFrontend.d.ts +0 -15
  205. package/dist/app/lib/blocks/ErrorBoundaryFrontend.js +0 -35
  206. package/dist/app/lib/hooks/apiConfig.js +0 -4
  207. package/dist/app/lib/hooks/usePageLoad.d.ts +0 -6
  208. package/dist/app/lib/hooks/usePageLoad.js +0 -5
  209. package/dist/app/server/utils/index.html.d.ts +0 -2
  210. package/dist/app/server/utils/index.html.js +0 -14
@@ -0,0 +1,2 @@
1
+ import { PropsWithChildren } from "react";
2
+ export declare function APIProvider(props: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { QueryProvider } from "./query-client.js";
3
+ export function APIProvider(props) {
4
+ return _jsx(QueryProvider, { children: props.children });
5
+ }
@@ -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,5 @@
1
+ type Props = {
2
+ error: Error;
3
+ };
4
+ export declare function ErrorMessage({ error }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ export declare const AssetCaptureContext: import("react").Context<Set<string>>;
2
+ export declare const useAssetCapture: () => Set<string>;
@@ -0,0 +1,5 @@
1
+ import { createContext, useContext } from "react";
2
+ export const AssetCaptureContext = createContext(new Set());
3
+ export const useAssetCapture = () => {
4
+ return useContext(AssetCaptureContext);
5
+ };
@@ -0,0 +1,13 @@
1
+ export type HydrationErrorSnapshot = {
2
+ html: string;
3
+ error: Error;
4
+ info: any;
5
+ };
6
+ export declare const hydrationDebug: {
7
+ initialHTML: string;
8
+ events: HydrationErrorSnapshot[];
9
+ add(item: {
10
+ error: Error;
11
+ info: any;
12
+ }): void;
13
+ };
@@ -0,0 +1,11 @@
1
+ import { proxy } from "valtio";
2
+ export const hydrationDebug = proxy({
3
+ initialHTML: "",
4
+ events: [],
5
+ add(item) {
6
+ hydrationDebug.events.push({
7
+ html: document.querySelector("#_app")?.innerHTML ?? "",
8
+ ...item,
9
+ });
10
+ },
11
+ });
@@ -1,2 +1,4 @@
1
1
  import { QueryClient } from "@tanstack/react-query";
2
+ import { PropsWithChildren } from "react";
2
3
  export declare function getQueryClient(): QueryClient;
4
+ export declare function QueryProvider(props: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
- import { QueryClient } from "@tanstack/react-query";
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,2 @@
1
+ import { TRPCUntypedClient } from "@trpc/client";
2
+ export declare function getRPCClient(): TRPCUntypedClient<any>;
@@ -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
  }
@@ -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
- // Load the compiler
164
- // new AdminBundler(project, {
165
- // mode: "development",
166
- // })
167
- // new FrontendBundler(project, {
168
- // mode: "production",
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, matches.map((item, index) => {
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);
@@ -5,6 +5,6 @@ export function bootCLIUI(props) {
5
5
  console.clear();
6
6
  render(_jsx(CLIApp, { ...props }), {
7
7
  exitOnCtrlC: true,
8
- patchConsole: true,
8
+ patchConsole: false,
9
9
  });
10
10
  }
@@ -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
- getText: (tool) => [tool.name, ...(tool.keywords ? tool.keywords : [])],
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
- 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 }));
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.9";
1
+ export declare const VERSION = "2.0.0-beta.89";
@@ -1 +1 @@
1
- export const VERSION = "2.0.0-beta.9";
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
- // log: console,
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",
@@ -8,6 +8,6 @@ export declare class AdminBundler {
8
8
  project: Project;
9
9
  opts: Options;
10
10
  constructor(project: Project, opts: Options);
11
- protected start(): Promise<void>;
11
+ start(): Promise<void>;
12
12
  }
13
13
  export {};
@@ -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({