@base44-preview/cli 0.1.23-pr.645.b52be01 → 0.1.23-pr.645.f7a2f42

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.
@@ -42,9 +42,8 @@ if (!appBaseUrl) {
42
42
  Deno.exit(1);
43
43
  }
44
44
 
45
- // Exact version: an unversioned specifier makes Deno resolve "latest" from npm on
46
- // every fresh cache, so a pre-cached SDK is never used.
47
- import { createClient } from "npm:@base44/sdk@0.8.48";
45
+ // runScript pins this to BASE44_EXEC_SDK_VERSION when set; otherwise Deno resolves latest.
46
+ import { createClient } from "npm:@base44/sdk";
48
47
 
49
48
  const customHeaders: Record<string, string> = {};
50
49
  if (isPrivileged) customHeaders["X-Bypass-RLS"] = "true";
package/dist/cli/index.js CHANGED
@@ -228810,7 +228810,7 @@ function normalizeBase44Env() {
228810
228810
  loadProjectEnvFiles();
228811
228811
 
228812
228812
  // src/cli/index.ts
228813
- import { dirname as dirname29, join as join39 } from "node:path";
228813
+ import { dirname as dirname29, join as join40 } from "node:path";
228814
228814
  import { fileURLToPath as fileURLToPath6 } from "node:url";
228815
228815
 
228816
228816
  // ../../node_modules/@clack/core/dist/index.mjs
@@ -256177,6 +256177,15 @@ var DATA_ENV_ENV_VAR = "BASE44_DATA_ENV";
256177
256177
  function read3(env, name) {
256178
256178
  return env[name]?.trim() || undefined;
256179
256179
  }
256180
+ var SDK_VERSION_VAR = "BASE44_EXEC_SDK_VERSION";
256181
+ var SDK_VERSION_RE = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
256182
+ function readExecSdkVersion(env = process.env) {
256183
+ const version = read3(env, SDK_VERSION_VAR);
256184
+ if (version && !SDK_VERSION_RE.test(version)) {
256185
+ throw new InvalidInputError(`${SDK_VERSION_VAR} must be an exact version such as 0.8.52.`);
256186
+ }
256187
+ return version;
256188
+ }
256180
256189
  function hasExecEnvTarget(env = process.env) {
256181
256190
  return EXEC_ENV_VARS.some((name) => read3(env, name) !== undefined);
256182
256191
  }
@@ -256204,7 +256213,16 @@ function readExecEnvTarget(env = process.env) {
256204
256213
  }
256205
256214
  // src/core/exec/run-script.ts
256206
256215
  import { spawn as spawn4 } from "node:child_process";
256207
- import { copyFileSync, writeFileSync as writeFileSync3 } from "node:fs";
256216
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "node:fs";
256217
+ import { join as join39 } from "node:path";
256218
+ var SDK_SPECIFIER = '"npm:@base44/sdk"';
256219
+ function wrapperSource(sdkVersion) {
256220
+ const source = readFileSync3(getExecWrapperPath(), "utf-8");
256221
+ return sdkVersion ? source.replace(SDK_SPECIFIER, `"npm:@base44/sdk@${sdkVersion}"`) : source;
256222
+ }
256223
+ var DENO_CONFIG = {
256224
+ minimumDependencyAge: { exclude: ["npm:@base44/sdk"] }
256225
+ };
256208
256226
  var SERVICE_TOKEN_ENV = "BASE44_SERVICE_TOKEN";
256209
256227
  function inheritedEnv() {
256210
256228
  const env = { ...process.env };
@@ -256219,7 +256237,7 @@ function inheritedEnv() {
256219
256237
  return env;
256220
256238
  }
256221
256239
  async function runScript(options) {
256222
- const { appId, code, local, privileged, dataEnv, serviceToken } = options;
256240
+ const { appId, code, local, privileged, dataEnv, serviceToken, sdkVersion } = options;
256223
256241
  verifyDenoInstalled("to run scripts with exec");
256224
256242
  const cleanupFns = [];
256225
256243
  const tempScript = await $file({ postfix: ".ts" });
@@ -256229,10 +256247,21 @@ async function runScript(options) {
256229
256247
  const [appUserToken, appBaseUrl] = local ? [local.token, local.serverUrl] : await Promise.all([getAppUserToken(), getSiteUrl()]);
256230
256248
  const tempWrapper = await $file({ postfix: ".ts" });
256231
256249
  cleanupFns.push(tempWrapper.cleanup);
256232
- copyFileSync(getExecWrapperPath(), tempWrapper.path);
256250
+ writeFileSync3(tempWrapper.path, wrapperSource(sdkVersion), "utf-8");
256251
+ const configDir = await $dir({ unsafeCleanup: true });
256252
+ cleanupFns.push(configDir.cleanup);
256253
+ const configPath = join39(configDir.path, "deno.json");
256254
+ writeFileSync3(configPath, JSON.stringify(DENO_CONFIG), "utf-8");
256233
256255
  try {
256234
256256
  const exitCode = await new Promise((resolvePromise) => {
256235
- const child = spawn4("deno", ["run", "--allow-all", "--node-modules-dir=none", tempWrapper.path], {
256257
+ const child = spawn4("deno", [
256258
+ "run",
256259
+ "--allow-all",
256260
+ "--node-modules-dir=none",
256261
+ "--config",
256262
+ configPath,
256263
+ tempWrapper.path
256264
+ ], {
256236
256265
  env: {
256237
256266
  ...inheritedEnv(),
256238
256267
  ...serviceToken ? { [SERVICE_TOKEN_ENV]: serviceToken } : {},
@@ -256291,6 +256320,7 @@ async function execAction({ app, isNonInteractive }, options) {
256291
256320
  });
256292
256321
  }
256293
256322
  const envTarget = readExecEnvTarget();
256323
+ const sdkVersion = readExecSdkVersion();
256294
256324
  if (envTarget && options.local) {
256295
256325
  throw new InvalidInputError("--local cannot be used when BASE44_EXEC_ACCESS_TOKEN and BASE44_EXEC_SERVER_URL are set.");
256296
256326
  }
@@ -256316,7 +256346,8 @@ async function execAction({ app, isNonInteractive }, options) {
256316
256346
  local,
256317
256347
  privileged: options.privileged,
256318
256348
  dataEnv: options.dataEnv,
256319
- serviceToken: envTarget?.serviceToken
256349
+ serviceToken: envTarget?.serviceToken,
256350
+ sdkVersion
256320
256351
  });
256321
256352
  if (exitCode !== 0) {
256322
256353
  process.exitCode = exitCode;
@@ -260509,7 +260540,7 @@ function addCommandInfoToErrorReporter(program, errorReporter) {
260509
260540
  // src/cli/index.ts
260510
260541
  var __dirname4 = dirname29(fileURLToPath6(import.meta.url));
260511
260542
  async function runCLI(options) {
260512
- ensureNpmAssets(join39(__dirname4, "../assets"));
260543
+ ensureNpmAssets(join40(__dirname4, "../assets"));
260513
260544
  const errorReporter = new ErrorReporter;
260514
260545
  errorReporter.registerProcessErrorHandlers();
260515
260546
  const jsonMode = process.argv.includes("--json");
@@ -260548,4 +260579,4 @@ export {
260548
260579
  runCLI
260549
260580
  };
260550
260581
 
260551
- //# debugId=F91265C83F23C30764756E2164756E21
260582
+ //# debugId=8A5040C39B05EA0064756E2164756E21