eddev 2.0.0-beta.17 → 2.0.0-beta.19

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.
@@ -6,6 +6,7 @@ import { SSRRoot } from "../entry/ssr-root.js";
6
6
  import { RouteLoader } from "../lib/routing/loader.js";
7
7
  export async function renderPageToSSRStream(pathname, initialData, serverContext) {
8
8
  const clientManifest = serverContext.getManifest("client");
9
+ console.log("Manifest is", clientManifest);
9
10
  const assets = await clientManifest.inputs[clientManifest.handler].assets();
10
11
  const jsx = (_jsx(SSRRoot, { assets: _jsx(Suspense, { children: assets.map((m) => renderAsset(m)) }), pathname: pathname, initialData: initialData, loader: new RouteLoader() }));
11
12
  const stream = await new Promise(async (resolve) => {
@@ -14,7 +15,7 @@ export async function renderPageToSSRStream(pathname, initialData, serverContext
14
15
  resolve(stream);
15
16
  },
16
17
  bootstrapModules: [clientManifest.inputs[clientManifest.handler].output.path],
17
- bootstrapScriptContent: `window.manifest = ${JSON.stringify(clientManifest.json())}; window._PAGE_DATA = ${JSON.stringify(initialData)}`,
18
+ bootstrapScriptContent: `window.manifest = ${JSON.stringify(await clientManifest.json())}; window._PAGE_DATA = ${JSON.stringify(initialData)}`,
18
19
  });
19
20
  });
20
21
  return stream;
@@ -2,8 +2,8 @@ import chalk from "chalk";
2
2
  import { Command } from "commander";
3
3
  import { setDefaultResultOrder } from "dns";
4
4
  import { config as importDotEnv } from "dotenv";
5
- import { adminLog } from "../compiler/bundler.admin.js";
6
- import { frontendLog } from "../compiler/bundler.frontend.js";
5
+ import { AdminBundler, adminLog } from "../compiler/bundler.admin.js";
6
+ import { FrontendBundler, frontendLog } from "../compiler/bundler.frontend.js";
7
7
  import { DevServer, serverlessLog } from "../compiler/dev-server.js";
8
8
  import { createVinxiCodegen } from "../compiler/vinxi-codegen.js";
9
9
  import { graphqlLog } from "../graphql/graphql-codegen.js";
@@ -160,13 +160,24 @@ program
160
160
  console,
161
161
  });
162
162
  }
163
- // Load the compiler
164
- // new AdminBundler(project, {
165
- // mode: "development",
166
- // })
167
- // new FrontendBundler(project, {
168
- // mode: "production",
169
- // })
163
+ else {
164
+ const codegen = createVinxiCodegen({
165
+ mode: "production",
166
+ project: project,
167
+ serverless: false,
168
+ });
169
+ await codegen.run();
170
+ console.info("Building for SPA WordPress (Frontend and Admin)");
171
+ // Load the compiler
172
+ const admin = new AdminBundler(project, {
173
+ mode: "development",
174
+ });
175
+ const frontend = new FrontendBundler(project, {
176
+ mode: "production",
177
+ });
178
+ await Promise.all([admin.start(), frontend.start()]);
179
+ console.log("Done building SPA WordPress");
180
+ }
170
181
  });
171
182
  program
172
183
  .command("info")
@@ -1 +1 @@
1
- export declare const VERSION = "2.0.0-beta.16";
1
+ export declare const VERSION = "2.0.0-beta.19";
@@ -1 +1 @@
1
- export const VERSION = "2.0.0-beta.16";
1
+ export const VERSION = "2.0.0-beta.19";
@@ -8,6 +8,6 @@ export declare class AdminBundler {
8
8
  project: Project;
9
9
  opts: Options;
10
10
  constructor(project: Project, opts: Options);
11
- protected start(): Promise<void>;
11
+ start(): Promise<void>;
12
12
  }
13
13
  export {};
