@base44-preview/cli 0.1.17-pr.635.7aa76fd → 0.1.17-pr.635.e302685

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/index.js CHANGED
@@ -230722,9 +230722,9 @@ var SiteConfigSchema = object({
230722
230722
  serveCommand: string2().optional(),
230723
230723
  outputDirectory: string2().optional(),
230724
230724
  installCommand: string2().default("npm install"),
230725
- devHostFlag: string2().default("--host"),
230726
- devHost: string2().default("0.0.0.0"),
230727
- devPort: number2().int().min(1).max(65535).default(5173)
230725
+ devHostFlag: string2().optional(),
230726
+ devHost: string2().optional(),
230727
+ devPort: number2().int().min(1).max(65535).optional()
230728
230728
  });
230729
230729
  var PluginMetadataSchema = object({
230730
230730
  namespace: string2().min(1, "Plugin namespace cannot be empty").regex(/^[a-zA-Z0-9_-]+$/, "Plugin namespace can only contain letters, numbers, underscores, and dashes")
@@ -246711,6 +246711,9 @@ async function gitHead(projectRoot) {
246711
246711
  }
246712
246712
  // src/core/site/serve-command.ts
246713
246713
  var DEFAULT_SERVE_COMMAND = "npm run dev";
246714
+ var DEFAULT_HOST_FLAG = "--host";
246715
+ var DEFAULT_DEV_HOST = "0.0.0.0";
246716
+ var DEFAULT_DEV_PORT = 5173;
246714
246717
  var SCRIPT = "[A-Za-z0-9:_.-]+";
246715
246718
  var PREFIX2 = "[A-Za-z0-9._/-]+";
246716
246719
  var SCRIPT_RUNNERS = [
@@ -246728,7 +246731,13 @@ function runnerFor(serveCommand) {
246728
246731
  }
246729
246732
  function withServeAddress(serveCommand, { host, port, hostFlag }) {
246730
246733
  const command = serveCommand.trim();
246731
- const args = [hostFlag, host, "--port", String(port)];
246734
+ const args = [
246735
+ ...host ? [hostFlag ?? DEFAULT_HOST_FLAG, host] : [],
246736
+ ...port === undefined ? [] : ["--port", String(port)]
246737
+ ];
246738
+ if (args.length === 0) {
246739
+ return { command, droppedAddress: false };
246740
+ }
246732
246741
  const runner = runnerFor(command);
246733
246742
  if (!runner) {
246734
246743
  return { command, droppedAddress: true };
@@ -251313,6 +251322,16 @@ function stopRunnerOnProcessSignals(runner) {
251313
251322
  }
251314
251323
 
251315
251324
  // src/cli/commands/site/dev.ts
251325
+ function parsePort(value) {
251326
+ if (!/^\d+$/.test(value)) {
251327
+ throw new InvalidArgumentError2("must be a whole number");
251328
+ }
251329
+ const port = Number(value);
251330
+ if (port < 1 || port > 65535) {
251331
+ throw new InvalidArgumentError2("must be between 1 and 65535");
251332
+ }
251333
+ return port;
251334
+ }
251316
251335
  async function siteDevAction(ctx, options) {
251317
251336
  const { app } = ctx;
251318
251337
  if (!app?.projectRoot) {
@@ -251325,8 +251344,8 @@ async function siteDevAction(ctx, options) {
251325
251344
  }
251326
251345
  const serveCommand = site.serveCommand ?? DEFAULT_SERVE_COMMAND;
251327
251346
  const { command, droppedAddress } = withServeAddress(serveCommand, {
251328
- host: site.devHost,
251329
- port: site.devPort,
251347
+ host: options.host ?? site.devHost ?? DEFAULT_DEV_HOST,
251348
+ port: options.port ?? site.devPort ?? DEFAULT_DEV_PORT,
251330
251349
  hostFlag: site.devHostFlag
251331
251350
  });
251332
251351
  if (droppedAddress) {
@@ -251346,7 +251365,7 @@ async function siteDevAction(ctx, options) {
251346
251365
  };
251347
251366
  }
251348
251367
  function getSiteDevCommand() {
251349
- return new Base44Command("dev", { requireAuth: false }).description("Run the site's dev server against a given backend (no local backend)").option("--backend-url <url>", "Backend the frontend should call, injected as VITE_BASE44_APP_BASE_URL. Omit for a frontend that reaches its backend same-origin.").action(siteDevAction);
251368
+ return new Base44Command("dev", { requireAuth: false }).description("Run the site's dev server against a given backend (no local backend)").option("--backend-url <url>", "Backend the frontend should call, injected as VITE_BASE44_APP_BASE_URL. Omit for a frontend that reaches its backend same-origin.").option("--host <address>", `Address to bind (default: site.devHost, else ${DEFAULT_DEV_HOST})`).option("--port <number>", `Port to bind (default: site.devPort, else ${DEFAULT_DEV_PORT})`, parsePort).action(siteDevAction);
251350
251369
  }
251351
251370
 
251352
251371
  // src/cli/commands/site/open.ts
@@ -255792,7 +255811,7 @@ function readStdin2() {
255792
255811
  process.stdin.on("error", reject);
255793
255812
  });
255794
255813
  }
255795
- function parsePort(value) {
255814
+ function parsePort2(value) {
255796
255815
  const port = Number(value);
255797
255816
  if (!Number.isInteger(port) || port <= 0 || port > 65535) {
255798
255817
  throw new InvalidInputError(`Invalid --port value: "${value}".`, {
@@ -255829,7 +255848,7 @@ async function execAction({ app, isNonInteractive }, options) {
255829
255848
  if (!code.trim()) {
255830
255849
  throw noInputError;
255831
255850
  }
255832
- const local = options.local ? await resolveLocalTarget(options.port !== undefined ? parsePort(options.port) : DEFAULT_DEV_SERVER_PORT) : undefined;
255851
+ const local = options.local ? await resolveLocalTarget(options.port !== undefined ? parsePort2(options.port) : DEFAULT_DEV_SERVER_PORT) : undefined;
255833
255852
  const { exitCode } = await runScript({
255834
255853
  appId: app.id,
255835
255854
  code,
@@ -260064,4 +260083,4 @@ export {
260064
260083
  runCLI
260065
260084
  };
260066
260085
 
260067
- //# debugId=8C0EDF181791840B64756E2164756E21
260086
+ //# debugId=B2A3D9FE2F0B212364756E2164756E21