eddev 2.0.0-beta.5 → 2.0.0-beta.50

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 (220) hide show
  1. package/dist/app/entry/MetaTags.d.ts +7 -0
  2. package/dist/app/entry/MetaTags.js +17 -0
  3. package/dist/app/entry/boot-admin.d.ts +1 -0
  4. package/dist/app/entry/{main.admin.js → boot-admin.js} +3 -5
  5. package/dist/app/entry/spa-root.d.ts +1 -0
  6. package/dist/app/entry/{Root.js → spa-root.js} +4 -4
  7. package/dist/app/entry/ssr-root-client.d.ts +6 -0
  8. package/dist/app/entry/ssr-root-client.js +27 -0
  9. package/dist/app/entry/ssr-root.d.ts +10 -0
  10. package/dist/app/entry/ssr-root.js +24 -0
  11. package/dist/app/lib/admin/index.d.ts +2 -2
  12. package/dist/app/lib/admin/index.js +2 -2
  13. package/dist/app/lib/admin/installFieldTypes.js +1 -1
  14. package/dist/app/lib/admin/runWidgets.js +1 -1
  15. package/dist/app/lib/blocks/ContentBlocks.js +4 -4
  16. package/dist/app/lib/blocks/EditableText.d.ts +1 -1
  17. package/dist/app/lib/blocks/EditableText.js +3 -3
  18. package/dist/app/lib/blocks/ErrorBoundaryFrontend.js +1 -0
  19. package/dist/app/lib/blocks/InnerBlocks.d.ts +13 -3
  20. package/dist/app/lib/blocks/InnerBlocks.js +13 -5
  21. package/dist/app/lib/blocks/block-utils.d.ts +2 -2
  22. package/dist/app/lib/blocks/block-utils.js +2 -2
  23. package/dist/app/lib/blocks/editor/EditorSupport.js +3 -3
  24. package/dist/app/lib/blocks/editor/editor-config.d.ts +1 -1
  25. package/dist/app/lib/blocks/editor/editor-config.js +1 -1
  26. package/dist/app/lib/blocks/editor/installGutenbergHooks.js +5 -5
  27. package/dist/app/lib/blocks/editor/usePostEditor.d.ts +1 -1
  28. package/dist/app/lib/blocks/index.d.ts +9 -9
  29. package/dist/app/lib/blocks/index.js +9 -9
  30. package/dist/app/lib/blocks/inline-editing.d.ts +1 -1
  31. package/dist/app/lib/blocks/inline-editing.js +7 -5
  32. package/dist/app/lib/devtools/components/BreakpointIndicator.js +6 -4
  33. package/dist/app/lib/devtools/components/DevUI.js +4 -3
  34. package/dist/app/lib/devtools/components/GridIndicator.d.ts +1 -0
  35. package/dist/app/lib/devtools/components/GridIndicator.js +24 -0
  36. package/dist/app/lib/devtools/dev-tools-store.d.ts +9 -0
  37. package/dist/app/lib/devtools/dev-tools-store.js +8 -0
  38. package/dist/app/lib/devtools/hooks/usePersistState.d.ts +1 -1
  39. package/dist/app/lib/devtools/hooks/usePersistState.js +11 -2
  40. package/dist/app/lib/devtools/hooks/useTailwind.d.ts +1078 -1079
  41. package/dist/app/lib/devtools/hooks/useTailwind.js +6 -3
  42. package/dist/app/lib/devtools/index.d.ts +1 -0
  43. package/dist/app/lib/devtools/index.js +1 -1
  44. package/dist/app/lib/devtools/loader.js +8 -7
  45. package/dist/app/lib/devtools/useQueryDebug.d.ts +7 -1
  46. package/dist/app/lib/devtools/useQueryDebug.js +5 -8
  47. package/dist/app/lib/dynamic/index.d.ts +1 -1
  48. package/dist/app/lib/dynamic/index.js +1 -1
  49. package/dist/app/lib/hooks/apiConfig.d.ts +3 -1
  50. package/dist/app/lib/hooks/apiConfig.js +9 -4
  51. package/dist/app/lib/hooks/index.d.ts +4 -5
  52. package/dist/app/lib/hooks/index.js +4 -5
  53. package/dist/app/lib/hooks/queryUtils.d.ts +5 -2
  54. package/dist/app/lib/hooks/queryUtils.js +19 -20
  55. package/dist/app/lib/hooks/useAppData.js +1 -1
  56. package/dist/app/lib/internal/index.d.ts +4 -4
  57. package/dist/app/lib/internal/index.js +4 -4
  58. package/dist/app/lib/internal/internal-store.d.ts +0 -2
  59. package/dist/app/lib/internal/internal-store.js +1 -3
  60. package/dist/app/lib/internal/read-admin-manifest.d.ts +1 -1
  61. package/dist/app/lib/legacy-stitches/createStitches.d.ts +21 -21
  62. package/dist/app/lib/legacy-stitches/createStitches.js +1 -1
  63. package/dist/app/lib/legacy-stitches/index.d.ts +1 -1
  64. package/dist/app/lib/legacy-stitches/index.js +1 -1
  65. package/dist/app/lib/routing/components/BackButton.d.ts +49 -0
  66. package/dist/app/lib/routing/components/BackButton.js +47 -0
  67. package/dist/app/lib/routing/components/BrowserRouter.d.ts +4 -1
  68. package/dist/app/lib/routing/components/BrowserRouter.js +79 -11
  69. package/dist/app/lib/routing/components/ClientOnly.js +1 -1
  70. package/dist/app/lib/routing/components/Link.d.ts +1 -0
  71. package/dist/app/lib/routing/components/Link.js +9 -10
  72. package/dist/app/lib/routing/components/RouteRenderer.d.ts +1 -1
  73. package/dist/app/lib/routing/components/RouteRenderer.js +7 -6
  74. package/dist/app/lib/routing/components/SSRRouter.d.ts +2 -2
  75. package/dist/app/lib/routing/components/SSRRouter.js +5 -6
  76. package/dist/app/lib/routing/components/ScrollRestoration.js +1 -1
  77. package/dist/app/lib/routing/context.d.ts +8 -5
  78. package/dist/app/lib/routing/context.js +13 -96
  79. package/dist/app/lib/routing/hooks/useRestorableState.d.ts +2 -1
  80. package/dist/app/lib/routing/hooks/useRestorableState.js +2 -1
  81. package/dist/app/lib/routing/hooks/useRoute.d.ts +16 -1
  82. package/dist/app/lib/routing/hooks/useRoute.js +22 -1
  83. package/dist/app/lib/routing/hooks/useRouteMeta.d.ts +5 -0
  84. package/dist/app/lib/routing/hooks/useRouteMeta.js +9 -0
  85. package/dist/app/lib/routing/hooks/useRouteTransition.d.ts +1 -1
  86. package/dist/app/lib/routing/hooks/useRouteTransition.js +1 -1
  87. package/dist/app/lib/routing/hooks/useRouter.d.ts +1 -1
  88. package/dist/app/lib/routing/hooks/useRouter.js +1 -1
  89. package/dist/app/lib/routing/hooks/useRouterEvents.d.ts +1 -1
  90. package/dist/app/lib/routing/hooks/useRouterEvents.js +1 -1
  91. package/dist/app/lib/routing/hooks/useRouterState.d.ts +1 -1
  92. package/dist/app/lib/routing/hooks/useRouterState.js +1 -1
  93. package/dist/app/lib/routing/hooks/useSearchParams.js +2 -2
  94. package/dist/app/lib/routing/index.d.ts +14 -13
  95. package/dist/app/lib/routing/index.js +14 -13
  96. package/dist/app/lib/routing/loader.d.ts +2 -2
  97. package/dist/app/lib/routing/loader.js +7 -5
  98. package/dist/app/lib/routing/types.d.ts +28 -8
  99. package/dist/app/lib/routing/utils.d.ts +3 -1
  100. package/dist/app/lib/routing/utils.js +12 -1
  101. package/dist/app/lib/views/index.d.ts +1 -1
  102. package/dist/app/lib/views/index.js +1 -1
  103. package/dist/app/server/defineRouter.d.ts +2 -0
  104. package/dist/app/server/defineRouter.js +4 -0
  105. package/dist/app/server/index.d.ts +4 -0
  106. package/dist/app/server/index.js +4 -0
  107. package/dist/app/server/proxy-wp-admin.d.ts +3 -0
  108. package/dist/app/server/proxy-wp-admin.js +105 -0
  109. package/dist/app/server/render-ssr-page.d.ts +5 -0
  110. package/dist/app/server/render-ssr-page.js +31 -0
  111. package/dist/app/server/server-context.d.ts +50 -0
  112. package/dist/app/server/server-context.js +145 -0
  113. package/dist/app/server/utils/headers.d.ts +1 -0
  114. package/dist/app/server/utils/headers.js +17 -0
  115. package/dist/app/server/utils/replace-host.d.ts +6 -4
  116. package/dist/app/server/utils/replace-host.js +58 -11
  117. package/dist/node/cli/cli-worker.d.ts +1 -1
  118. package/dist/node/cli/cli-worker.js +7 -2
  119. package/dist/node/cli/cli.js +84 -12
  120. package/dist/node/cli/display/CLIApp.d.ts +1 -1
  121. package/dist/node/cli/display/CLIApp.js +3 -6
  122. package/dist/node/cli/display/components/LogEntries.d.ts +1 -1
  123. package/dist/node/cli/display/hooks/useStatefulLog.d.ts +1 -1
  124. package/dist/node/cli/display/tools/CreateBlock.d.ts +1 -1
  125. package/dist/node/cli/display/tools/cli-tools.d.ts +1 -11
  126. package/dist/node/cli/display/tools/cli-tools.js +9 -9
  127. package/dist/node/cli/display/util/colors.d.ts +2 -2
  128. package/dist/node/cli/version.d.ts +1 -1
  129. package/dist/node/cli/version.js +1 -1
  130. package/dist/node/compiler/build-vinxi.d.ts +8 -0
  131. package/dist/node/compiler/build-vinxi.js +37 -0
  132. package/dist/node/compiler/bundler.admin.d.ts +2 -2
  133. package/dist/node/compiler/bundler.admin.js +3 -4
  134. package/dist/node/compiler/bundler.frontend.d.ts +1 -1
  135. package/dist/node/compiler/bundler.frontend.js +3 -4
  136. package/dist/node/compiler/{serverless.dev.d.ts → dev-server.d.ts} +7 -5
  137. package/dist/node/compiler/dev-server.js +105 -0
  138. package/dist/node/compiler/get-vite-config.d.ts +19 -0
  139. package/dist/node/compiler/get-vite-config.js +200 -0
  140. package/dist/node/compiler/vinxi-app.d.ts +19 -0
  141. package/dist/node/compiler/vinxi-app.js +167 -0
  142. package/dist/node/compiler/vinxi-codegen.d.ts +12 -0
  143. package/dist/node/compiler/vinxi-codegen.js +464 -0
  144. package/dist/node/graphql/graphql-codegen.d.ts +1 -1
  145. package/dist/node/graphql/graphql-codegen.js +63 -16
  146. package/dist/node/graphql/graphql-schema-loader.js +15 -18
  147. package/dist/node/project/config.d.ts +31 -37
  148. package/dist/node/project/config.js +13 -11
  149. package/dist/node/project/env.d.ts +1 -1
  150. package/dist/node/project/env.js +1 -1
  151. package/dist/node/project/manifest/block-manifest.js +2 -2
  152. package/dist/node/project/manifest/manifest.d.ts +1 -1
  153. package/dist/node/project/manifest/manifest.js +1 -1
  154. package/dist/node/project/manifest/view-manifest.js +2 -2
  155. package/dist/node/project/project.d.ts +3 -2
  156. package/dist/node/project/project.js +18 -20
  157. package/dist/node/project/wp-info.js +3 -2
  158. package/dist/node/types/view-type.js +3 -4
  159. package/dist/node/utils/fs-codegen.d.ts +40 -0
  160. package/dist/node/utils/fs-codegen.js +97 -0
  161. package/dist/node/utils/fs.js +2 -0
  162. package/dist/node/utils/{selfSignedCert.js → self-signed-cert.js} +1 -1
  163. package/dist/node/utils/{statefulLog.js → stateful-log.js} +1 -1
  164. package/package.json +31 -32
  165. package/types.app.d.ts +2 -2
  166. package/types.app.internal.d.ts +2 -2
  167. package/types.node.d.ts +3 -3
  168. package/dist/app/entry/Root.d.ts +0 -1
  169. package/dist/app/entry/main.admin.d.ts +0 -3
  170. package/dist/app/entry/main.frontend.spa.d.ts +0 -3
  171. package/dist/app/entry/main.frontend.spa.js +0 -13
  172. package/dist/app/entry/main.frontend.ssr.d.ts +0 -21
  173. package/dist/app/entry/main.frontend.ssr.js +0 -79
  174. package/dist/app/entry/main.serverless.dev.d.ts +0 -4
  175. package/dist/app/entry/main.serverless.dev.js +0 -21
  176. package/dist/app/lib/hooks/usePageLoad.d.ts +0 -6
  177. package/dist/app/lib/hooks/usePageLoad.js +0 -5
  178. package/dist/app/server/create-api-builtin-hono.d.ts +0 -8
  179. package/dist/app/server/create-api-builtin-hono.js +0 -80
  180. package/dist/app/server/create-ssr-hono.d.ts +0 -18
  181. package/dist/app/server/create-ssr-hono.js +0 -104
  182. package/dist/app/server/utils/index.html.d.ts +0 -2
  183. package/dist/app/server/utils/index.html.js +0 -14
  184. package/dist/node/compiler/index.html.d.ts +0 -2
  185. package/dist/node/compiler/index.html.js +0 -15
  186. package/dist/node/compiler/serverless.dev.js +0 -218
  187. package/dist/node/compiler/vite/get-vite-config.d.ts +0 -13
  188. package/dist/node/compiler/vite/get-vite-config.js +0 -315
  189. package/dist/node/compiler/vite/plugin-admin.d.ts +0 -4
  190. package/dist/node/compiler/vite/plugin-admin.js +0 -67
  191. package/dist/node/compiler/vite/plugin-blocks.d.ts +0 -4
  192. package/dist/node/compiler/vite/plugin-blocks.js +0 -73
  193. package/dist/node/compiler/vite/plugin-entry.d.ts +0 -6
  194. package/dist/node/compiler/vite/plugin-entry.js +0 -16
  195. package/dist/node/compiler/vite/plugin-resolved-tailwind.d.ts +0 -4
  196. package/dist/node/compiler/vite/plugin-resolved-tailwind.js +0 -29
  197. package/dist/node/compiler/vite/plugin-theme.d.ts +0 -4
  198. package/dist/node/compiler/vite/plugin-theme.js +0 -40
  199. package/dist/node/compiler/vite/plugin-views.d.ts +0 -4
  200. package/dist/node/compiler/vite/plugin-views.js +0 -51
  201. package/dist/node/utils/console.d.ts +0 -21
  202. package/dist/node/utils/console.js +0 -28
  203. package/dist/node/utils/unsafe-fetch.d.ts +0 -2
  204. package/dist/node/utils/unsafe-fetch.js +0 -19
  205. package/tsup.config.ts +0 -40
  206. package/types.manifests.d.ts +0 -22
  207. /package/dist/node/utils/{formatZodError.d.ts → format-zod-error.d.ts} +0 -0
  208. /package/dist/node/utils/{formatZodError.js → format-zod-error.js} +0 -0
  209. /package/dist/node/utils/{getRepoInfo.d.ts → get-repo-info.d.ts} +0 -0
  210. /package/dist/node/utils/{getRepoInfo.js → get-repo-info.js} +0 -0
  211. /package/dist/node/utils/{highlightCode.d.ts → highlight-code.d.ts} +0 -0
  212. /package/dist/node/utils/{highlightCode.js → highlight-code.js} +0 -0
  213. /package/dist/node/utils/{isDeploying.d.ts → is-deploying.d.ts} +0 -0
  214. /package/dist/node/utils/{isDeploying.js → is-deploying.js} +0 -0
  215. /package/dist/node/utils/{selfSignedCert.d.ts → self-signed-cert.d.ts} +0 -0
  216. /package/dist/node/utils/{statefulLog.d.ts → stateful-log.d.ts} +0 -0
  217. /package/dist/node/utils/{export-extractor.d.ts → ts-export-extractor.d.ts} +0 -0
  218. /package/dist/node/utils/{export-extractor.js → ts-export-extractor.js} +0 -0
  219. /package/dist/node/utils/{watchFileTree.d.ts → watch-file-tree.d.ts} +0 -0
  220. /package/dist/node/utils/{watchFileTree.js → watch-file-tree.js} +0 -0