@@ -10,7 +10,6 @@ export class AdminBundler {
10
10
  constructor(project, opts) {
11
11
  this.project = project;
12
12
  this.opts = opts;
13
- this.start();
14
13
  }
15
14
  async start() {
16
15
  console.info(`Creating ${this.opts.mode} WordPress admin build...`);
@@ -10,7 +10,6 @@ export class FrontendBundler {
10
10
  constructor(project, opts) {
11
11
  this.project = project;
12
12
  this.opts = opts;
13
- this.start();
14
13
  }
15
14
  async start() {
16
15
  console.info(`Creating ${this.opts.mode} SPA build...`);
@@ -91,7 +91,7 @@ export function ssrPlugin() {
91
91
  config.ssr = {
92
92
  ...config.ssr,
93
93
  // @ts-ignore
94
- noExternal: ["eddev", "vinxi", ...(config?.optimizeDeps?.noExternal ?? [])],
94
+ noExternal: ["eddev", "vinxi", "react-use", ...(config?.optimizeDeps?.noExternal ?? [])],
95
95
  optimizeDeps: {
96
96
  exclude: ["eddev", "vinxi"],
97
97
  },
@@ -169,9 +169,9 @@ export function getViteConfig(args) {
169
169
  minify: args.mode === "production",
170
170
  modulePreload: false,
171
171
  outDir: args.outDir,
172
- watch: {},
172
+ // watch: {},
173
173
  rollupOptions: {
174
- input: `/.eddev/${args.mode === "production" ? "prod" : "dev"}-spa/entry.${args.target === "cms" ? "admin" : "client"}.tsx`,
174
+ input: `./.eddev/${args.mode === "production" ? "prod" : "dev"}-spa/entry.${args.target === "cms" ? "admin" : "client"}.tsx`,
175
175
  external: args.target === "cms" ? ["react", "react-dom"] : [],
176
176
  onwarn(warning, warn) {
177
177
  if (!cliMode.verbose &&
@@ -97,7 +97,7 @@ export function createVinxiCodegen(opts) {
97
97
  import { devToolsStore } from 'eddev/devtools'
98
98
 
99
99
  // Set up a dynamic entry which will load the configured tailwind manifest
100
- devToolsStore.loadTailwindConfig = () => import('./manifest/tailwind-config')
100
+ devToolsStore.loadTailwindConfig = () => import('./manifest/tailwind-config.js')
101
101
 
102
102
  // Create the asset renderer, which will ensure scripts/styles are mounted correctly
103
103
  function getAssets() {
@@ -157,7 +157,7 @@ export function createVinxiCodegen(opts) {
157
157
  generate: code /* tsx */ `
158
158
  /// <reference types="vinxi/types/server" />
159
159
  import { createRouter, eventHandler, getRouterParam, getQuery, getWebRequest, getRequestHeaders } from "vinxi/http"
160
- import { serverContext } from "./context"
160
+ import { serverContext } from "./context.js"
161
161
 
162
162
  const router = createRouter()
163
163
  .get(
@@ -221,13 +221,14 @@ export function createVinxiCodegen(opts) {
221
221
  generate: code /* tsx */ `
222
222
  /// <reference types="vinxi/types/server" />
223
223
  import "../../views/index.css"
224
- import "./manifest/blocks"
225
- import "./manifest/styles"
226
- import "./manifest/views"
224
+ import "./manifest/blocks.js"
225
+ import "./manifest/styles.js"
226
+ import "./manifest/views.js"
227
227
 
228
228
  import { renderPageToSSRStream, proxyWpAdmin } from "eddev/server"
229
229
  import { eventHandler, setResponseHeader, setResponseStatus, getRequestURL } from "vinxi/http"
230
- import { serverContext } from "./context"
230
+ import { serverContext } from "./context.js"
231
+ import { getManifest } from "vinxi/manifest"
231
232
 
232
233
  export default eventHandler({
233
234
  handler: async (event) => {
@@ -246,6 +247,7 @@ export function createVinxiCodegen(opts) {
246
247
  if (response.ok) {
247
248
  setResponseStatus(event, response.status)
248
249
  setResponseHeader(event, "Content-Type", "text/html; charset=utf-8")
250
+ console.log('MM', getManifest('client'))
249
251
  return renderPageToSSRStream(url.pathname, await response.json(), serverContext)
250
252
  } else {
251
253
  return response
@@ -263,7 +265,7 @@ export function createVinxiCodegen(opts) {
263
265
  /// <reference types="vinxi/types/server" />
264
266
  import { proxyWpAdmin } from "eddev/server"
265
267
  import { eventHandler } from "vinxi/http"
266
- import { serverContext } from "./context"
268
+ import { serverContext } from "./context.js"
267
269
 
268
270
  export default eventHandler(async (event) => {
269
271
  return proxyWpAdmin(event, serverContext)
@@ -399,7 +401,7 @@ export function createVinxiCodegen(opts) {
399
401
  name: "manifest/tailwind-config.ts",
400
402
  generate: async () => {
401
403
  return code /* ts */ `
402
- import tw from "../../../tailwind.config"
404
+ import tw from "../../../tailwind.config.ts"
403
405
  import resolveConfig from 'tailwindcss/resolveConfig'
404
406
  import { devToolsStore } from 'eddev/devtools'
405
407
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eddev",
3
- "version": "2.0.0-beta.17",
3
+ "version": "2.0.0-beta.19",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",