eddev 2.0.0-beta.2 → 2.0.0-beta.21

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 (204) 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/admin/index.d.ts +2 -2
  10. package/dist/app/lib/admin/index.js +2 -2
  11. package/dist/app/lib/admin/installFieldTypes.js +1 -1
  12. package/dist/app/lib/admin/runWidgets.js +1 -1
  13. package/dist/app/lib/blocks/ContentBlocks.js +4 -4
  14. package/dist/app/lib/blocks/EditableText.d.ts +1 -1
  15. package/dist/app/lib/blocks/EditableText.js +2 -2
  16. package/dist/app/lib/blocks/ErrorBoundaryFrontend.d.ts +1 -1
  17. package/dist/app/lib/blocks/InnerBlocks.d.ts +2 -2
  18. package/dist/app/lib/blocks/InnerBlocks.js +4 -4
  19. package/dist/app/lib/blocks/block-utils.d.ts +1 -1
  20. package/dist/app/lib/blocks/block-utils.js +1 -1
  21. package/dist/app/lib/blocks/editor/EditorSupport.js +3 -3
  22. package/dist/app/lib/blocks/editor/ErrorBoundaryEditor.d.ts +1 -1
  23. package/dist/app/lib/blocks/editor/editor-config.d.ts +1 -1
  24. package/dist/app/lib/blocks/editor/editor-config.js +1 -1
  25. package/dist/app/lib/blocks/editor/installGutenbergHooks.js +5 -5
  26. package/dist/app/lib/blocks/editor/usePostEditor.d.ts +1 -1
  27. package/dist/app/lib/blocks/index.d.ts +9 -9
  28. package/dist/app/lib/blocks/index.js +9 -9
  29. package/dist/app/lib/blocks/inline-editing.d.ts +1 -1
  30. package/dist/app/lib/blocks/inline-editing.js +3 -3
  31. package/dist/app/lib/devtools/components/BreakpointIndicator.js +5 -3
  32. package/dist/app/lib/devtools/components/DevUI.js +1 -1
  33. package/dist/app/lib/devtools/dev-tools-store.d.ts +9 -0
  34. package/dist/app/lib/devtools/dev-tools-store.js +8 -0
  35. package/dist/app/lib/devtools/hooks/useTailwind.d.ts +1078 -1079
  36. package/dist/app/lib/devtools/hooks/useTailwind.js +6 -3
  37. package/dist/app/lib/devtools/index.d.ts +1 -0
  38. package/dist/app/lib/devtools/index.js +1 -1
  39. package/dist/app/lib/devtools/loader.js +4 -4
  40. package/dist/app/lib/dynamic/index.d.ts +1 -1
  41. package/dist/app/lib/dynamic/index.js +1 -1
  42. package/dist/app/lib/hooks/index.d.ts +5 -5
  43. package/dist/app/lib/hooks/index.js +5 -5
  44. package/dist/app/lib/hooks/queryUtils.d.ts +4 -1
  45. package/dist/app/lib/hooks/queryUtils.js +10 -13
  46. package/dist/app/lib/hooks/useAppData.js +1 -1
  47. package/dist/app/lib/internal/index.d.ts +4 -4
  48. package/dist/app/lib/internal/index.js +4 -4
  49. package/dist/app/lib/internal/internal-store.d.ts +0 -2
  50. package/dist/app/lib/internal/internal-store.js +1 -3
  51. package/dist/app/lib/internal/read-admin-manifest.d.ts +1 -1
  52. package/dist/app/lib/legacy-stitches/createStitches.d.ts +3 -511
  53. package/dist/app/lib/legacy-stitches/createStitches.js +1 -1
  54. package/dist/app/lib/legacy-stitches/index.d.ts +1 -1
  55. package/dist/app/lib/legacy-stitches/index.js +1 -1
  56. package/dist/app/lib/routing/components/BrowserRouter.js +4 -4
  57. package/dist/app/lib/routing/components/ClientOnly.d.ts +1 -1
  58. package/dist/app/lib/routing/components/ClientOnly.js +1 -1
  59. package/dist/app/lib/routing/components/Link.js +5 -5
  60. package/dist/app/lib/routing/components/RouteRenderer.d.ts +1 -1
  61. package/dist/app/lib/routing/components/RouteRenderer.js +3 -3
  62. package/dist/app/lib/routing/components/SSRRouter.d.ts +2 -2
  63. package/dist/app/lib/routing/components/SSRRouter.js +4 -4
  64. package/dist/app/lib/routing/components/ScrollRestoration.js +1 -1
  65. package/dist/app/lib/routing/context.d.ts +2 -2
  66. package/dist/app/lib/routing/context.js +1 -1
  67. package/dist/app/lib/routing/hooks/useRestorableState.js +2 -1
  68. package/dist/app/lib/routing/hooks/useRoute.d.ts +1 -1
  69. package/dist/app/lib/routing/hooks/useRoute.js +1 -1
  70. package/dist/app/lib/routing/hooks/useRouteTransition.d.ts +1 -1
  71. package/dist/app/lib/routing/hooks/useRouteTransition.js +1 -1
  72. package/dist/app/lib/routing/hooks/useRouter.d.ts +1 -1
  73. package/dist/app/lib/routing/hooks/useRouter.js +1 -1
  74. package/dist/app/lib/routing/hooks/useRouterEvents.d.ts +1 -1
  75. package/dist/app/lib/routing/hooks/useRouterEvents.js +1 -1
  76. package/dist/app/lib/routing/hooks/useRouterState.d.ts +1 -1
  77. package/dist/app/lib/routing/hooks/useRouterState.js +1 -1
  78. package/dist/app/lib/routing/hooks/useSearchParams.js +2 -2
  79. package/dist/app/lib/routing/index.d.ts +13 -13
  80. package/dist/app/lib/routing/index.js +13 -13
  81. package/dist/app/lib/routing/loader.d.ts +2 -2
  82. package/dist/app/lib/routing/loader.js +7 -5
  83. package/dist/app/lib/routing/types.d.ts +2 -2
  84. package/dist/app/lib/routing/utils.d.ts +1 -1
  85. package/dist/app/lib/views/index.d.ts +1 -1
  86. package/dist/app/lib/views/index.js +1 -1
  87. package/dist/app/server/index.d.ts +3 -0
  88. package/dist/app/server/index.js +3 -0
  89. package/dist/app/server/proxy-wp-admin.d.ts +3 -0
  90. package/dist/app/server/proxy-wp-admin.js +105 -0
  91. package/dist/app/server/render-ssr-page.d.ts +3 -0
  92. package/dist/app/server/render-ssr-page.js +21 -0
  93. package/dist/app/server/server-context.d.ts +37 -0
  94. package/dist/app/server/server-context.js +118 -0
  95. package/dist/app/server/utils/headers.d.ts +1 -0
  96. package/dist/app/server/utils/headers.js +17 -0
  97. package/dist/app/server/utils/replace-host.d.ts +6 -4
  98. package/dist/app/server/utils/replace-host.js +58 -11
  99. package/dist/node/cli/cli-worker.d.ts +1 -1
  100. package/dist/node/cli/cli-worker.js +7 -2
  101. package/dist/node/cli/cli.js +83 -12
  102. package/dist/node/cli/display/CLIApp.d.ts +1 -1
  103. package/dist/node/cli/display/CLIApp.js +3 -6
  104. package/dist/node/cli/display/components/LogEntries.d.ts +1 -1
  105. package/dist/node/cli/display/hooks/useStatefulLog.d.ts +1 -1
  106. package/dist/node/cli/display/tools/CreateBlock.d.ts +1 -1
  107. package/dist/node/cli/display/tools/cli-tools.d.ts +1 -11
  108. package/dist/node/cli/display/tools/cli-tools.js +9 -9
  109. package/dist/node/cli/display/util/colors.d.ts +2 -2
  110. package/dist/node/cli/version.d.ts +1 -1
  111. package/dist/node/cli/version.js +1 -1
  112. package/dist/node/compiler/build-vinxi.d.ts +8 -0
  113. package/dist/node/compiler/build-vinxi.js +37 -0
  114. package/dist/node/compiler/bundler.admin.d.ts +2 -2
  115. package/dist/node/compiler/bundler.admin.js +3 -4
  116. package/dist/node/compiler/bundler.frontend.d.ts +1 -1
  117. package/dist/node/compiler/bundler.frontend.js +3 -4
  118. package/dist/node/compiler/{serverless.dev.d.ts → dev-server.d.ts} +7 -5
  119. package/dist/node/compiler/dev-server.js +97 -0
  120. package/dist/node/compiler/get-vite-config.d.ts +19 -0
  121. package/dist/node/compiler/get-vite-config.js +201 -0
  122. package/dist/node/compiler/vinxi-app.d.ts +10 -0
  123. package/dist/node/compiler/vinxi-app.js +121 -0
  124. package/dist/node/compiler/vinxi-codegen.d.ts +12 -0
  125. package/dist/node/compiler/vinxi-codegen.js +417 -0
  126. package/dist/node/graphql/graphql-codegen.d.ts +1 -1
  127. package/dist/node/graphql/graphql-codegen.js +3 -3
  128. package/dist/node/graphql/graphql-schema-loader.js +15 -18
  129. package/dist/node/project/config.js +1 -1
  130. package/dist/node/project/env.d.ts +1 -1
  131. package/dist/node/project/env.js +1 -1
  132. package/dist/node/project/favicons.d.ts +1 -0
  133. package/dist/node/project/favicons.js +1 -1
  134. package/dist/node/project/manifest/block-manifest.js +2 -2
  135. package/dist/node/project/manifest/manifest.d.ts +1 -1
  136. package/dist/node/project/manifest/manifest.js +1 -1
  137. package/dist/node/project/manifest/view-manifest.js +2 -2
  138. package/dist/node/project/project.d.ts +3 -2
  139. package/dist/node/project/project.js +17 -19
  140. package/dist/node/project/wp-info.js +0 -2
  141. package/dist/node/types/block-type.d.ts +2 -2
  142. package/dist/node/types/view-type.js +3 -4
  143. package/dist/node/utils/fs-codegen.d.ts +40 -0
  144. package/dist/node/utils/fs-codegen.js +97 -0
  145. package/dist/node/utils/fs.js +2 -0
  146. package/dist/node/utils/{selfSignedCert.js → self-signed-cert.js} +1 -1
  147. package/dist/node/utils/{statefulLog.js → stateful-log.js} +1 -1
  148. package/package.json +29 -31
  149. package/tsconfig.app.json +2 -2
  150. package/tsconfig.node.json +2 -2
  151. package/types.app.d.ts +2 -2
  152. package/types.app.internal.d.ts +2 -2
  153. package/types.node.d.ts +3 -3
  154. package/dist/app/entry/Root.d.ts +0 -1
  155. package/dist/app/entry/main.admin.d.ts +0 -3
  156. package/dist/app/entry/main.frontend.spa.d.ts +0 -3
  157. package/dist/app/entry/main.frontend.spa.js +0 -13
  158. package/dist/app/entry/main.frontend.ssr.d.ts +0 -21
  159. package/dist/app/entry/main.frontend.ssr.js +0 -79
  160. package/dist/app/entry/main.serverless.dev.d.ts +0 -4
  161. package/dist/app/entry/main.serverless.dev.js +0 -21
  162. package/dist/app/server/create-api-builtin-hono.d.ts +0 -8
  163. package/dist/app/server/create-api-builtin-hono.js +0 -80
  164. package/dist/app/server/create-ssr-hono.d.ts +0 -18
  165. package/dist/app/server/create-ssr-hono.js +0 -104
  166. package/dist/app/server/utils/index.html.d.ts +0 -2
  167. package/dist/app/server/utils/index.html.js +0 -14
  168. package/dist/node/compiler/index.html.d.ts +0 -2
  169. package/dist/node/compiler/index.html.js +0 -15
  170. package/dist/node/compiler/serverless.dev.js +0 -215
  171. package/dist/node/compiler/vite/get-vite-config.d.ts +0 -13
  172. package/dist/node/compiler/vite/get-vite-config.js +0 -315
  173. package/dist/node/compiler/vite/plugin-admin.d.ts +0 -4
  174. package/dist/node/compiler/vite/plugin-admin.js +0 -67
  175. package/dist/node/compiler/vite/plugin-blocks.d.ts +0 -4
  176. package/dist/node/compiler/vite/plugin-blocks.js +0 -73
  177. package/dist/node/compiler/vite/plugin-entry.d.ts +0 -6
  178. package/dist/node/compiler/vite/plugin-entry.js +0 -16
  179. package/dist/node/compiler/vite/plugin-resolved-tailwind.d.ts +0 -4
  180. package/dist/node/compiler/vite/plugin-resolved-tailwind.js +0 -29
  181. package/dist/node/compiler/vite/plugin-theme.d.ts +0 -4
  182. package/dist/node/compiler/vite/plugin-theme.js +0 -40
  183. package/dist/node/compiler/vite/plugin-views.d.ts +0 -4
  184. package/dist/node/compiler/vite/plugin-views.js +0 -51
  185. package/dist/node/utils/console.d.ts +0 -21
  186. package/dist/node/utils/console.js +0 -28
  187. package/dist/node/utils/unsafe-fetch.d.ts +0 -2
  188. package/dist/node/utils/unsafe-fetch.js +0 -19
  189. package/tsup.config.ts +0 -40
  190. package/types.manifests.d.ts +0 -22
  191. /package/dist/node/utils/{formatZodError.d.ts → format-zod-error.d.ts} +0 -0
  192. /package/dist/node/utils/{formatZodError.js → format-zod-error.js} +0 -0
  193. /package/dist/node/utils/{getRepoInfo.d.ts → get-repo-info.d.ts} +0 -0
  194. /package/dist/node/utils/{getRepoInfo.js → get-repo-info.js} +0 -0
  195. /package/dist/node/utils/{highlightCode.d.ts → highlight-code.d.ts} +0 -0
  196. /package/dist/node/utils/{highlightCode.js → highlight-code.js} +0 -0
  197. /package/dist/node/utils/{isDeploying.d.ts → is-deploying.d.ts} +0 -0
  198. /package/dist/node/utils/{isDeploying.js → is-deploying.js} +0 -0
  199. /package/dist/node/utils/{selfSignedCert.d.ts → self-signed-cert.d.ts} +0 -0
  200. /package/dist/node/utils/{statefulLog.d.ts → stateful-log.d.ts} +0 -0
  201. /package/dist/node/utils/{export-extractor.d.ts → ts-export-extractor.d.ts} +0 -0
  202. /package/dist/node/utils/{export-extractor.js → ts-export-extractor.js} +0 -0
  203. /package/dist/node/utils/{watchFileTree.d.ts → watch-file-tree.d.ts} +0 -0
  204. /package/dist/node/utils/{watchFileTree.js → watch-file-tree.js} +0 -0
