eddev 2.0.0-beta.1 → 2.0.0-beta.11

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 (130) hide show
  1. package/dist/app/entry/boot-admin.d.ts +1 -0
  2. package/dist/app/entry/{main.admin.js → boot-admin.js} +3 -5
  3. package/dist/app/entry/spa-root.d.ts +1 -0
  4. package/dist/app/entry/{Root.js → spa-root.js} +4 -4
  5. package/dist/app/entry/ssr-root-client.d.ts +4 -0
  6. package/dist/app/entry/ssr-root-client.js +9 -0
  7. package/dist/app/entry/ssr-root.d.ts +9 -0
  8. package/dist/app/entry/ssr-root.js +21 -0
  9. package/dist/app/lib/blocks/ErrorBoundaryFrontend.d.ts +1 -1
  10. package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts +1 -1
  11. package/dist/app/lib/devtools/components/BreakpointIndicator.js +5 -3
  12. package/dist/app/lib/devtools/dev-tools-store.d.ts +9 -0
  13. package/dist/app/lib/devtools/dev-tools-store.js +8 -0
  14. package/dist/app/lib/devtools/hooks/useTailwind.d.ts +120 -121
  15. package/dist/app/lib/devtools/hooks/useTailwind.js +6 -3
  16. package/dist/app/lib/devtools/index.d.ts +1 -0
  17. package/dist/app/lib/devtools/index.js +1 -1
  18. package/dist/app/lib/hooks/queryUtils.d.ts +4 -1
  19. package/dist/app/lib/hooks/queryUtils.js +8 -11
  20. package/dist/app/lib/internal/internal-store.d.ts +0 -2
  21. package/dist/app/lib/internal/internal-store.js +1 -3
  22. package/dist/app/lib/routing/components/ClientOnly.d.ts +1 -1
  23. package/dist/app/lib/routing/loader.js +6 -4
  24. package/dist/app/server/index.d.ts +3 -0
  25. package/dist/app/server/index.js +3 -0
  26. package/dist/app/server/proxy-wp-admin.d.ts +3 -0
  27. package/dist/app/server/proxy-wp-admin.js +106 -0
  28. package/dist/app/server/render-ssr-page.d.ts +2 -0
  29. package/dist/app/server/render-ssr-page.js +22 -0
  30. package/dist/app/server/server-context.d.ts +34 -0
  31. package/dist/app/server/server-context.js +116 -0
  32. package/dist/app/server/utils/headers.d.ts +1 -0
  33. package/dist/app/server/utils/headers.js +17 -0
  34. package/dist/app/server/utils/replace-host.d.ts +6 -4
  35. package/dist/app/server/utils/replace-host.js +58 -11
  36. package/dist/node/cli/cli-worker.d.ts +1 -1
  37. package/dist/node/cli/cli-worker.js +3 -0
  38. package/dist/node/cli/cli.js +45 -14
  39. package/dist/node/cli/display/CLIApp.d.ts +1 -1
  40. package/dist/node/cli/display/CLIApp.js +1 -1
  41. package/dist/node/cli/display/components/LogEntries.d.ts +1 -1
  42. package/dist/node/cli/display/hooks/useStatefulLog.d.ts +1 -1
  43. package/dist/node/cli/display/util/colors.d.ts +2 -2
  44. package/dist/node/cli/version.d.ts +1 -1
  45. package/dist/node/cli/version.js +1 -1
  46. package/dist/node/compiler/build-vinxi.d.ts +8 -0
  47. package/dist/node/compiler/build-vinxi.js +37 -0
  48. package/dist/node/compiler/bundler.admin.d.ts +1 -1
  49. package/dist/node/compiler/bundler.admin.js +3 -3
  50. package/dist/node/compiler/bundler.frontend.d.ts +1 -1
  51. package/dist/node/compiler/bundler.frontend.js +3 -3
  52. package/dist/node/compiler/{serverless.dev.d.ts → dev-server.d.ts} +7 -5
  53. package/dist/node/compiler/dev-server.js +97 -0
  54. package/dist/node/compiler/get-vite-config.d.ts +19 -0
  55. package/dist/node/compiler/get-vite-config.js +184 -0
  56. package/dist/node/compiler/vinxi-app.d.ts +10 -0
  57. package/dist/node/compiler/vinxi-app.js +121 -0
  58. package/dist/node/compiler/vinxi-codegen.d.ts +12 -0
  59. package/dist/node/compiler/vinxi-codegen.js +408 -0
  60. package/dist/node/graphql/graphql-codegen.d.ts +1 -1
  61. package/dist/node/graphql/graphql-codegen.js +3 -3
  62. package/dist/node/graphql/graphql-schema-loader.js +15 -18
  63. package/dist/node/project/config.js +1 -1
  64. package/dist/node/project/env.d.ts +1 -1
  65. package/dist/node/project/env.js +1 -1
  66. package/dist/node/project/manifest/block-manifest.js +2 -2
  67. package/dist/node/project/manifest/manifest.d.ts +1 -1
  68. package/dist/node/project/manifest/manifest.js +1 -1
  69. package/dist/node/project/manifest/view-manifest.js +2 -2
  70. package/dist/node/project/project.d.ts +2 -1
  71. package/dist/node/project/project.js +13 -15
  72. package/dist/node/project/wp-info.js +0 -2
  73. package/dist/node/types/view-type.js +3 -4
  74. package/dist/node/utils/fs-codegen.d.ts +40 -0
  75. package/dist/node/utils/fs-codegen.js +97 -0
  76. package/dist/node/utils/fs.js +2 -0
  77. package/dist/node/utils/{selfSignedCert.js → self-signed-cert.js} +1 -1
  78. package/dist/node/utils/{statefulLog.js → stateful-log.js} +1 -1
  79. package/package.json +29 -31
  80. package/dist/app/entry/Root.d.ts +0 -1
  81. package/dist/app/entry/main.admin.d.ts +0 -3
  82. package/dist/app/entry/main.frontend.spa.d.ts +0 -3
  83. package/dist/app/entry/main.frontend.spa.js +0 -13
  84. package/dist/app/entry/main.frontend.ssr.d.ts +0 -21
  85. package/dist/app/entry/main.frontend.ssr.js +0 -79
  86. package/dist/app/entry/main.serverless.dev.d.ts +0 -4
  87. package/dist/app/entry/main.serverless.dev.js +0 -21
  88. package/dist/app/server/create-api-builtin-hono.d.ts +0 -8
  89. package/dist/app/server/create-api-builtin-hono.js +0 -80
  90. package/dist/app/server/create-ssr-hono.d.ts +0 -18
  91. package/dist/app/server/create-ssr-hono.js +0 -104
  92. package/dist/app/server/utils/index.html.d.ts +0 -2
  93. package/dist/app/server/utils/index.html.js +0 -14
  94. package/dist/node/compiler/index.html.d.ts +0 -2
  95. package/dist/node/compiler/index.html.js +0 -15
  96. package/dist/node/compiler/serverless.dev.js +0 -215
  97. package/dist/node/compiler/vite/get-vite-config.d.ts +0 -13
  98. package/dist/node/compiler/vite/get-vite-config.js +0 -315
  99. package/dist/node/compiler/vite/plugin-admin.d.ts +0 -4
  100. package/dist/node/compiler/vite/plugin-admin.js +0 -67
  101. package/dist/node/compiler/vite/plugin-blocks.d.ts +0 -4
  102. package/dist/node/compiler/vite/plugin-blocks.js +0 -73
  103. package/dist/node/compiler/vite/plugin-entry.d.ts +0 -6
  104. package/dist/node/compiler/vite/plugin-entry.js +0 -16
  105. package/dist/node/compiler/vite/plugin-resolved-tailwind.d.ts +0 -4
  106. package/dist/node/compiler/vite/plugin-resolved-tailwind.js +0 -29
  107. package/dist/node/compiler/vite/plugin-theme.d.ts +0 -4
  108. package/dist/node/compiler/vite/plugin-theme.js +0 -40
  109. package/dist/node/compiler/vite/plugin-views.d.ts +0 -4
  110. package/dist/node/compiler/vite/plugin-views.js +0 -51
  111. package/dist/node/utils/console.d.ts +0 -21
  112. package/dist/node/utils/console.js +0 -28
  113. package/dist/node/utils/unsafe-fetch.d.ts +0 -2
  114. package/dist/node/utils/unsafe-fetch.js +0 -19
  115. package/tsup.config.ts +0 -40
  116. package/types.manifests.d.ts +0 -22
  117. /package/dist/node/utils/{formatZodError.d.ts → format-zod-error.d.ts} +0 -0
  118. /package/dist/node/utils/{formatZodError.js → format-zod-error.js} +0 -0
  119. /package/dist/node/utils/{getRepoInfo.d.ts → get-repo-info.d.ts} +0 -0
  120. /package/dist/node/utils/{getRepoInfo.js → get-repo-info.js} +0 -0
  121. /package/dist/node/utils/{highlightCode.d.ts → highlight-code.d.ts} +0 -0
  122. /package/dist/node/utils/{highlightCode.js → highlight-code.js} +0 -0
  123. /package/dist/node/utils/{isDeploying.d.ts → is-deploying.d.ts} +0 -0
  124. /package/dist/node/utils/{isDeploying.js → is-deploying.js} +0 -0
  125. /package/dist/node/utils/{selfSignedCert.d.ts → self-signed-cert.d.ts} +0 -0
  126. /package/dist/node/utils/{statefulLog.d.ts → stateful-log.d.ts} +0 -0
  127. /package/dist/node/utils/{export-extractor.d.ts → ts-export-extractor.d.ts} +0 -0
  128. /package/dist/node/utils/{export-extractor.js → ts-export-extractor.js} +0 -0
  129. /package/dist/node/utils/{watchFileTree.d.ts → watch-file-tree.d.ts} +0 -0
  130. /package/dist/node/utils/{watchFileTree.js → watch-file-tree.js} +0 -0
