@base44-preview/cli 0.1.15-pr.626.db74099 → 0.1.15-pr.627.092ff93

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
@@ -31177,7 +31177,7 @@ function cleanDoc(doc) {
31177
31177
  return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
31178
31178
  }
31179
31179
  function replaceEndOfLine(doc, replacement = literalline) {
31180
- return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join30(replacement, currentDoc.split(`
31180
+ return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join28(replacement, currentDoc.split(`
31181
31181
  `)) : currentDoc);
31182
31182
  }
31183
31183
  function canBreakFn(doc) {
@@ -31257,7 +31257,7 @@ function indentIfBreak(contents, options) {
31257
31257
  negate: options.negate
31258
31258
  };
31259
31259
  }
31260
- function join30(separator, docs) {
31260
+ function join28(separator, docs) {
31261
31261
  assertDoc(separator);
31262
31262
  assertDocArray(docs);
31263
31263
  const parts = [];
@@ -31968,7 +31968,7 @@ var init_doc = __esm(() => {
31968
31968
  MODE_FLAT = Symbol("MODE_FLAT");
31969
31969
  DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
31970
31970
  builders = {
31971
- join: join30,
31971
+ join: join28,
31972
31972
  line,
31973
31973
  softline,
31974
31974
  hardline,
@@ -228783,7 +228783,7 @@ function normalizeBase44Env() {
228783
228783
  loadProjectEnvFiles();
228784
228784
 
228785
228785
  // src/cli/index.ts
228786
- import { dirname as dirname29, join as join39 } from "node:path";
228786
+ import { dirname as dirname28, join as join37 } from "node:path";
228787
228787
  import { fileURLToPath as fileURLToPath6 } from "node:url";
228788
228788
 
228789
228789
  // ../../node_modules/@clack/core/dist/index.mjs
@@ -239590,8 +239590,91 @@ async function createArchive(pathToArchive, targetArchivePath) {
239590
239590
  import { readFile as readFile3 } from "node:fs/promises";
239591
239591
  import { join as join18 } from "node:path";
239592
239592
 
239593
- // src/core/site/modules.ts
239593
+ // src/core/site/manifest.ts
239594
+ import { createHash } from "node:crypto";
239595
+ import { createReadStream } from "node:fs";
239594
239596
  import { stat } from "node:fs/promises";
239597
+ import { basename as basename5, extname, join as join16 } from "node:path";
239598
+ var MAX_ASSET_COUNT = 1e5;
239599
+ var ASSETS_IGNORE_FILE = ".assetsignore";
239600
+ var ALWAYS_IGNORED = new Set([
239601
+ ASSETS_IGNORE_FILE,
239602
+ "wrangler.json",
239603
+ ".dev.vars"
239604
+ ]);
239605
+ var MIME_TYPES = {
239606
+ ".html": "text/html",
239607
+ ".htm": "text/html",
239608
+ ".css": "text/css",
239609
+ ".js": "text/javascript",
239610
+ ".mjs": "text/javascript",
239611
+ ".json": "application/json",
239612
+ ".map": "application/json",
239613
+ ".txt": "text/plain",
239614
+ ".xml": "application/xml",
239615
+ ".svg": "image/svg+xml",
239616
+ ".png": "image/png",
239617
+ ".jpg": "image/jpeg",
239618
+ ".jpeg": "image/jpeg",
239619
+ ".gif": "image/gif",
239620
+ ".webp": "image/webp",
239621
+ ".avif": "image/avif",
239622
+ ".ico": "image/x-icon",
239623
+ ".woff": "font/woff",
239624
+ ".woff2": "font/woff2",
239625
+ ".ttf": "font/ttf",
239626
+ ".otf": "font/otf",
239627
+ ".eot": "application/vnd.ms-fontobject",
239628
+ ".mp3": "audio/mpeg",
239629
+ ".mp4": "video/mp4",
239630
+ ".webm": "video/webm",
239631
+ ".pdf": "application/pdf",
239632
+ ".wasm": "application/wasm",
239633
+ ".webmanifest": "application/manifest+json"
239634
+ };
239635
+ function getAssetContentType(filePath) {
239636
+ return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
239637
+ }
239638
+ async function hashAssetFile(appId, absolutePath) {
239639
+ const hash = createHash("sha256").update(Buffer.from(appId, "utf8"));
239640
+ for await (const chunk of createReadStream(absolutePath)) {
239641
+ hash.update(chunk);
239642
+ }
239643
+ return hash.digest("hex").slice(0, 32);
239644
+ }
239645
+ async function buildAssetManifest(assetsDir, appId) {
239646
+ const manifest = {};
239647
+ const filesByHash = new Map;
239648
+ const found = await globby("**/*", {
239649
+ cwd: assetsDir,
239650
+ dot: true,
239651
+ onlyFiles: true,
239652
+ followSymbolicLinks: false,
239653
+ ignoreFiles: [ASSETS_IGNORE_FILE]
239654
+ });
239655
+ const relativeFilePaths = found.filter((path) => !ALWAYS_IGNORED.has(basename5(path)));
239656
+ if (relativeFilePaths.length > MAX_ASSET_COUNT) {
239657
+ throw new InvalidInputError(`Too many static assets: found ${relativeFilePaths.length}, the limit is ${MAX_ASSET_COUNT} files.`);
239658
+ }
239659
+ for (const relativePath of relativeFilePaths.sort()) {
239660
+ const absolutePath = join16(assetsDir, ...relativePath.split("/"));
239661
+ const { size } = await stat(absolutePath);
239662
+ const hash = await hashAssetFile(appId, absolutePath);
239663
+ manifest[`/${relativePath}`] = { hash, size };
239664
+ if (!filesByHash.has(hash)) {
239665
+ filesByHash.set(hash, {
239666
+ absolutePath,
239667
+ hash,
239668
+ size,
239669
+ contentType: getAssetContentType(absolutePath)
239670
+ });
239671
+ }
239672
+ }
239673
+ return { manifest, filesByHash };
239674
+ }
239675
+
239676
+ // src/core/site/modules.ts
239677
+ import { stat as stat2 } from "node:fs/promises";
239595
239678
  import { relative as relative5, resolve as resolve3, sep } from "node:path";
239596
239679
  var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
239597
239680
  var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
@@ -239666,7 +239749,7 @@ async function collectModules(config) {
239666
239749
  const modules = [...modulesByName.values()];
239667
239750
  let totalBytes = 0;
239668
239751
  for (const module of modules) {
239669
- module.size = (await stat(module.absolutePath)).size;
239752
+ module.size = (await stat2(module.absolutePath)).size;
239670
239753
  totalBytes += module.size;
239671
239754
  }
239672
239755
  if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
@@ -239685,104 +239768,8 @@ function addSourcemap(modulesByName, configDir, name) {
239685
239768
  });
239686
239769
  }
239687
239770
 
239688
- // src/core/site/wrangler-config.ts
239689
- import { dirname as dirname12, join as join16, resolve as resolve4 } from "node:path";
239690
- var WRANGLER_REDIRECT_PATH = join16(".wrangler", "deploy", "config.json");
239691
- var RedirectConfigSchema = looseObject({
239692
- configPath: string2().min(1)
239693
- });
239694
- var WranglerConfigSchema = looseObject({
239695
- main: string2().min(1, "wrangler config is missing a 'main' entry module"),
239696
- no_bundle: boolean2().optional(),
239697
- rules: array(looseObject({ type: string2(), globs: array(string2()) })).optional(),
239698
- assets: looseObject({
239699
- directory: string2().optional(),
239700
- html_handling: string2().optional(),
239701
- not_found_handling: string2().optional(),
239702
- run_worker_first: union([boolean2(), array(string2())]).optional(),
239703
- headers: string2().optional(),
239704
- redirects: string2().optional()
239705
- }).optional(),
239706
- compatibility_date: string2().optional(),
239707
- compatibility_flags: array(string2()).optional(),
239708
- vars: record(string2(), unknown()).optional(),
239709
- upload_source_maps: boolean2().optional()
239710
- });
239711
- async function detectFullStackArtifact(projectRoot) {
239712
- const redirectPath = join16(projectRoot, WRANGLER_REDIRECT_PATH);
239713
- return await pathExists(redirectPath) ? redirectPath : null;
239714
- }
239715
- async function resolveWranglerConfig(redirectPath) {
239716
- const configPath = await resolveRedirectedConfigPath(redirectPath);
239717
- const parsed = await readJsonFile(configPath);
239718
- const result = WranglerConfigSchema.safeParse(parsed);
239719
- if (!result.success) {
239720
- throw new ConfigInvalidError(`Invalid wrangler config: ${prettifyError(result.error)}`, configPath);
239721
- }
239722
- const config = result.data;
239723
- if (config.no_bundle !== true) {
239724
- throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
239725
- }
239726
- const configDir = dirname12(configPath);
239727
- const assetsDirectory = config.assets?.directory ? resolve4(configDir, config.assets.directory) : null;
239728
- return {
239729
- configPath,
239730
- configDir,
239731
- main: config.main,
239732
- assetsDirectory,
239733
- assetsConfig: config.assets ? toResolvedAssetsConfig(config.assets) : null,
239734
- compatibilityDate: config.compatibility_date ?? null,
239735
- compatibilityFlags: config.compatibility_flags ?? [],
239736
- rules: (config.rules ?? []).map((rule) => ({
239737
- type: rule.type,
239738
- globs: rule.globs
239739
- })),
239740
- uploadSourceMaps: config.upload_source_maps ?? false
239741
- };
239742
- }
239743
- async function resolveRedirectedConfigPath(redirectPath) {
239744
- const parsed = await readJsonFile(redirectPath);
239745
- const result = RedirectConfigSchema.safeParse(parsed);
239746
- if (!result.success) {
239747
- throw new ConfigInvalidError(`Invalid deploy redirect file: ${prettifyError(result.error)}`, redirectPath);
239748
- }
239749
- const configPath = resolve4(dirname12(redirectPath), result.data.configPath);
239750
- if (!await pathExists(configPath)) {
239751
- throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
239752
- hints: [{ message: "Rebuild the project to regenerate the artifact" }]
239753
- });
239754
- }
239755
- return configPath;
239756
- }
239757
- function toResolvedAssetsConfig(assets) {
239758
- return {
239759
- htmlHandling: assets.html_handling,
239760
- notFoundHandling: assets.not_found_handling,
239761
- runWorkerFirst: assets.run_worker_first,
239762
- headers: assets.headers,
239763
- redirects: assets.redirects
239764
- };
239765
- }
239766
-
239767
- // src/core/site/full-stack.ts
239768
- async function resolveFullStackBuild(projectRoot) {
239769
- const redirectPath = await detectFullStackArtifact(projectRoot);
239770
- if (!redirectPath) {
239771
- return null;
239772
- }
239773
- const config = await resolveWranglerConfig(redirectPath);
239774
- return {
239775
- config,
239776
- modules: await collectModules(config),
239777
- assetsDir: config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null
239778
- };
239779
- }
239780
-
239781
- // src/core/site/manifest.ts
239782
- import { createHash } from "node:crypto";
239783
- import { createReadStream } from "node:fs";
239784
- import { stat as stat2 } from "node:fs/promises";
239785
- import { basename as basename5, extname, join as join17 } from "node:path";
239771
+ // src/core/site/upload.ts
239772
+ import { readFile as readFile2 } from "node:fs/promises";
239786
239773
 
239787
239774
  // ../../node_modules/p-map/index.js
239788
239775
  async function pMap(iterable, mapper, {
@@ -239908,99 +239895,7 @@ async function pMap(iterable, mapper, {
239908
239895
  }
239909
239896
  var pMapSkip = Symbol("skip");
239910
239897
 
239911
- // src/core/site/manifest.ts
239912
- var MAX_ASSET_COUNT = 1e5;
239913
- var ASSETS_IGNORE_FILE = ".assetsignore";
239914
- var ALWAYS_IGNORED = new Set([
239915
- ASSETS_IGNORE_FILE,
239916
- "wrangler.json",
239917
- ".dev.vars"
239918
- ]);
239919
- var MIME_TYPES = {
239920
- ".html": "text/html",
239921
- ".htm": "text/html",
239922
- ".css": "text/css",
239923
- ".js": "text/javascript",
239924
- ".mjs": "text/javascript",
239925
- ".json": "application/json",
239926
- ".map": "application/json",
239927
- ".txt": "text/plain",
239928
- ".xml": "application/xml",
239929
- ".svg": "image/svg+xml",
239930
- ".png": "image/png",
239931
- ".jpg": "image/jpeg",
239932
- ".jpeg": "image/jpeg",
239933
- ".gif": "image/gif",
239934
- ".webp": "image/webp",
239935
- ".avif": "image/avif",
239936
- ".ico": "image/x-icon",
239937
- ".woff": "font/woff",
239938
- ".woff2": "font/woff2",
239939
- ".ttf": "font/ttf",
239940
- ".otf": "font/otf",
239941
- ".eot": "application/vnd.ms-fontobject",
239942
- ".mp3": "audio/mpeg",
239943
- ".mp4": "video/mp4",
239944
- ".webm": "video/webm",
239945
- ".pdf": "application/pdf",
239946
- ".wasm": "application/wasm",
239947
- ".webmanifest": "application/manifest+json"
239948
- };
239949
- function getAssetContentType(filePath) {
239950
- return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
239951
- }
239952
- async function walkBuildOutput(outputDir) {
239953
- const found = await globby("**/*", {
239954
- cwd: outputDir,
239955
- dot: true,
239956
- onlyFiles: true,
239957
- followSymbolicLinks: false,
239958
- ignoreFiles: [ASSETS_IGNORE_FILE]
239959
- });
239960
- return found.filter((path) => !ALWAYS_IGNORED.has(basename5(path))).sort();
239961
- }
239962
- var STAT_CONCURRENCY = 32;
239963
- async function describeBuildOutput(outputDir) {
239964
- const relativePaths = await walkBuildOutput(outputDir);
239965
- return await pMap(relativePaths, async (path) => {
239966
- const absolutePath = join17(outputDir, ...path.split("/"));
239967
- return { path, absolutePath, size: (await stat2(absolutePath)).size };
239968
- }, { concurrency: STAT_CONCURRENCY });
239969
- }
239970
- async function hashFileInto(hash, absolutePath) {
239971
- for await (const chunk of createReadStream(absolutePath)) {
239972
- hash.update(chunk);
239973
- }
239974
- return hash;
239975
- }
239976
- async function hashAssetFile(appId, absolutePath) {
239977
- const hash = await hashFileInto(createHash("sha256").update(Buffer.from(appId, "utf8")), absolutePath);
239978
- return hash.digest("hex").slice(0, 32);
239979
- }
239980
- async function buildAssetManifest(assetsDir, appId) {
239981
- const manifest = {};
239982
- const filesByHash = new Map;
239983
- const files = await describeBuildOutput(assetsDir);
239984
- if (files.length > MAX_ASSET_COUNT) {
239985
- throw new InvalidInputError(`Too many static assets: found ${files.length}, the limit is ${MAX_ASSET_COUNT} files.`);
239986
- }
239987
- for (const { path: relativePath, absolutePath, size } of files) {
239988
- const hash = await hashAssetFile(appId, absolutePath);
239989
- manifest[`/${relativePath}`] = { hash, size };
239990
- if (!filesByHash.has(hash)) {
239991
- filesByHash.set(hash, {
239992
- absolutePath,
239993
- hash,
239994
- size,
239995
- contentType: getAssetContentType(absolutePath)
239996
- });
239997
- }
239998
- }
239999
- return { manifest, filesByHash };
240000
- }
240001
-
240002
239898
  // src/core/site/upload.ts
240003
- import { readFile as readFile2 } from "node:fs/promises";
240004
239899
  var DEFAULT_UPLOAD_CONCURRENCY = 3;
240005
239900
  var MAX_UPLOAD_CONCURRENCY = 50;
240006
239901
  var MAX_UPLOAD_ATTEMPTS = 3;
@@ -240099,17 +239994,11 @@ async function uploadPresignedAsset(upload, assets) {
240099
239994
  if (!file) {
240100
239995
  throw new InternalError(`Server requested upload of unknown asset path: ${upload.path}`);
240101
239996
  }
240102
- await putPresigned(upload, file.absolutePath);
240103
- }
240104
- async function putPresigned(upload, absolutePath) {
240105
- const content = await readFile2(absolutePath);
239997
+ const content = await readFile2(file.absolutePath);
240106
239998
  try {
240107
239999
  await distribution_default.put(upload.url, {
240108
240000
  body: new Uint8Array(content),
240109
- headers: {
240110
- "Content-Type": upload.contentType,
240111
- ...upload.checksumSha256 ? { "x-amz-checksum-sha256": upload.checksumSha256 } : {}
240112
- },
240001
+ headers: { "Content-Type": upload.contentType },
240113
240002
  timeout: 120000,
240114
240003
  retry: UPLOAD_RETRY
240115
240004
  });
@@ -240118,6 +240007,85 @@ async function putPresigned(upload, absolutePath) {
240118
240007
  }
240119
240008
  }
240120
240009
 
240010
+ // src/core/site/wrangler-config.ts
240011
+ import { dirname as dirname12, join as join17, resolve as resolve4 } from "node:path";
240012
+ var WRANGLER_REDIRECT_PATH = join17(".wrangler", "deploy", "config.json");
240013
+ var RedirectConfigSchema = looseObject({
240014
+ configPath: string2().min(1)
240015
+ });
240016
+ var WranglerConfigSchema = looseObject({
240017
+ main: string2().min(1, "wrangler config is missing a 'main' entry module"),
240018
+ no_bundle: boolean2().optional(),
240019
+ rules: array(looseObject({ type: string2(), globs: array(string2()) })).optional(),
240020
+ assets: looseObject({
240021
+ directory: string2().optional(),
240022
+ html_handling: string2().optional(),
240023
+ not_found_handling: string2().optional(),
240024
+ run_worker_first: union([boolean2(), array(string2())]).optional(),
240025
+ headers: string2().optional(),
240026
+ redirects: string2().optional()
240027
+ }).optional(),
240028
+ compatibility_date: string2().optional(),
240029
+ compatibility_flags: array(string2()).optional(),
240030
+ vars: record(string2(), unknown()).optional(),
240031
+ upload_source_maps: boolean2().optional()
240032
+ });
240033
+ async function detectFullStackArtifact(projectRoot) {
240034
+ const redirectPath = join17(projectRoot, WRANGLER_REDIRECT_PATH);
240035
+ return await pathExists(redirectPath) ? redirectPath : null;
240036
+ }
240037
+ async function resolveWranglerConfig(redirectPath) {
240038
+ const configPath = await resolveRedirectedConfigPath(redirectPath);
240039
+ const parsed = await readJsonFile(configPath);
240040
+ const result = WranglerConfigSchema.safeParse(parsed);
240041
+ if (!result.success) {
240042
+ throw new ConfigInvalidError(`Invalid wrangler config: ${prettifyError(result.error)}`, configPath);
240043
+ }
240044
+ const config = result.data;
240045
+ if (config.no_bundle !== true) {
240046
+ throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
240047
+ }
240048
+ const configDir = dirname12(configPath);
240049
+ const assetsDirectory = config.assets?.directory ? resolve4(configDir, config.assets.directory) : null;
240050
+ return {
240051
+ configPath,
240052
+ configDir,
240053
+ main: config.main,
240054
+ assetsDirectory,
240055
+ assetsConfig: config.assets ? toResolvedAssetsConfig(config.assets) : null,
240056
+ compatibilityDate: config.compatibility_date ?? null,
240057
+ compatibilityFlags: config.compatibility_flags ?? [],
240058
+ rules: (config.rules ?? []).map((rule) => ({
240059
+ type: rule.type,
240060
+ globs: rule.globs
240061
+ })),
240062
+ uploadSourceMaps: config.upload_source_maps ?? false
240063
+ };
240064
+ }
240065
+ async function resolveRedirectedConfigPath(redirectPath) {
240066
+ const parsed = await readJsonFile(redirectPath);
240067
+ const result = RedirectConfigSchema.safeParse(parsed);
240068
+ if (!result.success) {
240069
+ throw new ConfigInvalidError(`Invalid deploy redirect file: ${prettifyError(result.error)}`, redirectPath);
240070
+ }
240071
+ const configPath = resolve4(dirname12(redirectPath), result.data.configPath);
240072
+ if (!await pathExists(configPath)) {
240073
+ throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
240074
+ hints: [{ message: "Rebuild the project to regenerate the artifact" }]
240075
+ });
240076
+ }
240077
+ return configPath;
240078
+ }
240079
+ function toResolvedAssetsConfig(assets) {
240080
+ return {
240081
+ htmlHandling: assets.html_handling,
240082
+ notFoundHandling: assets.not_found_handling,
240083
+ runWorkerFirst: assets.run_worker_first,
240084
+ headers: assets.headers,
240085
+ redirects: assets.redirects
240086
+ };
240087
+ }
240088
+
240121
240089
  // src/core/site/deployment.ts
240122
240090
  var NO_ASSETS = { manifest: {}, filesByHash: new Map };
240123
240091
  var DEPLOYMENTS_API_ENV = "BASE44_DEPLOYMENTS_API";
@@ -240144,11 +240112,12 @@ async function deployToDeployments(options) {
240144
240112
  return { deploymentId: finalized.deploymentId, gitHash };
240145
240113
  }
240146
240114
  async function resolveWorkerBuild(projectRoot, progress) {
240147
- const built = await resolveFullStackBuild(projectRoot);
240148
- if (!built) {
240115
+ const redirectPath = await detectFullStackArtifact(projectRoot);
240116
+ if (!redirectPath) {
240149
240117
  return null;
240150
240118
  }
240151
- const { config, modules, assetsDir } = built;
240119
+ const config = await resolveWranglerConfig(redirectPath);
240120
+ const assetsDir = config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null;
240152
240121
  return {
240153
240122
  config: {
240154
240123
  main: config.main,
@@ -240156,7 +240125,7 @@ async function resolveWorkerBuild(projectRoot, progress) {
240156
240125
  compatibility_flags: config.compatibilityFlags,
240157
240126
  assets: buildAssetsConfig(config.assetsConfig, progress)
240158
240127
  },
240159
- modules,
240128
+ modules: await collectModules(config),
240160
240129
  assetsDir
240161
240130
  };
240162
240131
  }
@@ -246700,13 +246669,6 @@ async function resolveGitHash(projectRoot, explicit) {
246700
246669
  }
246701
246670
  return hash;
246702
246671
  }
246703
- async function resolveProvenanceCommit(projectRoot, explicit) {
246704
- if (explicit) {
246705
- return await resolveGitHash(projectRoot, explicit);
246706
- }
246707
- const hash = await gitHead(projectRoot);
246708
- return hash && isGitCommitHash(hash) ? hash : undefined;
246709
- }
246710
246672
  async function gitHead(projectRoot) {
246711
246673
  try {
246712
246674
  const { stdout } = await execa("git", ["rev-parse", "HEAD"], {
@@ -247076,12 +247038,6 @@ async function ensureAppContext(ctx, options = {}) {
247076
247038
  ctx.app = appContext;
247077
247039
  ctx.errorReporter.setContext({ appId: appContext.id });
247078
247040
  }
247079
- function requireApp(ctx) {
247080
- if (!ctx.app) {
247081
- throw new InternalError("This command read an app context it never resolved — it is declared with requireAppContext: false.");
247082
- }
247083
- return ctx.app;
247084
- }
247085
247041
 
247086
247042
  // src/cli/utils/version-check.ts
247087
247043
  async function checkForUpgrade() {
@@ -247248,152 +247204,6 @@ async function resolveBranchName(name) {
247248
247204
  return matches[0].id;
247249
247205
  }
247250
247206
 
247251
- // src/core/version/publish.ts
247252
- import { randomUUID as randomUUID4 } from "node:crypto";
247253
-
247254
- // src/core/version/schema.ts
247255
- var DeclareVersionResponseSchema = object({
247256
- session_id: string2(),
247257
- uploads: array(object({
247258
- path: string2(),
247259
- url: string2(),
247260
- content_type: string2(),
247261
- content_length: number2(),
247262
- checksum_sha256: string2()
247263
- }))
247264
- }).transform((data) => ({
247265
- sessionId: data.session_id,
247266
- uploads: data.uploads.map((upload) => ({
247267
- path: upload.path,
247268
- url: upload.url,
247269
- contentType: upload.content_type,
247270
- contentLength: upload.content_length,
247271
- checksumSha256: upload.checksum_sha256
247272
- }))
247273
- }));
247274
- var CreateVersionResponseSchema = object({
247275
- version_id: string2(),
247276
- manifest_hash: string2()
247277
- }).transform((data) => ({
247278
- versionId: data.version_id,
247279
- manifestHash: data.manifest_hash
247280
- }));
247281
- var EnvironmentResponseSchema = object({
247282
- name: string2(),
247283
- version_id: string2(),
247284
- manifest_hash: string2(),
247285
- deployment_id: string2()
247286
- }).transform((data) => ({
247287
- name: data.name,
247288
- versionId: data.version_id,
247289
- manifestHash: data.manifest_hash,
247290
- deploymentId: data.deployment_id
247291
- }));
247292
-
247293
- // src/core/version/api.ts
247294
- var DEFAULT_VERSION_UPLOAD_CONCURRENCY = 8;
247295
- var MAX_VERSION_UPLOAD_CONCURRENCY = 16;
247296
- function declaredFile({ path, size, digest }) {
247297
- return { path, size, digest };
247298
- }
247299
- async function post(path, json, doing) {
247300
- try {
247301
- return await getAppClient().post(path, { json, timeout: 180000 });
247302
- } catch (error) {
247303
- throw await ApiError.fromHttpError(error, doing);
247304
- }
247305
- }
247306
- async function patch(path, json, doing) {
247307
- try {
247308
- return await getAppClient().patch(path, { json, timeout: 180000 });
247309
- } catch (error) {
247310
- throw await ApiError.fromHttpError(error, doing);
247311
- }
247312
- }
247313
- function parse10(schema, body, what) {
247314
- const result = schema.safeParse(body);
247315
- if (!result.success) {
247316
- throw new SchemaValidationError(`Invalid ${what} response from server`, result.error);
247317
- }
247318
- return result.data;
247319
- }
247320
- async function createVersion(artifacts, options = {}) {
247321
- const declared = parse10(DeclareVersionResponseSchema, await (await post("versions", {
247322
- static_bundle: artifacts.files.map(declaredFile),
247323
- ...artifacts.siteWorker ? {
247324
- site_worker: {
247325
- main: artifacts.siteWorker.main,
247326
- modules: artifacts.siteWorker.modules.map(declaredFile),
247327
- compatibility_date: artifacts.siteWorker.compatibilityDate,
247328
- compatibility_flags: artifacts.siteWorker.compatibilityFlags
247329
- }
247330
- } : {},
247331
- entities: artifacts.entities,
247332
- agents: artifacts.agents,
247333
- source_commit: options.sourceCommit
247334
- }, "declaring a version")).json(), "declare");
247335
- const declaredFiles = [
247336
- ...artifacts.files,
247337
- ...artifacts.siteWorker?.modules ?? []
247338
- ];
247339
- options.progress?.onDeclared?.({
247340
- fileCount: declaredFiles.length,
247341
- owedFiles: declared.uploads.length
247342
- });
247343
- if (declared.uploads.length !== declaredFiles.length) {
247344
- throw new InternalError(`Declared ${declaredFiles.length} files but the server signed ${declared.uploads.length} upload URLs.`);
247345
- }
247346
- let uploadedFiles = 0;
247347
- await pMap(declared.uploads, async (upload, index) => {
247348
- await putPresigned(upload, declaredFiles[index].absolutePath);
247349
- uploadedFiles++;
247350
- options.progress?.onUpload?.({
247351
- uploadedFiles,
247352
- totalFiles: declared.uploads.length
247353
- });
247354
- }, { concurrency: options.concurrency ?? DEFAULT_VERSION_UPLOAD_CONCURRENCY });
247355
- return parse10(CreateVersionResponseSchema, await (await post(`versions/${encodeURIComponent(declared.sessionId)}/finalize`, {}, "creating a version")).json(), "create version");
247356
- }
247357
- async function setEnvironmentVersion(environment, versionId, options = {}) {
247358
- return parse10(EnvironmentResponseSchema, await (await patch(`environments/${encodeURIComponent(environment)}`, {
247359
- version_id: versionId,
247360
- ...options.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}
247361
- }, "setting the environment's version")).json(), "environment");
247362
- }
247363
-
247364
- // src/core/version/publish.ts
247365
- var STEP = Symbol.for("base44.publishStep");
247366
- var DEFAULT_ENVIRONMENT = "production";
247367
- async function tagStep(step, run) {
247368
- try {
247369
- return await run();
247370
- } catch (error) {
247371
- if (error !== null && typeof error === "object" && !(STEP in error)) {
247372
- Object.defineProperty(error, STEP, { value: step, enumerable: false });
247373
- }
247374
- throw error;
247375
- }
247376
- }
247377
- function stepOf(error) {
247378
- return error !== null && typeof error === "object" && STEP in error ? error[STEP] : undefined;
247379
- }
247380
- async function publishVersion(artifacts, options = {}) {
247381
- const version = await tagStep("create_version", () => createVersion(artifacts, {
247382
- sourceCommit: options.sourceCommit,
247383
- concurrency: options.concurrency,
247384
- progress: options.progress
247385
- }));
247386
- const environment = await tagStep("deploy", () => setEnvironmentVersion(options.target ?? DEFAULT_ENVIRONMENT, version.versionId, {
247387
- idempotencyKey: randomUUID4()
247388
- }));
247389
- return {
247390
- environment: environment.name,
247391
- versionId: environment.versionId,
247392
- manifestHash: environment.manifestHash,
247393
- deploymentId: environment.deploymentId
247394
- };
247395
- }
247396
-
247397
247207
  // src/cli/utils/command/Base44Command.ts
247398
247208
  function writeJsonSuccess(result) {
247399
247209
  if (result.stdout) {
@@ -247411,10 +247221,6 @@ function writeJsonError(error) {
247411
247221
  const envelope = {
247412
247222
  error: error instanceof Error ? error.message : String(error)
247413
247223
  };
247414
- const step = stepOf(error);
247415
- if (step !== undefined) {
247416
- envelope.step = step;
247417
- }
247418
247224
  if (isCLIError(error)) {
247419
247225
  envelope.code = error.code;
247420
247226
  if (error.details.length > 0) {
@@ -249757,136 +249563,17 @@ async function maybeAskToBuild(isNonInteractive, buildCommand) {
249757
249563
  });
249758
249564
  return !Ct(answer) && answer;
249759
249565
  }
249760
- // src/core/version/artifacts.ts
249761
- import { createHash as createHash2 } from "node:crypto";
249762
- import { join as join27, resolve as resolve10 } from "node:path";
249763
- var MAX_FILE_COUNT = 50000;
249764
- var HASH_CONCURRENCY = 32;
249765
- var ENTRY2 = "index.html";
249766
- async function digestFile(absolutePath) {
249767
- const hash = await hashFileInto(createHash2("sha256"), absolutePath);
249768
- return `sha256:${hash.digest("hex")}`;
249769
- }
249770
- async function collectBuildOutput(outputDir, options = {}) {
249771
- const found = await describeBuildOutput(outputDir);
249772
- if (found.length === 0) {
249773
- throw new InvalidInputError(`No files found in ${outputDir}. Build the site before creating a version.`, {
249774
- hints: [
249775
- { message: "Run 'base44 build' first", command: "base44 build" }
249776
- ]
249777
- });
249778
- }
249779
- if (found.length > MAX_FILE_COUNT) {
249780
- throw new InvalidInputError(`Too many files: found ${found.length}, the limit is ${MAX_FILE_COUNT}.`);
249781
- }
249782
- if (options.requireEntry !== false && !found.some((f) => f.path === ENTRY2)) {
249783
- throw new InvalidInputError(`${outputDir} has no ${ENTRY2}, so nothing could enter the site.`);
249784
- }
249785
- return await pMap(found, async (file) => ({ ...file, digest: await digestFile(file.absolutePath) }), { concurrency: HASH_CONCURRENCY });
249786
- }
249787
- async function collectSiteWorker(projectRoot) {
249788
- const built = await resolveFullStackBuild(projectRoot);
249789
- if (!built) {
249790
- return null;
249791
- }
249792
- const { config, modules, assetsDir } = built;
249793
- const entry = resolve10(config.configDir, config.main);
249794
- const main = modules.find((m) => m.absolutePath === entry)?.name;
249795
- if (!main) {
249796
- throw new InvalidInputError(`The Worker's entry module ${config.main} is not among the ${modules.length} modules collected from ${config.configDir}.`);
249797
- }
249798
- return {
249799
- main,
249800
- modules: await pMap(modules, async ({ name, absolutePath, size }) => ({
249801
- path: name,
249802
- absolutePath,
249803
- size,
249804
- digest: await digestFile(absolutePath)
249805
- }), { concurrency: HASH_CONCURRENCY }),
249806
- compatibilityDate: config.compatibilityDate,
249807
- compatibilityFlags: config.compatibilityFlags,
249808
- assetsDir
249809
- };
249810
- }
249811
- async function readRawResources(dir) {
249812
- if (!await pathExists(dir)) {
249813
- return {};
249814
- }
249815
- const files = await globby(`**/*.${CONFIG_FILE_EXTENSION_GLOB}`, {
249816
- cwd: dir,
249817
- onlyFiles: true,
249818
- followSymbolicLinks: false
249819
- });
249820
- const payloads = {};
249821
- for (const relativePath of files.sort()) {
249822
- const name = relativePath.replace(/\.jsonc?$/, "");
249823
- payloads[name] = await readJsonFile(join27(dir, ...relativePath.split("/")));
249824
- }
249825
- return payloads;
249826
- }
249827
- async function collectResources(configDir, dirs) {
249828
- const [entities, agents] = await Promise.all([
249829
- readRawResources(join27(configDir, dirs.entitiesDir)),
249830
- readRawResources(join27(configDir, dirs.agentsDir))
249831
- ]);
249832
- return { entities, agents };
249833
- }
249834
- // src/core/version/gate.ts
249835
- var VERSIONS_API_ENV = "BASE44_VERSIONS_API";
249836
- function versionsApiEnabled(env = process.env) {
249837
- const value = env[VERSIONS_API_ENV];
249838
- return value === "1" || value === "true";
249839
- }
249840
- // src/core/version/project.ts
249841
- import { dirname as dirname21, join as join28, resolve as resolve11 } from "node:path";
249842
- var DEFAULT_BUILD_COMMAND = "npm run build";
249843
- var DEFAULT_OUTPUT_DIRECTORY = "dist";
249844
- async function resolvePublishTarget(projectRoot, overrides = {}) {
249845
- const project = await readSettingsIfPresent(projectRoot);
249846
- const root = project?.root ?? projectRoot ?? process.cwd();
249847
- return {
249848
- root,
249849
- configDir: project ? dirname21(project.configPath) : join28(root, PROJECT_SUBDIR),
249850
- buildCommand: project ? project.site?.buildCommand : DEFAULT_BUILD_COMMAND,
249851
- outputDir: outputDirectory(project, root, overrides.outputDir),
249852
- entitiesDir: project?.entitiesDir ?? "entities",
249853
- agentsDir: project?.agentsDir ?? "agents"
249854
- };
249855
- }
249856
- function outputDirectory(project, root, override) {
249857
- const configured = override ?? (project ? project.site?.outputDirectory : DEFAULT_OUTPUT_DIRECTORY);
249858
- return configured ? resolve11(root, configured) : null;
249859
- }
249860
- function requireOutputDir(target) {
249861
- if (target.outputDir === null) {
249862
- throw new ConfigNotFoundError("No site configuration found.", {
249863
- hints: [
249864
- {
249865
- message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
249866
- },
249867
- { message: `Or pass --output-dir <dir>, relative to ${target.root}` }
249868
- ]
249869
- });
249870
- }
249871
- return target.outputDir;
249872
- }
249873
- async function readSettingsIfPresent(projectRoot) {
249874
- try {
249875
- return await readProjectSettings(projectRoot);
249876
- } catch (error) {
249877
- if (error instanceof ConfigNotFoundError) {
249878
- return null;
249879
- }
249880
- throw error;
249881
- }
249882
- }
249566
+
249883
249567
  // src/cli/commands/project/build.ts
249884
249568
  async function buildAction(ctx) {
249885
- const app = requireApp(ctx);
249886
- const target = await resolvePublishTarget(app.projectRoot);
249569
+ const { app } = ctx;
249570
+ if (!app?.projectRoot) {
249571
+ throw new ConfigInvalidError("base44 build requires a linked local project. Run it from a project with base44/.app.jsonc.");
249572
+ }
249573
+ const { project } = await readProjectConfig(app.projectRoot);
249887
249574
  await runSiteBuild(ctx, {
249888
- root: target.root,
249889
- buildCommand: target.buildCommand,
249575
+ root: project.root,
249576
+ buildCommand: project.site?.buildCommand,
249890
249577
  appId: app.id
249891
249578
  });
249892
249579
  return {
@@ -249894,15 +249581,15 @@ async function buildAction(ctx) {
249894
249581
  };
249895
249582
  }
249896
249583
  function getBuildCommand() {
249897
- return new Base44Command("build", { requireAuth: false }).description("Build the site with the Base44 app id injected").action(buildAction);
249584
+ return new Base44Command("build").description("Build the site with the Base44 app id injected").action(buildAction);
249898
249585
  }
249899
249586
 
249900
249587
  // src/cli/commands/project/create.ts
249901
- import { basename as basename6, resolve as resolve12 } from "node:path";
249588
+ import { basename as basename6, resolve as resolve10 } from "node:path";
249902
249589
  var import_kebabCase = __toESM(require_kebabCase(), 1);
249903
249590
 
249904
249591
  // src/cli/commands/project/scaffold-shared.ts
249905
- import { join as join29 } from "node:path";
249592
+ import { join as join27 } from "node:path";
249906
249593
  var DEFAULT_TEMPLATE_ID = "backend-only";
249907
249594
  async function getTemplateById(templateId) {
249908
249595
  const templates = await listTemplates();
@@ -249965,7 +249652,7 @@ async function completeProjectSetup({
249965
249652
  env: { VITE_BASE44_APP_ID: projectId }
249966
249653
  })`${buildCommand}`;
249967
249654
  updateMessage("Deploying site...");
249968
- return await deploySite(join29(resolvedPath, outputDirectory));
249655
+ return await deploySite(join27(resolvedPath, outputDirectory));
249969
249656
  }, {
249970
249657
  successMessage: theme.colors.base44Orange("Site deployed successfully"),
249971
249658
  errorMessage: "Failed to deploy site"
@@ -250094,7 +249781,7 @@ async function createInteractive(options, ctx) {
250094
249781
  }, ctx);
250095
249782
  }
250096
249783
  async function createNonInteractive(options, ctx) {
250097
- ctx.log.info(`Creating a new project at ${resolve12(options.path)}`);
249784
+ ctx.log.info(`Creating a new project at ${resolve10(options.path)}`);
250098
249785
  const template = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
250099
249786
  return await executeCreate({
250100
249787
  template,
@@ -250118,7 +249805,7 @@ async function executeCreate({
250118
249805
  }, ctx) {
250119
249806
  const { log, runTask } = ctx;
250120
249807
  const name = rawName.trim();
250121
- const resolvedPath = resolve12(projectPath);
249808
+ const resolvedPath = resolve10(projectPath);
250122
249809
  const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
250123
249810
  const { projectId } = await runTask("Setting up your project...", async () => {
250124
249811
  return await createProjectFiles({
@@ -250759,7 +250446,7 @@ function getLogsCommand() {
250759
250446
  }
250760
250447
 
250761
250448
  // src/cli/commands/project/scaffold.ts
250762
- import { basename as basename7, resolve as resolve13 } from "node:path";
250449
+ import { basename as basename7, resolve as resolve11 } from "node:path";
250763
250450
  function resolveAppId(options) {
250764
250451
  const appId = options.appId;
250765
250452
  if (!appId) {
@@ -250775,7 +250462,7 @@ function resolveAppId(options) {
250775
250462
  async function scaffoldAction(ctx, name, options, command) {
250776
250463
  const { log, runTask } = ctx;
250777
250464
  const appId = resolveAppId(command.optsWithGlobals());
250778
- const resolvedPath = resolve13("./");
250465
+ const resolvedPath = resolve11("./");
250779
250466
  const projectName = (name ?? basename7(resolvedPath)).trim();
250780
250467
  const template = await getTemplateById("backend-only");
250781
250468
  log.info(`Scaffolding project at ${resolvedPath}`);
@@ -250823,81 +250510,6 @@ function getVisibilityCommand() {
250823
250510
  ])).action(setVisibility);
250824
250511
  }
250825
250512
 
250826
- // src/cli/commands/versions/options.ts
250827
- function outputDirOption() {
250828
- return new Option2("--output-dir <dir>", "Build output directory (defaults to the project's, else dist)");
250829
- }
250830
- function targetOption() {
250831
- return new Option2("--target <name>", "Environment to serve the version at");
250832
- }
250833
- function gitHashOption() {
250834
- return new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser((value) => {
250835
- if (!isGitCommitHash(value)) {
250836
- throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
250837
- }
250838
- return value;
250839
- });
250840
- }
250841
- function concurrencyOption() {
250842
- return new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser((value) => {
250843
- const parsed = Number(value);
250844
- if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_VERSION_UPLOAD_CONCURRENCY) {
250845
- throw new InvalidArgumentError2(`Expected a whole number between 1 and ${MAX_VERSION_UPLOAD_CONCURRENCY}.`);
250846
- }
250847
- return parsed;
250848
- });
250849
- }
250850
-
250851
- // src/cli/commands/publish.ts
250852
- async function publishAction(ctx, options) {
250853
- const { runTask, log, jsonMode } = ctx;
250854
- const app = requireApp(ctx);
250855
- const target = await resolvePublishTarget(app.projectRoot, {
250856
- outputDir: options.outputDir
250857
- });
250858
- if (options.build !== false) {
250859
- await tagStep("build", () => runSiteBuild(ctx, {
250860
- root: target.root,
250861
- buildCommand: target.buildCommand,
250862
- appId: app.id
250863
- }));
250864
- }
250865
- const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
250866
- const result = await runTask("Publishing...", async (updateMessage) => {
250867
- const artifacts = await tagStep("create_version", async () => {
250868
- const siteWorker = await collectSiteWorker(target.root);
250869
- const assetsDir = siteWorker ? siteWorker.assetsDir : requireOutputDir(target);
250870
- return {
250871
- files: assetsDir ? await collectBuildOutput(assetsDir, {
250872
- requireEntry: siteWorker === null
250873
- }) : [],
250874
- ...siteWorker ? { siteWorker } : {},
250875
- ...await collectResources(target.configDir, target)
250876
- };
250877
- });
250878
- return await publishVersion(artifacts, {
250879
- sourceCommit: gitHash,
250880
- target: options.target,
250881
- concurrency: options.concurrency,
250882
- progress: {
250883
- onDeclared: ({ fileCount, owedFiles }) => updateMessage(`Uploading ${owedFiles} of ${fileCount} files`),
250884
- onUpload: ({ uploadedFiles, totalFiles }) => updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} files`)
250885
- }
250886
- });
250887
- }, { successMessage: "Published", errorMessage: "Publish failed" });
250888
- if (!jsonMode) {
250889
- log.message(theme.styles.dim(`version ${result.versionId}`));
250890
- }
250891
- return {
250892
- outroMessage: `${result.environment} now serves ${result.versionId}`,
250893
- stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
250894
- ` : undefined
250895
- };
250896
- }
250897
- function getPublishCommand() {
250898
- return new Base44Command("publish").description("Build the app, record it as a version, and serve that version").option("--no-build", "Publish the existing build output without rebuilding").addOption(outputDirOption()).addOption(targetOption()).addOption(gitHashOption()).addOption(concurrencyOption()).action(publishAction);
250899
- }
250900
-
250901
250513
  // src/core/resources/sandbox/schema.ts
250902
250514
  var FileErrorSchema = object({
250903
250515
  code: string2(),
@@ -251267,7 +250879,7 @@ function getSecretsListCommand() {
251267
250879
  }
251268
250880
 
251269
250881
  // src/cli/commands/secrets/set.ts
251270
- import { resolve as resolve14 } from "node:path";
250882
+ import { resolve as resolve12 } from "node:path";
251271
250883
  function parseEntries(entries) {
251272
250884
  const secrets = {};
251273
250885
  for (const entry of entries) {
@@ -251298,7 +250910,7 @@ async function setSecretsAction({ log, runTask }, entries, options) {
251298
250910
  validateInput(entries, options);
251299
250911
  let secrets;
251300
250912
  if (options.envFile) {
251301
- secrets = await parseEnvFile(resolve14(options.envFile));
250913
+ secrets = await parseEnvFile(resolve12(options.envFile));
251302
250914
  if (Object.keys(secrets).length === 0) {
251303
250915
  throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
251304
250916
  }
@@ -251327,7 +250939,7 @@ function getSecretsCommand() {
251327
250939
  }
251328
250940
 
251329
250941
  // src/cli/commands/site/deploy.ts
251330
- import { resolve as resolve15 } from "node:path";
250942
+ import { resolve as resolve13 } from "node:path";
251331
250943
  async function deployAction2(ctx, options) {
251332
250944
  const { isNonInteractive } = ctx;
251333
250945
  if (isNonInteractive && !options.yes) {
@@ -251405,7 +251017,7 @@ async function deployTarball({ runTask }, project) {
251405
251017
  }
251406
251018
  function siteOutputDir(project) {
251407
251019
  const outputDirectory = project.site?.outputDirectory;
251408
- return outputDirectory ? resolve15(project.root, outputDirectory) : null;
251020
+ return outputDirectory ? resolve13(project.root, outputDirectory) : null;
251409
251021
  }
251410
251022
  function getSiteDeployCommand() {
251411
251023
  const command = new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)");
@@ -251537,10 +251149,10 @@ function toPascalCase(name) {
251537
251149
  return name.split(/[-_\s]+/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
251538
251150
  }
251539
251151
  // src/core/types/update-project.ts
251540
- import { join as join33 } from "node:path";
251152
+ import { join as join30 } from "node:path";
251541
251153
  var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
251542
251154
  async function updateProjectConfig(projectRoot) {
251543
- const tsconfigPath = join33(projectRoot, "tsconfig.json");
251155
+ const tsconfigPath = join30(projectRoot, "tsconfig.json");
251544
251156
  if (!await pathExists(tsconfigPath)) {
251545
251157
  return false;
251546
251158
  }
@@ -251589,61 +251201,6 @@ function getTypesCommand() {
251589
251201
  return new Command2("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
251590
251202
  }
251591
251203
 
251592
- // src/cli/commands/versions/create.ts
251593
- async function createAction2({ runTask, jsonMode, app }, options) {
251594
- const target = await resolvePublishTarget(app?.projectRoot, {
251595
- outputDir: options.outputDir
251596
- });
251597
- const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
251598
- const version = await runTask("Creating version...", async (updateMessage) => await createVersion({
251599
- files: await collectBuildOutput(requireOutputDir(target)),
251600
- ...await collectResources(target.configDir, target)
251601
- }, {
251602
- sourceCommit: gitHash,
251603
- concurrency: options.concurrency,
251604
- progress: {
251605
- onDeclared: ({ fileCount, owedFiles }) => updateMessage(`Uploading ${owedFiles} of ${fileCount} files`),
251606
- onUpload: ({ uploadedFiles, totalFiles }) => updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} files`)
251607
- }
251608
- }), {
251609
- successMessage: "Version created",
251610
- errorMessage: "Create version failed"
251611
- });
251612
- return {
251613
- outroMessage: `Version ${version.versionId} (${version.manifestHash})`,
251614
- stdout: jsonMode ? `${JSON.stringify(version, null, 2)}
251615
- ` : undefined
251616
- };
251617
- }
251618
- function getVersionCreateCommand() {
251619
- return new Base44Command("create").description("Record the built output as a version, without deploying it").addOption(outputDirOption()).addOption(gitHashOption()).addOption(concurrencyOption()).action(createAction2);
251620
- }
251621
-
251622
- // src/cli/commands/versions/deploy.ts
251623
- import { randomUUID as randomUUID5 } from "node:crypto";
251624
- async function deployAction3({ runTask, jsonMode }, versionId, options) {
251625
- const environment = options.target ?? DEFAULT_ENVIRONMENT;
251626
- const result = await runTask(`Pointing ${environment} at ${versionId}...`, async () => await setEnvironmentVersion(environment, versionId, {
251627
- idempotencyKey: randomUUID5()
251628
- }), {
251629
- successMessage: "Environment updated",
251630
- errorMessage: "Could not update the environment"
251631
- });
251632
- return {
251633
- outroMessage: `${result.name} now serves ${result.versionId}`,
251634
- stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
251635
- ` : undefined
251636
- };
251637
- }
251638
- function getVersionDeployCommand() {
251639
- return new Base44Command("deploy").description("Point an environment at an already-recorded version (also the rollback)").argument("<version-id>", "The version to serve").option("--target <name>", "Environment to point at it").action(deployAction3);
251640
- }
251641
-
251642
- // src/cli/commands/versions/index.ts
251643
- function getVersionsCommand() {
251644
- return new Command2("versions").description("Record app versions and serve them").addCommand(getVersionCreateCommand()).addCommand(getVersionDeployCommand());
251645
- }
251646
-
251647
251204
  // src/core/resources/workflow/schema.ts
251648
251205
  var WorkflowRunStatusSchema = _enum([
251649
251206
  "running",
@@ -252060,7 +251617,7 @@ function createDevLogger(label, labelColor = theme.styles.dim) {
252060
251617
  // src/cli/dev/dev-server/main.ts
252061
251618
  var import_cors = __toESM(require_lib4(), 1);
252062
251619
  var import_express6 = __toESM(require_express(), 1);
252063
- import { dirname as dirname27, join as join38 } from "node:path";
251620
+ import { dirname as dirname26, join as join36 } from "node:path";
252064
251621
 
252065
251622
  // ../../node_modules/get-port/index.js
252066
251623
  import net from "node:net";
@@ -252190,7 +251747,7 @@ var $tmpName = promisify11(tmp.tmpName);
252190
251747
 
252191
251748
  // src/cli/dev/dev-server/function-manager.ts
252192
251749
  import { spawn as spawn2 } from "node:child_process";
252193
- import { dirname as dirname24, join as join34 } from "node:path";
251750
+ import { dirname as dirname23, join as join31 } from "node:path";
252194
251751
  import { pathToFileURL } from "node:url";
252195
251752
 
252196
251753
  // src/cli/dev/dev-server/base-function-manager.ts
@@ -252295,7 +251852,7 @@ class FunctionManager extends BaseFunctionManager {
252295
251852
  }
252296
251853
  spawnFunction(func, port) {
252297
251854
  this.logger.log(`Spawning function "${func.name}" on port ${port}`);
252298
- const importMapPath = join34(dirname24(this.wrapperPath), "import-map.json");
251855
+ const importMapPath = join31(dirname23(this.wrapperPath), "import-map.json");
252299
251856
  const process2 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
252300
251857
  env: {
252301
251858
  ...globalThis.process.env,
@@ -252369,7 +251926,7 @@ class FunctionManager extends BaseFunctionManager {
252369
251926
  import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
252370
251927
  import { isBuiltin } from "node:module";
252371
251928
  import { homedir as homedir3 } from "node:os";
252372
- import { join as join35 } from "node:path";
251929
+ import { join as join33 } from "node:path";
252373
251930
  import { pathToFileURL as pathToFileURL6 } from "node:url";
252374
251931
  var depsPromise;
252375
251932
  function loadDeps() {
@@ -252490,9 +252047,9 @@ export default {
252490
252047
  };
252491
252048
  `;
252492
252049
  function ensureBundlerConfig() {
252493
- const dir = join35(homedir3(), ".base44", "function-bundler");
252050
+ const dir = join33(homedir3(), ".base44", "function-bundler");
252494
252051
  mkdirSync2(dir, { recursive: true });
252495
- const configPath = join35(dir, "deno.json");
252052
+ const configPath = join33(dir, "deno.json");
252496
252053
  writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
252497
252054
  `);
252498
252055
  return configPath;
@@ -253873,11 +253430,11 @@ async function createEntityRoutes(db, logger, broadcast) {
253873
253430
  // src/cli/dev/dev-server/routes/integrations.ts
253874
253431
  var import_express5 = __toESM(require_express(), 1);
253875
253432
  var import_multer = __toESM(require_multer(), 1);
253876
- import { createHash as createHash3, randomUUID as randomUUID6 } from "node:crypto";
253433
+ import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
253877
253434
  import fs28 from "node:fs";
253878
253435
  import path18 from "node:path";
253879
253436
  function createFileToken(fileUri) {
253880
- return createHash3("sha256").update(fileUri).digest("hex");
253437
+ return createHash2("sha256").update(fileUri).digest("hex");
253881
253438
  }
253882
253439
  function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
253883
253440
  const router = import_express5.Router({ mergeParams: true });
@@ -253890,14 +253447,14 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
253890
253447
  destination: mediaFilesDir,
253891
253448
  filename: (_req, file, cb) => {
253892
253449
  const ext = path18.extname(file.originalname);
253893
- cb(null, `${randomUUID6()}${ext}`);
253450
+ cb(null, `${randomUUID4()}${ext}`);
253894
253451
  }
253895
253452
  });
253896
253453
  const privateStorage = import_multer.default.diskStorage({
253897
253454
  destination: privateFilesDir,
253898
253455
  filename: (_req, file, cb) => {
253899
253456
  const ext = path18.extname(file.originalname);
253900
- cb(null, `${randomUUID6()}${ext}`);
253457
+ cb(null, `${randomUUID4()}${ext}`);
253901
253458
  }
253902
253459
  });
253903
253460
  const upload = import_multer.default({ storage, limits: { fileSize: MAX_FILE_SIZE } });
@@ -255759,8 +255316,8 @@ async function createDevServer(options) {
255759
255316
  broadcastEntityEvent(io, appId, entityName, event);
255760
255317
  };
255761
255318
  const base44ConfigWatcher = new WatchBase44({
255762
- functions: join38(dirname27(project.configPath), project.functionsDir),
255763
- entities: join38(dirname27(project.configPath), project.entitiesDir)
255319
+ functions: join36(dirname26(project.configPath), project.functionsDir),
255320
+ entities: join36(dirname26(project.configPath), project.entitiesDir)
255764
255321
  }, devLogger);
255765
255322
  base44ConfigWatcher.on("change", async (name) => {
255766
255323
  try {
@@ -256157,7 +255714,7 @@ Examples:
256157
255714
  }
256158
255715
 
256159
255716
  // src/cli/commands/project/eject.ts
256160
- import { resolve as resolve19 } from "node:path";
255717
+ import { resolve as resolve17 } from "node:path";
256161
255718
  var import_kebabCase2 = __toESM(require_kebabCase(), 1);
256162
255719
  async function eject(ctx, options, command) {
256163
255720
  const { log, runTask, isNonInteractive } = ctx;
@@ -256221,7 +255778,7 @@ async function eject(ctx, options, command) {
256221
255778
  Ne("Operation cancelled.");
256222
255779
  throw new CLIExitError(0);
256223
255780
  }
256224
- const resolvedPath = resolve19(selectedPath);
255781
+ const resolvedPath = resolve17(selectedPath);
256225
255782
  await runTask("Downloading your project's code...", async (updateMessage) => {
256226
255783
  await createProjectFilesForExistingProject({
256227
255784
  projectId,
@@ -256305,10 +255862,6 @@ function createProgram(context) {
256305
255862
  program.addCommand(getBranchesCommand());
256306
255863
  program.addCommand(getAuthCommand());
256307
255864
  program.addCommand(getSiteCommand());
256308
- if (versionsApiEnabled()) {
256309
- program.addCommand(getPublishCommand());
256310
- program.addCommand(getVersionsCommand());
256311
- }
256312
255865
  program.addCommand(getTypesCommand());
256313
255866
  program.addCommand(getExecCommand());
256314
255867
  program.addCommand(getDevCommand());
@@ -256321,7 +255874,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
256321
255874
  import { release, type } from "node:os";
256322
255875
 
256323
255876
  // ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
256324
- import { dirname as dirname28, posix, sep as sep2 } from "path";
255877
+ import { dirname as dirname27, posix, sep as sep2 } from "path";
256325
255878
  function createModulerModifier() {
256326
255879
  const getModuleFromFileName = createGetModuleFromFilename();
256327
255880
  return async (frames) => {
@@ -256330,7 +255883,7 @@ function createModulerModifier() {
256330
255883
  return frames;
256331
255884
  };
256332
255885
  }
256333
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname28(process.argv[1]) : process.cwd(), isWindows = sep2 === "\\") {
255886
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname27(process.argv[1]) : process.cwd(), isWindows = sep2 === "\\") {
256334
255887
  const normalizedBase = isWindows ? normalizeWindowsPath2(basePath) : basePath;
256335
255888
  return (filename) => {
256336
255889
  if (!filename)
@@ -260319,9 +259872,9 @@ function addCommandInfoToErrorReporter(program, errorReporter) {
260319
259872
  });
260320
259873
  }
260321
259874
  // src/cli/index.ts
260322
- var __dirname4 = dirname29(fileURLToPath6(import.meta.url));
259875
+ var __dirname4 = dirname28(fileURLToPath6(import.meta.url));
260323
259876
  async function runCLI(options) {
260324
- ensureNpmAssets(join39(__dirname4, "../assets"));
259877
+ ensureNpmAssets(join37(__dirname4, "../assets"));
260325
259878
  const errorReporter = new ErrorReporter;
260326
259879
  errorReporter.registerProcessErrorHandlers();
260327
259880
  const jsonMode = process.argv.includes("--json");
@@ -260360,4 +259913,4 @@ export {
260360
259913
  runCLI
260361
259914
  };
260362
259915
 
260363
- //# debugId=049BFBB8889BAA6E64756E2164756E21
259916
+ //# debugId=EF36A7D77029953264756E2164756E21