eddev 2.0.0-beta.68 → 2.0.0-beta.70

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.
@@ -4,7 +4,6 @@ import { installEDGutenbergHooks } from "../lib/blocks/editor/installGutenbergHo
4
4
  export default function bootAdmin() {
5
5
  console.log("Booting admin");
6
6
  if (window.name === "editor-canvas") {
7
- console.log("In canvas");
8
7
  }
9
8
  else {
10
9
  installEDGutenbergHooks();
@@ -7,7 +7,7 @@ export function EditableText({ id, as, appendOnEnter, store, ...props }) {
7
7
  if (!readOnly) {
8
8
  const [value, setValue] = useValueStore(store ?? id);
9
9
  const appendBlocks = useBlockAppender();
10
- return (_jsx(wp.blockEditor.RichText, { ...props, tagName: as, value: value || "", onChange: setValue, inlineToolbar: props.inlineToolbar, disableLineBreaks: props.disableLineBreaks, onKeyDownCapture: (e) => {
10
+ return (_jsx(wp.blockEditor.RichText, { ...props, placeholder: props.placeholder ?? props.defaultValue, tagName: as, value: value || "", onChange: setValue, inlineToolbar: props.inlineToolbar, disableLineBreaks: props.disableLineBreaks, onKeyDownCapture: (e) => {
11
11
  if (e.key === "Enter" && appendOnEnter && appendBlocks) {
12
12
  appendBlocks([
13
13
  wp.blocks.createBlock(typeof appendOnEnter === "string" ? appendOnEnter : "core/paragraph"),
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from "react";
2
+ type Props = PropsWithChildren<{
3
+ enabled: boolean;
4
+ clientId: string;
5
+ }>;
6
+ export declare function EditorHighlights(props: Props): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,130 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from "react";
3
+ export function EditorHighlights(props) {
4
+ const ref = useRef(null);
5
+ const [controller, setController] = useState(null);
6
+ // wp.data.select('core/editor').isBlockSelected
7
+ // const isSelected = wp.data.useSelect(
8
+ // (select) => (select("core/editor") as any).isBlockSelected(props.clientId),
9
+ // [props.clientId]
10
+ // )
11
+ useEffect(() => {
12
+ if (!props.enabled)
13
+ return;
14
+ const controller = new HighlightController(ref.current);
15
+ setController(controller);
16
+ return () => controller.teardown();
17
+ }, [props.enabled]);
18
+ useEffect(() => {
19
+ if (controller) {
20
+ controller.isSelected = false;
21
+ controller.updateClasses();
22
+ controller.update();
23
+ }
24
+ }, [controller, false]);
25
+ return (_jsx("div", { ref: ref, style: { display: "contents" }, onPointerEnter: () => controller?.enable(), onPointerLeave: () => controller?.disable(), children: props.children }));
26
+ }
27
+ class HighlightController {
28
+ root;
29
+ enabled = false;
30
+ disposers = [];
31
+ elements = new Map();
32
+ block = null;
33
+ isSelected = false;
34
+ constructor(root) {
35
+ this.root = root;
36
+ }
37
+ setup() {
38
+ this.teardown();
39
+ const updateElements = () => {
40
+ let editables = Array.from(this.root.querySelectorAll("[contenteditable=true], .editable-slot"));
41
+ let childBlocks = Array.from(this.root.querySelectorAll(".wp-block"));
42
+ const childIsSelected = this.root.querySelectorAll(".editor-highlighter-root-selected").length > 0;
43
+ this.block = childBlocks[0];
44
+ childBlocks = childBlocks.slice(1);
45
+ editables = childIsSelected
46
+ ? []
47
+ : editables.filter((element) => !childBlocks.some((block) => block.contains(element)));
48
+ let changed = false;
49
+ for (const [el, item] of this.elements) {
50
+ if (!editables.includes(el)) {
51
+ item.observer.disconnect();
52
+ item.overlay.remove();
53
+ this.elements.delete(el);
54
+ changed = true;
55
+ }
56
+ }
57
+ for (let el of editables) {
58
+ if (!this.elements.has(el)) {
59
+ const observer = new ResizeObserver(() => this.update());
60
+ observer.observe(el);
61
+ this.elements.set(el, {
62
+ observer,
63
+ bounds: el.getBoundingClientRect(),
64
+ overlay: this.createOverlay(el),
65
+ });
66
+ changed = true;
67
+ }
68
+ }
69
+ if (changed) {
70
+ this.update();
71
+ this.updateClasses();
72
+ }
73
+ };
74
+ const mutationObserver = new MutationObserver(() => {
75
+ updateElements();
76
+ });
77
+ updateElements();
78
+ mutationObserver.observe(this.root, { childList: true, subtree: true });
79
+ this.disposers.push(() => {
80
+ mutationObserver.disconnect();
81
+ for (const item of this.elements.values()) {
82
+ item.observer.disconnect();
83
+ item.overlay.remove();
84
+ }
85
+ this.elements = new Map();
86
+ });
87
+ }
88
+ updateClasses() {
89
+ for (const item of this.elements.values()) {
90
+ item.overlay.classList.toggle("editor-highlight-selected", this.isSelected);
91
+ }
92
+ this.root.classList.toggle("editor-highlighter-root-selected", this.enabled);
93
+ }
94
+ createOverlay(target) {
95
+ const el = document.createElement("div");
96
+ el.style.position = "absolute";
97
+ el.style.pointerEvents = "none";
98
+ el.style.zIndex = "20";
99
+ el.className = "editor-highlight";
100
+ this.block.appendChild(el);
101
+ return el;
102
+ }
103
+ teardown() {
104
+ this.disposers.forEach((dispose) => dispose());
105
+ }
106
+ enable() {
107
+ this.enabled = true;
108
+ this.setup();
109
+ this.update();
110
+ this.updateClasses();
111
+ }
112
+ disable() {
113
+ this.enabled = false;
114
+ this.teardown();
115
+ this.update();
116
+ this.updateClasses();
117
+ }
118
+ update() {
119
+ if (!this.block)
120
+ return;
121
+ const rootBounds = this.block.getBoundingClientRect();
122
+ for (const [el, item] of this.elements) {
123
+ const bounds = el.getBoundingClientRect();
124
+ item.overlay.style.left = bounds.left - rootBounds.left + "px";
125
+ item.overlay.style.top = bounds.top - rootBounds.top + "px";
126
+ item.overlay.style.width = bounds.width + "px";
127
+ item.overlay.style.height = bounds.height + "px";
128
+ }
129
+ }
130
+ }
@@ -7,6 +7,7 @@ import { BlockContext, EditableBlock } from "./EditorSupport.js";
7
7
  import { blocksByTag } from "./blocks-by-tag.js";
8
8
  import { editorConfigStore, getEditingPostInfo, watchEditorTemplate } from "./editor-config.js";
9
9
  import { rootBlocks } from "./root-blocks.js";
10
+ import { EditorHighlights } from "./EditorHighlights.js";
10
11
  function listenForHandleResize() {
11
12
  let interval = setInterval(() => {
12
13
  let viewportTarget = document.querySelector(".interface-interface-skeleton__content");
@@ -66,6 +67,7 @@ export function installEDGutenbergHooks() {
66
67
  };
67
68
  // Add an 'inline' object attribute, which will hold all inline contents
68
69
  item.attributes.inline = { type: "object" };
70
+ item.attributes.values = { type: "object" };
69
71
  item.attributes.isFromTemplate = { type: "boolean" };
70
72
  item.supports.customClassName = false;
71
73
  item.edit = function (props) {
@@ -87,7 +89,7 @@ export function installEDGutenbergHooks() {
87
89
  }, []);
88
90
  return (_jsx(BlockContext.Provider, { value: { name, props }, children: _jsx(InlineEditingContextProvider, { values: props.attributes.inline || {}, innerBlocks: children, block: [name, props], index: index ?? -1, onChange: (attrs) => {
89
91
  props.setAttributes({ ...props.attributes, inline: attrs });
90
- }, insertBlocksAfter: props.insertBlocksAfter, children: edit.call(self, props) }) }));
92
+ }, insertBlocksAfter: props.insertBlocksAfter, children: _jsx(EditorHighlights, { enabled: true, clientId: props.clientId, children: edit.call(self, props) }) }) }));
91
93
  };
92
94
  }
93
95
  // Find PHP-defined 'tags' for core blocks.
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect } from "react";
2
+ import { useEffect, useLayoutEffect } from "react";
3
3
  import { usePersistState } from "../hooks/usePersistState.js";
4
4
  export function GridIndicator() {
5
5
  const [enabled, setEnabled] = usePersistState("gridOverlayEnabled", false);
@@ -18,7 +18,10 @@ export function GridIndicator() {
18
18
  for (let i = 0; i < 12; i++) {
19
19
  cols.push(_jsx("div", { style: { height: "100%", backgroundColor: "rgba(255,0,0,0.1)" } }));
20
20
  }
21
+ useLayoutEffect(() => {
22
+ document.documentElement.classList.toggle("debug-grid", enabled);
23
+ }, [enabled]);
21
24
  if (!enabled)
22
25
  return null;
23
- return (_jsx("div", { style: { position: "fixed", inset: 0, zIndex: 999999999, pointerEvents: "none" }, children: _jsx("div", { className: "grid-auto", style: { height: "100%" }, children: cols }) }));
26
+ return (_jsx("div", { style: { position: "fixed", inset: 0, zIndex: 999999999, pointerEvents: "none" }, children: _jsx("div", { className: "grid-auto debug-display", style: { height: "100%" }, children: cols }) }));
24
27
  }
@@ -214,7 +214,7 @@ export function BrowserRouter(props) {
214
214
  hash: link.hash,
215
215
  search: "",
216
216
  query: link.query,
217
- pathname: link.pathname,
217
+ pathname: data.canonical ?? link.pathname,
218
218
  view: data.view,
219
219
  props: data.viewData?.data ?? {},
220
220
  component: lazyComponent,
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useMemo } from "react";
3
- import { parseURL, resolveURL, withoutTrailingSlash } from "ufo";
3
+ import { parseURL, resolveURL, withoutTrailingSlash, withTrailingSlash } from "ufo";
4
4
  import { useIsSSR } from "../hooks/useIsSSR.js";
5
5
  import { useRouter } from "../hooks/useRouter.js";
6
6
  import { isSameOrigin } from "../utils.js";
@@ -17,7 +17,7 @@ export const Link = forwardRef(({ preferBack, ...props }, ref) => {
17
17
  else {
18
18
  const router = useRouter();
19
19
  const state = useLinkState(props.href ?? "");
20
- return (_jsx(Comp, { ref: ref, "data-active": state.active ?? undefined, "data-child-active": state.childActive ?? undefined, "data-pending": state.pending ?? undefined, ...props, href: props.href ?? undefined, onMouseEnter: (e) => {
20
+ return (_jsx(Comp, { ref: ref, "data-active": state.active ?? undefined, "data-child-active": state.childActive ?? undefined, "data-pending": state.pending ?? undefined, ...props, href: withTrailingSlash(props.href ?? undefined), onMouseEnter: (e) => {
21
21
  if (props.onMouseEnter) {
22
22
  props.onMouseEnter(e);
23
23
  }
@@ -56,6 +56,7 @@ export class RouteLoader {
56
56
  return this.entries.has(cacheKey);
57
57
  }
58
58
  async loadRouteData(pathname, withAppData = false) {
59
+ pathname = withTrailingSlash(pathname);
59
60
  const cacheKey = this.getKey(pathname);
60
61
  // Cached value?
61
62
  if (this.entries.has(cacheKey))
@@ -65,9 +66,12 @@ export class RouteLoader {
65
66
  serverless: env.serverless,
66
67
  debug: env.dev,
67
68
  });
68
- const promise = this.fetchImpl(requestUrl, {})
69
- .then((response) => response.text())
70
- .then((text) => {
69
+ const promise = this.fetchImpl(requestUrl)
70
+ .then(async (response) => {
71
+ if (response.redirected) {
72
+ return { redirect: response.url };
73
+ }
74
+ let text = await response.text();
71
75
  if (this.processProps) {
72
76
  text = this.processProps(text);
73
77
  }
@@ -78,14 +82,15 @@ export class RouteLoader {
78
82
  throw new RouteError(`JSON parse error for route '${pathname}':\n${err?.message}`, 500);
79
83
  }
80
84
  })
81
- .then((data) => {
85
+ .then(async (data) => {
82
86
  if (data.redirect) {
83
- const redirect = data.redirect;
84
- data = this.loadRouteData(redirect).then((data) => {
85
- data.canonical = redirect;
86
- return data;
87
- });
87
+ const redirect = parseURL(data.redirect).pathname;
88
+ data = await this.loadRouteData(redirect);
89
+ data.canonical = redirect;
88
90
  }
91
+ return data;
92
+ })
93
+ .then((data) => {
89
94
  this.entries.set(cacheKey, new Promise((resolve) => resolve(data)));
90
95
  return data;
91
96
  });
@@ -1,5 +1,5 @@
1
1
  import { parse as qsParse, stringify as qsStringify } from "qs";
2
- import { parseURL, resolveURL, stringifyParsedURL, withoutTrailingSlash } from "ufo";
2
+ import { parseURL, resolveURL, stringifyParsedURL, withoutTrailingSlash, withTrailingSlash } from "ufo";
3
3
  export function isSameOrigin(url) {
4
4
  if (typeof document === "undefined") {
5
5
  return url.startsWith("/");
@@ -81,6 +81,7 @@ export function normalizeRoute(route) {
81
81
  export function stringifyRouteLink(route) {
82
82
  return stringifyParsedURL({
83
83
  ...route,
84
+ pathname: withTrailingSlash(route.pathname),
84
85
  search: stringifyQuery(route.query),
85
86
  });
86
87
  }
@@ -2,11 +2,25 @@
2
2
  import { splitSetCookieString } from "cookie-es";
3
3
  import { getProxyRequestHeaders, getRequestURL, getWebRequest } from "vinxi/http";
4
4
  import { ServerContext } from "./server-context.js";
5
+ import { renderErrorPage } from "./render-ssr-page.js";
5
6
  export async function proxyWpAdmin(event) {
6
7
  const serverContext = ServerContext.main;
7
8
  const replaceUrls = serverContext.replaceUrls;
8
9
  const req = getWebRequest(event);
9
- const proxyUrl = serverContext.getOriginUrl(getRequestURL(event).href);
10
+ const reqUrl = getRequestURL(event);
11
+ const serverlessConfig = serverContext.config.serverless;
12
+ if (!serverContext.dev) {
13
+ if (reqUrl.pathname.toLowerCase().match(/\/+(graphql|wp\-(admin|login|json))/)) {
14
+ if (serverlessConfig.admin === "hide") {
15
+ return renderErrorPage({
16
+ code: 404,
17
+ pathname: reqUrl.pathname,
18
+ title: "Not Found",
19
+ });
20
+ }
21
+ }
22
+ }
23
+ const proxyUrl = serverContext.getOriginUrl(reqUrl.href);
10
24
  // Prepare request headers to be sent to the origin server
11
25
  const proxyHeaders = getProxyRequestHeaders(event);
12
26
  proxyHeaders["X-ED-Dev-Proxy"] = "true";
@@ -6,6 +6,13 @@ type SSRArgs = {
6
6
  export declare function getSsrStream(args: SSRArgs): Promise<ReadableStream<Uint8Array>>;
7
7
  type RenderArgs = {
8
8
  pathname: string;
9
+ statusCode?: number;
9
10
  };
10
11
  export declare function renderPage(args: RenderArgs): Promise<Response>;
12
+ type RenderErrorPageArgs = {
13
+ pathname: string;
14
+ code: number;
15
+ title: string;
16
+ };
17
+ export declare function renderErrorPage(args: RenderErrorPageArgs): Promise<Response>;
11
18
  export {};
@@ -67,6 +67,7 @@ export async function renderPage(args) {
67
67
  data = await response.json();
68
68
  data.appData = appData;
69
69
  data.trackers = trackers;
70
+ responseInit.status = response.status;
70
71
  }
71
72
  catch (err) {
72
73
  data = {
@@ -74,6 +75,7 @@ export async function renderPage(args) {
74
75
  viewType: "react",
75
76
  viewData: {},
76
77
  appData: appData,
78
+ trackers: trackers,
77
79
  };
78
80
  console.error(err);
79
81
  responseInit.status = 500;
@@ -98,3 +100,46 @@ export async function renderPage(args) {
98
100
  });
99
101
  }
100
102
  }
103
+ export async function renderErrorPage(args) {
104
+ return renderPage({
105
+ pathname: "/_error",
106
+ statusCode: args.code,
107
+ });
108
+ // const serverContext = ServerContext.main
109
+ // let headers = new Headers()
110
+ // let responseInit: ResponseInit = {
111
+ // headers,
112
+ // }
113
+ // try {
114
+ // const { appData, trackers } = await serverContext.fetchAppData()
115
+ // let data: RouteDataWithTrackers
116
+ // data = {
117
+ // view: "_error",
118
+ // viewType: "react",
119
+ // viewData: {},
120
+ // appData,
121
+ // trackers,
122
+ // }
123
+ // responseInit.status = 500
124
+ // headers.set("Content-Type", "text/html; charset=utf-8")
125
+ // const stream = await getSsrStream({
126
+ // ...args,
127
+ // initialData: data,
128
+ // })
129
+ // return new Response(stream, responseInit)
130
+ // } catch (err) {
131
+ // console.error(err)
132
+ // return new Response(
133
+ // '<!DOCTYPE html><html><head><title>500 Internal Server Error</title></head><body><h1>500 Internal Server Error</h1><p>"' +
134
+ // String(err) +
135
+ // '"</p></body></html>',
136
+ // {
137
+ // status: 500,
138
+ // statusText: "Internal Server Error",
139
+ // headers: {
140
+ // "Content-Type": "text/html; charset=utf-8",
141
+ // },
142
+ // },
143
+ // )
144
+ // }
145
+ }
@@ -1,4 +1,4 @@
1
- import { parseURL, stringifyParsedURL, withQuery } from "ufo";
1
+ import { parseURL, stringifyParsedURL, withQuery, withTrailingSlash } from "ufo";
2
2
  import { filterHeader } from "./utils/headers.js";
3
3
  import { createUrlReplacer } from "./utils/replace-host.js";
4
4
  const PROXY_RESPONSE_HEADERS = ["content-type", "set-cookie", /^x-/, "cache-control", /woocommerce/];
@@ -76,22 +76,39 @@ export class ServerContext {
76
76
  });
77
77
  }
78
78
  async fetchRouteData(req) {
79
- const fetchUrl = withQuery(req.pathname, {
79
+ const fetchUrl = withQuery(withTrailingSlash(req.pathname), {
80
80
  ...req.query,
81
81
  _props: "1",
82
82
  _ssr: "1",
83
83
  _debug: this.dev ? "1" : undefined,
84
84
  });
85
85
  // console.log("Fetching route data", req.pathname)
86
- const result = this.fetchOrigin(fetchUrl, {
86
+ const result = await this.fetchOrigin(fetchUrl, {
87
87
  cache: "no-cache",
88
88
  replaceUrls: true,
89
89
  headers: {
90
90
  "Content-Type": "application/json",
91
91
  Accept: "application/json",
92
92
  },
93
+ redirect: "manual",
93
94
  });
94
- // console.log("Finished fetching route data")
95
+ if (result.headers.get("content-type") && result.headers.get("location")) {
96
+ let location = result.headers.get("location");
97
+ let status = result.status;
98
+ if (this.replaceUrls) {
99
+ location = this.replaceUrls(location);
100
+ }
101
+ const headers = new Headers({
102
+ ...result.headers,
103
+ });
104
+ headers.delete("location");
105
+ return new Response(JSON.stringify({
106
+ redirect: location,
107
+ status: status,
108
+ }), {
109
+ headers: headers,
110
+ });
111
+ }
95
112
  return result;
96
113
  }
97
114
  async fetchAppData() {
@@ -130,7 +147,6 @@ export class ServerContext {
130
147
  "Content-Type": "application/json",
131
148
  Accept: "application/json",
132
149
  },
133
- redirect: "manual",
134
150
  });
135
151
  }
136
152
  async fetchMutation(req) {
@@ -145,7 +161,6 @@ export class ServerContext {
145
161
  Accept: "application/json",
146
162
  },
147
163
  body: JSON.stringify(req.body),
148
- redirect: "manual",
149
164
  });
150
165
  }
151
166
  get allowedCorsOrigins() {
@@ -86,7 +86,6 @@ 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
  }
@@ -33,6 +33,13 @@ program
33
33
  .option("--fast", "Shorthand for --mode graphql,serverless", false)
34
34
  .option("--verbose", "Show extra debugging info", false)
35
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
+ // }
36
43
  process.env["NODE_ENV"] = "development";
37
44
  /** Ignore self-signed certificate errors in dev mode */
38
45
  process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
@@ -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 +1 @@
1
- export declare const VERSION = "2.0.0-beta.68";
1
+ export declare const VERSION = "2.0.0-beta.70";
@@ -1 +1 @@
1
- export const VERSION = "2.0.0-beta.68";
1
+ export const VERSION = "2.0.0-beta.70";
@@ -79,12 +79,18 @@ export function createVinxiApp(args) {
79
79
  },
80
80
  },
81
81
  routers: [
82
- {
83
- name: "public",
84
- type: "static",
85
- dir: "./assets",
86
- base: joinURL(args.publicUrl, "assets"),
87
- },
82
+ ...args.config.serverless.themeAssets.map((folder) => {
83
+ const folderName = folder
84
+ .split("/")
85
+ .filter((p) => !p.includes("*") && p !== ".")
86
+ .join("/");
87
+ return {
88
+ name: "public_" + folderName,
89
+ type: "static",
90
+ dir: "./" + folderName,
91
+ base: joinURL(args.publicUrl, folderName),
92
+ };
93
+ }),
88
94
  {
89
95
  name: "data-api",
90
96
  type: "http",
@@ -290,7 +290,7 @@ export class GraphQLGenerator {
290
290
  hasDocuments: true,
291
291
  banner: `import { ContentBlock } from "eddev/blocks"`,
292
292
  footer: Object.keys(wp.scalarTypes)
293
- .map((name) => `export type ${name}Scalar = Scalars["${name}"]["output"]`)
293
+ .map((name) => `export type ${name.endsWith("Option") ? name : name + "Scalar"} = Scalars["${name}"]["output"]`)
294
294
  .join("\n"),
295
295
  plugins: {
296
296
  typescript: [typescriptPlugin, {}],
@@ -28,6 +28,7 @@ export declare const EDConfigSchema: z.ZodObject<{
28
28
  enabled: z.ZodDefault<z.ZodBoolean>;
29
29
  uploads: z.ZodEnum<["proxy", "remote"]>;
30
30
  plugins: z.ZodDefault<z.ZodEnum<["proxy", "remote"]>>;
31
+ admin: z.ZodDefault<z.ZodEnum<["proxy", "hide"]>>;
31
32
  themeAssets: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
32
33
  apiOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
33
34
  endpoints: z.ZodRecord<z.ZodString, z.ZodString>;
@@ -44,6 +45,7 @@ export declare const EDConfigSchema: z.ZodObject<{
44
45
  plugins: "proxy" | "remote";
45
46
  enabled: boolean;
46
47
  uploads: "proxy" | "remote";
48
+ admin: "hide" | "proxy";
47
49
  themeAssets: string[];
48
50
  apiOnly: boolean;
49
51
  endpoints: Record<string, string>;
@@ -57,6 +59,7 @@ export declare const EDConfigSchema: z.ZodObject<{
57
59
  endpoints: Record<string, string>;
58
60
  plugins?: "proxy" | "remote" | undefined;
59
61
  enabled?: boolean | undefined;
62
+ admin?: "hide" | "proxy" | undefined;
60
63
  themeAssets?: string[] | undefined;
61
64
  apiOnly?: boolean | undefined;
62
65
  defaultRevalidate?: number | undefined;
@@ -84,6 +87,7 @@ export declare const EDConfigSchema: z.ZodObject<{
84
87
  plugins: "proxy" | "remote";
85
88
  enabled: boolean;
86
89
  uploads: "proxy" | "remote";
90
+ admin: "hide" | "proxy";
87
91
  themeAssets: string[];
88
92
  apiOnly: boolean;
89
93
  endpoints: Record<string, string>;
@@ -113,6 +117,7 @@ export declare const EDConfigSchema: z.ZodObject<{
113
117
  endpoints: Record<string, string>;
114
118
  plugins?: "proxy" | "remote" | undefined;
115
119
  enabled?: boolean | undefined;
120
+ admin?: "hide" | "proxy" | undefined;
116
121
  themeAssets?: string[] | undefined;
117
122
  apiOnly?: boolean | undefined;
118
123
  defaultRevalidate?: number | undefined;
@@ -37,12 +37,15 @@ export const EDConfigSchema = z.object({
37
37
  .enum(["proxy", "remote"])
38
38
  .default("remote")
39
39
  .describe("Whether to proxy plugin assets or serve them from the serverless endpoint.\nDefault is `remote`, but `proxy` can be used to hide the CMS origin."),
40
- // theme: z.enum(["proxy", "copy", "remote"]),
40
+ admin: z
41
+ .enum(["proxy", "hide"])
42
+ .default("proxy")
43
+ .describe("How to handle the WordPress admin URLs.\nDefault is `proxy`, which will proxy the admin URLs to the CMS origin. When set to `hide`, all /wp-admin, /wp-json and /wp-login.php URLs will show a 404 page.\nHas no effect in dev mode."),
41
44
  themeAssets: z
42
45
  .array(z.string())
43
46
  .optional()
44
47
  .default(["assets"])
45
- .describe('Files to include in a serverless deployment.\nDefault is `["assets"]`'),
48
+ .describe('Asset folders to include in a serverless deployment.\nDefault is `["assets"]`'),
46
49
  apiOnly: z.boolean().optional().default(false).describe("Whether to deploy only the API, not the frontend"),
47
50
  endpoints: z
48
51
  .record(z.string(), z.string())
@@ -125,7 +128,7 @@ export class Configurator {
125
128
  this.config = undefined;
126
129
  if (exitOnError) {
127
130
  console.flush();
128
- process.exit(0);
131
+ process.exit(1);
129
132
  }
130
133
  }
131
134
  }
@@ -133,6 +133,8 @@ export class StatefulLog {
133
133
  this.notifySubscribers();
134
134
  }
135
135
  addLogEntry(kind, ...messages) {
136
+ // We ignore SSL errors in dev mode.
137
+ // if (typeof messages[0] === "string" && messages[0].includes("NODE_TLS_REJECT_UNAUTHORIZED")) return
136
138
  if (cliMode.interactive) {
137
139
  const entry = {
138
140
  id: getID(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eddev",
3
- "version": "2.0.0-beta.68",
3
+ "version": "2.0.0-beta.70",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",