@base44-preview/cli 0.1.16-pr.626.cb8fa0d → 0.1.16-pr.634.3cc42b9

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
@@ -230705,10 +230705,10 @@ var TemplatesConfigSchema = object({
230705
230705
  templates: array(TemplateSchema)
230706
230706
  });
230707
230707
  var SiteConfigSchema = object({
230708
- buildCommand: string2().optional(),
230709
- serveCommand: string2().optional(),
230710
- outputDirectory: string2().optional(),
230711
- installCommand: string2().optional()
230708
+ buildCommand: string2().optional().default("npm run build"),
230709
+ serveCommand: string2().optional().default("npm run dev"),
230710
+ outputDirectory: string2().optional().default("./dist"),
230711
+ installCommand: string2().optional().default("npm install")
230712
230712
  });
230713
230713
  var PluginMetadataSchema = object({
230714
230714
  namespace: string2().min(1, "Plugin namespace cannot be empty").regex(/^[a-zA-Z0-9_-]+$/, "Plugin namespace can only contain letters, numbers, underscores, and dashes")
@@ -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"], {
@@ -246729,7 +246691,7 @@ function hasResourcesToDeploy(projectData) {
246729
246691
  connectors,
246730
246692
  authConfig
246731
246693
  } = projectData;
246732
- const hasSite = Boolean(project.site?.outputDirectory);
246694
+ const hasSite = project.site !== undefined;
246733
246695
  const hasEntities = entities.length > 0;
246734
246696
  const hasFunctions = functions.length > 0;
246735
246697
  const hasActors = actors.length > 0;
@@ -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,169 +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
- function declaredModule(module) {
247300
- return { ...declaredFile(module), type: module.type };
247301
- }
247302
- function declaredAssetsConfig(config) {
247303
- const stated = {
247304
- html_handling: config?.htmlHandling ?? null,
247305
- not_found_handling: config?.notFoundHandling ?? null,
247306
- run_worker_first: config?.runWorkerFirst ?? null,
247307
- headers: config?.headers ?? null,
247308
- redirects: config?.redirects ?? null
247309
- };
247310
- return Object.values(stated).every((v) => v === null) ? null : stated;
247311
- }
247312
- async function post(path, json, doing) {
247313
- try {
247314
- return await getAppClient().post(path, { json, timeout: 180000 });
247315
- } catch (error) {
247316
- throw await ApiError.fromHttpError(error, doing);
247317
- }
247318
- }
247319
- async function patch(path, json, doing) {
247320
- try {
247321
- return await getAppClient().patch(path, { json, timeout: 180000 });
247322
- } catch (error) {
247323
- throw await ApiError.fromHttpError(error, doing);
247324
- }
247325
- }
247326
- function parse10(schema, body, what) {
247327
- const result = schema.safeParse(body);
247328
- if (!result.success) {
247329
- throw new SchemaValidationError(`Invalid ${what} response from server`, result.error);
247330
- }
247331
- return result.data;
247332
- }
247333
- async function createVersion(artifacts, options = {}) {
247334
- const declared = parse10(DeclareVersionResponseSchema, await (await post("versions", {
247335
- static_bundle: artifacts.files.map(declaredFile),
247336
- ...artifacts.siteWorker ? {
247337
- site_worker: {
247338
- main: artifacts.siteWorker.main,
247339
- modules: artifacts.siteWorker.modules.map(declaredModule),
247340
- assets: artifacts.siteWorker.assets.map(declaredFile),
247341
- compatibility_date: artifacts.siteWorker.compatibilityDate,
247342
- compatibility_flags: artifacts.siteWorker.compatibilityFlags,
247343
- assets_config: declaredAssetsConfig(artifacts.siteWorker.assetsConfig)
247344
- }
247345
- } : {},
247346
- entities: artifacts.entities,
247347
- agents: artifacts.agents,
247348
- source_commit: options.sourceCommit
247349
- }, "declaring a version")).json(), "declare");
247350
- const declaredFiles = [
247351
- ...artifacts.files,
247352
- ...artifacts.siteWorker?.modules ?? [],
247353
- ...artifacts.siteWorker?.assets ?? []
247354
- ];
247355
- options.progress?.onDeclared?.({ fileCount: declaredFiles.length });
247356
- if (declared.uploads.length !== declaredFiles.length) {
247357
- throw new InternalError(`Declared ${declaredFiles.length} files but the server signed ${declared.uploads.length} upload URLs.`);
247358
- }
247359
- const drifted = declared.uploads.findIndex((upload, index) => upload.path !== declaredFiles[index].path);
247360
- if (drifted !== -1) {
247361
- throw new InternalError(`Upload ${drifted} is signed for ${declared.uploads[drifted].path}, but that slot declared ${declaredFiles[drifted].path}.`);
247362
- }
247363
- let uploadedFiles = 0;
247364
- await pMap(declared.uploads, async (upload, index) => {
247365
- await putPresigned(upload, declaredFiles[index].absolutePath);
247366
- uploadedFiles++;
247367
- options.progress?.onUpload?.({
247368
- uploadedFiles,
247369
- totalFiles: declared.uploads.length
247370
- });
247371
- }, { concurrency: options.concurrency ?? DEFAULT_VERSION_UPLOAD_CONCURRENCY });
247372
- return parse10(CreateVersionResponseSchema, await (await post(`versions/${encodeURIComponent(declared.sessionId)}/finalize`, {}, "creating a version")).json(), "create version");
247373
- }
247374
- async function setEnvironmentVersion(environment, versionId, options = {}) {
247375
- return parse10(EnvironmentResponseSchema, await (await patch(`environments/${encodeURIComponent(environment)}`, {
247376
- version_id: versionId,
247377
- ...options.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}
247378
- }, "setting the environment's version")).json(), "environment");
247379
- }
247380
-
247381
- // src/core/version/publish.ts
247382
- var STEP = Symbol.for("base44.publishStep");
247383
- var DEFAULT_ENVIRONMENT = "production";
247384
- async function tagStep(step, run) {
247385
- try {
247386
- return await run();
247387
- } catch (error) {
247388
- if (error !== null && typeof error === "object" && !(STEP in error) && Object.isExtensible(error)) {
247389
- Object.defineProperty(error, STEP, { value: step, enumerable: false });
247390
- }
247391
- throw error;
247392
- }
247393
- }
247394
- function stepOf(error) {
247395
- return error !== null && typeof error === "object" && STEP in error ? error[STEP] : undefined;
247396
- }
247397
- async function publishVersion(artifacts, options = {}) {
247398
- const version = await tagStep("create_version", () => createVersion(artifacts, {
247399
- sourceCommit: options.sourceCommit,
247400
- concurrency: options.concurrency,
247401
- progress: options.progress
247402
- }));
247403
- const environment = await tagStep("deploy", () => setEnvironmentVersion(options.target ?? DEFAULT_ENVIRONMENT, version.versionId, {
247404
- idempotencyKey: randomUUID4()
247405
- }));
247406
- return {
247407
- environment: environment.name,
247408
- versionId: environment.versionId,
247409
- manifestHash: environment.manifestHash,
247410
- deploymentId: environment.deploymentId
247411
- };
247412
- }
247413
-
247414
247207
  // src/cli/utils/command/Base44Command.ts
247415
247208
  function writeJsonSuccess(result) {
247416
247209
  if (result.stdout) {
@@ -247428,10 +247221,6 @@ function writeJsonError(error) {
247428
247221
  const envelope = {
247429
247222
  error: error instanceof Error ? error.message : String(error)
247430
247223
  };
247431
- const step = stepOf(error);
247432
- if (step !== undefined) {
247433
- envelope.step = step;
247434
- }
247435
247224
  if (isCLIError(error)) {
247436
247225
  envelope.code = error.code;
247437
247226
  if (error.details.length > 0) {
@@ -249738,7 +249527,7 @@ async function runSiteBuild({ runTask }, { root, buildCommand, appId }) {
249738
249527
  throw new ConfigNotFoundError("No site build command found.", {
249739
249528
  hints: [
249740
249529
  {
249741
- message: `Add 'site.buildCommand' to your config.jsonc (e.g., "site": { "buildCommand": "npm run build" })`
249530
+ message: `Add a 'site' block to your config.jsonc (e.g., "site": { "buildCommand": "npm run build" }). Inside one, buildCommand defaults to "npm run build".`
249742
249531
  }
249743
249532
  ]
249744
249533
  });
@@ -249774,149 +249563,17 @@ async function maybeAskToBuild(isNonInteractive, buildCommand) {
249774
249563
  });
249775
249564
  return !Ct(answer) && answer;
249776
249565
  }
249777
- // src/core/version/artifacts.ts
249778
- import { createHash as createHash2 } from "node:crypto";
249779
- import { join as join28, resolve as resolve11 } from "node:path";
249780
-
249781
- // src/core/version/project.ts
249782
- import { dirname as dirname21, join as join27, resolve as resolve10 } from "node:path";
249783
- var DEFAULT_BUILD_COMMAND = "npm run build";
249784
- var DEFAULT_OUTPUT_DIRECTORY = "dist";
249785
- async function resolvePublishTarget(projectRoot, overrides = {}) {
249786
- const project = await readSettingsIfPresent(projectRoot);
249787
- const root = project?.root ?? projectRoot ?? process.cwd();
249788
- return {
249789
- root,
249790
- configDir: project ? dirname21(project.configPath) : join27(root, PROJECT_SUBDIR),
249791
- buildCommand: project ? project.site?.buildCommand : DEFAULT_BUILD_COMMAND,
249792
- outputDir: outputDirectory(project, root, overrides.outputDir),
249793
- entitiesDir: project?.entitiesDir ?? "entities",
249794
- agentsDir: project?.agentsDir ?? "agents"
249795
- };
249796
- }
249797
- function outputDirectory(project, root, override) {
249798
- const configured = override ?? (project ? project.site?.outputDirectory : DEFAULT_OUTPUT_DIRECTORY);
249799
- return configured ? resolve10(root, configured) : null;
249800
- }
249801
- function requireOutputDir(target) {
249802
- if (target.outputDir === null) {
249803
- throw new ConfigNotFoundError("No site configuration found.", {
249804
- hints: [
249805
- {
249806
- message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
249807
- },
249808
- { message: `Or pass --output-dir <dir>, relative to ${target.root}` }
249809
- ]
249810
- });
249811
- }
249812
- return target.outputDir;
249813
- }
249814
- async function readSettingsIfPresent(projectRoot) {
249815
- try {
249816
- return await readProjectSettings(projectRoot);
249817
- } catch (error) {
249818
- if (error instanceof ConfigNotFoundError) {
249819
- return null;
249820
- }
249821
- throw error;
249822
- }
249823
- }
249824
249566
 
249825
- // src/core/version/artifacts.ts
249826
- var MAX_FILE_COUNT = 50000;
249827
- var HASH_CONCURRENCY = 32;
249828
- var ENTRY2 = "index.html";
249829
- async function digestFile(absolutePath) {
249830
- const hash = await hashFileInto(createHash2("sha256"), absolutePath);
249831
- return `sha256:${hash.digest("hex")}`;
249832
- }
249833
- async function collectBuildOutput(outputDir, options = {}) {
249834
- const found = await describeBuildOutput(outputDir);
249835
- if (found.length === 0) {
249836
- throw new InvalidInputError(`No files found in ${outputDir}. Build the site before creating a version.`, {
249837
- hints: [
249838
- { message: "Run 'base44 build' first", command: "base44 build" }
249839
- ]
249840
- });
249841
- }
249842
- if (found.length > MAX_FILE_COUNT) {
249843
- throw new InvalidInputError(`Too many files: found ${found.length}, the limit is ${MAX_FILE_COUNT}.`);
249844
- }
249845
- if (options.requireEntry !== false && !found.some((f) => f.path === ENTRY2)) {
249846
- throw new InvalidInputError(`${outputDir} has no ${ENTRY2}, so nothing could enter the site.`);
249847
- }
249848
- return await pMap(found, async (file) => ({ ...file, digest: await digestFile(file.absolutePath) }), { concurrency: HASH_CONCURRENCY });
249849
- }
249850
- async function collectSiteWorker(projectRoot) {
249851
- const built = await resolveFullStackBuild(projectRoot);
249852
- if (!built) {
249853
- return null;
249854
- }
249855
- const { config, modules, assetsDir } = built;
249856
- const entry = resolve11(config.configDir, config.main);
249857
- const main = modules.find((m) => m.absolutePath === entry)?.name;
249858
- if (!main) {
249859
- throw new InvalidInputError(`The Worker's entry module ${config.main} is not among the ${modules.length} modules collected from ${config.configDir}.`);
249860
- }
249861
- return {
249862
- main,
249863
- modules: await pMap(modules, async ({ name, absolutePath, size, type }) => ({
249864
- path: name,
249865
- absolutePath,
249866
- size,
249867
- digest: await digestFile(absolutePath),
249868
- type
249869
- }), { concurrency: HASH_CONCURRENCY }),
249870
- assets: assetsDir ? await collectBuildOutput(assetsDir, { requireEntry: false }) : [],
249871
- compatibilityDate: config.compatibilityDate,
249872
- compatibilityFlags: config.compatibilityFlags,
249873
- assetsConfig: config.assetsConfig
249874
- };
249875
- }
249876
- async function readRawResources(dir) {
249877
- if (!await pathExists(dir)) {
249878
- return {};
249879
- }
249880
- const files = await globby(`**/*.${CONFIG_FILE_EXTENSION_GLOB}`, {
249881
- cwd: dir,
249882
- onlyFiles: true,
249883
- followSymbolicLinks: false
249884
- });
249885
- const payloads = {};
249886
- for (const relativePath of files.sort()) {
249887
- const name = relativePath.replace(/\.jsonc?$/, "");
249888
- payloads[name] = await readJsonFile(join28(dir, ...relativePath.split("/")));
249889
- }
249890
- return payloads;
249891
- }
249892
- async function collectResources(configDir, dirs) {
249893
- const [entities, agents] = await Promise.all([
249894
- readRawResources(join28(configDir, dirs.entitiesDir)),
249895
- readRawResources(join28(configDir, dirs.agentsDir))
249896
- ]);
249897
- return { entities, agents };
249898
- }
249899
- async function collectArtifacts(target) {
249900
- const siteWorker = await collectSiteWorker(target.root);
249901
- return {
249902
- files: siteWorker ? [] : await collectBuildOutput(requireOutputDir(target)),
249903
- ...siteWorker ? { siteWorker } : {},
249904
- ...await collectResources(target.configDir, target)
249905
- };
249906
- }
249907
- // src/core/version/gate.ts
249908
- var VERSIONS_API_ENV = "BASE44_VERSIONS_API";
249909
- function versionsApiEnabled(env = process.env) {
249910
- const value = env[VERSIONS_API_ENV];
249911
- return value === "1" || value === "true";
249912
- }
249913
249567
  // src/cli/commands/project/build.ts
249914
249568
  async function buildAction(ctx) {
249915
- const app = requireApp(ctx);
249916
- 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);
249917
249574
  await runSiteBuild(ctx, {
249918
- root: target.root,
249919
- buildCommand: target.buildCommand,
249575
+ root: project.root,
249576
+ buildCommand: project.site?.buildCommand,
249920
249577
  appId: app.id
249921
249578
  });
249922
249579
  return {
@@ -249924,15 +249581,15 @@ async function buildAction(ctx) {
249924
249581
  };
249925
249582
  }
249926
249583
  function getBuildCommand() {
249927
- 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);
249928
249585
  }
249929
249586
 
249930
249587
  // src/cli/commands/project/create.ts
249931
- import { basename as basename6, resolve as resolve12 } from "node:path";
249588
+ import { basename as basename6, resolve as resolve10 } from "node:path";
249932
249589
  var import_kebabCase = __toESM(require_kebabCase(), 1);
249933
249590
 
249934
249591
  // src/cli/commands/project/scaffold-shared.ts
249935
- import { join as join29 } from "node:path";
249592
+ import { join as join27 } from "node:path";
249936
249593
  var DEFAULT_TEMPLATE_ID = "backend-only";
249937
249594
  async function getTemplateById(templateId) {
249938
249595
  const templates = await listTemplates();
@@ -249995,7 +249652,7 @@ async function completeProjectSetup({
249995
249652
  env: { VITE_BASE44_APP_ID: projectId }
249996
249653
  })`${buildCommand}`;
249997
249654
  updateMessage("Deploying site...");
249998
- return await deploySite(join29(resolvedPath, outputDirectory));
249655
+ return await deploySite(join27(resolvedPath, outputDirectory));
249999
249656
  }, {
250000
249657
  successMessage: theme.colors.base44Orange("Site deployed successfully"),
250001
249658
  errorMessage: "Failed to deploy site"
@@ -250124,7 +249781,7 @@ async function createInteractive(options, ctx) {
250124
249781
  }, ctx);
250125
249782
  }
250126
249783
  async function createNonInteractive(options, ctx) {
250127
- ctx.log.info(`Creating a new project at ${resolve12(options.path)}`);
249784
+ ctx.log.info(`Creating a new project at ${resolve10(options.path)}`);
250128
249785
  const template = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
250129
249786
  return await executeCreate({
250130
249787
  template,
@@ -250148,7 +249805,7 @@ async function executeCreate({
250148
249805
  }, ctx) {
250149
249806
  const { log, runTask } = ctx;
250150
249807
  const name = rawName.trim();
250151
- const resolvedPath = resolve12(projectPath);
249808
+ const resolvedPath = resolve10(projectPath);
250152
249809
  const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
250153
249810
  const { projectId } = await runTask("Setting up your project...", async () => {
250154
249811
  return await createProjectFiles({
@@ -250789,7 +250446,7 @@ function getLogsCommand() {
250789
250446
  }
250790
250447
 
250791
250448
  // src/cli/commands/project/scaffold.ts
250792
- import { basename as basename7, resolve as resolve13 } from "node:path";
250449
+ import { basename as basename7, resolve as resolve11 } from "node:path";
250793
250450
  function resolveAppId(options) {
250794
250451
  const appId = options.appId;
250795
250452
  if (!appId) {
@@ -250805,7 +250462,7 @@ function resolveAppId(options) {
250805
250462
  async function scaffoldAction(ctx, name, options, command) {
250806
250463
  const { log, runTask } = ctx;
250807
250464
  const appId = resolveAppId(command.optsWithGlobals());
250808
- const resolvedPath = resolve13("./");
250465
+ const resolvedPath = resolve11("./");
250809
250466
  const projectName = (name ?? basename7(resolvedPath)).trim();
250810
250467
  const template = await getTemplateById("backend-only");
250811
250468
  log.info(`Scaffolding project at ${resolvedPath}`);
@@ -250853,69 +250510,6 @@ function getVisibilityCommand() {
250853
250510
  ])).action(setVisibility);
250854
250511
  }
250855
250512
 
250856
- // src/cli/commands/versions/options.ts
250857
- function outputDirOption() {
250858
- return new Option2("--output-dir <dir>", "Build output directory (defaults to the project's, else dist)");
250859
- }
250860
- function targetOption() {
250861
- return new Option2("--target <name>", "Environment to serve the version at");
250862
- }
250863
- function gitHashOption() {
250864
- return new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser((value) => {
250865
- if (!isGitCommitHash(value)) {
250866
- throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
250867
- }
250868
- return value;
250869
- });
250870
- }
250871
- function concurrencyOption() {
250872
- return new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser((value) => {
250873
- const parsed = Number(value);
250874
- if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_VERSION_UPLOAD_CONCURRENCY) {
250875
- throw new InvalidArgumentError2(`Expected a whole number between 1 and ${MAX_VERSION_UPLOAD_CONCURRENCY}.`);
250876
- }
250877
- return parsed;
250878
- });
250879
- }
250880
-
250881
- // src/cli/commands/publish.ts
250882
- async function publishAction(ctx, options) {
250883
- const { runTask, log, jsonMode } = ctx;
250884
- const app = requireApp(ctx);
250885
- const target = await tagStep("create_version", () => resolvePublishTarget(app.projectRoot, { outputDir: options.outputDir }));
250886
- if (options.build !== false) {
250887
- await tagStep("build", () => runSiteBuild(ctx, {
250888
- root: target.root,
250889
- buildCommand: target.buildCommand,
250890
- appId: app.id
250891
- }));
250892
- }
250893
- const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
250894
- const result = await runTask("Publishing...", async (updateMessage) => {
250895
- const artifacts = await tagStep("create_version", () => collectArtifacts(target));
250896
- return await publishVersion(artifacts, {
250897
- sourceCommit: gitHash,
250898
- target: options.target,
250899
- concurrency: options.concurrency,
250900
- progress: {
250901
- onDeclared: ({ fileCount }) => updateMessage(`Uploading ${fileCount} files`),
250902
- onUpload: ({ uploadedFiles, totalFiles }) => updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} files`)
250903
- }
250904
- });
250905
- }, { successMessage: "Published", errorMessage: "Publish failed" });
250906
- if (!jsonMode) {
250907
- log.message(theme.styles.dim(`version ${result.versionId}`));
250908
- }
250909
- return {
250910
- outroMessage: `${result.environment} now serves ${result.versionId}`,
250911
- stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
250912
- ` : undefined
250913
- };
250914
- }
250915
- function getPublishCommand() {
250916
- 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);
250917
- }
250918
-
250919
250513
  // src/core/resources/sandbox/schema.ts
250920
250514
  var FileErrorSchema = object({
250921
250515
  code: string2(),
@@ -251301,7 +250895,7 @@ function getSecretsListCommand() {
251301
250895
  }
251302
250896
 
251303
250897
  // src/cli/commands/secrets/set.ts
251304
- import { resolve as resolve14 } from "node:path";
250898
+ import { resolve as resolve12 } from "node:path";
251305
250899
  function parseEntries(entries) {
251306
250900
  const secrets = {};
251307
250901
  for (const entry of entries) {
@@ -251332,7 +250926,7 @@ async function setSecretsAction({ log, runTask }, entries, options) {
251332
250926
  validateInput(entries, options);
251333
250927
  let secrets;
251334
250928
  if (options.envFile) {
251335
- secrets = await parseEnvFile(resolve14(options.envFile));
250929
+ secrets = await parseEnvFile(resolve12(options.envFile));
251336
250930
  if (Object.keys(secrets).length === 0) {
251337
250931
  throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
251338
250932
  }
@@ -251361,7 +250955,7 @@ function getSecretsCommand() {
251361
250955
  }
251362
250956
 
251363
250957
  // src/cli/commands/site/deploy.ts
251364
- import { resolve as resolve15 } from "node:path";
250958
+ import { resolve as resolve13 } from "node:path";
251365
250959
  async function deployAction2(ctx, options) {
251366
250960
  const { isNonInteractive } = ctx;
251367
250961
  if (isNonInteractive && !options.yes) {
@@ -251426,7 +251020,7 @@ async function deployTarball({ runTask }, project) {
251426
251020
  throw new ConfigNotFoundError("No site configuration found.", {
251427
251021
  hints: [
251428
251022
  {
251429
- message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
251023
+ message: `Add a 'site' block to your config.jsonc (e.g., "site": { "outputDirectory": "dist" }). Inside one, outputDirectory defaults to "./dist".`
251430
251024
  }
251431
251025
  ]
251432
251026
  });
@@ -251439,7 +251033,7 @@ async function deployTarball({ runTask }, project) {
251439
251033
  }
251440
251034
  function siteOutputDir(project) {
251441
251035
  const outputDirectory = project.site?.outputDirectory;
251442
- return outputDirectory ? resolve15(project.root, outputDirectory) : null;
251036
+ return outputDirectory ? resolve13(project.root, outputDirectory) : null;
251443
251037
  }
251444
251038
  function getSiteDeployCommand() {
251445
251039
  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)");
@@ -251571,10 +251165,10 @@ function toPascalCase(name) {
251571
251165
  return name.split(/[-_\s]+/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
251572
251166
  }
251573
251167
  // src/core/types/update-project.ts
251574
- import { join as join33 } from "node:path";
251168
+ import { join as join30 } from "node:path";
251575
251169
  var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
251576
251170
  async function updateProjectConfig(projectRoot) {
251577
- const tsconfigPath = join33(projectRoot, "tsconfig.json");
251171
+ const tsconfigPath = join30(projectRoot, "tsconfig.json");
251578
251172
  if (!await pathExists(tsconfigPath)) {
251579
251173
  return false;
251580
251174
  }
@@ -251623,59 +251217,6 @@ function getTypesCommand() {
251623
251217
  return new Command2("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
251624
251218
  }
251625
251219
 
251626
- // src/cli/commands/versions/create.ts
251627
- async function createAction2(ctx, options) {
251628
- const { runTask, jsonMode } = ctx;
251629
- const target = await resolvePublishTarget(requireApp(ctx).projectRoot, {
251630
- outputDir: options.outputDir
251631
- });
251632
- const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
251633
- const version = await runTask("Creating version...", async (updateMessage) => await createVersion(await collectArtifacts(target), {
251634
- sourceCommit: gitHash,
251635
- concurrency: options.concurrency,
251636
- progress: {
251637
- onDeclared: ({ fileCount }) => updateMessage(`Uploading ${fileCount} files`),
251638
- onUpload: ({ uploadedFiles, totalFiles }) => updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} files`)
251639
- }
251640
- }), {
251641
- successMessage: "Version created",
251642
- errorMessage: "Create version failed"
251643
- });
251644
- return {
251645
- outroMessage: `Version ${version.versionId} (${version.manifestHash})`,
251646
- stdout: jsonMode ? `${JSON.stringify(version, null, 2)}
251647
- ` : undefined
251648
- };
251649
- }
251650
- function getVersionCreateCommand() {
251651
- return new Base44Command("create").description("Record the built output as a version, without deploying it").addOption(outputDirOption()).addOption(gitHashOption()).addOption(concurrencyOption()).action(createAction2);
251652
- }
251653
-
251654
- // src/cli/commands/versions/deploy.ts
251655
- import { randomUUID as randomUUID5 } from "node:crypto";
251656
- async function deployAction3({ runTask, jsonMode }, versionId, options) {
251657
- const environment = options.target ?? DEFAULT_ENVIRONMENT;
251658
- const result = await runTask(`Pointing ${environment} at ${versionId}...`, async () => await setEnvironmentVersion(environment, versionId, {
251659
- idempotencyKey: randomUUID5()
251660
- }), {
251661
- successMessage: "Environment updated",
251662
- errorMessage: "Could not update the environment"
251663
- });
251664
- return {
251665
- outroMessage: `${result.name} now serves ${result.versionId}`,
251666
- stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
251667
- ` : undefined
251668
- };
251669
- }
251670
- function getVersionDeployCommand() {
251671
- return new Base44Command("deploy").description("Point an environment at an already-recorded version (also the rollback)").argument("<version-id>", "The version to serve").addOption(targetOption()).action(deployAction3);
251672
- }
251673
-
251674
- // src/cli/commands/versions/index.ts
251675
- function getVersionsCommand() {
251676
- return new Command2("versions").description("Record app versions and serve them").addCommand(getVersionCreateCommand()).addCommand(getVersionDeployCommand());
251677
- }
251678
-
251679
251220
  // src/core/resources/workflow/schema.ts
251680
251221
  var WorkflowRunStatusSchema = _enum([
251681
251222
  "running",
@@ -252092,7 +251633,7 @@ function createDevLogger(label, labelColor = theme.styles.dim) {
252092
251633
  // src/cli/dev/dev-server/main.ts
252093
251634
  var import_cors = __toESM(require_lib4(), 1);
252094
251635
  var import_express6 = __toESM(require_express(), 1);
252095
- import { dirname as dirname27, join as join38 } from "node:path";
251636
+ import { dirname as dirname26, join as join36 } from "node:path";
252096
251637
 
252097
251638
  // ../../node_modules/get-port/index.js
252098
251639
  import net from "node:net";
@@ -252222,7 +251763,7 @@ var $tmpName = promisify11(tmp.tmpName);
252222
251763
 
252223
251764
  // src/cli/dev/dev-server/function-manager.ts
252224
251765
  import { spawn as spawn2 } from "node:child_process";
252225
- import { dirname as dirname24, join as join34 } from "node:path";
251766
+ import { dirname as dirname23, join as join31 } from "node:path";
252226
251767
  import { pathToFileURL } from "node:url";
252227
251768
 
252228
251769
  // src/cli/dev/dev-server/base-function-manager.ts
@@ -252327,7 +251868,7 @@ class FunctionManager extends BaseFunctionManager {
252327
251868
  }
252328
251869
  spawnFunction(func, port) {
252329
251870
  this.logger.log(`Spawning function "${func.name}" on port ${port}`);
252330
- const importMapPath = join34(dirname24(this.wrapperPath), "import-map.json");
251871
+ const importMapPath = join31(dirname23(this.wrapperPath), "import-map.json");
252331
251872
  const process2 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
252332
251873
  env: {
252333
251874
  ...globalThis.process.env,
@@ -252401,7 +251942,7 @@ class FunctionManager extends BaseFunctionManager {
252401
251942
  import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
252402
251943
  import { isBuiltin } from "node:module";
252403
251944
  import { homedir as homedir3 } from "node:os";
252404
- import { join as join35 } from "node:path";
251945
+ import { join as join33 } from "node:path";
252405
251946
  import { pathToFileURL as pathToFileURL6 } from "node:url";
252406
251947
  var depsPromise;
252407
251948
  function loadDeps() {
@@ -252522,9 +252063,9 @@ export default {
252522
252063
  };
252523
252064
  `;
252524
252065
  function ensureBundlerConfig() {
252525
- const dir = join35(homedir3(), ".base44", "function-bundler");
252066
+ const dir = join33(homedir3(), ".base44", "function-bundler");
252526
252067
  mkdirSync2(dir, { recursive: true });
252527
- const configPath = join35(dir, "deno.json");
252068
+ const configPath = join33(dir, "deno.json");
252528
252069
  writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
252529
252070
  `);
252530
252071
  return configPath;
@@ -253905,11 +253446,11 @@ async function createEntityRoutes(db, logger, broadcast) {
253905
253446
  // src/cli/dev/dev-server/routes/integrations.ts
253906
253447
  var import_express5 = __toESM(require_express(), 1);
253907
253448
  var import_multer = __toESM(require_multer(), 1);
253908
- import { createHash as createHash3, randomUUID as randomUUID6 } from "node:crypto";
253449
+ import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
253909
253450
  import fs28 from "node:fs";
253910
253451
  import path18 from "node:path";
253911
253452
  function createFileToken(fileUri) {
253912
- return createHash3("sha256").update(fileUri).digest("hex");
253453
+ return createHash2("sha256").update(fileUri).digest("hex");
253913
253454
  }
253914
253455
  function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
253915
253456
  const router = import_express5.Router({ mergeParams: true });
@@ -253922,14 +253463,14 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
253922
253463
  destination: mediaFilesDir,
253923
253464
  filename: (_req, file, cb) => {
253924
253465
  const ext = path18.extname(file.originalname);
253925
- cb(null, `${randomUUID6()}${ext}`);
253466
+ cb(null, `${randomUUID4()}${ext}`);
253926
253467
  }
253927
253468
  });
253928
253469
  const privateStorage = import_multer.default.diskStorage({
253929
253470
  destination: privateFilesDir,
253930
253471
  filename: (_req, file, cb) => {
253931
253472
  const ext = path18.extname(file.originalname);
253932
- cb(null, `${randomUUID6()}${ext}`);
253473
+ cb(null, `${randomUUID4()}${ext}`);
253933
253474
  }
253934
253475
  });
253935
253476
  const upload = import_multer.default({ storage, limits: { fileSize: MAX_FILE_SIZE } });
@@ -255791,8 +255332,8 @@ async function createDevServer(options) {
255791
255332
  broadcastEntityEvent(io, appId, entityName, event);
255792
255333
  };
255793
255334
  const base44ConfigWatcher = new WatchBase44({
255794
- functions: join38(dirname27(project.configPath), project.functionsDir),
255795
- entities: join38(dirname27(project.configPath), project.entitiesDir)
255335
+ functions: join36(dirname26(project.configPath), project.functionsDir),
255336
+ entities: join36(dirname26(project.configPath), project.entitiesDir)
255796
255337
  }, devLogger);
255797
255338
  base44ConfigWatcher.on("change", async (name) => {
255798
255339
  try {
@@ -256020,7 +255561,7 @@ function startServeCommand(runner, backend) {
256020
255561
  async function remoteDevAction(app) {
256021
255562
  const site = await resolveConfiguredSite(app);
256022
255563
  if (!site) {
256023
- throw new ConfigInvalidError("base44 dev --remote serves the frontend against the production backend, but this project has no site.serveCommand in base44/config.jsonc.");
255564
+ throw new ConfigInvalidError(`base44 dev --remote serves the frontend against the production backend, but this project has no 'site' block in base44/config.jsonc. Add one; inside it serveCommand defaults to "npm run dev".`);
256024
255565
  }
256025
255566
  const appBaseUrl = await getSiteUrl();
256026
255567
  const runner = createServeCommandRunner({
@@ -256189,7 +255730,7 @@ Examples:
256189
255730
  }
256190
255731
 
256191
255732
  // src/cli/commands/project/eject.ts
256192
- import { resolve as resolve19 } from "node:path";
255733
+ import { resolve as resolve17 } from "node:path";
256193
255734
  var import_kebabCase2 = __toESM(require_kebabCase(), 1);
256194
255735
  async function eject(ctx, options, command) {
256195
255736
  const { log, runTask, isNonInteractive } = ctx;
@@ -256253,7 +255794,7 @@ async function eject(ctx, options, command) {
256253
255794
  Ne("Operation cancelled.");
256254
255795
  throw new CLIExitError(0);
256255
255796
  }
256256
- const resolvedPath = resolve19(selectedPath);
255797
+ const resolvedPath = resolve17(selectedPath);
256257
255798
  await runTask("Downloading your project's code...", async (updateMessage) => {
256258
255799
  await createProjectFilesForExistingProject({
256259
255800
  projectId,
@@ -256337,10 +255878,6 @@ function createProgram(context) {
256337
255878
  program.addCommand(getBranchesCommand());
256338
255879
  program.addCommand(getAuthCommand());
256339
255880
  program.addCommand(getSiteCommand());
256340
- if (versionsApiEnabled()) {
256341
- program.addCommand(getPublishCommand());
256342
- program.addCommand(getVersionsCommand());
256343
- }
256344
255881
  program.addCommand(getTypesCommand());
256345
255882
  program.addCommand(getExecCommand());
256346
255883
  program.addCommand(getDevCommand());
@@ -256353,7 +255890,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
256353
255890
  import { release, type } from "node:os";
256354
255891
 
256355
255892
  // ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
256356
- import { dirname as dirname28, posix, sep as sep2 } from "path";
255893
+ import { dirname as dirname27, posix, sep as sep2 } from "path";
256357
255894
  function createModulerModifier() {
256358
255895
  const getModuleFromFileName = createGetModuleFromFilename();
256359
255896
  return async (frames) => {
@@ -256362,7 +255899,7 @@ function createModulerModifier() {
256362
255899
  return frames;
256363
255900
  };
256364
255901
  }
256365
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname28(process.argv[1]) : process.cwd(), isWindows = sep2 === "\\") {
255902
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname27(process.argv[1]) : process.cwd(), isWindows = sep2 === "\\") {
256366
255903
  const normalizedBase = isWindows ? normalizeWindowsPath2(basePath) : basePath;
256367
255904
  return (filename) => {
256368
255905
  if (!filename)
@@ -260351,9 +259888,9 @@ function addCommandInfoToErrorReporter(program, errorReporter) {
260351
259888
  });
260352
259889
  }
260353
259890
  // src/cli/index.ts
260354
- var __dirname4 = dirname29(fileURLToPath6(import.meta.url));
259891
+ var __dirname4 = dirname28(fileURLToPath6(import.meta.url));
260355
259892
  async function runCLI(options) {
260356
- ensureNpmAssets(join39(__dirname4, "../assets"));
259893
+ ensureNpmAssets(join37(__dirname4, "../assets"));
260357
259894
  const errorReporter = new ErrorReporter;
260358
259895
  errorReporter.registerProcessErrorHandlers();
260359
259896
  const jsonMode = process.argv.includes("--json");
@@ -260392,4 +259929,4 @@ export {
260392
259929
  runCLI
260393
259930
  };
260394
259931
 
260395
- //# debugId=45EEED102FF0084464756E2164756E21
259932
+ //# debugId=E2C8B2D4450DEEB964756E2164756E21