@base44-preview/cli 0.0.37-pr.357.020ced4 → 0.0.37-pr.357.87da1eb

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
@@ -244354,7 +244354,7 @@ function getDevCommand(context) {
244354
244354
 
244355
244355
  // src/cli/commands/exec.ts
244356
244356
  import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
244357
- import { unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
244357
+ import { copyFileSync, unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
244358
244358
  import { tmpdir as tmpdir2 } from "node:os";
244359
244359
  import { dirname as dirname12, join as join16, resolve as resolve6 } from "node:path";
244360
244360
  import { fileURLToPath as fileURLToPath8 } from "node:url";
@@ -244384,14 +244384,15 @@ function readStdin() {
244384
244384
  });
244385
244385
  }
244386
244386
  async function execAction(scriptArg, options8, extraArgs) {
244387
- verifyDenoIsInstalled();
244388
244387
  let scriptPath;
244389
244388
  let tempFile = null;
244390
- const isStdinPipe = !process.stdin.isTTY;
244391
244389
  const hasFile = scriptArg !== undefined;
244392
244390
  const hasEval = options8.eval !== undefined;
244393
- const modeCount = [hasFile, hasEval, isStdinPipe].filter(Boolean).length;
244394
- if (modeCount === 0) {
244391
+ const isStdinPipe = !hasFile && !hasEval && !process.stdin.isTTY;
244392
+ if (hasFile && hasEval) {
244393
+ throw new InvalidInputError("Cannot use both a file path and -e flag. Provide only one input mode.");
244394
+ }
244395
+ if (!hasFile && !hasEval && !isStdinPipe) {
244395
244396
  throw new InvalidInputError("No script provided. Pass a file path, use -e for inline code, or pipe from stdin.", {
244396
244397
  hints: [
244397
244398
  { message: "File: base44 exec ./script.ts" },
@@ -244400,9 +244401,7 @@ async function execAction(scriptArg, options8, extraArgs) {
244400
244401
  ]
244401
244402
  });
244402
244403
  }
244403
- if (modeCount > 1) {
244404
- throw new InvalidInputError("Multiple input modes detected. Provide only one of: file path, -e flag, or stdin.");
244405
- }
244404
+ verifyDenoIsInstalled();
244406
244405
  if (hasFile) {
244407
244406
  scriptPath = `file://${resolve6(scriptArg)}`;
244408
244407
  } else {
@@ -244419,9 +244418,17 @@ async function execAction(scriptArg, options8, extraArgs) {
244419
244418
  } catch (error48) {
244420
244419
  throw await ApiError.fromHttpError(error48, "exchanging platform token for app user token");
244421
244420
  }
244421
+ const tempWrapper = join16(tmpdir2(), `base44-exec-wrapper-${Date.now()}.js`);
244422
+ copyFileSync(EXEC_WRAPPER_PATH, tempWrapper);
244422
244423
  try {
244423
244424
  const exitCode = await new Promise((resolvePromise) => {
244424
- const child = spawn3("deno", ["run", "--allow-all", EXEC_WRAPPER_PATH, ...extraArgs], {
244425
+ const child = spawn3("deno", [
244426
+ "run",
244427
+ "--allow-all",
244428
+ "--node-modules-dir=auto",
244429
+ tempWrapper,
244430
+ ...extraArgs
244431
+ ], {
244425
244432
  env: {
244426
244433
  ...process.env,
244427
244434
  SCRIPT_PATH: scriptPath,
@@ -244439,10 +244446,12 @@ async function execAction(scriptArg, options8, extraArgs) {
244439
244446
  process.exitCode = exitCode;
244440
244447
  }
244441
244448
  } finally {
244442
- if (tempFile) {
244443
- try {
244444
- unlinkSync(tempFile);
244445
- } catch {}
244449
+ for (const f7 of [tempFile, tempWrapper]) {
244450
+ if (f7) {
244451
+ try {
244452
+ unlinkSync(f7);
244453
+ } catch {}
244454
+ }
244446
244455
  }
244447
244456
  }
244448
244457
  return {};
@@ -248810,4 +248819,4 @@ export {
248810
248819
  CLIExitError
248811
248820
  };
248812
248821
 
248813
- //# debugId=2C074684B8F8F66564756E2164756E21
248822
+ //# debugId=D0BCB3536472873564756E2164756E21