@@ -0,0 +1,408 @@
1
+ import { code } from "ts-poet";
2
+ import { FSCodegen } from "../utils/fs-codegen.js";
3
+ export function getVinxiFolder(opts) {
4
+ return (opts.mode === "development" ? "dev" : "prod") + (opts.serverless ? "" : "-spa");
5
+ }
6
+ export async function runVinxiCodegen(opts) {
7
+ const codegen = createVinxiCodegen(opts);
8
+ await codegen.run();
9
+ codegen.stop();
10
+ }
11
+ export function createVinxiCodegen(opts) {
12
+ const project = opts.project;
13
+ const folder = ".eddev/" + getVinxiFolder(opts);
14
+ const codegen = new FSCodegen(opts.project, {
15
+ outDir: folder,
16
+ });
17
+ if (opts.serverless) {
18
+ codegen.registerFile({
19
+ name: "context.ts",
20
+ generate: code /* tsx */ `
21
+ import { ServerContext } from "eddev/server"
22
+
23
+ export const serverContext = new ServerContext(${JSON.stringify({
24
+ dev: true,
25
+ origin: project.origin,
26
+ replaceUrls: {
27
+ from: project.origin,
28
+ to: opts.endpoint ?? "",
29
+ prefixes: [
30
+ { prefix: "/wp-content/uploads", replace: project.config?.serverless.uploads === "proxy" },
31
+ { prefix: "/wp-content/plugins", replace: project.config?.serverless.plugins === "proxy" },
32
+ ],
33
+ },
34
+ })})
35
+ `.toString(),
36
+ });
37
+ }
38
+ if (opts.serverless) {
39
+ codegen.registerFile({
40
+ name: "react-shim.js",
41
+ generate: code /* tsx */ `
42
+ import React from "react"
43
+ import ReactDOM from "react-dom/client"
44
+ Object.assign(React, window.React)
45
+ Object.assign(ReactDOM, window.ReactDOM)
46
+ `,
47
+ });
48
+ }
49
+ codegen.registerFile({
50
+ name: "entry.admin.tsx",
51
+ generate: () => {
52
+ return code /* tsx */ `
53
+ ${opts.serverless ? `import "./react-shim.js"` : ""}
54
+ ${opts.serverless ? `import "vinxi/client"` : ""}
55
+ import "../../views/index.css"
56
+ import "./manifest/admin"
57
+ import "./manifest/blocks"
58
+ import "./manifest/styles"
59
+ import bootAdmin from "eddev/_internal/boot-admin.js"
60
+
61
+ bootAdmin()
62
+ `;
63
+ },
64
+ });
65
+ codegen.registerFile({
66
+ name: "entry.client.tsx",
67
+ generate: () => {
68
+ if (opts.serverless) {
69
+ /**
70
+ * Client entry for SSR mode
71
+ */
72
+ return code /* tsx */ `
73
+ /// <reference types="vinxi/types/client" />
74
+ /**
75
+ * SSR-mode frontend entry.
76
+ * Hydrates the main app, including the html/head/body elements.
77
+ * Also ensures that the assets used during SSR are loaded.
78
+ */
79
+ import "vinxi/client"
80
+ import "../../views/index.css"
81
+ import "./manifest/blocks"
82
+ import "./manifest/views"
83
+
84
+ import * as React from "react"
85
+ import { Root, hydrateRoot } from "react-dom/client"
86
+ import { SSRClientRoot } from "eddev/_internal/ssr-root-client.js"
87
+ import { getManifest } from "vinxi/manifest"
88
+ import { createAssets } from "@vinxi/react"
89
+ import { devToolsStore } from 'eddev/devtools'
90
+
91
+ // Set up a dynamic entry which will load the configured tailwind manifest
92
+ devToolsStore.loadTailwindConfig = () => import('./manifest/tailwind-config')
93
+
94
+ // Create the asset renderer, which will ensure scripts/styles are mounted correctly
95
+ function getAssets() {
96
+ const Assets = createAssets(getManifest("client").handler, getManifest("client"))
97
+ return <React.Suspense><Assets /></React.Suspense>
98
+ }
99
+
100
+ window.$reactRoot =
101
+ window.$reactRoot ||
102
+ hydrateRoot(
103
+ document,
104
+ <SSRClientRoot assets={getAssets()} />,
105
+ )
106
+
107
+ if (import.meta.hot) {
108
+ import.meta.hot.accept((mod) => {
109
+ if (mod) {
110
+ const Assets = createAssets(getManifest("client").handler, getManifest("client"))
111
+ const app = <SSRClientRoot assets={getAssets()} />
112
+ window.$reactRoot?.render(app)
113
+ }
114
+ })
115
+ }
116
+
117
+ declare global {
118
+ interface Window {
119
+ $reactRoot?: Root
120
+ }
121
+ }
122
+
123
+ `;
124
+ }
125
+ else {
126
+ return code /* tsx */ `
127
+ /**
128
+ * SPA-mode frontend entry.
129
+ * Renders the main app into the empty <div id='root'> element, and expects window._PAGE_DATA to be set.
130
+ */
131
+ import "./manifest/blocks"
132
+ import "./manifest/views"
133
+ import "../../views/index.css"
134
+ import { devToolsStore } from 'eddev/devtools'
135
+ import { createRoot } from "react-dom/client"
136
+ import { SPARoot } from "eddev/_internal/spa-root.js"
137
+ import * as React from "react"
138
+
139
+ devToolsStore.loadTailwindConfig = () => import('./manifest/tailwind-config')
140
+
141
+ createRoot(document.getElementById("root")!).render(<SPARoot />)
142
+ `;
143
+ }
144
+ },
145
+ });
146
+ if (opts.serverless) {
147
+ codegen.registerFile({
148
+ name: "handler.data-api.ts",
149
+ generate: code /* tsx */ `
150
+ /// <reference types="vinxi/types/server" />
151
+ import { createRouter, eventHandler, getRouterParam, getQuery, getWebRequest, getRequestHeaders } from "vinxi/http"
152
+ import { serverContext } from "./context"
153
+
154
+ const router = createRouter()
155
+ .get(
156
+ "/route/",
157
+ eventHandler(async (event) => {
158
+ const id = "/"
159
+
160
+ return await serverContext.fetchRouteData({
161
+ pathname: id,
162
+ withAppData: false,
163
+ })
164
+ }),
165
+ )
166
+ .get(
167
+ "/route/**:name",
168
+ eventHandler(async (event) => {
169
+ const id = "/" + getRouterParam(event, "name")
170
+
171
+ return await serverContext.fetchRouteData({
172
+ pathname: id,
173
+ withAppData: false,
174
+ })
175
+ }),
176
+ )
177
+ .get(
178
+ "/query/**:name",
179
+ eventHandler(async (event) => {
180
+ const id = "/" + getRouterParam(event, "name")
181
+ const paramString = getQuery(event).params
182
+
183
+ const params = typeof paramString === "string" && paramString.length ? JSON.parse(paramString) : {}
184
+
185
+ return await serverContext.fetchNamedQuery({
186
+ name: id,
187
+ params: params,
188
+ headers: getRequestHeaders(event),
189
+ })
190
+ }),
191
+ )
192
+ .post(
193
+ "/mutation/**:name",
194
+ eventHandler(async (event) => {
195
+ const id = "/" + getRouterParam(event, "name")
196
+ const body = await getWebRequest(event).json()
197
+ return await serverContext.fetchMutation({
198
+ name: id,
199
+ body,
200
+ headers: {},
201
+ })
202
+ }),
203
+ )
204
+
205
+ export default router.handler
206
+
207
+ `,
208
+ });
209
+ }
210
+ if (opts.serverless) {
211
+ codegen.registerFile({
212
+ name: "handler.ssr-page.ts",
213
+ generate: code /* tsx */ `
214
+ /// <reference types="vinxi/types/server" />
215
+ import "../../views/index.css"
216
+ import "./manifest/blocks"
217
+ import "./manifest/styles"
218
+ import "./manifest/views"
219
+
220
+ import { renderPageToSSRStream, proxyWpAdmin } from "eddev/server"
221
+ import { eventHandler, setResponseHeader, setResponseStatus, getRequestURL } from "vinxi/http"
222
+ import { serverContext } from "./context"
223
+
224
+ export default eventHandler({
225
+ handler: async (event) => {
226
+ const url = getRequestURL(event)
227
+
228
+ if (url.pathname.includes('.')) {
229
+ return proxyWpAdmin(event, serverContext)
230
+ }
231
+
232
+ const response = await serverContext.fetchRouteData({
233
+ pathname: url.pathname,
234
+ withAppData: true,
235
+ headers: {},
236
+ query: {},
237
+ })
238
+ if (response.ok) {
239
+ setResponseStatus(event, response.status)
240
+ setResponseHeader(event, "Content-Type", "text/html; charset=utf-8")
241
+ return renderPageToSSRStream(url.pathname, await response.json())
242
+ } else {
243
+ return response
244
+ }
245
+ },
246
+ })
247
+
248
+ `,
249
+ });
250
+ }
251
+ if (opts.serverless) {
252
+ codegen.registerFile({
253
+ name: "handler.wp-proxy.ts",
254
+ generate: code /* tsx */ `
255
+ /// <reference types="vinxi/types/server" />
256
+ import { proxyWpAdmin } from "eddev/server"
257
+ import { eventHandler } from "vinxi/http"
258
+ import { serverContext } from "./context"
259
+
260
+ export default eventHandler(async (event) => {
261
+ return proxyWpAdmin(event, serverContext)
262
+ })
263
+ `,
264
+ });
265
+ }
266
+ codegen.registerFile({
267
+ name: "manifest/blocks.ts",
268
+ generate: async () => {
269
+ const blockManifest = await project.blocks.get();
270
+ return code /* ts */ `
271
+ import { blockManifestReader } from 'eddev/_internal'
272
+ import { dynamic } from 'eddev/dynamic'
273
+ import core from '../../../blocks/_core'
274
+
275
+ const manifest = {
276
+ ${Object.entries(blockManifest.blocks)
277
+ .filter(([name]) => !name.match(/^_[a-z]+$/i))
278
+ .map(([name, block]) => {
279
+ const importStatement = `dynamic(() => import(${JSON.stringify("../../../" + block.fileName)}))`;
280
+ return JSON.stringify(block.acfName) + ": " + importStatement;
281
+ })
282
+ .join(",\n")},
283
+ ...core
284
+ }
285
+
286
+ const info = {
287
+ ${Object.entries(blockManifest.blocks)
288
+ .filter(([name]) => !name.match(/^_[a-z]+$/i))
289
+ .map(([name, block]) => {
290
+ return (JSON.stringify(block.acfName) +
291
+ ": " +
292
+ JSON.stringify({
293
+ slug: block.slug,
294
+ tags: block.tags,
295
+ flags: block.flags ?? {},
296
+ }));
297
+ })
298
+ .join(",\n")}
299
+ }
300
+
301
+ blockManifestReader.set(manifest, info)
302
+
303
+ export default manifest
304
+
305
+ if (import.meta.hot) {
306
+ import.meta.hot.accept()
307
+ }
308
+ `;
309
+ },
310
+ subscribe: project.blocks.subscribe,
311
+ });
312
+ codegen.registerFile({
313
+ name: "manifest/admin.ts",
314
+ generate: async () => {
315
+ const fieldManifest = await project.fields.get();
316
+ const widgetManifest = await project.widgets.get();
317
+ return code /* ts */ `
318
+ import { adminManifestReader } from 'eddev/_internal'
319
+ import editorConfig from '../../../blocks/_editor'
320
+
321
+ const fields = {${Object.entries(fieldManifest.fields)
322
+ .map(([name, field]) => {
323
+ const importStatement = `() => import(${JSON.stringify("../../../" + field.fileName)}).then(m => m.default)`;
324
+ return JSON.stringify(field.slug) + ": " + importStatement;
325
+ })
326
+ .join(",\n")}}
327
+ const widgets = {${Object.entries(widgetManifest.widgets)
328
+ .map(([name, widget]) => {
329
+ const importStatement = `() => import(${JSON.stringify("../../../" + widget.fileName)}).then(m => m.default)`;
330
+ return JSON.stringify(widget.slug) + ": " + importStatement;
331
+ })
332
+ .join(",\n")}}
333
+
334
+ const manifest = {
335
+ fields,
336
+ widgets,
337
+ editorConfig
338
+ }
339
+
340
+ adminManifestReader.set(manifest)
341
+
342
+ export default manifest
343
+
344
+ export { editorConfig }
345
+
346
+ if (import.meta.hot) {
347
+ import.meta.hot.accept()
348
+ }
349
+ `;
350
+ },
351
+ subscribe: (callback) => {
352
+ const unsub = [project.fields.subscribe(callback), project.widgets.subscribe(callback)];
353
+ return () => unsub.forEach((u) => u());
354
+ },
355
+ });
356
+ codegen.registerFile({
357
+ name: "manifest/views.ts",
358
+ generate: async () => {
359
+ const viewManifest = await project.views.get();
360
+ return code /* ts */ `
361
+ import { viewManifestReader } from 'eddev/_internal'
362
+ import { dynamic } from 'eddev/dynamic'
363
+ const manifest = {${Object.entries(viewManifest.views)
364
+ .map(([name, view]) => {
365
+ const importStatement = `dynamic(() => import(${JSON.stringify("../../../" + view.fileName)}))`;
366
+ return JSON.stringify(view.slug) + ": " + importStatement;
367
+ })
368
+ .join(",\n")}}
369
+
370
+ viewManifestReader.value = manifest
371
+
372
+ export default manifest
373
+
374
+ if (import.meta.hot) {
375
+ import.meta.hot.accept()
376
+ }
377
+ `;
378
+ },
379
+ subscribe: project.views.subscribe,
380
+ });
381
+ codegen.registerFile({
382
+ name: "manifest/styles.ts",
383
+ generate: async () => {
384
+ return code /* ts */ `
385
+ export const getCssText = undefined
386
+ export const editorGlobalStyles = () => {}
387
+ `;
388
+ },
389
+ });
390
+ codegen.registerFile({
391
+ name: "manifest/tailwind-config.ts",
392
+ generate: async () => {
393
+ return code /* ts */ `
394
+ import tw from "../../../tailwind.config"
395
+ import resolveConfig from 'tailwindcss/resolveConfig'
396
+ import { devToolsStore } from 'eddev/devtools'
397
+
398
+ const value = resolveConfig(tw)
399
+ devToolsStore.tailwindConfig = value
400
+
401
+ if (import.meta.hot) {
402
+ import.meta.hot.accept()
403
+ }
404
+ `;
405
+ },
406
+ });
407
+ return codegen;
408
+ }
@@ -1,5 +1,5 @@
1
1
  import { Project } from "../project/project.js";
