@evjs/cli 0.0.29 → 0.0.30

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.
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
- import { configure, getConsoleSink, getLogger, } from "@logtape/logtape";
5
+ import { configure, getConsoleSink, getLogger } from "@logtape/logtape";
6
6
  import { Command } from "commander";
7
7
  import { build, dev } from "./index.js";
8
8
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
package/dist/index.js CHANGED
@@ -153,12 +153,10 @@ export async function dev(userConfig, options) {
153
153
  new Promise((resolve) => setTimeout(resolve, 3000)),
154
154
  ]);
155
155
  }
156
- catch (e) { }
156
+ catch { }
157
157
  }
158
158
  const serverPort = config?.server?.dev?.port ?? CONFIG_DEFAULTS.serverPort;
159
- const runtimeConfig = config?.server?.runtime ?? "node";
160
- const [runtime, ...runtimeExtraArgs] = runtimeConfig.split(/\s+/);
161
- logger.info `Server bundle detected, starting ${runtime} API...`;
159
+ logger.info `Server bundle detected, starting API...`;
162
160
  const bootstrapPath = path.resolve(cwd, "dist/server/_dev_start.cjs");
163
161
  try {
164
162
  const serverBundlePath = path.resolve(cwd, "dist/server", manifest.entry);
@@ -166,22 +164,13 @@ export async function dev(userConfig, options) {
166
164
  fs.mkdirSync(path.dirname(bootstrapPath), { recursive: true });
167
165
  }
168
166
  fs.writeFileSync(bootstrapPath, [
169
- `const bundle = require(${JSON.stringify(serverBundlePath)});`,
170
- `const app = bundle.app || bundle.createApp({ functions: { endpoint: ${JSON.stringify(config.server.endpoint)} } });`,
167
+ `const handler = require(${JSON.stringify(serverBundlePath)}).default;`,
171
168
  `const { serve } = require("@evjs/server/node");`,
172
- `serve(app, { port: ${serverPort}, https: ${JSON.stringify(config.server.dev.https)} });`,
169
+ `serve({ fetch: handler }, { port: ${serverPort}, https: ${JSON.stringify(config.server.dev.https)} });`,
173
170
  ].join("\n"));
174
- // node gets --watch flags; other runtimes use their own args as-is
175
- const runtimeArgs = runtime === "node"
176
- ? [
177
- "--watch",
178
- "--watch-preserve-output",
179
- ...runtimeExtraArgs,
180
- bootstrapPath,
181
- ]
182
- : [...runtimeExtraArgs, bootstrapPath];
171
+ const runtimeArgs = [bootstrapPath];
183
172
  // Don't await execa here since it's a long-running watch process
184
- const child = execa(runtime, runtimeArgs, {
173
+ const child = execa("node", runtimeArgs, {
185
174
  stdio: "inherit",
186
175
  env: { ...process.env, NODE_ENV: "development" },
187
176
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evjs/cli",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "description": "CLI and configuration layer for the evjs framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",