@@ -1,315 +0,0 @@
1
- import * as t from "@babel/types";
2
- import replace from "@rollup/plugin-replace";
3
- import react from "@vitejs/plugin-react";
4
- import { pascalCase } from "change-case-all";
5
- import { join } from "path";
6
- import { withoutTrailingSlash } from "ufo";
7
- import { createLogger } from "vite";
8
- import tsconfigPaths from "vite-tsconfig-paths";
9
- import { cliMode } from "../../cli/cli-mode.js";
10
- import { pluginAdminManifest } from "./plugin-admin.js";
11
- import { pluginBlocks } from "./plugin-blocks.js";
12
- import { pluginEntryFile } from "./plugin-entry.js";
13
- import { pluginResolvedTailwind } from "./plugin-resolved-tailwind.js";
14
- import { pluginThemeManifest } from "./plugin-theme.js";
15
- import { pluginViews } from "./plugin-views.js";
16
- export function getViteConfig(args) {
17
- const console = args.console;
18
- const logger = createLogger();
19
- logger.info = (msg) => args.console.info(msg.replace(/\n/, ""));
20
- logger.warn = (msg) => {
21
- if (typeof msg === "string" && msg.includes("Error when using sourcemap for reporting"))
22
- return;
23
- return args.console.warn(msg.replace(/\n/, ""));
24
- };
25
- logger.error = (msg) => args.console.fail(msg.replace(/\n/, ""));
26
- logger.warnOnce = (msg) => args.console.warn(msg.replace(/\n/, ""));
27
- logger.clearScreen = () => {
28
- args.console.resetLog();
29
- };
30
- const envDefines = {
31
- client: args.serverless ? "!import.meta.env.SSR" : "true",
32
- serverless: args.serverless ? "true" : "false",
33
- dev: args.mode === "development" ? "true" : "false",
34
- admin: args.mode === "development" && args.serverless
35
- ? `(typeof __wp_admin !== "undefined")`
36
- : args.target === "cms"
37
- ? "true"
38
- : "false",
39
- themePath: JSON.stringify(args.project.publicUrl),
40
- devUI: args.mode === "development" ? "true" : "false",
41
- serverlessOrigin: JSON.stringify("http://serverleress-endpoint"),
42
- rpcEnabled: "false",
43
- origin: JSON.stringify(process.env.SITE_URL ?? "/"),
44
- };
45
- const expandDefines = (obj, prefixes = []) => {
46
- const result = {};
47
- for (const prefix of prefixes) {
48
- for (const [key, value] of Object.entries(obj)) {
49
- result[prefix + key] = value;
50
- }
51
- }
52
- return result;
53
- };
54
- /** Initial config */
55
- const config = {
56
- appType: "custom",
57
- mode: args.mode,
58
- root: args.rootDir,
59
- customLogger: logger,
60
- logLevel: cliMode.verbose ? "info" : "warn",
61
- base: withoutTrailingSlash(args.project.publicUrl) + "/dist/" + args.target,
62
- define: {
63
- "process.env.NODE_ENV": JSON.stringify(args.mode),
64
- // ssrLoadModule: "() => Promise.resolve({})",
65
- },
66
- // optimizeDeps: {
67
- // force: true,
68
- // holdUntilCrawlEnd: true,
69
- // include: ["zustand"],
70
- // noDiscovery: true,
71
- // exclude: ["react-external.js", "react-dom-external.js", "react", "react-dom"],
72
- // esbuildOptions: {},
73
- // },
74
- resolve: {
75
- alias: [
76
- { find: "@manifest/blocks", replacement: join(args.project.rootDir, "__block-manifest.js") },
77
- { find: "@manifest/views", replacement: join(args.project.rootDir, "__view-manifest.js") },
78
- { find: "@manifest/theme", replacement: join(args.project.rootDir, "__theme-manifest.js") },
79
- { find: "@manifest/admin", replacement: join(args.project.rootDir, "__admin-manifest.js") },
80
- { find: "@manifest/tailwind", replacement: join(args.project.rootDir, "__resolved-tailwind.js") },
81
- ],
82
- },
83
- legacy: {
84
- proxySsrExternalModules: true,
85
- },
86
- plugins: [
87
- tsconfigPaths(),
88
- // pluginShimReact(args),
89
- react({
90
- babel: {
91
- overrides: [{ test: /types\./, compact: true }],
92
- plugins: [
93
- {
94
- visitor: {
95
- // TODO: Move this to a separate file
96
- // TODO: Attach the title to the block component, so we can use it for debugging
97
- ExportNamedDeclaration: (path) => {
98
- const decl = path.node.declaration;
99
- if (decl?.type !== "VariableDeclaration")
100
- return;
101
- const id = decl.declarations[0].id;
102
- if (!t.isIdentifier(id))
103
- return;
104
- if (id.name === "meta") {
105
- path.remove();
106
- }
107
- },
108
- ExportDefaultDeclaration: (path) => {
109
- if (path.node.declaration.type === "CallExpression") {
110
- const call = path.node.declaration;
111
- if (call.callee.type === "Identifier" && ["defineBlock", "defineView"].includes(call.callee.name)) {
112
- const type = call.callee.name.replace("define", "");
113
- const args = call.arguments;
114
- if (args.length === 2 &&
115
- args[0].type === "StringLiteral" &&
116
- args[1].type === "ArrowFunctionExpression") {
117
- const name = args[0].value;
118
- let body = args[1].body;
119
- if (t.isExpression(body)) {
120
- body = t.blockStatement([t.returnStatement(body)]);
121
- }
122
- path.replaceWith(t.exportDefaultDeclaration(t.functionDeclaration(t.identifier(pascalCase(type + "-" + name)), args[1].params, body, args[1].generator, args[1].async)));
123
- }
124
- }
125
- }
126
- },
127
- },
128
- },
129
- ],
130
- },
131
- }),
132
- replace({
133
- values: expandDefines(envDefines, ["process.env.", "process.", "env."]),
134
- preventAssignment: true,
135
- }),
136
- // SPA Frontend, to be served by WordPress
137
- args.target === "frontend" &&
138
- !args.serverless &&
139
- pluginEntryFile({
140
- code: `
141
- import boot from 'eddev/_internal/_entry/main.frontend.spa.js'
142
- import "./views/index.css"
143
- boot()
144
- `,
145
- id: "eddev-bootup",
146
- path: "/_boot.js",
147
- }),
148
- // SPA Admin bundle, to be served by WordPress admin
149
- args.target === "cms" &&
150
- !args.serverless &&
151
- pluginEntryFile({
152
- code: `
153
- import boot from 'eddev/_internal/_entry/main.admin.js'
154
- import "./views/index.css"
155
- boot()
156
- `,
157
- id: "eddev-bootup",
158
- path: "/_boot.js",
159
- }),
160
- // Frontend + Admin, used during development
161
- args.serverless &&
162
- pluginEntryFile({
163
- code: `
164
- import boot from 'eddev/_internal/_entry/main.serverless.dev.js'
165
- import "./views/index.css"
166
- boot()
167
- `,
168
- id: "eddev-bootup",
169
- path: "/_boot.js",
170
- }),
171
- args.serverless &&
172
- pluginEntryFile({
173
- code: `
174
- import React from 'react'
175
- import ReactDOM from 'react-dom/client'
176
- Object.assign(React, window.React)
177
- Object.assign(ReactDOM, window.ReactDOM)
178
- `,
179
- id: "eddev-test-shim",
180
- path: "/_boot_test_shim.js",
181
- }),
182
- // Frontend + Admin, used during development
183
- args.serverless &&
184
- pluginEntryFile({
185
- code: `
186
- import '/_boot_test_shim.js'
187
- import boot from 'eddev/_internal/_entry/main.serverless.dev.js'
188
- import "./views/index.css"
189
- boot()
190
- `,
191
- id: "eddev-bootup-serverless-admin",
192
- path: "/_boot_admin.js",
193
- }),
194
- // SSR Bundle, used for rendering on the server
195
- args.serverless &&
196
- pluginEntryFile({
197
- code: `
198
- export * from 'eddev/_internal/_entry/main.frontend.ssr.js'
199
- import "./views/index.css"
200
- `,
201
- id: "eddev-ssr",
202
- path: "/_ssr.js",
203
- }),
204
- // args.serverless && {
205
- // name: "eddev:serverless",
206
- // (chunk) {
207
- // console.log("Chunk", chunk)
208
- // return ""
209
- // },
210
- // },
211
- pluginResolvedTailwind(args.project, args.console, args.serverless),
212
- pluginBlocks(args.project, args.console, args.serverless),
213
- pluginViews(args.project, args.console, args.serverless),
214
- pluginThemeManifest(args.project, args.console),
215
- pluginAdminManifest(args.project, args.console),
216
- !args.serverless && buildStatus(console),
217
- // args.serverless
218
- // ? pluginEntryFile({
219
- // code: indexHtml,
220
- // id: "index.html",
221
- // path: join(args.rootDir, "index.html"),
222
- // })
223
- // : null,
224
- ],
225
- build: args.target === "cms"
226
- ? {
227
- manifest: true,
228
- sourcemap: true,
229
- modulePreload: false,
230
- minify: args.mode === "production",
231
- outDir: args.outDir,
232
- watch: {},
233
- rollupOptions: {
234
- input: "/_boot.js",
235
- external: ["react", "react-dom"],
236
- onwarn(warning, warn) {
237
- if (warning.code === "SOURCEMAP_ERROR") {
238
- return;
239
- }
240
- warn(warning);
241
- },
242
- output: {
243
- entryFileNames: "main.admin.js",
244
- format: "iife",
245
- globals: {
246
- react: "window.React",
247
- "react-dom": "window.ReactDOM",
248
- },
249
- },
250
- },
251
- }
252
- : args.serverless
253
- ? {
254
- rollupOptions: {
255
- input: "/_boot.js",
256
- external: ["react", "react-dom"],
257
- onwarn(warning, warn) {
258
- if (warning.code === "SOURCEMAP_ERROR") {
259
- return;
260
- }
261
- warn(warning);
262
- },
263
- output: args.mode === "production"
264
- ? {
265
- entryFileNames: "main.admin.js",
266
- format: "iife",
267
- globals: {
268
- react: "window.React",
269
- "react-dom": "window.ReactDOM",
270
- },
271
- }
272
- : undefined,
273
- },
274
- }
275
- : {
276
- manifest: true,
277
- sourcemap: true,
278
- minify: args.mode === "production",
279
- modulePreload: false,
280
- outDir: args.outDir,
281
- watch: {},
282
- rollupOptions: {
283
- input: "/_boot.js",
284
- onwarn(warning, warn) {
285
- if (warning.code === "SOURCEMAP_ERROR") {
286
- return;
287
- }
288
- warn(warning);
289
- },
290
- },
291
- },
292
- };
293
- return config;
294
- }
295
- function buildStatus(console) {
296
- let timer = 0;
297
- return {
298
- name: "eddev:logging",
299
- enforce: "post",
300
- watchChange() {
301
- console.resetLog();
302
- clearTimeout(timer);
303
- },
304
- buildStart() {
305
- clearTimeout(timer);
306
- console.setWorking(true);
307
- },
308
- buildEnd() {
309
- clearTimeout(timer);
310
- timer = setTimeout(() => {
311
- console.setWorking(false);
312
- }, 0);
313
- },
314
- };
315
- }
@@ -1,4 +0,0 @@
1
- import { Plugin } from "vite";
2
- import { Project } from "../../project/project.js";
3
- import { StatefulLog } from "../../utils/statefulLog.js";
4
- export declare function pluginAdminManifest(project: Project, console: StatefulLog<any>): Plugin;
@@ -1,67 +0,0 @@
1
- import { join } from "path";
2
- export function pluginAdminManifest(project, console) {
3
- const virtualId = "\0virtual:admin-manifest.js";
4
- let server = null;
5
- const fakePath = join(project.rootDir, "__admin-manifest.js");
6
- let lastHash = "";
7
- project.views.subscribeFuture(async (manifest) => {
8
- if (server) {
9
- const hash = Object.keys(manifest.views).join("");
10
- const virtualModule = server.moduleGraph.getModuleById(virtualId);
11
- if (virtualModule && hash !== lastHash && lastHash !== "") {
12
- server.moduleGraph.invalidateModule(virtualModule);
13
- }
14
- lastHash = hash;
15
- }
16
- });
17
- return {
18
- name: "eddev:adminManifest",
19
- resolveId(id) {
20
- if (id === fakePath) {
21
- return virtualId;
22
- }
23
- },
24
- async load(id) {
25
- if (id === virtualId) {
26
- const fieldManifest = await project.fields.get();
27
- const widgetManifest = await project.widgets.get();
28
- return `
29
- import { adminManifestReader } from 'eddev/_internal'
30
- import editorConfig from './blocks/_editor'
31
-
32
- const fields = {${Object.entries(fieldManifest.fields)
33
- .map(([name, field]) => {
34
- const importStatement = `() => import(${JSON.stringify("./" + field.fileName)}).then(m => m.default)`;
35
- return JSON.stringify(field.slug) + ": " + importStatement;
36
- })
37
- .join(",\n")}}
38
- const widgets = {${Object.entries(widgetManifest.widgets)
39
- .map(([name, widget]) => {
40
- const importStatement = `() => import(${JSON.stringify("./" + widget.fileName)}).then(m => m.default)`;
41
- return JSON.stringify(widget.slug) + ": " + importStatement;
42
- })
43
- .join(",\n")}}
44
-
45
- const manifest = {
46
- fields,
47
- widgets,
48
- editorConfig
49
- }
50
-
51
- adminManifestReader.set(manifest)
52
-
53
- export default manifest
54
-
55
- export { editorConfig }
56
-
57
- if (import.meta.hot) {
58
- import.meta.hot.accept()
59
- }
60
- `;
61
- }
62
- },
63
- configureServer(_server) {
64
- server = _server;
65
- },
66
- };
67
- }
@@ -1,4 +0,0 @@
1
- import { Plugin } from "vite";
2
- import { Project } from "../../project/project.js";
3
- import { StatefulLog } from "../../utils/statefulLog.js";
4
- export declare function pluginBlocks(project: Project, console: StatefulLog<any>, ssr: boolean): Plugin;
@@ -1,73 +0,0 @@
1
- import { join } from "path";
2
- export function pluginBlocks(project, console, ssr) {
3
- const manifestId = "\0virtual:block-manifest.js";
4
- let server = null;
5
- const fakePath = join(project.rootDir, "__block-manifest.js");
6
- let lastHash = "";
7
- project.blocks.subscribeFuture(async (manifest) => {
8
- if (server) {
9
- const hash = Object.keys(manifest.blocks).join("");
10
- const virtualModule = server.moduleGraph.getModuleById(manifestId);
11
- if (virtualModule && hash !== lastHash && lastHash !== "") {
12
- server.moduleGraph.invalidateModule(virtualModule);
13
- }
14
- lastHash = hash;
15
- }
16
- });
17
- return {
18
- name: "eddev:blockManifest",
19
- enforce: "pre",
20
- resolveId(id) {
21
- if (id === fakePath) {
22
- return manifestId;
23
- }
24
- },
25
- async load(id) {
26
- if (id === manifestId) {
27
- const blockManifest = await project.blocks.get();
28
- return `
29
- import { blockManifestReader } from 'eddev/_internal'
30
- import { dynamic } from 'eddev/dynamic'
31
- import core from './blocks/_core'
32
-
33
- const manifest = {
34
- ${Object.entries(blockManifest.blocks)
35
- .filter(([name]) => !name.match(/^_[a-z]+$/i))
36
- .map(([name, block]) => {
37
- const importStatement = `dynamic(() => import(${JSON.stringify("./" + block.fileName)}))`;
38
- return JSON.stringify(block.acfName) + ": " + importStatement;
39
- })
40
- .join(",\n")},
41
- ...core
42
- }
43
-
44
- const info = {
45
- ${Object.entries(blockManifest.blocks)
46
- .filter(([name]) => !name.match(/^_[a-z]+$/i))
47
- .map(([name, block]) => {
48
- return (JSON.stringify(block.acfName) +
49
- ": " +
50
- JSON.stringify({
51
- slug: block.slug,
52
- tags: block.tags,
53
- flags: block.flags ?? {},
54
- }));
55
- })
56
- .join(",\n")}
57
- }
58
-
59
- blockManifestReader.set(manifest, info)
60
-
61
- export default manifest
62
-
63
- if (import.meta.hot) {
64
- import.meta.hot.accept()
65
- }
66
- `;
67
- }
68
- },
69
- configureServer(_server) {
70
- server = _server;
71
- },
72
- };
73
- }
@@ -1,6 +0,0 @@
1
- import { Plugin } from "vite";
2
- export declare function pluginEntryFile(args: {
3
- code: string;
4
- id: string;
5
- path: string;
6
- }): Plugin;
@@ -1,16 +0,0 @@
1
- export function pluginEntryFile(args) {
2
- const virtualId = "\0virtual:" + args.id;
3
- return {
4
- name: "eddev:entry:" + args.id,
5
- resolveId(id) {
6
- if (id === args.path) {
7
- return virtualId;
8
- }
9
- },
10
- load(id) {
11
- if (id === virtualId) {
12
- return args.code;
13
- }
14
- },
15
- };
16
- }
@@ -1,4 +0,0 @@
1
- import { Plugin } from "vite";
2
- import { Project } from "../../project/project.js";
3
- import { StatefulLog } from "../../utils/statefulLog.js";
4
- export declare function pluginResolvedTailwind(project: Project, console: StatefulLog<any>, ssr: boolean): Plugin;
@@ -1,29 +0,0 @@
1
- import { join } from "path";
2
- export function pluginResolvedTailwind(project, console, ssr) {
3
- const virtualId = "\0virtual:resolved-tailwind.js";
4
- const fakePath = join(project.rootDir, "__resolved-tailwind.js");
5
- return {
6
- name: "eddev:resolvedTailwind",
7
- resolveId(id) {
8
- if (id === fakePath) {
9
- return virtualId;
10
- }
11
- },
12
- async load(id) {
13
- if (id === virtualId) {
14
- return `
15
- import tw from "./tailwind.config"
16
- import resolveConfig from 'tailwindcss/resolveConfig'
17
- import { internalStore } from 'eddev/_internal'
18
-
19
- const value = resolveConfig(tw)
20
- internalStore.set('tailwindConfig', value)
21
-
22
- if (import.meta.hot) {
23
- import.meta.hot.accept()
24
- }
25
- `;
26
- }
27
- },
28
- };
29
- }
@@ -1,4 +0,0 @@
1
- import { Plugin } from "vite";
2
- import { Project } from "../../project/project.js";
3
- import { StatefulLog } from "../../utils/statefulLog.js";
4
- export declare function pluginThemeManifest(project: Project, console: StatefulLog<any>): Plugin;
@@ -1,40 +0,0 @@
1
- import { join } from "path";
2
- export function pluginThemeManifest(project, console) {
3
- const virtualId = "\0virtual:theme-manifest.js";
4
- const fakePath = join(project.rootDir, "__theme-manifest.js");
5
- const usingStitches = project.config?.legacyStitches;
6
- return {
7
- name: "eddev:themeManifest",
8
- resolveId(id) {
9
- if (id === fakePath) {
10
- return virtualId;
11
- }
12
- },
13
- async load(id) {
14
- if (id === virtualId) {
15
- if (usingStitches) {
16
- return `
17
- import * as theme from './theme.css'
18
- export const getCssText = () => {
19
- if (theme.getCssText) {
20
- return theme.getCssText()
21
- }
22
- return ''
23
- }
24
-
25
- export const editorGlobalStyles = () => {
26
- if (theme.editorGlobalStyles)
27
- return theme.editorGlobalStyles()
28
- }
29
- `;
30
- }
31
- else {
32
- return `
33
- export const getCssText = undefined
34
- export const editorGlobalStyles = () => {}
35
- `;
36
- }
37
- }
38
- },
39
- };
40
- }
@@ -1,4 +0,0 @@
1
- import { Plugin } from "vite";
2
- import { Project } from "../../project/project.js";
3
- import { StatefulLog } from "../../utils/statefulLog.js";
4
- export declare function pluginViews(project: Project, console: StatefulLog<any>, ssr: boolean): Plugin;
@@ -1,51 +0,0 @@
1
- import { join } from "path";
2
- export function pluginViews(project, console, ssr) {
3
- const virtualId = "\0virtual:view-manifest.js";
4
- let server = null;
5
- const fakePath = join(project.rootDir, "__view-manifest.js");
6
- let lastHash = "";
7
- project.views.subscribeFuture(async (manifest) => {
8
- if (server) {
9
- const hash = Object.keys(manifest.views).join("");
10
- const virtualModule = server.moduleGraph.getModuleById(virtualId);
11
- if (virtualModule && hash !== lastHash && lastHash !== "") {
12
- server.moduleGraph.invalidateModule(virtualModule);
13
- }
14
- lastHash = hash;
15
- }
16
- });
17
- return {
18
- name: "eddev:viewManifest",
19
- resolveId(id) {
20
- if (id === fakePath) {
21
- return virtualId;
22
- }
23
- },
24
- async load(id) {
25
- if (id === virtualId) {
26
- const viewManifest = await project.views.get();
27
- return `
28
- import { viewManifestReader } from 'eddev/_internal'
29
- import { dynamic } from 'eddev/dynamic'
30
- const manifest = {${Object.entries(viewManifest.views)
31
- .map(([name, view]) => {
32
- const importStatement = `dynamic(() => import(${JSON.stringify("./" + view.fileName)}))`;
33
- return JSON.stringify(view.slug) + ": " + importStatement;
34
- })
35
- .join(",\n")}}
36
-
37
- viewManifestReader.value = manifest
38
-
39
- export default manifest
40
-
41
- if (import.meta.hot) {
42
- import.meta.hot.accept()
43
- }
44
- `;
45
- }
46
- },
47
- configureServer(_server) {
48
- server = _server;
49
- },
50
- };
51
- }
@@ -1,21 +0,0 @@
1
- import { ConsolaInstance, LogLevel } from "consola";
2
- export declare const logger: ConsolaInstance;
3
- export declare const console: {
4
- setLevel: (level: LogLevel) => void;
5
- failish: (message: string) => void;
6
- heading: (message: string) => void;
7
- log: (message: any, ...args: any[]) => void;
8
- verbose: (message: any, ...args: any[]) => void;
9
- info: (message: any, ...args: any[]) => void;
10
- warn: (message: any, ...args: any[]) => void;
11
- error: (message: any, ...args: any[]) => void;
12
- fail: (message: any, ...args: any[]) => void;
13
- success: (message: any, ...args: any[]) => void;
14
- ready: (message: any, ...args: any[]) => void;
15
- silent: (message: any, ...args: any[]) => void;
16
- fatal: (message: any, ...args: any[]) => void;
17
- start: (message: any, ...args: any[]) => void;
18
- box: (message: any, ...args: any[]) => void;
19
- debug: (message: any, ...args: any[]) => void;
20
- trace: (message: any, ...args: any[]) => void;
21
- };