@base44-preview/cli 0.1.29-pr.656.a562be5 → 0.1.32-pr.658.bc0ac49

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
@@ -236769,6 +236769,27 @@ function siteOrDefault(project) {
236769
236769
  warnConfigFallback(`${project.configPath} has no 'site' block; using the default site commands.`);
236770
236770
  return DEFAULT_SITE;
236771
236771
  }
236772
+ var COMMAND_NOT_FOUND_EXIT_CODES = new Set([127, 9009]);
236773
+ async function runSiteCommandOrDefault(command, fallback, run) {
236774
+ try {
236775
+ return await run(command);
236776
+ } catch (error) {
236777
+ if (command === fallback || !isCommandNotFound(error)) {
236778
+ throw error;
236779
+ }
236780
+ warnSiteCommandFallback(command, fallback);
236781
+ return run(fallback);
236782
+ }
236783
+ }
236784
+ function warnSiteCommandFallback(command, fallback) {
236785
+ warnConfigFallback(`'${command}' could not start because its program is not installed; running '${fallback}' instead.`);
236786
+ }
236787
+ function isCommandNotFoundExit(code) {
236788
+ return typeof code === "number" && COMMAND_NOT_FOUND_EXIT_CODES.has(code);
236789
+ }
236790
+ function isCommandNotFound(error) {
236791
+ return typeof error === "object" && error !== null && "exitCode" in error && isCommandNotFoundExit(error.exitCode);
236792
+ }
236772
236793
  function withoutKey(record, key) {
236773
236794
  return Object.fromEntries(Object.entries(record).filter(([k]) => k !== key));
236774
236795
  }
@@ -239374,7 +239395,7 @@ import { join as join13 } from "node:path";
239374
239395
  // package.json