@@ -5,31 +5,25 @@ export declare const EDConfigSchema: z.ZodObject<{
5
5
  version: z.ZodEffects<z.ZodEnum<["1", "2"]>, "2", "1" | "2">;
6
6
  legacyMetadata: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
7
7
  legacyStitches: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
8
- tracking: z.ZodOptional<z.ZodObject<{
9
- tagManagerID: z.ZodOptional<z.ZodString>;
10
- ga: z.ZodOptional<z.ZodObject<{
11
- trackingID: z.ZodOptional<z.ZodString>;
12
- version: z.ZodEnum<["3", "4"]>;
13
- }, "strip", z.ZodTypeAny, {
14
- version: "3" | "4";
15
- trackingID?: string | undefined;
16
- }, {
17
- version: "3" | "4";
18
- trackingID?: string | undefined;
19
- }>>;
8
+ trackers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"provider", [z.ZodObject<{
9
+ provider: z.ZodLiteral<"ga4">;
10
+ id: z.ZodString;
20
11
  }, "strip", z.ZodTypeAny, {
21
- tagManagerID?: string | undefined;
22
- ga?: {
23
- version: "3" | "4";
24
- trackingID?: string | undefined;
25
- } | undefined;
12
+ provider: "ga4";
13
+ id: string;
26
14
  }, {
27
- tagManagerID?: string | undefined;
28
- ga?: {
29
- version: "3" | "4";
30
- trackingID?: string | undefined;
31
- } | undefined;
32
- }>>;
15
+ provider: "ga4";
16
+ id: string;
17
+ }>, z.ZodObject<{
18
+ provider: z.ZodLiteral<"gtm">;
19
+ id: z.ZodString;
20
+ }, "strip", z.ZodTypeAny, {
21
+ provider: "gtm";
22
+ id: string;
23
+ }, {
24
+ provider: "gtm";
25
+ id: string;
26
+ }>]>, "many">>;
33
27
  serverless: z.ZodObject<{
34
28
  enabled: z.ZodDefault<z.ZodBoolean>;
35
29
  uploads: z.ZodEnum<["proxy", "remote"]>;
@@ -85,13 +79,13 @@ export declare const EDConfigSchema: z.ZodObject<{
85
79
  };
86
80
  devUI: "enabled" | "disabled";
87
81
  $schema?: string | undefined;
88
- tracking?: {
89
- tagManagerID?: string | undefined;
90
- ga?: {
91
- version: "3" | "4";
92
- trackingID?: string | undefined;
93
- } | undefined;
94
- } | undefined;
82
+ trackers?: ({
83
+ provider: "ga4";
84
+ id: string;
85
+ } | {
86
+ provider: "gtm";
87
+ id: string;
88
+ })[] | undefined;
95
89
  cache?: Record<string, {
96
90
  props: number;
97
91
  queries: number;
@@ -111,13 +105,13 @@ export declare const EDConfigSchema: z.ZodObject<{
111
105
  $schema?: string | undefined;
112
106
  legacyMetadata?: boolean | undefined;
113
107
  legacyStitches?: boolean | undefined;
114
- tracking?: {
115
- tagManagerID?: string | undefined;
116
- ga?: {
117
- version: "3" | "4";
118
- trackingID?: string | undefined;
119
- } | undefined;
120
- } | undefined;
108
+ trackers?: ({
109
+ provider: "ga4";
110
+ id: string;
111
+ } | {
112
+ provider: "gtm";
113
+ id: string;
114
+ })[] | undefined;
121
115
  cache?: Record<string, {
122
116
  props: number;
123
117
  queries: number;
@@ -4,7 +4,7 @@ import { z } from "zod";
4
4
  import { zodToJsonSchema } from "zod-to-json-schema";
5
5
  import { cliMode } from "../cli/cli-mode.js";
6
6
  import { fs } from "../utils/fs.js";
7
- import { isDeploying } from "../utils/isDeploying.js";
7
+ import { isDeploying } from "../utils/is-deploying.js";
8
8
  import { projectLog as console } from "./project.js";
9
9
  export const EDConfigSchema = z.object({
10
10
  $schema: z.string().optional(),
@@ -15,16 +15,18 @@ export const EDConfigSchema = z.object({
15
15
  .default(false)
16
16
  .describe("Whether to use legacy comments or exported JSON for block and view metadata"),
17
17
  legacyStitches: z.boolean().optional().default(true).describe("Whether this site is using Stitches"),
18
- tracking: z
19
- .object({
20
- tagManagerID: z.string().optional(),
21
- ga: z
22
- .object({
23
- trackingID: z.string().optional(),
24
- version: z.enum(["3", "4"]),
25
- })
26
- .optional(),
27
- })
18
+ trackers: z
19
+ .array(z.discriminatedUnion("provider", [
20
+ z.object({
21
+ provider: z.literal("ga4"),
22
+ id: z.string().describe("The Google Analytics 4 tracking ID"),
23
+ }),
24
+ z.object({
25
+ provider: z.literal("gtm"),
26
+ id: z.string().describe("The Google Tag Manager project ID (eg. GTM-XXXXXXX)"),
27
+ }),
28
+ ]))
29
+ .describe("An array of standard tracking codes to embed")
28
30
  .optional(),
29
31
  serverless: z.object({
30
32
  enabled: z.boolean().default(true).describe("Whether to deploy the site as a serverless app"),
@@ -35,5 +35,5 @@ export declare const ProjectEnvUtils: {
35
35
  valid: false;
36
36
  };
37
37
  getSafe<T extends ProjectEnvKey>(key: T): Required<ProjectEnvMap[T]> | undefined;
38
- get<T extends ProjectEnvKey>(key: T, cons?: import("../utils/statefulLog.js").StatefulLog<import("./project.js").Project>): z.infer<(typeof fields)[T]>;
38
+ get<T extends ProjectEnvKey>(key: T, cons?: import("../utils/stateful-log.js").StatefulLog<import("./project.js").Project>): z.infer<(typeof fields)[T]>;
39
39
  };
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { cliMode } from "../cli/cli-mode.js";
3
3
  import { projectLog as console } from "./project.js";
4
- import { formatZodError } from "../utils/formatZodError.js";
4
+ import { formatZodError } from "../utils/format-zod-error.js";
5
5
  const portNumber = z
6
6
  .string()
7
7
  .default("0")
@@ -1,8 +1,8 @@
1
1
  import { camelCase, kebabCase } from "change-case-all";
2
2
  import { cliMode } from "../../cli/cli-mode.js";
3
3
  import { BlockMetaSchema } from "../../types/block-type.js";
4
- import { metaExtractor } from "../../utils/export-extractor.js";
5
- import { formatZodError } from "../../utils/formatZodError.js";
4
+ import { metaExtractor } from "../../utils/ts-export-extractor.js";
5
+ import { formatZodError } from "../../utils/format-zod-error.js";
6
6
  import { fs } from "../../utils/fs.js";
7
7
  import { createManifestGenerator } from "./manifest.js";
8
8
  export function loadBlockManifest(project) {
@@ -1,4 +1,4 @@
1
- import { FileEvent } from "../../utils/watchFileTree.js";
1
+ import { FileEvent } from "../../utils/watch-file-tree.js";
2
2
  type ManifestEntry<TEntryData> = {
3
3
  key: string;
4
4
  relativePath: string;
@@ -1,4 +1,4 @@
1
- import { getFileTree, watchFileTree } from "../../utils/watchFileTree.js";
1
+ import { getFileTree, watchFileTree } from "../../utils/watch-file-tree.js";
2
2
  import { relative } from "path";
3
3
  export function createManifestGenerator(args) {
4
4
  let subscribers = new Set();
@@ -1,9 +1,9 @@
1
1
  import { basename } from "node:path";
2
2
  import { cliMode } from "../../cli/cli-mode.js";
3
3
  import { ViewMetaSchema } from "../../types/view-type.js";
4
- import { metaExtractor } from "../../utils/export-extractor.js";
5
- import { formatZodError } from "../../utils/formatZodError.js";
4
+ import { formatZodError } from "../../utils/format-zod-error.js";
6
5
  import { fs } from "../../utils/fs.js";
6
+ import { metaExtractor } from "../../utils/ts-export-extractor.js";
7
7
  import { createManifestGenerator } from "./manifest.js";
8
8
  export function loadViewManifest(project) {
9
9
  return createManifestGenerator({
@@ -1,9 +1,9 @@
1
1
  import { EDConfig } from "./config.js";
2
2
  import { BlockManifestGenerator } from "./manifest/block-manifest.js";
3
- import { ViewManifestGenerator } from "./manifest/view-manifest.js";
4
3
  import { FieldManifestGenerator } from "./manifest/field-manifest.js";
4
+ import { ViewManifestGenerator } from "./manifest/view-manifest.js";
5
5
  import { WidgetManifestGenerator } from "./manifest/widget-manifest.js";
6
- export declare const projectLog: import("../utils/statefulLog.js").StatefulLog<Project>;
6
+ export declare const projectLog: import("../utils/stateful-log.js").StatefulLog<Project>;
7
7
  type ProjectArgs = {
8
8
  rootDir: string;
9
9
  reportPluginCompatibility?: boolean;
@@ -18,6 +18,7 @@ export declare class Project {
18
18
  publicUrl: string;
19
19
  repoUrl: string;
20
20
  configFile: string;
21
+ origin: string;
21
22
  config?: EDConfig;
22
23
  blocks: BlockManifestGenerator;
23
24
  views: ViewManifestGenerator;
@@ -1,19 +1,16 @@
1
- import * as clack from "@clack/prompts";
1
+ import { objFormat } from "obj-console";
2
2
  import { relative, resolve } from "path";
3
3
  import { undent } from "undent";
4
- import { cliMode } from "../cli/cli-mode.js";
5
- // import { console } from "../utils/console.js"
6
- import { objFormat } from "obj-console";
7
- import { getRepoInfo } from "../utils/getRepoInfo.js";
8
- import { isDeploying } from "../utils/isDeploying.js";
9
- import { createConsole } from "../utils/statefulLog.js";
4
+ import { getRepoInfo } from "../utils/get-repo-info.js";
5
+ import { isDeploying } from "../utils/is-deploying.js";
6
+ import { createConsole } from "../utils/stateful-log.js";
10
7
  import { Configurator } from "./config.js";
11
- import { loadBlockManifest } from "./manifest/block-manifest.js";
12
- import { loadViewManifest } from "./manifest/view-manifest.js";
13
- import { WPInfo } from "./wp-info.js";
14
8
  import { ProjectEnvUtils } from "./env.js";
9
+ import { loadBlockManifest } from "./manifest/block-manifest.js";
15
10
  import { loadFieldManifest } from "./manifest/field-manifest.js";
11
+ import { loadViewManifest } from "./manifest/view-manifest.js";
16
12
  import { loadWidgetManifest } from "./manifest/widget-manifest.js";
13
+ import { WPInfo } from "./wp-info.js";
17
14
  const console = createConsole("Project", "project");
18
15
  export const projectLog = console;
19
16
  /**
@@ -26,6 +23,7 @@ export class Project {
26
23
  publicUrl = "";
27
24
  repoUrl = "";
28
25
  configFile = "";
26
+ origin = "";
29
27
  config;
30
28
  blocks;
31
29
  views;
@@ -35,12 +33,13 @@ export class Project {
35
33
  reportPluginCompatibility = false;
36
34
  constructor(opts) {
37
35
  this.rootDir = opts.rootDir;
36
+ this.origin = ProjectEnvUtils.getSafe("SITE_URL") ?? "";
38
37
  this.reportPluginCompatibility = opts.reportPluginCompatibility || false;
39
38
  this.blocks = loadBlockManifest(this);
40
39
  this.views = loadViewManifest(this);
41
40
  this.fields = loadFieldManifest(this);
42
41
  this.widgets = loadWidgetManifest(this);
43
- this.wp = new WPInfo(ProjectEnvUtils.get("SITE_URL"));
42
+ this.wp = new WPInfo(this.origin);
44
43
  }
45
44
  async load() {
46
45
  console.setWorking(true);
@@ -62,15 +61,14 @@ export class Project {
62
61
 
63
62
  You should rename the folder to match the repo name, or vice versa.
64
63
  `);
65
- if (cliMode.interactive) {
66
- await clack.confirm({
67
- message: `Ignore and continue anyway?`,
68
- });
69
- }
70
- else {
71
- console.flush();
72
- process.exit(1);
73
- }
64
+ // if (cliMode.interactive) {
65
+ // await clack.confirm({
66
+ // message: `Ignore and continue anyway?`,
67
+ // })
68
+ // } else {
69
+ // console.flush()
70
+ // process.exit(1)
71
+ // }
74
72
  }
75
73
  /**
76
74
  * Load configuration
@@ -1,5 +1,4 @@
1
1
  import { resolveURL } from "ufo";
2
- import { getUnsafeFetch } from "../utils/unsafe-fetch.js";
3
2
  export class WPInfo {
4
3
  siteUrl;
5
4
  cached;
@@ -7,10 +6,12 @@ export class WPInfo {
7
6
  this.siteUrl = siteUrl;
8
7
  }
9
8
  async getInfo(force = false) {
9
+ if (!this.siteUrl) {
10
+ throw new Error("Attempted to get site info from WordPress, but SITE_URL was not present in the environment.");
11
+ }
10
12
  if (this.cached && !force)
11
13
  return this.cached;
12
14
  const url = resolveURL(this.siteUrl, "/wp-json/ed/v1/dev/site-info");
13
- const fetch = getUnsafeFetch(this.siteUrl);
14
15
  const response = await fetch(url);
15
16
  const result = (await response.json());
16
17
  this.cached = result;
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import { objFormat } from "obj-console";
3
- import { console } from "../utils/console.js";
4
3
  import chalk from "chalk";
5
4
  import { indent } from "../utils/helpers.js";
6
5
  export const ViewMetaSchema = z.object({
@@ -28,7 +27,7 @@ export function describeView(view) {
28
27
  return output;
29
28
  }
30
29
  export function describeViewManifest(manifest) {
31
- console.heading("View Manifest");
30
+ console.log("View Manifest");
32
31
  console.info("Discovered " + Object.keys(manifest.views).length + " view(s)");
33
32
  const totalWarnings = manifest.validationMessages.filter((m) => m.severity === "warning").length;
34
33
  const totalErrors = manifest.validationMessages.filter((m) => m.severity === "error").length;
@@ -48,7 +47,7 @@ export function describeViewManifest(manifest) {
48
47
  console.log(indent(4, describeView(view)));
49
48
  }
50
49
  if (totalWarnings > 0)
51
- console.failish(totalWarnings + " warning(s) while loading view metadata");
50
+ console.warn(totalWarnings + " warning(s) while loading view metadata");
52
51
  if (totalErrors > 0)
53
- console.fail(totalErrors + " error(s) while loading view metadata");
52
+ console.warn(totalErrors + " error(s) while loading view metadata");
54
53
  }
@@ -0,0 +1,40 @@
1
+ import { Code } from "ts-poet";
2
+ import { Project } from "../project/project.js";
3
+ type VirtualFile = {
4
+ name: string;
5
+ content: string | Code;
6
+ };
7
+ type CodeGenerator = {
8
+ getFiles(): Promise<VirtualFile | VirtualFile[] | null>;
9
+ susbcribe?(callback: () => void): () => void;
10
+ };
11
+ /**
12
+ * A codegen utility that allows you to procedurally and reactively generate files, to be flushed to the FS.
13
+ */
14
+ export declare class FSCodegen {
15
+ project: Project;
16
+ opts: {
17
+ outDir: string;
18
+ };
19
+ outDir: string;
20
+ private generators;
21
+ private generatorFiles;
22
+ private unsubscribers;
23
+ private flushScheduled;
24
+ constructor(project: Project, opts: {
25
+ outDir: string;
26
+ });
27
+ register(generator: CodeGenerator): void;
28
+ registerFile({ name, generate, subscribe, }: {
29
+ name: string;
30
+ generate: (() => string | Code | Promise<string | Code>) | string | Code;
31
+ subscribe?: (callback: () => void) => () => void;
32
+ }): void;
33
+ private runGenerator;
34
+ scheduleFlush(): void;
35
+ runAndWatch(): Promise<void>;
36
+ run(): Promise<void>;
37
+ private flush;
38
+ stop(): void;
39
+ }
40
+ export {};
@@ -0,0 +1,97 @@
1
+ import { Code } from "ts-poet";
2
+ import { globby } from "globby";
3
+ import { fs } from "./fs.js";
4
+ import { join, resolve } from "path";
5
+ /**
6
+ * A codegen utility that allows you to procedurally and reactively generate files, to be flushed to the FS.
7
+ */
8
+ export class FSCodegen {
9
+ project;
10
+ opts;
11
+ outDir;
12
+ generators = new Set();
13
+ generatorFiles = new Map();
14
+ unsubscribers = new Set();
15
+ flushScheduled = false;
16
+ constructor(project, opts) {
17
+ this.project = project;
18
+ this.opts = opts;
19
+ this.outDir = opts.outDir;
20
+ }
21
+ register(generator) {
22
+ this.generators.add(generator);
23
+ }
24
+ registerFile({ name, generate, subscribe, }) {
25
+ this.register({
26
+ async getFiles() {
27
+ return {
28
+ name,
29
+ content: generate instanceof Code ? generate.toString() : typeof generate === "string" ? generate : await generate(),
30
+ };
31
+ },
32
+ susbcribe: subscribe,
33
+ });
34
+ }
35
+ async runGenerator(generator) {
36
+ const files = await generator.getFiles();
37
+ this.generatorFiles.set(generator, files ? (Array.isArray(files) ? files : [files]) : []);
38
+ this.scheduleFlush();
39
+ }
40
+ scheduleFlush() {
41
+ if (this.flushScheduled) {
42
+ return;
43
+ }
44
+ this.flushScheduled = true;
45
+ setTimeout(() => {
46
+ this.flushScheduled = false;
47
+ this.flush();
48
+ }, 100);
49
+ }
50
+ async runAndWatch() {
51
+ await Promise.all(Array.from(this.generators).map((generator) => {
52
+ return new Promise((resolve) => {
53
+ let first = true;
54
+ if (generator.susbcribe) {
55
+ // Subscribe and run at least once
56
+ this.unsubscribers.add(generator.susbcribe(() => {
57
+ if (first) {
58
+ first = false;
59
+ this.runGenerator(generator).then(resolve);
60
+ }
61
+ else {
62
+ this.runGenerator(generator);
63
+ }
64
+ }));
65
+ }
66
+ else {
67
+ // Just run once, since there is no subscriber
68
+ this.runGenerator(generator).then(resolve);
69
+ }
70
+ });
71
+ }));
72
+ await this.flush();
73
+ }
74
+ async run() {
75
+ await Promise.all(Array.from(this.generators).map((generator) => this.runGenerator(generator)));
76
+ await this.flush();
77
+ }
78
+ async flush() {
79
+ const files = Array.from(this.generatorFiles.values()).flat();
80
+ const existing = (await globby(this.outDir + "/**/*")).map((path) => resolve(this.project.rootDir, path));
81
+ const written = new Set();
82
+ await Promise.all(files.map(async (file) => {
83
+ const path = join(this.project.rootDir, this.outDir, file.name);
84
+ written.add(resolve(this.project.rootDir, path));
85
+ await fs.writeIfUnchanged(path, file.content.toString());
86
+ }));
87
+ await Promise.all(existing.map(async (path) => {
88
+ if (!written.has(path)) {
89
+ await fs.rm(path);
90
+ }
91
+ }));
92
+ }
93
+ stop() {
94
+ this.unsubscribers.forEach((unsub) => unsub());
95
+ this.unsubscribers.clear();
96
+ }
97
+ }
@@ -1,7 +1,9 @@
1
1
  import * as nodeFs from "fs/promises";
2
+ import { dirname } from "path";
2
3
  export const fs = {
3
4
  ...nodeFs,
4
5
  writeIfUnchanged: async (path, content) => {
6
+ await fs.mkdirp(dirname(path));
5
7
  try {
6
8
  const currentContent = await nodeFs.readFile(path, "utf8");
7
9
  if (currentContent === content)
@@ -1,4 +1,4 @@
1
- import { serverlessLog } from "../compiler/serverless.dev.js";
1
+ import { serverlessLog } from "../compiler/dev-server.js";
2
2
  import { fs } from "./fs.js";
3
3
  import { createCA, createCert } from "mkcert";
4
4
  export async function ensureSelfSignedCert(hostname, rootDir) {
@@ -1,5 +1,5 @@
1
1
  import { cliMode } from "../cli/cli-mode.js";
2
- import { eachFormattedZodError } from "./formatZodError.js";
2
+ import { eachFormattedZodError } from "./format-zod-error.js";
3
3
  import chalk from "chalk";
4
4
  let logId = 0;
5
5
  const getID = () => logId++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eddev",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.50",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -34,23 +34,34 @@
34
34
  "types": "./dist/app/lib/dynamic/index.d.ts",
35
35
  "import": "./dist/app/lib/dynamic/index.js"
36
36
  },
37
- "./types.app.public": {
38
- "types": "./types.app.d.ts"
37
+ "./devtools": {
38
+ "types": "./dist/app/lib/devtools/index.d.ts",
39
+ "import": "./dist/app/lib/devtools/index.js"
40
+ },
41
+ "./server": {
42
+ "types": "./dist/app/server/index.d.ts",
43
+ "import": "./dist/app/server/index.js"
44
+ },
45
+ "./_internal/boot-admin.js": {
46
+ "import": "./dist/app/entry/boot-admin.js"
39
47
  },
40
- "./_internal/_entry/main.frontend.spa.js": {
41
- "import": "./dist/app/entry/main.frontend.spa.js"
48
+ "./_internal/spa-root.js": {
49
+ "import": "./dist/app/entry/spa-root.js"
42
50
  },
43
- "./_internal/_entry/main.admin.js": {
44
- "import": "./dist/app/entry/main.admin.js"
51
+ "./_internal/ssr-root-client.js": {
52
+ "import": "./dist/app/entry/ssr-root-client.js"
45
53
  },
46
- "./_internal/_entry/main.frontend.ssr.js": {
47
- "import": "./dist/app/entry/main.frontend.ssr.js"
54
+ "./_internal/ssr-root.js": {
55
+ "import": "./dist/app/entry/ssr-root.js"
48
56
  },
49
- "./_internal/_entry/main.serverless.dev.js": {
50
- "import": "./dist/app/entry/main.serverless.dev.js"
57
+ "./_internal/create-vinxi-app.js": {
58
+ "import": "./dist/node/compiler/vinxi-app.js"
51
59
  },
52
60
  "./_internal": {
53
61
  "import": "./dist/app/lib/internal/index.js"
62
+ },
63
+ "./types.app.public": {
64
+ "types": "./types.app.d.ts"
54
65
  }
55
66
  },
56
67
  "scripts": {
@@ -67,56 +78,40 @@
67
78
  "@graphql-codegen/typescript-operations": "^4.0.1",
68
79
  "@graphql-tools/load": "^8.0.0",
69
80
  "@graphql-tools/url-loader": "^8.0.0",
70
- "@hono/node-server": "^1.7.0",
71
81
  "@inquirer/prompts": "^5.0.6",
72
82
  "@nozbe/microfuzz": "^1.0.0",
73
83
  "@rollup/plugin-replace": "^5.0.5",
74
84
  "@tanstack/react-query": "^5.51.23",
75
85
  "@types/qs": "^6.9.15",
76
- "@types/wordpress__blocks": "^12.5.13",
77
- "@types/wordpress__components": "^23.0.11",
78
- "@types/wordpress__editor": "^13.6.7",
79
- "@types/wordpress__hooks": "^2.11.0",
86
+ "@vinxi/react": "^0.2.5",
80
87
  "@vitejs/plugin-react": "^4.1.1",
81
88
  "chalk": "^5.3.0",
82
89
  "change-case-all": "^2.1.0",
83
90
  "chokidar": "^3.5.3",
84
91
  "commander": "^11.1.0",
85
- "concurrently": "^8.2.2",
86
- "consola": "^3.2.3",
87
92
  "csstype": "^3.1.3",
88
93
  "dotenv": "^16.3.1",
89
- "express": "^4.18.2",
90
- "express-http-proxy": "^2.0.0",
91
- "fastest-levenshtein": "^1.0.16",
92
94
  "globby": "^13.2.2",
93
95
  "graphql": "^16.8.1",
94
- "hono": "^3.12.11",
96
+ "hono": "^4.6.2",
95
97
  "ink": "^5.0.1",
96
- "ink-quicksearch-input": "^1.0.0",
97
98
  "ink-spinner": "^5.0.0",
98
99
  "ink-text-input": "^6.0.0",
99
100
  "listhen": "^1.6.0",
100
101
  "mkcert": "^3.2.0",
101
- "mnemonist": "^0.39.8",
102
- "node-fetch": "^3.3.2",
103
102
  "obj-console": "^1.0.2",
104
103
  "object-code": "^1.3.3",
105
104
  "qs": "^6.13.0",
106
- "react-error-boundary": "^4.0.11",
107
- "rollup-plugin-external-globals": "^0.9.2",
105
+ "react-super-seo": "^1.1.9",
108
106
  "ts-poet": "^6.6.0",
109
- "tsup": "^7.2.0",
110
107
  "ufo": "^1.3.1",
111
108
  "undent": "^0.1.0",
112
- "use-zustand": "^0.2.0",
113
109
  "valtio": "^1.13.2",
114
- "vite": "^5.4.3",
110
+ "vinxi": "^0.4.3",
115
111
  "vite-tsconfig-paths": "^4.2.1",
116
112
  "zod": "^3.22.4",
117
113
  "zod-to-json-schema": "^3.21.4",
118
- "zod-validation-error": "^2.1.0",
119
- "zustand": "^4.5.5"
114
+ "zod-validation-error": "^2.1.0"
120
115
  },
121
116
  "devDependencies": {
122
117
  "@types/express": "^4.17.21",
@@ -124,6 +119,10 @@
124
119
  "@types/node": "^20.9.0",
125
120
  "@types/react": "^18.3.3",
126
121
  "@types/react-dom": "^18.3.0",
122
+ "@types/wordpress__blocks": "^12.5.13",
123
+ "@types/wordpress__components": "^23.0.11",
124
+ "@types/wordpress__editor": "^13.6.7",
125
+ "@types/wordpress__hooks": "^2.11.0",
127
126
  "typescript": "^5.5.2"
128
127
  },
129
128
  "peerDependencies": {
package/types.app.d.ts CHANGED
@@ -1,6 +1,6 @@
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
4
 
5
5
  declare global {
6
6
  interface ViewProps {}
@@ -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 +0,0 @@
1
- export declare function Root(): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +0,0 @@
1
- import "@manifest/admin";
2
- import "@manifest/blocks";
3
- export default function bootAdmin(): void;