@base44-preview/cli 0.1.7-pr.585.083d2ac → 0.1.7-pr.585.92ac4a7

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
@@ -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(resolve3, reject) {
23423
23423
  isexe(path11, options || {}, function(er, is) {
23424
23424
  if (er) {
23425
23425
  reject(er);
23426
23426
  } else {
23427
- resolve4(is);
23427
+ resolve3(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((resolve3, reject) => {
23490
23490
  if (i === pathEnv.length)
23491
- return opt.all && found.length ? resolve4(found) : reject(getNotFoundError(cmd));
23491
+ return opt.all && found.length ? resolve3(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
+ resolve3(subStep(p, i, 0));
23497
23497
  });
23498
- const subStep = (p, i, ii) => new Promise((resolve4, reject) => {
23498
+ const subStep = (p, i, ii) => new Promise((resolve3, reject) => {
23499
23499
  if (ii === pathExt.length)
23500
- return resolve4(step(i + 1));
23500
+ return resolve3(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 resolve3(p + ext);
23508
23508
  }
23509
- return resolve4(subStep(p, i, ii + 1));
23509
+ return resolve3(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 join15(array2, separator) {
27037
+ function join17(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 = join15;
28969
+ lodash.join = join17;
28970
28970
  lodash.kebabCase = kebabCase;
28971
28971
  lodash.last = last;
28972
28972
  lodash.lastIndexOf = lastIndexOf;
@@ -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, sep2, end, banNewLines = false) {
120388
+ function skipUntil(str, ptr, sep, 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, sep2, end, banNewLines = false) {
120394
120394
  let c24 = str[i5];
120395
120395
  if (c24 === "#") {
120396
120396
  i5 = indexOfNewline(str, i5);
120397
- } else if (c24 === sep2) {
120397
+ } else if (c24 === sep) {
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 extname2(url3) {
121177
+ function extname(url3) {
121178
121178
  const pathname = url3.pathname;
121179
121179
  let index = pathname.length;
121180
121180
  while (index--) {
@@ -121189,7 +121189,7 @@ function extname2(url3) {
121189
121189
  return "";
121190
121190
  }
121191
121191
  function getFileProtocolModuleFormat(url3, _context, ignoreErrors) {
121192
- const value = extname2(url3);
121192
+ const value = extname(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(modules2) {
123907
+ function createParsersAndPrinters(modules) {
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 modules2) {
123914
+ } of modules) {
123915
123915
  const loadPlugin2 = async () => {
123916
123916
  const plugin = await importPlugin2();
123917
123917
  Object.assign(parsers2, plugin.parsers);
@@ -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(resolve16) {
138291
- resolve16(value);
138290
+ return value instanceof P9 ? value : new P9(function(resolve13) {
138291
+ resolve13(value);
138292
138292
  });
138293
138293
  }
138294
- return new (P9 || (P9 = Promise))(function(resolve16, reject) {
138294
+ return new (P9 || (P9 = Promise))(function(resolve13, 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 ? resolve16(result.value) : adopt(result.value).then(fulfilled, rejected);
138310
+ result.done ? resolve13(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 = resolve16;
142963
+ exports.resolve = resolve13;
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 = relative5;
142975
+ exports.relative = relative4;
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 resolve16(from, to5) {
142991
+ function resolve13(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 relative5(from, to5) {
143125
+ function relative4(from, to5) {
143126
143126
  if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
143127
- return resolve16(from, to5);
143127
+ return resolve13(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((resolve16, reject) => {
143803
+ return new Promise((resolve13, 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
- resolve16({
143831
+ resolve13({
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(resolve16) {
145165
- resolve16(value);
145164
+ return value instanceof P9 ? value : new P9(function(resolve13) {
145165
+ resolve13(value);
145166
145166
  });
145167
145167
  }
145168
- return new (P9 || (P9 = Promise))(function(resolve16, reject) {
145168
+ return new (P9 || (P9 = Promise))(function(resolve13, 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 ? resolve16(result.value) : adopt(result.value).then(fulfilled, rejected);
145184
+ result.done ? resolve13(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(resolve16) {
145306
- resolve16(value);
145305
+ return value instanceof P9 ? value : new P9(function(resolve13) {
145306
+ resolve13(value);
145307
145307
  });
145308
145308
  }
145309
- return new (P9 || (P9 = Promise))(function(resolve16, reject) {
145309
+ return new (P9 || (P9 = Promise))(function(resolve13, 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 ? resolve16(result.value) : adopt(result.value).then(fulfilled, rejected);
145325
+ result.done ? resolve13(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 relative5 = __require("path").relative;
146454
+ var relative4 = __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 relative5(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
146650
+ return relative4(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 modules2 = [
150646
+ var modules = [
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 < modules2.length; i5++) {
150658
- module = modules2[i5];
150657
+ for (i5 = 0;i5 < modules.length; i5++) {
150658
+ module = modules[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(resolve16, reject) {
150987
+ return new Promise(function executor(resolve13, reject) {
150988
150988
  readStream(stream, encoding, length, limit, function onRead2(err, buf) {
150989
150989
  if (err)
150990
150990
  return reject(err);
150991
- resolve16(buf);
150991
+ resolve13(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 extname3 = __require("path").extname;
160795
+ var extname2 = __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 = extname3("x." + path18).toLowerCase().slice(1);
160852
+ var extension2 = extname2("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 dirname21 = path18.dirname;
164112
+ var dirname20 = path18.dirname;
164113
164113
  var basename6 = path18.basename;
164114
- var extname3 = path18.extname;
164114
+ var extname2 = path18.extname;
164115
164115
  var join29 = path18.join;
164116
- var resolve16 = path18.resolve;
164116
+ var resolve13 = 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 = extname3(name2);
164121
+ this.ext = extname2(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 = resolve16(root2, name2);
164151
- var dir = dirname21(loc);
164150
+ var loc = resolve13(root2, name2);
164151
+ var dir = dirname20(loc);
164152
164152
  var file2 = basename6(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 resolve17(dir, file2) {
164175
+ View.prototype.resolve = function resolve14(dir, file2) {
164176
164176
  var ext = this.ext;
164177
164177
  var path19 = join29(dir, file2);
164178
- var stat4 = tryStat(path19);
164179
- if (stat4 && stat4.isFile()) {
164178
+ var stat3 = tryStat(path19);
164179
+ if (stat3 && stat3.isFile()) {
164180
164180
  return path19;
164181
164181
  }
164182
164182
  path19 = join29(dir, basename6(file2, ext), "index" + ext);
164183
- stat4 = tryStat(path19);
164184
- if (stat4 && stat4.isFile()) {
164183
+ stat3 = tryStat(path19);
164184
+ if (stat3 && stat3.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(stat4) {
164236
- var mtime = stat4.mtime.getTime().toString(16);
164237
- var size = stat4.size.toString(16);
164235
+ function stattag(stat3) {
164236
+ var mtime = stat3.mtime.getTime().toString(16);
164237
+ var size = stat3.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 resolve16 = __require("node:path").resolve;
166334
+ var resolve13 = __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", resolve16("views"));
166388
+ this.set("views", resolve13("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 extname3 = path18.extname;
167876
+ var extname2 = path18.extname;
167877
167877
  var join29 = path18.join;
167878
167878
  var normalize2 = path18.normalize;
167879
- var resolve16 = path18.resolve;
167880
- var sep2 = path18.sep;
167879
+ var resolve13 = path18.resolve;
167880
+ var sep = 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 ? resolve16(opts.root) : null;
167908
+ this._root = opts.root ? resolve13(opts.root) : null;
167909
167909
  }
167910
167910
  util2.inherits(SendStream, Stream2);
167911
167911
  SendStream.prototype.error = function error48(status, err) {
@@ -168038,14 +168038,14 @@ var require_send = __commonJS((exports, module) => {
168038
168038
  var parts;
168039
168039
  if (root2 !== null) {
168040
168040
  if (path19) {
168041
- path19 = normalize2("." + sep2 + path19);
168041
+ path19 = normalize2("." + sep + 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(sep2);
168048
+ parts = path19.split(sep);
168049
168049
  path19 = normalize2(join29(root2, path19));
168050
168050
  } else {
168051
168051
  if (UP_PATH_REGEXP.test(path19)) {
@@ -168053,8 +168053,8 @@ var require_send = __commonJS((exports, module) => {
168053
168053
  this.error(403);
168054
168054
  return res;
168055
168055
  }
168056
- parts = normalize2(path19).split(sep2);
168057
- path19 = resolve16(path19);
168056
+ parts = normalize2(path19).split(sep);
168057
+ path19 = resolve13(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, stat4) {
168081
- var len = stat4.size;
168080
+ SendStream.prototype.send = function send2(path19, stat3) {
168081
+ var len = stat3.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, stat4);
168093
+ this.setHeader(path19, stat3);
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, stat4) {
168151
- var pathEndsWithSep = path19[path19.length - 1] === sep2;
168152
- if (err && err.code === "ENOENT" && !extname3(path19) && !pathEndsWithSep) {
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) {
168153
168153
  return next(err);
168154
168154
  }
168155
168155
  if (err)
168156
168156
  return self2.onStatError(err);
168157
- if (stat4.isDirectory())
168157
+ if (stat3.isDirectory())
168158
168158
  return self2.redirect(path19);
168159
168159
  if (pathEndsWithSep)
168160
168160
  return self2.error(404);
168161
- self2.emit("file", path19, stat4);
168162
- self2.send(path19, stat4);
168161
+ self2.emit("file", path19, stat3);
168162
+ self2.send(path19, stat3);
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, stat4) {
168170
+ fs28.stat(p4, function(err2, stat3) {
168171
168171
  if (err2)
168172
168172
  return next(err2);
168173
- if (stat4.isDirectory())
168173
+ if (stat3.isDirectory())
168174
168174
  return next();
168175
- self2.emit("file", p4, stat4);
168176
- self2.send(p4, stat4);
168175
+ self2.emit("file", p4, stat3);
168176
+ self2.send(p4, stat3);
168177
168177
  });
168178
168178
  }
168179
168179
  };
@@ -168188,13 +168188,13 @@ var require_send = __commonJS((exports, module) => {
168188
168188
  }
168189
168189
  var p4 = join29(path19, self2._index[i5]);
168190
168190
  debug('stat "%s"', p4);
168191
- fs28.stat(p4, function(err2, stat4) {
168191
+ fs28.stat(p4, function(err2, stat3) {
168192
168192
  if (err2)
168193
168193
  return next(err2);
168194
- if (stat4.isDirectory())
168194
+ if (stat3.isDirectory())
168195
168195
  return next();
168196
- self2.emit("file", p4, stat4);
168197
- self2.send(p4, stat4);
168196
+ self2.emit("file", p4, stat3);
168197
+ self2.send(p4, stat3);
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 = extname3(path19);
168224
+ var ext = extname2(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, stat4) {
168229
+ SendStream.prototype.setHeader = function setHeader(path19, stat3) {
168230
168230
  var res = this.res;
168231
- this.emit("headers", res, path19, stat4);
168231
+ this.emit("headers", res, path19, stat3);
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 = stat4.mtime.toUTCString();
168245
+ var modified = stat3.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(stat4);
168250
+ var val = etag(stat3);
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 extname3 = path18.extname;
168385
- var resolve16 = path18.resolve;
168384
+ var extname2 = path18.extname;
168385
+ var resolve13 = 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 ? resolve16(path19) : path19;
168594
+ var fullPath = !opts.root ? resolve13(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(extname3(filename));
168625
+ this.type(extname2(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 resolve16 = __require("path").resolve;
168855
+ var resolve13 = __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 = resolve16(root2);
168874
+ opts.root = resolve13(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(relative5, base) {
169799
- return useNativeURL ? new URL2(relative5, base) : parseUrl(url3.resolve(base, relative5));
169798
+ function resolveUrl(relative4, base) {
169799
+ return useNativeURL ? new URL2(relative4, base) : parseUrl(url3.resolve(base, relative4));
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((resolve16) => {
172249
- this._triggerBuffer = resolve16;
172248
+ this.buffer.chain(new Promise((resolve13) => {
172249
+ this._triggerBuffer = resolve13;
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((resolve16, reject) => {
173269
+ var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve13, 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
- resolve16();
173286
+ resolve13();
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((resolve16, reject) => {
173457
+ return new Promise((resolve13, 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
- resolve16({ data, indexes });
173500
+ resolve13({ 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 extname3 = __require("path").extname;
183033
+ var extname2 = __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 = extname3("x." + path18).toLowerCase().substr(1);
183088
+ var extension2 = extname2("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 extname3 = __require("path").extname;
193080
+ var extname2 = __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 = extname3("x." + path18).toLowerCase().substr(1);
193135
+ var extension2 = extname2("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((resolve16, reject) => {
199111
+ return new Promise((resolve13, 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 resolve16(responses);
199117
+ return resolve13(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((resolve16, reject) => {
199305
+ return new Promise((resolve13, reject) => {
199306
199306
  args.push((arg1, arg2) => {
199307
199307
  if (withErr) {
199308
- return arg1 ? reject(arg1) : resolve16(arg2);
199308
+ return arg1 ? reject(arg1) : resolve13(arg2);
199309
199309
  } else {
199310
- return resolve16(arg1);
199310
+ return resolve13(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((resolve16, reject) => {
199765
+ return new Promise((resolve13, 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 resolve16(responses);
199771
+ return resolve13(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((resolve16, reject) => {
203306
+ return new Promise((resolve13, 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: resolve16,
203316
+ resolve: resolve13,
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((resolve16, reject) => {
203526
+ return new Promise((resolve13, 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: resolve16,
203536
+ resolve: resolve13,
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((resolve16) => {
204265
+ return new Promise((resolve13) => {
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
- resolve16();
204271
+ resolve13();
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 extname3 = __require("path").extname;
213007
+ var extname2 = __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 = extname3("x." + path18).toLowerCase().substr(1);
213062
+ var extension2 = extname2("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, stat4) {
217395
- if (er22 || !stat4.isDirectory())
217394
+ xfs.stat(p4, function(er22, stat3) {
217395
+ if (er22 || !stat3.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 stat4;
217426
+ var stat3;
217427
217427
  try {
217428
- stat4 = xfs.statSync(p4);
217428
+ stat3 = xfs.statSync(p4);
217429
217429
  } catch (err1) {
217430
217430
  throw err0;
217431
217431
  }
217432
- if (!stat4.isDirectory())
217432
+ if (!stat3.isDirectory())
217433
217433
  throw err0;
217434
217434
  break;
217435
217435
  }
@@ -218930,14 +218930,14 @@ var require_async_iterator = __commonJS((exports, module) => {
218930
218930
  };
218931
218931
  }
218932
218932
  function readAndResolve(iter) {
218933
- var resolve16 = iter[kLastResolve];
218934
- if (resolve16 !== null) {
218933
+ var resolve13 = iter[kLastResolve];
218934
+ if (resolve13 !== 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
- resolve16(createIterResult(data, false));
218940
+ resolve13(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(resolve16, reject) {
218948
+ return function(resolve13, reject) {
218949
218949
  lastPromise.then(function() {
218950
218950
  if (iter[kEnded]) {
218951
- resolve16(createIterResult(undefined, true));
218951
+ resolve13(createIterResult(undefined, true));
218952
218952
  return;
218953
218953
  }
218954
- iter[kHandlePromise](resolve16, reject);
218954
+ iter[kHandlePromise](resolve13, 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(resolve16, reject) {
218973
+ return new Promise(function(resolve13, reject) {
218974
218974
  process.nextTick(function() {
218975
218975
  if (_this[kError]) {
218976
218976
  reject(_this[kError]);
218977
218977
  } else {
218978
- resolve16(createIterResult(undefined, true));
218978
+ resolve13(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(resolve16, reject) {
219001
+ return new Promise(function(resolve13, reject) {
219002
219002
  _this2[kStream].destroy(null, function(err) {
219003
219003
  if (err) {
219004
219004
  reject(err);
219005
219005
  return;
219006
219006
  }
219007
- resolve16(createIterResult(undefined, true));
219007
+ resolve13(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(resolve16, reject) {
219029
+ value: function value(resolve13, 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
- resolve16(createIterResult(data, false));
219035
+ resolve13(createIterResult(data, false));
219036
219036
  } else {
219037
- iterator[kLastResolve] = resolve16;
219037
+ iterator[kLastResolve] = resolve13;
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 resolve16 = iterator[kLastResolve];
219057
- if (resolve16 !== null) {
219056
+ var resolve13 = iterator[kLastResolve];
219057
+ if (resolve13 !== null) {
219058
219058
  iterator[kLastPromise] = null;
219059
219059
  iterator[kLastResolve] = null;
219060
219060
  iterator[kLastReject] = null;
219061
- resolve16(createIterResult(undefined, true));
219061
+ resolve13(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, resolve16, reject, _next, _throw, key2, arg) {
219073
+ function asyncGeneratorStep(gen, resolve13, 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
- resolve16(value);
219082
+ resolve13(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(resolve16, reject) {
219090
+ return new Promise(function(resolve13, reject) {
219091
219091
  var gen = fn9.apply(self2, args);
219092
219092
  function _next(value) {
219093
- asyncGeneratorStep(gen, resolve16, reject, _next, _throw, "next", value);
219093
+ asyncGeneratorStep(gen, resolve13, reject, _next, _throw, "next", value);
219094
219094
  }
219095
219095
  function _throw(err) {
219096
- asyncGeneratorStep(gen, resolve16, reject, _next, _throw, "throw", err);
219096
+ asyncGeneratorStep(gen, resolve13, 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_promises26 = __require("node:fs/promises");
221223
+ var import_promises25 = __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_promises26.access)(DEVIN_LOCAL_PATH, import_node_fs24.constants.F_OK);
221281
+ await (0, import_promises25.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 };
@@ -237049,7 +237049,7 @@ function normalizeBase44Env() {
237049
237049
  loadProjectEnvFiles();
237050
237050
 
237051
237051
  // src/cli/index.ts
237052
- import { dirname as dirname26, join as join36 } from "node:path";
237052
+ import { dirname as dirname25, join as join36 } from "node:path";
237053
237053
  import { fileURLToPath as fileURLToPath6 } from "node:url";
237054
237054
 
237055
237055
  // ../../node_modules/@clack/core/dist/index.mjs
@@ -238257,7 +238257,7 @@ var {
238257
238257
  } = import__.default;
238258
238258
 
238259
238259
  // src/cli/commands/agent-skills/pull.ts
238260
- import { dirname as dirname11, join as join17 } from "node:path";
238260
+ import { dirname as dirname10, join as join17 } from "node:path";
238261
238261
  // ../../node_modules/chalk/source/vendor/ansi-styles/index.js
238262
238262
  var ANSI_BACKGROUND_OFFSET = 10;
238263
238263
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
@@ -247439,7 +247439,7 @@ async function createProjectFilesForExistingProject(options) {
247439
247439
  };
247440
247440
  }
247441
247441
  // src/core/project/deploy.ts
247442
- import { resolve as resolve3 } from "node:path";
247442
+ import { resolve as resolve4 } from "node:path";
247443
247443
 
247444
247444
  // src/core/site/api.ts
247445
247445
  async function uploadSite(archivePath) {
@@ -247506,340 +247506,77 @@ async function createArchive(pathToArchive, targetArchivePath) {
247506
247506
  cwd: pathToArchive
247507
247507
  }, ["."]);
247508
247508
  }
247509
- // src/core/project/deploy.ts
247510
- function hasResourcesToDeploy(projectData) {
247511
- const {
247512
- project,
247513
- entities,
247514
- functions,
247515
- agents,
247516
- agentSkills,
247517
- connectors,
247518
- authConfig
247519
- } = projectData;
247520
- const hasSite = Boolean(project.site?.outputDirectory);
247521
- const hasEntities = entities.length > 0;
247522
- const hasFunctions = functions.length > 0;
247523
- const hasAgents = agents.length > 0;
247524
- const hasAgentSkills = agentSkills.length > 0;
247525
- const hasConnectors = connectors.length > 0;
247526
- const hasAuthConfig = authConfig.length > 0;
247527
- const hasVisibility = Boolean(project.visibility);
247528
- return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
247529
- }
247530
- async function deployAll(projectData, options) {
247531
- const {
247532
- project,
247533
- entities,
247534
- functions,
247535
- agents,
247536
- agentSkills,
247537
- connectors,
247538
- authConfig
247539
- } = projectData;
247540
- await setAppVisibility(project.visibility);
247541
- if (project.visibility) {
247542
- options?.onVisibilitySet?.(project.visibility);
247543
- }
247544
- await entityResource.push(entities);
247545
- await deployFunctionsSequentially(functions, {
247546
- onStart: options?.onFunctionStart,
247547
- onResult: options?.onFunctionResult
247548
- });
247549
- await agentSkillResource.push(agentSkills);
247550
- await agentResource.push(agents);
247551
- await authConfigResource.push(authConfig);
247552
- const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
247553
- const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
247554
- if ((options?.site ?? true) && project.site?.outputDirectory) {
247555
- const outputDir = resolve3(project.root, project.site.outputDirectory);
247556
- const { appUrl } = await deploySite(outputDir);
247557
- return { appUrl, connectorResults };
247558
- }
247559
- return { connectorResults };
247560
- }
247561
- // src/core/clients/base44-client.ts
247562
- var retriedRequests = new WeakSet;
247563
- async function captureRequestBody(request, options) {
247564
- if (request.body == null) {
247565
- return;
247509
+ // src/core/site/deploy-app.ts
247510
+ import { resolve as resolve3 } from "node:path";
247511
+
247512
+ // src/core/deployments/schema.ts
247513
+ var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
247514
+ var CreateDeploymentResponseSchema = exports_external.object({
247515
+ deployment_id: exports_external.string(),
247516
+ asset_uploads: exports_external.object({
247517
+ type: exports_external.literal("s3"),
247518
+ uploads: exports_external.array(exports_external.object({
247519
+ path: exports_external.string(),
247520
+ content_type: exports_external.string(),
247521
+ content_length: exports_external.number(),
247522
+ url: exports_external.string()
247523
+ }))
247524
+ }).nullable().optional()
247525
+ }).transform((data) => ({
247526
+ deploymentId: data.deployment_id,
247527
+ assetUploads: data.asset_uploads == null ? null : {
247528
+ type: "s3",
247529
+ uploads: data.asset_uploads.uploads.map((upload) => ({
247530
+ path: upload.path,
247531
+ contentType: upload.content_type,
247532
+ contentLength: upload.content_length,
247533
+ url: upload.url
247534
+ }))
247566
247535
  }
247536
+ }));
247537
+ var FinalizeDeploymentResponseSchema = exports_external.object({
247538
+ deployment_id: exports_external.string()
247539
+ }).transform((data) => ({
247540
+ deploymentId: data.deployment_id
247541
+ }));
247542
+
247543
+ // src/core/deployments/api.ts
247544
+ async function createDeployment(request) {
247545
+ const appClient = getAppClient();
247546
+ let response;
247567
247547
  try {
247568
- const cloned = request.clone();
247569
- const text = await cloned.text();
247570
- options.context.__requestBody = text;
247571
- } catch {}
247572
- }
247573
- async function handleUnauthorized(request, _options, response) {
247574
- if (response.status !== 401) {
247575
- return;
247576
- }
247577
- if (hasWorkspaceApiKeyAuth()) {
247578
- return;
247579
- }
247580
- if (retriedRequests.has(request)) {
247581
- return;
247582
- }
247583
- const newAccessToken = await refreshAndSaveTokens();
247584
- if (!newAccessToken) {
247585
- return;
247586
- }
247587
- retriedRequests.add(request);
247588
- const requestId = request.headers.get("X-Request-ID");
247589
- return distribution_default(request.clone(), {
247590
- headers: {
247591
- ...requestId && { "X-Request-ID": requestId },
247592
- Authorization: `Bearer ${newAccessToken}`
247593
- }
247594
- });
247595
- }
247596
- var base44Client = distribution_default.create({
247597
- prefixUrl: getBase44ApiUrl(),
247598
- headers: {
247599
- "User-Agent": "Base44 CLI"
247600
- },
247601
- hooks: {
247602
- beforeRequest: [
247603
- (request) => {
247604
- request.headers.set("X-Request-ID", randomUUID2());
247605
- },
247606
- captureRequestBody,
247607
- async (request) => {
247608
- const workspaceApiKey = getWorkspaceApiKeyFromEnv();
247609
- if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
247610
- request.headers.set("api_key", workspaceApiKey);
247611
- return;
247612
- }
247613
- try {
247614
- const auth = await readAuth();
247615
- if (isTokenExpired(auth)) {
247616
- const newAccessToken = await refreshAndSaveTokens();
247617
- if (newAccessToken) {
247618
- request.headers.set("Authorization", `Bearer ${newAccessToken}`);
247619
- return;
247620
- }
247621
- }
247622
- request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
247623
- } catch {}
247624
- }
247625
- ],
247626
- afterResponse: [handleUnauthorized]
247627
- }
247628
- });
247629
- function getAppClient() {
247630
- const { id } = getAppContext();
247631
- return base44Client.extend({
247632
- prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
247633
- });
247634
- }
247635
- function getSandboxClient(appId) {
247636
- return base44Client.extend({
247637
- prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
247638
- });
247639
- }
247640
- // src/core/clients/oauth-client.ts
247641
- import { randomUUID as randomUUID3 } from "node:crypto";
247642
- var oauthClient = distribution_default.create({
247643
- prefixUrl: getBase44ApiUrl(),
247644
- headers: {
247645
- "User-Agent": "Base44 CLI"
247646
- },
247647
- hooks: {
247648
- beforeRequest: [
247649
- (request) => {
247650
- request.headers.set("X-Request-ID", randomUUID3());
247651
- }
247652
- ]
247653
- }
247654
- });
247655
- // src/core/auth/api.ts
247656
- async function generateDeviceCode() {
247657
- const response = await oauthClient.post("oauth/device/code", {
247658
- json: {
247659
- client_id: AUTH_CLIENT_ID,
247660
- scope: "apps:read apps:write sandbox:write"
247661
- },
247662
- throwHttpErrors: false
247663
- });
247664
- if (!response.ok) {
247665
- throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
247666
- }
247667
- const result = DeviceCodeResponseSchema.safeParse(await response.json());
247668
- if (!result.success) {
247669
- throw new SchemaValidationError("Invalid device code response from server", result.error);
247670
- }
247671
- return result.data;
247672
- }
247673
- async function getTokenFromDeviceCode(deviceCode) {
247674
- const searchParams = new URLSearchParams;
247675
- searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
247676
- searchParams.set("device_code", deviceCode);
247677
- searchParams.set("client_id", AUTH_CLIENT_ID);
247678
- const response = await oauthClient.post("oauth/token", {
247679
- body: searchParams.toString(),
247680
- headers: {
247681
- "Content-Type": "application/x-www-form-urlencoded"
247682
- },
247683
- throwHttpErrors: false
247684
- });
247685
- const json2 = await response.json();
247686
- if (!response.ok) {
247687
- const errorResult = OAuthErrorSchema.safeParse(json2);
247688
- if (!errorResult.success) {
247689
- throw new SchemaValidationError("Token request failed", errorResult.error);
247690
- }
247691
- const { error: error48, error_description } = errorResult.data;
247692
- if (error48 === "authorization_pending" || error48 === "slow_down") {
247693
- return null;
247694
- }
247695
- throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
247696
- statusCode: response.status
247697
- });
247698
- }
247699
- const result = TokenResponseSchema.safeParse(json2);
247700
- if (!result.success) {
247701
- throw new SchemaValidationError("Invalid token response from server", result.error);
247702
- }
247703
- return result.data;
247704
- }
247705
- async function renewAccessToken(refreshToken) {
247706
- const searchParams = new URLSearchParams;
247707
- searchParams.set("grant_type", "refresh_token");
247708
- searchParams.set("refresh_token", refreshToken);
247709
- searchParams.set("client_id", AUTH_CLIENT_ID);
247710
- const response = await oauthClient.post("oauth/token", {
247711
- body: searchParams.toString(),
247712
- headers: {
247713
- "Content-Type": "application/x-www-form-urlencoded"
247714
- },
247715
- throwHttpErrors: false
247716
- });
247717
- const json2 = await response.json();
247718
- if (!response.ok) {
247719
- const errorResult = OAuthErrorSchema.safeParse(json2);
247720
- if (!errorResult.success) {
247721
- throw new ApiError(`Token refresh failed: ${response.statusText}`, {
247722
- statusCode: response.status
247723
- });
247724
- }
247725
- const { error: error48, error_description } = errorResult.data;
247726
- throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
247727
- statusCode: response.status
247728
- });
247729
- }
247730
- const result = TokenResponseSchema.safeParse(json2);
247731
- if (!result.success) {
247732
- throw new SchemaValidationError("Invalid token response from server", result.error);
247733
- }
247734
- return result.data;
247735
- }
247736
- async function getUserInfo(accessToken) {
247737
- const response = await oauthClient.get("oauth/userinfo", {
247738
- headers: { Authorization: `Bearer ${accessToken}` }
247739
- });
247740
- if (!response.ok) {
247741
- throw new ApiError(`Failed to fetch user info: ${response.status}`, {
247742
- statusCode: response.status
247548
+ response = await appClient.post("deployments", {
247549
+ json: request,
247550
+ timeout: 120000
247743
247551
  });
247552
+ } catch (error48) {
247553
+ throw await ApiError.fromHttpError(error48, "creating deployment");
247744
247554
  }
247745
- const result = UserInfoSchema.safeParse(await response.json());
247555
+ const result = CreateDeploymentResponseSchema.safeParse(await response.json());
247746
247556
  if (!result.success) {
247747
- throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
247557
+ throw new SchemaValidationError("Invalid response from server", result.error);
247748
247558
  }
247749
247559
  return result.data;
247750
247560
  }
247751
- // src/cli/commands/auth/login-flow.ts
247752
- async function generateAndDisplayDeviceCode(log, runTask) {
247753
- const deviceCodeResponse = await runTask("Generating device code...", async () => {
247754
- return await generateDeviceCode();
247755
- }, {
247756
- successMessage: "Device code generated",
247757
- errorMessage: "Failed to generate device code"
247758
- });
247759
- log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
247760
- Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
247761
- return deviceCodeResponse;
247561
+ async function finalizeStaticDeployment(deploymentId, indexHtml) {
247562
+ const formData = new FormData;
247563
+ formData.append("index.html", new File([indexHtml], "index.html", { type: "text/html" }));
247564
+ return await postFinalize(deploymentId, formData);
247762
247565
  }
247763
- async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
247764
- let tokenResponse;
247566
+ async function postFinalize(deploymentId, formData) {
247567
+ const appClient = getAppClient();
247568
+ let response;
247765
247569
  try {
247766
- await runTask("Waiting for authentication...", async () => {
247767
- await pWaitFor(async () => {
247768
- const result = await getTokenFromDeviceCode(deviceCode);
247769
- if (result !== null) {
247770
- tokenResponse = result;
247771
- return true;
247772
- }
247773
- return false;
247774
- }, {
247775
- interval: interval * 1000,
247776
- timeout: expiresIn * 1000
247777
- });
247778
- }, {
247779
- successMessage: "Authentication completed!",
247780
- errorMessage: "Authentication failed"
247781
- });
247570
+ response = await appClient.post(`deployments/${encodeURIComponent(deploymentId)}/finalize`, { body: formData, timeout: 180000 });
247782
247571
  } catch (error48) {
247783
- if (error48 instanceof Error && error48.message.includes("timed out")) {
247784
- throw new AuthExpiredError("Authentication timed out. Please try again.");
247785
- }
247786
- throw error48;
247787
- }
247788
- if (tokenResponse === undefined) {
247789
- throw new InternalError("Failed to retrieve authentication token.");
247790
- }
247791
- return tokenResponse;
247792
- }
247793
- async function saveAuthData(response, userInfo) {
247794
- const expiresAt = Date.now() + response.expiresIn * 1000;
247795
- await writeAuth({
247796
- accessToken: response.accessToken,
247797
- refreshToken: response.refreshToken,
247798
- expiresAt,
247799
- email: userInfo.email,
247800
- name: userInfo.name
247801
- });
247802
- }
247803
- async function login({
247804
- log,
247805
- runTask
247806
- }) {
247807
- const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
247808
- const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
247809
- const userInfo = await getUserInfo(token.accessToken);
247810
- await saveAuthData(token, userInfo);
247811
- return {
247812
- outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
247813
- };
247814
- }
247815
-
247816
- // src/cli/utils/command/middleware.ts
247817
- async function ensureAuth(ctx) {
247818
- if (hasWorkspaceApiKeyAuth()) {
247819
- ctx.errorReporter.setContext({
247820
- user: { email: "workspace-api-key", name: "Workspace API key" }
247821
- });
247822
- return;
247572
+ throw await ApiError.fromHttpError(error48, "finalizing deployment");
247823
247573
  }
247824
- await seedAuthFromEnv();
247825
- const loggedIn = await isLoggedIn();
247826
- if (!loggedIn) {
247827
- ctx.log.info("You need to login first to continue.");
247828
- await login(ctx);
247574
+ const result = FinalizeDeploymentResponseSchema.safeParse(await response.json());
247575
+ if (!result.success) {
247576
+ throw new SchemaValidationError("Invalid response from server", result.error);
247829
247577
  }
247830
- try {
247831
- const userInfo = await readAuth();
247832
- ctx.errorReporter.setContext({
247833
- user: { email: userInfo.email, name: userInfo.name }
247834
- });
247835
- } catch {}
247836
- }
247837
- async function ensureAppContext(ctx, options = {}) {
247838
- const appContext = await initAppContext(options);
247839
- ctx.app = appContext;
247840
- ctx.errorReporter.setContext({ appId: appContext.id });
247578
+ return result.data;
247841
247579
  }
247842
-
247843
247580
  // ../../node_modules/is-plain-obj/index.js
247844
247581
  function isPlainObject2(value) {
247845
247582
  if (typeof value !== "object" || value === null) {
@@ -247937,13 +247674,13 @@ var getJoinLength = (uint8Arrays) => {
247937
247674
  var isTemplateString = (templates) => Array.isArray(templates) && Array.isArray(templates.raw);
247938
247675
  var parseTemplates = (templates, expressions) => {
247939
247676
  let tokens = [];
247940
- for (const [index, template2] of templates.entries()) {
247677
+ for (const [index, template] of templates.entries()) {
247941
247678
  tokens = parseTemplate({
247942
247679
  templates,
247943
247680
  expressions,
247944
247681
  tokens,
247945
247682
  index,
247946
- template: template2
247683
+ template
247947
247684
  });
247948
247685
  }
247949
247686
  if (tokens.length === 0) {
@@ -247952,11 +247689,11 @@ var parseTemplates = (templates, expressions) => {
247952
247689
  const [file2, ...commandArguments] = tokens;
247953
247690
  return [file2, commandArguments, {}];
247954
247691
  };
247955
- var parseTemplate = ({ templates, expressions, tokens, index, template: template2 }) => {
247956
- if (template2 === undefined) {
247692
+ var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
247693
+ if (template === undefined) {
247957
247694
  throw new TypeError(`Invalid backslash sequence: ${templates.raw[index]}`);
247958
247695
  }
247959
- const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(template2, templates.raw[index]);
247696
+ const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(template, templates.raw[index]);
247960
247697
  const newTokens = concatTokens(tokens, nextTokens, leadingWhitespaces);
247961
247698
  if (index === expressions.length) {
247962
247699
  return newTokens;
@@ -247965,18 +247702,18 @@ var parseTemplate = ({ templates, expressions, tokens, index, template: template
247965
247702
  const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
247966
247703
  return concatTokens(newTokens, expressionTokens, trailingWhitespaces);
247967
247704
  };
247968
- var splitByWhitespaces = (template2, rawTemplate) => {
247705
+ var splitByWhitespaces = (template, rawTemplate) => {
247969
247706
  if (rawTemplate.length === 0) {
247970
247707
  return { nextTokens: [], leadingWhitespaces: false, trailingWhitespaces: false };
247971
247708
  }
247972
247709
  const nextTokens = [];
247973
247710
  let templateStart = 0;
247974
247711
  const leadingWhitespaces = DELIMITERS.has(rawTemplate[0]);
247975
- for (let templateIndex = 0, rawIndex = 0;templateIndex < template2.length; templateIndex += 1, rawIndex += 1) {
247712
+ for (let templateIndex = 0, rawIndex = 0;templateIndex < template.length; templateIndex += 1, rawIndex += 1) {
247976
247713
  const rawCharacter = rawTemplate[rawIndex];
247977
247714
  if (DELIMITERS.has(rawCharacter)) {
247978
247715
  if (templateStart !== templateIndex) {
247979
- nextTokens.push(template2.slice(templateStart, templateIndex));
247716
+ nextTokens.push(template.slice(templateStart, templateIndex));
247980
247717
  }
247981
247718
  templateStart = templateIndex + 1;
247982
247719
  } else if (rawCharacter === "\\") {
@@ -247992,9 +247729,9 @@ var splitByWhitespaces = (template2, rawTemplate) => {
247992
247729
  }
247993
247730
  }
247994
247731
  }
247995
- const trailingWhitespaces = templateStart === template2.length;
247732
+ const trailingWhitespaces = templateStart === template.length;
247996
247733
  if (!trailingWhitespaces) {
247997
- nextTokens.push(template2.slice(templateStart));
247734
+ nextTokens.push(template.slice(templateStart));
247998
247735
  }
247999
247736
  return { nextTokens, leadingWhitespaces, trailingWhitespaces };
248000
247737
  };
@@ -249388,8 +249125,8 @@ var disconnect = (anyProcess) => {
249388
249125
  // ../../node_modules/execa/lib/utils/deferred.js
249389
249126
  var createDeferred = () => {
249390
249127
  const methods = {};
249391
- const promise2 = new Promise((resolve4, reject) => {
249392
- Object.assign(methods, { resolve: resolve4, reject });
249128
+ const promise2 = new Promise((resolve3, reject) => {
249129
+ Object.assign(methods, { resolve: resolve3, reject });
249393
249130
  });
249394
249131
  return Object.assign(promise2, methods);
249395
249132
  };
@@ -253753,11 +253490,11 @@ var addConcurrentStream = (concurrentStreams, stream, waitName) => {
253753
253490
  const promises = weakMap.get(stream);
253754
253491
  const promise2 = createDeferred();
253755
253492
  promises.push(promise2);
253756
- const resolve4 = promise2.resolve.bind(promise2);
253757
- return { resolve: resolve4, promises };
253493
+ const resolve3 = promise2.resolve.bind(promise2);
253494
+ return { resolve: resolve3, promises };
253758
253495
  };
253759
- var waitForConcurrentStreams = async ({ resolve: resolve4, promises }, subprocess) => {
253760
- resolve4();
253496
+ var waitForConcurrentStreams = async ({ resolve: resolve3, promises }, subprocess) => {
253497
+ resolve3();
253761
253498
  const [isSubprocessExit] = await Promise.race([
253762
253499
  Promise.allSettled([true, subprocess]),
253763
253500
  Promise.all([false, ...promises])
@@ -254336,6 +254073,587 @@ var {
254336
254073
  getCancelSignal: getCancelSignal2
254337
254074
  } = getIpcExport();
254338
254075
 
254076
+ // src/core/deployments/git-hash.ts
254077
+ async function resolveGitHash(projectRoot, explicit) {
254078
+ const hash2 = explicit ?? await gitHead(projectRoot);
254079
+ if (!hash2 || !GIT_HASH_PATTERN.test(hash2)) {
254080
+ 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.", {
254081
+ hints: [
254082
+ {
254083
+ message: "Run the deploy from a git checkout, or pass the commit explicitly with --git-hash."
254084
+ }
254085
+ ]
254086
+ });
254087
+ }
254088
+ return hash2;
254089
+ }
254090
+ async function gitHead(projectRoot) {
254091
+ try {
254092
+ const { stdout } = await execa("git", ["rev-parse", "HEAD"], {
254093
+ cwd: projectRoot
254094
+ });
254095
+ return stdout.trim();
254096
+ } catch {
254097
+ return null;
254098
+ }
254099
+ }
254100
+ // src/core/deployments/manifest.ts
254101
+ import { createHash } from "node:crypto";
254102
+ import { readdir as readdir2, readFile as readFile2, stat } from "node:fs/promises";
254103
+ import { join as join15 } from "node:path";
254104
+ var MAX_ASSET_SIZE_BYTES = 25 * 1024 * 1024;
254105
+ var MAX_ASSET_COUNT = 1e5;
254106
+ var ASSETS_IGNORE_FILE = ".assetsignore";
254107
+ var ALWAYS_SKIPPED_FILES = new Set([
254108
+ ASSETS_IGNORE_FILE,
254109
+ "wrangler.json",
254110
+ ".dev.vars"
254111
+ ]);
254112
+ function hashAsset(appId, content) {
254113
+ return createHash("sha256").update(Buffer.from(appId, "utf8")).update(content).digest("hex").slice(0, 32);
254114
+ }
254115
+ function globToRegExp(glob) {
254116
+ let source = "";
254117
+ for (let i2 = 0;i2 < glob.length; i2++) {
254118
+ const char = glob[i2];
254119
+ if (char === "*") {
254120
+ if (glob[i2 + 1] === "*") {
254121
+ source += ".*";
254122
+ i2++;
254123
+ } else {
254124
+ source += "[^/]*";
254125
+ }
254126
+ } else if (char === "?") {
254127
+ source += "[^/]";
254128
+ } else {
254129
+ source += char.replace(/[.+^${}()|[\]\\]/g, "\\$&");
254130
+ }
254131
+ }
254132
+ return new RegExp(`^${source}$`);
254133
+ }
254134
+ function createIgnoreMatcher(lines) {
254135
+ const rules = lines.map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#")).map((line) => {
254136
+ const isDirOnly = line.endsWith("/");
254137
+ let pattern = isDirOnly ? line.slice(0, -1) : line;
254138
+ const anchored = pattern.includes("/");
254139
+ pattern = pattern.replace(/^\//, "");
254140
+ return { regex: globToRegExp(pattern), anchored, isDirOnly };
254141
+ });
254142
+ return (relativePath, isDirectory2) => {
254143
+ const segments = relativePath.split("/");
254144
+ return rules.some((rule) => {
254145
+ if (rule.anchored) {
254146
+ if (rule.isDirOnly ? isDirectory2 : true) {
254147
+ if (rule.regex.test(relativePath))
254148
+ return true;
254149
+ }
254150
+ return false;
254151
+ }
254152
+ const basename4 = segments[segments.length - 1];
254153
+ if (rule.isDirOnly && !isDirectory2)
254154
+ return false;
254155
+ return rule.regex.test(basename4);
254156
+ });
254157
+ };
254158
+ }
254159
+ async function loadIgnoreMatcher(assetsDir) {
254160
+ const ignorePath = join15(assetsDir, ASSETS_IGNORE_FILE);
254161
+ if (!await pathExists(ignorePath)) {
254162
+ return () => false;
254163
+ }
254164
+ const content = await readTextFile(ignorePath);
254165
+ return createIgnoreMatcher(content.split(/\r?\n/));
254166
+ }
254167
+ async function buildAssetManifest(assetsDir, appId) {
254168
+ const isIgnored = await loadIgnoreMatcher(assetsDir);
254169
+ const manifest = {};
254170
+ const filesByHash = new Map;
254171
+ const relativeFilePaths = await collectFilePaths(assetsDir, "", isIgnored);
254172
+ if (relativeFilePaths.length > MAX_ASSET_COUNT) {
254173
+ throw new InvalidInputError(`Too many static assets: found ${relativeFilePaths.length}, the limit is ${MAX_ASSET_COUNT} files.`);
254174
+ }
254175
+ for (const relativePath of relativeFilePaths.sort()) {
254176
+ const absolutePath = join15(assetsDir, ...relativePath.split("/"));
254177
+ const { size } = await stat(absolutePath);
254178
+ if (size > MAX_ASSET_SIZE_BYTES) {
254179
+ throw new InvalidInputError(`Static asset "${relativePath}" is ${size} bytes, which exceeds the 25 MiB per-file limit.`);
254180
+ }
254181
+ const content = await readFile2(absolutePath);
254182
+ const hash2 = hashAsset(appId, content);
254183
+ manifest[`/${relativePath}`] = { hash: hash2, size };
254184
+ if (!filesByHash.has(hash2)) {
254185
+ filesByHash.set(hash2, { absolutePath, hash: hash2, size });
254186
+ }
254187
+ }
254188
+ return { manifest, filesByHash };
254189
+ }
254190
+ async function collectFilePaths(dir, relativeDir, isIgnored) {
254191
+ const entries = await readdir2(dir, { withFileTypes: true });
254192
+ const results = [];
254193
+ for (const entry of entries) {
254194
+ const relativePath = relativeDir ? `${relativeDir}/${entry.name}` : entry.name;
254195
+ if (entry.isDirectory()) {
254196
+ if (isIgnored(relativePath, true))
254197
+ continue;
254198
+ results.push(...await collectFilePaths(join15(dir, entry.name), relativePath, isIgnored));
254199
+ continue;
254200
+ }
254201
+ if (!entry.isFile())
254202
+ continue;
254203
+ if (ALWAYS_SKIPPED_FILES.has(entry.name))
254204
+ continue;
254205
+ if (isIgnored(relativePath, false))
254206
+ continue;
254207
+ results.push(relativePath);
254208
+ }
254209
+ return results;
254210
+ }
254211
+ // src/core/deployments/static-site.ts
254212
+ import { readFile as readFile4 } from "node:fs/promises";
254213
+ import { join as join16 } from "node:path";
254214
+
254215
+ // src/core/deployments/upload.ts
254216
+ import { readFile as readFile3 } from "node:fs/promises";
254217
+ var UPLOAD_CONCURRENCY = 3;
254218
+ var MAX_ATTEMPTS_PER_UPLOAD = 3;
254219
+ var RETRY_BASE_DELAY_MS = 500;
254220
+ async function uploadPresignedAssets(uploads, assets, onProgress) {
254221
+ let uploadedFiles = 0;
254222
+ let nextUpload = 0;
254223
+ const worker = async () => {
254224
+ while (nextUpload < uploads.length) {
254225
+ const upload = uploads[nextUpload++];
254226
+ await uploadPresignedAssetWithRetry(upload, assets);
254227
+ uploadedFiles++;
254228
+ onProgress?.({ uploadedFiles, totalFiles: uploads.length });
254229
+ }
254230
+ };
254231
+ await Promise.all(Array.from({ length: Math.min(UPLOAD_CONCURRENCY, uploads.length) }, worker));
254232
+ }
254233
+ async function uploadPresignedAssetWithRetry(upload, assets) {
254234
+ const entry = assets.manifest[upload.path];
254235
+ const file2 = entry && assets.filesByHash.get(entry.hash);
254236
+ if (!file2) {
254237
+ throw new InternalError(`Server requested upload of unknown asset path: ${upload.path}`);
254238
+ }
254239
+ const content = await readFile3(file2.absolutePath);
254240
+ let lastError;
254241
+ for (let attempt = 0;attempt < MAX_ATTEMPTS_PER_UPLOAD; attempt++) {
254242
+ if (attempt > 0) {
254243
+ await sleep3(RETRY_BASE_DELAY_MS * 2 ** (attempt - 1));
254244
+ }
254245
+ try {
254246
+ await distribution_default.put(upload.url, {
254247
+ body: new Uint8Array(content),
254248
+ headers: { "Content-Type": upload.contentType },
254249
+ timeout: 120000,
254250
+ retry: 0
254251
+ });
254252
+ return;
254253
+ } catch (error48) {
254254
+ lastError = error48;
254255
+ }
254256
+ }
254257
+ throw await ApiError.fromHttpError(lastError, "uploading static assets");
254258
+ }
254259
+ function sleep3(ms) {
254260
+ return new Promise((resolve3) => setTimeout(resolve3, ms));
254261
+ }
254262
+
254263
+ // src/core/deployments/static-site.ts
254264
+ var STATIC_DEPLOYMENTS_ENV = "BASE44_STATIC_DEPLOYMENTS";
254265
+ function staticDeploymentsEnabled(env2 = process.env) {
254266
+ const value = env2[STATIC_DEPLOYMENTS_ENV];
254267
+ return value === "1" || value === "true";
254268
+ }
254269
+ async function deployStaticSite(options) {
254270
+ const { outputDir, gitHash, progress } = options;
254271
+ const assets = await buildAssetManifest(outputDir, getAppContext().id);
254272
+ if (!assets.manifest["/index.html"]) {
254273
+ throw new InvalidInputError(`No index.html found in "${outputDir}" — a static site needs one at the output directory root.`);
254274
+ }
254275
+ const created = await createDeployment({
254276
+ git_hash: gitHash,
254277
+ asset_manifest: assets.manifest
254278
+ });
254279
+ const totalAssets = Object.keys(assets.manifest).length;
254280
+ progress?.onAssets?.({
254281
+ totalAssets,
254282
+ newAssets: created.assetUploads?.uploads.length ?? 0
254283
+ });
254284
+ if (created.assetUploads) {
254285
+ await uploadPresignedAssets(created.assetUploads.uploads, assets, progress?.onAssetUpload);
254286
+ }
254287
+ const indexHtml = await readFile4(join16(outputDir, "index.html"));
254288
+ const finalized = await finalizeStaticDeployment(created.deploymentId, new Uint8Array(indexHtml));
254289
+ return { deploymentId: finalized.deploymentId, gitHash };
254290
+ }
254291
+ // src/core/site/deploy-app.ts
254292
+ async function planAppDeploy(target) {
254293
+ const outputDirectory = target.site?.outputDirectory;
254294
+ if (!outputDirectory) {
254295
+ return { kind: "none" };
254296
+ }
254297
+ const outputDir = resolve3(target.root, outputDirectory);
254298
+ return staticDeploymentsEnabled() ? { kind: "static-deployment", outputDir } : { kind: "static", outputDir };
254299
+ }
254300
+ async function detectAppDeployKind(target) {
254301
+ return (await planAppDeploy(target)).kind;
254302
+ }
254303
+ async function deployAppSite(target, options = {}) {
254304
+ const plan = await planAppDeploy(target);
254305
+ switch (plan.kind) {
254306
+ case "static-deployment": {
254307
+ const gitHash = await resolveGitHash(target.root, options.gitHash);
254308
+ const { deploymentId } = await deployStaticSite({
254309
+ outputDir: plan.outputDir,
254310
+ gitHash,
254311
+ progress: options.progress
254312
+ });
254313
+ return { kind: "static-deployment", deploymentId, gitHash };
254314
+ }
254315
+ case "static": {
254316
+ const { appUrl } = await deploySite(plan.outputDir);
254317
+ return { kind: "static", appUrl };
254318
+ }
254319
+ case "none":
254320
+ return { kind: "none" };
254321
+ }
254322
+ }
254323
+ // src/core/project/deploy.ts
254324
+ function hasResourcesToDeploy(projectData) {
254325
+ const {
254326
+ project,
254327
+ entities,
254328
+ functions,
254329
+ agents,
254330
+ agentSkills,
254331
+ connectors,
254332
+ authConfig
254333
+ } = projectData;
254334
+ const hasSite = Boolean(project.site?.outputDirectory || project.site?.buildCommand);
254335
+ const hasEntities = entities.length > 0;
254336
+ const hasFunctions = functions.length > 0;
254337
+ const hasAgents = agents.length > 0;
254338
+ const hasAgentSkills = agentSkills.length > 0;
254339
+ const hasConnectors = connectors.length > 0;
254340
+ const hasAuthConfig = authConfig.length > 0;
254341
+ const hasVisibility = Boolean(project.visibility);
254342
+ return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
254343
+ }
254344
+ async function deployAll(projectData, options) {
254345
+ const {
254346
+ project,
254347
+ entities,
254348
+ functions,
254349
+ agents,
254350
+ agentSkills,
254351
+ connectors,
254352
+ authConfig
254353
+ } = projectData;
254354
+ await setAppVisibility(project.visibility);
254355
+ if (project.visibility) {
254356
+ options?.onVisibilitySet?.(project.visibility);
254357
+ }
254358
+ await entityResource.push(entities);
254359
+ await deployFunctionsSequentially(functions, {
254360
+ onStart: options?.onFunctionStart,
254361
+ onResult: options?.onFunctionResult
254362
+ });
254363
+ await agentSkillResource.push(agentSkills);
254364
+ await agentResource.push(agents);
254365
+ await authConfigResource.push(authConfig);
254366
+ const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
254367
+ const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
254368
+ if ((options?.site ?? true) && project.site?.outputDirectory) {
254369
+ const outputDir = resolve4(project.root, project.site.outputDirectory);
254370
+ const { appUrl } = await deploySite(outputDir);
254371
+ return { appUrl, connectorResults };
254372
+ }
254373
+ return { connectorResults };
254374
+ }
254375
+ // src/core/clients/base44-client.ts
254376
+ var retriedRequests = new WeakSet;
254377
+ async function captureRequestBody(request, options) {
254378
+ if (request.body == null) {
254379
+ return;
254380
+ }
254381
+ try {
254382
+ const cloned = request.clone();
254383
+ const text = await cloned.text();
254384
+ options.context.__requestBody = text;
254385
+ } catch {}
254386
+ }
254387
+ async function handleUnauthorized(request, _options, response) {
254388
+ if (response.status !== 401) {
254389
+ return;
254390
+ }
254391
+ if (hasWorkspaceApiKeyAuth()) {
254392
+ return;
254393
+ }
254394
+ if (retriedRequests.has(request)) {
254395
+ return;
254396
+ }
254397
+ const newAccessToken = await refreshAndSaveTokens();
254398
+ if (!newAccessToken) {
254399
+ return;
254400
+ }
254401
+ retriedRequests.add(request);
254402
+ const requestId = request.headers.get("X-Request-ID");
254403
+ return distribution_default(request.clone(), {
254404
+ headers: {
254405
+ ...requestId && { "X-Request-ID": requestId },
254406
+ Authorization: `Bearer ${newAccessToken}`
254407
+ }
254408
+ });
254409
+ }
254410
+ var base44Client = distribution_default.create({
254411
+ prefixUrl: getBase44ApiUrl(),
254412
+ headers: {
254413
+ "User-Agent": "Base44 CLI"
254414
+ },
254415
+ hooks: {
254416
+ beforeRequest: [
254417
+ (request) => {
254418
+ request.headers.set("X-Request-ID", randomUUID2());
254419
+ },
254420
+ captureRequestBody,
254421
+ async (request) => {
254422
+ const workspaceApiKey = getWorkspaceApiKeyFromEnv();
254423
+ if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
254424
+ request.headers.set("api_key", workspaceApiKey);
254425
+ return;
254426
+ }
254427
+ try {
254428
+ const auth = await readAuth();
254429
+ if (isTokenExpired(auth)) {
254430
+ const newAccessToken = await refreshAndSaveTokens();
254431
+ if (newAccessToken) {
254432
+ request.headers.set("Authorization", `Bearer ${newAccessToken}`);
254433
+ return;
254434
+ }
254435
+ }
254436
+ request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
254437
+ } catch {}
254438
+ }
254439
+ ],
254440
+ afterResponse: [handleUnauthorized]
254441
+ }
254442
+ });
254443
+ function getAppClient() {
254444
+ const { id } = getAppContext();
254445
+ return base44Client.extend({
254446
+ prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
254447
+ });
254448
+ }
254449
+ function getSandboxClient(appId) {
254450
+ return base44Client.extend({
254451
+ prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
254452
+ });
254453
+ }
254454
+ // src/core/clients/oauth-client.ts
254455
+ import { randomUUID as randomUUID3 } from "node:crypto";
254456
+ var oauthClient = distribution_default.create({
254457
+ prefixUrl: getBase44ApiUrl(),
254458
+ headers: {
254459
+ "User-Agent": "Base44 CLI"
254460
+ },
254461
+ hooks: {
254462
+ beforeRequest: [
254463
+ (request) => {
254464
+ request.headers.set("X-Request-ID", randomUUID3());
254465
+ }
254466
+ ]
254467
+ }
254468
+ });
254469
+ // src/core/auth/api.ts
254470
+ async function generateDeviceCode() {
254471
+ const response = await oauthClient.post("oauth/device/code", {
254472
+ json: {
254473
+ client_id: AUTH_CLIENT_ID,
254474
+ scope: "apps:read apps:write sandbox:write"
254475
+ },
254476
+ throwHttpErrors: false
254477
+ });
254478
+ if (!response.ok) {
254479
+ throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
254480
+ }
254481
+ const result = DeviceCodeResponseSchema.safeParse(await response.json());
254482
+ if (!result.success) {
254483
+ throw new SchemaValidationError("Invalid device code response from server", result.error);
254484
+ }
254485
+ return result.data;
254486
+ }
254487
+ async function getTokenFromDeviceCode(deviceCode) {
254488
+ const searchParams = new URLSearchParams;
254489
+ searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
254490
+ searchParams.set("device_code", deviceCode);
254491
+ searchParams.set("client_id", AUTH_CLIENT_ID);
254492
+ const response = await oauthClient.post("oauth/token", {
254493
+ body: searchParams.toString(),
254494
+ headers: {
254495
+ "Content-Type": "application/x-www-form-urlencoded"
254496
+ },
254497
+ throwHttpErrors: false
254498
+ });
254499
+ const json2 = await response.json();
254500
+ if (!response.ok) {
254501
+ const errorResult = OAuthErrorSchema.safeParse(json2);
254502
+ if (!errorResult.success) {
254503
+ throw new SchemaValidationError("Token request failed", errorResult.error);
254504
+ }
254505
+ const { error: error48, error_description } = errorResult.data;
254506
+ if (error48 === "authorization_pending" || error48 === "slow_down") {
254507
+ return null;
254508
+ }
254509
+ throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
254510
+ statusCode: response.status
254511
+ });
254512
+ }
254513
+ const result = TokenResponseSchema.safeParse(json2);
254514
+ if (!result.success) {
254515
+ throw new SchemaValidationError("Invalid token response from server", result.error);
254516
+ }
254517
+ return result.data;
254518
+ }
254519
+ async function renewAccessToken(refreshToken) {
254520
+ const searchParams = new URLSearchParams;
254521
+ searchParams.set("grant_type", "refresh_token");
254522
+ searchParams.set("refresh_token", refreshToken);
254523
+ searchParams.set("client_id", AUTH_CLIENT_ID);
254524
+ const response = await oauthClient.post("oauth/token", {
254525
+ body: searchParams.toString(),
254526
+ headers: {
254527
+ "Content-Type": "application/x-www-form-urlencoded"
254528
+ },
254529
+ throwHttpErrors: false
254530
+ });
254531
+ const json2 = await response.json();
254532
+ if (!response.ok) {
254533
+ const errorResult = OAuthErrorSchema.safeParse(json2);
254534
+ if (!errorResult.success) {
254535
+ throw new ApiError(`Token refresh failed: ${response.statusText}`, {
254536
+ statusCode: response.status
254537
+ });
254538
+ }
254539
+ const { error: error48, error_description } = errorResult.data;
254540
+ throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
254541
+ statusCode: response.status
254542
+ });
254543
+ }
254544
+ const result = TokenResponseSchema.safeParse(json2);
254545
+ if (!result.success) {
254546
+ throw new SchemaValidationError("Invalid token response from server", result.error);
254547
+ }
254548
+ return result.data;
254549
+ }
254550
+ async function getUserInfo(accessToken) {
254551
+ const response = await oauthClient.get("oauth/userinfo", {
254552
+ headers: { Authorization: `Bearer ${accessToken}` }
254553
+ });
254554
+ if (!response.ok) {
254555
+ throw new ApiError(`Failed to fetch user info: ${response.status}`, {
254556
+ statusCode: response.status
254557
+ });
254558
+ }
254559
+ const result = UserInfoSchema.safeParse(await response.json());
254560
+ if (!result.success) {
254561
+ throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
254562
+ }
254563
+ return result.data;
254564
+ }
254565
+ // src/cli/commands/auth/login-flow.ts
254566
+ async function generateAndDisplayDeviceCode(log, runTask) {
254567
+ const deviceCodeResponse = await runTask("Generating device code...", async () => {
254568
+ return await generateDeviceCode();
254569
+ }, {
254570
+ successMessage: "Device code generated",
254571
+ errorMessage: "Failed to generate device code"
254572
+ });
254573
+ log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
254574
+ Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
254575
+ return deviceCodeResponse;
254576
+ }
254577
+ async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
254578
+ let tokenResponse;
254579
+ try {
254580
+ await runTask("Waiting for authentication...", async () => {
254581
+ await pWaitFor(async () => {
254582
+ const result = await getTokenFromDeviceCode(deviceCode);
254583
+ if (result !== null) {
254584
+ tokenResponse = result;
254585
+ return true;
254586
+ }
254587
+ return false;
254588
+ }, {
254589
+ interval: interval * 1000,
254590
+ timeout: expiresIn * 1000
254591
+ });
254592
+ }, {
254593
+ successMessage: "Authentication completed!",
254594
+ errorMessage: "Authentication failed"
254595
+ });
254596
+ } catch (error48) {
254597
+ if (error48 instanceof Error && error48.message.includes("timed out")) {
254598
+ throw new AuthExpiredError("Authentication timed out. Please try again.");
254599
+ }
254600
+ throw error48;
254601
+ }
254602
+ if (tokenResponse === undefined) {
254603
+ throw new InternalError("Failed to retrieve authentication token.");
254604
+ }
254605
+ return tokenResponse;
254606
+ }
254607
+ async function saveAuthData(response, userInfo) {
254608
+ const expiresAt = Date.now() + response.expiresIn * 1000;
254609
+ await writeAuth({
254610
+ accessToken: response.accessToken,
254611
+ refreshToken: response.refreshToken,
254612
+ expiresAt,
254613
+ email: userInfo.email,
254614
+ name: userInfo.name
254615
+ });
254616
+ }
254617
+ async function login({
254618
+ log,
254619
+ runTask
254620
+ }) {
254621
+ const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
254622
+ const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
254623
+ const userInfo = await getUserInfo(token.accessToken);
254624
+ await saveAuthData(token, userInfo);
254625
+ return {
254626
+ outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
254627
+ };
254628
+ }
254629
+
254630
+ // src/cli/utils/command/middleware.ts
254631
+ async function ensureAuth(ctx) {
254632
+ if (hasWorkspaceApiKeyAuth()) {
254633
+ ctx.errorReporter.setContext({
254634
+ user: { email: "workspace-api-key", name: "Workspace API key" }
254635
+ });
254636
+ return;
254637
+ }
254638
+ await seedAuthFromEnv();
254639
+ const loggedIn = await isLoggedIn();
254640
+ if (!loggedIn) {
254641
+ ctx.log.info("You need to login first to continue.");
254642
+ await login(ctx);
254643
+ }
254644
+ try {
254645
+ const userInfo = await readAuth();
254646
+ ctx.errorReporter.setContext({
254647
+ user: { email: userInfo.email, name: userInfo.name }
254648
+ });
254649
+ } catch {}
254650
+ }
254651
+ async function ensureAppContext(ctx, options = {}) {
254652
+ const appContext = await initAppContext(options);
254653
+ ctx.app = appContext;
254654
+ ctx.errorReporter.setContext({ appId: appContext.id });
254655
+ }
254656
+
254339
254657
  // src/cli/utils/version-check.ts
254340
254658
  async function checkForUpgrade() {
254341
254659
  const testLatestVersion = getTestOverrides()?.latestVersion;
@@ -254714,667 +255032,6 @@ function formatYaml(data, options = {}) {
254714
255032
  const replacer = stripEmpty ? stripEmptyReplacer : undefined;
254715
255033
  return $stringify(data, replacer, { indent: YAML_INDENT }).trimEnd();
254716
255034
  }
254717
- // src/core/deployments/api.ts
254718
- import { readFile as readFile2 } from "node:fs/promises";
254719
-
254720
- // src/core/deployments/schema.ts
254721
- var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
254722
- var CreateDeploymentResponseSchema = exports_external.object({
254723
- deployment_id: exports_external.string(),
254724
- asset_buckets: exports_external.array(exports_external.array(exports_external.string()))
254725
- }).transform((data) => ({
254726
- deploymentId: data.deployment_id,
254727
- assetBuckets: data.asset_buckets
254728
- }));
254729
- var AssetUploadResponseSchema = exports_external.looseObject({
254730
- result: exports_external.looseObject({ jwt: exports_external.string().nullable().optional() }).nullable().optional()
254731
- });
254732
- var FinalizeDeploymentResponseSchema = exports_external.object({
254733
- deployment_id: exports_external.string()
254734
- }).transform((data) => ({
254735
- deploymentId: data.deployment_id
254736
- }));
254737
-
254738
- // src/core/deployments/api.ts
254739
- var MODULE_CONTENT_TYPES = {
254740
- esm: "application/javascript+module",
254741
- sourcemap: "application/source-map",
254742
- wasm: "application/wasm",
254743
- text: "text/plain",
254744
- data: "application/octet-stream"
254745
- };
254746
- async function createDeployment(request) {
254747
- const appClient = getAppClient();
254748
- let response;
254749
- try {
254750
- response = await appClient.post("deployments", {
254751
- json: request,
254752
- timeout: 120000
254753
- });
254754
- } catch (error48) {
254755
- throw await ApiError.fromHttpError(error48, "creating deployment");
254756
- }
254757
- const result = CreateDeploymentResponseSchema.safeParse(await response.json());
254758
- if (!result.success) {
254759
- throw new SchemaValidationError("Invalid response from server", result.error);
254760
- }
254761
- return result.data;
254762
- }
254763
- async function uploadAssetBucket(deploymentId, formData) {
254764
- const appClient = getAppClient();
254765
- const response = await appClient.post(`deployments/${encodeURIComponent(deploymentId)}/assets`, {
254766
- searchParams: { base64: "true" },
254767
- body: formData,
254768
- timeout: 120000,
254769
- retry: 0
254770
- });
254771
- const parsed = AssetUploadResponseSchema.safeParse(await response.json());
254772
- const jwt3 = parsed.success ? parsed.data.result?.jwt : null;
254773
- return jwt3 || null;
254774
- }
254775
- async function finalizeDeployment(deploymentId, completionJwt, modules) {
254776
- const appClient = getAppClient();
254777
- const formData = new FormData;
254778
- formData.append("payload", JSON.stringify({ completion_jwt: completionJwt }));
254779
- for (const module of modules) {
254780
- const content = module.content !== undefined ? module.content : new Uint8Array(await readFile2(module.absolutePath));
254781
- formData.append(module.name, new File([content], module.name, {
254782
- type: MODULE_CONTENT_TYPES[module.type]
254783
- }));
254784
- }
254785
- let response;
254786
- try {
254787
- response = await appClient.post(`deployments/${encodeURIComponent(deploymentId)}/finalize`, { body: formData, timeout: 180000 });
254788
- } catch (error48) {
254789
- throw await ApiError.fromHttpError(error48, "finalizing deployment");
254790
- }
254791
- const result = FinalizeDeploymentResponseSchema.safeParse(await response.json());
254792
- if (!result.success) {
254793
- throw new SchemaValidationError("Invalid response from server", result.error);
254794
- }
254795
- return result.data;
254796
- }
254797
- // src/core/deployments/manifest.ts
254798
- import { createHash } from "node:crypto";
254799
- import { readdir as readdir2, readFile as readFile3, stat } from "node:fs/promises";
254800
- import { extname, join as join15 } from "node:path";
254801
- var MAX_ASSET_SIZE_BYTES = 25 * 1024 * 1024;
254802
- var MAX_ASSET_COUNT = 1e5;
254803
- var ASSETS_IGNORE_FILE = ".assetsignore";
254804
- var ALWAYS_SKIPPED_FILES = new Set([
254805
- ASSETS_IGNORE_FILE,
254806
- "wrangler.json",
254807
- ".dev.vars"
254808
- ]);
254809
- var MIME_TYPES = {
254810
- ".html": "text/html",
254811
- ".htm": "text/html",
254812
- ".css": "text/css",
254813
- ".js": "text/javascript",
254814
- ".mjs": "text/javascript",
254815
- ".json": "application/json",
254816
- ".map": "application/json",
254817
- ".txt": "text/plain",
254818
- ".xml": "application/xml",
254819
- ".svg": "image/svg+xml",
254820
- ".png": "image/png",
254821
- ".jpg": "image/jpeg",
254822
- ".jpeg": "image/jpeg",
254823
- ".gif": "image/gif",
254824
- ".webp": "image/webp",
254825
- ".avif": "image/avif",
254826
- ".ico": "image/x-icon",
254827
- ".woff": "font/woff",
254828
- ".woff2": "font/woff2",
254829
- ".ttf": "font/ttf",
254830
- ".otf": "font/otf",
254831
- ".eot": "application/vnd.ms-fontobject",
254832
- ".mp3": "audio/mpeg",
254833
- ".mp4": "video/mp4",
254834
- ".webm": "video/webm",
254835
- ".pdf": "application/pdf",
254836
- ".wasm": "application/wasm",
254837
- ".webmanifest": "application/manifest+json"
254838
- };
254839
- function getMimeType(filePath) {
254840
- return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
254841
- }
254842
- function hashAsset(appId, content) {
254843
- return createHash("sha256").update(Buffer.from(appId, "utf8")).update(content).digest("hex").slice(0, 32);
254844
- }
254845
- function globToRegExp(glob) {
254846
- let source = "";
254847
- for (let i2 = 0;i2 < glob.length; i2++) {
254848
- const char = glob[i2];
254849
- if (char === "*") {
254850
- if (glob[i2 + 1] === "*") {
254851
- source += ".*";
254852
- i2++;
254853
- } else {
254854
- source += "[^/]*";
254855
- }
254856
- } else if (char === "?") {
254857
- source += "[^/]";
254858
- } else {
254859
- source += char.replace(/[.+^${}()|[\]\\]/g, "\\$&");
254860
- }
254861
- }
254862
- return new RegExp(`^${source}$`);
254863
- }
254864
- function createIgnoreMatcher(lines) {
254865
- const rules = lines.map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#")).map((line) => {
254866
- const isDirOnly = line.endsWith("/");
254867
- let pattern = isDirOnly ? line.slice(0, -1) : line;
254868
- const anchored = pattern.includes("/");
254869
- pattern = pattern.replace(/^\//, "");
254870
- return { regex: globToRegExp(pattern), anchored, isDirOnly };
254871
- });
254872
- return (relativePath, isDirectory2) => {
254873
- const segments = relativePath.split("/");
254874
- return rules.some((rule) => {
254875
- if (rule.anchored) {
254876
- if (rule.isDirOnly ? isDirectory2 : true) {
254877
- if (rule.regex.test(relativePath))
254878
- return true;
254879
- }
254880
- return false;
254881
- }
254882
- const basename4 = segments[segments.length - 1];
254883
- if (rule.isDirOnly && !isDirectory2)
254884
- return false;
254885
- return rule.regex.test(basename4);
254886
- });
254887
- };
254888
- }
254889
- async function loadIgnoreMatcher(assetsDir) {
254890
- const ignorePath = join15(assetsDir, ASSETS_IGNORE_FILE);
254891
- if (!await pathExists(ignorePath)) {
254892
- return () => false;
254893
- }
254894
- const content = await readTextFile(ignorePath);
254895
- return createIgnoreMatcher(content.split(/\r?\n/));
254896
- }
254897
- async function buildAssetManifest(assetsDir, appId) {
254898
- const isIgnored = await loadIgnoreMatcher(assetsDir);
254899
- const manifest = {};
254900
- const filesByHash = new Map;
254901
- const relativeFilePaths = await collectFilePaths(assetsDir, "", isIgnored);
254902
- if (relativeFilePaths.length > MAX_ASSET_COUNT) {
254903
- throw new InvalidInputError(`Too many static assets: found ${relativeFilePaths.length}, the limit is ${MAX_ASSET_COUNT} files.`);
254904
- }
254905
- for (const relativePath of relativeFilePaths.sort()) {
254906
- const absolutePath = join15(assetsDir, ...relativePath.split("/"));
254907
- const { size } = await stat(absolutePath);
254908
- if (size > MAX_ASSET_SIZE_BYTES) {
254909
- throw new InvalidInputError(`Static asset "${relativePath}" is ${size} bytes, which exceeds the 25 MiB per-file limit.`);
254910
- }
254911
- const content = await readFile3(absolutePath);
254912
- const hash2 = hashAsset(appId, content);
254913
- manifest[`/${relativePath}`] = { hash: hash2, size };
254914
- if (!filesByHash.has(hash2)) {
254915
- filesByHash.set(hash2, {
254916
- absolutePath,
254917
- hash: hash2,
254918
- size,
254919
- contentType: getMimeType(absolutePath)
254920
- });
254921
- }
254922
- }
254923
- return { manifest, filesByHash };
254924
- }
254925
- async function collectFilePaths(dir, relativeDir, isIgnored) {
254926
- const entries = await readdir2(dir, { withFileTypes: true });
254927
- const results = [];
254928
- for (const entry of entries) {
254929
- const relativePath = relativeDir ? `${relativeDir}/${entry.name}` : entry.name;
254930
- if (entry.isDirectory()) {
254931
- if (isIgnored(relativePath, true))
254932
- continue;
254933
- results.push(...await collectFilePaths(join15(dir, entry.name), relativePath, isIgnored));
254934
- continue;
254935
- }
254936
- if (!entry.isFile())
254937
- continue;
254938
- if (ALWAYS_SKIPPED_FILES.has(entry.name))
254939
- continue;
254940
- if (isIgnored(relativePath, false))
254941
- continue;
254942
- results.push(relativePath);
254943
- }
254944
- return results;
254945
- }
254946
-
254947
- // src/core/deployments/modules.ts
254948
- import { stat as stat2 } from "node:fs/promises";
254949
- import { relative as relative3, resolve as resolve4, sep } from "node:path";
254950
- var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
254951
- var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
254952
- var RULE_TYPE_TO_MODULE_TYPE = {
254953
- ESModule: "esm",
254954
- CompiledWasm: "wasm",
254955
- Text: "text",
254956
- Data: "data"
254957
- };
254958
- function toPosix(path16) {
254959
- return path16.split(sep).join("/");
254960
- }
254961
- async function collectModules(config12) {
254962
- const entryPath = resolve4(config12.configDir, config12.main);
254963
- if (!await pathExists(entryPath)) {
254964
- throw new InvalidInputError(`Worker entry module does not exist: ${entryPath} (from "main" in ${config12.configPath})`, {
254965
- hints: [{ message: "Rebuild the project to regenerate the artifact" }]
254966
- });
254967
- }
254968
- const modulesByName = new Map;
254969
- const entryName = toPosix(relative3(config12.configDir, entryPath));
254970
- modulesByName.set(entryName, {
254971
- name: entryName,
254972
- absolutePath: entryPath,
254973
- size: 0,
254974
- type: "esm"
254975
- });
254976
- const ignore = [...MODULE_IGNORE];
254977
- if (config12.assetsDirectory?.startsWith(config12.configDir + sep)) {
254978
- ignore.push(`${toPosix(relative3(config12.configDir, config12.assetsDirectory))}/**`);
254979
- }
254980
- for (const rule of config12.rules) {
254981
- const type = RULE_TYPE_TO_MODULE_TYPE[rule.type];
254982
- if (!type) {
254983
- throw new InvalidInputError(`Unsupported module rule type "${rule.type}" in ${config12.configPath}. Supported: ${Object.keys(RULE_TYPE_TO_MODULE_TYPE).join(", ")}.`);
254984
- }
254985
- const matches = await globby(rule.globs, {
254986
- cwd: config12.configDir,
254987
- onlyFiles: true,
254988
- dot: true,
254989
- ignore
254990
- });
254991
- for (const match of matches.sort()) {
254992
- if (!modulesByName.has(match)) {
254993
- modulesByName.set(match, {
254994
- name: match,
254995
- absolutePath: resolve4(config12.configDir, match),
254996
- size: 0,
254997
- type
254998
- });
254999
- }
255000
- }
255001
- }
255002
- if (config12.uploadSourceMaps) {
255003
- const maps = await globby("**/*.map", {
255004
- cwd: config12.configDir,
255005
- onlyFiles: true,
255006
- dot: true,
255007
- ignore
255008
- });
255009
- for (const map2 of maps.sort()) {
255010
- addSourcemap(modulesByName, config12.configDir, map2);
255011
- }
255012
- } else {
255013
- for (const name2 of [...modulesByName.keys()]) {
255014
- const mapName = `${name2}.map`;
255015
- if (await pathExists(resolve4(config12.configDir, mapName))) {
255016
- addSourcemap(modulesByName, config12.configDir, mapName);
255017
- }
255018
- }
255019
- }
255020
- const modules = [...modulesByName.values()];
255021
- let totalBytes = 0;
255022
- for (const module of modules) {
255023
- module.size = (await stat2(module.absolutePath)).size;
255024
- totalBytes += module.size;
255025
- }
255026
- if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
255027
- throw new InvalidInputError(`Worker modules total ${totalBytes} bytes, which exceeds the 40 MB limit for Base44 full-stack deploys.`);
255028
- }
255029
- return modules;
255030
- }
255031
- function addSourcemap(modulesByName, configDir, name2) {
255032
- if (modulesByName.has(name2))
255033
- return;
255034
- modulesByName.set(name2, {
255035
- name: name2,
255036
- absolutePath: resolve4(configDir, name2),
255037
- size: 0,
255038
- type: "sourcemap"
255039
- });
255040
- }
255041
-
255042
- // src/core/deployments/upload.ts
255043
- import { readFile as readFile4 } from "node:fs/promises";
255044
- var BUCKET_CONCURRENCY = 3;
255045
- var MAX_ATTEMPTS_PER_BUCKET = 3;
255046
- var RETRY_BASE_DELAY_MS = 500;
255047
- var MAX_RATE_LIMIT_WAITS = 10;
255048
- var RATE_LIMIT_DELAY_MS = 15000;
255049
- async function uploadAssetBuckets(deploymentId, buckets, filesByHash, onProgress) {
255050
- if (buckets.length === 0) {
255051
- return null;
255052
- }
255053
- const totalFiles = buckets.reduce((sum, bucket) => sum + bucket.length, 0);
255054
- let uploadedFiles = 0;
255055
- let completedBuckets = 0;
255056
- let completionJwt = null;
255057
- let nextBucket = 0;
255058
- const worker = async () => {
255059
- while (nextBucket < buckets.length) {
255060
- const bucket = buckets[nextBucket++];
255061
- const jwt3 = await uploadBucketWithRetry(deploymentId, bucket, filesByHash);
255062
- if (jwt3) {
255063
- completionJwt = jwt3;
255064
- }
255065
- uploadedFiles += bucket.length;
255066
- completedBuckets++;
255067
- onProgress?.({
255068
- uploadedFiles,
255069
- totalFiles,
255070
- completedBuckets,
255071
- totalBuckets: buckets.length
255072
- });
255073
- }
255074
- };
255075
- await Promise.all(Array.from({ length: Math.min(BUCKET_CONCURRENCY, buckets.length) }, worker));
255076
- if (!completionJwt) {
255077
- throw new ApiError("Asset upload finished but the server did not return a completion token.");
255078
- }
255079
- return completionJwt;
255080
- }
255081
- async function uploadBucketWithRetry(deploymentId, bucket, filesByHash) {
255082
- let lastError;
255083
- let rateLimitWaits = 0;
255084
- const formData = await buildBucketForm(bucket, filesByHash);
255085
- for (let attempt = 0;attempt < MAX_ATTEMPTS_PER_BUCKET; attempt++) {
255086
- if (attempt > 0) {
255087
- await sleep3(RETRY_BASE_DELAY_MS * 2 ** (attempt - 1));
255088
- }
255089
- try {
255090
- return await uploadAssetBucket(deploymentId, formData);
255091
- } catch (error48) {
255092
- if (error48 instanceof HTTPError && error48.response.status === 429 && rateLimitWaits < MAX_RATE_LIMIT_WAITS) {
255093
- rateLimitWaits++;
255094
- attempt--;
255095
- await sleep3(RATE_LIMIT_DELAY_MS);
255096
- continue;
255097
- }
255098
- lastError = error48;
255099
- }
255100
- }
255101
- if (lastError instanceof HTTPError && lastError.response.status === 409) {
255102
- throw new ApiError("This deploy's upload session has expired — rerun deploy. Already-uploaded assets are skipped on the next attempt.", { statusCode: 409, cause: lastError });
255103
- }
255104
- throw await ApiError.fromHttpError(lastError, "uploading static assets");
255105
- }
255106
- async function buildBucketForm(bucket, filesByHash) {
255107
- const formData = new FormData;
255108
- for (const hash2 of bucket) {
255109
- const file2 = filesByHash.get(hash2);
255110
- if (!file2) {
255111
- throw new InternalError(`Server requested upload of unknown asset hash: ${hash2}`);
255112
- }
255113
- const content = await readFile4(file2.absolutePath);
255114
- formData.append(hash2, new File([content.toString("base64")], hash2, { type: file2.contentType }));
255115
- }
255116
- return formData;
255117
- }
255118
- function sleep3(ms) {
255119
- return new Promise((resolve5) => setTimeout(resolve5, ms));
255120
- }
255121
-
255122
- // src/core/deployments/wrangler-config.ts
255123
- import { dirname as dirname10, join as join16, resolve as resolve5 } from "node:path";
255124
- var WRANGLER_REDIRECT_PATH = join16(".wrangler", "deploy", "config.json");
255125
- var RedirectConfigSchema = exports_external.looseObject({
255126
- configPath: exports_external.string().min(1)
255127
- });
255128
- var BindingArraySchema = exports_external.array(exports_external.unknown()).optional();
255129
- var WranglerConfigSchema = exports_external.looseObject({
255130
- name: exports_external.string().optional(),
255131
- main: exports_external.string().min(1, "wrangler config is missing a 'main' entry module"),
255132
- no_bundle: exports_external.boolean().optional(),
255133
- rules: exports_external.array(exports_external.looseObject({ type: exports_external.string(), globs: exports_external.array(exports_external.string()) })).optional(),
255134
- assets: exports_external.looseObject({
255135
- directory: exports_external.string().optional(),
255136
- html_handling: exports_external.string().optional(),
255137
- not_found_handling: exports_external.string().optional(),
255138
- run_worker_first: exports_external.union([exports_external.boolean(), exports_external.array(exports_external.string())]).optional(),
255139
- headers: exports_external.string().optional(),
255140
- redirects: exports_external.string().optional()
255141
- }).optional(),
255142
- compatibility_date: exports_external.string().optional(),
255143
- compatibility_flags: exports_external.array(exports_external.string()).optional(),
255144
- vars: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
255145
- upload_source_maps: exports_external.boolean().optional(),
255146
- kv_namespaces: BindingArraySchema,
255147
- d1_databases: BindingArraySchema,
255148
- r2_buckets: BindingArraySchema,
255149
- durable_objects: exports_external.looseObject({ bindings: BindingArraySchema }).optional(),
255150
- services: BindingArraySchema,
255151
- queues: exports_external.looseObject({
255152
- producers: BindingArraySchema,
255153
- consumers: BindingArraySchema
255154
- }).optional(),
255155
- hyperdrive: BindingArraySchema,
255156
- analytics_engine_datasets: BindingArraySchema,
255157
- vectorize: BindingArraySchema
255158
- });
255159
- async function detectFullStackArtifact(projectRoot) {
255160
- const redirectPath = join16(projectRoot, WRANGLER_REDIRECT_PATH);
255161
- if (await pathExists(redirectPath)) {
255162
- return { source: "redirect", path: redirectPath };
255163
- }
255164
- for (const name2 of ["wrangler.jsonc", "wrangler.json"]) {
255165
- const configPath = join16(projectRoot, name2);
255166
- if (await pathExists(configPath)) {
255167
- return { source: "root-config", path: configPath };
255168
- }
255169
- }
255170
- const tomlPath = join16(projectRoot, "wrangler.toml");
255171
- if (await pathExists(tomlPath)) {
255172
- return { source: "toml", path: tomlPath };
255173
- }
255174
- return null;
255175
- }
255176
- async function resolveWranglerConfig(projectRoot) {
255177
- const artifact = await detectFullStackArtifact(projectRoot);
255178
- if (!artifact) {
255179
- throw new InvalidInputError("No full-stack build artifact found. Expected a .wrangler/deploy/config.json redirect file or a root wrangler.jsonc.", {
255180
- hints: [{ message: "Run your framework's build command first" }]
255181
- });
255182
- }
255183
- if (artifact.source === "toml") {
255184
- throw new InvalidInputError("wrangler.toml is not supported for Base44 full-stack deploys. Convert your config to wrangler.jsonc.");
255185
- }
255186
- const configPath = artifact.source === "redirect" ? await resolveRedirectedConfigPath(artifact.path) : artifact.path;
255187
- const parsed = await readJsonFile(configPath);
255188
- const result = WranglerConfigSchema.safeParse(parsed);
255189
- if (!result.success) {
255190
- throw new ConfigInvalidError(`Invalid wrangler config: ${exports_external.prettifyError(result.error)}`, configPath);
255191
- }
255192
- const config12 = result.data;
255193
- if (config12.no_bundle !== true) {
255194
- 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).");
255195
- }
255196
- assertNoUnsupportedBindings(config12, configPath);
255197
- const configDir = dirname10(configPath);
255198
- const assetsDirectory = config12.assets?.directory ? resolve5(configDir, config12.assets.directory) : null;
255199
- return {
255200
- configPath,
255201
- configDir,
255202
- name: config12.name ?? null,
255203
- main: config12.main,
255204
- assetsDirectory,
255205
- assetsConfig: config12.assets ? toResolvedAssetsConfig(config12.assets) : null,
255206
- compatibilityDate: config12.compatibility_date ?? null,
255207
- compatibilityFlags: config12.compatibility_flags ?? [],
255208
- vars: config12.vars ?? {},
255209
- rules: (config12.rules ?? []).map((rule) => ({
255210
- type: rule.type,
255211
- globs: rule.globs
255212
- })),
255213
- uploadSourceMaps: config12.upload_source_maps ?? false
255214
- };
255215
- }
255216
- async function resolveRedirectedConfigPath(redirectPath) {
255217
- const parsed = await readJsonFile(redirectPath);
255218
- const result = RedirectConfigSchema.safeParse(parsed);
255219
- if (!result.success) {
255220
- throw new ConfigInvalidError(`Invalid deploy redirect file: ${exports_external.prettifyError(result.error)}`, redirectPath);
255221
- }
255222
- const configPath = resolve5(dirname10(redirectPath), result.data.configPath);
255223
- if (!await pathExists(configPath)) {
255224
- throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
255225
- hints: [{ message: "Rebuild the project to regenerate the artifact" }]
255226
- });
255227
- }
255228
- return configPath;
255229
- }
255230
- function toResolvedAssetsConfig(assets) {
255231
- return {
255232
- htmlHandling: assets.html_handling,
255233
- notFoundHandling: assets.not_found_handling,
255234
- runWorkerFirst: assets.run_worker_first,
255235
- headers: assets.headers,
255236
- redirects: assets.redirects
255237
- };
255238
- }
255239
- function assertNoUnsupportedBindings(config12, configPath) {
255240
- const bindingSources = {
255241
- kv_namespaces: config12.kv_namespaces,
255242
- d1_databases: config12.d1_databases,
255243
- r2_buckets: config12.r2_buckets,
255244
- "durable_objects.bindings": config12.durable_objects?.bindings,
255245
- services: config12.services,
255246
- "queues.producers": config12.queues?.producers,
255247
- "queues.consumers": config12.queues?.consumers,
255248
- hyperdrive: config12.hyperdrive,
255249
- analytics_engine_datasets: config12.analytics_engine_datasets,
255250
- vectorize: config12.vectorize
255251
- };
255252
- const used = Object.entries(bindingSources).filter(([, values]) => (values?.length ?? 0) > 0).map(([name2]) => name2);
255253
- if (used.length > 0) {
255254
- throw new InvalidInputError(`Unsupported bindings for Base44 full-stack deploys: ${used.join(", ")}. Remove them or file a feature request.`, {
255255
- hints: [{ message: `Edit the bindings in ${configPath}` }]
255256
- });
255257
- }
255258
- }
255259
-
255260
- // src/core/deployments/deploy.ts
255261
- async function resolveGitHash(projectRoot, explicit) {
255262
- const hash2 = explicit ?? await gitHead(projectRoot);
255263
- if (!hash2 || !GIT_HASH_PATTERN.test(hash2)) {
255264
- throw new InvalidInputError(explicit ? `'${explicit}' is not a git commit hash.` : "Full-stack deployments are addressed by the commit that produced the build, and no git commit was found.", {
255265
- hints: [
255266
- {
255267
- message: "Run the deploy from a git checkout, or pass the commit explicitly with --git-hash."
255268
- }
255269
- ]
255270
- });
255271
- }
255272
- return hash2;
255273
- }
255274
- async function gitHead(projectRoot) {
255275
- try {
255276
- const { stdout } = await execa("git", ["rev-parse", "HEAD"], {
255277
- cwd: projectRoot
255278
- });
255279
- return stdout.trim();
255280
- } catch {
255281
- return null;
255282
- }
255283
- }
255284
- async function deployFullStack(options) {
255285
- const { projectRoot, gitHash, progress } = options;
255286
- const config12 = await resolveWranglerConfig(projectRoot);
255287
- if (!config12.compatibilityFlags.includes("nodejs_compat")) {
255288
- 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.");
255289
- }
255290
- if (config12.vars && Object.keys(config12.vars).length > 0) {
255291
- progress?.onWarning?.("wrangler 'vars' are not supported and were ignored — a worker's environment comes from the app's secrets (base44 secrets set).");
255292
- }
255293
- const modules = await collectModules(config12);
255294
- let assets = { manifest: {}, filesByHash: new Map };
255295
- if (config12.assetsDirectory && await pathExists(config12.assetsDirectory)) {
255296
- assets = await buildAssetManifest(config12.assetsDirectory, getAppContext().id);
255297
- }
255298
- const created = await createDeployment({
255299
- git_hash: gitHash,
255300
- config: {
255301
- main: config12.main,
255302
- compatibility_date: config12.compatibilityDate,
255303
- compatibility_flags: config12.compatibilityFlags,
255304
- assets: buildAssetsConfig(config12.assetsConfig, progress)
255305
- },
255306
- asset_manifest: assets.manifest
255307
- });
255308
- const totalAssets = Object.keys(assets.manifest).length;
255309
- const newAssets = new Set(created.assetBuckets.flat()).size;
255310
- progress?.onAssets?.({ totalAssets, newAssets });
255311
- const completionJwt = await uploadAssetBuckets(created.deploymentId, created.assetBuckets, assets.filesByHash, progress?.onAssetUpload);
255312
- progress?.onWorker?.({ moduleCount: modules.length });
255313
- const finalized = await finalizeDeployment(created.deploymentId, completionJwt, modules);
255314
- return { deploymentId: finalized.deploymentId, gitHash };
255315
- }
255316
- function buildAssetsConfig(assetsConfig, progress) {
255317
- if (!assetsConfig)
255318
- return null;
255319
- if (assetsConfig.headers || assetsConfig.redirects) {
255320
- progress?.onWarning?.("_headers/_redirects files are not supported yet and were ignored for this deploy.");
255321
- }
255322
- let runWorkerFirst;
255323
- if (Array.isArray(assetsConfig.runWorkerFirst)) {
255324
- progress?.onWarning?.("'run_worker_first' route patterns are not supported yet and were ignored for this deploy.");
255325
- } else {
255326
- runWorkerFirst = assetsConfig.runWorkerFirst;
255327
- }
255328
- return {
255329
- html_handling: assetsConfig.htmlHandling,
255330
- not_found_handling: assetsConfig.notFoundHandling,
255331
- run_worker_first: runWorkerFirst
255332
- };
255333
- }
255334
- // src/core/deployments/static-site.ts
255335
- var STATIC_WORKERS_ENV = "BASE44_STATIC_WORKERS";
255336
- function staticWorkersEnabled(env2 = process.env) {
255337
- const value = env2[STATIC_WORKERS_ENV];
255338
- return value === "1" || value === "true";
255339
- }
255340
- var STUB_MODULE_NAME = "index.js";
255341
- var STUB_SOURCE = `export default {
255342
- async fetch(request, env) {
255343
- return env.ASSETS.fetch(request);
255344
- },
255345
- };
255346
- `;
255347
- var STATIC_COMPATIBILITY_DATE = "2026-01-01";
255348
- async function deployStaticSite(options) {
255349
- const { outputDir, gitHash, progress } = options;
255350
- const assets = await buildAssetManifest(outputDir, getAppContext().id);
255351
- const created = await createDeployment({
255352
- git_hash: gitHash,
255353
- config: {
255354
- main: STUB_MODULE_NAME,
255355
- compatibility_date: STATIC_COMPATIBILITY_DATE,
255356
- compatibility_flags: [],
255357
- assets: { not_found_handling: "single-page-application" }
255358
- },
255359
- asset_manifest: assets.manifest
255360
- });
255361
- const totalAssets = Object.keys(assets.manifest).length;
255362
- const newAssets = new Set(created.assetBuckets.flat()).size;
255363
- progress?.onAssets?.({ totalAssets, newAssets });
255364
- const completionJwt = await uploadAssetBuckets(created.deploymentId, created.assetBuckets, assets.filesByHash, progress?.onAssetUpload);
255365
- const stubBytes = new TextEncoder().encode(STUB_SOURCE);
255366
- const modules = [
255367
- {
255368
- name: STUB_MODULE_NAME,
255369
- content: stubBytes,
255370
- size: stubBytes.byteLength,
255371
- type: "esm"
255372
- }
255373
- ];
255374
- progress?.onWorker?.({ moduleCount: modules.length });
255375
- const finalized = await finalizeDeployment(created.deploymentId, completionJwt, modules);
255376
- return { deploymentId: finalized.deploymentId, gitHash };
255377
- }
255378
255035
  // src/core/utils/dependencies.ts
255379
255036
  import { spawnSync as spawnSync2 } from "node:child_process";
255380
255037
  function verifyDenoInstalled(context) {
@@ -255463,7 +255120,7 @@ async function pullAction({
255463
255120
  runTask: runTask2
255464
255121
  }) {
255465
255122
  const { project: project2 } = await readProjectConfig();
255466
- const dir = join17(dirname11(project2.configPath), project2.agentSkillsDir);
255123
+ const dir = join17(dirname10(project2.configPath), project2.agentSkillsDir);
255467
255124
  const remote = await runTask2("Fetching agent skills from Base44", () => fetchAgentSkills(), {
255468
255125
  successMessage: "Agent skills fetched successfully",
255469
255126
  errorMessage: "Failed to fetch agent skills"
@@ -255519,13 +255176,13 @@ function getAgentSkillsCommand() {
255519
255176
  }
255520
255177
 
255521
255178
  // src/cli/commands/agents/pull.ts
255522
- import { dirname as dirname12, join as join18 } from "node:path";
255179
+ import { dirname as dirname11, join as join18 } from "node:path";
255523
255180
  async function pullAgentsAction({
255524
255181
  log,
255525
255182
  runTask: runTask2
255526
255183
  }) {
255527
255184
  const { project: project2 } = await readProjectConfig();
255528
- const configDir = dirname12(project2.configPath);
255185
+ const configDir = dirname11(project2.configPath);
255529
255186
  const agentsDir = join18(configDir, project2.agentsDir);
255530
255187
  const remoteAgents = await runTask2("Fetching agents from Base44", async () => {
255531
255188
  return await fetchAgents();
@@ -255596,11 +255253,11 @@ function getAgentsCommand() {
255596
255253
  }
255597
255254
 
255598
255255
  // src/cli/commands/auth/password-login.ts
255599
- import { dirname as dirname13, join as join19 } from "node:path";
255256
+ import { dirname as dirname12, join as join19 } from "node:path";
255600
255257
  async function passwordLoginAction({ log, runTask: runTask2 }, action) {
255601
255258
  const shouldEnable = action === "enable";
255602
255259
  const { project: project2 } = await readProjectConfig();
255603
- const configDir = dirname13(project2.configPath);
255260
+ const configDir = dirname12(project2.configPath);
255604
255261
  const authDir = join19(configDir, project2.authDir);
255605
255262
  const updated = await runTask2("Updating local auth config", async () => {
255606
255263
  const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
@@ -255621,13 +255278,13 @@ function getPasswordLoginCommand() {
255621
255278
  }
255622
255279
 
255623
255280
  // src/cli/commands/auth/pull.ts
255624
- import { dirname as dirname14, join as join20 } from "node:path";
255281
+ import { dirname as dirname13, join as join20 } from "node:path";
255625
255282
  async function pullAuthAction({
255626
255283
  log,
255627
255284
  runTask: runTask2
255628
255285
  }) {
255629
255286
  const { project: project2 } = await readProjectConfig();
255630
- const configDir = dirname14(project2.configPath);
255287
+ const configDir = dirname13(project2.configPath);
255631
255288
  const authDir = join20(configDir, project2.authDir);
255632
255289
  const remoteConfig = await runTask2("Fetching auth config from Base44", async () => {
255633
255290
  return await pullAuthConfig();
@@ -255692,7 +255349,7 @@ function getAuthPushCommand() {
255692
255349
  }
255693
255350
 
255694
255351
  // src/cli/commands/auth/social-login.ts
255695
- import { dirname as dirname15, join as join21, resolve as resolve6 } from "node:path";
255352
+ import { dirname as dirname14, join as join21, resolve as resolve5 } from "node:path";
255696
255353
  var PROVIDER_LABELS = {
255697
255354
  google: "Google",
255698
255355
  microsoft: "Microsoft",
@@ -255732,7 +255389,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
255732
255389
  let clientSecret;
255733
255390
  if (useCustomOAuth && oauth && oauthCli && hasSecretOptions(options)) {
255734
255391
  if (options.envFile) {
255735
- const secrets = await parseEnvFile(resolve6(options.envFile));
255392
+ const secrets = await parseEnvFile(resolve5(options.envFile));
255736
255393
  const value = secrets[oauthCli.envVar];
255737
255394
  if (!value) {
255738
255395
  throw new InvalidInputError(`Key "${oauthCli.envVar}" not found in ${options.envFile}.`);
@@ -255762,7 +255419,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
255762
255419
  }
255763
255420
  }
255764
255421
  const { project: project2 } = await readProjectConfig();
255765
- const configDir = dirname15(project2.configPath);
255422
+ const configDir = dirname14(project2.configPath);
255766
255423
  const authDir = join21(configDir, project2.authDir);
255767
255424
  const { config: updated } = await runTask2("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
255768
255425
  if (clientSecret) {
@@ -255788,7 +255445,7 @@ function getSocialLoginCommand() {
255788
255445
  }
255789
255446
 
255790
255447
  // src/cli/commands/auth/sso.ts
255791
- import { dirname as dirname16, join as join22, resolve as resolve7 } from "node:path";
255448
+ import { dirname as dirname15, join as join22, resolve as resolve6 } from "node:path";
255792
255449
  var SSOConfigFileSchema = exports_external.object({
255793
255450
  provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
255794
255451
  clientId: exports_external.string(),
@@ -255804,7 +255461,7 @@ var SSOConfigFileSchema = exports_external.object({
255804
255461
  ssoName: exports_external.string().optional()
255805
255462
  });
255806
255463
  async function loadSSOConfigFile(filePath) {
255807
- const resolved = resolve7(filePath);
255464
+ const resolved = resolve6(filePath);
255808
255465
  const raw2 = await readJsonFile(resolved);
255809
255466
  const result = SSOConfigFileSchema.safeParse(raw2);
255810
255467
  if (!result.success) {
@@ -255892,7 +255549,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
255892
255549
  }
255893
255550
  let clientSecret;
255894
255551
  if (merged.envFile && !merged.clientSecret) {
255895
- const secrets2 = await parseEnvFile(resolve7(merged.envFile));
255552
+ const secrets2 = await parseEnvFile(resolve6(merged.envFile));
255896
255553
  const value = secrets2.sso_client_secret;
255897
255554
  if (!value) {
255898
255555
  throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
@@ -255951,7 +255608,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
255951
255608
  throw error48;
255952
255609
  }
255953
255610
  const { project: project2 } = await readProjectConfig();
255954
- const configDir = dirname16(project2.configPath);
255611
+ const configDir = dirname15(project2.configPath);
255955
255612
  const authDir = join22(configDir, project2.authDir);
255956
255613
  await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
255957
255614
  await runTask2("Saving SSO credentials", async () => pushSSOSecrets(secrets));
@@ -255967,7 +255624,7 @@ async function ssoDisableAction({ log, runTask: runTask2 }, options) {
255967
255624
  throw new InvalidInputError("Configuration options cannot be used with disable. To disable SSO: base44 auth sso disable");
255968
255625
  }
255969
255626
  const { project: project2 } = await readProjectConfig();
255970
- const configDir = dirname16(project2.configPath);
255627
+ const configDir = dirname15(project2.configPath);
255971
255628
  const authDir = join22(configDir, project2.authDir);
255972
255629
  const updated = await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
255973
255630
  await runTask2("Removing SSO credentials", async () => deleteSSOSecrets());
@@ -256530,19 +256187,19 @@ var baseOpen = async (options) => {
256530
256187
  }
256531
256188
  const subprocess = childProcess3.spawn(command2, cliArguments, childProcessOptions);
256532
256189
  if (options.wait) {
256533
- return new Promise((resolve8, reject) => {
256190
+ return new Promise((resolve7, reject) => {
256534
256191
  subprocess.once("error", reject);
256535
256192
  subprocess.once("close", (exitCode) => {
256536
256193
  if (!options.allowNonzeroExitCode && exitCode !== 0) {
256537
256194
  reject(new Error(`Exited with code ${exitCode}`));
256538
256195
  return;
256539
256196
  }
256540
- resolve8(subprocess);
256197
+ resolve7(subprocess);
256541
256198
  });
256542
256199
  });
256543
256200
  }
256544
256201
  if (isFallbackAttempt) {
256545
- return new Promise((resolve8, reject) => {
256202
+ return new Promise((resolve7, reject) => {
256546
256203
  subprocess.once("error", reject);
256547
256204
  subprocess.once("spawn", () => {
256548
256205
  subprocess.once("close", (exitCode) => {
@@ -256552,17 +256209,17 @@ var baseOpen = async (options) => {
256552
256209
  return;
256553
256210
  }
256554
256211
  subprocess.unref();
256555
- resolve8(subprocess);
256212
+ resolve7(subprocess);
256556
256213
  });
256557
256214
  });
256558
256215
  });
256559
256216
  }
256560
256217
  subprocess.unref();
256561
- return new Promise((resolve8, reject) => {
256218
+ return new Promise((resolve7, reject) => {
256562
256219
  subprocess.once("error", reject);
256563
256220
  subprocess.once("spawn", () => {
256564
256221
  subprocess.off("error", reject);
256565
- resolve8(subprocess);
256222
+ resolve7(subprocess);
256566
256223
  });
256567
256224
  });
256568
256225
  };
@@ -256825,13 +256482,13 @@ function getConnectorsListAvailableCommand() {
256825
256482
  }
256826
256483
 
256827
256484
  // src/cli/commands/connectors/pull.ts
256828
- import { dirname as dirname17, join as join23, resolve as resolve8 } from "node:path";
256485
+ import { dirname as dirname16, join as join23, resolve as resolve7 } from "node:path";
256829
256486
  async function resolveConnectorsDir(options) {
256830
256487
  if (!getAppContext().projectRoot) {
256831
- return resolve8(options.dir ?? "connectors");
256488
+ return resolve7(options.dir ?? "connectors");
256832
256489
  }
256833
256490
  const { project: project2 } = await readProjectConfig();
256834
- return join23(dirname17(project2.configPath), project2.connectorsDir);
256491
+ return join23(dirname16(project2.configPath), project2.connectorsDir);
256835
256492
  }
256836
256493
  async function pullConnectorsAction({ log, runTask: runTask2, jsonMode }, options) {
256837
256494
  const connectorsDir = await resolveConnectorsDir(options);
@@ -256872,10 +256529,10 @@ function getConnectorsPullCommand() {
256872
256529
  }
256873
256530
 
256874
256531
  // src/cli/commands/connectors/push.ts
256875
- import { resolve as resolve9 } from "node:path";
256532
+ import { resolve as resolve8 } from "node:path";
256876
256533
  async function readConnectorsToPush(options) {
256877
256534
  if (!getAppContext().projectRoot) {
256878
- return readAllConnectors(resolve9(options.dir ?? "connectors"));
256535
+ return readAllConnectors(resolve8(options.dir ?? "connectors"));
256879
256536
  }
256880
256537
  const { connectors } = await readProjectConfig();
256881
256538
  return connectors;
@@ -257239,10 +256896,10 @@ function getListCommand() {
257239
256896
  }
257240
256897
 
257241
256898
  // src/cli/commands/functions/pull.ts
257242
- import { dirname as dirname18, join as join24 } from "node:path";
256899
+ import { dirname as dirname17, join as join24 } from "node:path";
257243
256900
  async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
257244
256901
  const { project: project2, functions } = await readProjectConfig();
257245
- const configDir = dirname18(project2.configPath);
256902
+ const configDir = dirname17(project2.configPath);
257246
256903
  const functionsDir = join24(configDir, project2.functionsDir);
257247
256904
  const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
257248
256905
  const remoteFunctions = await runTask2("Fetching functions from Base44", async () => {
@@ -257301,8 +256958,82 @@ function getFunctionsCommand() {
257301
256958
  return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand()).addCommand(getDeleteCommand()).addCommand(getListCommand()).addCommand(getPullCommand());
257302
256959
  }
257303
256960
 
256961
+ // src/cli/commands/project/site-build.ts
256962
+ async function runSiteBuild({ runTask: runTask2 }, { root, buildCommand, appId }) {
256963
+ if (!buildCommand) {
256964
+ throw new ConfigNotFoundError("No site build command found.", {
256965
+ hints: [
256966
+ {
256967
+ message: `Add 'site.buildCommand' to your config.jsonc (e.g., "site": { "buildCommand": "npm run build" })`
256968
+ }
256969
+ ]
256970
+ });
256971
+ }
256972
+ await runTask2("Building site...", () => execa({
256973
+ cwd: root,
256974
+ shell: true,
256975
+ env: { VITE_BASE44_APP_ID: appId }
256976
+ })`${buildCommand}`, {
256977
+ successMessage: "Site built successfully",
256978
+ errorMessage: "Build failed"
256979
+ });
256980
+ }
256981
+ async function maybeBuildBeforeDeploy(ctx, project2, build) {
256982
+ if (!ctx.app) {
256983
+ return;
256984
+ }
256985
+ if (build === true) {
256986
+ await runSiteBuild(ctx, {
256987
+ root: project2.root,
256988
+ buildCommand: project2.site?.buildCommand,
256989
+ appId: ctx.app.id
256990
+ });
256991
+ return;
256992
+ }
256993
+ if (build === false || !project2.site?.outputDirectory) {
256994
+ return;
256995
+ }
256996
+ const shouldBuild = await shouldAskToBuild(ctx.isNonInteractive, project2.site.buildCommand);
256997
+ if (shouldBuild) {
256998
+ await runSiteBuild(ctx, {
256999
+ root: project2.root,
257000
+ buildCommand: project2.site.buildCommand,
257001
+ appId: ctx.app.id
257002
+ });
257003
+ }
257004
+ }
257005
+ async function shouldAskToBuild(isNonInteractive, buildCommand) {
257006
+ if (!buildCommand || isNonInteractive) {
257007
+ return false;
257008
+ }
257009
+ const answer = await Re({
257010
+ message: `Build the site first? (runs '${buildCommand}' with your app id)`
257011
+ });
257012
+ return !Ct(answer) && answer;
257013
+ }
257014
+
257015
+ // src/cli/commands/project/build.ts
257016
+ async function buildAction(ctx) {
257017
+ const { app } = ctx;
257018
+ if (!app?.projectRoot) {
257019
+ throw new ConfigInvalidError("base44 build requires a linked local project. Run it from a project with base44/.app.jsonc.");
257020
+ }
257021
+ const { project: project2 } = await readProjectConfig(app.projectRoot);
257022
+ await runSiteBuild(ctx, {
257023
+ root: project2.root,
257024
+ buildCommand: project2.site?.buildCommand,
257025
+ appId: app.id
257026
+ });
257027
+ return {
257028
+ outroMessage: `Site built with app id ${theme.styles.bold(app.id)}`
257029
+ };
257030
+ }
257031
+ function getBuildCommand() {
257032
+ return new Base44Command("build").description("Build the site with the Base44 app id injected").action(buildAction);
257033
+ }
257034
+
257304
257035
  // src/cli/commands/project/create.ts
257305
- import { basename as basename4, resolve as resolve10 } from "node:path";
257036
+ import { basename as basename4, resolve as resolve9 } from "node:path";
257306
257037
  var import_kebabCase = __toESM(require_kebabCase(), 1);
257307
257038
 
257308
257039
  // src/cli/commands/project/scaffold-shared.ts
@@ -257323,7 +257054,7 @@ async function completeProjectSetup({
257323
257054
  projectId,
257324
257055
  name: name2,
257325
257056
  resolvedPath,
257326
- deploy: deploy6,
257057
+ deploy: deploy5,
257327
257058
  skills,
257328
257059
  isInteractive
257329
257060
  }, { runTask: runTask2 }) {
@@ -257337,7 +257068,7 @@ async function completeProjectSetup({
257337
257068
  });
257338
257069
  shouldPushEntities = !Ct(result) && result;
257339
257070
  } else {
257340
- shouldPushEntities = !!deploy6;
257071
+ shouldPushEntities = !!deploy5;
257341
257072
  }
257342
257073
  if (shouldPushEntities) {
257343
257074
  await runTask2(`Pushing ${entities.length} data models to Base44...`, async () => {
@@ -257357,7 +257088,7 @@ async function completeProjectSetup({
257357
257088
  });
257358
257089
  shouldDeploy = !Ct(result) && result;
257359
257090
  } else {
257360
- shouldDeploy = !!deploy6;
257091
+ shouldDeploy = !!deploy5;
257361
257092
  }
257362
257093
  if (shouldDeploy && installCommand && buildCommand && outputDirectory) {
257363
257094
  const { appUrl } = await runTask2("Installing dependencies...", async (updateMessage) => {
@@ -257494,7 +257225,7 @@ async function createInteractive(options, ctx) {
257494
257225
  }, ctx);
257495
257226
  }
257496
257227
  async function createNonInteractive(options, ctx) {
257497
- ctx.log.info(`Creating a new project at ${resolve10(options.path)}`);
257228
+ ctx.log.info(`Creating a new project at ${resolve9(options.path)}`);
257498
257229
  const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
257499
257230
  return await executeCreate({
257500
257231
  template: template2,
@@ -257511,14 +257242,14 @@ async function executeCreate({
257511
257242
  name: rawName,
257512
257243
  description,
257513
257244
  projectPath,
257514
- deploy: deploy6,
257245
+ deploy: deploy5,
257515
257246
  skills,
257516
257247
  workspaceId: flagWorkspaceId,
257517
257248
  isInteractive
257518
257249
  }, ctx) {
257519
257250
  const { log, runTask: runTask2 } = ctx;
257520
257251
  const name2 = rawName.trim();
257521
- const resolvedPath = resolve10(projectPath);
257252
+ const resolvedPath = resolve9(projectPath);
257522
257253
  const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
257523
257254
  const { projectId } = await runTask2("Setting up your project...", async () => {
257524
257255
  return await createProjectFiles({
@@ -257533,7 +257264,7 @@ async function executeCreate({
257533
257264
  errorMessage: "Failed to create project"
257534
257265
  });
257535
257266
  setAppContext({ id: projectId, projectRoot: resolvedPath });
257536
- const summary = await completeProjectSetup({ projectId, name: name2, resolvedPath, deploy: deploy6, skills, isInteractive }, ctx);
257267
+ const summary = await completeProjectSetup({ projectId, name: name2, resolvedPath, deploy: deploy5, skills, isInteractive }, ctx);
257537
257268
  printProjectSummary(summary, log);
257538
257269
  return { outroMessage: "Your project is set up and ready to use" };
257539
257270
  }
@@ -257568,21 +257299,64 @@ Examples:
257568
257299
  $ base44 create my-app --workspace 507f1f77bcf86cd799439011 Creates a base44 project in the given workspace`).hook("preAction", validateCreateOptions).action(createAction);
257569
257300
  }
257570
257301
 
257302
+ // src/cli/commands/site/run-app-deploy.ts
257303
+ var TASK_LABELS = {
257304
+ "static-deployment": {
257305
+ start: "Deploying site...",
257306
+ success: "Site deployed",
257307
+ error: "Site deploy failed"
257308
+ },
257309
+ static: {
257310
+ start: "Creating archive and deploying site...",
257311
+ success: "Site deployed successfully",
257312
+ error: "Deployment failed"
257313
+ }
257314
+ };
257315
+ async function runAppSiteDeploy({ runTask: runTask2, log }, target, options = {}) {
257316
+ const kind = await detectAppDeployKind(target);
257317
+ if (kind === "none")
257318
+ return { kind: "none" };
257319
+ const labels = TASK_LABELS[kind];
257320
+ const progressLines = [];
257321
+ const warnings = [];
257322
+ const result = await runTask2(labels.start, async (updateMessage) => await deployAppSite(target, {
257323
+ gitHash: options.gitHash,
257324
+ progress: {
257325
+ onWarning: (message) => {
257326
+ warnings.push(message);
257327
+ },
257328
+ onAssets: ({ totalAssets, newAssets }) => {
257329
+ const line = `Found ${totalAssets} static assets (${newAssets} new)`;
257330
+ progressLines.push(line);
257331
+ updateMessage(line);
257332
+ },
257333
+ onAssetUpload: ({ uploadedFiles, totalFiles }) => {
257334
+ updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
257335
+ }
257336
+ }
257337
+ }), {
257338
+ successMessage: labels.success,
257339
+ errorMessage: labels.error
257340
+ });
257341
+ for (const line of progressLines) {
257342
+ log.message(theme.styles.dim(line));
257343
+ }
257344
+ for (const warning of warnings) {
257345
+ log.warn(warning);
257346
+ }
257347
+ return result;
257348
+ }
257349
+
257571
257350
  // src/cli/commands/project/deploy.ts
257572
- import { resolve as resolve11 } from "node:path";
257573
257351
  async function deployAction(ctx, options = {}) {
257574
257352
  const { isNonInteractive, log } = ctx;
257575
257353
  if (isNonInteractive && !options.yes) {
257576
257354
  throw new InvalidInputError("--yes is required in non-interactive mode");
257577
257355
  }
257578
- if (options.build && options.prebuilt) {
257579
- throw new InvalidInputError("--build and --prebuilt cannot be combined.");
257580
- }
257581
257356
  const projectData = await readProjectConfig(options.projectRoot);
257582
257357
  const { project: project2, entities, functions, agents, connectors, authConfig } = projectData;
257583
- let fullStackArtifact = await detectFullStackArtifact(project2.root);
257584
- const isFullStackCandidate = fullStackArtifact !== null || Boolean(project2.site?.buildCommand);
257585
- if (!hasResourcesToDeploy(projectData) && !isFullStackCandidate) {
257358
+ const plannedSite = await detectAppDeployKind(project2);
257359
+ if (!hasResourcesToDeploy(projectData) && plannedSite === "none") {
257586
257360
  return {
257587
257361
  outroMessage: "No resources found to deploy"
257588
257362
  };
@@ -257606,9 +257380,7 @@ async function deployAction(ctx, options = {}) {
257606
257380
  if (project2.visibility) {
257607
257381
  summaryLines.push(` - Visibility: ${project2.visibility}`);
257608
257382
  }
257609
- if (fullStackArtifact) {
257610
- summaryLines.push(" - Full-stack app");
257611
- } else if (project2.site?.outputDirectory) {
257383
+ if (project2.site?.outputDirectory) {
257612
257384
  summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
257613
257385
  }
257614
257386
  if (!options.yes) {
@@ -257626,6 +257398,7 @@ ${summaryLines.join(`
257626
257398
  ${summaryLines.join(`
257627
257399
  `)}`);
257628
257400
  }
257401
+ await maybeBuildBeforeDeploy(ctx, project2, options.build);
257629
257402
  let functionCompleted = 0;
257630
257403
  const functionTotal = functions.length;
257631
257404
  const result = await deployAll(projectData, {
@@ -257642,20 +257415,9 @@ ${summaryLines.join(`
257642
257415
  formatDeployResult(r, log);
257643
257416
  }
257644
257417
  });
257645
- await buildSiteIfNeeded(ctx, projectData, options, fullStackArtifact);
257646
- fullStackArtifact = await detectFullStackArtifact(project2.root);
257647
- let appUrl;
257648
- let fullStackResult;
257649
- if (fullStackArtifact) {
257650
- fullStackResult = await runFullStackDeploy(ctx, project2.root, options);
257651
- } else if (project2.site?.outputDirectory) {
257652
- const outputDir = resolve11(project2.root, project2.site.outputDirectory);
257653
- if (staticWorkersEnabled()) {
257654
- fullStackResult = await runFullStackDeploy(ctx, project2.root, options, outputDir);
257655
- } else {
257656
- ({ appUrl } = await deploySite(outputDir));
257657
- }
257658
- }
257418
+ const siteResult = await runAppSiteDeploy(ctx, project2, {
257419
+ gitHash: options.gitHash
257420
+ });
257659
257421
  const connectorResults = result.connectorResults ?? [];
257660
257422
  await handleOAuthConnectors(connectorResults, isNonInteractive, options, log);
257661
257423
  const stripeResult = connectorResults.find((r) => r.type === "stripe");
@@ -257663,83 +257425,27 @@ ${summaryLines.join(`
257663
257425
  printStripeResult(stripeResult, log);
257664
257426
  }
257665
257427
  log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
257666
- if (appUrl) {
257667
- log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(appUrl)}`);
257428
+ if (siteResult.kind === "static") {
257429
+ log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(siteResult.appUrl)}`);
257668
257430
  }
257669
- if (fullStackResult) {
257670
- printFullStackSummary(fullStackResult, log);
257431
+ const deployment = siteResult.kind === "static-deployment" ? siteResult : undefined;
257432
+ if (deployment) {
257433
+ printDeploymentSummary(deployment, log);
257671
257434
  }
257672
257435
  return {
257673
257436
  outroMessage: "App deployed successfully",
257674
- stdout: ctx.jsonMode && fullStackResult ? `${JSON.stringify({
257675
- deploymentId: fullStackResult.deploymentId,
257676
- gitHash: fullStackResult.gitHash
257437
+ stdout: ctx.jsonMode && deployment ? `${JSON.stringify({
257438
+ deploymentId: deployment.deploymentId,
257439
+ gitHash: deployment.gitHash
257677
257440
  }, null, 2)}
257678
257441
  ` : undefined
257679
257442
  };
257680
257443
  }
257681
- async function buildSiteIfNeeded({ runTask: runTask2 }, { project: project2 }, options, fullStackArtifact) {
257682
- const site2 = project2.site;
257683
- if (!site2?.buildCommand || options.prebuilt)
257684
- return;
257685
- const artifactPresent = fullStackArtifact !== null || (site2.outputDirectory ? await pathExists(resolve11(project2.root, site2.outputDirectory)) : false);
257686
- if (artifactPresent && !options.build)
257687
- return;
257688
- const { installCommand, buildCommand } = site2;
257689
- await runTask2(installCommand ? "Installing dependencies..." : "Building project...", async (updateMessage) => {
257690
- if (installCommand) {
257691
- await execa({ cwd: project2.root, shell: true })`${installCommand}`;
257692
- updateMessage("Building project...");
257693
- }
257694
- await execa({ cwd: project2.root, shell: true })`${buildCommand}`;
257695
- }, {
257696
- successMessage: "Project built successfully",
257697
- errorMessage: "Failed to build project"
257698
- });
257699
- }
257700
- async function runFullStackDeploy({ runTask: runTask2, log }, projectRoot, options, staticOutputDir) {
257701
- const gitHash = await resolveGitHash(projectRoot, options.gitHash);
257702
- const progressLines = [];
257703
- const warnings = [];
257704
- const deployment = await runTask2(staticOutputDir ? "Deploying site to Workers..." : "Deploying full-stack app...", async (updateMessage) => {
257705
- const progress = {
257706
- onWarning: (message) => {
257707
- warnings.push(message);
257708
- },
257709
- onAssets: ({ totalAssets, newAssets }) => {
257710
- const line = `Found ${totalAssets} static assets (${newAssets} new)`;
257711
- progressLines.push(line);
257712
- updateMessage(line);
257713
- },
257714
- onAssetUpload: ({ uploadedFiles, totalFiles }) => {
257715
- updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
257716
- },
257717
- onWorker: ({ moduleCount }) => {
257718
- updateMessage(`Deploying worker (${moduleCount} modules)…`);
257719
- }
257720
- };
257721
- return staticOutputDir ? await deployStaticSite({
257722
- outputDir: staticOutputDir,
257723
- gitHash,
257724
- progress
257725
- }) : await deployFullStack({ projectRoot, gitHash, progress });
257726
- }, {
257727
- successMessage: theme.colors.base44Orange(staticOutputDir ? "Site deployed to Workers" : "Full-stack app deployed"),
257728
- errorMessage: staticOutputDir ? "Site deploy failed" : "Full-stack deploy failed"
257729
- });
257730
- for (const line of progressLines) {
257731
- log.message(theme.styles.dim(line));
257732
- }
257733
- for (const warning of warnings) {
257734
- log.warn(warning);
257735
- }
257736
- return deployment;
257737
- }
257738
- function printFullStackSummary(deployment, log) {
257444
+ function printDeploymentSummary(deployment, log) {
257739
257445
  log.message(`${theme.styles.header("Deployment")}: ${deployment.deploymentId} ${theme.styles.dim(`(commit ${deployment.gitHash.slice(0, 12)})`)}`);
257740
257446
  }
257741
257447
  function getDeployCommand2() {
257742
- return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").option("--git-hash <hash>", "Commit the full-stack build came from (defaults to the checkout's HEAD)").option("--build", "Run the configured install/build commands before deploying, even when a build artifact already exists").option("--prebuilt", "Skip the build step and deploy the existing artifact").action(deployAction);
257448
+ return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").option("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").action(deployAction);
257743
257449
  }
257744
257450
  async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
257745
257451
  const needsOAuth = filterPendingOAuth(connectorResults);
@@ -258017,7 +257723,7 @@ async function followLogs(functionNames, options, availableFunctionNames, jsonMo
258017
257723
  for (const entry of fresh)
258018
257724
  writeFollowLine(entry, jsonMode);
258019
257725
  first = false;
258020
- await new Promise((resolve12) => setTimeout(resolve12, 2000));
257726
+ await new Promise((resolve10) => setTimeout(resolve10, 2000));
258021
257727
  }
258022
257728
  }
258023
257729
  function formatLogs(entries, env3) {
@@ -258131,7 +257837,7 @@ function getLogsCommand() {
258131
257837
  }
258132
257838
 
258133
257839
  // src/cli/commands/project/scaffold.ts
258134
- import { basename as basename5, resolve as resolve12 } from "node:path";
257840
+ import { basename as basename5, resolve as resolve10 } from "node:path";
258135
257841
  function resolveAppId(options) {
258136
257842
  const appId = options.appId;
258137
257843
  if (!appId) {
@@ -258147,7 +257853,7 @@ function resolveAppId(options) {
258147
257853
  async function scaffoldAction(ctx, name2, options, command2) {
258148
257854
  const { log, runTask: runTask2 } = ctx;
258149
257855
  const appId = resolveAppId(command2.optsWithGlobals());
258150
- const resolvedPath = resolve12("./");
257856
+ const resolvedPath = resolve10("./");
258151
257857
  const projectName = (name2 ?? basename5(resolvedPath)).trim();
258152
257858
  const template2 = await getTemplateById("backend-only");
258153
257859
  log.info(`Scaffolding project at ${resolvedPath}`);
@@ -258544,7 +258250,7 @@ function getSecretsListCommand() {
258544
258250
  }
258545
258251
 
258546
258252
  // src/cli/commands/secrets/set.ts
258547
- import { resolve as resolve13 } from "node:path";
258253
+ import { resolve as resolve11 } from "node:path";
258548
258254
  function parseEntries(entries) {
258549
258255
  const secrets = {};
258550
258256
  for (const entry of entries) {
@@ -258575,7 +258281,7 @@ async function setSecretsAction({ log, runTask: runTask2 }, entries, options) {
258575
258281
  validateInput(entries, options);
258576
258282
  let secrets;
258577
258283
  if (options.envFile) {
258578
- secrets = await parseEnvFile(resolve13(options.envFile));
258284
+ secrets = await parseEnvFile(resolve11(options.envFile));
258579
258285
  if (Object.keys(secrets).length === 0) {
258580
258286
  throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
258581
258287
  }
@@ -258604,13 +258310,14 @@ function getSecretsCommand() {
258604
258310
  }
258605
258311
 
258606
258312
  // src/cli/commands/site/deploy.ts
258607
- import { resolve as resolve14 } from "node:path";
258608
- async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
258313
+ async function deployAction2(ctx, options) {
258314
+ const { isNonInteractive } = ctx;
258609
258315
  if (isNonInteractive && !options.yes) {
258610
258316
  throw new InvalidInputError("--yes is required in non-interactive mode");
258611
258317
  }
258612
258318
  const { project: project2 } = await readProjectConfig();
258613
- if (!project2.site?.outputDirectory) {
258319
+ const kind = await detectAppDeployKind(project2);
258320
+ if (kind === "none") {
258614
258321
  throw new ConfigNotFoundError("No site configuration found.", {
258615
258322
  hints: [
258616
258323
  {
@@ -258619,25 +258326,32 @@ async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
258619
258326
  ]
258620
258327
  });
258621
258328
  }
258622
- const outputDir = resolve14(project2.root, project2.site.outputDirectory);
258623
258329
  if (!options.yes) {
258624
258330
  const shouldDeploy = await Re({
258625
- message: `Deploy site from ${project2.site.outputDirectory}?`
258331
+ message: `Deploy site from ${project2.site?.outputDirectory}?`
258626
258332
  });
258627
258333
  if (Ct(shouldDeploy) || !shouldDeploy) {
258628
258334
  return { outroMessage: "Deployment cancelled" };
258629
258335
  }
258630
258336
  }
258631
- const result = await runTask2("Creating archive and deploying site...", async () => {
258632
- return await deploySite(outputDir);
258633
- }, {
258634
- successMessage: "Site deployed successfully",
258635
- errorMessage: "Deployment failed"
258337
+ await maybeBuildBeforeDeploy(ctx, project2, options.build);
258338
+ const result = await runAppSiteDeploy(ctx, project2, {
258339
+ gitHash: options.gitHash
258636
258340
  });
258637
- return { outroMessage: `Visit your site at: ${result.appUrl}` };
258341
+ if (result.kind === "static-deployment") {
258342
+ return {
258343
+ outroMessage: `Deployment ${result.deploymentId} (commit ${result.gitHash.slice(0, 12)})`,
258344
+ stdout: ctx.jsonMode ? `${JSON.stringify({ deploymentId: result.deploymentId, gitHash: result.gitHash }, null, 2)}
258345
+ ` : undefined
258346
+ };
258347
+ }
258348
+ if (result.kind === "static") {
258349
+ return { outroMessage: `Visit your site at: ${result.appUrl}` };
258350
+ }
258351
+ return { outroMessage: "Nothing to deploy" };
258638
258352
  }
258639
258353
  function getSiteDeployCommand() {
258640
- return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(deployAction2);
258354
+ return new Base44Command("deploy").description("Deploy the built site to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").action(deployAction2);
258641
258355
  }
258642
258356
 
258643
258357
  // src/cli/commands/site/open.ts
@@ -258982,7 +258696,7 @@ function createDevLogger(label2, labelColor = theme.styles.dim) {
258982
258696
  // src/cli/dev/dev-server/main.ts
258983
258697
  var import_cors = __toESM(require_lib4(), 1);
258984
258698
  var import_express6 = __toESM(require_express(), 1);
258985
- import { dirname as dirname24, join as join35 } from "node:path";
258699
+ import { dirname as dirname23, join as join35 } from "node:path";
258986
258700
 
258987
258701
  // ../../node_modules/get-port/index.js
258988
258702
  import net from "node:net";
@@ -259009,14 +258723,14 @@ var getLocalHosts = () => {
259009
258723
  }
259010
258724
  return results;
259011
258725
  };
259012
- var checkAvailablePort = (options8) => new Promise((resolve16, reject) => {
258726
+ var checkAvailablePort = (options8) => new Promise((resolve13, reject) => {
259013
258727
  const server = net.createServer();
259014
258728
  server.unref();
259015
258729
  server.on("error", reject);
259016
258730
  server.listen(options8, () => {
259017
258731
  const { port } = server.address();
259018
258732
  server.close(() => {
259019
- resolve16(port);
258733
+ resolve13(port);
259020
258734
  });
259021
258735
  });
259022
258736
  });
@@ -259117,7 +258831,7 @@ var $setGracefulCleanup = tmp.setGracefulCleanup;
259117
258831
 
259118
258832
  // src/cli/dev/dev-server/function-manager.ts
259119
258833
  import { spawn as spawn2 } from "node:child_process";
259120
- import { dirname as dirname21, join as join29 } from "node:path";
258834
+ import { dirname as dirname20, join as join29 } from "node:path";
259121
258835
  import { pathToFileURL } from "node:url";
259122
258836
 
259123
258837
  // src/cli/dev/dev-server/base-function-manager.ts
@@ -259222,7 +258936,7 @@ class FunctionManager extends BaseFunctionManager {
259222
258936
  }
259223
258937
  spawnFunction(func, port) {
259224
258938
  this.logger.log(`Spawning function "${func.name}" on port ${port}`);
259225
- const importMapPath = join29(dirname21(this.wrapperPath), "import-map.json");
258939
+ const importMapPath = join29(dirname20(this.wrapperPath), "import-map.json");
259226
258940
  const process23 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
259227
258941
  env: {
259228
258942
  ...globalThis.process.env,
@@ -259261,7 +258975,7 @@ class FunctionManager extends BaseFunctionManager {
259261
258975
  });
259262
258976
  }
259263
258977
  waitForReady(name2, runningFunc) {
259264
- return new Promise((resolve16, reject) => {
258978
+ return new Promise((resolve13, reject) => {
259265
258979
  runningFunc.process.on("exit", (code2) => {
259266
258980
  if (!runningFunc.ready) {
259267
258981
  clearTimeout(timeout3);
@@ -259284,7 +258998,7 @@ class FunctionManager extends BaseFunctionManager {
259284
258998
  runningFunc.ready = true;
259285
258999
  clearTimeout(timeout3);
259286
259000
  runningFunc.process.stdout?.off("data", onData);
259287
- resolve16(runningFunc.port);
259001
+ resolve13(runningFunc.port);
259288
259002
  }
259289
259003
  };
259290
259004
  runningFunc.process.stdout?.on("data", onData);
@@ -260870,16 +260584,16 @@ function createCustomIntegrationRoutes(remoteProxy, logger2) {
260870
260584
 
260871
260585
  // src/cli/dev/dev-server/watcher.ts
260872
260586
  import { EventEmitter as EventEmitter4 } from "node:events";
260873
- import { relative as relative7 } from "node:path";
260587
+ import { relative as relative6 } from "node:path";
260874
260588
 
260875
260589
  // ../../node_modules/chokidar/index.js
260876
260590
  import { EventEmitter as EventEmitter3 } from "node:events";
260877
260591
  import { stat as statcb, Stats } from "node:fs";
260878
- import { readdir as readdir4, stat as stat6 } from "node:fs/promises";
260592
+ import { readdir as readdir4, stat as stat5 } from "node:fs/promises";
260879
260593
  import * as sp3 from "node:path";
260880
260594
 
260881
260595
  // ../../node_modules/readdirp/index.js
260882
- import { lstat as lstat2, readdir as readdir3, realpath, stat as stat4 } from "node:fs/promises";
260596
+ import { lstat as lstat2, readdir as readdir3, realpath, stat as stat3 } from "node:fs/promises";
260883
260597
  import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
260884
260598
  import { Readable as Readable6 } from "node:stream";
260885
260599
  var EntryTypes = {
@@ -260961,7 +260675,7 @@ class ReaddirpStream extends Readable6 {
260961
260675
  const { root: root2, type } = opts;
260962
260676
  this._fileFilter = normalizeFilter(opts.fileFilter);
260963
260677
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
260964
- const statMethod = opts.lstat ? lstat2 : stat4;
260678
+ const statMethod = opts.lstat ? lstat2 : stat3;
260965
260679
  if (wantBigintFsStats) {
260966
260680
  this._stat = (path19) => statMethod(path19, { bigint: true });
260967
260681
  } else {
@@ -261114,7 +260828,7 @@ function readdirp(root2, options8 = {}) {
261114
260828
 
261115
260829
  // ../../node_modules/chokidar/handler.js
261116
260830
  import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
261117
- import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat5 } from "node:fs/promises";
260831
+ import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat4 } from "node:fs/promises";
261118
260832
  import { type as osType } from "node:os";
261119
260833
  import * as sp2 from "node:path";
261120
260834
  var STR_DATA = "data";
@@ -261140,7 +260854,7 @@ var EVENTS = {
261140
260854
  };
261141
260855
  var EV = EVENTS;
261142
260856
  var THROTTLE_MODE_WATCH = "watch";
261143
- var statMethods = { lstat: lstat3, stat: stat5 };
260857
+ var statMethods = { lstat: lstat3, stat: stat4 };
261144
260858
  var KEY_LISTENERS = "listeners";
261145
260859
  var KEY_ERR = "errHandlers";
261146
260860
  var KEY_RAW = "rawEmitters";
@@ -261600,9 +261314,9 @@ class NodeFsHandler {
261600
261314
  if (this.fsw.closed) {
261601
261315
  return;
261602
261316
  }
261603
- const dirname23 = sp2.dirname(file2);
261317
+ const dirname22 = sp2.dirname(file2);
261604
261318
  const basename7 = sp2.basename(file2);
261605
- const parent = this.fsw._getWatchedDir(dirname23);
261319
+ const parent = this.fsw._getWatchedDir(dirname22);
261606
261320
  let prevStats = stats;
261607
261321
  if (parent.has(basename7))
261608
261322
  return;
@@ -261611,7 +261325,7 @@ class NodeFsHandler {
261611
261325
  return;
261612
261326
  if (!newStats || newStats.mtimeMs === 0) {
261613
261327
  try {
261614
- const newStats2 = await stat5(file2);
261328
+ const newStats2 = await stat4(file2);
261615
261329
  if (this.fsw.closed)
261616
261330
  return;
261617
261331
  const at13 = newStats2.atimeMs;
@@ -261629,7 +261343,7 @@ class NodeFsHandler {
261629
261343
  prevStats = newStats2;
261630
261344
  }
261631
261345
  } catch (error48) {
261632
- this.fsw._remove(dirname23, basename7);
261346
+ this.fsw._remove(dirname22, basename7);
261633
261347
  }
261634
261348
  } else if (parent.has(basename7)) {
261635
261349
  const at13 = newStats.atimeMs;
@@ -261718,7 +261432,7 @@ class NodeFsHandler {
261718
261432
  this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
261719
261433
  }
261720
261434
  }).on(EV.ERROR, this._boundHandleError);
261721
- return new Promise((resolve17, reject) => {
261435
+ return new Promise((resolve14, reject) => {
261722
261436
  if (!stream)
261723
261437
  return reject();
261724
261438
  stream.once(STR_END, () => {
@@ -261727,7 +261441,7 @@ class NodeFsHandler {
261727
261441
  return;
261728
261442
  }
261729
261443
  const wasThrottled = throttler ? throttler.clear() : false;
261730
- resolve17(undefined);
261444
+ resolve14(undefined);
261731
261445
  previous.getChildren().filter((item) => {
261732
261446
  return item !== directory && !current.has(item);
261733
261447
  }).forEach((item) => {
@@ -261852,11 +261566,11 @@ function createPattern(matcher) {
261852
261566
  if (matcher.path === string4)
261853
261567
  return true;
261854
261568
  if (matcher.recursive) {
261855
- const relative7 = sp3.relative(matcher.path, string4);
261856
- if (!relative7) {
261569
+ const relative6 = sp3.relative(matcher.path, string4);
261570
+ if (!relative6) {
261857
261571
  return false;
261858
261572
  }
261859
- return !relative7.startsWith("..") && !sp3.isAbsolute(relative7);
261573
+ return !relative6.startsWith("..") && !sp3.isAbsolute(relative6);
261860
261574
  }
261861
261575
  return false;
261862
261576
  };
@@ -262283,7 +261997,7 @@ class FSWatcher extends EventEmitter3 {
262283
261997
  const fullPath = opts.cwd ? sp3.join(opts.cwd, path19) : path19;
262284
261998
  let stats2;
262285
261999
  try {
262286
- stats2 = await stat6(fullPath);
262000
+ stats2 = await stat5(fullPath);
262287
262001
  } catch (err) {}
262288
262002
  if (!stats2 || this.closed)
262289
262003
  return;
@@ -262387,8 +262101,8 @@ class FSWatcher extends EventEmitter3 {
262387
262101
  }
262388
262102
  return this._userIgnored(path19, stats);
262389
262103
  }
262390
- _isntIgnored(path19, stat7) {
262391
- return !this._isIgnored(path19, stat7);
262104
+ _isntIgnored(path19, stat6) {
262105
+ return !this._isIgnored(path19, stat6);
262392
262106
  }
262393
262107
  _getWatchHelpers(path19) {
262394
262108
  return new WatchHelper(path19, this.options.followSymlinks, this);
@@ -262555,7 +262269,7 @@ class WatchBase44 extends EventEmitter4 {
262555
262269
  ignoreInitial: true
262556
262270
  });
262557
262271
  watcher.on("all", import_debounce.default(async (_event, path19) => {
262558
- this.emit("change", name2, relative7(targetPath, path19));
262272
+ this.emit("change", name2, relative6(targetPath, path19));
262559
262273
  }, WATCH_DEBOUNCE_MS));
262560
262274
  watcher.on("error", (err) => {
262561
262275
  this.logger.error(`Watch handler failed for ${targetPath}`, err);
@@ -262644,7 +262358,7 @@ async function createDevServer(options8) {
262644
262358
  }
262645
262359
  remoteProxy(req, res, next);
262646
262360
  });
262647
- const server = await new Promise((resolve18, reject) => {
262361
+ const server = await new Promise((resolve15, reject) => {
262648
262362
  const s5 = app.listen(port, "127.0.0.1", (err) => {
262649
262363
  if (err) {
262650
262364
  if ("code" in err && err.code === "EADDRINUSE") {
@@ -262653,7 +262367,7 @@ async function createDevServer(options8) {
262653
262367
  reject(err);
262654
262368
  }
262655
262369
  } else {
262656
- resolve18(s5);
262370
+ resolve15(s5);
262657
262371
  }
262658
262372
  });
262659
262373
  });
@@ -262662,8 +262376,8 @@ async function createDevServer(options8) {
262662
262376
  broadcastEntityEvent(io6, appId, entityName, event);
262663
262377
  };
262664
262378
  const base44ConfigWatcher = new WatchBase44({
262665
- functions: join35(dirname24(project2.configPath), project2.functionsDir),
262666
- entities: join35(dirname24(project2.configPath), project2.entitiesDir)
262379
+ functions: join35(dirname23(project2.configPath), project2.functionsDir),
262380
+ entities: join35(dirname23(project2.configPath), project2.entitiesDir)
262667
262381
  }, devLogger);
262668
262382
  base44ConfigWatcher.on("change", async (name2) => {
262669
262383
  try {
@@ -262703,13 +262417,13 @@ async function createDevServer(options8) {
262703
262417
  if (!server.listening) {
262704
262418
  return;
262705
262419
  }
262706
- await new Promise((resolve18, reject) => {
262420
+ await new Promise((resolve15, reject) => {
262707
262421
  server.close((error48) => {
262708
262422
  if (error48) {
262709
262423
  reject(error48);
262710
262424
  return;
262711
262425
  }
262712
- resolve18();
262426
+ resolve15();
262713
262427
  });
262714
262428
  });
262715
262429
  };
@@ -262780,15 +262494,15 @@ class ServeRunner {
262780
262494
  return;
262781
262495
  }
262782
262496
  this.stopping = true;
262783
- const exited = new Promise((resolve18) => child.once("exit", () => resolve18()));
262497
+ const exited = new Promise((resolve15) => child.once("exit", () => resolve15()));
262784
262498
  if (process23.platform === "win32" && child.pid) {
262785
262499
  const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
262786
262500
  stdio: "ignore",
262787
262501
  windowsHide: true
262788
262502
  });
262789
- await new Promise((resolve18) => {
262790
- taskkill.once("exit", () => resolve18());
262791
- taskkill.once("error", () => resolve18());
262503
+ await new Promise((resolve15) => {
262504
+ taskkill.once("exit", () => resolve15());
262505
+ taskkill.once("error", () => resolve15());
262792
262506
  });
262793
262507
  } else if (child.pid) {
262794
262508
  try {
@@ -262958,13 +262672,13 @@ async function runScript(options8) {
262958
262672
  }
262959
262673
  // src/cli/commands/exec.ts
262960
262674
  function readStdin2() {
262961
- return new Promise((resolve18, reject) => {
262675
+ return new Promise((resolve15, reject) => {
262962
262676
  let data = "";
262963
262677
  process.stdin.setEncoding("utf-8");
262964
262678
  process.stdin.on("data", (chunk) => {
262965
262679
  data += chunk;
262966
262680
  });
262967
- process.stdin.on("end", () => resolve18(data));
262681
+ process.stdin.on("end", () => resolve15(data));
262968
262682
  process.stdin.on("error", reject);
262969
262683
  });
262970
262684
  }
@@ -263035,7 +262749,7 @@ Examples:
263035
262749
  }
263036
262750
 
263037
262751
  // src/cli/commands/project/eject.ts
263038
- import { resolve as resolve18 } from "node:path";
262752
+ import { resolve as resolve15 } from "node:path";
263039
262753
  var import_kebabCase2 = __toESM(require_kebabCase(), 1);
263040
262754
  async function eject(ctx, options8, command2) {
263041
262755
  const { log, runTask: runTask2, isNonInteractive } = ctx;
@@ -263099,7 +262813,7 @@ async function eject(ctx, options8, command2) {
263099
262813
  Ne("Operation cancelled.");
263100
262814
  throw new CLIExitError(0);
263101
262815
  }
263102
- const resolvedPath = resolve18(selectedPath);
262816
+ const resolvedPath = resolve15(selectedPath);
263103
262817
  await runTask2("Downloading your project's code...", async (updateMessage) => {
263104
262818
  await createProjectFilesForExistingProject({
263105
262819
  projectId,
@@ -263132,7 +262846,11 @@ async function eject(ctx, options8, command2) {
263132
262846
  successMessage: theme.colors.base44Orange("Project built successfully"),
263133
262847
  errorMessage: "Failed to build project"
263134
262848
  });
263135
- await deployAction(ctx, { yes: true, projectRoot: resolvedPath });
262849
+ await deployAction(ctx, {
262850
+ yes: true,
262851
+ build: false,
262852
+ projectRoot: resolvedPath
262853
+ });
263136
262854
  }
263137
262855
  }
263138
262856
  return { outroMessage: "Your new project is set and ready to use" };
@@ -263161,6 +262879,7 @@ function createProgram(context) {
263161
262879
  program2.addCommand(getCreateCommand());
263162
262880
  program2.addCommand(getScaffoldCommand());
263163
262881
  program2.addCommand(getDashboardCommand());
262882
+ program2.addCommand(getBuildCommand());
263164
262883
  program2.addCommand(getDeployCommand2());
263165
262884
  program2.addCommand(getVisibilityCommand());
263166
262885
  program2.addCommand(getLinkCommand());
@@ -263187,7 +262906,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
263187
262906
  import { release, type } from "node:os";
263188
262907
 
263189
262908
  // ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
263190
- import { dirname as dirname25, posix, sep as sep2 } from "path";
262909
+ import { dirname as dirname24, posix, sep } from "path";
263191
262910
  function createModulerModifier() {
263192
262911
  const getModuleFromFileName = createGetModuleFromFilename();
263193
262912
  return async (frames) => {
@@ -263196,7 +262915,7 @@ function createModulerModifier() {
263196
262915
  return frames;
263197
262916
  };
263198
262917
  }
263199
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname25(process.argv[1]) : process.cwd(), isWindows5 = sep2 === "\\") {
262918
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname24(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
263200
262919
  const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
263201
262920
  return (filename) => {
263202
262921
  if (!filename)
@@ -265474,14 +265193,14 @@ async function addSourceContext(frames) {
265474
265193
  return frames;
265475
265194
  }
265476
265195
  function getContextLinesFromFile(path19, ranges, output) {
265477
- return new Promise((resolve19) => {
265196
+ return new Promise((resolve16) => {
265478
265197
  const stream = createReadStream2(path19);
265479
265198
  const lineReaded = createInterface2({
265480
265199
  input: stream
265481
265200
  });
265482
265201
  function destroyStreamAndResolve() {
265483
265202
  stream.destroy();
265484
- resolve19();
265203
+ resolve16();
265485
265204
  }
265486
265205
  let lineNumber = 0;
265487
265206
  let currentRangeIndex = 0;
@@ -266593,15 +266312,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
266593
266312
  return true;
266594
266313
  if (this.featureFlagsPoller === undefined)
266595
266314
  return false;
266596
- return new Promise((resolve19) => {
266315
+ return new Promise((resolve16) => {
266597
266316
  const timeout3 = setTimeout(() => {
266598
266317
  cleanup();
266599
- resolve19(false);
266318
+ resolve16(false);
266600
266319
  }, timeoutMs);
266601
266320
  const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
266602
266321
  clearTimeout(timeout3);
266603
266322
  cleanup();
266604
- resolve19(count2 > 0);
266323
+ resolve16(count2 > 0);
266605
266324
  });
266606
266325
  });
266607
266326
  }
@@ -267385,7 +267104,7 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
267385
267104
  });
267386
267105
  }
267387
267106
  // src/cli/index.ts
267388
- var __dirname4 = dirname26(fileURLToPath6(import.meta.url));
267107
+ var __dirname4 = dirname25(fileURLToPath6(import.meta.url));
267389
267108
  async function runCLI(options8) {
267390
267109
  ensureNpmAssets(join36(__dirname4, "../assets"));
267391
267110
  const errorReporter = new ErrorReporter;
@@ -267426,4 +267145,4 @@ export {
267426
267145
  CLIExitError
267427
267146
  };
267428
267147
 
267429
- //# debugId=FFEEAB2F2B84F55664756E2164756E21
267148
+ //# debugId=90CE1A1AA8C5C92664756E2164756E21