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
@@ -1,16 +1,17 @@
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";
14
15
  const console = createConsole("Project", "project");
15
16
  export const projectLog = console;
16
17
  /**
@@ -29,17 +30,47 @@ export class Project {
29
30
  views;
30
31
  fields;
31
32
  widgets;
33
+ serverRoutes;
32
34
  wp;
33
35
  reportPluginCompatibility = false;
34
36
  constructor(opts) {
35
37
  this.rootDir = opts.rootDir;
36
- this.origin = ProjectEnvUtils.get("SITE_URL");
38
+ this.origin = ProjectEnvUtils.getSafe("SITE_URL") ?? "";
37
39
  this.reportPluginCompatibility = opts.reportPluginCompatibility || false;
38
40
  this.blocks = loadBlockManifest(this);
39
41
  this.views = loadViewManifest(this);
40
42
  this.fields = loadFieldManifest(this);
41
43
  this.widgets = loadWidgetManifest(this);
42
- this.wp = new WPInfo(ProjectEnvUtils.get("SITE_URL"));
44
+ this.serverRoutes = loadRouteManifest(this);
45
+ this.wp = new WPInfo(this.origin);
46
+ }
47
+ async verifyOriginAccess() {
48
+ try {
49
+ const response = await this.wp.ping();
50
+ if (!response.ok) {
51
+ return {
52
+ success: false,
53
+ message: [
54
+ `Failed to access WordPress origin at ${this.origin}`,
55
+ `Using API Key?: ${ProjectEnvUtils.getSafe("SITE_API_KEY") ? "Yes" : "No"}`,
56
+ `Response: ${response.status} ${response.statusText}`,
57
+ ].join("\n"),
58
+ };
59
+ }
60
+ return {
61
+ success: true,
62
+ };
63
+ }
64
+ catch (err) {
65
+ return {
66
+ success: false,
67
+ message: [
68
+ `Failed to access WordPress origin at ${this.origin}`,
69
+ `Using API Key?: ${ProjectEnvUtils.getSafe("SITE_API_KEY") ? "Yes" : "No"}`,
70
+ `The following error occurred:${err}`,
71
+ ].join("\n"),
72
+ };
73
+ }
43
74
  }
44
75
  async load() {
45
76
  console.setWorking(true);
@@ -26,6 +26,7 @@ export declare class WPInfo {
26
26
  siteUrl: string;
27
27
  private cached?;
28
28
  constructor(siteUrl: string);
29
+ ping(): Promise<Response>;
29
30
  getInfo(force?: boolean): Promise<WPInfoData>;
30
31
  getPluginIssues(): Promise<string[]>;
31
32
  }
@@ -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 fetch(url);
24
+ const response = await fetchWP(url);
13
25
  const result = (await response.json());
14
26
  this.cached = result;
15
27
  return result;
@@ -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
- cache: boolean;
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" | "childrenOnly" | "default";
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
- cache?: boolean | undefined;
69
- description?: string | undefined;
70
- category?: string | undefined;
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" | "childrenOnly" | "default" | undefined;
91
+ frontendMode?: "hidden" | "default" | "childrenOnly" | undefined;
87
92
  inserter?: boolean | undefined;
88
93
  }>;
89
94
  export type BlockMetadata = z.infer<typeof BlockMetaSchema>;
@@ -27,6 +27,7 @@ export const BlockMetaSchema = z.object({
27
27
  allowMultiple: z.boolean().default(true),
28
28
  postMetaBlock: z
29
29
  .object({
30
+ postTypes: z.array(z.string()),
30
31
  fieldName: z.string(),
31
32
  })
32
33
  .optional(),
@@ -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 + "/**/*")).map((path) => resolve(this.project.rootDir, path));
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());
@@ -2,5 +2,5 @@
2
2
  * Returns true if we think that the compiler is running in a deployment context (Vercel, GitHub Actions, etc.)
3
3
  */
4
4
  export function isDeploying() {
5
- return !!process.env.VERCEL;
5
+ return !!process.env.VERCEL || !!process.env.GITHUB_ACTIONS;
6
6
  }
