@base44-preview/cli 0.1.25-pr.650.091b64d → 0.1.25-pr.651.5cb9fda

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
@@ -239361,7 +239361,6 @@ var package_default = {
239361
239361
  node: ">=20.19.0"
239362
239362
  },
239363
239363
  dependencies: {
239364
- "@base44/functions-compiler": "0.1.4",
239365
239364
  "@deno/loader": "https://npm.jsr.io/~/11/@jsr/deno__loader/0.5.0.tgz",
239366
239365
  esbuild: "0.28.0",
239367
239366
  miniflare: "4.20260722.0"
@@ -240132,12 +240131,10 @@ async function uploadPresignedAsset(upload, assets) {
240132
240131
  await putPresigned(upload, file.absolutePath);
240133
240132
  }
240134
240133
  async function putPresigned(upload, absolutePath) {
240135
- await putPresignedBody(upload, new Uint8Array(await readFile2(absolutePath)));
240136
- }
240137
- async function putPresignedBody(upload, body) {
240134
+ const content = await readFile2(absolutePath);
240138
240135
  try {
240139
240136
  await distribution_default.put(upload.url, {
240140
- body,
240137
+ body: new Uint8Array(content),
240141
240138
  headers: {
240142
240139
  "Content-Type": upload.contentType,
240143
240140
  ...upload.checksumSha256 ? { "x-amz-checksum-sha256": upload.checksumSha256 } : {}
@@ -246852,8 +246849,7 @@ async function resolveBuildTarget(projectRoot, overrides = {}) {
246852
246849
  buildCommand: project ? project.site?.buildCommand : DEFAULT_BUILD_COMMAND,
246853
246850
  outputDir: outputDirectory(project, root, overrides.outputDir),
246854
246851
  entitiesDir: project?.entitiesDir ?? "entities",
246855
- agentsDir: project?.agentsDir ?? "agents",
246856
- functionsDir: project?.functionsDir ?? "functions"
246852
+ agentsDir: project?.agentsDir ?? "agents"
246857
246853
  };
246858
246854
  }
246859
246855
  function outputDirectory(project, root, override) {
@@ -250691,15 +250687,6 @@ function declaredFile({ path, size, digest }) {
250691
250687
  function declaredModule(module) {
250692
250688
  return { ...declaredFile(module), type: module.type };
250693
250689
  }
250694
- function declaredBundle(bundle) {
250695
- return {
250696
- module: { size: bundle.size, digest: bundle.digest },
250697
- functions: bundle.functions,
250698
- runtime_secrets: bundle.runtimeSecrets,
250699
- post_response_telemetry: bundle.postResponseTelemetry,
250700
- static_egress_artifact: bundle.staticEgressArtifact
250701
- };
250702
- }
250703
250690
  function declaredServingConfig(config) {
250704
250691
  const stated = {
250705
250692
  html_handling: config?.htmlHandling ?? null,
@@ -250753,7 +250740,6 @@ async function createVersion(artifacts, options = {}) {
250753
250740
  serving_config: declaredServingConfig(artifacts.siteWorker.servingConfig)
250754
250741
  }
250755
250742
  } : {},
250756
- backend_bundles: artifacts.backendBundles.map(declaredBundle),
250757
250743
  entities: artifacts.entities,
250758
250744
  agents: artifacts.agents,
250759
250745
  source_commit: options.sourceCommit
@@ -250762,22 +250748,17 @@ async function createVersion(artifacts, options = {}) {
250762
250748
  ...artifacts.assets,
250763
250749
  ...artifacts.siteWorker?.modules ?? []
250764
250750
  ];
250765
- const slotCount = declaredFiles.length + artifacts.backendBundles.length;
250766
- options.progress?.onDeclared?.({ fileCount: slotCount });
250767
- if (declared.uploads.length !== slotCount) {
250768
- throw new InternalError(`Declared ${slotCount} files but the server signed ${declared.uploads.length} upload URLs.`);
250751
+ options.progress?.onDeclared?.({ fileCount: declaredFiles.length });
250752
+ if (declared.uploads.length !== declaredFiles.length) {
250753
+ throw new InternalError(`Declared ${declaredFiles.length} files but the server signed ${declared.uploads.length} upload URLs.`);
250769
250754
  }
250770
- const drifted = declaredFiles.findIndex((file, index) => declared.uploads[index].path !== file.path);
250755
+ const drifted = declared.uploads.findIndex((upload, index) => upload.path !== declaredFiles[index].path);
250771
250756
  if (drifted !== -1) {
250772
250757
  throw new InternalError(`Upload ${drifted} is signed for ${declared.uploads[drifted].path}, but that slot declared ${declaredFiles[drifted].path}.`);
250773
250758
  }
250774
250759
  let uploadedFiles = 0;
250775
250760
  await pMap(declared.uploads, async (upload, index) => {
250776
- if (index < declaredFiles.length) {
250777
- await putPresigned(upload, declaredFiles[index].absolutePath);
250778
- } else {
250779
- await putPresignedBody(upload, artifacts.backendBundles[index - declaredFiles.length].module);
250780
- }
250761
+ await putPresigned(upload, declaredFiles[index].absolutePath);
250781
250762
  uploadedFiles++;
250782
250763
  options.progress?.onUpload?.({
250783
250764
  uploadedFiles,
@@ -250793,109 +250774,13 @@ async function setEnvironmentVersion(environment, versionId, options = {}) {
250793
250774
  }, "setting the environment's version", options.idempotencyKey ? KEYED_RETRY : undefined)).json(), "environment");
250794
250775
  }
250795
250776
  // src/core/version/artifacts.ts
250796
- import { createHash as createHash3 } from "node:crypto";
250797
- import { join as join29, resolve as resolve13 } from "node:path";
250798
-
250799
- // src/core/version/functions.ts
250800
250777
  import { createHash as createHash2 } from "node:crypto";
250801
- import { relative as relative6 } from "node:path";
250802
- var SHARD_POLICY = {
250803
- shardSize: 100,
250804
- globalShardSize: 100,
250805
- maxShards: 1,
250806
- gzipCapBytes: 9500000
250807
- };
250808
- var COMPILE_MODES = { runtimeSecrets: false, postResponseTelemetry: false };
250809
- async function loadCompiler() {
250810
- try {
250811
- return await import("@base44/functions-compiler");
250812
- } catch (error) {
250813
- throw new DependencyNotFoundError("Backend functions cannot be compiled by this installation of the CLI.", {
250814
- hints: [{ message: "Install the CLI from npm: npm install -g base44" }],
250815
- cause: error instanceof Error ? error : undefined
250816
- });
250817
- }
250818
- }
250819
- function projectPath(root, absolutePath) {
250820
- return relative6(root, absolutePath).split(/[/\\]/).join("/");
250821
- }
250822
- async function compilerInput(compiler, root, fn) {
250823
- const backendFiles = {};
250824
- for (const filePath of fn.filePaths) {
250825
- backendFiles[projectPath(root, filePath)] = await readTextFile(filePath);
250826
- }
250827
- const { entry, files } = await compiler.cfwBundleInput(projectPath(root, fn.entryPath), await readTextFile(fn.entryPath), backendFiles);
250828
- return { name: fn.name, entry, files };
250829
- }
250830
- function describeFailure(failure) {
250831
- const where = failure.function ? `${failure.function}: ` : "";
250832
- const errors = (failure.errors ?? []).map((e) => e.file ? `${e.file}:${e.line ?? 0} ${e.message}` : e.message);
250833
- return [`${where}${failure.message}`, ...errors].join(`
250834
- `);
250835
- }
250836
- function sha256(bytes) {
250837
- return `sha256:${createHash2("sha256").update(bytes).digest("hex")}`;
250838
- }
250839
- async function compileBackendBundles(root, functionsDir) {
250840
- const functions = await readAllFunctions(functionsDir);
250841
- if (functions.length === 0) {
250842
- return [];
250843
- }
250844
- const compiler = await loadCompiler();
250845
- const sorted = [...functions].sort((a, b) => a.name < b.name ? -1 : 1);
250846
- const inputs = await pMap(sorted, (fn) => compilerInput(compiler, root, fn), {
250847
- concurrency: 8
250848
- });
250849
- const entries = new Map(inputs.map((input) => [input.name, input.entry]));
250850
- const built = await compiler.compileFunctionShards(inputs, SHARD_POLICY, COMPILE_MODES);
250851
- if (!built.ok) {
250852
- throw new InvalidInputError(`Backend functions failed to compile (${built.failures.length} error${built.failures.length === 1 ? "" : "s"}).`, { details: built.failures.map(describeFailure) });
250853
- }
250854
- return built.shards.map((shard) => {
250855
- const module = new TextEncoder().encode(shard.module);
250856
- return {
250857
- module,
250858
- size: module.byteLength,
250859
- digest: sha256(module),
250860
- functions: shard.functions.map((name) => ({
250861
- name,
250862
- entry: entries.get(name)
250863
- })),
250864
- ...COMPILE_MODES,
250865
- staticEgressArtifact: compiler.STATIC_EGRESS_ARTIFACT_MARKER
250866
- };
250867
- });
250868
- }
250869
-
250870
- // src/core/version/publish.ts
250871
- import { randomUUID as randomUUID4 } from "node:crypto";
250872
- var DEFAULT_ENVIRONMENT = "production";
250873
- async function tagStep2(step, run) {
250874
- return await tagStep(step, run);
250875
- }
250876
- async function publishVersion(artifacts, options = {}) {
250877
- const version = await tagStep2("create_version", () => createVersion(artifacts, {
250878
- sourceCommit: options.sourceCommit,
250879
- concurrency: options.concurrency,
250880
- progress: options.progress
250881
- }));
250882
- const environment = await tagStep2("deploy", () => setEnvironmentVersion(options.target ?? DEFAULT_ENVIRONMENT, version.versionId, {
250883
- idempotencyKey: randomUUID4()
250884
- }));
250885
- return {
250886
- environment: environment.name,
250887
- versionId: environment.versionId,
250888
- manifestHash: environment.manifestHash,
250889
- deploymentId: environment.deploymentId
250890
- };
250891
- }
250892
-
250893
- // src/core/version/artifacts.ts
250778
+ import { join as join29, resolve as resolve13 } from "node:path";
250894
250779
  var MAX_FILE_COUNT = 50000;
250895
250780
  var HASH_CONCURRENCY = 32;
250896
250781
  var ENTRY2 = "index.html";
250897
250782
  async function digestFile(absolutePath) {
250898
- const hash = await hashFileInto(createHash3("sha256"), absolutePath);
250783
+ const hash = await hashFileInto(createHash2("sha256"), absolutePath);
250899
250784
  return `sha256:${hash.digest("hex")}`;
250900
250785
  }
250901
250786
  async function collectBuildOutput(outputDir, options = {}) {
@@ -250969,7 +250854,6 @@ async function collectArtifacts(target) {
250969
250854
  entryFile: ENTRY2
250970
250855
  }),
250971
250856
  ...siteWorker ? { siteWorker } : {},
250972
- backendBundles: await tagStep2("build", () => compileBackendBundles(target.root, join29(target.configDir, target.functionsDir))),
250973
250857
  ...await collectResources(target.configDir, target)
250974
250858
  };
250975
250859
  }
@@ -250979,6 +250863,28 @@ function versionsApiEnabled(env = process.env) {
250979
250863
  const value = env[VERSIONS_API_ENV];
250980
250864
  return value === "1" || value === "true";
250981
250865
  }
250866
+ // src/core/version/publish.ts
250867
+ import { randomUUID as randomUUID4 } from "node:crypto";
250868
+ var DEFAULT_ENVIRONMENT = "production";
250869
+ async function tagStep2(step, run) {
250870
+ return await tagStep(step, run);
250871
+ }
250872
+ async function publishVersion(artifacts, options = {}) {
250873
+ const version = await tagStep2("create_version", () => createVersion(artifacts, {
250874
+ sourceCommit: options.sourceCommit,
250875
+ concurrency: options.concurrency,
250876
+ progress: options.progress
250877
+ }));
250878
+ const environment = await tagStep2("deploy", () => setEnvironmentVersion(options.target ?? DEFAULT_ENVIRONMENT, version.versionId, {
250879
+ idempotencyKey: randomUUID4()
250880
+ }));
250881
+ return {
250882
+ environment: environment.name,
250883
+ versionId: environment.versionId,
250884
+ manifestHash: environment.manifestHash,
250885
+ deploymentId: environment.deploymentId
250886
+ };
250887
+ }
250982
250888
  // src/cli/commands/versions/options.ts
250983
250889
  function outputDirOption() {
250984
250890
  return new Option2("--output-dir <dir>", "Build output directory (defaults to the project's, else dist)");
@@ -254218,11 +254124,11 @@ async function createEntityRoutes(db, logger, broadcast) {
254218
254124
  // src/cli/dev/dev-server/routes/integrations.ts
254219
254125
  var import_express5 = __toESM(require_express(), 1);
254220
254126
  var import_multer = __toESM(require_multer(), 1);
254221
- import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
254127
+ import { createHash as createHash3, randomUUID as randomUUID6 } from "node:crypto";
254222
254128
  import fs28 from "node:fs";
254223
254129
  import path18 from "node:path";
254224
254130
  function createFileToken(fileUri) {
254225
- return createHash4("sha256").update(fileUri).digest("hex");
254131
+ return createHash3("sha256").update(fileUri).digest("hex");
254226
254132
  }
254227
254133
  function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
254228
254134
  const router = import_express5.Router({ mergeParams: true });
@@ -254307,7 +254213,7 @@ function createCustomIntegrationRoutes(remoteProxy, logger) {
254307
254213
 
254308
254214
  // src/cli/dev/dev-server/watcher.ts
254309
254215
  import { EventEmitter as EventEmitter4 } from "node:events";
254310
- import { relative as relative10 } from "node:path";
254216
+ import { relative as relative9 } from "node:path";
254311
254217
 
254312
254218
  // ../../node_modules/chokidar/index.js
254313
254219
  import { EventEmitter as EventEmitter3 } from "node:events";
@@ -255992,7 +255898,7 @@ class WatchBase44 extends EventEmitter4 {
255992
255898
  ignoreInitial: true
255993
255899
  });
255994
255900
  watcher.on("all", import_debounce.default(async (_event, path) => {
255995
- this.emit("change", name, relative10(targetPath, path));
255901
+ this.emit("change", name, relative9(targetPath, path));
255996
255902
  }, WATCH_DEBOUNCE_MS));
255997
255903
  watcher.on("error", (err) => {
255998
255904
  this.logger.error(`Watch handler failed for ${targetPath}`, err);
@@ -260673,4 +260579,4 @@ export {
260673
260579
  runCLI
260674
260580
  };
260675
260581
 
260676
- //# debugId=7490370A6571054464756E2164756E21
260582
+ //# debugId=EF40B3382548218A64756E2164756E21