2
- export declare const graphqlLog: import("../utils/statefulLog.js").StatefulLog<GraphQLGenerator>;
2
+ export declare const graphqlLog: import("../utils/stateful-log.js").StatefulLog<GraphQLGenerator>;
3
3
  export declare class GraphQLGenerator {
4
4
  project: Project;
5
5
  private needsRegenerate;
@@ -10,9 +10,9 @@ import * as typescriptPlugin from "@graphql-codegen/typescript";
10
10
  import * as typescriptOperationsPlugin from "@graphql-codegen/typescript-operations";
11
11
  import chalk from "chalk";
12
12
  import { code } from "ts-poet";
13
- import { highlightCode } from "../utils/highlightCode.js";
14
- import { createConsole } from "../utils/statefulLog.js";
15
- import { watchFileTreeForChanges } from "../utils/watchFileTree.js";
13
+ import { highlightCode } from "../utils/highlight-code.js";
14
+ import { createConsole } from "../utils/stateful-log.js";
15
+ import { watchFileTreeForChanges } from "../utils/watch-file-tree.js";
16
16
  import pluginFiles from "./plugins/gql-plugin-files.js";
17
17
  import pluginNoDuplicates from "./plugins/gql-plugin-no-duplicates.js";
18
18
  import pluginQueries from "./plugins/gql-plugin-queries.js";
@@ -1,8 +1,6 @@
1
1
  import { loadSchema } from "@graphql-tools/load";
2
2
  import { UrlLoader } from "@graphql-tools/url-loader";
3
3
  import { introspectionFromSchema } from "graphql";
4
- import { Agent } from "https";
5
- import fetch from "node-fetch";
6
4
  import { graphqlLog as console } from "./graphql-codegen.js";
7
5
  import chalk from "chalk";
8
6
  import { hash } from "object-code";
@@ -23,22 +21,21 @@ export class GraphQLSchemaLoader {
23
21
  console.info(`${this.lastHash ? "Reloading" : "Loading"} GraphQL schema from ${chalk.yellowBright(this.url)}`);
24
22
  const rawSchema = await loadSchema(this.url, {
25
23
  loaders: [new UrlLoader()],
26
- fetch: (url, opts) => {
27
- const httpsAgent = new Agent({
28
- rejectUnauthorized: false,
29
- });
30
- return fetch(url, {
31
- ...opts,
32
- agent: function (_parsedURL) {
33
- if (_parsedURL.protocol == "http:") {
34
- return undefined;
35
- }
36
- else {
37
- return httpsAgent;
38
- }
39
- },
40
- });
41
- },
24
+ // fetch: (url: string, opts: any) => {
25
+ // const httpsAgent = new Agent({
26
+ // rejectUnauthorized: false,
27
+ // })
28
+ // return fetch(url, {
29
+ // ...opts,
30
+ // agent: function (_parsedURL) {
31
+ // if (_parsedURL.protocol == "http:") {
32
+ // return undefined
33
+ // } else {
34
+ // return httpsAgent
35
+ // }
36
+ // },
37
+ // })
38
+ // },
42
39
  }).catch((e) => {
43
40
  return e;
44
41
  });
@@ -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(),
@@ -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,8 +1,8 @@
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 { 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 loadViewManifest(project) {
@@ -3,7 +3,7 @@ import { BlockManifestGenerator } from "./manifest/block-manifest.js";
3
3
  import { ViewManifestGenerator } from "./manifest/view-manifest.js";
4
4
  import { FieldManifestGenerator } from "./manifest/field-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,12 +1,9 @@
1
- import * as clack from "@clack/prompts";
2
1
  import { relative, resolve } from "path";
3
2
  import { undent } from "undent";
4
- import { cliMode } from "../cli/cli-mode.js";
5
- // import { console } from "../utils/console.js"
6
3
  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
8
  import { loadBlockManifest } from "./manifest/block-manifest.js";
12
9
  import { loadViewManifest } from "./manifest/view-manifest.js";
@@ -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,6 +33,7 @@ export class Project {
35
33
  reportPluginCompatibility = false;
36
34
  constructor(opts) {
37
35
  this.rootDir = opts.rootDir;
36
+ this.origin = ProjectEnvUtils.get("SITE_URL");
38
37
  this.reportPluginCompatibility = opts.reportPluginCompatibility || false;
39
38
  this.blocks = loadBlockManifest(this);
40
39
  this.views = loadViewManifest(this);
@@ -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;
@@ -10,7 +9,6 @@ export class WPInfo {
10
9
  if (this.cached && !force)
11
10
  return this.cached;
12
11
  const url = resolveURL(this.siteUrl, "/wp-json/ed/v1/dev/site-info");
13
- const fetch = getUnsafeFetch(this.siteUrl);
14
12
  const response = await fetch(url);
15
13
  const result = (await response.json());
16
14
  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
  }