@base44-preview/cli 0.1.8-pr.580.d80a0ce → 0.1.8-pr.584.ae3c2f4

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
@@ -23352,15 +23352,15 @@ var require_windows = __commonJS((exports, module) => {
23352
23352
  }
23353
23353
  return false;
23354
23354
  }
23355
- function checkStat(stat2, path11, options) {
23356
- if (!stat2.isSymbolicLink() && !stat2.isFile()) {
23355
+ function checkStat(stat3, path11, options) {
23356
+ if (!stat3.isSymbolicLink() && !stat3.isFile()) {
23357
23357
  return false;
23358
23358
  }
23359
23359
  return checkPathExt(path11, options);
23360
23360
  }
23361
23361
  function isexe(path11, options, cb) {
23362
- fs14.stat(path11, function(er, stat2) {
23363
- cb(er, er ? false : checkStat(stat2, path11, options));
23362
+ fs14.stat(path11, function(er, stat3) {
23363
+ cb(er, er ? false : checkStat(stat3, path11, options));
23364
23364
  });
23365
23365
  }
23366
23366
  function sync(path11, options) {
@@ -23374,20 +23374,20 @@ var require_mode = __commonJS((exports, module) => {
23374
23374
  isexe.sync = sync;
23375
23375
  var fs14 = __require("fs");
23376
23376
  function isexe(path11, options, cb) {
23377
- fs14.stat(path11, function(er, stat2) {
23378
- cb(er, er ? false : checkStat(stat2, options));
23377
+ fs14.stat(path11, function(er, stat3) {
23378
+ cb(er, er ? false : checkStat(stat3, options));
23379
23379
  });
23380
23380
  }
23381
23381
  function sync(path11, options) {
23382
23382
  return checkStat(fs14.statSync(path11), options);
23383
23383
  }
23384
- function checkStat(stat2, options) {
23385
- return stat2.isFile() && checkMode(stat2, options);
23384
+ function checkStat(stat3, options) {
23385
+ return stat3.isFile() && checkMode(stat3, options);
23386
23386
  }
23387
- function checkMode(stat2, options) {
23388
- var mod = stat2.mode;
23389
- var uid = stat2.uid;
23390
- var gid = stat2.gid;
23387
+ function checkMode(stat3, options) {
23388
+ var mod = stat3.mode;
23389
+ var uid = stat3.uid;
23390
+ var gid = stat3.gid;
23391
23391
  var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
23392
23392
  var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
23393
23393
  var u = parseInt("100", 8);
@@ -23419,12 +23419,12 @@ var require_isexe = __commonJS((exports, module) => {
23419
23419
  if (typeof Promise !== "function") {
23420
23420
  throw new TypeError("callback not provided");
23421
23421
  }
23422
- return new Promise(function(resolve4, reject) {
23422
+ return new Promise(function(resolve5, reject) {
23423
23423
  isexe(path11, options || {}, function(er, is) {
23424
23424
  if (er) {
23425
23425
  reject(er);
23426
23426
  } else {
23427
- resolve4(is);
23427
+ resolve5(is);
23428
23428
  }
23429
23429
  });
23430
23430
  });
@@ -23486,27 +23486,27 @@ var require_which = __commonJS((exports, module) => {
23486
23486
  opt = {};
23487
23487
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
23488
23488
  const found = [];
23489
- const step = (i) => new Promise((resolve4, reject) => {
23489
+ const step = (i) => new Promise((resolve5, reject) => {
23490
23490
  if (i === pathEnv.length)
23491
- return opt.all && found.length ? resolve4(found) : reject(getNotFoundError(cmd));
23491
+ return opt.all && found.length ? resolve5(found) : reject(getNotFoundError(cmd));
23492
23492
  const ppRaw = pathEnv[i];
23493
23493
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
23494
23494
  const pCmd = path11.join(pathPart, cmd);
23495
23495
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
23496
- resolve4(subStep(p, i, 0));
23496
+ resolve5(subStep(p, i, 0));
23497
23497
  });
23498
- const subStep = (p, i, ii) => new Promise((resolve4, reject) => {
23498
+ const subStep = (p, i, ii) => new Promise((resolve5, reject) => {
23499
23499
  if (ii === pathExt.length)
23500
- return resolve4(step(i + 1));
23500
+ return resolve5(step(i + 1));
23501
23501
  const ext = pathExt[ii];
23502
23502
  isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
23503
23503
  if (!er && is) {
23504
23504
  if (opt.all)
23505
23505
  found.push(p + ext);
23506
23506
  else
23507
- return resolve4(p + ext);
23507
+ return resolve5(p + ext);
23508
23508
  }
23509
- return resolve4(subStep(p, i, ii + 1));
23509
+ return resolve5(subStep(p, i, ii + 1));
23510
23510
  });
23511
23511
  });
23512
23512
  return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
@@ -27034,7 +27034,7 @@ var require_lodash8 = __commonJS((exports, module) => {
27034
27034
  }
27035
27035
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
27036
27036
  });
27037
- function join17(array2, separator) {
27037
+ function join18(array2, separator) {
27038
27038
  return array2 == null ? "" : nativeJoin.call(array2, separator);
27039
27039
  }
27040
27040
  function last(array2) {
@@ -28966,7 +28966,7 @@ __p += '`;
28966
28966
  lodash.isUndefined = isUndefined;
28967
28967
  lodash.isWeakMap = isWeakMap;
28968
28968
  lodash.isWeakSet = isWeakSet;
28969
- lodash.join = join17;
28969
+ lodash.join = join18;
28970
28970
  lodash.kebabCase = kebabCase;
28971
28971
  lodash.last = last;
28972
28972
  lodash.lastIndexOf = lastIndexOf;
@@ -31176,7 +31176,7 @@ function cleanDoc(doc2) {
31176
31176
  return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
31177
31177
  }
31178
31178
  function replaceEndOfLine(doc2, replacement = literalline) {
31179
- return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join26(replacement, currentDoc.split(`
31179
+ return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join27(replacement, currentDoc.split(`
31180
31180
  `)) : currentDoc);
31181
31181
  }
31182
31182
  function canBreakFn(doc2) {
@@ -31256,7 +31256,7 @@ function indentIfBreak(contents, options) {
31256
31256
  negate: options.negate
31257
31257
  };
31258
31258
  }
31259
- function join26(separator, docs) {
31259
+ function join27(separator, docs) {
31260
31260
  assertDoc(separator);
31261
31261
  assertDocArray(docs);
31262
31262
  const parts = [];
@@ -31967,7 +31967,7 @@ var init_doc = __esm(() => {
31967
31967
  MODE_FLAT = Symbol("MODE_FLAT");
31968
31968
  DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
31969
31969
  builders = {
31970
- join: join26,
31970
+ join: join27,
31971
31971
  line,
31972
31972
  softline,
31973
31973
  hardline,
@@ -120385,7 +120385,7 @@ function skipVoid(str, ptr, banNewLines, banComments) {
120385
120385
  ptr++;
120386
120386
  return banComments || c24 !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
120387
120387
  }
120388
- function skipUntil(str, ptr, sep, end, banNewLines = false) {
120388
+ function skipUntil(str, ptr, sep2, end, banNewLines = false) {
120389
120389
  if (!end) {
120390
120390
  ptr = indexOfNewline(str, ptr);
120391
120391
  return ptr < 0 ? str.length : ptr;
@@ -120394,7 +120394,7 @@ function skipUntil(str, ptr, sep, end, banNewLines = false) {
120394
120394
  let c24 = str[i5];
120395
120395
  if (c24 === "#") {
120396
120396
  i5 = indexOfNewline(str, i5);
120397
- } else if (c24 === sep) {
120397
+ } else if (c24 === sep2) {
120398
120398
  return i5 + 1;
120399
120399
  } else if (c24 === end || banNewLines && (c24 === `
120400
120400
  ` || c24 === "\r" && str[i5 + 1] === `
@@ -121174,7 +121174,7 @@ function getDataProtocolModuleFormat(parsed) {
121174
121174
  const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(parsed.pathname) || [null, null, null];
121175
121175
  return mimeToFormat(mime);
121176
121176
  }
121177
- function extname(url3) {
121177
+ function extname2(url3) {
121178
121178
  const pathname = url3.pathname;
121179
121179
  let index = pathname.length;
121180
121180
  while (index--) {
@@ -121189,7 +121189,7 @@ function extname(url3) {
121189
121189
  return "";
121190
121190
  }
121191
121191
  function getFileProtocolModuleFormat(url3, _context, ignoreErrors) {
121192
- const value = extname(url3);
121192
+ const value = extname2(url3);
121193
121193
  if (value === ".js") {
121194
121194
  const packageType = getPackageType(url3);
121195
121195
  if (packageType !== "none") {
@@ -123904,14 +123904,14 @@ async function printToDoc(originalText, options8) {
123904
123904
  async function printDocToString2(doc2, options8) {
123905
123905
  return printDocToStringWithoutNormalizeOptions(doc2, await normalize_format_options_default(options8));
123906
123906
  }
123907
- function createParsersAndPrinters(modules) {
123907
+ function createParsersAndPrinters(modules2) {
123908
123908
  const parsers2 = /* @__PURE__ */ Object.create(null);
123909
123909
  const printers2 = /* @__PURE__ */ Object.create(null);
123910
123910
  for (const {
123911
123911
  importPlugin: importPlugin2,
123912
123912
  parsers: parserNames = [],
123913
123913
  printers: printerNames = []
123914
- } of modules) {
123914
+ } of modules2) {
123915
123915
  const loadPlugin2 = async () => {
123916
123916
  const plugin = await importPlugin2();
123917
123917
  Object.assign(parsers2, plugin.parsers);
@@ -136881,7 +136881,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
136881
136881
  return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
136882
136882
  }
136883
136883
  function replaceEndOfLine2(doc2, replacement = literalline2) {
136884
- return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join28(replacement, currentDoc.split(`
136884
+ return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join29(replacement, currentDoc.split(`
136885
136885
  `)) : currentDoc);
136886
136886
  }
136887
136887
  function canBreakFn2(doc2) {
@@ -136967,7 +136967,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
136967
136967
  negate: options8.negate
136968
136968
  };
136969
136969
  }
136970
- function join28(separator, docs) {
136970
+ function join29(separator, docs) {
136971
136971
  assertDoc2(separator);
136972
136972
  assertDocArray2(docs);
136973
136973
  const parts = [];
@@ -137632,7 +137632,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
137632
137632
  }
137633
137633
  }
137634
137634
  var builders2 = {
137635
- join: join28,
137635
+ join: join29,
137636
137636
  line: line3,
137637
137637
  softline: softline2,
137638
137638
  hardline: hardline4,
@@ -138287,11 +138287,11 @@ var require_prettier = __commonJS((exports, module) => {
138287
138287
  var require_formatter = __commonJS((exports) => {
138288
138288
  var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
138289
138289
  function adopt(value) {
138290
- return value instanceof P9 ? value : new P9(function(resolve13) {
138291
- resolve13(value);
138290
+ return value instanceof P9 ? value : new P9(function(resolve15) {
138291
+ resolve15(value);
138292
138292
  });
138293
138293
  }
138294
- return new (P9 || (P9 = Promise))(function(resolve13, reject) {
138294
+ return new (P9 || (P9 = Promise))(function(resolve15, reject) {
138295
138295
  function fulfilled(value) {
138296
138296
  try {
138297
138297
  step(generator.next(value));
@@ -138307,7 +138307,7 @@ var require_formatter = __commonJS((exports) => {
138307
138307
  }
138308
138308
  }
138309
138309
  function step(result) {
138310
- result.done ? resolve13(result.value) : adopt(result.value).then(fulfilled, rejected);
138310
+ result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
138311
138311
  }
138312
138312
  step((generator = generator.apply(thisArg, _arguments || [])).next());
138313
138313
  });
@@ -142960,7 +142960,7 @@ var require_url = __commonJS((exports) => {
142960
142960
  };
142961
142961
  Object.defineProperty(exports, "__esModule", { value: true });
142962
142962
  exports.parse = undefined;
142963
- exports.resolve = resolve13;
142963
+ exports.resolve = resolve15;
142964
142964
  exports.cwd = cwd;
142965
142965
  exports.getProtocol = getProtocol;
142966
142966
  exports.getExtension = getExtension;
@@ -142972,7 +142972,7 @@ var require_url = __commonJS((exports) => {
142972
142972
  exports.fromFileSystemPath = fromFileSystemPath;
142973
142973
  exports.toFileSystemPath = toFileSystemPath;
142974
142974
  exports.safePointerToPath = safePointerToPath;
142975
- exports.relative = relative4;
142975
+ exports.relative = relative5;
142976
142976
  var convert_path_to_posix_1 = __importDefault(require_convert_path_to_posix());
142977
142977
  var path_1 = __importStar(__require("path"));
142978
142978
  var forwardSlashPattern = /\//g;
@@ -142988,7 +142988,7 @@ var require_url = __commonJS((exports) => {
142988
142988
  var urlDecodePatterns = [/%23/g, "#", /%24/g, "$", /%26/g, "&", /%2C/g, ",", /%40/g, "@"];
142989
142989
  var parse11 = (u4) => new URL(u4);
142990
142990
  exports.parse = parse11;
142991
- function resolve13(from, to5) {
142991
+ function resolve15(from, to5) {
142992
142992
  const fromUrl = new URL((0, convert_path_to_posix_1.default)(from), "https://aaa.nonexistanturl.com");
142993
142993
  const resolvedUrl = new URL((0, convert_path_to_posix_1.default)(to5), fromUrl);
142994
142994
  const endSpaces = to5.match(/(\s*)$/)?.[1] || "";
@@ -143122,9 +143122,9 @@ var require_url = __commonJS((exports) => {
143122
143122
  return decodeURIComponent(value).replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
143123
143123
  });
143124
143124
  }
143125
- function relative4(from, to5) {
143125
+ function relative5(from, to5) {
143126
143126
  if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
143127
- return resolve13(from, to5);
143127
+ return resolve15(from, to5);
143128
143128
  }
143129
143129
  const fromDir = path_1.default.dirname(stripHash(from));
143130
143130
  const toPath4 = stripHash(to5);
@@ -143800,7 +143800,7 @@ var require_plugins = __commonJS((exports) => {
143800
143800
  let plugin;
143801
143801
  let lastError;
143802
143802
  let index = 0;
143803
- return new Promise((resolve13, reject) => {
143803
+ return new Promise((resolve15, reject) => {
143804
143804
  runNextPlugin();
143805
143805
  function runNextPlugin() {
143806
143806
  plugin = plugins[index++];
@@ -143828,7 +143828,7 @@ var require_plugins = __commonJS((exports) => {
143828
143828
  }
143829
143829
  }
143830
143830
  function onSuccess(result) {
143831
- resolve13({
143831
+ resolve15({
143832
143832
  plugin,
143833
143833
  result
143834
143834
  });
@@ -145161,11 +145161,11 @@ var require_lib3 = __commonJS((exports) => {
145161
145161
  var require_resolver = __commonJS((exports) => {
145162
145162
  var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
145163
145163
  function adopt(value) {
145164
- return value instanceof P9 ? value : new P9(function(resolve13) {
145165
- resolve13(value);
145164
+ return value instanceof P9 ? value : new P9(function(resolve15) {
145165
+ resolve15(value);
145166
145166
  });
145167
145167
  }
145168
- return new (P9 || (P9 = Promise))(function(resolve13, reject) {
145168
+ return new (P9 || (P9 = Promise))(function(resolve15, reject) {
145169
145169
  function fulfilled(value) {
145170
145170
  try {
145171
145171
  step(generator.next(value));
@@ -145181,7 +145181,7 @@ var require_resolver = __commonJS((exports) => {
145181
145181
  }
145182
145182
  }
145183
145183
  function step(result) {
145184
- result.done ? resolve13(result.value) : adopt(result.value).then(fulfilled, rejected);
145184
+ result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
145185
145185
  }
145186
145186
  step((generator = generator.apply(thisArg, _arguments || [])).next());
145187
145187
  });
@@ -145302,11 +145302,11 @@ var require_optionValidator = __commonJS((exports) => {
145302
145302
  var require_src3 = __commonJS((exports) => {
145303
145303
  var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
145304
145304
  function adopt(value) {
145305
- return value instanceof P9 ? value : new P9(function(resolve13) {
145306
- resolve13(value);
145305
+ return value instanceof P9 ? value : new P9(function(resolve15) {
145306
+ resolve15(value);
145307
145307
  });
145308
145308
  }
145309
- return new (P9 || (P9 = Promise))(function(resolve13, reject) {
145309
+ return new (P9 || (P9 = Promise))(function(resolve15, reject) {
145310
145310
  function fulfilled(value) {
145311
145311
  try {
145312
145312
  step(generator.next(value));
@@ -145322,7 +145322,7 @@ var require_src3 = __commonJS((exports) => {
145322
145322
  }
145323
145323
  }
145324
145324
  function step(result) {
145325
- result.done ? resolve13(result.value) : adopt(result.value).then(fulfilled, rejected);
145325
+ result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
145326
145326
  }
145327
145327
  step((generator = generator.apply(thisArg, _arguments || [])).next());
145328
145328
  });
@@ -146451,7 +146451,7 @@ var require_depd = __commonJS((exports, module) => {
146451
146451
  * Copyright(c) 2014-2018 Douglas Christopher Wilson
146452
146452
  * MIT Licensed
146453
146453
  */
146454
- var relative4 = __require("path").relative;
146454
+ var relative5 = __require("path").relative;
146455
146455
  module.exports = depd;
146456
146456
  var basePath = process.cwd();
146457
146457
  function containsNamespace(str, namespace) {
@@ -146647,7 +146647,7 @@ var require_depd = __commonJS((exports, module) => {
146647
146647
  return formatted;
146648
146648
  }
146649
146649
  function formatLocation(callSite) {
146650
- return relative4(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
146650
+ return relative5(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
146651
146651
  }
146652
146652
  function getStack() {
146653
146653
  var limit = Error.stackTraceLimit;
@@ -150643,7 +150643,7 @@ var require_dbcs_data = __commonJS((exports, module) => {
150643
150643
  // ../../node_modules/iconv-lite/encodings/index.js
150644
150644
  var require_encodings = __commonJS((exports, module) => {
150645
150645
  var mergeModules = require_merge_exports();
150646
- var modules = [
150646
+ var modules2 = [
150647
150647
  require_internal(),
150648
150648
  require_utf32(),
150649
150649
  require_utf16(),
@@ -150654,8 +150654,8 @@ var require_encodings = __commonJS((exports, module) => {
150654
150654
  require_dbcs_codec(),
150655
150655
  require_dbcs_data()
150656
150656
  ];
150657
- for (i5 = 0;i5 < modules.length; i5++) {
150658
- module = modules[i5];
150657
+ for (i5 = 0;i5 < modules2.length; i5++) {
150658
+ module = modules2[i5];
150659
150659
  mergeModules(exports, module);
150660
150660
  }
150661
150661
  var module;
@@ -150984,11 +150984,11 @@ var require_raw_body = __commonJS((exports, module) => {
150984
150984
  if (done) {
150985
150985
  return readStream(stream, encoding, length, limit, wrap(done));
150986
150986
  }
150987
- return new Promise(function executor(resolve13, reject) {
150987
+ return new Promise(function executor(resolve15, reject) {
150988
150988
  readStream(stream, encoding, length, limit, function onRead2(err, buf) {
150989
150989
  if (err)
150990
150990
  return reject(err);
150991
- resolve13(buf);
150991
+ resolve15(buf);
150992
150992
  });
150993
150993
  });
150994
150994
  }
@@ -160792,7 +160792,7 @@ var require_mime_types = __commonJS((exports) => {
160792
160792
  * MIT Licensed
160793
160793
  */
160794
160794
  var db2 = require_db();
160795
- var extname2 = __require("path").extname;
160795
+ var extname3 = __require("path").extname;
160796
160796
  var mimeScore = require_mimeScore();
160797
160797
  var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
160798
160798
  var TEXT_TYPE_REGEXP = /^text\//i;
@@ -160849,7 +160849,7 @@ var require_mime_types = __commonJS((exports) => {
160849
160849
  if (!path18 || typeof path18 !== "string") {
160850
160850
  return false;
160851
160851
  }
160852
- var extension2 = extname2("x." + path18).toLowerCase().slice(1);
160852
+ var extension2 = extname3("x." + path18).toLowerCase().slice(1);
160853
160853
  if (!extension2) {
160854
160854
  return false;
160855
160855
  }
@@ -164109,16 +164109,16 @@ var require_view = __commonJS((exports, module) => {
164109
164109
  var debug = require_src4()("express:view");
164110
164110
  var path18 = __require("node:path");
164111
164111
  var fs28 = __require("node:fs");
164112
- var dirname20 = path18.dirname;
164112
+ var dirname21 = path18.dirname;
164113
164113
  var basename7 = path18.basename;
164114
- var extname2 = path18.extname;
164115
- var join29 = path18.join;
164116
- var resolve13 = path18.resolve;
164114
+ var extname3 = path18.extname;
164115
+ var join30 = path18.join;
164116
+ var resolve15 = path18.resolve;
164117
164117
  module.exports = View;
164118
164118
  function View(name2, options8) {
164119
164119
  var opts = options8 || {};
164120
164120
  this.defaultEngine = opts.defaultEngine;
164121
- this.ext = extname2(name2);
164121
+ this.ext = extname3(name2);
164122
164122
  this.name = name2;
164123
164123
  this.root = opts.root;
164124
164124
  if (!this.ext && !this.defaultEngine) {
@@ -164147,8 +164147,8 @@ var require_view = __commonJS((exports, module) => {
164147
164147
  debug('lookup "%s"', name2);
164148
164148
  for (var i5 = 0;i5 < roots.length && !path19; i5++) {
164149
164149
  var root2 = roots[i5];
164150
- var loc = resolve13(root2, name2);
164151
- var dir = dirname20(loc);
164150
+ var loc = resolve15(root2, name2);
164151
+ var dir = dirname21(loc);
164152
164152
  var file2 = basename7(loc);
164153
164153
  path19 = this.resolve(dir, file2);
164154
164154
  }
@@ -164172,16 +164172,16 @@ var require_view = __commonJS((exports, module) => {
164172
164172
  });
164173
164173
  sync = false;
164174
164174
  };
164175
- View.prototype.resolve = function resolve14(dir, file2) {
164175
+ View.prototype.resolve = function resolve16(dir, file2) {
164176
164176
  var ext = this.ext;
164177
- var path19 = join29(dir, file2);
164178
- var stat3 = tryStat(path19);
164179
- if (stat3 && stat3.isFile()) {
164177
+ var path19 = join30(dir, file2);
164178
+ var stat4 = tryStat(path19);
164179
+ if (stat4 && stat4.isFile()) {
164180
164180
  return path19;
164181
164181
  }
164182
- path19 = join29(dir, basename7(file2, ext), "index" + ext);
164183
- stat3 = tryStat(path19);
164184
- if (stat3 && stat3.isFile()) {
164182
+ path19 = join30(dir, basename7(file2, ext), "index" + ext);
164183
+ stat4 = tryStat(path19);
164184
+ if (stat4 && stat4.isFile()) {
164185
164185
  return path19;
164186
164186
  }
164187
164187
  };
@@ -164232,9 +164232,9 @@ var require_etag = __commonJS((exports, module) => {
164232
164232
  }
164233
164233
  return obj && typeof obj === "object" && "ctime" in obj && toString2.call(obj.ctime) === "[object Date]" && "mtime" in obj && toString2.call(obj.mtime) === "[object Date]" && "ino" in obj && typeof obj.ino === "number" && "size" in obj && typeof obj.size === "number";
164234
164234
  }
164235
- function stattag(stat3) {
164236
- var mtime = stat3.mtime.getTime().toString(16);
164237
- var size = stat3.size.toString(16);
164235
+ function stattag(stat4) {
164236
+ var mtime = stat4.mtime.getTime().toString(16);
164237
+ var size = stat4.size.toString(16);
164238
164238
  return '"' + size + "-" + mtime + '"';
164239
164239
  }
164240
164240
  });
@@ -166331,7 +166331,7 @@ var require_application = __commonJS((exports, module) => {
166331
166331
  var compileETag = require_utils10().compileETag;
166332
166332
  var compileQueryParser = require_utils10().compileQueryParser;
166333
166333
  var compileTrust = require_utils10().compileTrust;
166334
- var resolve13 = __require("node:path").resolve;
166334
+ var resolve15 = __require("node:path").resolve;
166335
166335
  var once9 = require_once();
166336
166336
  var Router = require_router();
166337
166337
  var slice = Array.prototype.slice;
@@ -166385,7 +166385,7 @@ var require_application = __commonJS((exports, module) => {
166385
166385
  this.mountpath = "/";
166386
166386
  this.locals.settings = this.settings;
166387
166387
  this.set("view", View);
166388
- this.set("views", resolve13("views"));
166388
+ this.set("views", resolve15("views"));
166389
166389
  this.set("jsonp callback name", "callback");
166390
166390
  if (env4 === "production") {
166391
166391
  this.enable("view cache");
@@ -167873,11 +167873,11 @@ var require_send = __commonJS((exports, module) => {
167873
167873
  var statuses = require_statuses();
167874
167874
  var Stream2 = __require("stream");
167875
167875
  var util2 = __require("util");
167876
- var extname2 = path18.extname;
167877
- var join29 = path18.join;
167876
+ var extname3 = path18.extname;
167877
+ var join30 = path18.join;
167878
167878
  var normalize2 = path18.normalize;
167879
- var resolve13 = path18.resolve;
167880
- var sep = path18.sep;
167879
+ var resolve15 = path18.resolve;
167880
+ var sep2 = path18.sep;
167881
167881
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
167882
167882
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000;
167883
167883
  var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
@@ -167905,7 +167905,7 @@ var require_send = __commonJS((exports, module) => {
167905
167905
  this._maxage = opts.maxAge || opts.maxage;
167906
167906
  this._maxage = typeof this._maxage === "string" ? ms9(this._maxage) : Number(this._maxage);
167907
167907
  this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
167908
- this._root = opts.root ? resolve13(opts.root) : null;
167908
+ this._root = opts.root ? resolve15(opts.root) : null;
167909
167909
  }
167910
167910
  util2.inherits(SendStream, Stream2);
167911
167911
  SendStream.prototype.error = function error48(status, err) {
@@ -168038,23 +168038,23 @@ var require_send = __commonJS((exports, module) => {
168038
168038
  var parts;
168039
168039
  if (root2 !== null) {
168040
168040
  if (path19) {
168041
- path19 = normalize2("." + sep + path19);
168041
+ path19 = normalize2("." + sep2 + path19);
168042
168042
  }
168043
168043
  if (UP_PATH_REGEXP.test(path19)) {
168044
168044
  debug('malicious path "%s"', path19);
168045
168045
  this.error(403);
168046
168046
  return res;
168047
168047
  }
168048
- parts = path19.split(sep);
168049
- path19 = normalize2(join29(root2, path19));
168048
+ parts = path19.split(sep2);
168049
+ path19 = normalize2(join30(root2, path19));
168050
168050
  } else {
168051
168051
  if (UP_PATH_REGEXP.test(path19)) {
168052
168052
  debug('malicious path "%s"', path19);
168053
168053
  this.error(403);
168054
168054
  return res;
168055
168055
  }
168056
- parts = normalize2(path19).split(sep);
168057
- path19 = resolve13(path19);
168056
+ parts = normalize2(path19).split(sep2);
168057
+ path19 = resolve15(path19);
168058
168058
  }
168059
168059
  if (containsDotFile(parts)) {
168060
168060
  debug('%s dotfile "%s"', this._dotfiles, path19);
@@ -168077,8 +168077,8 @@ var require_send = __commonJS((exports, module) => {
168077
168077
  this.sendFile(path19);
168078
168078
  return res;
168079
168079
  };
168080
- SendStream.prototype.send = function send2(path19, stat3) {
168081
- var len = stat3.size;
168080
+ SendStream.prototype.send = function send2(path19, stat4) {
168081
+ var len = stat4.size;
168082
168082
  var options8 = this.options;
168083
168083
  var opts = {};
168084
168084
  var res = this.res;
@@ -168090,7 +168090,7 @@ var require_send = __commonJS((exports, module) => {
168090
168090
  return;
168091
168091
  }
168092
168092
  debug('pipe "%s"', path19);
168093
- this.setHeader(path19, stat3);
168093
+ this.setHeader(path19, stat4);
168094
168094
  this.type(path19);
168095
168095
  if (this.isConditionalGET()) {
168096
168096
  if (this.isPreconditionFailure()) {
@@ -168147,19 +168147,19 @@ var require_send = __commonJS((exports, module) => {
168147
168147
  var i5 = 0;
168148
168148
  var self2 = this;
168149
168149
  debug('stat "%s"', path19);
168150
- fs28.stat(path19, function onstat(err, stat3) {
168151
- var pathEndsWithSep = path19[path19.length - 1] === sep;
168152
- if (err && err.code === "ENOENT" && !extname2(path19) && !pathEndsWithSep) {
168150
+ fs28.stat(path19, function onstat(err, stat4) {
168151
+ var pathEndsWithSep = path19[path19.length - 1] === sep2;
168152
+ if (err && err.code === "ENOENT" && !extname3(path19) && !pathEndsWithSep) {
168153
168153
  return next(err);
168154
168154
  }
168155
168155
  if (err)
168156
168156
  return self2.onStatError(err);
168157
- if (stat3.isDirectory())
168157
+ if (stat4.isDirectory())
168158
168158
  return self2.redirect(path19);
168159
168159
  if (pathEndsWithSep)
168160
168160
  return self2.error(404);
168161
- self2.emit("file", path19, stat3);
168162
- self2.send(path19, stat3);
168161
+ self2.emit("file", path19, stat4);
168162
+ self2.send(path19, stat4);
168163
168163
  });
168164
168164
  function next(err) {
168165
168165
  if (self2._extensions.length <= i5) {
@@ -168167,13 +168167,13 @@ var require_send = __commonJS((exports, module) => {
168167
168167
  }
168168
168168
  var p4 = path19 + "." + self2._extensions[i5++];
168169
168169
  debug('stat "%s"', p4);
168170
- fs28.stat(p4, function(err2, stat3) {
168170
+ fs28.stat(p4, function(err2, stat4) {
168171
168171
  if (err2)
168172
168172
  return next(err2);
168173
- if (stat3.isDirectory())
168173
+ if (stat4.isDirectory())
168174
168174
  return next();
168175
- self2.emit("file", p4, stat3);
168176
- self2.send(p4, stat3);
168175
+ self2.emit("file", p4, stat4);
168176
+ self2.send(p4, stat4);
168177
168177
  });
168178
168178
  }
168179
168179
  };
@@ -168186,15 +168186,15 @@ var require_send = __commonJS((exports, module) => {
168186
168186
  return self2.onStatError(err);
168187
168187
  return self2.error(404);
168188
168188
  }
168189
- var p4 = join29(path19, self2._index[i5]);
168189
+ var p4 = join30(path19, self2._index[i5]);
168190
168190
  debug('stat "%s"', p4);
168191
- fs28.stat(p4, function(err2, stat3) {
168191
+ fs28.stat(p4, function(err2, stat4) {
168192
168192
  if (err2)
168193
168193
  return next(err2);
168194
- if (stat3.isDirectory())
168194
+ if (stat4.isDirectory())
168195
168195
  return next();
168196
- self2.emit("file", p4, stat3);
168197
- self2.send(p4, stat3);
168196
+ self2.emit("file", p4, stat4);
168197
+ self2.send(p4, stat4);
168198
168198
  });
168199
168199
  }
168200
168200
  next();
@@ -168221,14 +168221,14 @@ var require_send = __commonJS((exports, module) => {
168221
168221
  var res = this.res;
168222
168222
  if (res.getHeader("Content-Type"))
168223
168223
  return;
168224
- var ext = extname2(path19);
168224
+ var ext = extname3(path19);
168225
168225
  var type2 = mime.contentType(ext) || "application/octet-stream";
168226
168226
  debug("content-type %s", type2);
168227
168227
  res.setHeader("Content-Type", type2);
168228
168228
  };
168229
- SendStream.prototype.setHeader = function setHeader(path19, stat3) {
168229
+ SendStream.prototype.setHeader = function setHeader(path19, stat4) {
168230
168230
  var res = this.res;
168231
- this.emit("headers", res, path19, stat3);
168231
+ this.emit("headers", res, path19, stat4);
168232
168232
  if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
168233
168233
  debug("accept ranges");
168234
168234
  res.setHeader("Accept-Ranges", "bytes");
@@ -168242,12 +168242,12 @@ var require_send = __commonJS((exports, module) => {
168242
168242
  res.setHeader("Cache-Control", cacheControl);
168243
168243
  }
168244
168244
  if (this._lastModified && !res.getHeader("Last-Modified")) {
168245
- var modified = stat3.mtime.toUTCString();
168245
+ var modified = stat4.mtime.toUTCString();
168246
168246
  debug("modified %s", modified);
168247
168247
  res.setHeader("Last-Modified", modified);
168248
168248
  }
168249
168249
  if (this._etag && !res.getHeader("ETag")) {
168250
- var val = etag(stat3);
168250
+ var val = etag(stat4);
168251
168251
  debug("etag %s", val);
168252
168252
  res.setHeader("ETag", val);
168253
168253
  }
@@ -168381,8 +168381,8 @@ var require_response = __commonJS((exports, module) => {
168381
168381
  var setCharset = require_utils10().setCharset;
168382
168382
  var cookie = require_cookie();
168383
168383
  var send = require_send();
168384
- var extname2 = path18.extname;
168385
- var resolve13 = path18.resolve;
168384
+ var extname3 = path18.extname;
168385
+ var resolve15 = path18.resolve;
168386
168386
  var vary = require_vary();
168387
168387
  var { Buffer: Buffer7 } = __require("node:buffer");
168388
168388
  var res = Object.create(http.ServerResponse.prototype);
@@ -168591,7 +168591,7 @@ var require_response = __commonJS((exports, module) => {
168591
168591
  }
168592
168592
  opts = Object.create(opts);
168593
168593
  opts.headers = headers;
168594
- var fullPath = !opts.root ? resolve13(path19) : path19;
168594
+ var fullPath = !opts.root ? resolve15(path19) : path19;
168595
168595
  return this.sendFile(fullPath, opts, done);
168596
168596
  };
168597
168597
  res.contentType = res.type = function contentType(type) {
@@ -168622,7 +168622,7 @@ var require_response = __commonJS((exports, module) => {
168622
168622
  };
168623
168623
  res.attachment = function attachment(filename) {
168624
168624
  if (filename) {
168625
- this.type(extname2(filename));
168625
+ this.type(extname3(filename));
168626
168626
  }
168627
168627
  this.set("Content-Disposition", contentDisposition(filename));
168628
168628
  return this;
@@ -168852,7 +168852,7 @@ var require_serve_static = __commonJS((exports, module) => {
168852
168852
  var encodeUrl = require_encodeurl();
168853
168853
  var escapeHtml = require_escape_html();
168854
168854
  var parseUrl = require_parseurl();
168855
- var resolve13 = __require("path").resolve;
168855
+ var resolve15 = __require("path").resolve;
168856
168856
  var send = require_send();
168857
168857
  var url3 = __require("url");
168858
168858
  module.exports = serveStatic;
@@ -168871,7 +168871,7 @@ var require_serve_static = __commonJS((exports, module) => {
168871
168871
  throw new TypeError("option setHeaders must be function");
168872
168872
  }
168873
168873
  opts.maxage = opts.maxage || opts.maxAge || 0;
168874
- opts.root = resolve13(root2);
168874
+ opts.root = resolve15(root2);
168875
168875
  var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
168876
168876
  return function serveStatic2(req, res, next) {
168877
168877
  if (req.method !== "GET" && req.method !== "HEAD") {
@@ -169795,8 +169795,8 @@ var require_follow_redirects = __commonJS((exports, module) => {
169795
169795
  }
169796
169796
  return parsed;
169797
169797
  }
169798
- function resolveUrl(relative4, base) {
169799
- return useNativeURL ? new URL2(relative4, base) : parseUrl(url3.resolve(base, relative4));
169798
+ function resolveUrl(relative5, base) {
169799
+ return useNativeURL ? new URL2(relative5, base) : parseUrl(url3.resolve(base, relative5));
169800
169800
  }
169801
169801
  function validateUrl(input) {
169802
169802
  if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
@@ -172245,8 +172245,8 @@ var require_executor = __commonJS((exports, module) => {
172245
172245
  }
172246
172246
  resetBuffer() {
172247
172247
  this.buffer = new Waterfall;
172248
- this.buffer.chain(new Promise((resolve13) => {
172249
- this._triggerBuffer = resolve13;
172248
+ this.buffer.chain(new Promise((resolve15) => {
172249
+ this._triggerBuffer = resolve15;
172250
172250
  }));
172251
172251
  if (this.ready)
172252
172252
  this._triggerBuffer();
@@ -173266,7 +173266,7 @@ var require_storage = __commonJS((exports, module) => {
173266
173266
  throw e8;
173267
173267
  }
173268
173268
  };
173269
- var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve13, reject) => {
173269
+ var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve15, reject) => {
173270
173270
  try {
173271
173271
  const stream = writeFileStream(filename, { mode });
173272
173272
  const readable2 = Readable6.from(lines);
@@ -173283,7 +173283,7 @@ var require_storage = __commonJS((exports, module) => {
173283
173283
  if (err)
173284
173284
  reject(err);
173285
173285
  else
173286
- resolve13();
173286
+ resolve15();
173287
173287
  });
173288
173288
  });
173289
173289
  readable2.on("error", (err) => {
@@ -173454,7 +173454,7 @@ var require_persistence = __commonJS((exports, module) => {
173454
173454
  return { data: tdata, indexes };
173455
173455
  }
173456
173456
  treatRawStreamAsync(rawStream) {
173457
- return new Promise((resolve13, reject) => {
173457
+ return new Promise((resolve15, reject) => {
173458
173458
  const dataById = {};
173459
173459
  const indexes = {};
173460
173460
  let corruptItems = 0;
@@ -173497,7 +173497,7 @@ var require_persistence = __commonJS((exports, module) => {
173497
173497
  }
173498
173498
  }
173499
173499
  const data = Object.values(dataById);
173500
- resolve13({ data, indexes });
173500
+ resolve15({ data, indexes });
173501
173501
  });
173502
173502
  lineStream.on("error", function(err) {
173503
173503
  reject(err, null);
@@ -183030,7 +183030,7 @@ var require_mime_types2 = __commonJS((exports) => {
183030
183030
  * MIT Licensed
183031
183031
  */
183032
183032
  var db2 = require_db2();
183033
- var extname2 = __require("path").extname;
183033
+ var extname3 = __require("path").extname;
183034
183034
  var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
183035
183035
  var TEXT_TYPE_REGEXP = /^text\//i;
183036
183036
  exports.charset = charset;
@@ -183085,7 +183085,7 @@ var require_mime_types2 = __commonJS((exports) => {
183085
183085
  if (!path18 || typeof path18 !== "string") {
183086
183086
  return false;
183087
183087
  }
183088
- var extension2 = extname2("x." + path18).toLowerCase().substr(1);
183088
+ var extension2 = extname3("x." + path18).toLowerCase().substr(1);
183089
183089
  if (!extension2) {
183090
183090
  return false;
183091
183091
  }
@@ -193077,7 +193077,7 @@ var require_mime_types3 = __commonJS((exports) => {
193077
193077
  * MIT Licensed
193078
193078
  */
193079
193079
  var db2 = require_db3();
193080
- var extname2 = __require("path").extname;
193080
+ var extname3 = __require("path").extname;
193081
193081
  var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
193082
193082
  var TEXT_TYPE_REGEXP = /^text\//i;
193083
193083
  exports.charset = charset;
@@ -193132,7 +193132,7 @@ var require_mime_types3 = __commonJS((exports) => {
193132
193132
  if (!path18 || typeof path18 !== "string") {
193133
193133
  return false;
193134
193134
  }
193135
- var extension2 = extname2("x." + path18).toLowerCase().substr(1);
193135
+ var extension2 = extname3("x." + path18).toLowerCase().substr(1);
193136
193136
  if (!extension2) {
193137
193137
  return false;
193138
193138
  }
@@ -199108,13 +199108,13 @@ var require_broadcast_operator = __commonJS((exports) => {
199108
199108
  return true;
199109
199109
  }
199110
199110
  emitWithAck(ev2, ...args) {
199111
- return new Promise((resolve13, reject) => {
199111
+ return new Promise((resolve15, reject) => {
199112
199112
  args.push((err, responses) => {
199113
199113
  if (err) {
199114
199114
  err.responses = responses;
199115
199115
  return reject(err);
199116
199116
  } else {
199117
- return resolve13(responses);
199117
+ return resolve15(responses);
199118
199118
  }
199119
199119
  });
199120
199120
  this.emit(ev2, ...args);
@@ -199302,12 +199302,12 @@ var require_socket2 = __commonJS((exports) => {
199302
199302
  }
199303
199303
  emitWithAck(ev2, ...args) {
199304
199304
  const withErr = this.flags.timeout !== undefined;
199305
- return new Promise((resolve13, reject) => {
199305
+ return new Promise((resolve15, reject) => {
199306
199306
  args.push((arg1, arg2) => {
199307
199307
  if (withErr) {
199308
- return arg1 ? reject(arg1) : resolve13(arg2);
199308
+ return arg1 ? reject(arg1) : resolve15(arg2);
199309
199309
  } else {
199310
- return resolve13(arg1);
199310
+ return resolve15(arg1);
199311
199311
  }
199312
199312
  });
199313
199313
  this.emit(ev2, ...args);
@@ -199762,13 +199762,13 @@ var require_namespace = __commonJS((exports) => {
199762
199762
  return true;
199763
199763
  }
199764
199764
  serverSideEmitWithAck(ev2, ...args) {
199765
- return new Promise((resolve13, reject) => {
199765
+ return new Promise((resolve15, reject) => {
199766
199766
  args.push((err, responses) => {
199767
199767
  if (err) {
199768
199768
  err.responses = responses;
199769
199769
  return reject(err);
199770
199770
  } else {
199771
- return resolve13(responses);
199771
+ return resolve15(responses);
199772
199772
  }
199773
199773
  });
199774
199774
  this.serverSideEmit(ev2, ...args);
@@ -203303,7 +203303,7 @@ var require_cluster_adapter = __commonJS((exports) => {
203303
203303
  return localSockets;
203304
203304
  }
203305
203305
  const requestId = randomId();
203306
- return new Promise((resolve13, reject) => {
203306
+ return new Promise((resolve15, reject) => {
203307
203307
  const timeout3 = setTimeout(() => {
203308
203308
  const storedRequest2 = this.requests.get(requestId);
203309
203309
  if (storedRequest2) {
@@ -203313,7 +203313,7 @@ var require_cluster_adapter = __commonJS((exports) => {
203313
203313
  }, opts.flags.timeout || DEFAULT_TIMEOUT);
203314
203314
  const storedRequest = {
203315
203315
  type: MessageType.FETCH_SOCKETS,
203316
- resolve: resolve13,
203316
+ resolve: resolve15,
203317
203317
  timeout: timeout3,
203318
203318
  current: 0,
203319
203319
  expected: expectedResponseCount,
@@ -203523,7 +203523,7 @@ var require_cluster_adapter = __commonJS((exports) => {
203523
203523
  return localSockets;
203524
203524
  }
203525
203525
  const requestId = randomId();
203526
- return new Promise((resolve13, reject) => {
203526
+ return new Promise((resolve15, reject) => {
203527
203527
  const timeout3 = setTimeout(() => {
203528
203528
  const storedRequest2 = this.customRequests.get(requestId);
203529
203529
  if (storedRequest2) {
@@ -203533,7 +203533,7 @@ var require_cluster_adapter = __commonJS((exports) => {
203533
203533
  }, opts.flags.timeout || DEFAULT_TIMEOUT);
203534
203534
  const storedRequest = {
203535
203535
  type: MessageType.FETCH_SOCKETS,
203536
- resolve: resolve13,
203536
+ resolve: resolve15,
203537
203537
  timeout: timeout3,
203538
203538
  missingUids: new Set([...this.nodesMap.keys()]),
203539
203539
  responses: localSockets
@@ -204262,13 +204262,13 @@ var require_dist4 = __commonJS((exports, module) => {
204262
204262
  this.engine.close();
204263
204263
  (0, uws_1.restoreAdapter)();
204264
204264
  if (this.httpServer) {
204265
- return new Promise((resolve13) => {
204265
+ return new Promise((resolve15) => {
204266
204266
  this.httpServer.close((err) => {
204267
204267
  fn9 && fn9(err);
204268
204268
  if (err) {
204269
204269
  debug("server was not running");
204270
204270
  }
204271
- resolve13();
204271
+ resolve15();
204272
204272
  });
204273
204273
  });
204274
204274
  } else {
@@ -213004,7 +213004,7 @@ var require_mime_types4 = __commonJS((exports) => {
213004
213004
  * MIT Licensed
213005
213005
  */
213006
213006
  var db2 = require_db4();
213007
- var extname2 = __require("path").extname;
213007
+ var extname3 = __require("path").extname;
213008
213008
  var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
213009
213009
  var TEXT_TYPE_REGEXP = /^text\//i;
213010
213010
  exports.charset = charset;
@@ -213059,7 +213059,7 @@ var require_mime_types4 = __commonJS((exports) => {
213059
213059
  if (!path18 || typeof path18 !== "string") {
213060
213060
  return false;
213061
213061
  }
213062
- var extension2 = extname2("x." + path18).toLowerCase().substr(1);
213062
+ var extension2 = extname3("x." + path18).toLowerCase().substr(1);
213063
213063
  if (!extension2) {
213064
213064
  return false;
213065
213065
  }
@@ -217391,8 +217391,8 @@ var require_mkdirp = __commonJS((exports, module) => {
217391
217391
  });
217392
217392
  break;
217393
217393
  default:
217394
- xfs.stat(p4, function(er22, stat3) {
217395
- if (er22 || !stat3.isDirectory())
217394
+ xfs.stat(p4, function(er22, stat4) {
217395
+ if (er22 || !stat4.isDirectory())
217396
217396
  cb2(er10, made);
217397
217397
  else
217398
217398
  cb2(null, made);
@@ -217423,13 +217423,13 @@ var require_mkdirp = __commonJS((exports, module) => {
217423
217423
  sync(p4, opts, made);
217424
217424
  break;
217425
217425
  default:
217426
- var stat3;
217426
+ var stat4;
217427
217427
  try {
217428
- stat3 = xfs.statSync(p4);
217428
+ stat4 = xfs.statSync(p4);
217429
217429
  } catch (err1) {
217430
217430
  throw err0;
217431
217431
  }
217432
- if (!stat3.isDirectory())
217432
+ if (!stat4.isDirectory())
217433
217433
  throw err0;
217434
217434
  break;
217435
217435
  }
@@ -217632,7 +217632,7 @@ var require_buffer_list = __commonJS((exports, module) => {
217632
217632
  }
217633
217633
  }, {
217634
217634
  key: "join",
217635
- value: function join31(s5) {
217635
+ value: function join33(s5) {
217636
217636
  if (this.length === 0)
217637
217637
  return "";
217638
217638
  var p4 = this.head;
@@ -218930,14 +218930,14 @@ var require_async_iterator = __commonJS((exports, module) => {
218930
218930
  };
218931
218931
  }
218932
218932
  function readAndResolve(iter) {
218933
- var resolve13 = iter[kLastResolve];
218934
- if (resolve13 !== null) {
218933
+ var resolve15 = iter[kLastResolve];
218934
+ if (resolve15 !== null) {
218935
218935
  var data = iter[kStream].read();
218936
218936
  if (data !== null) {
218937
218937
  iter[kLastPromise] = null;
218938
218938
  iter[kLastResolve] = null;
218939
218939
  iter[kLastReject] = null;
218940
- resolve13(createIterResult(data, false));
218940
+ resolve15(createIterResult(data, false));
218941
218941
  }
218942
218942
  }
218943
218943
  }
@@ -218945,13 +218945,13 @@ var require_async_iterator = __commonJS((exports, module) => {
218945
218945
  process.nextTick(readAndResolve, iter);
218946
218946
  }
218947
218947
  function wrapForNext(lastPromise, iter) {
218948
- return function(resolve13, reject) {
218948
+ return function(resolve15, reject) {
218949
218949
  lastPromise.then(function() {
218950
218950
  if (iter[kEnded]) {
218951
- resolve13(createIterResult(undefined, true));
218951
+ resolve15(createIterResult(undefined, true));
218952
218952
  return;
218953
218953
  }
218954
- iter[kHandlePromise](resolve13, reject);
218954
+ iter[kHandlePromise](resolve15, reject);
218955
218955
  }, reject);
218956
218956
  };
218957
218957
  }
@@ -218970,12 +218970,12 @@ var require_async_iterator = __commonJS((exports, module) => {
218970
218970
  return Promise.resolve(createIterResult(undefined, true));
218971
218971
  }
218972
218972
  if (this[kStream].destroyed) {
218973
- return new Promise(function(resolve13, reject) {
218973
+ return new Promise(function(resolve15, reject) {
218974
218974
  process.nextTick(function() {
218975
218975
  if (_this[kError]) {
218976
218976
  reject(_this[kError]);
218977
218977
  } else {
218978
- resolve13(createIterResult(undefined, true));
218978
+ resolve15(createIterResult(undefined, true));
218979
218979
  }
218980
218980
  });
218981
218981
  });
@@ -218998,13 +218998,13 @@ var require_async_iterator = __commonJS((exports, module) => {
218998
218998
  return this;
218999
218999
  }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
219000
219000
  var _this2 = this;
219001
- return new Promise(function(resolve13, reject) {
219001
+ return new Promise(function(resolve15, reject) {
219002
219002
  _this2[kStream].destroy(null, function(err) {
219003
219003
  if (err) {
219004
219004
  reject(err);
219005
219005
  return;
219006
219006
  }
219007
- resolve13(createIterResult(undefined, true));
219007
+ resolve15(createIterResult(undefined, true));
219008
219008
  });
219009
219009
  });
219010
219010
  }), _Object$setPrototypeO), AsyncIteratorPrototype);
@@ -219026,15 +219026,15 @@ var require_async_iterator = __commonJS((exports, module) => {
219026
219026
  value: stream._readableState.endEmitted,
219027
219027
  writable: true
219028
219028
  }), _defineProperty(_Object$create, kHandlePromise, {
219029
- value: function value(resolve13, reject) {
219029
+ value: function value(resolve15, reject) {
219030
219030
  var data = iterator[kStream].read();
219031
219031
  if (data) {
219032
219032
  iterator[kLastPromise] = null;
219033
219033
  iterator[kLastResolve] = null;
219034
219034
  iterator[kLastReject] = null;
219035
- resolve13(createIterResult(data, false));
219035
+ resolve15(createIterResult(data, false));
219036
219036
  } else {
219037
- iterator[kLastResolve] = resolve13;
219037
+ iterator[kLastResolve] = resolve15;
219038
219038
  iterator[kLastReject] = reject;
219039
219039
  }
219040
219040
  },
@@ -219053,12 +219053,12 @@ var require_async_iterator = __commonJS((exports, module) => {
219053
219053
  iterator[kError] = err;
219054
219054
  return;
219055
219055
  }
219056
- var resolve13 = iterator[kLastResolve];
219057
- if (resolve13 !== null) {
219056
+ var resolve15 = iterator[kLastResolve];
219057
+ if (resolve15 !== null) {
219058
219058
  iterator[kLastPromise] = null;
219059
219059
  iterator[kLastResolve] = null;
219060
219060
  iterator[kLastReject] = null;
219061
- resolve13(createIterResult(undefined, true));
219061
+ resolve15(createIterResult(undefined, true));
219062
219062
  }
219063
219063
  iterator[kEnded] = true;
219064
219064
  });
@@ -219070,7 +219070,7 @@ var require_async_iterator = __commonJS((exports, module) => {
219070
219070
 
219071
219071
  // ../../node_modules/readable-stream/lib/internal/streams/from.js
219072
219072
  var require_from = __commonJS((exports, module) => {
219073
- function asyncGeneratorStep(gen, resolve13, reject, _next, _throw, key2, arg) {
219073
+ function asyncGeneratorStep(gen, resolve15, reject, _next, _throw, key2, arg) {
219074
219074
  try {
219075
219075
  var info = gen[key2](arg);
219076
219076
  var value = info.value;
@@ -219079,7 +219079,7 @@ var require_from = __commonJS((exports, module) => {
219079
219079
  return;
219080
219080
  }
219081
219081
  if (info.done) {
219082
- resolve13(value);
219082
+ resolve15(value);
219083
219083
  } else {
219084
219084
  Promise.resolve(value).then(_next, _throw);
219085
219085
  }
@@ -219087,13 +219087,13 @@ var require_from = __commonJS((exports, module) => {
219087
219087
  function _asyncToGenerator(fn9) {
219088
219088
  return function() {
219089
219089
  var self2 = this, args = arguments;
219090
- return new Promise(function(resolve13, reject) {
219090
+ return new Promise(function(resolve15, reject) {
219091
219091
  var gen = fn9.apply(self2, args);
219092
219092
  function _next(value) {
219093
- asyncGeneratorStep(gen, resolve13, reject, _next, _throw, "next", value);
219093
+ asyncGeneratorStep(gen, resolve15, reject, _next, _throw, "next", value);
219094
219094
  }
219095
219095
  function _throw(err) {
219096
- asyncGeneratorStep(gen, resolve13, reject, _next, _throw, "throw", err);
219096
+ asyncGeneratorStep(gen, resolve15, reject, _next, _throw, "throw", err);
219097
219097
  }
219098
219098
  _next(undefined);
219099
219099
  });
@@ -221220,7 +221220,7 @@ var require_dist5 = __commonJS((exports, module) => {
221220
221220
  determineAgent: () => determineAgent
221221
221221
  });
221222
221222
  module.exports = __toCommonJS2(src_exports);
221223
- var import_promises25 = __require("node:fs/promises");
221223
+ var import_promises26 = __require("node:fs/promises");
221224
221224
  var import_node_fs24 = __require("node:fs");
221225
221225
  var DEVIN_LOCAL_PATH = "/opt/.devin";
221226
221226
  var CURSOR2 = "cursor";
@@ -221278,7 +221278,7 @@ var require_dist5 = __commonJS((exports, module) => {
221278
221278
  return { isAgent: true, agent: { name: REPLIT } };
221279
221279
  }
221280
221280
  try {
221281
- await (0, import_promises25.access)(DEVIN_LOCAL_PATH, import_node_fs24.constants.F_OK);
221281
+ await (0, import_promises26.access)(DEVIN_LOCAL_PATH, import_node_fs24.constants.F_OK);
221282
221282
  return { isAgent: true, agent: { name: DEVIN } };
221283
221283
  } catch (error48) {}
221284
221284
  return { isAgent: false, agent: undefined };
@@ -237840,7 +237840,7 @@ function normalizeBase44Env() {
237840
237840
  loadProjectEnvFiles();
237841
237841
 
237842
237842
  // src/cli/index.ts
237843
- import { dirname as dirname25, join as join36 } from "node:path";
237843
+ import { dirname as dirname26, join as join37 } from "node:path";
237844
237844
  import { fileURLToPath as fileURLToPath6 } from "node:url";
237845
237845
 
237846
237846
  // ../../node_modules/@clack/core/dist/index.mjs
@@ -239048,7 +239048,7 @@ var {
239048
239048
  } = import__.default;
239049
239049
 
239050
239050
  // src/cli/commands/agent-skills/pull.ts
239051
- import { dirname as dirname10, join as join17 } from "node:path";
239051
+ import { dirname as dirname11, join as join18 } from "node:path";
239052
239052
  // ../../node_modules/chalk/source/vendor/ansi-styles/index.js
239053
239053
  var ANSI_BACKGROUND_OFFSET = 10;
239054
239054
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
@@ -245663,18 +245663,26 @@ var PublishedUrlResponseSchema = exports_external.object({
245663
245663
  });
245664
245664
  var CreateDeploymentResponseSchema = exports_external.object({
245665
245665
  deployment_id: exports_external.string(),
245666
- asset_uploads: exports_external.object({
245667
- type: exports_external.literal("s3"),
245668
- uploads: exports_external.array(exports_external.object({
245669
- path: exports_external.string(),
245670
- content_type: exports_external.string(),
245671
- content_length: exports_external.number(),
245672
- url: exports_external.string()
245673
- }))
245674
- }).nullable().optional()
245666
+ asset_uploads: exports_external.discriminatedUnion("type", [
245667
+ exports_external.object({
245668
+ type: exports_external.literal("cf"),
245669
+ url: exports_external.string(),
245670
+ jwt: exports_external.string(),
245671
+ buckets: exports_external.array(exports_external.array(exports_external.string()))
245672
+ }),
245673
+ exports_external.object({
245674
+ type: exports_external.literal("s3"),
245675
+ uploads: exports_external.array(exports_external.object({
245676
+ path: exports_external.string(),
245677
+ content_type: exports_external.string(),
245678
+ content_length: exports_external.number(),
245679
+ url: exports_external.string()
245680
+ }))
245681
+ })
245682
+ ]).nullable().optional()
245675
245683
  }).transform((data) => ({
245676
245684
  deploymentId: data.deployment_id,
245677
- assetUploads: data.asset_uploads == null ? null : {
245685
+ assetUploads: data.asset_uploads == null ? null : data.asset_uploads.type === "cf" ? data.asset_uploads : {
245678
245686
  type: "s3",
245679
245687
  uploads: data.asset_uploads.uploads.map((upload) => ({
245680
245688
  path: upload.path,
@@ -245684,6 +245692,9 @@ var CreateDeploymentResponseSchema = exports_external.object({
245684
245692
  }))
245685
245693
  }
245686
245694
  }));
245695
+ var AssetUploadResponseSchema = exports_external.looseObject({
245696
+ result: exports_external.looseObject({ jwt: exports_external.string().nullable().optional() }).nullable().optional()
245697
+ });
245687
245698
  var FinalizeDeploymentResponseSchema = exports_external.object({
245688
245699
  deployment_id: exports_external.string()
245689
245700
  }).transform((data) => ({
@@ -248259,7 +248270,7 @@ async function createProjectFilesForExistingProject(options) {
248259
248270
  };
248260
248271
  }
248261
248272
  // src/core/project/deploy.ts
248262
- import { resolve as resolve3 } from "node:path";
248273
+ import { resolve as resolve6 } from "node:path";
248263
248274
 
248264
248275
  // src/core/site/api.ts
248265
248276
  async function uploadSite(archivePath) {
@@ -248283,6 +248294,13 @@ async function uploadSite(archivePath) {
248283
248294
  }
248284
248295
  return result.data;
248285
248296
  }
248297
+ var MODULE_CONTENT_TYPES = {
248298
+ esm: "application/javascript+module",
248299
+ sourcemap: "application/source-map",
248300
+ wasm: "application/wasm",
248301
+ text: "text/plain",
248302
+ data: "application/octet-stream"
248303
+ };
248286
248304
  async function createDeployment(request) {
248287
248305
  const appClient = getAppClient();
248288
248306
  let response;
@@ -248300,6 +248318,29 @@ async function createDeployment(request) {
248300
248318
  }
248301
248319
  return result.data;
248302
248320
  }
248321
+ async function uploadAssetBucket(target, formData) {
248322
+ const response = await distribution_default.post(target.url, {
248323
+ searchParams: { base64: "true" },
248324
+ headers: { Authorization: `Bearer ${target.jwt}` },
248325
+ body: formData,
248326
+ timeout: 120000,
248327
+ retry: 0
248328
+ });
248329
+ const parsed = AssetUploadResponseSchema.safeParse(await response.json());
248330
+ const jwt3 = parsed.success ? parsed.data.result?.jwt : null;
248331
+ return jwt3 || null;
248332
+ }
248333
+ async function finalizeDeployment(deploymentId, completionJwt, modules) {
248334
+ const formData = new FormData;
248335
+ formData.append("payload", JSON.stringify({ completion_jwt: completionJwt }));
248336
+ for (const module of modules) {
248337
+ const content = await readFile(module.absolutePath);
248338
+ formData.append(module.name, new File([new Uint8Array(content)], module.name, {
248339
+ type: MODULE_CONTENT_TYPES[module.type]
248340
+ }));
248341
+ }
248342
+ return await postFinalize(deploymentId, formData);
248343
+ }
248303
248344
  async function finalizeStaticDeployment(deploymentId, indexHtml) {
248304
248345
  const formData = new FormData;
248305
248346
  formData.append("index.html", new File([indexHtml], "index.html", { type: "text/html" }));
@@ -248335,9 +248376,7 @@ async function deploySite(siteOutputDir) {
248335
248376
  if (!await pathExists(siteOutputDir)) {
248336
248377
  throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
248337
248378
  hints: [
248338
- {
248339
- message: "Run 'base44 build' first (it injects your app id; a bare 'npm run build' does not)"
248340
- }
248379
+ { message: "Run your build command (e.g., 'npm run build') first" }
248341
248380
  ]
248342
248381
  });
248343
248382
  }
@@ -248345,9 +248384,7 @@ async function deploySite(siteOutputDir) {
248345
248384
  if (filePaths.length === 0) {
248346
248385
  throw new ConfigInvalidError(`No files found in output directory: ${siteOutputDir}. Make sure to build your project first.`, siteOutputDir, {
248347
248386
  hints: [
248348
- {
248349
- message: "Run 'base44 build' first (it injects your app id; a bare 'npm run build' does not)"
248350
- }
248387
+ { message: "Run your build command (e.g., 'npm run build') first" }
248351
248388
  ]
248352
248389
  });
248353
248390
  }
@@ -248366,10 +248403,13 @@ async function createArchive(pathToArchive, targetArchivePath) {
248366
248403
  cwd: pathToArchive
248367
248404
  }, ["."]);
248368
248405
  }
248406
+ // src/core/site/deploy-app.ts
248407
+ import { resolve as resolve5 } from "node:path";
248408
+
248369
248409
  // src/core/site/manifest.ts
248370
248410
  import { createHash } from "node:crypto";
248371
248411
  import { readFile as readFile2, stat } from "node:fs/promises";
248372
- import { basename as basename4, join as join15 } from "node:path";
248412
+ import { basename as basename4, extname, join as join15 } from "node:path";
248373
248413
  var MAX_ASSET_SIZE_BYTES = 25 * 1024 * 1024;
248374
248414
  var MAX_ASSET_COUNT = 1e5;
248375
248415
  var ASSETS_IGNORE_FILE = ".assetsignore";
@@ -248378,6 +248418,39 @@ var ALWAYS_IGNORED = new Set([
248378
248418
  "wrangler.json",
248379
248419
  ".dev.vars"
248380
248420
  ]);
248421
+ var MIME_TYPES = {
248422
+ ".html": "text/html",
248423
+ ".htm": "text/html",
248424
+ ".css": "text/css",
248425
+ ".js": "text/javascript",
248426
+ ".mjs": "text/javascript",
248427
+ ".json": "application/json",
248428
+ ".map": "application/json",
248429
+ ".txt": "text/plain",
248430
+ ".xml": "application/xml",
248431
+ ".svg": "image/svg+xml",
248432
+ ".png": "image/png",
248433
+ ".jpg": "image/jpeg",
248434
+ ".jpeg": "image/jpeg",
248435
+ ".gif": "image/gif",
248436
+ ".webp": "image/webp",
248437
+ ".avif": "image/avif",
248438
+ ".ico": "image/x-icon",
248439
+ ".woff": "font/woff",
248440
+ ".woff2": "font/woff2",
248441
+ ".ttf": "font/ttf",
248442
+ ".otf": "font/otf",
248443
+ ".eot": "application/vnd.ms-fontobject",
248444
+ ".mp3": "audio/mpeg",
248445
+ ".mp4": "video/mp4",
248446
+ ".webm": "video/webm",
248447
+ ".pdf": "application/pdf",
248448
+ ".wasm": "application/wasm",
248449
+ ".webmanifest": "application/manifest+json"
248450
+ };
248451
+ function getAssetContentType(filePath) {
248452
+ return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
248453
+ }
248381
248454
  function hashAsset(appId, content) {
248382
248455
  return createHash("sha256").update(Buffer.from(appId, "utf8")).update(content).digest("hex").slice(0, 32);
248383
248456
  }
@@ -248405,14 +248478,111 @@ async function buildAssetManifest(assetsDir, appId) {
248405
248478
  const hash2 = hashAsset(appId, content);
248406
248479
  manifest[`/${relativePath}`] = { hash: hash2, size };
248407
248480
  if (!filesByHash.has(hash2)) {
248408
- filesByHash.set(hash2, { absolutePath, hash: hash2, size });
248481
+ filesByHash.set(hash2, {
248482
+ absolutePath,
248483
+ hash: hash2,
248484
+ size,
248485
+ contentType: getAssetContentType(absolutePath)
248486
+ });
248409
248487
  }
248410
248488
  }
248411
248489
  return { manifest, filesByHash };
248412
248490
  }
248413
- // src/core/site/static-site.ts
248414
- import { readFile as readFile4 } from "node:fs/promises";
248415
- import { join as join16 } from "node:path";
248491
+
248492
+ // src/core/site/modules.ts
248493
+ import { stat as stat2 } from "node:fs/promises";
248494
+ import { relative as relative3, resolve as resolve3, sep } from "node:path";
248495
+ var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
248496
+ var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
248497
+ var RULE_TYPE_TO_MODULE_TYPE = {
248498
+ ESModule: "esm",
248499
+ CompiledWasm: "wasm",
248500
+ Text: "text",
248501
+ Data: "data"
248502
+ };
248503
+ function toPosix(path11) {
248504
+ return path11.split(sep).join("/");
248505
+ }
248506
+ async function collectModules(config9) {
248507
+ const entryPath = resolve3(config9.configDir, config9.main);
248508
+ if (!await pathExists(entryPath)) {
248509
+ throw new InvalidInputError(`Worker entry module does not exist: ${entryPath} (from "main" in ${config9.configPath})`, {
248510
+ hints: [{ message: "Rebuild the project to regenerate the artifact" }]
248511
+ });
248512
+ }
248513
+ const modulesByName = new Map;
248514
+ const entryName = toPosix(relative3(config9.configDir, entryPath));
248515
+ modulesByName.set(entryName, {
248516
+ name: entryName,
248517
+ absolutePath: entryPath,
248518
+ size: 0,
248519
+ type: "esm"
248520
+ });
248521
+ const ignore = [...MODULE_IGNORE];
248522
+ if (config9.assetsDirectory?.startsWith(config9.configDir + sep)) {
248523
+ ignore.push(`${toPosix(relative3(config9.configDir, config9.assetsDirectory))}/**`);
248524
+ }
248525
+ for (const rule of config9.rules) {
248526
+ const type = RULE_TYPE_TO_MODULE_TYPE[rule.type];
248527
+ if (!type) {
248528
+ throw new InvalidInputError(`Unsupported module rule type "${rule.type}" in ${config9.configPath}. Supported: ${Object.keys(RULE_TYPE_TO_MODULE_TYPE).join(", ")}.`);
248529
+ }
248530
+ const matches = await globby(rule.globs, {
248531
+ cwd: config9.configDir,
248532
+ onlyFiles: true,
248533
+ dot: true,
248534
+ ignore
248535
+ });
248536
+ for (const match of matches.sort()) {
248537
+ if (!modulesByName.has(match)) {
248538
+ modulesByName.set(match, {
248539
+ name: match,
248540
+ absolutePath: resolve3(config9.configDir, match),
248541
+ size: 0,
248542
+ type
248543
+ });
248544
+ }
248545
+ }
248546
+ }
248547
+ if (config9.uploadSourceMaps) {
248548
+ const maps = await globby("**/*.map", {
248549
+ cwd: config9.configDir,
248550
+ onlyFiles: true,
248551
+ dot: true,
248552
+ ignore
248553
+ });
248554
+ for (const map2 of maps.sort()) {
248555
+ addSourcemap(modulesByName, config9.configDir, map2);
248556
+ }
248557
+ } else {
248558
+ for (const name2 of [...modulesByName.keys()]) {
248559
+ const mapName = `${name2}.map`;
248560
+ if (await pathExists(resolve3(config9.configDir, mapName))) {
248561
+ addSourcemap(modulesByName, config9.configDir, mapName);
248562
+ }
248563
+ }
248564
+ }
248565
+ const modules = [...modulesByName.values()];
248566
+ let totalBytes = 0;
248567
+ for (const module of modules) {
248568
+ module.size = (await stat2(module.absolutePath)).size;
248569
+ totalBytes += module.size;
248570
+ }
248571
+ if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
248572
+ throw new InvalidInputError(`Worker modules total ${totalBytes} bytes, which exceeds the 40 MB limit for Base44 full-stack deploys.`);
248573
+ }
248574
+ return modules;
248575
+ }
248576
+ function addSourcemap(modulesByName, configDir, name2) {
248577
+ if (modulesByName.has(name2))
248578
+ return;
248579
+ modulesByName.set(name2, {
248580
+ name: name2,
248581
+ absolutePath: resolve3(configDir, name2),
248582
+ size: 0,
248583
+ type: "sourcemap"
248584
+ });
248585
+ }
248416
248586
 
248417
248587
  // src/core/site/upload.ts
248418
248588
  import { readFile as readFile3 } from "node:fs/promises";
@@ -248448,7 +248618,7 @@ async function pMap(iterable, mapper, {
248448
248618
  const cleanup = () => {
248449
248619
  signal?.removeEventListener("abort", signalListener);
248450
248620
  };
248451
- const resolve3 = (value) => {
248621
+ const resolve4 = (value) => {
248452
248622
  resolve_(value);
248453
248623
  cleanup();
248454
248624
  };
@@ -248481,7 +248651,7 @@ async function pMap(iterable, mapper, {
248481
248651
  }
248482
248652
  isResolved = true;
248483
248653
  if (skippedIndexesMap.size === 0) {
248484
- resolve3(result);
248654
+ resolve4(result);
248485
248655
  return;
248486
248656
  }
248487
248657
  const pureResult = [];
@@ -248491,7 +248661,7 @@ async function pMap(iterable, mapper, {
248491
248661
  }
248492
248662
  pureResult.push(value);
248493
248663
  }
248494
- resolve3(pureResult);
248664
+ resolve4(pureResult);
248495
248665
  }
248496
248666
  return;
248497
248667
  }
@@ -248546,6 +248716,64 @@ var DEFAULT_UPLOAD_CONCURRENCY = 3;
248546
248716
  var MAX_UPLOAD_CONCURRENCY = 50;
248547
248717
  var MAX_UPLOAD_ATTEMPTS = 3;
248548
248718
  var RETRY_BASE_DELAY_MS = 500;
248719
+ var MAX_RATE_LIMIT_WAITS = 10;
248720
+ var RATE_LIMIT_DELAY_MS = 15000;
248721
+ async function uploadAssetBuckets(target, filesByHash, options = {}) {
248722
+ const { concurrency = DEFAULT_UPLOAD_CONCURRENCY, onProgress } = options;
248723
+ const { buckets } = target;
248724
+ const totalFiles = buckets.reduce((sum, bucket) => sum + bucket.length, 0);
248725
+ let uploadedFiles = 0;
248726
+ let completionJwt = null;
248727
+ await pMap(buckets, async (bucket) => {
248728
+ const jwt3 = await uploadBucketWithRetry(target, bucket, filesByHash);
248729
+ if (jwt3) {
248730
+ completionJwt = jwt3;
248731
+ }
248732
+ uploadedFiles += bucket.length;
248733
+ onProgress?.({ uploadedFiles, totalFiles });
248734
+ }, { concurrency });
248735
+ if (!completionJwt) {
248736
+ throw new ApiError("Asset upload finished but the server did not return a completion token.");
248737
+ }
248738
+ return completionJwt;
248739
+ }
248740
+ async function uploadBucketWithRetry(target, bucket, filesByHash) {
248741
+ let lastError;
248742
+ let rateLimitWaits = 0;
248743
+ const formData = await buildBucketForm(bucket, filesByHash);
248744
+ for (let attempt = 0;attempt < MAX_UPLOAD_ATTEMPTS; attempt++) {
248745
+ if (attempt > 0) {
248746
+ await sleep3(RETRY_BASE_DELAY_MS * 2 ** (attempt - 1));
248747
+ }
248748
+ try {
248749
+ return await uploadAssetBucket(target, formData);
248750
+ } catch (error48) {
248751
+ if (error48 instanceof HTTPError && error48.response.status === 429 && rateLimitWaits < MAX_RATE_LIMIT_WAITS) {
248752
+ rateLimitWaits++;
248753
+ attempt--;
248754
+ await sleep3(RATE_LIMIT_DELAY_MS);
248755
+ continue;
248756
+ }
248757
+ lastError = error48;
248758
+ }
248759
+ }
248760
+ if (lastError instanceof HTTPError && (lastError.response.status === 401 || lastError.response.status === 403)) {
248761
+ throw new ApiError("This deploy's upload session has expired — rerun deploy. Already-uploaded assets are skipped on the next attempt.", { statusCode: lastError.response.status, cause: lastError });
248762
+ }
248763
+ throw await ApiError.fromHttpError(lastError, "uploading assets to Cloudflare");
248764
+ }
248765
+ async function buildBucketForm(bucket, filesByHash) {
248766
+ const formData = new FormData;
248767
+ for (const hash2 of bucket) {
248768
+ const file2 = filesByHash.get(hash2);
248769
+ if (!file2) {
248770
+ throw new InternalError(`Server requested upload of unknown asset hash: ${hash2}`);
248771
+ }
248772
+ const content = await readFile3(file2.absolutePath);
248773
+ formData.append(hash2, new File([content.toString("base64")], hash2, { type: file2.contentType }));
248774
+ }
248775
+ return formData;
248776
+ }
248549
248777
  async function uploadPresignedAssets(uploads, assets, options = {}) {
248550
248778
  const { concurrency = DEFAULT_UPLOAD_CONCURRENCY, onProgress } = options;
248551
248779
  let uploadedFiles = 0;
@@ -248576,366 +248804,154 @@ async function uploadPresignedAsset(upload, assets) {
248576
248804
  throw await ApiError.fromHttpError(error48, "uploading static assets");
248577
248805
  }
248578
248806
  }
248807
+ function sleep3(ms) {
248808
+ return new Promise((resolve4) => setTimeout(resolve4, ms));
248809
+ }
248579
248810
 
248580
- // src/core/site/static-site.ts
248581
- async function deployStaticSite(options) {
248582
- const { outputDir, gitHash, concurrency, progress } = options;
248583
- const assets = await buildAssetManifest(outputDir, getAppContext().id);
248584
- if (!assets.manifest["/index.html"]) {
248585
- throw new InvalidInputError(`No index.html found in "${outputDir}" — a static site needs one at the output directory root.`);
248586
- }
248587
- const created = await createDeployment({
248588
- git_hash: gitHash,
248589
- asset_manifest: assets.manifest
248590
- });
248591
- progress?.onAssets?.({
248592
- totalAssets: Object.keys(assets.manifest).length,
248593
- newAssets: created.assetUploads?.uploads.length ?? 0
248594
- });
248595
- if (created.assetUploads) {
248596
- await uploadPresignedAssets(created.assetUploads.uploads, assets, {
248597
- concurrency,
248598
- onProgress: progress?.onAssetUpload
248811
+ // src/core/site/wrangler-config.ts
248812
+ import { dirname as dirname10, join as join16, resolve as resolve4 } from "node:path";
248813
+ var WRANGLER_REDIRECT_PATH = join16(".wrangler", "deploy", "config.json");
248814
+ var RedirectConfigSchema = exports_external.looseObject({
248815
+ configPath: exports_external.string().min(1)
248816
+ });
248817
+ var WranglerConfigSchema = exports_external.looseObject({
248818
+ main: exports_external.string().min(1, "wrangler config is missing a 'main' entry module"),
248819
+ no_bundle: exports_external.boolean().optional(),
248820
+ rules: exports_external.array(exports_external.looseObject({ type: exports_external.string(), globs: exports_external.array(exports_external.string()) })).optional(),
248821
+ assets: exports_external.looseObject({
248822
+ directory: exports_external.string().optional(),
248823
+ html_handling: exports_external.string().optional(),
248824
+ not_found_handling: exports_external.string().optional(),
248825
+ run_worker_first: exports_external.union([exports_external.boolean(), exports_external.array(exports_external.string())]).optional(),
248826
+ headers: exports_external.string().optional(),
248827
+ redirects: exports_external.string().optional()
248828
+ }).optional(),
248829
+ compatibility_date: exports_external.string().optional(),
248830
+ compatibility_flags: exports_external.array(exports_external.string()).optional(),
248831
+ vars: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
248832
+ upload_source_maps: exports_external.boolean().optional()
248833
+ });
248834
+ async function detectFullStackArtifact(projectRoot) {
248835
+ const redirectPath = join16(projectRoot, WRANGLER_REDIRECT_PATH);
248836
+ return await pathExists(redirectPath) ? redirectPath : null;
248837
+ }
248838
+ async function resolveWranglerConfig(projectRoot) {
248839
+ const redirectPath = await detectFullStackArtifact(projectRoot);
248840
+ if (!redirectPath) {
248841
+ throw new InvalidInputError("No full-stack build artifact found. Expected a .wrangler/deploy/config.json redirect file.", {
248842
+ hints: [{ message: "Run your framework's build command first" }]
248599
248843
  });
248600
248844
  }
248601
- const indexHtml = await readFile4(join16(outputDir, "index.html"));
248602
- const finalized = await finalizeStaticDeployment(created.deploymentId, new Uint8Array(indexHtml));
248603
- return { deploymentId: finalized.deploymentId };
248604
- }
248605
- // src/core/project/deploy.ts
248606
- function hasResourcesToDeploy(projectData) {
248607
- const {
248608
- project,
248609
- entities,
248610
- functions,
248611
- agents,
248612
- agentSkills,
248613
- connectors,
248614
- authConfig
248615
- } = projectData;
248616
- const hasSite = Boolean(project.site?.outputDirectory);
248617
- const hasEntities = entities.length > 0;
248618
- const hasFunctions = functions.length > 0;
248619
- const hasAgents = agents.length > 0;
248620
- const hasAgentSkills = agentSkills.length > 0;
248621
- const hasConnectors = connectors.length > 0;
248622
- const hasAuthConfig = authConfig.length > 0;
248623
- const hasVisibility = Boolean(project.visibility);
248624
- return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
248625
- }
248626
- async function deployAll(projectData, options) {
248627
- const {
248628
- project,
248629
- entities,
248630
- functions,
248631
- agents,
248632
- agentSkills,
248633
- connectors,
248634
- authConfig
248635
- } = projectData;
248636
- await setAppVisibility(project.visibility);
248637
- if (project.visibility) {
248638
- options?.onVisibilitySet?.(project.visibility);
248639
- }
248640
- await entityResource.push(entities);
248641
- await deployFunctionsSequentially(functions, {
248642
- onStart: options?.onFunctionStart,
248643
- onResult: options?.onFunctionResult
248644
- });
248645
- await agentSkillResource.push(agentSkills);
248646
- await agentResource.push(agents);
248647
- await authConfigResource.push(authConfig);
248648
- const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
248649
- const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
248650
- if (project.site?.outputDirectory) {
248651
- const outputDir = resolve3(project.root, project.site.outputDirectory);
248652
- const { appUrl } = await deploySite(outputDir);
248653
- return { appUrl, connectorResults };
248845
+ const configPath = await resolveRedirectedConfigPath(redirectPath);
248846
+ const parsed = await readJsonFile(configPath);
248847
+ const result = WranglerConfigSchema.safeParse(parsed);
248848
+ if (!result.success) {
248849
+ throw new ConfigInvalidError(`Invalid wrangler config: ${exports_external.prettifyError(result.error)}`, configPath);
248654
248850
  }
248655
- return { connectorResults };
248656
- }
248657
- // src/core/clients/base44-client.ts
248658
- var retriedRequests = new WeakSet;
248659
- async function captureRequestBody(request, options) {
248660
- if (request.body == null) {
248661
- return;
248851
+ const config9 = result.data;
248852
+ if (config9.no_bundle !== true) {
248853
+ throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 full-stack deploys only support pre-bundled Workers output (no_bundle: true).");
248662
248854
  }
248663
- try {
248664
- const cloned = request.clone();
248665
- const text = await cloned.text();
248666
- options.context.__requestBody = text;
248667
- } catch {}
248855
+ const configDir = dirname10(configPath);
248856
+ const assetsDirectory = config9.assets?.directory ? resolve4(configDir, config9.assets.directory) : null;
248857
+ return {
248858
+ configPath,
248859
+ configDir,
248860
+ main: config9.main,
248861
+ assetsDirectory,
248862
+ assetsConfig: config9.assets ? toResolvedAssetsConfig(config9.assets) : null,
248863
+ compatibilityDate: config9.compatibility_date ?? null,
248864
+ compatibilityFlags: config9.compatibility_flags ?? [],
248865
+ vars: config9.vars ?? {},
248866
+ rules: (config9.rules ?? []).map((rule) => ({
248867
+ type: rule.type,
248868
+ globs: rule.globs
248869
+ })),
248870
+ uploadSourceMaps: config9.upload_source_maps ?? false
248871
+ };
248668
248872
  }
248669
- async function handleUnauthorized(request, _options, response) {
248670
- if (response.status !== 401) {
248671
- return;
248672
- }
248673
- if (hasWorkspaceApiKeyAuth()) {
248674
- return;
248675
- }
248676
- if (retriedRequests.has(request)) {
248677
- return;
248678
- }
248679
- const newAccessToken = await refreshAndSaveTokens();
248680
- if (!newAccessToken) {
248681
- return;
248873
+ async function resolveRedirectedConfigPath(redirectPath) {
248874
+ const parsed = await readJsonFile(redirectPath);
248875
+ const result = RedirectConfigSchema.safeParse(parsed);
248876
+ if (!result.success) {
248877
+ throw new ConfigInvalidError(`Invalid deploy redirect file: ${exports_external.prettifyError(result.error)}`, redirectPath);
248682
248878
  }
248683
- retriedRequests.add(request);
248684
- const requestId = request.headers.get("X-Request-ID");
248685
- return distribution_default(request.clone(), {
248686
- headers: {
248687
- ...requestId && { "X-Request-ID": requestId },
248688
- Authorization: `Bearer ${newAccessToken}`
248689
- }
248690
- });
248691
- }
248692
- var base44Client = distribution_default.create({
248693
- prefixUrl: getBase44ApiUrl(),
248694
- headers: {
248695
- "User-Agent": "Base44 CLI"
248696
- },
248697
- hooks: {
248698
- beforeRequest: [
248699
- (request) => {
248700
- request.headers.set("X-Request-ID", randomUUID2());
248701
- },
248702
- captureRequestBody,
248703
- async (request) => {
248704
- const workspaceApiKey = getWorkspaceApiKeyFromEnv();
248705
- if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
248706
- request.headers.set("api_key", workspaceApiKey);
248707
- return;
248708
- }
248709
- try {
248710
- const auth = await readAuth();
248711
- if (isTokenExpired(auth)) {
248712
- const newAccessToken = await refreshAndSaveTokens();
248713
- if (newAccessToken) {
248714
- request.headers.set("Authorization", `Bearer ${newAccessToken}`);
248715
- return;
248716
- }
248717
- }
248718
- request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
248719
- } catch {}
248720
- }
248721
- ],
248722
- afterResponse: [handleUnauthorized]
248879
+ const configPath = resolve4(dirname10(redirectPath), result.data.configPath);
248880
+ if (!await pathExists(configPath)) {
248881
+ throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
248882
+ hints: [{ message: "Rebuild the project to regenerate the artifact" }]
248883
+ });
248723
248884
  }
248724
- });
248725
- function getAppClient() {
248726
- const { id } = getAppContext();
248727
- return base44Client.extend({
248728
- prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
248729
- });
248885
+ return configPath;
248730
248886
  }
248731
- function getSandboxClient(appId) {
248732
- return base44Client.extend({
248733
- prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
248734
- });
248887
+ function toResolvedAssetsConfig(assets) {
248888
+ return {
248889
+ htmlHandling: assets.html_handling,
248890
+ notFoundHandling: assets.not_found_handling,
248891
+ runWorkerFirst: assets.run_worker_first,
248892
+ headers: assets.headers,
248893
+ redirects: assets.redirects
248894
+ };
248735
248895
  }
248736
- // src/core/clients/oauth-client.ts
248737
- import { randomUUID as randomUUID3 } from "node:crypto";
248738
- var oauthClient = distribution_default.create({
248739
- prefixUrl: getBase44ApiUrl(),
248740
- headers: {
248741
- "User-Agent": "Base44 CLI"
248742
- },
248743
- hooks: {
248744
- beforeRequest: [
248745
- (request) => {
248746
- request.headers.set("X-Request-ID", randomUUID3());
248747
- }
248748
- ]
248896
+
248897
+ // src/core/site/full-stack.ts
248898
+ async function deployFullStack(options) {
248899
+ const { projectRoot, gitHash, concurrency, progress } = options;
248900
+ const config9 = await resolveWranglerConfig(projectRoot);
248901
+ if (!config9.compatibilityFlags.includes("nodejs_compat")) {
248902
+ progress?.onWarning?.("The wrangler config has no 'nodejs_compat' compatibility flag; Node.js built-ins will be unavailable at runtime. Enable it in your framework's Cloudflare adapter settings if your server code needs Node APIs.");
248749
248903
  }
248750
- });
248751
- // src/core/auth/api.ts
248752
- async function generateDeviceCode() {
248753
- const response = await oauthClient.post("oauth/device/code", {
248754
- json: {
248755
- client_id: AUTH_CLIENT_ID,
248756
- scope: "apps:read apps:write sandbox:write"
248757
- },
248758
- throwHttpErrors: false
248759
- });
248760
- if (!response.ok) {
248761
- throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
248904
+ if (config9.vars && Object.keys(config9.vars).length > 0) {
248905
+ progress?.onWarning?.("wrangler 'vars' are not supported and were ignored — a worker's environment comes from the app's secrets (base44 secrets set).");
248762
248906
  }
248763
- const result = DeviceCodeResponseSchema.safeParse(await response.json());
248764
- if (!result.success) {
248765
- throw new SchemaValidationError("Invalid device code response from server", result.error);
248907
+ const modules = await collectModules(config9);
248908
+ let assets = { manifest: {}, filesByHash: new Map };
248909
+ if (config9.assetsDirectory && await pathExists(config9.assetsDirectory)) {
248910
+ assets = await buildAssetManifest(config9.assetsDirectory, getAppContext().id);
248766
248911
  }
248767
- return result.data;
248768
- }
248769
- async function getTokenFromDeviceCode(deviceCode) {
248770
- const searchParams = new URLSearchParams;
248771
- searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
248772
- searchParams.set("device_code", deviceCode);
248773
- searchParams.set("client_id", AUTH_CLIENT_ID);
248774
- const response = await oauthClient.post("oauth/token", {
248775
- body: searchParams.toString(),
248776
- headers: {
248777
- "Content-Type": "application/x-www-form-urlencoded"
248778
- },
248779
- throwHttpErrors: false
248780
- });
248781
- const json2 = await response.json();
248782
- if (!response.ok) {
248783
- const errorResult = OAuthErrorSchema.safeParse(json2);
248784
- if (!errorResult.success) {
248785
- throw new SchemaValidationError("Token request failed", errorResult.error);
248786
- }
248787
- const { error: error48, error_description } = errorResult.data;
248788
- if (error48 === "authorization_pending" || error48 === "slow_down") {
248789
- return null;
248790
- }
248791
- throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
248792
- statusCode: response.status
248793
- });
248794
- }
248795
- const result = TokenResponseSchema.safeParse(json2);
248796
- if (!result.success) {
248797
- throw new SchemaValidationError("Invalid token response from server", result.error);
248798
- }
248799
- return result.data;
248800
- }
248801
- async function renewAccessToken(refreshToken) {
248802
- const searchParams = new URLSearchParams;
248803
- searchParams.set("grant_type", "refresh_token");
248804
- searchParams.set("refresh_token", refreshToken);
248805
- searchParams.set("client_id", AUTH_CLIENT_ID);
248806
- const response = await oauthClient.post("oauth/token", {
248807
- body: searchParams.toString(),
248808
- headers: {
248809
- "Content-Type": "application/x-www-form-urlencoded"
248912
+ const created = await createDeployment({
248913
+ git_hash: gitHash,
248914
+ config: {
248915
+ main: config9.main,
248916
+ compatibility_date: config9.compatibilityDate,
248917
+ compatibility_flags: config9.compatibilityFlags,
248918
+ assets: buildAssetsConfig(config9.assetsConfig, progress)
248810
248919
  },
248811
- throwHttpErrors: false
248812
- });
248813
- const json2 = await response.json();
248814
- if (!response.ok) {
248815
- const errorResult = OAuthErrorSchema.safeParse(json2);
248816
- if (!errorResult.success) {
248817
- throw new ApiError(`Token refresh failed: ${response.statusText}`, {
248818
- statusCode: response.status
248819
- });
248820
- }
248821
- const { error: error48, error_description } = errorResult.data;
248822
- throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
248823
- statusCode: response.status
248824
- });
248825
- }
248826
- const result = TokenResponseSchema.safeParse(json2);
248827
- if (!result.success) {
248828
- throw new SchemaValidationError("Invalid token response from server", result.error);
248829
- }
248830
- return result.data;
248831
- }
248832
- async function getUserInfo(accessToken) {
248833
- const response = await oauthClient.get("oauth/userinfo", {
248834
- headers: { Authorization: `Bearer ${accessToken}` }
248920
+ asset_manifest: assets.manifest
248835
248921
  });
248836
- if (!response.ok) {
248837
- throw new ApiError(`Failed to fetch user info: ${response.status}`, {
248838
- statusCode: response.status
248839
- });
248840
- }
248841
- const result = UserInfoSchema.safeParse(await response.json());
248842
- if (!result.success) {
248843
- throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
248922
+ if (created.assetUploads && created.assetUploads.type !== "cf") {
248923
+ throw new ApiError(`The server answered a full-stack deploy with the "${created.assetUploads.type}" upload target.`);
248844
248924
  }
248845
- return result.data;
248846
- }
248847
- // src/cli/commands/auth/login-flow.ts
248848
- async function generateAndDisplayDeviceCode(log, runTask) {
248849
- const deviceCodeResponse = await runTask("Generating device code...", async () => {
248850
- return await generateDeviceCode();
248851
- }, {
248852
- successMessage: "Device code generated",
248853
- errorMessage: "Failed to generate device code"
248854
- });
248855
- log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
248856
- Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
248857
- return deviceCodeResponse;
248925
+ const totalAssets = Object.keys(assets.manifest).length;
248926
+ const newAssets = created.assetUploads ? new Set(created.assetUploads.buckets.flat()).size : 0;
248927
+ progress?.onAssets?.({ totalAssets, newAssets });
248928
+ const completionJwt = created.assetUploads ? await uploadAssetBuckets(created.assetUploads, assets.filesByHash, {
248929
+ concurrency,
248930
+ onProgress: progress?.onAssetUpload
248931
+ }) : null;
248932
+ progress?.onWorker?.({ moduleCount: modules.length });
248933
+ const finalized = await finalizeDeployment(created.deploymentId, completionJwt, modules);
248934
+ return { deploymentId: finalized.deploymentId, gitHash };
248858
248935
  }
248859
- async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
248860
- let tokenResponse;
248861
- try {
248862
- await runTask("Waiting for authentication...", async () => {
248863
- await pWaitFor(async () => {
248864
- const result = await getTokenFromDeviceCode(deviceCode);
248865
- if (result !== null) {
248866
- tokenResponse = result;
248867
- return true;
248868
- }
248869
- return false;
248870
- }, {
248871
- interval: interval * 1000,
248872
- timeout: expiresIn * 1000
248873
- });
248874
- }, {
248875
- successMessage: "Authentication completed!",
248876
- errorMessage: "Authentication failed"
248877
- });
248878
- } catch (error48) {
248879
- if (error48 instanceof Error && error48.message.includes("timed out")) {
248880
- throw new AuthExpiredError("Authentication timed out. Please try again.");
248881
- }
248882
- throw error48;
248936
+ function buildAssetsConfig(assetsConfig, progress) {
248937
+ if (!assetsConfig)
248938
+ return null;
248939
+ if (assetsConfig.headers || assetsConfig.redirects) {
248940
+ progress?.onWarning?.("_headers/_redirects files are not supported yet and were ignored for this deploy.");
248883
248941
  }
248884
- if (tokenResponse === undefined) {
248885
- throw new InternalError("Failed to retrieve authentication token.");
248942
+ let runWorkerFirst;
248943
+ if (Array.isArray(assetsConfig.runWorkerFirst)) {
248944
+ progress?.onWarning?.("'run_worker_first' route patterns are not supported yet and were ignored for this deploy.");
248945
+ } else {
248946
+ runWorkerFirst = assetsConfig.runWorkerFirst;
248886
248947
  }
248887
- return tokenResponse;
248888
- }
248889
- async function saveAuthData(response, userInfo) {
248890
- const expiresAt = Date.now() + response.expiresIn * 1000;
248891
- await writeAuth({
248892
- accessToken: response.accessToken,
248893
- refreshToken: response.refreshToken,
248894
- expiresAt,
248895
- email: userInfo.email,
248896
- name: userInfo.name
248897
- });
248898
- }
248899
- async function login({
248900
- log,
248901
- runTask
248902
- }) {
248903
- const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
248904
- const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
248905
- const userInfo = await getUserInfo(token.accessToken);
248906
- await saveAuthData(token, userInfo);
248907
248948
  return {
248908
- outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
248949
+ html_handling: assetsConfig.htmlHandling,
248950
+ not_found_handling: assetsConfig.notFoundHandling,
248951
+ run_worker_first: runWorkerFirst
248909
248952
  };
248910
248953
  }
248911
248954
 
248912
- // src/cli/utils/command/middleware.ts
248913
- async function ensureAuth(ctx) {
248914
- if (hasWorkspaceApiKeyAuth()) {
248915
- ctx.errorReporter.setContext({
248916
- user: { email: "workspace-api-key", name: "Workspace API key" }
248917
- });
248918
- return;
248919
- }
248920
- await seedAuthFromEnv();
248921
- const loggedIn = await isLoggedIn();
248922
- if (!loggedIn) {
248923
- ctx.log.info("You need to login first to continue.");
248924
- await login(ctx);
248925
- }
248926
- try {
248927
- const userInfo = await readAuth();
248928
- ctx.errorReporter.setContext({
248929
- user: { email: userInfo.email, name: userInfo.name }
248930
- });
248931
- } catch {}
248932
- }
248933
- async function ensureAppContext(ctx, options = {}) {
248934
- const appContext = await initAppContext(options);
248935
- ctx.app = appContext;
248936
- ctx.errorReporter.setContext({ appId: appContext.id });
248937
- }
248938
-
248939
248955
  // ../../node_modules/is-plain-obj/index.js
248940
248956
  function isPlainObject2(value) {
248941
248957
  if (typeof value !== "object" || value === null) {
@@ -249033,13 +249049,13 @@ var getJoinLength = (uint8Arrays) => {
249033
249049
  var isTemplateString = (templates) => Array.isArray(templates) && Array.isArray(templates.raw);
249034
249050
  var parseTemplates = (templates, expressions) => {
249035
249051
  let tokens = [];
249036
- for (const [index, template2] of templates.entries()) {
249052
+ for (const [index, template] of templates.entries()) {
249037
249053
  tokens = parseTemplate({
249038
249054
  templates,
249039
249055
  expressions,
249040
249056
  tokens,
249041
249057
  index,
249042
- template: template2
249058
+ template
249043
249059
  });
249044
249060
  }
249045
249061
  if (tokens.length === 0) {
@@ -249048,11 +249064,11 @@ var parseTemplates = (templates, expressions) => {
249048
249064
  const [file2, ...commandArguments] = tokens;
249049
249065
  return [file2, commandArguments, {}];
249050
249066
  };
249051
- var parseTemplate = ({ templates, expressions, tokens, index, template: template2 }) => {
249052
- if (template2 === undefined) {
249067
+ var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
249068
+ if (template === undefined) {
249053
249069
  throw new TypeError(`Invalid backslash sequence: ${templates.raw[index]}`);
249054
249070
  }
249055
- const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(template2, templates.raw[index]);
249071
+ const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(template, templates.raw[index]);
249056
249072
  const newTokens = concatTokens(tokens, nextTokens, leadingWhitespaces);
249057
249073
  if (index === expressions.length) {
249058
249074
  return newTokens;
@@ -249061,18 +249077,18 @@ var parseTemplate = ({ templates, expressions, tokens, index, template: template
249061
249077
  const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
249062
249078
  return concatTokens(newTokens, expressionTokens, trailingWhitespaces);
249063
249079
  };
249064
- var splitByWhitespaces = (template2, rawTemplate) => {
249080
+ var splitByWhitespaces = (template, rawTemplate) => {
249065
249081
  if (rawTemplate.length === 0) {
249066
249082
  return { nextTokens: [], leadingWhitespaces: false, trailingWhitespaces: false };
249067
249083
  }
249068
249084
  const nextTokens = [];
249069
249085
  let templateStart = 0;
249070
249086
  const leadingWhitespaces = DELIMITERS.has(rawTemplate[0]);
249071
- for (let templateIndex = 0, rawIndex = 0;templateIndex < template2.length; templateIndex += 1, rawIndex += 1) {
249087
+ for (let templateIndex = 0, rawIndex = 0;templateIndex < template.length; templateIndex += 1, rawIndex += 1) {
249072
249088
  const rawCharacter = rawTemplate[rawIndex];
249073
249089
  if (DELIMITERS.has(rawCharacter)) {
249074
249090
  if (templateStart !== templateIndex) {
249075
- nextTokens.push(template2.slice(templateStart, templateIndex));
249091
+ nextTokens.push(template.slice(templateStart, templateIndex));
249076
249092
  }
249077
249093
  templateStart = templateIndex + 1;
249078
249094
  } else if (rawCharacter === "\\") {
@@ -249088,9 +249104,9 @@ var splitByWhitespaces = (template2, rawTemplate) => {
249088
249104
  }
249089
249105
  }
249090
249106
  }
249091
- const trailingWhitespaces = templateStart === template2.length;
249107
+ const trailingWhitespaces = templateStart === template.length;
249092
249108
  if (!trailingWhitespaces) {
249093
- nextTokens.push(template2.slice(templateStart));
249109
+ nextTokens.push(template.slice(templateStart));
249094
249110
  }
249095
249111
  return { nextTokens, leadingWhitespaces, trailingWhitespaces };
249096
249112
  };
@@ -250484,8 +250500,8 @@ var disconnect = (anyProcess) => {
250484
250500
  // ../../node_modules/execa/lib/utils/deferred.js
250485
250501
  var createDeferred = () => {
250486
250502
  const methods = {};
250487
- const promise2 = new Promise((resolve4, reject) => {
250488
- Object.assign(methods, { resolve: resolve4, reject });
250503
+ const promise2 = new Promise((resolve5, reject) => {
250504
+ Object.assign(methods, { resolve: resolve5, reject });
250489
250505
  });
250490
250506
  return Object.assign(promise2, methods);
250491
250507
  };
@@ -254849,11 +254865,11 @@ var addConcurrentStream = (concurrentStreams, stream, waitName) => {
254849
254865
  const promises = weakMap.get(stream);
254850
254866
  const promise2 = createDeferred();
254851
254867
  promises.push(promise2);
254852
- const resolve4 = promise2.resolve.bind(promise2);
254853
- return { resolve: resolve4, promises };
254868
+ const resolve5 = promise2.resolve.bind(promise2);
254869
+ return { resolve: resolve5, promises };
254854
254870
  };
254855
- var waitForConcurrentStreams = async ({ resolve: resolve4, promises }, subprocess) => {
254856
- resolve4();
254871
+ var waitForConcurrentStreams = async ({ resolve: resolve5, promises }, subprocess) => {
254872
+ resolve5();
254857
254873
  const [isSubprocessExit] = await Promise.race([
254858
254874
  Promise.allSettled([true, subprocess]),
254859
254875
  Promise.all([false, ...promises])
@@ -255432,6 +255448,454 @@ var {
255432
255448
  getCancelSignal: getCancelSignal2
255433
255449
  } = getIpcExport();
255434
255450
 
255451
+ // src/core/utils/git.ts
255452
+ var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
255453
+ function isGitCommitHash(value) {
255454
+ return GIT_HASH_PATTERN.test(value);
255455
+ }
255456
+
255457
+ // src/core/site/git-hash.ts
255458
+ async function resolveGitHash(projectRoot, explicit) {
255459
+ const hash2 = explicit ?? await gitHead(projectRoot);
255460
+ if (!hash2 || !isGitCommitHash(hash2)) {
255461
+ throw new InvalidInputError(explicit ? `'${explicit}' is not a git commit hash.` : "Deployments are addressed by the commit that produced the build, and no git commit was found.", {
255462
+ hints: [
255463
+ {
255464
+ message: "Run the deploy from a git checkout, or pass the commit explicitly with --git-hash."
255465
+ }
255466
+ ]
255467
+ });
255468
+ }
255469
+ return hash2;
255470
+ }
255471
+ async function gitHead(projectRoot) {
255472
+ try {
255473
+ const { stdout } = await execa("git", ["rev-parse", "HEAD"], {
255474
+ cwd: projectRoot
255475
+ });
255476
+ return stdout.trim();
255477
+ } catch {
255478
+ return null;
255479
+ }
255480
+ }
255481
+
255482
+ // src/core/site/static-site.ts
255483
+ import { readFile as readFile4 } from "node:fs/promises";
255484
+ import { join as join17 } from "node:path";
255485
+ var STATIC_DEPLOYMENTS_ENV = "BASE44_STATIC_DEPLOYMENTS";
255486
+ function staticDeploymentsEnabled(env2 = process.env) {
255487
+ const value = env2[STATIC_DEPLOYMENTS_ENV];
255488
+ return value === "1" || value === "true";
255489
+ }
255490
+ async function deployStaticSite(options) {
255491
+ const { outputDir, gitHash, concurrency, progress } = options;
255492
+ const assets = await buildAssetManifest(outputDir, getAppContext().id);
255493
+ if (!assets.manifest["/index.html"]) {
255494
+ throw new InvalidInputError(`No index.html found in "${outputDir}" — a static site needs one at the output directory root.`);
255495
+ }
255496
+ const created = await createDeployment({
255497
+ git_hash: gitHash,
255498
+ asset_manifest: assets.manifest
255499
+ });
255500
+ if (created.assetUploads && created.assetUploads.type !== "s3") {
255501
+ throw new ApiError(`The server answered a static-site deploy with the "${created.assetUploads.type}" upload target.`);
255502
+ }
255503
+ const totalAssets = Object.keys(assets.manifest).length;
255504
+ progress?.onAssets?.({
255505
+ totalAssets,
255506
+ newAssets: created.assetUploads?.uploads.length ?? 0
255507
+ });
255508
+ if (created.assetUploads) {
255509
+ await uploadPresignedAssets(created.assetUploads.uploads, assets, {
255510
+ concurrency,
255511
+ onProgress: progress?.onAssetUpload
255512
+ });
255513
+ }
255514
+ const indexHtml = await readFile4(join17(outputDir, "index.html"));
255515
+ const finalized = await finalizeStaticDeployment(created.deploymentId, new Uint8Array(indexHtml));
255516
+ return { deploymentId: finalized.deploymentId, gitHash };
255517
+ }
255518
+
255519
+ // src/core/site/deploy-app.ts
255520
+ async function planAppDeploy(target) {
255521
+ if (await detectFullStackArtifact(target.root)) {
255522
+ return { kind: "full-stack" };
255523
+ }
255524
+ const outputDirectory = target.site?.outputDirectory;
255525
+ if (!outputDirectory) {
255526
+ return { kind: "none" };
255527
+ }
255528
+ const outputDir = resolve5(target.root, outputDirectory);
255529
+ return staticDeploymentsEnabled() ? { kind: "static-deployment", outputDir } : { kind: "static", outputDir };
255530
+ }
255531
+ async function detectAppDeployKind(target) {
255532
+ return (await planAppDeploy(target)).kind;
255533
+ }
255534
+ async function deployAppSite(target, options = {}) {
255535
+ const plan = await planAppDeploy(target);
255536
+ switch (plan.kind) {
255537
+ case "full-stack": {
255538
+ const gitHash = await resolveGitHash(target.root, options.gitHash);
255539
+ const { deploymentId } = await deployFullStack({
255540
+ projectRoot: target.root,
255541
+ gitHash,
255542
+ concurrency: options.concurrency,
255543
+ progress: options.progress
255544
+ });
255545
+ return { kind: "full-stack", deploymentId, gitHash };
255546
+ }
255547
+ case "static-deployment": {
255548
+ const gitHash = await resolveGitHash(target.root, options.gitHash);
255549
+ const { deploymentId } = await deployStaticSite({
255550
+ outputDir: plan.outputDir,
255551
+ gitHash,
255552
+ concurrency: options.concurrency,
255553
+ progress: options.progress
255554
+ });
255555
+ return { kind: "static-deployment", deploymentId, gitHash };
255556
+ }
255557
+ case "static": {
255558
+ const { appUrl } = await deploySite(plan.outputDir);
255559
+ return { kind: "static", appUrl };
255560
+ }
255561
+ case "none":
255562
+ return { kind: "none" };
255563
+ }
255564
+ }
255565
+ // src/core/project/deploy.ts
255566
+ function hasResourcesToDeploy(projectData) {
255567
+ const {
255568
+ project,
255569
+ entities,
255570
+ functions,
255571
+ agents,
255572
+ agentSkills,
255573
+ connectors,
255574
+ authConfig
255575
+ } = projectData;
255576
+ const hasSite = Boolean(project.site?.outputDirectory || project.site?.buildCommand);
255577
+ const hasEntities = entities.length > 0;
255578
+ const hasFunctions = functions.length > 0;
255579
+ const hasAgents = agents.length > 0;
255580
+ const hasAgentSkills = agentSkills.length > 0;
255581
+ const hasConnectors = connectors.length > 0;
255582
+ const hasAuthConfig = authConfig.length > 0;
255583
+ const hasVisibility = Boolean(project.visibility);
255584
+ return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
255585
+ }
255586
+ async function deployAll(projectData, options) {
255587
+ const {
255588
+ project,
255589
+ entities,
255590
+ functions,
255591
+ agents,
255592
+ agentSkills,
255593
+ connectors,
255594
+ authConfig
255595
+ } = projectData;
255596
+ await setAppVisibility(project.visibility);
255597
+ if (project.visibility) {
255598
+ options?.onVisibilitySet?.(project.visibility);
255599
+ }
255600
+ await entityResource.push(entities);
255601
+ await deployFunctionsSequentially(functions, {
255602
+ onStart: options?.onFunctionStart,
255603
+ onResult: options?.onFunctionResult
255604
+ });
255605
+ await agentSkillResource.push(agentSkills);
255606
+ await agentResource.push(agents);
255607
+ await authConfigResource.push(authConfig);
255608
+ const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
255609
+ const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
255610
+ if ((options?.site ?? true) && project.site?.outputDirectory) {
255611
+ const outputDir = resolve6(project.root, project.site.outputDirectory);
255612
+ const { appUrl } = await deploySite(outputDir);
255613
+ return { appUrl, connectorResults };
255614
+ }
255615
+ return { connectorResults };
255616
+ }
255617
+ // src/core/clients/base44-client.ts
255618
+ var retriedRequests = new WeakSet;
255619
+ async function captureRequestBody(request, options) {
255620
+ if (request.body == null) {
255621
+ return;
255622
+ }
255623
+ try {
255624
+ const cloned = request.clone();
255625
+ const text = await cloned.text();
255626
+ options.context.__requestBody = text;
255627
+ } catch {}
255628
+ }
255629
+ async function handleUnauthorized(request, _options, response) {
255630
+ if (response.status !== 401) {
255631
+ return;
255632
+ }
255633
+ if (hasWorkspaceApiKeyAuth()) {
255634
+ return;
255635
+ }
255636
+ if (retriedRequests.has(request)) {
255637
+ return;
255638
+ }
255639
+ const newAccessToken = await refreshAndSaveTokens();
255640
+ if (!newAccessToken) {
255641
+ return;
255642
+ }
255643
+ retriedRequests.add(request);
255644
+ const requestId = request.headers.get("X-Request-ID");
255645
+ return distribution_default(request.clone(), {
255646
+ headers: {
255647
+ ...requestId && { "X-Request-ID": requestId },
255648
+ Authorization: `Bearer ${newAccessToken}`
255649
+ }
255650
+ });
255651
+ }
255652
+ var base44Client = distribution_default.create({
255653
+ prefixUrl: getBase44ApiUrl(),
255654
+ headers: {
255655
+ "User-Agent": "Base44 CLI"
255656
+ },
255657
+ hooks: {
255658
+ beforeRequest: [
255659
+ (request) => {
255660
+ request.headers.set("X-Request-ID", randomUUID2());
255661
+ },
255662
+ captureRequestBody,
255663
+ async (request) => {
255664
+ const workspaceApiKey = getWorkspaceApiKeyFromEnv();
255665
+ if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
255666
+ request.headers.set("api_key", workspaceApiKey);
255667
+ return;
255668
+ }
255669
+ try {
255670
+ const auth = await readAuth();
255671
+ if (isTokenExpired(auth)) {
255672
+ const newAccessToken = await refreshAndSaveTokens();
255673
+ if (newAccessToken) {
255674
+ request.headers.set("Authorization", `Bearer ${newAccessToken}`);
255675
+ return;
255676
+ }
255677
+ }
255678
+ request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
255679
+ } catch {}
255680
+ }
255681
+ ],
255682
+ afterResponse: [handleUnauthorized]
255683
+ }
255684
+ });
255685
+ function getAppClient() {
255686
+ const { id } = getAppContext();
255687
+ return base44Client.extend({
255688
+ prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
255689
+ });
255690
+ }
255691
+ function getSandboxClient(appId) {
255692
+ return base44Client.extend({
255693
+ prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
255694
+ });
255695
+ }
255696
+ // src/core/clients/oauth-client.ts
255697
+ import { randomUUID as randomUUID3 } from "node:crypto";
255698
+ var oauthClient = distribution_default.create({
255699
+ prefixUrl: getBase44ApiUrl(),
255700
+ headers: {
255701
+ "User-Agent": "Base44 CLI"
255702
+ },
255703
+ hooks: {
255704
+ beforeRequest: [
255705
+ (request) => {
255706
+ request.headers.set("X-Request-ID", randomUUID3());
255707
+ }
255708
+ ]
255709
+ }
255710
+ });
255711
+ // src/core/auth/api.ts
255712
+ async function generateDeviceCode() {
255713
+ const response = await oauthClient.post("oauth/device/code", {
255714
+ json: {
255715
+ client_id: AUTH_CLIENT_ID,
255716
+ scope: "apps:read apps:write sandbox:write"
255717
+ },
255718
+ throwHttpErrors: false
255719
+ });
255720
+ if (!response.ok) {
255721
+ throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
255722
+ }
255723
+ const result = DeviceCodeResponseSchema.safeParse(await response.json());
255724
+ if (!result.success) {
255725
+ throw new SchemaValidationError("Invalid device code response from server", result.error);
255726
+ }
255727
+ return result.data;
255728
+ }
255729
+ async function getTokenFromDeviceCode(deviceCode) {
255730
+ const searchParams = new URLSearchParams;
255731
+ searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
255732
+ searchParams.set("device_code", deviceCode);
255733
+ searchParams.set("client_id", AUTH_CLIENT_ID);
255734
+ const response = await oauthClient.post("oauth/token", {
255735
+ body: searchParams.toString(),
255736
+ headers: {
255737
+ "Content-Type": "application/x-www-form-urlencoded"
255738
+ },
255739
+ throwHttpErrors: false
255740
+ });
255741
+ const json2 = await response.json();
255742
+ if (!response.ok) {
255743
+ const errorResult = OAuthErrorSchema.safeParse(json2);
255744
+ if (!errorResult.success) {
255745
+ throw new SchemaValidationError("Token request failed", errorResult.error);
255746
+ }
255747
+ const { error: error48, error_description } = errorResult.data;
255748
+ if (error48 === "authorization_pending" || error48 === "slow_down") {
255749
+ return null;
255750
+ }
255751
+ throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
255752
+ statusCode: response.status
255753
+ });
255754
+ }
255755
+ const result = TokenResponseSchema.safeParse(json2);
255756
+ if (!result.success) {
255757
+ throw new SchemaValidationError("Invalid token response from server", result.error);
255758
+ }
255759
+ return result.data;
255760
+ }
255761
+ async function renewAccessToken(refreshToken) {
255762
+ const searchParams = new URLSearchParams;
255763
+ searchParams.set("grant_type", "refresh_token");
255764
+ searchParams.set("refresh_token", refreshToken);
255765
+ searchParams.set("client_id", AUTH_CLIENT_ID);
255766
+ const response = await oauthClient.post("oauth/token", {
255767
+ body: searchParams.toString(),
255768
+ headers: {
255769
+ "Content-Type": "application/x-www-form-urlencoded"
255770
+ },
255771
+ throwHttpErrors: false
255772
+ });
255773
+ const json2 = await response.json();
255774
+ if (!response.ok) {
255775
+ const errorResult = OAuthErrorSchema.safeParse(json2);
255776
+ if (!errorResult.success) {
255777
+ throw new ApiError(`Token refresh failed: ${response.statusText}`, {
255778
+ statusCode: response.status
255779
+ });
255780
+ }
255781
+ const { error: error48, error_description } = errorResult.data;
255782
+ throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
255783
+ statusCode: response.status
255784
+ });
255785
+ }
255786
+ const result = TokenResponseSchema.safeParse(json2);
255787
+ if (!result.success) {
255788
+ throw new SchemaValidationError("Invalid token response from server", result.error);
255789
+ }
255790
+ return result.data;
255791
+ }
255792
+ async function getUserInfo(accessToken) {
255793
+ const response = await oauthClient.get("oauth/userinfo", {
255794
+ headers: { Authorization: `Bearer ${accessToken}` }
255795
+ });
255796
+ if (!response.ok) {
255797
+ throw new ApiError(`Failed to fetch user info: ${response.status}`, {
255798
+ statusCode: response.status
255799
+ });
255800
+ }
255801
+ const result = UserInfoSchema.safeParse(await response.json());
255802
+ if (!result.success) {
255803
+ throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
255804
+ }
255805
+ return result.data;
255806
+ }
255807
+ // src/cli/commands/auth/login-flow.ts
255808
+ async function generateAndDisplayDeviceCode(log, runTask) {
255809
+ const deviceCodeResponse = await runTask("Generating device code...", async () => {
255810
+ return await generateDeviceCode();
255811
+ }, {
255812
+ successMessage: "Device code generated",
255813
+ errorMessage: "Failed to generate device code"
255814
+ });
255815
+ log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
255816
+ Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
255817
+ return deviceCodeResponse;
255818
+ }
255819
+ async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
255820
+ let tokenResponse;
255821
+ try {
255822
+ await runTask("Waiting for authentication...", async () => {
255823
+ await pWaitFor(async () => {
255824
+ const result = await getTokenFromDeviceCode(deviceCode);
255825
+ if (result !== null) {
255826
+ tokenResponse = result;
255827
+ return true;
255828
+ }
255829
+ return false;
255830
+ }, {
255831
+ interval: interval * 1000,
255832
+ timeout: expiresIn * 1000
255833
+ });
255834
+ }, {
255835
+ successMessage: "Authentication completed!",
255836
+ errorMessage: "Authentication failed"
255837
+ });
255838
+ } catch (error48) {
255839
+ if (error48 instanceof Error && error48.message.includes("timed out")) {
255840
+ throw new AuthExpiredError("Authentication timed out. Please try again.");
255841
+ }
255842
+ throw error48;
255843
+ }
255844
+ if (tokenResponse === undefined) {
255845
+ throw new InternalError("Failed to retrieve authentication token.");
255846
+ }
255847
+ return tokenResponse;
255848
+ }
255849
+ async function saveAuthData(response, userInfo) {
255850
+ const expiresAt = Date.now() + response.expiresIn * 1000;
255851
+ await writeAuth({
255852
+ accessToken: response.accessToken,
255853
+ refreshToken: response.refreshToken,
255854
+ expiresAt,
255855
+ email: userInfo.email,
255856
+ name: userInfo.name
255857
+ });
255858
+ }
255859
+ async function login({
255860
+ log,
255861
+ runTask
255862
+ }) {
255863
+ const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
255864
+ const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
255865
+ const userInfo = await getUserInfo(token.accessToken);
255866
+ await saveAuthData(token, userInfo);
255867
+ return {
255868
+ outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
255869
+ };
255870
+ }
255871
+
255872
+ // src/cli/utils/command/middleware.ts
255873
+ async function ensureAuth(ctx) {
255874
+ if (hasWorkspaceApiKeyAuth()) {
255875
+ ctx.errorReporter.setContext({
255876
+ user: { email: "workspace-api-key", name: "Workspace API key" }
255877
+ });
255878
+ return;
255879
+ }
255880
+ await seedAuthFromEnv();
255881
+ const loggedIn = await isLoggedIn();
255882
+ if (!loggedIn) {
255883
+ ctx.log.info("You need to login first to continue.");
255884
+ await login(ctx);
255885
+ }
255886
+ try {
255887
+ const userInfo = await readAuth();
255888
+ ctx.errorReporter.setContext({
255889
+ user: { email: userInfo.email, name: userInfo.name }
255890
+ });
255891
+ } catch {}
255892
+ }
255893
+ async function ensureAppContext(ctx, options = {}) {
255894
+ const appContext = await initAppContext(options);
255895
+ ctx.app = appContext;
255896
+ ctx.errorReporter.setContext({ appId: appContext.id });
255897
+ }
255898
+
255435
255899
  // src/cli/utils/version-check.ts
255436
255900
  async function checkForUpgrade() {
255437
255901
  const testLatestVersion = getTestOverrides()?.latestVersion;
@@ -255824,11 +256288,6 @@ function verifyDenoInstalled(context) {
255824
256288
  });
255825
256289
  }
255826
256290
  }
255827
- // src/core/utils/git.ts
255828
- var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
255829
- function isGitCommitHash(value) {
255830
- return GIT_HASH_PATTERN.test(value);
255831
- }
255832
256291
  // src/core/workspace/schema.ts
255833
256292
  var WorkspaceSchema = exports_external.object({
255834
256293
  id: exports_external.string(),
@@ -255903,7 +256362,7 @@ async function pullAction({
255903
256362
  runTask: runTask2
255904
256363
  }) {
255905
256364
  const { project: project2 } = await readProjectConfig();
255906
- const dir = join17(dirname10(project2.configPath), project2.agentSkillsDir);
256365
+ const dir = join18(dirname11(project2.configPath), project2.agentSkillsDir);
255907
256366
  const remote = await runTask2("Fetching agent skills from Base44", () => fetchAgentSkills(), {
255908
256367
  successMessage: "Agent skills fetched successfully",
255909
256368
  errorMessage: "Failed to fetch agent skills"
@@ -255959,14 +256418,14 @@ function getAgentSkillsCommand() {
255959
256418
  }
255960
256419
 
255961
256420
  // src/cli/commands/agents/pull.ts
255962
- import { dirname as dirname11, join as join18 } from "node:path";
256421
+ import { dirname as dirname12, join as join19 } from "node:path";
255963
256422
  async function pullAgentsAction({
255964
256423
  log,
255965
256424
  runTask: runTask2
255966
256425
  }) {
255967
256426
  const { project: project2 } = await readProjectConfig();
255968
- const configDir = dirname11(project2.configPath);
255969
- const agentsDir = join18(configDir, project2.agentsDir);
256427
+ const configDir = dirname12(project2.configPath);
256428
+ const agentsDir = join19(configDir, project2.agentsDir);
255970
256429
  const remoteAgents = await runTask2("Fetching agents from Base44", async () => {
255971
256430
  return await fetchAgents();
255972
256431
  }, {
@@ -256036,12 +256495,12 @@ function getAgentsCommand() {
256036
256495
  }
256037
256496
 
256038
256497
  // src/cli/commands/auth/password-login.ts
256039
- import { dirname as dirname12, join as join19 } from "node:path";
256498
+ import { dirname as dirname13, join as join20 } from "node:path";
256040
256499
  async function passwordLoginAction({ log, runTask: runTask2 }, action) {
256041
256500
  const shouldEnable = action === "enable";
256042
256501
  const { project: project2 } = await readProjectConfig();
256043
- const configDir = dirname12(project2.configPath);
256044
- const authDir = join19(configDir, project2.authDir);
256502
+ const configDir = dirname13(project2.configPath);
256503
+ const authDir = join20(configDir, project2.authDir);
256045
256504
  const updated = await runTask2("Updating local auth config", async () => {
256046
256505
  const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
256047
256506
  const merged = { ...current, enableUsernamePassword: shouldEnable };
@@ -256061,14 +256520,14 @@ function getPasswordLoginCommand() {
256061
256520
  }
256062
256521
 
256063
256522
  // src/cli/commands/auth/pull.ts
256064
- import { dirname as dirname13, join as join20 } from "node:path";
256523
+ import { dirname as dirname14, join as join21 } from "node:path";
256065
256524
  async function pullAuthAction({
256066
256525
  log,
256067
256526
  runTask: runTask2
256068
256527
  }) {
256069
256528
  const { project: project2 } = await readProjectConfig();
256070
- const configDir = dirname13(project2.configPath);
256071
- const authDir = join20(configDir, project2.authDir);
256529
+ const configDir = dirname14(project2.configPath);
256530
+ const authDir = join21(configDir, project2.authDir);
256072
256531
  const remoteConfig = await runTask2("Fetching auth config from Base44", async () => {
256073
256532
  return await pullAuthConfig();
256074
256533
  }, {
@@ -256132,7 +256591,7 @@ function getAuthPushCommand() {
256132
256591
  }
256133
256592
 
256134
256593
  // src/cli/commands/auth/social-login.ts
256135
- import { dirname as dirname14, join as join21, resolve as resolve4 } from "node:path";
256594
+ import { dirname as dirname15, join as join22, resolve as resolve7 } from "node:path";
256136
256595
  var PROVIDER_LABELS = {
256137
256596
  google: "Google",
256138
256597
  microsoft: "Microsoft",
@@ -256172,7 +256631,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
256172
256631
  let clientSecret;
256173
256632
  if (useCustomOAuth && oauth && oauthCli && hasSecretOptions(options)) {
256174
256633
  if (options.envFile) {
256175
- const secrets = await parseEnvFile(resolve4(options.envFile));
256634
+ const secrets = await parseEnvFile(resolve7(options.envFile));
256176
256635
  const value = secrets[oauthCli.envVar];
256177
256636
  if (!value) {
256178
256637
  throw new InvalidInputError(`Key "${oauthCli.envVar}" not found in ${options.envFile}.`);
@@ -256202,8 +256661,8 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
256202
256661
  }
256203
256662
  }
256204
256663
  const { project: project2 } = await readProjectConfig();
256205
- const configDir = dirname14(project2.configPath);
256206
- const authDir = join21(configDir, project2.authDir);
256664
+ const configDir = dirname15(project2.configPath);
256665
+ const authDir = join22(configDir, project2.authDir);
256207
256666
  const { config: updated } = await runTask2("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
256208
256667
  if (clientSecret) {
256209
256668
  await runTask2("Saving client secret", async () => pushCustomOAuthSecret(provider, clientSecret));
@@ -256228,7 +256687,7 @@ function getSocialLoginCommand() {
256228
256687
  }
256229
256688
 
256230
256689
  // src/cli/commands/auth/sso.ts
256231
- import { dirname as dirname15, join as join22, resolve as resolve5 } from "node:path";
256690
+ import { dirname as dirname16, join as join23, resolve as resolve8 } from "node:path";
256232
256691
  var SSOConfigFileSchema = exports_external.object({
256233
256692
  provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
256234
256693
  clientId: exports_external.string(),
@@ -256244,7 +256703,7 @@ var SSOConfigFileSchema = exports_external.object({
256244
256703
  ssoName: exports_external.string().optional()
256245
256704
  });
256246
256705
  async function loadSSOConfigFile(filePath) {
256247
- const resolved = resolve5(filePath);
256706
+ const resolved = resolve8(filePath);
256248
256707
  const raw2 = await readJsonFile(resolved);
256249
256708
  const result = SSOConfigFileSchema.safeParse(raw2);
256250
256709
  if (!result.success) {
@@ -256332,7 +256791,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
256332
256791
  }
256333
256792
  let clientSecret;
256334
256793
  if (merged.envFile && !merged.clientSecret) {
256335
- const secrets2 = await parseEnvFile(resolve5(merged.envFile));
256794
+ const secrets2 = await parseEnvFile(resolve8(merged.envFile));
256336
256795
  const value = secrets2.sso_client_secret;
256337
256796
  if (!value) {
256338
256797
  throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
@@ -256391,8 +256850,8 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
256391
256850
  throw error48;
256392
256851
  }
256393
256852
  const { project: project2 } = await readProjectConfig();
256394
- const configDir = dirname15(project2.configPath);
256395
- const authDir = join22(configDir, project2.authDir);
256853
+ const configDir = dirname16(project2.configPath);
256854
+ const authDir = join23(configDir, project2.authDir);
256396
256855
  await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
256397
256856
  await runTask2("Saving SSO credentials", async () => pushSSOSecrets(secrets));
256398
256857
  return {
@@ -256407,8 +256866,8 @@ async function ssoDisableAction({ log, runTask: runTask2 }, options) {
256407
256866
  throw new InvalidInputError("Configuration options cannot be used with disable. To disable SSO: base44 auth sso disable");
256408
256867
  }
256409
256868
  const { project: project2 } = await readProjectConfig();
256410
- const configDir = dirname15(project2.configPath);
256411
- const authDir = join22(configDir, project2.authDir);
256869
+ const configDir = dirname16(project2.configPath);
256870
+ const authDir = join23(configDir, project2.authDir);
256412
256871
  const updated = await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
256413
256872
  await runTask2("Removing SSO credentials", async () => deleteSSOSecrets());
256414
256873
  if (!hasAnyLoginMethod(updated)) {
@@ -256970,19 +257429,19 @@ var baseOpen = async (options) => {
256970
257429
  }
256971
257430
  const subprocess = childProcess3.spawn(command2, cliArguments, childProcessOptions);
256972
257431
  if (options.wait) {
256973
- return new Promise((resolve6, reject) => {
257432
+ return new Promise((resolve9, reject) => {
256974
257433
  subprocess.once("error", reject);
256975
257434
  subprocess.once("close", (exitCode) => {
256976
257435
  if (!options.allowNonzeroExitCode && exitCode !== 0) {
256977
257436
  reject(new Error(`Exited with code ${exitCode}`));
256978
257437
  return;
256979
257438
  }
256980
- resolve6(subprocess);
257439
+ resolve9(subprocess);
256981
257440
  });
256982
257441
  });
256983
257442
  }
256984
257443
  if (isFallbackAttempt) {
256985
- return new Promise((resolve6, reject) => {
257444
+ return new Promise((resolve9, reject) => {
256986
257445
  subprocess.once("error", reject);
256987
257446
  subprocess.once("spawn", () => {
256988
257447
  subprocess.once("close", (exitCode) => {
@@ -256992,17 +257451,17 @@ var baseOpen = async (options) => {
256992
257451
  return;
256993
257452
  }
256994
257453
  subprocess.unref();
256995
- resolve6(subprocess);
257454
+ resolve9(subprocess);
256996
257455
  });
256997
257456
  });
256998
257457
  });
256999
257458
  }
257000
257459
  subprocess.unref();
257001
- return new Promise((resolve6, reject) => {
257460
+ return new Promise((resolve9, reject) => {
257002
257461
  subprocess.once("error", reject);
257003
257462
  subprocess.once("spawn", () => {
257004
257463
  subprocess.off("error", reject);
257005
- resolve6(subprocess);
257464
+ resolve9(subprocess);
257006
257465
  });
257007
257466
  });
257008
257467
  };
@@ -257265,13 +257724,13 @@ function getConnectorsListAvailableCommand() {
257265
257724
  }
257266
257725
 
257267
257726
  // src/cli/commands/connectors/pull.ts
257268
- import { dirname as dirname16, join as join23, resolve as resolve6 } from "node:path";
257727
+ import { dirname as dirname17, join as join24, resolve as resolve9 } from "node:path";
257269
257728
  async function resolveConnectorsDir(options) {
257270
257729
  if (!getAppContext().projectRoot) {
257271
- return resolve6(options.dir ?? "connectors");
257730
+ return resolve9(options.dir ?? "connectors");
257272
257731
  }
257273
257732
  const { project: project2 } = await readProjectConfig();
257274
- return join23(dirname16(project2.configPath), project2.connectorsDir);
257733
+ return join24(dirname17(project2.configPath), project2.connectorsDir);
257275
257734
  }
257276
257735
  async function pullConnectorsAction({ log, runTask: runTask2, jsonMode }, options) {
257277
257736
  const connectorsDir = await resolveConnectorsDir(options);
@@ -257312,10 +257771,10 @@ function getConnectorsPullCommand() {
257312
257771
  }
257313
257772
 
257314
257773
  // src/cli/commands/connectors/push.ts
257315
- import { resolve as resolve7 } from "node:path";
257774
+ import { resolve as resolve10 } from "node:path";
257316
257775
  async function readConnectorsToPush(options) {
257317
257776
  if (!getAppContext().projectRoot) {
257318
- return readAllConnectors(resolve7(options.dir ?? "connectors"));
257777
+ return readAllConnectors(resolve10(options.dir ?? "connectors"));
257319
257778
  }
257320
257779
  const { connectors } = await readProjectConfig();
257321
257780
  return connectors;
@@ -257679,11 +258138,11 @@ function getListCommand() {
257679
258138
  }
257680
258139
 
257681
258140
  // src/cli/commands/functions/pull.ts
257682
- import { dirname as dirname17, join as join24 } from "node:path";
258141
+ import { dirname as dirname18, join as join25 } from "node:path";
257683
258142
  async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
257684
258143
  const { project: project2, functions } = await readProjectConfig();
257685
- const configDir = dirname17(project2.configPath);
257686
- const functionsDir = join24(configDir, project2.functionsDir);
258144
+ const configDir = dirname18(project2.configPath);
258145
+ const functionsDir = join25(configDir, project2.functionsDir);
257687
258146
  const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
257688
258147
  const remoteFunctions = await runTask2("Fetching functions from Base44", async () => {
257689
258148
  const { functions: functions2 } = await listDeployedFunctions();
@@ -257816,11 +258275,11 @@ function getBuildCommand() {
257816
258275
  }
257817
258276
 
257818
258277
  // src/cli/commands/project/create.ts
257819
- import { basename as basename5, resolve as resolve8 } from "node:path";
258278
+ import { basename as basename5, resolve as resolve11 } from "node:path";
257820
258279
  var import_kebabCase = __toESM(require_kebabCase(), 1);
257821
258280
 
257822
258281
  // src/cli/commands/project/scaffold-shared.ts
257823
- import { join as join25 } from "node:path";
258282
+ import { join as join26 } from "node:path";
257824
258283
  var DEFAULT_TEMPLATE_ID = "backend-only";
257825
258284
  async function getTemplateById(templateId) {
257826
258285
  const templates = await listTemplates();
@@ -257877,13 +258336,9 @@ async function completeProjectSetup({
257877
258336
  const { appUrl } = await runTask2("Installing dependencies...", async (updateMessage) => {
257878
258337
  await execa({ cwd: resolvedPath, shell: true })`${installCommand}`;
257879
258338
  updateMessage("Building project...");
257880
- await execa({
257881
- cwd: resolvedPath,
257882
- shell: true,
257883
- env: { VITE_BASE44_APP_ID: projectId }
257884
- })`${buildCommand}`;
258339
+ await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
257885
258340
  updateMessage("Deploying site...");
257886
- return await deploySite(join25(resolvedPath, outputDirectory));
258341
+ return await deploySite(join26(resolvedPath, outputDirectory));
257887
258342
  }, {
257888
258343
  successMessage: theme.colors.base44Orange("Site deployed successfully"),
257889
258344
  errorMessage: "Failed to deploy site"
@@ -258012,7 +258467,7 @@ async function createInteractive(options, ctx) {
258012
258467
  }, ctx);
258013
258468
  }
258014
258469
  async function createNonInteractive(options, ctx) {
258015
- ctx.log.info(`Creating a new project at ${resolve8(options.path)}`);
258470
+ ctx.log.info(`Creating a new project at ${resolve11(options.path)}`);
258016
258471
  const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
258017
258472
  return await executeCreate({
258018
258473
  template: template2,
@@ -258036,7 +258491,7 @@ async function executeCreate({
258036
258491
  }, ctx) {
258037
258492
  const { log, runTask: runTask2 } = ctx;
258038
258493
  const name2 = rawName.trim();
258039
- const resolvedPath = resolve8(projectPath);
258494
+ const resolvedPath = resolve11(projectPath);
258040
258495
  const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
258041
258496
  const { projectId } = await runTask2("Setting up your project...", async () => {
258042
258497
  return await createProjectFiles({
@@ -258086,6 +258541,81 @@ Examples:
258086
258541
  $ base44 create my-app --workspace 507f1f77bcf86cd799439011 Creates a base44 project in the given workspace`).hook("preAction", validateCreateOptions).action(createAction);
258087
258542
  }
258088
258543
 
258544
+ // src/cli/commands/site/deploy-options.ts
258545
+ function addDeploymentOptions(command2) {
258546
+ return command2.addOption(new Option("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash)).addOption(new Option("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency));
258547
+ }
258548
+ function parseGitHash(value) {
258549
+ if (!isGitCommitHash(value)) {
258550
+ throw new InvalidArgumentError("Expected a git commit hash (7-64 hex chars).");
258551
+ }
258552
+ return value;
258553
+ }
258554
+ function parseConcurrency(value) {
258555
+ const parsed = Number(value);
258556
+ if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_UPLOAD_CONCURRENCY) {
258557
+ throw new InvalidArgumentError(`Expected a whole number between 1 and ${MAX_UPLOAD_CONCURRENCY}.`);
258558
+ }
258559
+ return parsed;
258560
+ }
258561
+
258562
+ // src/cli/commands/site/run-app-deploy.ts
258563
+ var TASK_LABELS = {
258564
+ "full-stack": {
258565
+ start: "Deploying full-stack app...",
258566
+ success: theme.colors.base44Orange("Full-stack app deployed"),
258567
+ error: "Full-stack deploy failed"
258568
+ },
258569
+ "static-deployment": {
258570
+ start: "Deploying site...",
258571
+ success: "Site deployed",
258572
+ error: "Site deploy failed"
258573
+ },
258574
+ static: {
258575
+ start: "Creating archive and deploying site...",
258576
+ success: "Site deployed successfully",
258577
+ error: "Deployment failed"
258578
+ }
258579
+ };
258580
+ async function runAppSiteDeploy({ runTask: runTask2, log }, target, options = {}) {
258581
+ const kind = await detectAppDeployKind(target);
258582
+ if (kind === "none")
258583
+ return { kind: "none" };
258584
+ const labels = TASK_LABELS[kind];
258585
+ const progressLines = [];
258586
+ const warnings = [];
258587
+ const result = await runTask2(labels.start, async (updateMessage) => await deployAppSite(target, {
258588
+ gitHash: options.gitHash,
258589
+ concurrency: options.concurrency,
258590
+ progress: {
258591
+ onWarning: (message) => {
258592
+ warnings.push(message);
258593
+ },
258594
+ onAssets: ({ totalAssets, newAssets }) => {
258595
+ const line = `Found ${totalAssets} static assets (${newAssets} new)`;
258596
+ progressLines.push(line);
258597
+ updateMessage(line);
258598
+ },
258599
+ onAssetUpload: ({ uploadedFiles, totalFiles }) => {
258600
+ updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
258601
+ },
258602
+ onWorker: ({ moduleCount }) => {
258603
+ updateMessage(`Deploying worker (${moduleCount} modules)…`);
258604
+ }
258605
+ }
258606
+ }), {
258607
+ successMessage: labels.success,
258608
+ errorMessage: labels.error
258609
+ });
258610
+ for (const line of progressLines) {
258611
+ log.message(theme.styles.dim(line));
258612
+ }
258613
+ for (const warning of warnings) {
258614
+ log.warn(warning);
258615
+ }
258616
+ return result;
258617
+ }
258618
+
258089
258619
  // src/cli/commands/project/deploy.ts
258090
258620
  async function deployAction(ctx, options = {}) {
258091
258621
  const { isNonInteractive, log } = ctx;
@@ -258093,12 +258623,13 @@ async function deployAction(ctx, options = {}) {
258093
258623
  throw new InvalidInputError("--yes is required in non-interactive mode");
258094
258624
  }
258095
258625
  const projectData = await readProjectConfig(options.projectRoot);
258096
- if (!hasResourcesToDeploy(projectData)) {
258626
+ const { project: project2, entities, functions, agents, connectors, authConfig } = projectData;
258627
+ const plannedSite = await detectAppDeployKind(project2);
258628
+ if (!hasResourcesToDeploy(projectData) && plannedSite === "none") {
258097
258629
  return {
258098
258630
  outroMessage: "No resources found to deploy"
258099
258631
  };
258100
258632
  }
258101
- const { project: project2, entities, functions, agents, connectors, authConfig } = projectData;
258102
258633
  const summaryLines = [];
258103
258634
  if (entities.length > 0) {
258104
258635
  summaryLines.push(` - ${entities.length} ${entities.length === 1 ? "entity" : "entities"}`);
@@ -258118,7 +258649,9 @@ async function deployAction(ctx, options = {}) {
258118
258649
  if (project2.visibility) {
258119
258650
  summaryLines.push(` - Visibility: ${project2.visibility}`);
258120
258651
  }
258121
- if (project2.site?.outputDirectory) {
258652
+ if (plannedSite === "full-stack") {
258653
+ summaryLines.push(" - Full-stack app");
258654
+ } else if (project2.site?.outputDirectory) {
258122
258655
  summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
258123
258656
  }
258124
258657
  if (!options.yes) {
@@ -258140,6 +258673,7 @@ ${summaryLines.join(`
258140
258673
  let functionCompleted = 0;
258141
258674
  const functionTotal = functions.length;
258142
258675
  const result = await deployAll(projectData, {
258676
+ site: false,
258143
258677
  onVisibilitySet: (level) => {
258144
258678
  log.success(`App visibility set to ${level}`);
258145
258679
  },
@@ -258152,6 +258686,10 @@ ${summaryLines.join(`
258152
258686
  formatDeployResult(r, log);
258153
258687
  }
258154
258688
  });
258689
+ const siteResult = await runAppSiteDeploy(ctx, project2, {
258690
+ gitHash: options.gitHash,
258691
+ concurrency: options.concurrency
258692
+ });
258155
258693
  const connectorResults = result.connectorResults ?? [];
258156
258694
  await handleOAuthConnectors(connectorResults, isNonInteractive, options, log);
258157
258695
  const stripeResult = connectorResults.find((r) => r.type === "stripe");
@@ -258159,13 +258697,28 @@ ${summaryLines.join(`
258159
258697
  printStripeResult(stripeResult, log);
258160
258698
  }
258161
258699
  log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
258162
- if (result.appUrl) {
258163
- log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
258700
+ if (siteResult.kind === "static") {
258701
+ log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(siteResult.appUrl)}`);
258702
+ }
258703
+ const deployment = siteResult.kind === "full-stack" || siteResult.kind === "static-deployment" ? siteResult : undefined;
258704
+ if (deployment) {
258705
+ printDeploymentSummary(deployment, log);
258164
258706
  }
258165
- return { outroMessage: "App deployed successfully" };
258707
+ return {
258708
+ outroMessage: "App deployed successfully",
258709
+ stdout: ctx.jsonMode && deployment ? `${JSON.stringify({
258710
+ deploymentId: deployment.deploymentId,
258711
+ gitHash: deployment.gitHash
258712
+ }, null, 2)}
258713
+ ` : undefined
258714
+ };
258715
+ }
258716
+ function printDeploymentSummary(deployment, log) {
258717
+ log.message(`${theme.styles.header("Deployment")}: ${deployment.deploymentId} ${theme.styles.dim(`(commit ${deployment.gitHash.slice(0, 12)})`)}`);
258166
258718
  }
258167
258719
  function getDeployCommand2() {
258168
- return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").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)").action(deployAction);
258720
+ const command2 = new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").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)");
258721
+ return addDeploymentOptions(command2).action(deployAction);
258169
258722
  }
258170
258723
  async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
258171
258724
  const needsOAuth = filterPendingOAuth(connectorResults);
@@ -258443,7 +258996,7 @@ async function followLogs(functionNames, options, availableFunctionNames, jsonMo
258443
258996
  for (const entry of fresh)
258444
258997
  writeFollowLine(entry, jsonMode);
258445
258998
  first = false;
258446
- await new Promise((resolve9) => setTimeout(resolve9, 2000));
258999
+ await new Promise((resolve12) => setTimeout(resolve12, 2000));
258447
259000
  }
258448
259001
  }
258449
259002
  function formatLogs(entries, env3) {
@@ -258557,7 +259110,7 @@ function getLogsCommand() {
258557
259110
  }
258558
259111
 
258559
259112
  // src/cli/commands/project/scaffold.ts
258560
- import { basename as basename6, resolve as resolve9 } from "node:path";
259113
+ import { basename as basename6, resolve as resolve12 } from "node:path";
258561
259114
  function resolveAppId(options) {
258562
259115
  const appId = options.appId;
258563
259116
  if (!appId) {
@@ -258573,7 +259126,7 @@ function resolveAppId(options) {
258573
259126
  async function scaffoldAction(ctx, name2, options, command2) {
258574
259127
  const { log, runTask: runTask2 } = ctx;
258575
259128
  const appId = resolveAppId(command2.optsWithGlobals());
258576
- const resolvedPath = resolve9("./");
259129
+ const resolvedPath = resolve12("./");
258577
259130
  const projectName = (name2 ?? basename6(resolvedPath)).trim();
258578
259131
  const template2 = await getTemplateById("backend-only");
258579
259132
  log.info(`Scaffolding project at ${resolvedPath}`);
@@ -258970,7 +259523,7 @@ function getSecretsListCommand() {
258970
259523
  }
258971
259524
 
258972
259525
  // src/cli/commands/secrets/set.ts
258973
- import { resolve as resolve10 } from "node:path";
259526
+ import { resolve as resolve13 } from "node:path";
258974
259527
  function parseEntries(entries) {
258975
259528
  const secrets = {};
258976
259529
  for (const entry of entries) {
@@ -259001,7 +259554,7 @@ async function setSecretsAction({ log, runTask: runTask2 }, entries, options) {
259001
259554
  validateInput(entries, options);
259002
259555
  let secrets;
259003
259556
  if (options.envFile) {
259004
- secrets = await parseEnvFile(resolve10(options.envFile));
259557
+ secrets = await parseEnvFile(resolve13(options.envFile));
259005
259558
  if (Object.keys(secrets).length === 0) {
259006
259559
  throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
259007
259560
  }
@@ -259030,92 +259583,53 @@ function getSecretsCommand() {
259030
259583
  }
259031
259584
 
259032
259585
  // src/cli/commands/site/deploy.ts
259033
- import { resolve as resolve11 } from "node:path";
259034
259586
  async function deployAction2(ctx, options) {
259035
259587
  const { isNonInteractive } = ctx;
259036
259588
  if (isNonInteractive && !options.yes) {
259037
259589
  throw new InvalidInputError("--yes is required in non-interactive mode");
259038
259590
  }
259039
259591
  const { project: project2 } = await readProjectConfig();
259040
- const outputDirectory = project2.site?.outputDirectory;
259041
- if (!outputDirectory) {
259592
+ const kind = await detectAppDeployKind(project2);
259593
+ if (kind === "none") {
259042
259594
  throw new ConfigNotFoundError("No site configuration found.", {
259043
259595
  hints: [
259044
259596
  {
259045
259597
  message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
259598
+ },
259599
+ {
259600
+ message: "Full-stack apps ship from their build artifact — run your framework's build first"
259046
259601
  }
259047
259602
  ]
259048
259603
  });
259049
259604
  }
259050
259605
  if (!options.yes) {
259051
259606
  const shouldDeploy = await Re({
259052
- message: `Deploy site from ${outputDirectory}?`
259607
+ message: kind === "full-stack" ? "Deploy full-stack app?" : `Deploy site from ${project2.site?.outputDirectory}?`
259053
259608
  });
259054
259609
  if (Ct(shouldDeploy) || !shouldDeploy) {
259055
259610
  return { outroMessage: "Deployment cancelled" };
259056
259611
  }
259057
259612
  }
259058
259613
  await maybeBuildBeforeDeploy(ctx, project2, options.build);
259059
- const outputDir = resolve11(project2.root, outputDirectory);
259060
- const { gitHash, concurrency } = options;
259061
- return gitHash ? await deployToDeploymentsApi(ctx, outputDir, gitHash, concurrency) : await deployTarball(ctx, outputDir);
259062
- }
259063
- async function deployToDeploymentsApi({ runTask: runTask2, log, jsonMode }, outputDir, gitHash, concurrency) {
259064
- const progressLines = [];
259065
- const { deploymentId } = await runTask2("Deploying site...", async (updateMessage) => await deployStaticSite({
259066
- outputDir,
259067
- gitHash,
259068
- concurrency,
259069
- progress: {
259070
- onAssets: ({ totalAssets, newAssets }) => {
259071
- const line = `Found ${totalAssets} static assets (${newAssets} new)`;
259072
- progressLines.push(line);
259073
- updateMessage(line);
259074
- },
259075
- onAssetUpload: ({ uploadedFiles, totalFiles }) => {
259076
- updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
259077
- }
259078
- }
259079
- }), { successMessage: "Site deployed", errorMessage: "Site deploy failed" });
259080
- for (const line of progressLines) {
259081
- log.message(theme.styles.dim(line));
259082
- }
259083
- return {
259084
- outroMessage: `Deployment ${deploymentId} (commit ${gitHash.slice(0, 12)})`,
259085
- stdout: jsonMode ? `${JSON.stringify({ deploymentId, gitHash }, null, 2)}
259086
- ` : undefined
259087
- };
259088
- }
259089
- async function deployTarball({ runTask: runTask2 }, outputDir) {
259090
- const { appUrl } = await runTask2("Creating archive and deploying site...", async () => await deploySite(outputDir), {
259091
- successMessage: "Site deployed successfully",
259092
- errorMessage: "Deployment failed"
259614
+ const result = await runAppSiteDeploy(ctx, project2, {
259615
+ gitHash: options.gitHash,
259616
+ concurrency: options.concurrency
259093
259617
  });
259094
- return { outroMessage: `Visit your site at: ${appUrl}` };
259095
- }
259096
- function getSiteDeployCommand() {
259097
- const command2 = 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)");
259098
- if (staticDeploymentsEnabled()) {
259099
- command2.addOption(new Option("--git-hash <hash>", "Commit the build came from — deploys through the deployments API").argParser((value) => {
259100
- if (!isGitCommitHash(value)) {
259101
- throw new InvalidArgumentError("Expected a git commit hash (7-64 hex chars).");
259102
- }
259103
- return value;
259104
- }));
259105
- command2.addOption(new Option("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency));
259618
+ if (result.kind === "full-stack" || result.kind === "static-deployment") {
259619
+ return {
259620
+ outroMessage: `Deployment ${result.deploymentId} (commit ${result.gitHash.slice(0, 12)})`,
259621
+ stdout: ctx.jsonMode ? `${JSON.stringify({ deploymentId: result.deploymentId, gitHash: result.gitHash }, null, 2)}
259622
+ ` : undefined
259623
+ };
259106
259624
  }
259107
- return command2.action(deployAction2);
259108
- }
259109
- function parseConcurrency(value) {
259110
- const parsed = Number(value);
259111
- if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_UPLOAD_CONCURRENCY) {
259112
- throw new InvalidArgumentError(`Expected a whole number between 1 and ${MAX_UPLOAD_CONCURRENCY}.`);
259625
+ if (result.kind === "static") {
259626
+ return { outroMessage: `Visit your site at: ${result.appUrl}` };
259113
259627
  }
259114
- return parsed;
259628
+ return { outroMessage: "Nothing to deploy" };
259115
259629
  }
259116
- function staticDeploymentsEnabled(env3 = process.env) {
259117
- const value = env3.BASE44_STATIC_DEPLOYMENTS;
259118
- return value === "1" || value === "true";
259630
+ function getSiteDeployCommand() {
259631
+ const command2 = new Base44Command("deploy").description("Deploy the built site to Base44 hosting (full-stack apps deploy their Workers build)").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)");
259632
+ return addDeploymentOptions(command2).action(deployAction2);
259119
259633
  }
259120
259634
 
259121
259635
  // src/cli/commands/site/open.ts
@@ -259222,10 +259736,10 @@ function toPascalCase(name2) {
259222
259736
  return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
259223
259737
  }
259224
259738
  // src/core/types/update-project.ts
259225
- import { join as join28 } from "node:path";
259739
+ import { join as join29 } from "node:path";
259226
259740
  var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
259227
259741
  async function updateProjectConfig(projectRoot) {
259228
- const tsconfigPath = join28(projectRoot, "tsconfig.json");
259742
+ const tsconfigPath = join29(projectRoot, "tsconfig.json");
259229
259743
  if (!await pathExists(tsconfigPath)) {
259230
259744
  return false;
259231
259745
  }
@@ -259460,7 +259974,7 @@ function createDevLogger(label2, labelColor = theme.styles.dim) {
259460
259974
  // src/cli/dev/dev-server/main.ts
259461
259975
  var import_cors = __toESM(require_lib4(), 1);
259462
259976
  var import_express6 = __toESM(require_express(), 1);
259463
- import { dirname as dirname23, join as join35 } from "node:path";
259977
+ import { dirname as dirname24, join as join36 } from "node:path";
259464
259978
 
259465
259979
  // ../../node_modules/get-port/index.js
259466
259980
  import net from "node:net";
@@ -259487,14 +260001,14 @@ var getLocalHosts = () => {
259487
260001
  }
259488
260002
  return results;
259489
260003
  };
259490
- var checkAvailablePort = (options8) => new Promise((resolve13, reject) => {
260004
+ var checkAvailablePort = (options8) => new Promise((resolve15, reject) => {
259491
260005
  const server = net.createServer();
259492
260006
  server.unref();
259493
260007
  server.on("error", reject);
259494
260008
  server.listen(options8, () => {
259495
260009
  const { port } = server.address();
259496
260010
  server.close(() => {
259497
- resolve13(port);
260011
+ resolve15(port);
259498
260012
  });
259499
260013
  });
259500
260014
  });
@@ -259595,7 +260109,7 @@ var $setGracefulCleanup = tmp.setGracefulCleanup;
259595
260109
 
259596
260110
  // src/cli/dev/dev-server/function-manager.ts
259597
260111
  import { spawn as spawn2 } from "node:child_process";
259598
- import { dirname as dirname20, join as join29 } from "node:path";
260112
+ import { dirname as dirname21, join as join30 } from "node:path";
259599
260113
  import { pathToFileURL } from "node:url";
259600
260114
 
259601
260115
  // src/cli/dev/dev-server/base-function-manager.ts
@@ -259700,7 +260214,7 @@ class FunctionManager extends BaseFunctionManager {
259700
260214
  }
259701
260215
  spawnFunction(func, port) {
259702
260216
  this.logger.log(`Spawning function "${func.name}" on port ${port}`);
259703
- const importMapPath = join29(dirname20(this.wrapperPath), "import-map.json");
260217
+ const importMapPath = join30(dirname21(this.wrapperPath), "import-map.json");
259704
260218
  const process23 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
259705
260219
  env: {
259706
260220
  ...globalThis.process.env,
@@ -259739,7 +260253,7 @@ class FunctionManager extends BaseFunctionManager {
259739
260253
  });
259740
260254
  }
259741
260255
  waitForReady(name2, runningFunc) {
259742
- return new Promise((resolve13, reject) => {
260256
+ return new Promise((resolve15, reject) => {
259743
260257
  runningFunc.process.on("exit", (code2) => {
259744
260258
  if (!runningFunc.ready) {
259745
260259
  clearTimeout(timeout3);
@@ -259762,7 +260276,7 @@ class FunctionManager extends BaseFunctionManager {
259762
260276
  runningFunc.ready = true;
259763
260277
  clearTimeout(timeout3);
259764
260278
  runningFunc.process.stdout?.off("data", onData);
259765
- resolve13(runningFunc.port);
260279
+ resolve15(runningFunc.port);
259766
260280
  }
259767
260281
  };
259768
260282
  runningFunc.process.stdout?.on("data", onData);
@@ -259774,7 +260288,7 @@ class FunctionManager extends BaseFunctionManager {
259774
260288
  import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
259775
260289
  import { isBuiltin } from "node:module";
259776
260290
  import { homedir as homedir3 } from "node:os";
259777
- import { join as join30 } from "node:path";
260291
+ import { join as join31 } from "node:path";
259778
260292
  import { pathToFileURL as pathToFileURL6 } from "node:url";
259779
260293
  var depsPromise;
259780
260294
  function loadDeps() {
@@ -259895,9 +260409,9 @@ export default {
259895
260409
  };
259896
260410
  `;
259897
260411
  function ensureBundlerConfig() {
259898
- const dir = join30(homedir3(), ".base44", "function-bundler");
260412
+ const dir = join31(homedir3(), ".base44", "function-bundler");
259899
260413
  mkdirSync2(dir, { recursive: true });
259900
- const configPath = join30(dir, "deno.json");
260414
+ const configPath = join31(dir, "deno.json");
259901
260415
  writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
259902
260416
  `);
259903
260417
  return configPath;
@@ -261348,16 +261862,16 @@ function createCustomIntegrationRoutes(remoteProxy, logger2) {
261348
261862
 
261349
261863
  // src/cli/dev/dev-server/watcher.ts
261350
261864
  import { EventEmitter as EventEmitter4 } from "node:events";
261351
- import { relative as relative6 } from "node:path";
261865
+ import { relative as relative7 } from "node:path";
261352
261866
 
261353
261867
  // ../../node_modules/chokidar/index.js
261354
261868
  import { EventEmitter as EventEmitter3 } from "node:events";
261355
261869
  import { stat as statcb, Stats } from "node:fs";
261356
- import { readdir as readdir3, stat as stat5 } from "node:fs/promises";
261870
+ import { readdir as readdir3, stat as stat6 } from "node:fs/promises";
261357
261871
  import * as sp3 from "node:path";
261358
261872
 
261359
261873
  // ../../node_modules/readdirp/index.js
261360
- import { lstat as lstat2, readdir as readdir2, realpath, stat as stat3 } from "node:fs/promises";
261874
+ import { lstat as lstat2, readdir as readdir2, realpath, stat as stat4 } from "node:fs/promises";
261361
261875
  import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
261362
261876
  import { Readable as Readable6 } from "node:stream";
261363
261877
  var EntryTypes = {
@@ -261439,7 +261953,7 @@ class ReaddirpStream extends Readable6 {
261439
261953
  const { root: root2, type } = opts;
261440
261954
  this._fileFilter = normalizeFilter(opts.fileFilter);
261441
261955
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
261442
- const statMethod = opts.lstat ? lstat2 : stat3;
261956
+ const statMethod = opts.lstat ? lstat2 : stat4;
261443
261957
  if (wantBigintFsStats) {
261444
261958
  this._stat = (path19) => statMethod(path19, { bigint: true });
261445
261959
  } else {
@@ -261592,7 +262106,7 @@ function readdirp(root2, options8 = {}) {
261592
262106
 
261593
262107
  // ../../node_modules/chokidar/handler.js
261594
262108
  import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
261595
- import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat4 } from "node:fs/promises";
262109
+ import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat5 } from "node:fs/promises";
261596
262110
  import { type as osType } from "node:os";
261597
262111
  import * as sp2 from "node:path";
261598
262112
  var STR_DATA = "data";
@@ -261618,7 +262132,7 @@ var EVENTS = {
261618
262132
  };
261619
262133
  var EV = EVENTS;
261620
262134
  var THROTTLE_MODE_WATCH = "watch";
261621
- var statMethods = { lstat: lstat3, stat: stat4 };
262135
+ var statMethods = { lstat: lstat3, stat: stat5 };
261622
262136
  var KEY_LISTENERS = "listeners";
261623
262137
  var KEY_ERR = "errHandlers";
261624
262138
  var KEY_RAW = "rawEmitters";
@@ -262078,9 +262592,9 @@ class NodeFsHandler {
262078
262592
  if (this.fsw.closed) {
262079
262593
  return;
262080
262594
  }
262081
- const dirname22 = sp2.dirname(file2);
262595
+ const dirname23 = sp2.dirname(file2);
262082
262596
  const basename8 = sp2.basename(file2);
262083
- const parent = this.fsw._getWatchedDir(dirname22);
262597
+ const parent = this.fsw._getWatchedDir(dirname23);
262084
262598
  let prevStats = stats;
262085
262599
  if (parent.has(basename8))
262086
262600
  return;
@@ -262089,7 +262603,7 @@ class NodeFsHandler {
262089
262603
  return;
262090
262604
  if (!newStats || newStats.mtimeMs === 0) {
262091
262605
  try {
262092
- const newStats2 = await stat4(file2);
262606
+ const newStats2 = await stat5(file2);
262093
262607
  if (this.fsw.closed)
262094
262608
  return;
262095
262609
  const at13 = newStats2.atimeMs;
@@ -262107,7 +262621,7 @@ class NodeFsHandler {
262107
262621
  prevStats = newStats2;
262108
262622
  }
262109
262623
  } catch (error48) {
262110
- this.fsw._remove(dirname22, basename8);
262624
+ this.fsw._remove(dirname23, basename8);
262111
262625
  }
262112
262626
  } else if (parent.has(basename8)) {
262113
262627
  const at13 = newStats.atimeMs;
@@ -262196,7 +262710,7 @@ class NodeFsHandler {
262196
262710
  this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
262197
262711
  }
262198
262712
  }).on(EV.ERROR, this._boundHandleError);
262199
- return new Promise((resolve14, reject) => {
262713
+ return new Promise((resolve16, reject) => {
262200
262714
  if (!stream)
262201
262715
  return reject();
262202
262716
  stream.once(STR_END, () => {
@@ -262205,7 +262719,7 @@ class NodeFsHandler {
262205
262719
  return;
262206
262720
  }
262207
262721
  const wasThrottled = throttler ? throttler.clear() : false;
262208
- resolve14(undefined);
262722
+ resolve16(undefined);
262209
262723
  previous.getChildren().filter((item) => {
262210
262724
  return item !== directory && !current.has(item);
262211
262725
  }).forEach((item) => {
@@ -262330,11 +262844,11 @@ function createPattern(matcher) {
262330
262844
  if (matcher.path === string4)
262331
262845
  return true;
262332
262846
  if (matcher.recursive) {
262333
- const relative6 = sp3.relative(matcher.path, string4);
262334
- if (!relative6) {
262847
+ const relative7 = sp3.relative(matcher.path, string4);
262848
+ if (!relative7) {
262335
262849
  return false;
262336
262850
  }
262337
- return !relative6.startsWith("..") && !sp3.isAbsolute(relative6);
262851
+ return !relative7.startsWith("..") && !sp3.isAbsolute(relative7);
262338
262852
  }
262339
262853
  return false;
262340
262854
  };
@@ -262761,7 +263275,7 @@ class FSWatcher extends EventEmitter3 {
262761
263275
  const fullPath = opts.cwd ? sp3.join(opts.cwd, path19) : path19;
262762
263276
  let stats2;
262763
263277
  try {
262764
- stats2 = await stat5(fullPath);
263278
+ stats2 = await stat6(fullPath);
262765
263279
  } catch (err) {}
262766
263280
  if (!stats2 || this.closed)
262767
263281
  return;
@@ -262865,8 +263379,8 @@ class FSWatcher extends EventEmitter3 {
262865
263379
  }
262866
263380
  return this._userIgnored(path19, stats);
262867
263381
  }
262868
- _isntIgnored(path19, stat6) {
262869
- return !this._isIgnored(path19, stat6);
263382
+ _isntIgnored(path19, stat7) {
263383
+ return !this._isIgnored(path19, stat7);
262870
263384
  }
262871
263385
  _getWatchHelpers(path19) {
262872
263386
  return new WatchHelper(path19, this.options.followSymlinks, this);
@@ -263033,7 +263547,7 @@ class WatchBase44 extends EventEmitter4 {
263033
263547
  ignoreInitial: true
263034
263548
  });
263035
263549
  watcher.on("all", import_debounce.default(async (_event, path19) => {
263036
- this.emit("change", name2, relative6(targetPath, path19));
263550
+ this.emit("change", name2, relative7(targetPath, path19));
263037
263551
  }, WATCH_DEBOUNCE_MS));
263038
263552
  watcher.on("error", (err) => {
263039
263553
  this.logger.error(`Watch handler failed for ${targetPath}`, err);
@@ -263122,7 +263636,7 @@ async function createDevServer(options8) {
263122
263636
  }
263123
263637
  remoteProxy(req, res, next);
263124
263638
  });
263125
- const server = await new Promise((resolve15, reject) => {
263639
+ const server = await new Promise((resolve17, reject) => {
263126
263640
  const s5 = app.listen(port, "127.0.0.1", (err) => {
263127
263641
  if (err) {
263128
263642
  if ("code" in err && err.code === "EADDRINUSE") {
@@ -263131,7 +263645,7 @@ async function createDevServer(options8) {
263131
263645
  reject(err);
263132
263646
  }
263133
263647
  } else {
263134
- resolve15(s5);
263648
+ resolve17(s5);
263135
263649
  }
263136
263650
  });
263137
263651
  });
@@ -263140,8 +263654,8 @@ async function createDevServer(options8) {
263140
263654
  broadcastEntityEvent(io6, appId, entityName, event);
263141
263655
  };
263142
263656
  const base44ConfigWatcher = new WatchBase44({
263143
- functions: join35(dirname23(project2.configPath), project2.functionsDir),
263144
- entities: join35(dirname23(project2.configPath), project2.entitiesDir)
263657
+ functions: join36(dirname24(project2.configPath), project2.functionsDir),
263658
+ entities: join36(dirname24(project2.configPath), project2.entitiesDir)
263145
263659
  }, devLogger);
263146
263660
  base44ConfigWatcher.on("change", async (name2) => {
263147
263661
  try {
@@ -263181,13 +263695,13 @@ async function createDevServer(options8) {
263181
263695
  if (!server.listening) {
263182
263696
  return;
263183
263697
  }
263184
- await new Promise((resolve15, reject) => {
263698
+ await new Promise((resolve17, reject) => {
263185
263699
  server.close((error48) => {
263186
263700
  if (error48) {
263187
263701
  reject(error48);
263188
263702
  return;
263189
263703
  }
263190
- resolve15();
263704
+ resolve17();
263191
263705
  });
263192
263706
  });
263193
263707
  };
@@ -263258,15 +263772,15 @@ class ServeRunner {
263258
263772
  return;
263259
263773
  }
263260
263774
  this.stopping = true;
263261
- const exited = new Promise((resolve15) => child.once("exit", () => resolve15()));
263775
+ const exited = new Promise((resolve17) => child.once("exit", () => resolve17()));
263262
263776
  if (process23.platform === "win32" && child.pid) {
263263
263777
  const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
263264
263778
  stdio: "ignore",
263265
263779
  windowsHide: true
263266
263780
  });
263267
- await new Promise((resolve15) => {
263268
- taskkill.once("exit", () => resolve15());
263269
- taskkill.once("error", () => resolve15());
263781
+ await new Promise((resolve17) => {
263782
+ taskkill.once("exit", () => resolve17());
263783
+ taskkill.once("error", () => resolve17());
263270
263784
  });
263271
263785
  } else if (child.pid) {
263272
263786
  try {
@@ -263337,10 +263851,6 @@ function validateDevOptions(command2) {
263337
263851
  if (appId !== undefined) {
263338
263852
  command2.error(`base44 dev cannot be used with --app-id or ${BASE44_APP_ID_ENV_VAR}.`);
263339
263853
  }
263340
- const { port, remote } = command2.opts();
263341
- if (remote && port !== undefined) {
263342
- command2.error("--port applies to the local backend, which --remote does not start.");
263343
- }
263344
263854
  }
263345
263855
  function requireLinkedProject({ app }) {
263346
263856
  if (!app?.projectRoot) {
@@ -263348,44 +263858,31 @@ function requireLinkedProject({ app }) {
263348
263858
  }
263349
263859
  return { id: app.id, projectRoot: app.projectRoot };
263350
263860
  }
263351
- async function resolveConfiguredSite(app) {
263861
+ async function createConfiguredServeRunner(app, backendUrl) {
263352
263862
  const { project: project2 } = await readProjectConfig(app.projectRoot);
263353
263863
  const serveCommand = project2.site?.serveCommand;
263354
- return serveCommand ? { serveCommand, projectRoot: project2.root } : undefined;
263864
+ if (!serveCommand) {
263865
+ return;
263866
+ }
263867
+ return createServeCommandRunner({
263868
+ serveCommand,
263869
+ projectRoot: project2.root,
263870
+ appId: app.id,
263871
+ appBaseUrl: backendUrl
263872
+ });
263355
263873
  }
263356
- function stopRunnerOnProcessSignals(runner) {
263874
+ function startServeCommand(runner, backend) {
263357
263875
  const stop2 = () => void runner.stop();
263358
263876
  process.on("SIGINT", stop2);
263359
263877
  process.on("SIGTERM", stop2);
263360
- }
263361
- function startServeCommand(runner, backend) {
263362
- stopRunnerOnProcessSignals(runner);
263363
263878
  runner.onExit(() => {
263364
263879
  backend.shutdown().finally(() => process.exit(1));
263365
263880
  });
263366
263881
  createDevLogger("backend", theme.styles.info).log(`Backend running on ${backend.url}`);
263367
263882
  runner.start();
263368
263883
  }
263369
- async function remoteDevAction(app) {
263370
- const site2 = await resolveConfiguredSite(app);
263371
- if (!site2) {
263372
- throw new ConfigInvalidError("base44 dev --remote serves the frontend against the production backend, but this project has no site.serveCommand in base44/config.jsonc.");
263373
- }
263374
- const appBaseUrl = await getSiteUrl();
263375
- const runner = createServeCommandRunner({
263376
- ...site2,
263377
- appId: app.id,
263378
- appBaseUrl
263379
- });
263380
- stopRunnerOnProcessSignals(runner);
263381
- runner.onExit((code2) => process.exit(code2 ?? 1));
263382
- runner.start();
263383
- return {
263384
- outroMessage: `Frontend dev server targets ${theme.styles.bold(appBaseUrl)} — every write hits your live app`
263385
- };
263386
- }
263387
- async function localDevAction(ctx, app, options8) {
263388
- const site2 = await resolveConfiguredSite(app);
263884
+ async function devAction(ctx, options8) {
263885
+ const app = requireLinkedProject(ctx);
263389
263886
  const siteUrlPromise = getSiteUrl().catch(() => {
263390
263887
  return;
263391
263888
  });
@@ -263400,23 +263897,15 @@ async function localDevAction(ctx, app, options8) {
263400
263897
  }
263401
263898
  });
263402
263899
  const backendUrl = localServerUrl(backend.port);
263403
- if (site2) {
263404
- const runner = createServeCommandRunner({
263405
- ...site2,
263406
- appId: app.id,
263407
- appBaseUrl: backendUrl
263408
- });
263900
+ const runner = await createConfiguredServeRunner(app, backendUrl);
263901
+ if (runner) {
263409
263902
  startServeCommand(runner, { url: backendUrl, shutdown: backend.shutdown });
263410
263903
  }
263411
- const outroMessage = site2 ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(backendUrl)}`;
263904
+ const outroMessage = runner ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(backendUrl)}`;
263412
263905
  return { outroMessage };
263413
263906
  }
263414
- async function devAction(ctx, options8) {
263415
- const app = requireLinkedProject(ctx);
263416
- return options8.remote ? remoteDevAction(app) : localDevAction(ctx, app, options8);
263417
- }
263418
263907
  function getDevCommand() {
263419
- return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").option("--remote", "Serve the frontend against the production backend instead of a local one").hook("preAction", validateDevOptions).action(devAction);
263908
+ return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").hook("preAction", validateDevOptions).action(devAction);
263420
263909
  }
263421
263910
 
263422
263911
  // src/core/exec/run-script.ts
@@ -263461,13 +263950,13 @@ async function runScript(options8) {
263461
263950
  }
263462
263951
  // src/cli/commands/exec.ts
263463
263952
  function readStdin2() {
263464
- return new Promise((resolve15, reject) => {
263953
+ return new Promise((resolve17, reject) => {
263465
263954
  let data = "";
263466
263955
  process.stdin.setEncoding("utf-8");
263467
263956
  process.stdin.on("data", (chunk) => {
263468
263957
  data += chunk;
263469
263958
  });
263470
- process.stdin.on("end", () => resolve15(data));
263959
+ process.stdin.on("end", () => resolve17(data));
263471
263960
  process.stdin.on("error", reject);
263472
263961
  });
263473
263962
  }
@@ -263538,7 +264027,7 @@ Examples:
263538
264027
  }
263539
264028
 
263540
264029
  // src/cli/commands/project/eject.ts
263541
- import { resolve as resolve15 } from "node:path";
264030
+ import { resolve as resolve17 } from "node:path";
263542
264031
  var import_kebabCase2 = __toESM(require_kebabCase(), 1);
263543
264032
  async function eject(ctx, options8, command2) {
263544
264033
  const { log, runTask: runTask2, isNonInteractive } = ctx;
@@ -263602,7 +264091,7 @@ async function eject(ctx, options8, command2) {
263602
264091
  Ne("Operation cancelled.");
263603
264092
  throw new CLIExitError(0);
263604
264093
  }
263605
- const resolvedPath = resolve15(selectedPath);
264094
+ const resolvedPath = resolve17(selectedPath);
263606
264095
  await runTask2("Downloading your project's code...", async (updateMessage) => {
263607
264096
  await createProjectFilesForExistingProject({
263608
264097
  projectId,
@@ -263695,7 +264184,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
263695
264184
  import { release, type } from "node:os";
263696
264185
 
263697
264186
  // ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
263698
- import { dirname as dirname24, posix, sep } from "path";
264187
+ import { dirname as dirname25, posix, sep as sep2 } from "path";
263699
264188
  function createModulerModifier() {
263700
264189
  const getModuleFromFileName = createGetModuleFromFilename();
263701
264190
  return async (frames) => {
@@ -263704,7 +264193,7 @@ function createModulerModifier() {
263704
264193
  return frames;
263705
264194
  };
263706
264195
  }
263707
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname24(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
264196
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname25(process.argv[1]) : process.cwd(), isWindows5 = sep2 === "\\") {
263708
264197
  const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
263709
264198
  return (filename) => {
263710
264199
  if (!filename)
@@ -265982,14 +266471,14 @@ async function addSourceContext(frames) {
265982
266471
  return frames;
265983
266472
  }
265984
266473
  function getContextLinesFromFile(path19, ranges, output) {
265985
- return new Promise((resolve16) => {
266474
+ return new Promise((resolve18) => {
265986
266475
  const stream = createReadStream2(path19);
265987
266476
  const lineReaded = createInterface2({
265988
266477
  input: stream
265989
266478
  });
265990
266479
  function destroyStreamAndResolve() {
265991
266480
  stream.destroy();
265992
- resolve16();
266481
+ resolve18();
265993
266482
  }
265994
266483
  let lineNumber = 0;
265995
266484
  let currentRangeIndex = 0;
@@ -267101,15 +267590,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
267101
267590
  return true;
267102
267591
  if (this.featureFlagsPoller === undefined)
267103
267592
  return false;
267104
- return new Promise((resolve16) => {
267593
+ return new Promise((resolve18) => {
267105
267594
  const timeout3 = setTimeout(() => {
267106
267595
  cleanup();
267107
- resolve16(false);
267596
+ resolve18(false);
267108
267597
  }, timeoutMs);
267109
267598
  const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
267110
267599
  clearTimeout(timeout3);
267111
267600
  cleanup();
267112
- resolve16(count2 > 0);
267601
+ resolve18(count2 > 0);
267113
267602
  });
267114
267603
  });
267115
267604
  }
@@ -267893,9 +268382,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
267893
268382
  });
267894
268383
  }
267895
268384
  // src/cli/index.ts
267896
- var __dirname4 = dirname25(fileURLToPath6(import.meta.url));
268385
+ var __dirname4 = dirname26(fileURLToPath6(import.meta.url));
267897
268386
  async function runCLI(options8) {
267898
- ensureNpmAssets(join36(__dirname4, "../assets"));
268387
+ ensureNpmAssets(join37(__dirname4, "../assets"));
267899
268388
  const errorReporter = new ErrorReporter;
267900
268389
  errorReporter.registerProcessErrorHandlers();
267901
268390
  const jsonMode = process.argv.includes("--json");
@@ -267934,4 +268423,4 @@ export {
267934
268423
  CLIExitError
267935
268424
  };
267936
268425
 
267937
- //# debugId=5387AAD6203346FD64756E2164756E21
268426
+ //# debugId=0F2CA340A345A14E64756E2164756E21