eddev 2.0.0-beta.11 → 2.0.0-beta.111
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 +8 -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 +17 -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 +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 +24 -10
- 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 +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 +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 +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 +191 -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 +42 -4
- package/dist/app/server/server-context.js +195 -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/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 +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 +2 -0
- package/dist/node/compiler/get-vite-config.js +42 -12
- 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 +342 -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.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,16 +1,18 @@
|
|
|
1
|
+
import { objFormat } from "obj-console";
|
|
1
2
|
import { relative, resolve } from "path";
|
|
2
3
|
import { undent } from "undent";
|
|
3
|
-
import { objFormat } from "obj-console";
|
|
4
4
|
import { getRepoInfo } from "../utils/get-repo-info.js";
|
|
5
5
|
import { isDeploying } from "../utils/is-deploying.js";
|
|
6
6
|
import { createConsole } from "../utils/stateful-log.js";
|
|
7
7
|
import { Configurator } from "./config.js";
|
|
8
|
-
import { loadBlockManifest } from "./manifest/block-manifest.js";
|
|
9
|
-
import { loadViewManifest } from "./manifest/view-manifest.js";
|
|
10
|
-
import { WPInfo } from "./wp-info.js";
|
|
11
8
|
import { ProjectEnvUtils } from "./env.js";
|
|
9
|
+
import { loadBlockManifest } from "./manifest/block-manifest.js";
|
|
12
10
|
import { loadFieldManifest } from "./manifest/field-manifest.js";
|
|
11
|
+
import { loadRouteManifest } from "./manifest/routes-manifest.js";
|
|
12
|
+
import { loadViewManifest } from "./manifest/view-manifest.js";
|
|
13
13
|
import { loadWidgetManifest } from "./manifest/widget-manifest.js";
|
|
14
|
+
import { WPInfo } from "./wp-info.js";
|
|
15
|
+
import { fs } from "../utils/fs.js";
|
|
14
16
|
const console = createConsole("Project", "project");
|
|
15
17
|
export const projectLog = console;
|
|
16
18
|
/**
|
|
@@ -25,31 +27,74 @@ export class Project {
|
|
|
25
27
|
configFile = "";
|
|
26
28
|
origin = "";
|
|
27
29
|
config;
|
|
30
|
+
cssEntryFile = "views/index.css";
|
|
28
31
|
blocks;
|
|
29
32
|
views;
|
|
30
33
|
fields;
|
|
31
34
|
widgets;
|
|
35
|
+
serverRoutes;
|
|
32
36
|
wp;
|
|
33
37
|
reportPluginCompatibility = false;
|
|
34
38
|
constructor(opts) {
|
|
35
39
|
this.rootDir = opts.rootDir;
|
|
36
|
-
this.origin = ProjectEnvUtils.
|
|
40
|
+
this.origin = ProjectEnvUtils.getSafe("SITE_URL") ?? "";
|
|
37
41
|
this.reportPluginCompatibility = opts.reportPluginCompatibility || false;
|
|
38
42
|
this.blocks = loadBlockManifest(this);
|
|
39
43
|
this.views = loadViewManifest(this);
|
|
40
44
|
this.fields = loadFieldManifest(this);
|
|
41
45
|
this.widgets = loadWidgetManifest(this);
|
|
42
|
-
this.
|
|
46
|
+
this.serverRoutes = loadRouteManifest(this);
|
|
47
|
+
this.wp = new WPInfo(this.origin);
|
|
48
|
+
}
|
|
49
|
+
async verifyOriginAccess() {
|
|
50
|
+
try {
|
|
51
|
+
const response = await this.wp.ping();
|
|
52
|
+
if (!response.ok) {
|
|
53
|
+
return {
|
|
54
|
+
success: false,
|
|
55
|
+
message: [
|
|
56
|
+
`Failed to access WordPress origin at ${this.origin}`,
|
|
57
|
+
`Using API Key?: ${ProjectEnvUtils.getSafe("SITE_API_KEY") ? "Yes" : "No"}`,
|
|
58
|
+
`Response: ${response.status} ${response.statusText}`,
|
|
59
|
+
].join("\n"),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
success: true,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
return {
|
|
68
|
+
success: false,
|
|
69
|
+
message: [
|
|
70
|
+
`Failed to access WordPress origin at ${this.origin}`,
|
|
71
|
+
`Using API Key?: ${ProjectEnvUtils.getSafe("SITE_API_KEY") ? "Yes" : "No"}`,
|
|
72
|
+
`The following error occurred:${err}`,
|
|
73
|
+
].join("\n"),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
43
76
|
}
|
|
44
77
|
async load() {
|
|
45
78
|
console.setWorking(true);
|
|
46
79
|
console.setState(this);
|
|
47
|
-
const repoInfo = await getRepoInfo(this.rootDir)
|
|
80
|
+
const repoInfo = await getRepoInfo(this.rootDir).catch(() => {
|
|
81
|
+
projectLog.warn("Failed to get repo info");
|
|
82
|
+
const name = this.rootDir.split("/").pop();
|
|
83
|
+
return {
|
|
84
|
+
themeName: name,
|
|
85
|
+
repoName: name,
|
|
86
|
+
repoURL: "",
|
|
87
|
+
};
|
|
88
|
+
});
|
|
48
89
|
this.themeName = repoInfo.themeName;
|
|
49
90
|
this.publicUrl = `/wp-content/themes/${repoInfo.themeName}/`;
|
|
50
91
|
this.configFile = relative(process.cwd(), resolve(this.rootDir, "ed.config.json"));
|
|
51
92
|
this.repoUrl = repoInfo.repoURL?.replace("git@github.com:", "https://github.com/").replace(".git", "") || "";
|
|
52
93
|
this.reportProjectInfo();
|
|
94
|
+
/**
|
|
95
|
+
* Detect CSS file
|
|
96
|
+
*/
|
|
97
|
+
await this.detectCssEntryFile();
|
|
53
98
|
/**
|
|
54
99
|
* Make sure the git repo name matches
|
|
55
100
|
*/
|
|
@@ -87,6 +132,15 @@ export class Project {
|
|
|
87
132
|
console.setWorking(false);
|
|
88
133
|
console.info(this.reportProjectInfo());
|
|
89
134
|
}
|
|
135
|
+
async detectCssEntryFile() {
|
|
136
|
+
const candidates = ["styles/index.css", "views/index.css", "style.css"];
|
|
137
|
+
for (const candidate of candidates) {
|
|
138
|
+
if (await fs.exists(resolve(this.rootDir, candidate))) {
|
|
139
|
+
this.cssEntryFile = candidate;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
90
144
|
reportProjectInfo() {
|
|
91
145
|
return objFormat({
|
|
92
146
|
"Theme Name": this.themeName,
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import { resolveURL } from "ufo";
|
|
2
|
+
import { fetchWP } from "../utils/fetch-wp.js";
|
|
2
3
|
export class WPInfo {
|
|
3
4
|
siteUrl;
|
|
4
5
|
cached;
|
|
5
6
|
constructor(siteUrl) {
|
|
6
7
|
this.siteUrl = siteUrl;
|
|
7
8
|
}
|
|
9
|
+
async ping() {
|
|
10
|
+
if (!this.siteUrl) {
|
|
11
|
+
throw new Error("Attempted to ping WordPress, but SITE_URL was not present in the environment.");
|
|
12
|
+
}
|
|
13
|
+
const url = resolveURL(this.siteUrl, "/wp-json/ed/v1/handshake");
|
|
14
|
+
const response = await fetchWP(url);
|
|
15
|
+
return response;
|
|
16
|
+
}
|
|
8
17
|
async getInfo(force = false) {
|
|
18
|
+
if (!this.siteUrl) {
|
|
19
|
+
throw new Error("Attempted to get site info from WordPress, but SITE_URL was not present in the environment.");
|
|
20
|
+
}
|
|
9
21
|
if (this.cached && !force)
|
|
10
22
|
return this.cached;
|
|
11
23
|
const url = resolveURL(this.siteUrl, "/wp-json/ed/v1/dev/site-info");
|
|
12
|
-
const response = await
|
|
24
|
+
const response = await fetchWP(url);
|
|
13
25
|
const result = (await response.json());
|
|
14
26
|
this.cached = result;
|
|
15
27
|
return result;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { storybookVitePlugins } from "../compiler/get-vite-config";
|
|
2
|
+
export function applyViteStorybookConfig(config) {
|
|
3
|
+
config.plugins?.push(storybookVitePlugins({
|
|
4
|
+
client: true,
|
|
5
|
+
console: console,
|
|
6
|
+
mode: process.env.NODE_ENV === "production" ? "production" : "development",
|
|
7
|
+
rootDir: process.cwd(),
|
|
8
|
+
publicUrl: "/",
|
|
9
|
+
serverless: true,
|
|
10
|
+
target: "frontend",
|
|
11
|
+
}));
|
|
12
|
+
return config;
|
|
13
|
+
}
|
|
@@ -23,67 +23,72 @@ export declare const BlockMetaSchema: z.ZodObject<{
|
|
|
23
23
|
cache: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
24
24
|
allowMultiple: z.ZodDefault<z.ZodBoolean>;
|
|
25
25
|
postMetaBlock: z.ZodOptional<z.ZodObject<{
|
|
26
|
+
postTypes: z.ZodArray<z.ZodString, "many">;
|
|
26
27
|
fieldName: z.ZodString;
|
|
27
28
|
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
postTypes: string[];
|
|
28
30
|
fieldName: string;
|
|
29
31
|
}, {
|
|
32
|
+
postTypes: string[];
|
|
30
33
|
fieldName: string;
|
|
31
34
|
}>>;
|
|
32
35
|
frontendMode: z.ZodDefault<z.ZodEnum<["hidden", "childrenOnly", "default"]>>;
|
|
33
36
|
inserter: z.ZodDefault<z.ZodBoolean>;
|
|
34
37
|
}, "strip", z.ZodTypeAny, {
|
|
35
|
-
|
|
38
|
+
title: string;
|
|
39
|
+
mode: "both" | "edit" | "preview";
|
|
40
|
+
slug: string;
|
|
41
|
+
tags: string[];
|
|
42
|
+
flags: Record<string, any>;
|
|
43
|
+
category: string;
|
|
44
|
+
parent: string[];
|
|
36
45
|
acfName: string;
|
|
37
46
|
fileName: string;
|
|
38
|
-
slug: string;
|
|
39
47
|
graphqlFieldName: string;
|
|
40
|
-
title: string;
|
|
41
|
-
category: string;
|
|
42
48
|
types: string[];
|
|
43
|
-
mode: "preview" | "edit" | "both";
|
|
44
|
-
tags: string[];
|
|
45
|
-
flags: Record<string, any>;
|
|
46
49
|
childTags: string[];
|
|
47
50
|
childBlocks: string[];
|
|
48
|
-
parent: string[];
|
|
49
51
|
ancestors: string[];
|
|
50
52
|
dynamic: boolean;
|
|
53
|
+
cache: boolean;
|
|
51
54
|
allowMultiple: boolean;
|
|
52
|
-
frontendMode: "hidden" | "
|
|
55
|
+
frontendMode: "hidden" | "default" | "childrenOnly";
|
|
53
56
|
inserter: boolean;
|
|
54
|
-
description?: string | undefined;
|
|
55
57
|
icon?: string | undefined;
|
|
58
|
+
description?: string | undefined;
|
|
56
59
|
keywords?: string[] | undefined;
|
|
57
60
|
templates?: string[] | null | undefined;
|
|
58
61
|
postMetaBlock?: {
|
|
62
|
+
postTypes: string[];
|
|
59
63
|
fieldName: string;
|
|
60
64
|
} | undefined;
|
|
61
65
|
}, {
|
|
66
|
+
title: string;
|
|
67
|
+
slug: string;
|
|
62
68
|
acfName: string;
|
|
63
69
|
fileName: string;
|
|
64
|
-
slug: string;
|
|
65
70
|
graphqlFieldName: string;
|
|
66
|
-
title: string;
|
|
67
71
|
types: string[];
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
mode?: "both" | "edit" | "preview" | undefined;
|
|
73
|
+
tags?: string[] | undefined;
|
|
74
|
+
flags?: Record<string, any> | undefined;
|
|
71
75
|
icon?: string | undefined;
|
|
76
|
+
category?: string | undefined;
|
|
77
|
+
parent?: string[] | undefined;
|
|
78
|
+
description?: string | undefined;
|
|
72
79
|
keywords?: string[] | undefined;
|
|
73
80
|
templates?: string[] | null | undefined;
|
|
74
|
-
mode?: "preview" | "edit" | "both" | undefined;
|
|
75
|
-
tags?: string[] | undefined;
|
|
76
|
-
flags?: Record<string, any> | undefined;
|
|
77
81
|
childTags?: string[] | undefined;
|
|
78
82
|
childBlocks?: string[] | undefined;
|
|
79
|
-
parent?: string[] | undefined;
|
|
80
83
|
ancestors?: string[] | undefined;
|
|
81
84
|
dynamic?: boolean | undefined;
|
|
85
|
+
cache?: boolean | undefined;
|
|
82
86
|
allowMultiple?: boolean | undefined;
|
|
83
87
|
postMetaBlock?: {
|
|
88
|
+
postTypes: string[];
|
|
84
89
|
fieldName: string;
|
|
85
90
|
} | undefined;
|
|
86
|
-
frontendMode?: "hidden" | "
|
|
91
|
+
frontendMode?: "hidden" | "default" | "childrenOnly" | undefined;
|
|
87
92
|
inserter?: boolean | undefined;
|
|
88
93
|
}>;
|
|
89
94
|
export type BlockMetadata = z.infer<typeof BlockMetaSchema>;
|
|
@@ -9,21 +9,21 @@ export declare const ViewMetaSchema: z.ZodObject<{
|
|
|
9
9
|
routePattern: z.ZodOptional<z.ZodString>;
|
|
10
10
|
postType: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
cache: boolean;
|
|
13
|
-
fileName: string;
|
|
14
|
-
slug: string;
|
|
15
12
|
title: string;
|
|
13
|
+
slug: string;
|
|
14
|
+
fileName: string;
|
|
15
|
+
cache: boolean;
|
|
16
16
|
isCustomTemplate: boolean;
|
|
17
|
-
routePattern?: string | undefined;
|
|
18
17
|
postType?: string[] | undefined;
|
|
18
|
+
routePattern?: string | undefined;
|
|
19
19
|
}, {
|
|
20
|
-
fileName: string;
|
|
21
|
-
slug: string;
|
|
22
20
|
title: string;
|
|
21
|
+
slug: string;
|
|
22
|
+
fileName: string;
|
|
23
|
+
postType?: string[] | undefined;
|
|
23
24
|
cache?: boolean | undefined;
|
|
24
25
|
isCustomTemplate?: boolean | undefined;
|
|
25
26
|
routePattern?: string | undefined;
|
|
26
|
-
postType?: string[] | undefined;
|
|
27
27
|
}>;
|
|
28
28
|
export type ViewMetadata = z.infer<typeof ViewMetaSchema>;
|
|
29
29
|
export type ViewMetadataConstructor = z.input<typeof ViewMetaSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fetchWP(url: string | URL, args?: RequestInit): Promise<Response>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ProjectEnvUtils } from "../project/env.js";
|
|
2
|
+
import { Agent, fetch, setGlobalDispatcher, Headers } from "undici";
|
|
3
|
+
const agent = new Agent({
|
|
4
|
+
connect: {
|
|
5
|
+
rejectUnauthorized: false,
|
|
6
|
+
},
|
|
7
|
+
});
|
|
8
|
+
export function fetchWP(url, args = {}) {
|
|
9
|
+
const headers = new Headers(args.headers);
|
|
10
|
+
// If an API key has been set in the environment, use it
|
|
11
|
+
const accessKey = ProjectEnvUtils.getSafe("SITE_API_KEY");
|
|
12
|
+
if (accessKey) {
|
|
13
|
+
headers.set("x-ed-api-key", accessKey);
|
|
14
|
+
}
|
|
15
|
+
// Allow self-signed certificates when using a local development domain
|
|
16
|
+
let allowSelfSigned = isDevelopmentDomain(url);
|
|
17
|
+
return fetch(url, {
|
|
18
|
+
...args,
|
|
19
|
+
dispatcher: allowSelfSigned ? agent : undefined,
|
|
20
|
+
headers,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
setGlobalDispatcher(agent);
|
|
24
|
+
function isDevelopmentDomain(url) {
|
|
25
|
+
const hostname = typeof url === "string" ? new URL(url).hostname : url.hostname;
|
|
26
|
+
return !!hostname?.match(/(^[0-9\.]+$|\.local$)/);
|
|
27
|
+
}
|
|
@@ -15,6 +15,7 @@ export declare class FSCodegen {
|
|
|
15
15
|
project: Project;
|
|
16
16
|
opts: {
|
|
17
17
|
outDir: string;
|
|
18
|
+
onWritten?: (opts: Set<string>) => void;
|
|
18
19
|
};
|
|
19
20
|
outDir: string;
|
|
20
21
|
private generators;
|
|
@@ -23,6 +24,7 @@ export declare class FSCodegen {
|
|
|
23
24
|
private flushScheduled;
|
|
24
25
|
constructor(project: Project, opts: {
|
|
25
26
|
outDir: string;
|
|
27
|
+
onWritten?: (opts: Set<string>) => void;
|
|
26
28
|
});
|
|
27
29
|
register(generator: CodeGenerator): void;
|
|
28
30
|
registerFile({ name, generate, subscribe, }: {
|
|
@@ -77,7 +77,7 @@ export class FSCodegen {
|
|
|
77
77
|
}
|
|
78
78
|
async flush() {
|
|
79
79
|
const files = Array.from(this.generatorFiles.values()).flat();
|
|
80
|
-
const existing = (await globby(this.outDir
|
|
80
|
+
const existing = (await globby(join(this.outDir, "/**/*"))).map((path) => resolve(this.project.rootDir, path));
|
|
81
81
|
const written = new Set();
|
|
82
82
|
await Promise.all(files.map(async (file) => {
|
|
83
83
|
const path = join(this.project.rootDir, this.outDir, file.name);
|
|
@@ -89,6 +89,7 @@ export class FSCodegen {
|
|
|
89
89
|
await fs.rm(path);
|
|
90
90
|
}
|
|
91
91
|
}));
|
|
92
|
+
this.opts.onWritten?.(written);
|
|
92
93
|
}
|
|
93
94
|
stop() {
|
|
94
95
|
this.unsubscribers.forEach((unsub) => unsub());
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare function createReportBuilder(): {
|
|
2
|
-
log(...values: any[]): any;
|
|
3
|
-
warn(...values: any[]): any;
|
|
4
|
-
fail(...values: any[]): any;
|
|
5
|
-
info(...values: any[]): any;
|
|
6
|
-
help(...values: any[]): any;
|
|
7
|
-
success(...values: any[]): any;
|
|
2
|
+
log(...values: any[]): /*elided*/ any;
|
|
3
|
+
warn(...values: any[]): /*elided*/ any;
|
|
4
|
+
fail(...values: any[]): /*elided*/ any;
|
|
5
|
+
info(...values: any[]): /*elided*/ any;
|
|
6
|
+
help(...values: any[]): /*elided*/ any;
|
|
7
|
+
success(...values: any[]): /*elided*/ any;
|
|
8
8
|
toString(): string;
|
|
9
9
|
};
|
|
@@ -5,10 +5,10 @@ export async function ensureSelfSignedCert(hostname, rootDir) {
|
|
|
5
5
|
const certFile = `${rootDir}/.eddev/certs/${hostname}.crt`;
|
|
6
6
|
const keyFile = `${rootDir}/.eddev/certs/${hostname}.key`;
|
|
7
7
|
if ((await fs.exists(certFile)) && (await fs.exists(keyFile))) {
|
|
8
|
-
return {
|
|
8
|
+
return loadCert({
|
|
9
9
|
certFile,
|
|
10
10
|
keyFile,
|
|
11
|
-
};
|
|
11
|
+
});
|
|
12
12
|
}
|
|
13
13
|
console.info("Creating a self-signed certificate for local development.");
|
|
14
14
|
const ca = await createCA({
|
|
@@ -28,8 +28,16 @@ export async function ensureSelfSignedCert(hostname, rootDir) {
|
|
|
28
28
|
await fs.writeFile(keyFile, pems.key);
|
|
29
29
|
serverlessLog.help(`A new self-signed certificate has been created for ${hostname}! Please add the certificate to your keychain.`);
|
|
30
30
|
serverlessLog.help(`Certificate: ${certFile.replace(rootDir, "")}`);
|
|
31
|
+
return loadCert({
|
|
32
|
+
certFile,
|
|
33
|
+
keyFile,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async function loadCert({ certFile, keyFile }) {
|
|
31
37
|
return {
|
|
32
38
|
certFile,
|
|
33
39
|
keyFile,
|
|
40
|
+
cert: await fs.readFile(certFile, "utf-8"),
|
|
41
|
+
key: await fs.readFile(keyFile, "utf-8"),
|
|
34
42
|
};
|
|
35
43
|
}
|
|
@@ -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(),
|
|
@@ -5,7 +5,21 @@ export type FileEvent = {
|
|
|
5
5
|
type: FileWatchEvent;
|
|
6
6
|
file: string;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
type WatchTreeOpts = {
|
|
9
|
+
pattern: string | string[];
|
|
10
|
+
ignore?: string[];
|
|
11
|
+
callback: (files: FileList, event?: FileEvent) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare function watchFileTree({ pattern, callback, ignore }: WatchTreeOpts): Promise<Disposer>;
|
|
14
|
+
type WatchTreeChangesOpts = {
|
|
15
|
+
pattern: string | string[];
|
|
16
|
+
ignore?: string | RegExp | string[];
|
|
17
|
+
callback: (event: FileEvent) => void;
|
|
18
|
+
};
|
|
19
|
+
export declare function watchFileTreeForChanges({ pattern, callback, ignore }: WatchTreeChangesOpts): Promise<Disposer>;
|
|
20
|
+
type GetTreeOpts = {
|
|
21
|
+
pattern: string | string[];
|
|
22
|
+
ignore?: string[];
|
|
23
|
+
};
|
|
24
|
+
export declare function getFileTree(opts: GetTreeOpts): Promise<FileList>;
|
|
11
25
|
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import chokidar from "chokidar";
|
|
2
2
|
import { globby } from "globby";
|
|
3
|
-
export function watchFileTree(pattern, callback) {
|
|
3
|
+
export function watchFileTree({ pattern, callback, ignore }) {
|
|
4
4
|
const files = [];
|
|
5
5
|
let ready = false;
|
|
6
6
|
return new Promise((resolve) => {
|
|
7
7
|
const watcher = chokidar
|
|
8
|
-
.watch(pattern
|
|
8
|
+
.watch(pattern, {
|
|
9
|
+
ignored: ignore,
|
|
10
|
+
})
|
|
9
11
|
.on("add", (path) => {
|
|
10
12
|
files.push(path);
|
|
11
13
|
if (ready)
|
|
@@ -31,7 +33,7 @@ export function watchFileTree(pattern, callback) {
|
|
|
31
33
|
});
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
|
-
export function watchFileTreeForChanges(pattern, callback) {
|
|
36
|
+
export function watchFileTreeForChanges({ pattern, callback, ignore }) {
|
|
35
37
|
let ready = false;
|
|
36
38
|
return new Promise((resolve) => {
|
|
37
39
|
const watcher = chokidar
|
|
@@ -50,9 +52,14 @@ export function watchFileTreeForChanges(pattern, callback) {
|
|
|
50
52
|
})
|
|
51
53
|
.on("ready", () => {
|
|
52
54
|
ready = true;
|
|
55
|
+
resolve(() => {
|
|
56
|
+
watcher.close();
|
|
57
|
+
});
|
|
53
58
|
});
|
|
54
59
|
});
|
|
55
60
|
}
|
|
56
|
-
export function getFileTree(
|
|
57
|
-
return globby(pattern
|
|
61
|
+
export function getFileTree(opts) {
|
|
62
|
+
return globby(opts.pattern, {
|
|
63
|
+
ignore: opts.ignore,
|
|
64
|
+
});
|
|
58
65
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eddev",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.111",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -38,10 +38,18 @@
|
|
|
38
38
|
"types": "./dist/app/lib/devtools/index.d.ts",
|
|
39
39
|
"import": "./dist/app/lib/devtools/index.js"
|
|
40
40
|
},
|
|
41
|
+
"./runtime": {
|
|
42
|
+
"types": "./dist/app/lib/runtime/index.d.ts",
|
|
43
|
+
"import": "./dist/app/lib/runtime/index.js"
|
|
44
|
+
},
|
|
41
45
|
"./server": {
|
|
42
46
|
"types": "./dist/app/server/index.d.ts",
|
|
43
47
|
"import": "./dist/app/server/index.js"
|
|
44
48
|
},
|
|
49
|
+
"./storybook": {
|
|
50
|
+
"types": "./dist/node/storybook/index.d.ts",
|
|
51
|
+
"default": "./dist/node/storybook/index.js"
|
|
52
|
+
},
|
|
45
53
|
"./_internal/boot-admin.js": {
|
|
46
54
|
"import": "./dist/app/entry/boot-admin.js"
|
|
47
55
|
},
|
|
@@ -72,16 +80,17 @@
|
|
|
72
80
|
"license": "ISC",
|
|
73
81
|
"dependencies": {
|
|
74
82
|
"@babel/types": "^7.25.2",
|
|
75
|
-
"@
|
|
83
|
+
"@epic-web/cachified": "^5.2.0",
|
|
76
84
|
"@graphql-codegen/core": "^4.0.0",
|
|
77
85
|
"@graphql-codegen/typescript": "^4.0.1",
|
|
78
86
|
"@graphql-codegen/typescript-operations": "^4.0.1",
|
|
79
87
|
"@graphql-tools/load": "^8.0.0",
|
|
80
88
|
"@graphql-tools/url-loader": "^8.0.0",
|
|
81
|
-
"@inquirer/prompts": "^5.0.6",
|
|
82
89
|
"@nozbe/microfuzz": "^1.0.0",
|
|
83
90
|
"@rollup/plugin-replace": "^5.0.5",
|
|
84
91
|
"@tanstack/react-query": "^5.51.23",
|
|
92
|
+
"@trpc/client": "^11.0.0-rc.608",
|
|
93
|
+
"@trpc/server": "^11.0.0-rc.608",
|
|
85
94
|
"@types/qs": "^6.9.15",
|
|
86
95
|
"@vinxi/react": "^0.2.5",
|
|
87
96
|
"@vitejs/plugin-react": "^4.1.1",
|
|
@@ -93,40 +102,40 @@
|
|
|
93
102
|
"dotenv": "^16.3.1",
|
|
94
103
|
"globby": "^13.2.2",
|
|
95
104
|
"graphql": "^16.8.1",
|
|
105
|
+
"hono": "^4.6.2",
|
|
106
|
+
"httpxy": "^0.1.5",
|
|
96
107
|
"ink": "^5.0.1",
|
|
97
108
|
"ink-spinner": "^5.0.0",
|
|
98
|
-
"
|
|
99
|
-
"listhen": "^1.6.0",
|
|
109
|
+
"lru-cache": "10.4.1",
|
|
100
110
|
"mkcert": "^3.2.0",
|
|
101
111
|
"obj-console": "^1.0.2",
|
|
102
112
|
"object-code": "^1.3.3",
|
|
103
113
|
"qs": "^6.13.0",
|
|
114
|
+
"superjson": "^2.2.1",
|
|
104
115
|
"ts-poet": "^6.6.0",
|
|
105
116
|
"ufo": "^1.3.1",
|
|
106
117
|
"undent": "^0.1.0",
|
|
118
|
+
"undici": "^6.21.0",
|
|
107
119
|
"valtio": "^1.13.2",
|
|
108
120
|
"vinxi": "^0.4.3",
|
|
109
121
|
"vite-tsconfig-paths": "^4.2.1",
|
|
110
122
|
"zod": "^3.22.4",
|
|
111
123
|
"zod-to-json-schema": "^3.21.4",
|
|
112
|
-
"zod-validation-error": "^2.1.0"
|
|
113
|
-
"zustand": "^4.5.5"
|
|
124
|
+
"zod-validation-error": "^2.1.0"
|
|
114
125
|
},
|
|
115
126
|
"devDependencies": {
|
|
116
|
-
"@types/express": "^4.17.21",
|
|
117
|
-
"@types/express-http-proxy": "^1.6.6",
|
|
118
127
|
"@types/node": "^20.9.0",
|
|
119
128
|
"@types/react": "^18.3.3",
|
|
120
129
|
"@types/react-dom": "^18.3.0",
|
|
121
|
-
"typescript": "^5.5.2",
|
|
122
130
|
"@types/wordpress__blocks": "^12.5.13",
|
|
123
131
|
"@types/wordpress__components": "^23.0.11",
|
|
124
132
|
"@types/wordpress__editor": "^13.6.7",
|
|
125
|
-
"@types/wordpress__hooks": "^2.11.0"
|
|
133
|
+
"@types/wordpress__hooks": "^2.11.0",
|
|
134
|
+
"typescript": "^5.5.2"
|
|
126
135
|
},
|
|
127
136
|
"peerDependencies": {
|
|
128
137
|
"react": "^18.3.1",
|
|
129
|
-
"react-dom": "^
|
|
138
|
+
"react-dom": "^108.3.1",
|
|
130
139
|
"tailwindcss": "^3.4.4"
|
|
131
140
|
}
|
|
132
141
|
}
|
package/types.app.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
|
-
/// <reference types="./types.meta" />
|
|
3
|
-
/// <reference types="./types.env" />
|
|
2
|
+
/// <reference types="./types.meta.d.ts" />
|
|
3
|
+
/// <reference types="./types.env.d.ts" />
|
|
4
|
+
import { Router } from "@trpc/server"
|
|
4
5
|
|
|
5
6
|
declare global {
|
|
6
7
|
interface ViewProps {}
|
|
@@ -13,6 +14,7 @@ declare global {
|
|
|
13
14
|
interface PostMetaTypes {}
|
|
14
15
|
|
|
15
16
|
interface RPCRouter {}
|
|
17
|
+
interface RPCContext {}
|
|
16
18
|
|
|
17
19
|
type AppData = ViewProps["_app"]
|
|
18
20
|
|
package/types.app.internal.d.ts
CHANGED
package/types.node.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/// <reference types="./types.app" />
|
|
2
|
-
/// <reference types="./types.meta" />
|
|
3
|
-
/// <reference types="./types.env" />
|
|
1
|
+
/// <reference types="./types.app.d.ts" />
|
|
2
|
+
/// <reference types="./types.meta.d.ts" />
|
|
3
|
+
/// <reference types="./types.env.d.ts" />
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Component, ErrorInfo, ReactNode } from "react";
|
|
2
|
-
interface Props {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
}
|
|
5
|
-
interface State {
|
|
6
|
-
hasError: boolean;
|
|
7
|
-
error?: Error;
|
|
8
|
-
}
|
|
9
|
-
export declare class ErrorBoundaryFrontend extends Component<Props, State> {
|
|
10
|
-
state: State;
|
|
11
|
-
static getDerivedStateFromError(err: Error): State;
|
|
12
|
-
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
13
|
-
render(): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | null | undefined;
|
|
14
|
-
}
|
|
15
|
-
export {};
|