239375
239396
  var package_default = {
239376
239397
  name: "base44",
239377
- version: "0.1.29",
239398
+ version: "0.1.32",
239378
239399
  description: "Base44 CLI - Unified interface for managing Base44 applications",
239379
239400
  type: "module",
239380
239401
  bin: {
@@ -249751,11 +249772,11 @@ function getFunctionsCommand() {
249751
249772
 
249752
249773
  // src/cli/commands/project/site-build.ts
249753
249774
  async function runSiteBuild({ runTask }, { root, buildCommand = DEFAULT_SITE.buildCommand, appId }) {
249754
- await runTask("Building site...", () => execa({
249775
+ await runTask("Building site...", () => runSiteCommandOrDefault(buildCommand, DEFAULT_SITE.buildCommand, (command) => execa({
249755
249776
  cwd: root,
249756
249777
  shell: true,
249757
249778
  env: { VITE_BASE44_APP_ID: appId }
249758
- })`${buildCommand}`, {
249779
+ })`${command}`), {
249759
249780
  successMessage: "Site built successfully",
249760
249781
  errorMessage: "Build failed"
249761
249782
  });
@@ -261311,7 +261332,7 @@ function shardOf(group, response, verdict, options) {
261311
261332
  gzipBytes: verdict.gzipBytes,
261312
261333
  ...response.activation ? { activation: response.activation } : {},
261313
261334
  wrapper: {
261314
- secrets: response.activation ? `blob-${response.activation}` : "binding",
261335
+ secrets: response.activation ? `blob_${response.activation}` : "binding",
261315
261336
  postResponseTelemetry: options.postResponseTelemetry ?? false,
261316
261337
  staticEgress: STATIC_EGRESS_ARTIFACT_MARKER
261317
261338
  }
@@ -261394,8 +261415,9 @@ async function compilerInput(root, fn) {
261394
261415
  for (const filePath of fn.filePaths) {
261395
261416
  backendFiles[projectPath(root, filePath)] = await readTextFile(filePath);
261396
261417
  }
261397
- const { entry, files } = await cfwBundleInput(projectPath(root, fn.entryPath), await readTextFile(fn.entryPath), backendFiles);
261398
- return { name: fn.name, entry, files };
261418
+ const source = await readTextFile(fn.entryPath);
261419
+ const { entry, files } = await cfwBundleInput(projectPath(root, fn.entryPath), source, backendFiles);
261420
+ return { input: { name: fn.name, entry, files }, source };
261399
261421
  }
261400
261422
  function describeFailure(failure) {
261401
261423
  const where = failure.function ? `${failure.function}: ` : "";
@@ -261413,11 +261435,14 @@ async function compileBackendBundles(root, functionsDir) {
261413
261435
  }
261414
261436
  await requireCompilerRuntime();
261415
261437
  const sorted = [...functions].sort((a, b) => a.name < b.name ? -1 : 1);
261416
- const inputs = await pMap(sorted, (fn) => compilerInput(root, fn), {
261438
+ const compiled = await pMap(sorted, (fn) => compilerInput(root, fn), {
261417
261439
  concurrency: 8
261418
261440
  });
261419
- const entries = new Map(inputs.map((input) => [input.name, input.entry]));
261420
- const built = await compileFunctionShards(inputs, SHARD_POLICY, COMPILE_MODES);
261441
+ const declared = new Map(compiled.map(({ input, source }) => [
261442
+ input.name,
261443
+ { name: input.name, entry: input.entry, source }
261444
+ ]));
261445
+ const built = await compileFunctionShards(compiled.map(({ input }) => input), SHARD_POLICY, COMPILE_MODES);
261421
261446
  if (!built.ok) {
261422
261447
  throw new InvalidInputError(`Backend functions failed to compile (${built.failures.length} error${built.failures.length === 1 ? "" : "s"}).`, { details: built.failures.map(describeFailure) });
261423
261448
  }
@@ -261427,10 +261452,7 @@ async function compileBackendBundles(root, functionsDir) {
261427
261452
  module,
261428
261453
  size: module.byteLength,
261429
261454
  digest: sha256(module),
261430
- functions: shard.functions.map((name) => ({
261431
- name,
261432
- entry: entries.get(name)
261433
- })),
261455
+ functions: shard.functions.map((name) => declared.get(name)),
261434
261456
  wrapper: shard.wrapper
261435
261457
  };
261436
261458
  });
@@ -262326,14 +262348,25 @@ async function siteDevAction(ctx, forwarded) {
262326
262348
  const site = siteOrDefault(project);
262327
262349
  const serveCommand = site.serveCommand ?? DEFAULT_SERVE_COMMAND;
262328
262350
  const command = [serveCommand, ...forwarded].join(" ");
262329
- const runner = createServeCommandRunner({
262330
- serveCommand: command,
262331
- projectRoot: project.root,
262332
- appId: app.id
262333
- });
262334
- stopRunnerOnProcessSignals(runner);
262335
- runner.onExit((code) => process.exit(code ?? 1));
262336
- runner.start();
262351
+ const fallback = [DEFAULT_SERVE_COMMAND, ...forwarded].join(" ");
262352
+ const serve = (line) => {
262353
+ const runner = createServeCommandRunner({
262354
+ serveCommand: line,
262355
+ projectRoot: project.root,
262356
+ appId: app.id
262357
+ });
262358
+ stopRunnerOnProcessSignals(runner);
262359
+ runner.onExit((code) => {
262360
+ if (line !== fallback && isCommandNotFoundExit(code)) {
262361
+ warnSiteCommandFallback(line, fallback);
262362
+ serve(fallback);
262363
+ return;
262364
+ }
262365
+ process.exit(code ?? 1);
262366
+ });
262367
+ runner.start();
262368
+ };
262369
+ serve(command);
262337
262370
  return { outroMessage: `Frontend dev server running '${command}'` };
262338
262371
  }
262339
262372
  function getSiteDevCommand() {
@@ -262346,12 +262379,16 @@ async function installAction({
262346
262379
  }) {
262347
262380
  const project = await readProjectSettingsOrDefaults();
262348
262381
  const { installCommand } = siteOrDefault(project);
262349
- await runTask("Installing site dependencies...", () => execa({ cwd: project.root, shell: true })`${installCommand}`, {
262382
+ let ran = installCommand;
262383
+ await runTask("Installing site dependencies...", () => runSiteCommandOrDefault(installCommand, DEFAULT_SITE.installCommand, (command) => {
262384
+ ran = command;
262385
+ return execa({ cwd: project.root, shell: true })`${command}`;
262386
+ }), {
262350
262387
  successMessage: "Dependencies installed",
262351
262388
  errorMessage: "Install failed"
262352
262389
  });
262353
262390
  return {
262354
- outroMessage: `Installed with ${theme.styles.bold(installCommand)}`
262391
+ outroMessage: `Installed with ${theme.styles.bold(ran)}`
262355
262392
  };
262356
262393
  }
262357
262394
  function getSiteInstallCommand() {
@@ -271283,4 +271320,4 @@ export {
271283
271320
  runCLI
271284
271321
  };
271285
271322
 
271286
- //# debugId=F35542A3D74C85C064756E2164756E21
271323
+ //# debugId=61E073E485FD166064756E2164756E21