@@ -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
- export declare function watchFileTree(pattern: string | string[], callback: (files: FileList, event?: FileEvent) => void): Promise<Disposer>;
9
- export declare function watchFileTreeForChanges(pattern: string | string[], callback: (event: FileEvent) => void): Promise<Disposer>;
10
- export declare function getFileTree(pattern: string | string[]): Promise<FileList>;
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(pattern) {
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.9",
3
+ "version": "2.0.0-beta.91",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -38,6 +38,10 @@
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"
@@ -72,21 +76,18 @@
72
76
  "license": "ISC",
73
77
  "dependencies": {
74
78
  "@babel/types": "^7.25.2",
75
- "@clack/prompts": "^0.7.0",
79
+ "@epic-web/cachified": "^5.2.0",
76
80
  "@graphql-codegen/core": "^4.0.0",
77
81
  "@graphql-codegen/typescript": "^4.0.1",
78
82
  "@graphql-codegen/typescript-operations": "^4.0.1",
79
83
  "@graphql-tools/load": "^8.0.0",
80
84
  "@graphql-tools/url-loader": "^8.0.0",
81
- "@inquirer/prompts": "^5.0.6",
82
85
  "@nozbe/microfuzz": "^1.0.0",
83
86
  "@rollup/plugin-replace": "^5.0.5",
84
87
  "@tanstack/react-query": "^5.51.23",
88
+ "@trpc/client": "^11.0.0-rc.608",
89
+ "@trpc/server": "^11.0.0-rc.608",
85
90
  "@types/qs": "^6.9.15",
86
- "@types/wordpress__blocks": "^12.5.13",
87
- "@types/wordpress__components": "^23.0.11",
88
- "@types/wordpress__editor": "^13.6.7",
89
- "@types/wordpress__hooks": "^2.11.0",
90
91
  "@vinxi/react": "^0.2.5",
91
92
  "@vitejs/plugin-react": "^4.1.1",
92
93
  "chalk": "^5.3.0",
@@ -97,31 +98,34 @@
97
98
  "dotenv": "^16.3.1",
98
99
  "globby": "^13.2.2",
99
100
  "graphql": "^16.8.1",
101
+ "hono": "^4.6.2",
100
102
  "ink": "^5.0.1",
101
103
  "ink-spinner": "^5.0.0",
102
- "ink-text-input": "^6.0.0",
103
- "listhen": "^1.6.0",
104
+ "lru-cache": "10.4.1",
104
105
  "mkcert": "^3.2.0",
105
106
  "obj-console": "^1.0.2",
106
107
  "object-code": "^1.3.3",
107
108
  "qs": "^6.13.0",
109
+ "superjson": "^2.2.1",
108
110
  "ts-poet": "^6.6.0",
109
111
  "ufo": "^1.3.1",
110
112
  "undent": "^0.1.0",
113
+ "undici": "^6.21.0",
111
114
  "valtio": "^1.13.2",
112
115
  "vinxi": "^0.4.3",
113
116
  "vite-tsconfig-paths": "^4.2.1",
114
117
  "zod": "^3.22.4",
115
118
  "zod-to-json-schema": "^3.21.4",
116
- "zod-validation-error": "^2.1.0",
117
- "zustand": "^4.5.5"
119
+ "zod-validation-error": "^2.1.0"
118
120
  },
119
121
  "devDependencies": {
120
- "@types/express": "^4.17.21",
121
- "@types/express-http-proxy": "^1.6.6",
122
122
  "@types/node": "^20.9.0",
123
123
  "@types/react": "^18.3.3",
124
124
  "@types/react-dom": "^18.3.0",
125
+ "@types/wordpress__blocks": "^12.5.13",
126
+ "@types/wordpress__components": "^23.0.11",
127
+ "@types/wordpress__editor": "^13.6.7",
128
+ "@types/wordpress__hooks": "^2.11.0",
125
129
  "typescript": "^5.5.2"
126
130
  },
127
131
  "peerDependencies": {
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
 
@@ -1,5 +1,5 @@
1
- /// <reference types="./types.manifests" />
2
- /// <reference types="./types.app" />
1
+ /// <reference types="./types.manifests.d.ts" />
2
+ /// <reference types="./types.app.d.ts" />
3
3
 
4
4
  declare global {
5
5
  interface ViewProps {
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 {};
@@ -1,35 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Component } from "react";
3
- export class ErrorBoundaryFrontend extends Component {
4
- state = {
5
- hasError: false,
6
- };
7
- static getDerivedStateFromError(err) {
8
- // Update state so the next render will show the fallback UI.
9
- return { hasError: true, error: err };
10
- }
11
- componentDidCatch(error, errorInfo) {
12
- console.error("Uncaught error:", error, errorInfo);
13
- }
14
- render() {
15
- if (this.state.hasError) {
16
- const err = this.state.error;
17
- if (env.dev) {
18
- return (_jsx("pre", { style: {
19
- backgroundColor: "#fafafa",
20
- fontSize: "12px",
21
- color: "#d92a0b",
22
- border: "2px solid #d92a0b",
23
- borderRadius: "4px",
24
- padding: "8px",
25
- overflowX: "auto",
26
- fontFamily: '"Roboto Mono", Menlo, monospace',
27
- }, children: err.stack }));
28
- }
29
- else {
30
- return null;
31
- }
32
- }
33
- return this.props.children;
34
- }
35
- }
@@ -1,4 +0,0 @@
1
- import { create } from "zustand";
2
- export const useAPIConfig = create((set, get) => ({
3
- set: (config) => set(config),
4
- }));
@@ -1,6 +0,0 @@
1
- interface PageLoadStore {
2
- loading: boolean;
3
- setIsLoading(loading: boolean): void;
4
- }
5
- export declare const usePageLoad: import("zustand").UseBoundStore<import("zustand").StoreApi<PageLoadStore>>;
6
- export {};
@@ -1,5 +0,0 @@
1
- import { create } from "zustand";
2
- export const usePageLoad = create((set) => ({
3
- loading: false,
4
- setIsLoading: (loading) => set({ loading: loading }),
5
- }));
@@ -1,2 +0,0 @@
1
- declare const _default: "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <link rel=\"icon\" type=\"image/svg+xml\" href=\"/vite.svg\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <!--ssr-meta-->\n </head>\n <body>\n <div id=\"root\"><!--ssr-outlet--></div>\n <!--ssr-meta-->\n <script type=\"module\" src=\"/_boot.js\"></script>\n </body>\n</html>";
2
- export default _default;
@@ -1,14 +0,0 @@
1
- export default `<!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <!--ssr-meta-->
8
- </head>
9
- <body>
10
- <div id="root"><!--ssr-outlet--></div>
11
- <!--ssr-meta-->
12
- <script type="module" src="/_boot.js"></script>
13
- </body>
14
- </html>`;