base44 0.0.37 → 0.0.38

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
@@ -1,4 +1,4 @@
1
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="019cafc1-f5f3-7db3-bea1-c78b57ef5cd6")}catch(e){}}();import { createRequire } from "node:module";
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="019cbdc7-6e94-7511-a3d1-bbbcfd1b4420")}catch(e){}}();import { createRequire } from "node:module";
2
2
  var __create = Object.create;
3
3
  var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
@@ -8915,10 +8915,10 @@ var require_ejs = __commonJS((exports) => {
8915
8915
  exports.localsName = _DEFAULT_LOCALS_NAME;
8916
8916
  exports.promiseImpl = new Function("return this;")().Promise;
8917
8917
  exports.resolveInclude = function(name2, filename, isDir) {
8918
- var dirname6 = path11.dirname;
8918
+ var dirname7 = path11.dirname;
8919
8919
  var extname = path11.extname;
8920
8920
  var resolve = path11.resolve;
8921
- var includePath = resolve(isDir ? filename : dirname6(filename), name2);
8921
+ var includePath = resolve(isDir ? filename : dirname7(filename), name2);
8922
8922
  var ext = extname(name2);
8923
8923
  if (!ext) {
8924
8924
  includePath += ".ejs";
@@ -12634,8 +12634,8 @@ var require_main = __commonJS((exports, module) => {
12634
12634
  const shortPaths = [];
12635
12635
  for (const filePath of optionPaths) {
12636
12636
  try {
12637
- const relative = path11.relative(process.cwd(), filePath);
12638
- shortPaths.push(relative);
12637
+ const relative3 = path11.relative(process.cwd(), filePath);
12638
+ shortPaths.push(relative3);
12639
12639
  } catch (e2) {
12640
12640
  if (debug) {
12641
12641
  _debug(`Failed to load ${filePath} ${e2.message}`);
@@ -13193,58 +13193,34 @@ var require_cross_spawn = __commonJS((exports, module) => {
13193
13193
  module.exports._enoent = enoent;
13194
13194
  });
13195
13195
 
13196
- // node_modules/lodash.kebabcase/index.js
13197
- var require_lodash = __commonJS((exports, module) => {
13198
- var INFINITY = 1 / 0;
13199
- var symbolTag = "[object Symbol]";
13200
- var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
13201
- var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
13202
- var rsAstralRange = "\\ud800-\\udfff";
13203
- var rsComboMarksRange = "\\u0300-\\u036f\\ufe20-\\ufe23";
13204
- var rsComboSymbolsRange = "\\u20d0-\\u20f0";
13205
- var rsDingbatRange = "\\u2700-\\u27bf";
13206
- var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
13207
- var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
13208
- var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
13209
- var rsPunctuationRange = "\\u2000-\\u206f";
13210
- var rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000";
13211
- var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
13212
- var rsVarRange = "\\ufe0e\\ufe0f";
13213
- var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
13214
- var rsApos = "['’]";
13215
- var rsBreak = "[" + rsBreakRange + "]";
13216
- var rsCombo = "[" + rsComboMarksRange + rsComboSymbolsRange + "]";
13217
- var rsDigits = "\\d+";
13218
- var rsDingbat = "[" + rsDingbatRange + "]";
13219
- var rsLower = "[" + rsLowerRange + "]";
13220
- var rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
13221
- var rsFitz = "\\ud83c[\\udffb-\\udfff]";
13222
- var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
13223
- var rsNonAstral = "[^" + rsAstralRange + "]";
13224
- var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
13225
- var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
13226
- var rsUpper = "[" + rsUpperRange + "]";
13227
- var rsZWJ = "\\u200d";
13228
- var rsLowerMisc = "(?:" + rsLower + "|" + rsMisc + ")";
13229
- var rsUpperMisc = "(?:" + rsUpper + "|" + rsMisc + ")";
13230
- var rsOptLowerContr = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?";
13231
- var rsOptUpperContr = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?";
13232
- var reOptMod = rsModifier + "?";
13233
- var rsOptVar = "[" + rsVarRange + "]?";
13234
- var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
13235
- var rsSeq = rsOptVar + reOptMod + rsOptJoin;
13236
- var rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq;
13237
- var reApos = RegExp(rsApos, "g");
13238
- var reComboMark = RegExp(rsCombo, "g");
13239
- var reUnicodeWord = RegExp([
13240
- rsUpper + "?" + rsLower + "+" + rsOptLowerContr + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
13241
- rsUpperMisc + "+" + rsOptUpperContr + "(?=" + [rsBreak, rsUpper + rsLowerMisc, "$"].join("|") + ")",
13242
- rsUpper + "?" + rsLowerMisc + "+" + rsOptLowerContr,
13243
- rsUpper + "+" + rsOptUpperContr,
13244
- rsDigits,
13245
- rsEmoji
13246
- ].join("|"), "g");
13247
- var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
13196
+ // node_modules/lodash/_arrayReduce.js
13197
+ var require__arrayReduce = __commonJS((exports, module) => {
13198
+ function arrayReduce(array2, iteratee, accumulator, initAccum) {
13199
+ var index = -1, length = array2 == null ? 0 : array2.length;
13200
+ if (initAccum && length) {
13201
+ accumulator = array2[++index];
13202
+ }
13203
+ while (++index < length) {
13204
+ accumulator = iteratee(accumulator, array2[index], index, array2);
13205
+ }
13206
+ return accumulator;
13207
+ }
13208
+ module.exports = arrayReduce;
13209
+ });
13210
+
13211
+ // node_modules/lodash/_basePropertyOf.js
13212
+ var require__basePropertyOf = __commonJS((exports, module) => {
13213
+ function basePropertyOf(object2) {
13214
+ return function(key) {
13215
+ return object2 == null ? undefined : object2[key];
13216
+ };
13217
+ }
13218
+ module.exports = basePropertyOf;
13219
+ });
13220
+
13221
+ // node_modules/lodash/_deburrLetter.js
13222
+ var require__deburrLetter = __commonJS((exports, module) => {
13223
+ var basePropertyOf = require__basePropertyOf();
13248
13224
  var deburredLetters = {
13249
13225
  "À": "A",
13250
13226
  "Á": "A",
@@ -13435,72 +13411,256 @@ var require_lodash = __commonJS((exports, module) => {
13435
13411
  "Œ": "Oe",
13436
13412
  "œ": "oe",
13437
13413
  "ʼn": "'n",
13438
- "ſ": "ss"
13414
+ "ſ": "s"
13439
13415
  };
13416
+ var deburrLetter = basePropertyOf(deburredLetters);
13417
+ module.exports = deburrLetter;
13418
+ });
13419
+
13420
+ // node_modules/lodash/_freeGlobal.js
13421
+ var require__freeGlobal = __commonJS((exports, module) => {
13440
13422
  var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
13423
+ module.exports = freeGlobal;
13424
+ });
13425
+
13426
+ // node_modules/lodash/_root.js
13427
+ var require__root = __commonJS((exports, module) => {
13428
+ var freeGlobal = require__freeGlobal();
13441
13429
  var freeSelf = typeof self == "object" && self && self.Object === Object && self;
13442
13430
  var root = freeGlobal || freeSelf || Function("return this")();
13443
- function arrayReduce(array2, iteratee, accumulator, initAccum) {
13444
- var index = -1, length = array2 ? array2.length : 0;
13445
- if (initAccum && length) {
13446
- accumulator = array2[++index];
13447
- }
13431
+ module.exports = root;
13432
+ });
13433
+
13434
+ // node_modules/lodash/_Symbol.js
13435
+ var require__Symbol = __commonJS((exports, module) => {
13436
+ var root = require__root();
13437
+ var Symbol2 = root.Symbol;
13438
+ module.exports = Symbol2;
13439
+ });
13440
+
13441
+ // node_modules/lodash/_arrayMap.js
13442
+ var require__arrayMap = __commonJS((exports, module) => {
13443
+ function arrayMap(array2, iteratee) {
13444
+ var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
13448
13445
  while (++index < length) {
13449
- accumulator = iteratee(accumulator, array2[index], index, array2);
13446
+ result[index] = iteratee(array2[index], index, array2);
13450
13447
  }
13451
- return accumulator;
13448
+ return result;
13452
13449
  }
13453
- function asciiWords(string4) {
13454
- return string4.match(reAsciiWord) || [];
13450
+ module.exports = arrayMap;
13451
+ });
13452
+
13453
+ // node_modules/lodash/isArray.js
13454
+ var require_isArray = __commonJS((exports, module) => {
13455
+ var isArray = Array.isArray;
13456
+ module.exports = isArray;
13457
+ });
13458
+
13459
+ // node_modules/lodash/_getRawTag.js
13460
+ var require__getRawTag = __commonJS((exports, module) => {
13461
+ var Symbol2 = require__Symbol();
13462
+ var objectProto = Object.prototype;
13463
+ var hasOwnProperty = objectProto.hasOwnProperty;
13464
+ var nativeObjectToString = objectProto.toString;
13465
+ var symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined;
13466
+ function getRawTag(value) {
13467
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
13468
+ try {
13469
+ value[symToStringTag] = undefined;
13470
+ var unmasked = true;
13471
+ } catch (e2) {}
13472
+ var result = nativeObjectToString.call(value);
13473
+ if (unmasked) {
13474
+ if (isOwn) {
13475
+ value[symToStringTag] = tag;
13476
+ } else {
13477
+ delete value[symToStringTag];
13478
+ }
13479
+ }
13480
+ return result;
13455
13481
  }
13456
- function basePropertyOf(object2) {
13457
- return function(key) {
13458
- return object2 == null ? undefined : object2[key];
13459
- };
13482
+ module.exports = getRawTag;
13483
+ });
13484
+
13485
+ // node_modules/lodash/_objectToString.js
13486
+ var require__objectToString = __commonJS((exports, module) => {
13487
+ var objectProto = Object.prototype;
13488
+ var nativeObjectToString = objectProto.toString;
13489
+ function objectToString3(value) {
13490
+ return nativeObjectToString.call(value);
13460
13491
  }
13461
- var deburrLetter = basePropertyOf(deburredLetters);
13462
- function hasUnicodeWord(string4) {
13463
- return reHasUnicodeWord.test(string4);
13492
+ module.exports = objectToString3;
13493
+ });
13494
+
13495
+ // node_modules/lodash/_baseGetTag.js
13496
+ var require__baseGetTag = __commonJS((exports, module) => {
13497
+ var Symbol2 = require__Symbol();
13498
+ var getRawTag = require__getRawTag();
13499
+ var objectToString3 = require__objectToString();
13500
+ var nullTag = "[object Null]";
13501
+ var undefinedTag = "[object Undefined]";
13502
+ var symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined;
13503
+ function baseGetTag(value) {
13504
+ if (value == null) {
13505
+ return value === undefined ? undefinedTag : nullTag;
13506
+ }
13507
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString3(value);
13464
13508
  }
13465
- function unicodeWords(string4) {
13466
- return string4.match(reUnicodeWord) || [];
13509
+ module.exports = baseGetTag;
13510
+ });
13511
+
13512
+ // node_modules/lodash/isObjectLike.js
13513
+ var require_isObjectLike = __commonJS((exports, module) => {
13514
+ function isObjectLike(value) {
13515
+ return value != null && typeof value == "object";
13467
13516
  }
13468
- var objectProto = Object.prototype;
13469
- var objectToString3 = objectProto.toString;
13470
- var Symbol2 = root.Symbol;
13517
+ module.exports = isObjectLike;
13518
+ });
13519
+
13520
+ // node_modules/lodash/isSymbol.js
13521
+ var require_isSymbol = __commonJS((exports, module) => {
13522
+ var baseGetTag = require__baseGetTag();
13523
+ var isObjectLike = require_isObjectLike();
13524
+ var symbolTag = "[object Symbol]";
13525
+ function isSymbol(value) {
13526
+ return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
13527
+ }
13528
+ module.exports = isSymbol;
13529
+ });
13530
+
13531
+ // node_modules/lodash/_baseToString.js
13532
+ var require__baseToString = __commonJS((exports, module) => {
13533
+ var Symbol2 = require__Symbol();
13534
+ var arrayMap = require__arrayMap();
13535
+ var isArray = require_isArray();
13536
+ var isSymbol = require_isSymbol();
13537
+ var INFINITY = 1 / 0;
13471
13538
  var symbolProto = Symbol2 ? Symbol2.prototype : undefined;
13472
13539
  var symbolToString = symbolProto ? symbolProto.toString : undefined;
13473
13540
  function baseToString(value) {
13474
13541
  if (typeof value == "string") {
13475
13542
  return value;
13476
13543
  }
13544
+ if (isArray(value)) {
13545
+ return arrayMap(value, baseToString) + "";
13546
+ }
13477
13547
  if (isSymbol(value)) {
13478
13548
  return symbolToString ? symbolToString.call(value) : "";
13479
13549
  }
13480
13550
  var result = value + "";
13481
13551
  return result == "0" && 1 / value == -INFINITY ? "-0" : result;
13482
13552
  }
13483
- function createCompounder(callback) {
13484
- return function(string4) {
13485
- return arrayReduce(words(deburr(string4).replace(reApos, "")), callback, "");
13486
- };
13487
- }
13488
- function isObjectLike(value) {
13489
- return !!value && typeof value == "object";
13490
- }
13491
- function isSymbol(value) {
13492
- return typeof value == "symbol" || isObjectLike(value) && objectToString3.call(value) == symbolTag;
13493
- }
13553
+ module.exports = baseToString;
13554
+ });
13555
+
13556
+ // node_modules/lodash/toString.js
13557
+ var require_toString = __commonJS((exports, module) => {
13558
+ var baseToString = require__baseToString();
13494
13559
  function toString2(value) {
13495
13560
  return value == null ? "" : baseToString(value);
13496
13561
  }
13562
+ module.exports = toString2;
13563
+ });
13564
+
13565
+ // node_modules/lodash/deburr.js
13566
+ var require_deburr = __commonJS((exports, module) => {
13567
+ var deburrLetter = require__deburrLetter();
13568
+ var toString2 = require_toString();
13569
+ var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
13570
+ var rsComboMarksRange = "\\u0300-\\u036f";
13571
+ var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
13572
+ var rsComboSymbolsRange = "\\u20d0-\\u20ff";
13573
+ var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
13574
+ var rsCombo = "[" + rsComboRange + "]";
13575
+ var reComboMark = RegExp(rsCombo, "g");
13497
13576
  function deburr(string4) {
13498
13577
  string4 = toString2(string4);
13499
13578
  return string4 && string4.replace(reLatin, deburrLetter).replace(reComboMark, "");
13500
13579
  }
13501
- var kebabCase = createCompounder(function(result, word, index) {
13502
- return result + (index ? "-" : "") + word.toLowerCase();
13503
- });
13580
+ module.exports = deburr;
13581
+ });
13582
+
13583
+ // node_modules/lodash/_asciiWords.js
13584
+ var require__asciiWords = __commonJS((exports, module) => {
13585
+ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
13586
+ function asciiWords(string4) {
13587
+ return string4.match(reAsciiWord) || [];
13588
+ }
13589
+ module.exports = asciiWords;
13590
+ });
13591
+
13592
+ // node_modules/lodash/_hasUnicodeWord.js
13593
+ var require__hasUnicodeWord = __commonJS((exports, module) => {
13594
+ var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
13595
+ function hasUnicodeWord(string4) {
13596
+ return reHasUnicodeWord.test(string4);
13597
+ }
13598
+ module.exports = hasUnicodeWord;
13599
+ });
13600
+
13601
+ // node_modules/lodash/_unicodeWords.js
13602
+ var require__unicodeWords = __commonJS((exports, module) => {
13603
+ var rsAstralRange = "\\ud800-\\udfff";
13604
+ var rsComboMarksRange = "\\u0300-\\u036f";
13605
+ var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
13606
+ var rsComboSymbolsRange = "\\u20d0-\\u20ff";
13607
+ var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
13608
+ var rsDingbatRange = "\\u2700-\\u27bf";
13609
+ var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
13610
+ var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
13611
+ var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
13612
+ var rsPunctuationRange = "\\u2000-\\u206f";
13613
+ var rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000";
13614
+ var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
13615
+ var rsVarRange = "\\ufe0e\\ufe0f";
13616
+ var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
13617
+ var rsApos = "['’]";
13618
+ var rsBreak = "[" + rsBreakRange + "]";
13619
+ var rsCombo = "[" + rsComboRange + "]";
13620
+ var rsDigits = "\\d+";
13621
+ var rsDingbat = "[" + rsDingbatRange + "]";
13622
+ var rsLower = "[" + rsLowerRange + "]";
13623
+ var rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
13624
+ var rsFitz = "\\ud83c[\\udffb-\\udfff]";
13625
+ var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
13626
+ var rsNonAstral = "[^" + rsAstralRange + "]";
13627
+ var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
13628
+ var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
13629
+ var rsUpper = "[" + rsUpperRange + "]";
13630
+ var rsZWJ = "\\u200d";
13631
+ var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
13632
+ var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
13633
+ var rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?";
13634
+ var rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?";
13635
+ var reOptMod = rsModifier + "?";
13636
+ var rsOptVar = "[" + rsVarRange + "]?";
13637
+ var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
13638
+ var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
13639
+ var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
13640
+ var rsSeq = rsOptVar + reOptMod + rsOptJoin;
13641
+ var rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq;
13642
+ var reUnicodeWord = RegExp([
13643
+ rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
13644
+ rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
13645
+ rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
13646
+ rsUpper + "+" + rsOptContrUpper,
13647
+ rsOrdUpper,
13648
+ rsOrdLower,
13649
+ rsDigits,
13650
+ rsEmoji
13651
+ ].join("|"), "g");
13652
+ function unicodeWords(string4) {
13653
+ return string4.match(reUnicodeWord) || [];
13654
+ }
13655
+ module.exports = unicodeWords;
13656
+ });
13657
+
13658
+ // node_modules/lodash/words.js
13659
+ var require_words = __commonJS((exports, module) => {
13660
+ var asciiWords = require__asciiWords();
13661
+ var hasUnicodeWord = require__hasUnicodeWord();
13662
+ var toString2 = require_toString();
13663
+ var unicodeWords = require__unicodeWords();
13504
13664
  function words(string4, pattern, guard) {
13505
13665
  string4 = toString2(string4);
13506
13666
  pattern = guard ? undefined : pattern;
@@ -13509,6 +13669,30 @@ var require_lodash = __commonJS((exports, module) => {
13509
13669
  }
13510
13670
  return string4.match(pattern) || [];
13511
13671
  }
13672
+ module.exports = words;
13673
+ });
13674
+
13675
+ // node_modules/lodash/_createCompounder.js
13676
+ var require__createCompounder = __commonJS((exports, module) => {
13677
+ var arrayReduce = require__arrayReduce();
13678
+ var deburr = require_deburr();
13679
+ var words = require_words();
13680
+ var rsApos = "['’]";
13681
+ var reApos = RegExp(rsApos, "g");
13682
+ function createCompounder(callback) {
13683
+ return function(string4) {
13684
+ return arrayReduce(words(deburr(string4).replace(reApos, "")), callback, "");
13685
+ };
13686
+ }
13687
+ module.exports = createCompounder;
13688
+ });
13689
+
13690
+ // node_modules/lodash/kebabCase.js
13691
+ var require_kebabCase = __commonJS((exports, module) => {
13692
+ var createCompounder = require__createCompounder();
13693
+ var kebabCase = createCompounder(function(result, word, index) {
13694
+ return result + (index ? "-" : "") + word.toLowerCase();
13695
+ });
13512
13696
  module.exports = kebabCase;
13513
13697
  });
13514
13698
 
@@ -14591,7 +14775,7 @@ var require_lib2 = __commonJS((exports) => {
14591
14775
  });
14592
14776
 
14593
14777
  // node_modules/lodash/lodash.js
14594
- var require_lodash2 = __commonJS((exports, module) => {
14778
+ var require_lodash = __commonJS((exports, module) => {
14595
14779
  (function() {
14596
14780
  var undefined2;
14597
14781
  var VERSION = "4.17.23";
@@ -117232,15 +117416,15 @@ var init_prettier = __esm(() => {
117232
117416
  exports.removeDuplicateSlashes = removeDuplicateSlashes;
117233
117417
  function partitionAbsoluteAndRelative(patterns) {
117234
117418
  const absolute = [];
117235
- const relative2 = [];
117419
+ const relative22 = [];
117236
117420
  for (const pattern of patterns) {
117237
117421
  if (isAbsolute2(pattern)) {
117238
117422
  absolute.push(pattern);
117239
117423
  } else {
117240
- relative2.push(pattern);
117424
+ relative22.push(pattern);
117241
117425
  }
117242
117426
  }
117243
- return [absolute, relative2];
117427
+ return [absolute, relative22];
117244
117428
  }
117245
117429
  exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
117246
117430
  function isAbsolute2(pattern) {
@@ -127581,7 +127765,7 @@ var require_AST = __commonJS((exports) => {
127581
127765
  var require_JSONSchema = __commonJS((exports) => {
127582
127766
  Object.defineProperty(exports, "__esModule", { value: true });
127583
127767
  exports.isCompound = exports.isPrimitive = exports.isBoolean = exports.getRootSchema = exports.Intersection = exports.Types = exports.Parent = undefined;
127584
- var lodash_1 = require_lodash2();
127768
+ var lodash_1 = require_lodash();
127585
127769
  exports.Parent = Symbol("Parent");
127586
127770
  exports.Types = Symbol("Types");
127587
127771
  exports.Intersection = Symbol("Intersection");
@@ -130388,7 +130572,7 @@ var require_utils7 = __commonJS((exports) => {
130388
130572
  };
130389
130573
  Object.defineProperty(exports, "__esModule", { value: true });
130390
130574
  exports.parseFileAsJSONSchema = exports.isSchemaLike = exports.appendToDescription = exports.maybeStripDefault = exports.pathTransform = exports.escapeBlockComment = exports.log = exports.error = exports.generateName = exports.toSafeString = exports.stripExtension = exports.justName = exports.traverse = exports.Try = undefined;
130391
- var lodash_1 = require_lodash2();
130575
+ var lodash_1 = require_lodash();
130392
130576
  var path_1 = __require("path");
130393
130577
  var JSONSchema_1 = require_JSONSchema();
130394
130578
  var js_yaml_1 = __importDefault(require_js_yaml3());
@@ -130719,7 +130903,7 @@ ${values.join(`
130719
130903
  var require_generator = __commonJS((exports) => {
130720
130904
  Object.defineProperty(exports, "__esModule", { value: true });
130721
130905
  exports.generateType = exports.generate = undefined;
130722
- var lodash_1 = require_lodash2();
130906
+ var lodash_1 = require_lodash();
130723
130907
  var index_1 = require_src3();
130724
130908
  var AST_1 = require_AST();
130725
130909
  var utils_1 = require_utils7();
@@ -130982,7 +131166,7 @@ var require_generator = __commonJS((exports) => {
130982
131166
  var require_typesOfSchema = __commonJS((exports) => {
130983
131167
  Object.defineProperty(exports, "__esModule", { value: true });
130984
131168
  exports.typesOfSchema = undefined;
130985
- var lodash_1 = require_lodash2();
131169
+ var lodash_1 = require_lodash();
130986
131170
  var JSONSchema_1 = require_JSONSchema();
130987
131171
  function typesOfSchema(schema9) {
130988
131172
  if (schema9.tsType) {
@@ -131341,7 +131525,7 @@ var require_normalizer = __commonJS((exports) => {
131341
131525
  var require_optimizer = __commonJS((exports) => {
131342
131526
  Object.defineProperty(exports, "__esModule", { value: true });
131343
131527
  exports.optimize = undefined;
131344
- var lodash_1 = require_lodash2();
131528
+ var lodash_1 = require_lodash();
131345
131529
  var generator_1 = require_generator();
131346
131530
  var AST_1 = require_AST();
131347
131531
  var utils_1 = require_utils7();
@@ -131407,7 +131591,7 @@ var require_optimizer = __commonJS((exports) => {
131407
131591
  var require_parser = __commonJS((exports) => {
131408
131592
  Object.defineProperty(exports, "__esModule", { value: true });
131409
131593
  exports.parse = undefined;
131410
- var lodash_1 = require_lodash2();
131594
+ var lodash_1 = require_lodash();
131411
131595
  var util_1 = __require("util");
131412
131596
  var applySchemaTyping_1 = require_applySchemaTyping();
131413
131597
  var AST_1 = require_AST();
@@ -132195,7 +132379,7 @@ var require_url = __commonJS((exports) => {
132195
132379
  exports.fromFileSystemPath = fromFileSystemPath;
132196
132380
  exports.toFileSystemPath = toFileSystemPath;
132197
132381
  exports.safePointerToPath = safePointerToPath;
132198
- exports.relative = relative2;
132382
+ exports.relative = relative4;
132199
132383
  var convert_path_to_posix_1 = __importDefault(require_convert_path_to_posix());
132200
132384
  var path_1 = __importStar(__require("path"));
132201
132385
  var forwardSlashPattern = /\//g;
@@ -132345,7 +132529,7 @@ var require_url = __commonJS((exports) => {
132345
132529
  return decodeURIComponent(value).replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
132346
132530
  });
132347
132531
  }
132348
- function relative2(from, to5) {
132532
+ function relative4(from, to5) {
132349
132533
  if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
132350
132534
  return resolve6(from, to5);
132351
132535
  }
@@ -137260,7 +137444,7 @@ var require_linker = __commonJS((exports) => {
137260
137444
  Object.defineProperty(exports, "__esModule", { value: true });
137261
137445
  exports.link = undefined;
137262
137446
  var JSONSchema_1 = require_JSONSchema();
137263
- var lodash_1 = require_lodash2();
137447
+ var lodash_1 = require_lodash();
137264
137448
  function link2(schema9, parent = null) {
137265
137449
  if (!Array.isArray(schema9) && !(0, lodash_1.isPlainObject)(schema9)) {
137266
137450
  return schema9;
@@ -137328,7 +137512,7 @@ var require_src3 = __commonJS((exports) => {
137328
137512
  Object.defineProperty(exports, "__esModule", { value: true });
137329
137513
  exports.ValidationError = exports.compile = exports.compileFromFile = exports.DEFAULT_OPTIONS = undefined;
137330
137514
  var fs_1 = __require("fs");
137331
- var lodash_1 = require_lodash2();
137515
+ var lodash_1 = require_lodash();
137332
137516
  var path_1 = __require("path");
137333
137517
  var formatter_1 = require_formatter();
137334
137518
  var generator_1 = require_generator();
@@ -138412,7 +138596,7 @@ var require_depd = __commonJS((exports, module) => {
138412
138596
  * Copyright(c) 2014-2018 Douglas Christopher Wilson
138413
138597
  * MIT Licensed
138414
138598
  */
138415
- var relative2 = __require("path").relative;
138599
+ var relative4 = __require("path").relative;
138416
138600
  module.exports = depd;
138417
138601
  var basePath = process.cwd();
138418
138602
  function containsNamespace(str, namespace) {
@@ -138608,7 +138792,7 @@ var require_depd = __commonJS((exports, module) => {
138608
138792
  return formatted;
138609
138793
  }
138610
138794
  function formatLocation(callSite) {
138611
- return relative2(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
138795
+ return relative4(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
138612
138796
  }
138613
138797
  function getStack() {
138614
138798
  var limit = Error.stackTraceLimit;
@@ -156081,7 +156265,7 @@ var require_view = __commonJS((exports, module) => {
156081
156265
  var debug = require_src4()("express:view");
156082
156266
  var path18 = __require("node:path");
156083
156267
  var fs28 = __require("node:fs");
156084
- var dirname11 = path18.dirname;
156268
+ var dirname12 = path18.dirname;
156085
156269
  var basename4 = path18.basename;
156086
156270
  var extname2 = path18.extname;
156087
156271
  var join15 = path18.join;
@@ -156120,7 +156304,7 @@ var require_view = __commonJS((exports, module) => {
156120
156304
  for (var i5 = 0;i5 < roots.length && !path19; i5++) {
156121
156305
  var root2 = roots[i5];
156122
156306
  var loc = resolve6(root2, name2);
156123
- var dir = dirname11(loc);
156307
+ var dir = dirname12(loc);
156124
156308
  var file2 = basename4(loc);
156125
156309
  path19 = this.resolve(dir, file2);
156126
156310
  }
@@ -161779,8 +161963,8 @@ var require_follow_redirects = __commonJS((exports, module) => {
161779
161963
  }
161780
161964
  return parsed;
161781
161965
  }
161782
- function resolveUrl(relative2, base) {
161783
- return useNativeURL ? new URL2(relative2, base) : parseUrl(url3.resolve(base, relative2));
161966
+ function resolveUrl(relative4, base) {
161967
+ return useNativeURL ? new URL2(relative4, base) : parseUrl(url3.resolve(base, relative4));
161784
161968
  }
161785
161969
  function validateUrl(input) {
161786
161970
  if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
@@ -210272,6 +210456,168 @@ var require_multer = __commonJS((exports, module) => {
210272
210456
  module.exports.MulterError = MulterError;
210273
210457
  });
210274
210458
 
210459
+ // node_modules/lodash/isObject.js
210460
+ var require_isObject = __commonJS((exports, module) => {
210461
+ function isObject5(value) {
210462
+ var type = typeof value;
210463
+ return value != null && (type == "object" || type == "function");
210464
+ }
210465
+ module.exports = isObject5;
210466
+ });
210467
+
210468
+ // node_modules/lodash/now.js
210469
+ var require_now = __commonJS((exports, module) => {
210470
+ var root2 = require__root();
210471
+ var now = function() {
210472
+ return root2.Date.now();
210473
+ };
210474
+ module.exports = now;
210475
+ });
210476
+
210477
+ // node_modules/lodash/_trimmedEndIndex.js
210478
+ var require__trimmedEndIndex = __commonJS((exports, module) => {
210479
+ var reWhitespace = /\s/;
210480
+ function trimmedEndIndex(string4) {
210481
+ var index = string4.length;
210482
+ while (index-- && reWhitespace.test(string4.charAt(index))) {}
210483
+ return index;
210484
+ }
210485
+ module.exports = trimmedEndIndex;
210486
+ });
210487
+
210488
+ // node_modules/lodash/_baseTrim.js
210489
+ var require__baseTrim = __commonJS((exports, module) => {
210490
+ var trimmedEndIndex = require__trimmedEndIndex();
210491
+ var reTrimStart = /^\s+/;
210492
+ function baseTrim(string4) {
210493
+ return string4 ? string4.slice(0, trimmedEndIndex(string4) + 1).replace(reTrimStart, "") : string4;
210494
+ }
210495
+ module.exports = baseTrim;
210496
+ });
210497
+
210498
+ // node_modules/lodash/toNumber.js
210499
+ var require_toNumber = __commonJS((exports, module) => {
210500
+ var baseTrim = require__baseTrim();
210501
+ var isObject5 = require_isObject();
210502
+ var isSymbol = require_isSymbol();
210503
+ var NAN = 0 / 0;
210504
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
210505
+ var reIsBinary = /^0b[01]+$/i;
210506
+ var reIsOctal = /^0o[0-7]+$/i;
210507
+ var freeParseInt = parseInt;
210508
+ function toNumber(value) {
210509
+ if (typeof value == "number") {
210510
+ return value;
210511
+ }
210512
+ if (isSymbol(value)) {
210513
+ return NAN;
210514
+ }
210515
+ if (isObject5(value)) {
210516
+ var other = typeof value.valueOf == "function" ? value.valueOf() : value;
210517
+ value = isObject5(other) ? other + "" : other;
210518
+ }
210519
+ if (typeof value != "string") {
210520
+ return value === 0 ? value : +value;
210521
+ }
210522
+ value = baseTrim(value);
210523
+ var isBinary = reIsBinary.test(value);
210524
+ return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
210525
+ }
210526
+ module.exports = toNumber;
210527
+ });
210528
+
210529
+ // node_modules/lodash/debounce.js
210530
+ var require_debounce = __commonJS((exports, module) => {
210531
+ var isObject5 = require_isObject();
210532
+ var now = require_now();
210533
+ var toNumber = require_toNumber();
210534
+ var FUNC_ERROR_TEXT = "Expected a function";
210535
+ var nativeMax = Math.max;
210536
+ var nativeMin = Math.min;
210537
+ function debounce(func, wait, options8) {
210538
+ var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
210539
+ if (typeof func != "function") {
210540
+ throw new TypeError(FUNC_ERROR_TEXT);
210541
+ }
210542
+ wait = toNumber(wait) || 0;
210543
+ if (isObject5(options8)) {
210544
+ leading = !!options8.leading;
210545
+ maxing = "maxWait" in options8;
210546
+ maxWait = maxing ? nativeMax(toNumber(options8.maxWait) || 0, wait) : maxWait;
210547
+ trailing = "trailing" in options8 ? !!options8.trailing : trailing;
210548
+ }
210549
+ function invokeFunc(time3) {
210550
+ var args = lastArgs, thisArg = lastThis;
210551
+ lastArgs = lastThis = undefined;
210552
+ lastInvokeTime = time3;
210553
+ result = func.apply(thisArg, args);
210554
+ return result;
210555
+ }
210556
+ function leadingEdge(time3) {
210557
+ lastInvokeTime = time3;
210558
+ timerId = setTimeout(timerExpired, wait);
210559
+ return leading ? invokeFunc(time3) : result;
210560
+ }
210561
+ function remainingWait(time3) {
210562
+ var timeSinceLastCall = time3 - lastCallTime, timeSinceLastInvoke = time3 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
210563
+ return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
210564
+ }
210565
+ function shouldInvoke(time3) {
210566
+ var timeSinceLastCall = time3 - lastCallTime, timeSinceLastInvoke = time3 - lastInvokeTime;
210567
+ return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
210568
+ }
210569
+ function timerExpired() {
210570
+ var time3 = now();
210571
+ if (shouldInvoke(time3)) {
210572
+ return trailingEdge(time3);
210573
+ }
210574
+ timerId = setTimeout(timerExpired, remainingWait(time3));
210575
+ }
210576
+ function trailingEdge(time3) {
210577
+ timerId = undefined;
210578
+ if (trailing && lastArgs) {
210579
+ return invokeFunc(time3);
210580
+ }
210581
+ lastArgs = lastThis = undefined;
210582
+ return result;
210583
+ }
210584
+ function cancel() {
210585
+ if (timerId !== undefined) {
210586
+ clearTimeout(timerId);
210587
+ }
210588
+ lastInvokeTime = 0;
210589
+ lastArgs = lastCallTime = lastThis = timerId = undefined;
210590
+ }
210591
+ function flush() {
210592
+ return timerId === undefined ? result : trailingEdge(now());
210593
+ }
210594
+ function debounced() {
210595
+ var time3 = now(), isInvoking = shouldInvoke(time3);
210596
+ lastArgs = arguments;
210597
+ lastThis = this;
210598
+ lastCallTime = time3;
210599
+ if (isInvoking) {
210600
+ if (timerId === undefined) {
210601
+ return leadingEdge(lastCallTime);
210602
+ }
210603
+ if (maxing) {
210604
+ clearTimeout(timerId);
210605
+ timerId = setTimeout(timerExpired, wait);
210606
+ return invokeFunc(lastCallTime);
210607
+ }
210608
+ }
210609
+ if (timerId === undefined) {
210610
+ timerId = setTimeout(timerExpired, wait);
210611
+ }
210612
+ return result;
210613
+ }
210614
+ debounced.cancel = cancel;
210615
+ debounced.flush = flush;
210616
+ return debounced;
210617
+ }
210618
+ module.exports = debounce;
210619
+ });
210620
+
210275
210621
  // node_modules/@vercel/detect-agent/dist/index.js
210276
210622
  var require_dist5 = __commonJS((exports, module) => {
210277
210623
  var __defProp4 = Object.defineProperty;
@@ -210297,8 +210643,8 @@ var require_dist5 = __commonJS((exports, module) => {
210297
210643
  determineAgent: () => determineAgent
210298
210644
  });
210299
210645
  module.exports = __toCommonJS(src_exports);
210300
- var import_promises19 = __require("node:fs/promises");
210301
- var import_node_fs19 = __require("node:fs");
210646
+ var import_promises22 = __require("node:fs/promises");
210647
+ var import_node_fs21 = __require("node:fs");
210302
210648
  var DEVIN_LOCAL_PATH = "/opt/.devin";
210303
210649
  var CURSOR2 = "cursor";
210304
210650
  var CURSOR_CLI = "cursor-cli";
@@ -210355,7 +210701,7 @@ var require_dist5 = __commonJS((exports, module) => {
210355
210701
  return { isAgent: true, agent: { name: REPLIT } };
210356
210702
  }
210357
210703
  try {
210358
- await (0, import_promises19.access)(DEVIN_LOCAL_PATH, import_node_fs19.constants.F_OK);
210704
+ await (0, import_promises22.access)(DEVIN_LOCAL_PATH, import_node_fs21.constants.F_OK);
210359
210705
  return { isAgent: true, agent: { name: DEVIN } };
210360
210706
  } catch (error48) {}
210361
210707
  return { isAgent: false, agent: undefined };
@@ -210379,7 +210725,7 @@ var {
210379
210725
  } = import__.default;
210380
210726
 
210381
210727
  // src/cli/commands/agents/pull.ts
210382
- import { dirname as dirname7, join as join9 } from "node:path";
210728
+ import { dirname as dirname8, join as join9 } from "node:path";
210383
210729
 
210384
210730
  // node_modules/@clack/core/dist/index.mjs
210385
210731
  var import_picocolors = __toESM(require_picocolors(), 1);
@@ -225849,7 +226195,9 @@ import { fileURLToPath } from "node:url";
225849
226195
  var PROJECT_SUBDIR = "base44";
225850
226196
  var CONFIG_FILE_EXTENSION = "jsonc";
225851
226197
  var CONFIG_FILE_EXTENSION_GLOB = "{json,jsonc}";
225852
- var FUNCTION_CONFIG_FILE = `function.${CONFIG_FILE_EXTENSION_GLOB}`;
226198
+ var FUNCTION_CONFIG_GLOB = `**/function.${CONFIG_FILE_EXTENSION_GLOB}`;
226199
+ var ENTRY_FILE_GLOB = "**/entry.{js,ts}";
226200
+ var ENTRY_IGNORE_DOT_PATHS = ["**/*.*/**"];
225853
226201
  var APP_CONFIG_PATTERN = `**/.app.${CONFIG_FILE_EXTENSION_GLOB}`;
225854
226202
  var PROJECT_CONFIG_PATTERNS = [
225855
226203
  `${PROJECT_SUBDIR}/config.${CONFIG_FILE_EXTENSION_GLOB}`,
@@ -232878,7 +233226,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
232878
233226
  var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
232879
233227
 
232880
233228
  // src/core/project/config.ts
232881
- import { dirname as dirname5, join as join6 } from "node:path";
233229
+ import { dirname as dirname6, join as join6 } from "node:path";
232882
233230
 
232883
233231
  // src/core/resources/agent/schema.ts
232884
233232
  var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
@@ -233688,7 +234036,7 @@ async function fetchFunctionLogs(functionName, filters = {}) {
233688
234036
  return result.data;
233689
234037
  }
233690
234038
  // src/core/resources/function/config.ts
233691
- import { dirname as dirname4, join as join5 } from "node:path";
234039
+ import { basename as basename2, dirname as dirname4, join as join5, relative } from "node:path";
233692
234040
  async function readFunctionConfig(configPath) {
233693
234041
  const parsed = await readJsonFile(configPath);
233694
234042
  const result = FunctionConfigSchema.safeParse(parsed);
@@ -233706,7 +234054,7 @@ async function readFunction(configPath) {
233706
234054
  hints: [{ message: "Check the 'entry' field in your function config" }]
233707
234055
  });
233708
234056
  }
233709
- const filePaths = await globby("*.{js,ts,json}", {
234057
+ const filePaths = await globby("**/*.{js,ts,json}", {
233710
234058
  cwd: functionDir,
233711
234059
  absolute: true
233712
234060
  });
@@ -233717,26 +234065,61 @@ async function readAllFunctions(functionsDir) {
233717
234065
  if (!await pathExists(functionsDir)) {
233718
234066
  return [];
233719
234067
  }
233720
- const configFiles = await globby(`*/${FUNCTION_CONFIG_FILE}`, {
234068
+ const configFiles = await globby(FUNCTION_CONFIG_GLOB, {
233721
234069
  cwd: functionsDir,
233722
234070
  absolute: true
233723
234071
  });
233724
- const functions = await Promise.all(configFiles.map((configPath) => readFunction(configPath)));
234072
+ const entryFiles = await globby(ENTRY_FILE_GLOB, {
234073
+ cwd: functionsDir,
234074
+ absolute: true,
234075
+ ignore: ENTRY_IGNORE_DOT_PATHS
234076
+ });
234077
+ const configFilesDirs = new Set(configFiles.map((f) => dirname4(f)));
234078
+ const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(dirname4(entryFile)));
234079
+ const functionsFromConfig = await Promise.all(configFiles.map((configPath) => readFunction(configPath)));
234080
+ const functionsWithoutConfig = await Promise.all(entryFilesWithoutConfig.map(async (entryFile) => {
234081
+ const functionDir = dirname4(entryFile);
234082
+ const filePaths = await globby("**/*.{js,ts,json}", {
234083
+ cwd: functionDir,
234084
+ absolute: true
234085
+ });
234086
+ const name2 = relative(functionsDir, functionDir).split(/[/\\]/).join("/");
234087
+ if (!name2) {
234088
+ throw new InvalidInputError("entry.ts found directly in the functions directory — it must be inside a named subfolder", {
234089
+ hints: [
234090
+ {
234091
+ message: `Move ${entryFile} into a subfolder (e.g. functions/myFunc/entry.ts)`
234092
+ }
234093
+ ]
234094
+ });
234095
+ }
234096
+ const entry = basename2(entryFile);
234097
+ return { name: name2, entry, entryPath: entryFile, filePaths };
234098
+ }));
234099
+ const functions = [...functionsFromConfig, ...functionsWithoutConfig];
233725
234100
  const names = new Set;
233726
234101
  for (const fn of functions) {
233727
234102
  if (names.has(fn.name)) {
233728
- throw new Error(`Duplicate function name "${fn.name}"`);
234103
+ throw new InvalidInputError(`Duplicate function name "${fn.name}"`, {
234104
+ hints: [
234105
+ {
234106
+ message: "Ensure each function has a unique name (or path for zero-config functions)."
234107
+ }
234108
+ ]
234109
+ });
233729
234110
  }
233730
234111
  names.add(fn.name);
233731
234112
  }
233732
234113
  return functions;
233733
234114
  }
233734
234115
  // src/core/resources/function/deploy.ts
233735
- import { basename as basename2 } from "node:path";
234116
+ import { dirname as dirname5, relative as relative2 } from "node:path";
233736
234117
  async function loadFunctionCode(fn) {
234118
+ const functionDir = dirname5(fn.entryPath);
233737
234119
  const loadedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
233738
234120
  const content = await readTextFile(filePath);
233739
- return { path: basename2(filePath), content };
234121
+ const path11 = relative2(functionDir, filePath).split(/[/\\]/).join("/");
234122
+ return { path: path11, content };
233740
234123
  }));
233741
234124
  return { ...fn, files: loadedFiles };
233742
234125
  }
@@ -233762,12 +234145,12 @@ async function findConfigInDir(dir) {
233762
234145
  }
233763
234146
  async function findProjectRoot(startPath) {
233764
234147
  let current = startPath || process.cwd();
233765
- while (current !== dirname5(current)) {
234148
+ while (current !== dirname6(current)) {
233766
234149
  const configPath = await findConfigInDir(current);
233767
234150
  if (configPath) {
233768
234151
  return { root: current, configPath };
233769
234152
  }
233770
- current = dirname5(current);
234153
+ current = dirname6(current);
233771
234154
  }
233772
234155
  return null;
233773
234156
  }
@@ -233789,7 +234172,7 @@ async function readProjectConfig(projectRoot) {
233789
234172
  throw new SchemaValidationError("Invalid project configuration", result.error, configPath);
233790
234173
  }
233791
234174
  const project = result.data;
233792
- const configDir = dirname5(configPath);
234175
+ const configDir = dirname6(configPath);
233793
234176
  const [entities, functions, agents, connectors] = await Promise.all([
233794
234177
  entityResource.readAll(join6(configDir, project.entitiesDir)),
233795
234178
  functionResource.readAll(join6(configDir, project.functionsDir)),
@@ -233891,7 +234274,7 @@ async function readAppConfig(projectRoot) {
233891
234274
  // src/core/project/template.ts
233892
234275
  var import_ejs = __toESM(require_ejs(), 1);
233893
234276
  var import_front_matter = __toESM(require_front_matter(), 1);
233894
- import { dirname as dirname6, join as join7 } from "node:path";
234277
+ import { dirname as dirname7, join as join7 } from "node:path";
233895
234278
  async function listTemplates() {
233896
234279
  const parsed = await readJsonFile(getTemplatesIndexPath());
233897
234280
  const result = TemplatesConfigSchema.safeParse(parsed);
@@ -233913,7 +234296,7 @@ async function renderTemplate(template, destPath, data) {
233913
234296
  if (file2.endsWith(".ejs")) {
233914
234297
  const rendered = await import_ejs.default.renderFile(srcPath, data);
233915
234298
  const { attributes, body } = import_front_matter.default(rendered);
233916
- const destFile = attributes.outputFileName ? join7(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
234299
+ const destFile = attributes.outputFileName ? join7(dirname7(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
233917
234300
  const destFilePath = join7(destPath, destFile);
233918
234301
  await writeFile(destFilePath, body);
233919
234302
  } else {
@@ -234266,7 +234649,8 @@ async function setSecrets(secrets) {
234266
234649
  let response;
234267
234650
  try {
234268
234651
  response = await appClient.post("secrets", {
234269
- json: secrets
234652
+ json: secrets,
234653
+ timeout: false
234270
234654
  });
234271
234655
  } catch (error48) {
234272
234656
  throw await ApiError.fromHttpError(error48, "setting secrets");
@@ -241588,7 +241972,7 @@ var {
241588
241972
  // package.json
241589
241973
  var package_default = {
241590
241974
  name: "base44",
241591
- version: "0.0.37",
241975
+ version: "0.0.38",
241592
241976
  description: "Base44 CLI - Unified interface for managing Base44 applications",
241593
241977
  type: "module",
241594
241978
  bin: {
@@ -241634,11 +242018,12 @@ var package_default = {
241634
242018
  "@types/ejs": "^3.1.5",
241635
242019
  "@types/express": "^5.0.6",
241636
242020
  "@types/json-schema": "^7.0.15",
241637
- "@types/lodash.kebabcase": "^4.1.9",
241638
- "@types/node": "^22.10.5",
242021
+ "@types/lodash": "^4.17.24",
241639
242022
  "@types/multer": "^2.0.0",
242023
+ "@types/node": "^22.10.5",
241640
242024
  "@vercel/detect-agent": "^1.1.0",
241641
242025
  chalk: "^5.6.2",
242026
+ chokidar: "^5.0.0",
241642
242027
  commander: "^12.1.0",
241643
242028
  "common-tags": "^1.8.2",
241644
242029
  cors: "^2.8.5",
@@ -241654,9 +242039,9 @@ var package_default = {
241654
242039
  json5: "^2.2.3",
241655
242040
  knip: "^5.83.1",
241656
242041
  ky: "^1.14.2",
241657
- "lodash.kebabcase": "^4.1.1",
241658
- multer: "^2.0.0",
242042
+ lodash: "^4.17.23",
241659
242043
  msw: "^2.12.10",
242044
+ multer: "^2.0.0",
241660
242045
  nanoid: "^5.1.6",
241661
242046
  open: "^11.0.0",
241662
242047
  "p-wait-for": "^6.0.0",
@@ -241796,7 +242181,7 @@ function getDashboardUrl(projectId) {
241796
242181
  // src/cli/commands/agents/pull.ts
241797
242182
  async function pullAgentsAction() {
241798
242183
  const { project: project2 } = await readProjectConfig();
241799
- const configDir = dirname7(project2.configPath);
242184
+ const configDir = dirname8(project2.configPath);
241800
242185
  const agentsDir = join9(configDir, project2.agentsDir);
241801
242186
  const remoteAgents = await runTask("Fetching agents from Base44", async () => {
241802
242187
  return await fetchAgents();
@@ -241891,10 +242276,10 @@ function getWhoamiCommand(context) {
241891
242276
  }
241892
242277
 
241893
242278
  // src/cli/commands/connectors/pull.ts
241894
- import { dirname as dirname8, join as join10 } from "node:path";
242279
+ import { dirname as dirname9, join as join10 } from "node:path";
241895
242280
  async function pullConnectorsAction() {
241896
242281
  const { project: project2 } = await readProjectConfig();
241897
- const configDir = dirname8(project2.configPath);
242282
+ const configDir = dirname9(project2.configPath);
241898
242283
  const connectorsDir = join10(configDir, project2.connectorsDir);
241899
242284
  const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
241900
242285
  return await listConnectors();
@@ -242783,7 +243168,7 @@ function getFunctionsDeployCommand(context) {
242783
243168
 
242784
243169
  // src/cli/commands/project/create.ts
242785
243170
  import { basename as basename3, join as join11, resolve as resolve2 } from "node:path";
242786
- var import_lodash = __toESM(require_lodash(), 1);
243171
+ var import_kebabCase = __toESM(require_kebabCase(), 1);
242787
243172
  var DEFAULT_TEMPLATE_ID = "backend-only";
242788
243173
  async function getTemplateById(templateId) {
242789
243174
  const templates = await listTemplates();
@@ -242827,7 +243212,7 @@ async function createInteractive(options) {
242827
243212
  });
242828
243213
  },
242829
243214
  projectPath: async ({ results }) => {
242830
- const suggestedPath = await isDirEmpty() ? "./" : `./${import_lodash.default(results.name)}`;
243215
+ const suggestedPath = await isDirEmpty() ? "./" : `./${import_kebabCase.default(results.name)}`;
242831
243216
  return Ze({
242832
243217
  message: "Where should we create your project?",
242833
243218
  placeholder: suggestedPath,
@@ -243590,6 +243975,7 @@ function getTypesCommand(context) {
243590
243975
  }
243591
243976
 
243592
243977
  // src/cli/dev/dev-server/main.ts
243978
+ import { dirname as dirname15, join as join18 } from "node:path";
243593
243979
  var import_cors = __toESM(require_lib4(), 1);
243594
243980
  var import_express4 = __toESM(require_express2(), 1);
243595
243981
 
@@ -243748,9 +244134,9 @@ function createDevLogger() {
243748
244134
 
243749
244135
  // src/cli/dev/dev-server/function-manager.ts
243750
244136
  import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
243751
- import { dirname as dirname11, join as join15 } from "node:path";
244137
+ import { dirname as dirname12, join as join15 } from "node:path";
243752
244138
  import { fileURLToPath as fileURLToPath7 } from "node:url";
243753
- var __dirname5 = dirname11(fileURLToPath7(import.meta.url));
244139
+ var __dirname5 = dirname12(fileURLToPath7(import.meta.url));
243754
244140
  var WRAPPER_PATH = join15(__dirname5, "../deno-runtime/main.js");
243755
244141
  var READY_TIMEOUT = 30000;
243756
244142
 
@@ -243797,6 +244183,10 @@ class FunctionManager {
243797
244183
  try {
243798
244184
  return await promise2;
243799
244185
  } finally {
244186
+ if (!this.starting.has(name2) && this.running.has(name2)) {
244187
+ this.running.get(name2)?.process.kill();
244188
+ this.running.delete(name2);
244189
+ }
243800
244190
  this.starting.delete(name2);
243801
244191
  }
243802
244192
  }
@@ -243812,9 +244202,13 @@ class FunctionManager {
243812
244202
  this.setupProcessHandlers(name2, process21);
243813
244203
  return this.waitForReady(name2, runningFunc);
243814
244204
  }
244205
+ reload(functions) {
244206
+ this.stopAll();
244207
+ this.functions = new Map(functions.map((f7) => [f7.name, f7]));
244208
+ }
243815
244209
  stopAll() {
243816
244210
  for (const [name2, { process: process21 }] of this.running) {
243817
- this.logger.log(`[dev-server] Stopping function: ${name2}`);
244211
+ this.logger.log(`Stopping function: ${name2}`);
243818
244212
  process21.kill();
243819
244213
  }
243820
244214
  this.running.clear();
@@ -243825,7 +244219,7 @@ class FunctionManager {
243825
244219
  return getPorts({ exclude: usedPorts });
243826
244220
  }
243827
244221
  spawnFunction(func, port) {
243828
- this.logger.log(`[dev-server] Spawning function "${func.name}" on port ${port}`);
244222
+ this.logger.log(`Spawning function "${func.name}" on port ${port}`);
243829
244223
  const process21 = spawn2("deno", ["run", "--allow-all", WRAPPER_PATH], {
243830
244224
  env: {
243831
244225
  ...globalThis.process.env,
@@ -243853,11 +244247,13 @@ class FunctionManager {
243853
244247
  }
243854
244248
  });
243855
244249
  process21.on("exit", (code2) => {
243856
- this.logger.log(`[dev-server] Function "${name2}" exited with code ${code2}`);
244250
+ if (code2 !== null) {
244251
+ this.logger.log(`Function "${name2}" exited with code ${code2}`);
244252
+ }
243857
244253
  this.running.delete(name2);
243858
244254
  });
243859
244255
  process21.on("error", (error48) => {
243860
- this.logger.error(`[dev-server] Function "${name2}" error:`, error48);
244256
+ this.logger.error(`Function "${name2}" error:`, error48);
243861
244257
  this.running.delete(name2);
243862
244258
  });
243863
244259
  }
@@ -244308,6 +244704,1707 @@ function createCustomIntegrationRoutes(remoteProxy, logger) {
244308
244704
  return router;
244309
244705
  }
244310
244706
 
244707
+ // src/cli/dev/dev-server/watcher.ts
244708
+ import { EventEmitter as EventEmitter4 } from "node:events";
244709
+ import { relative as relative6 } from "node:path";
244710
+
244711
+ // node_modules/chokidar/index.js
244712
+ import { EventEmitter as EventEmitter3 } from "node:events";
244713
+ import { stat as statcb, Stats } from "node:fs";
244714
+ import { readdir as readdir3, stat as stat4 } from "node:fs/promises";
244715
+ import * as sp3 from "node:path";
244716
+
244717
+ // node_modules/readdirp/index.js
244718
+ import { lstat as lstat2, readdir as readdir2, realpath, stat as stat2 } from "node:fs/promises";
244719
+ import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
244720
+ import { Readable as Readable6 } from "node:stream";
244721
+ var EntryTypes = {
244722
+ FILE_TYPE: "files",
244723
+ DIR_TYPE: "directories",
244724
+ FILE_DIR_TYPE: "files_directories",
244725
+ EVERYTHING_TYPE: "all"
244726
+ };
244727
+ var defaultOptions = {
244728
+ root: ".",
244729
+ fileFilter: (_entryInfo) => true,
244730
+ directoryFilter: (_entryInfo) => true,
244731
+ type: EntryTypes.FILE_TYPE,
244732
+ lstat: false,
244733
+ depth: 2147483648,
244734
+ alwaysStat: false,
244735
+ highWaterMark: 4096
244736
+ };
244737
+ Object.freeze(defaultOptions);
244738
+ var RECURSIVE_ERROR_CODE = "READDIRP_RECURSIVE_ERROR";
244739
+ var NORMAL_FLOW_ERRORS = new Set(["ENOENT", "EPERM", "EACCES", "ELOOP", RECURSIVE_ERROR_CODE]);
244740
+ var ALL_TYPES = [
244741
+ EntryTypes.DIR_TYPE,
244742
+ EntryTypes.EVERYTHING_TYPE,
244743
+ EntryTypes.FILE_DIR_TYPE,
244744
+ EntryTypes.FILE_TYPE
244745
+ ];
244746
+ var DIR_TYPES = new Set([
244747
+ EntryTypes.DIR_TYPE,
244748
+ EntryTypes.EVERYTHING_TYPE,
244749
+ EntryTypes.FILE_DIR_TYPE
244750
+ ]);
244751
+ var FILE_TYPES2 = new Set([
244752
+ EntryTypes.EVERYTHING_TYPE,
244753
+ EntryTypes.FILE_DIR_TYPE,
244754
+ EntryTypes.FILE_TYPE
244755
+ ]);
244756
+ var isNormalFlowError = (error48) => NORMAL_FLOW_ERRORS.has(error48.code);
244757
+ var wantBigintFsStats = process.platform === "win32";
244758
+ var emptyFn = (_entryInfo) => true;
244759
+ var normalizeFilter = (filter2) => {
244760
+ if (filter2 === undefined)
244761
+ return emptyFn;
244762
+ if (typeof filter2 === "function")
244763
+ return filter2;
244764
+ if (typeof filter2 === "string") {
244765
+ const fl6 = filter2.trim();
244766
+ return (entry) => entry.basename === fl6;
244767
+ }
244768
+ if (Array.isArray(filter2)) {
244769
+ const trItems = filter2.map((item) => item.trim());
244770
+ return (entry) => trItems.some((f7) => entry.basename === f7);
244771
+ }
244772
+ return emptyFn;
244773
+ };
244774
+
244775
+ class ReaddirpStream extends Readable6 {
244776
+ parents;
244777
+ reading;
244778
+ parent;
244779
+ _stat;
244780
+ _maxDepth;
244781
+ _wantsDir;
244782
+ _wantsFile;
244783
+ _wantsEverything;
244784
+ _root;
244785
+ _isDirent;
244786
+ _statsProp;
244787
+ _rdOptions;
244788
+ _fileFilter;
244789
+ _directoryFilter;
244790
+ constructor(options8 = {}) {
244791
+ super({
244792
+ objectMode: true,
244793
+ autoDestroy: true,
244794
+ highWaterMark: options8.highWaterMark
244795
+ });
244796
+ const opts = { ...defaultOptions, ...options8 };
244797
+ const { root: root2, type } = opts;
244798
+ this._fileFilter = normalizeFilter(opts.fileFilter);
244799
+ this._directoryFilter = normalizeFilter(opts.directoryFilter);
244800
+ const statMethod = opts.lstat ? lstat2 : stat2;
244801
+ if (wantBigintFsStats) {
244802
+ this._stat = (path19) => statMethod(path19, { bigint: true });
244803
+ } else {
244804
+ this._stat = statMethod;
244805
+ }
244806
+ this._maxDepth = opts.depth != null && Number.isSafeInteger(opts.depth) ? opts.depth : defaultOptions.depth;
244807
+ this._wantsDir = type ? DIR_TYPES.has(type) : false;
244808
+ this._wantsFile = type ? FILE_TYPES2.has(type) : false;
244809
+ this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
244810
+ this._root = presolve(root2);
244811
+ this._isDirent = !opts.alwaysStat;
244812
+ this._statsProp = this._isDirent ? "dirent" : "stats";
244813
+ this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
244814
+ this.parents = [this._exploreDir(root2, 1)];
244815
+ this.reading = false;
244816
+ this.parent = undefined;
244817
+ }
244818
+ async _read(batch) {
244819
+ if (this.reading)
244820
+ return;
244821
+ this.reading = true;
244822
+ try {
244823
+ while (!this.destroyed && batch > 0) {
244824
+ const par = this.parent;
244825
+ const fil = par && par.files;
244826
+ if (fil && fil.length > 0) {
244827
+ const { path: path19, depth } = par;
244828
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path19));
244829
+ const awaited = await Promise.all(slice);
244830
+ for (const entry of awaited) {
244831
+ if (!entry)
244832
+ continue;
244833
+ if (this.destroyed)
244834
+ return;
244835
+ const entryType = await this._getEntryType(entry);
244836
+ if (entryType === "directory" && this._directoryFilter(entry)) {
244837
+ if (depth <= this._maxDepth) {
244838
+ this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
244839
+ }
244840
+ if (this._wantsDir) {
244841
+ this.push(entry);
244842
+ batch--;
244843
+ }
244844
+ } else if ((entryType === "file" || this._includeAsFile(entry)) && this._fileFilter(entry)) {
244845
+ if (this._wantsFile) {
244846
+ this.push(entry);
244847
+ batch--;
244848
+ }
244849
+ }
244850
+ }
244851
+ } else {
244852
+ const parent = this.parents.pop();
244853
+ if (!parent) {
244854
+ this.push(null);
244855
+ break;
244856
+ }
244857
+ this.parent = await parent;
244858
+ if (this.destroyed)
244859
+ return;
244860
+ }
244861
+ }
244862
+ } catch (error48) {
244863
+ this.destroy(error48);
244864
+ } finally {
244865
+ this.reading = false;
244866
+ }
244867
+ }
244868
+ async _exploreDir(path19, depth) {
244869
+ let files;
244870
+ try {
244871
+ files = await readdir2(path19, this._rdOptions);
244872
+ } catch (error48) {
244873
+ this._onError(error48);
244874
+ }
244875
+ return { files, depth, path: path19 };
244876
+ }
244877
+ async _formatEntry(dirent, path19) {
244878
+ let entry;
244879
+ const basename4 = this._isDirent ? dirent.name : dirent;
244880
+ try {
244881
+ const fullPath = presolve(pjoin(path19, basename4));
244882
+ entry = { path: prelative(this._root, fullPath), fullPath, basename: basename4 };
244883
+ entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
244884
+ } catch (err) {
244885
+ this._onError(err);
244886
+ return;
244887
+ }
244888
+ return entry;
244889
+ }
244890
+ _onError(err) {
244891
+ if (isNormalFlowError(err) && !this.destroyed) {
244892
+ this.emit("warn", err);
244893
+ } else {
244894
+ this.destroy(err);
244895
+ }
244896
+ }
244897
+ async _getEntryType(entry) {
244898
+ if (!entry && this._statsProp in entry) {
244899
+ return "";
244900
+ }
244901
+ const stats = entry[this._statsProp];
244902
+ if (stats.isFile())
244903
+ return "file";
244904
+ if (stats.isDirectory())
244905
+ return "directory";
244906
+ if (stats && stats.isSymbolicLink()) {
244907
+ const full = entry.fullPath;
244908
+ try {
244909
+ const entryRealPath = await realpath(full);
244910
+ const entryRealPathStats = await lstat2(entryRealPath);
244911
+ if (entryRealPathStats.isFile()) {
244912
+ return "file";
244913
+ }
244914
+ if (entryRealPathStats.isDirectory()) {
244915
+ const len = entryRealPath.length;
244916
+ if (full.startsWith(entryRealPath) && full.substr(len, 1) === psep) {
244917
+ const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
244918
+ recursiveError.code = RECURSIVE_ERROR_CODE;
244919
+ return this._onError(recursiveError);
244920
+ }
244921
+ return "directory";
244922
+ }
244923
+ } catch (error48) {
244924
+ this._onError(error48);
244925
+ return "";
244926
+ }
244927
+ }
244928
+ }
244929
+ _includeAsFile(entry) {
244930
+ const stats = entry && entry[this._statsProp];
244931
+ return stats && this._wantsEverything && !stats.isDirectory();
244932
+ }
244933
+ }
244934
+ function readdirp(root2, options8 = {}) {
244935
+ let type = options8.entryType || options8.type;
244936
+ if (type === "both")
244937
+ type = EntryTypes.FILE_DIR_TYPE;
244938
+ if (type)
244939
+ options8.type = type;
244940
+ if (!root2) {
244941
+ throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");
244942
+ } else if (typeof root2 !== "string") {
244943
+ throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");
244944
+ } else if (type && !ALL_TYPES.includes(type)) {
244945
+ throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(", ")}`);
244946
+ }
244947
+ options8.root = root2;
244948
+ return new ReaddirpStream(options8);
244949
+ }
244950
+
244951
+ // node_modules/chokidar/handler.js
244952
+ import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
244953
+ import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat3 } from "node:fs/promises";
244954
+ import { type as osType } from "node:os";
244955
+ import * as sp2 from "node:path";
244956
+ var STR_DATA = "data";
244957
+ var STR_END = "end";
244958
+ var STR_CLOSE = "close";
244959
+ var EMPTY_FN = () => {};
244960
+ var pl6 = process.platform;
244961
+ var isWindows4 = pl6 === "win32";
244962
+ var isMacos = pl6 === "darwin";
244963
+ var isLinux = pl6 === "linux";
244964
+ var isFreeBSD = pl6 === "freebsd";
244965
+ var isIBMi = osType() === "OS400";
244966
+ var EVENTS = {
244967
+ ALL: "all",
244968
+ READY: "ready",
244969
+ ADD: "add",
244970
+ CHANGE: "change",
244971
+ ADD_DIR: "addDir",
244972
+ UNLINK: "unlink",
244973
+ UNLINK_DIR: "unlinkDir",
244974
+ RAW: "raw",
244975
+ ERROR: "error"
244976
+ };
244977
+ var EV = EVENTS;
244978
+ var THROTTLE_MODE_WATCH = "watch";
244979
+ var statMethods = { lstat: lstat3, stat: stat3 };
244980
+ var KEY_LISTENERS = "listeners";
244981
+ var KEY_ERR = "errHandlers";
244982
+ var KEY_RAW = "rawEmitters";
244983
+ var HANDLER_KEYS2 = [KEY_LISTENERS, KEY_ERR, KEY_RAW];
244984
+ var binaryExtensions = new Set([
244985
+ "3dm",
244986
+ "3ds",
244987
+ "3g2",
244988
+ "3gp",
244989
+ "7z",
244990
+ "a",
244991
+ "aac",
244992
+ "adp",
244993
+ "afdesign",
244994
+ "afphoto",
244995
+ "afpub",
244996
+ "ai",
244997
+ "aif",
244998
+ "aiff",
244999
+ "alz",
245000
+ "ape",
245001
+ "apk",
245002
+ "appimage",
245003
+ "ar",
245004
+ "arj",
245005
+ "asf",
245006
+ "au",
245007
+ "avi",
245008
+ "bak",
245009
+ "baml",
245010
+ "bh",
245011
+ "bin",
245012
+ "bk",
245013
+ "bmp",
245014
+ "btif",
245015
+ "bz2",
245016
+ "bzip2",
245017
+ "cab",
245018
+ "caf",
245019
+ "cgm",
245020
+ "class",
245021
+ "cmx",
245022
+ "cpio",
245023
+ "cr2",
245024
+ "cur",
245025
+ "dat",
245026
+ "dcm",
245027
+ "deb",
245028
+ "dex",
245029
+ "djvu",
245030
+ "dll",
245031
+ "dmg",
245032
+ "dng",
245033
+ "doc",
245034
+ "docm",
245035
+ "docx",
245036
+ "dot",
245037
+ "dotm",
245038
+ "dra",
245039
+ "DS_Store",
245040
+ "dsk",
245041
+ "dts",
245042
+ "dtshd",
245043
+ "dvb",
245044
+ "dwg",
245045
+ "dxf",
245046
+ "ecelp4800",
245047
+ "ecelp7470",
245048
+ "ecelp9600",
245049
+ "egg",
245050
+ "eol",
245051
+ "eot",
245052
+ "epub",
245053
+ "exe",
245054
+ "f4v",
245055
+ "fbs",
245056
+ "fh",
245057
+ "fla",
245058
+ "flac",
245059
+ "flatpak",
245060
+ "fli",
245061
+ "flv",
245062
+ "fpx",
245063
+ "fst",
245064
+ "fvt",
245065
+ "g3",
245066
+ "gh",
245067
+ "gif",
245068
+ "graffle",
245069
+ "gz",
245070
+ "gzip",
245071
+ "h261",
245072
+ "h263",
245073
+ "h264",
245074
+ "icns",
245075
+ "ico",
245076
+ "ief",
245077
+ "img",
245078
+ "ipa",
245079
+ "iso",
245080
+ "jar",
245081
+ "jpeg",
245082
+ "jpg",
245083
+ "jpgv",
245084
+ "jpm",
245085
+ "jxr",
245086
+ "key",
245087
+ "ktx",
245088
+ "lha",
245089
+ "lib",
245090
+ "lvp",
245091
+ "lz",
245092
+ "lzh",
245093
+ "lzma",
245094
+ "lzo",
245095
+ "m3u",
245096
+ "m4a",
245097
+ "m4v",
245098
+ "mar",
245099
+ "mdi",
245100
+ "mht",
245101
+ "mid",
245102
+ "midi",
245103
+ "mj2",
245104
+ "mka",
245105
+ "mkv",
245106
+ "mmr",
245107
+ "mng",
245108
+ "mobi",
245109
+ "mov",
245110
+ "movie",
245111
+ "mp3",
245112
+ "mp4",
245113
+ "mp4a",
245114
+ "mpeg",
245115
+ "mpg",
245116
+ "mpga",
245117
+ "mxu",
245118
+ "nef",
245119
+ "npx",
245120
+ "numbers",
245121
+ "nupkg",
245122
+ "o",
245123
+ "odp",
245124
+ "ods",
245125
+ "odt",
245126
+ "oga",
245127
+ "ogg",
245128
+ "ogv",
245129
+ "otf",
245130
+ "ott",
245131
+ "pages",
245132
+ "pbm",
245133
+ "pcx",
245134
+ "pdb",
245135
+ "pdf",
245136
+ "pea",
245137
+ "pgm",
245138
+ "pic",
245139
+ "png",
245140
+ "pnm",
245141
+ "pot",
245142
+ "potm",
245143
+ "potx",
245144
+ "ppa",
245145
+ "ppam",
245146
+ "ppm",
245147
+ "pps",
245148
+ "ppsm",
245149
+ "ppsx",
245150
+ "ppt",
245151
+ "pptm",
245152
+ "pptx",
245153
+ "psd",
245154
+ "pya",
245155
+ "pyc",
245156
+ "pyo",
245157
+ "pyv",
245158
+ "qt",
245159
+ "rar",
245160
+ "ras",
245161
+ "raw",
245162
+ "resources",
245163
+ "rgb",
245164
+ "rip",
245165
+ "rlc",
245166
+ "rmf",
245167
+ "rmvb",
245168
+ "rpm",
245169
+ "rtf",
245170
+ "rz",
245171
+ "s3m",
245172
+ "s7z",
245173
+ "scpt",
245174
+ "sgi",
245175
+ "shar",
245176
+ "snap",
245177
+ "sil",
245178
+ "sketch",
245179
+ "slk",
245180
+ "smv",
245181
+ "snk",
245182
+ "so",
245183
+ "stl",
245184
+ "suo",
245185
+ "sub",
245186
+ "swf",
245187
+ "tar",
245188
+ "tbz",
245189
+ "tbz2",
245190
+ "tga",
245191
+ "tgz",
245192
+ "thmx",
245193
+ "tif",
245194
+ "tiff",
245195
+ "tlz",
245196
+ "ttc",
245197
+ "ttf",
245198
+ "txz",
245199
+ "udf",
245200
+ "uvh",
245201
+ "uvi",
245202
+ "uvm",
245203
+ "uvp",
245204
+ "uvs",
245205
+ "uvu",
245206
+ "viv",
245207
+ "vob",
245208
+ "war",
245209
+ "wav",
245210
+ "wax",
245211
+ "wbmp",
245212
+ "wdp",
245213
+ "weba",
245214
+ "webm",
245215
+ "webp",
245216
+ "whl",
245217
+ "wim",
245218
+ "wm",
245219
+ "wma",
245220
+ "wmv",
245221
+ "wmx",
245222
+ "woff",
245223
+ "woff2",
245224
+ "wrm",
245225
+ "wvx",
245226
+ "xbm",
245227
+ "xif",
245228
+ "xla",
245229
+ "xlam",
245230
+ "xls",
245231
+ "xlsb",
245232
+ "xlsm",
245233
+ "xlsx",
245234
+ "xlt",
245235
+ "xltm",
245236
+ "xltx",
245237
+ "xm",
245238
+ "xmind",
245239
+ "xpi",
245240
+ "xpm",
245241
+ "xwd",
245242
+ "xz",
245243
+ "z",
245244
+ "zip",
245245
+ "zipx"
245246
+ ]);
245247
+ var isBinaryPath = (filePath) => binaryExtensions.has(sp2.extname(filePath).slice(1).toLowerCase());
245248
+ var foreach = (val, fn9) => {
245249
+ if (val instanceof Set) {
245250
+ val.forEach(fn9);
245251
+ } else {
245252
+ fn9(val);
245253
+ }
245254
+ };
245255
+ var addAndConvert = (main, prop, item) => {
245256
+ let container = main[prop];
245257
+ if (!(container instanceof Set)) {
245258
+ main[prop] = container = new Set([container]);
245259
+ }
245260
+ container.add(item);
245261
+ };
245262
+ var clearItem = (cont) => (key2) => {
245263
+ const set2 = cont[key2];
245264
+ if (set2 instanceof Set) {
245265
+ set2.clear();
245266
+ } else {
245267
+ delete cont[key2];
245268
+ }
245269
+ };
245270
+ var delFromSet = (main, prop, item) => {
245271
+ const container = main[prop];
245272
+ if (container instanceof Set) {
245273
+ container.delete(item);
245274
+ } else if (container === item) {
245275
+ delete main[prop];
245276
+ }
245277
+ };
245278
+ var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
245279
+ var FsWatchInstances = new Map;
245280
+ function createFsWatchInstance(path19, options8, listener, errHandler, emitRaw) {
245281
+ const handleEvent = (rawEvent, evPath) => {
245282
+ listener(path19);
245283
+ emitRaw(rawEvent, evPath, { watchedPath: path19 });
245284
+ if (evPath && path19 !== evPath) {
245285
+ fsWatchBroadcast(sp2.resolve(path19, evPath), KEY_LISTENERS, sp2.join(path19, evPath));
245286
+ }
245287
+ };
245288
+ try {
245289
+ return fs_watch(path19, {
245290
+ persistent: options8.persistent
245291
+ }, handleEvent);
245292
+ } catch (error48) {
245293
+ errHandler(error48);
245294
+ return;
245295
+ }
245296
+ }
245297
+ var fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
245298
+ const cont = FsWatchInstances.get(fullPath);
245299
+ if (!cont)
245300
+ return;
245301
+ foreach(cont[listenerType], (listener) => {
245302
+ listener(val1, val2, val3);
245303
+ });
245304
+ };
245305
+ var setFsWatchListener = (path19, fullPath, options8, handlers) => {
245306
+ const { listener, errHandler, rawEmitter } = handlers;
245307
+ let cont = FsWatchInstances.get(fullPath);
245308
+ let watcher;
245309
+ if (!options8.persistent) {
245310
+ watcher = createFsWatchInstance(path19, options8, listener, errHandler, rawEmitter);
245311
+ if (!watcher)
245312
+ return;
245313
+ return watcher.close.bind(watcher);
245314
+ }
245315
+ if (cont) {
245316
+ addAndConvert(cont, KEY_LISTENERS, listener);
245317
+ addAndConvert(cont, KEY_ERR, errHandler);
245318
+ addAndConvert(cont, KEY_RAW, rawEmitter);
245319
+ } else {
245320
+ watcher = createFsWatchInstance(path19, options8, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
245321
+ if (!watcher)
245322
+ return;
245323
+ watcher.on(EV.ERROR, async (error48) => {
245324
+ const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
245325
+ if (cont)
245326
+ cont.watcherUnusable = true;
245327
+ if (isWindows4 && error48.code === "EPERM") {
245328
+ try {
245329
+ const fd = await open2(path19, "r");
245330
+ await fd.close();
245331
+ broadcastErr(error48);
245332
+ } catch (err) {}
245333
+ } else {
245334
+ broadcastErr(error48);
245335
+ }
245336
+ });
245337
+ cont = {
245338
+ listeners: listener,
245339
+ errHandlers: errHandler,
245340
+ rawEmitters: rawEmitter,
245341
+ watcher
245342
+ };
245343
+ FsWatchInstances.set(fullPath, cont);
245344
+ }
245345
+ return () => {
245346
+ delFromSet(cont, KEY_LISTENERS, listener);
245347
+ delFromSet(cont, KEY_ERR, errHandler);
245348
+ delFromSet(cont, KEY_RAW, rawEmitter);
245349
+ if (isEmptySet(cont.listeners)) {
245350
+ cont.watcher.close();
245351
+ FsWatchInstances.delete(fullPath);
245352
+ HANDLER_KEYS2.forEach(clearItem(cont));
245353
+ cont.watcher = undefined;
245354
+ Object.freeze(cont);
245355
+ }
245356
+ };
245357
+ };
245358
+ var FsWatchFileInstances = new Map;
245359
+ var setFsWatchFileListener = (path19, fullPath, options8, handlers) => {
245360
+ const { listener, rawEmitter } = handlers;
245361
+ let cont = FsWatchFileInstances.get(fullPath);
245362
+ const copts = cont && cont.options;
245363
+ if (copts && (copts.persistent < options8.persistent || copts.interval > options8.interval)) {
245364
+ unwatchFile(fullPath);
245365
+ cont = undefined;
245366
+ }
245367
+ if (cont) {
245368
+ addAndConvert(cont, KEY_LISTENERS, listener);
245369
+ addAndConvert(cont, KEY_RAW, rawEmitter);
245370
+ } else {
245371
+ cont = {
245372
+ listeners: listener,
245373
+ rawEmitters: rawEmitter,
245374
+ options: options8,
245375
+ watcher: watchFile(fullPath, options8, (curr, prev) => {
245376
+ foreach(cont.rawEmitters, (rawEmitter2) => {
245377
+ rawEmitter2(EV.CHANGE, fullPath, { curr, prev });
245378
+ });
245379
+ const currmtime = curr.mtimeMs;
245380
+ if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
245381
+ foreach(cont.listeners, (listener2) => listener2(path19, curr));
245382
+ }
245383
+ })
245384
+ };
245385
+ FsWatchFileInstances.set(fullPath, cont);
245386
+ }
245387
+ return () => {
245388
+ delFromSet(cont, KEY_LISTENERS, listener);
245389
+ delFromSet(cont, KEY_RAW, rawEmitter);
245390
+ if (isEmptySet(cont.listeners)) {
245391
+ FsWatchFileInstances.delete(fullPath);
245392
+ unwatchFile(fullPath);
245393
+ cont.options = cont.watcher = undefined;
245394
+ Object.freeze(cont);
245395
+ }
245396
+ };
245397
+ };
245398
+
245399
+ class NodeFsHandler {
245400
+ fsw;
245401
+ _boundHandleError;
245402
+ constructor(fsW) {
245403
+ this.fsw = fsW;
245404
+ this._boundHandleError = (error48) => fsW._handleError(error48);
245405
+ }
245406
+ _watchWithNodeFs(path19, listener) {
245407
+ const opts = this.fsw.options;
245408
+ const directory = sp2.dirname(path19);
245409
+ const basename5 = sp2.basename(path19);
245410
+ const parent = this.fsw._getWatchedDir(directory);
245411
+ parent.add(basename5);
245412
+ const absolutePath = sp2.resolve(path19);
245413
+ const options8 = {
245414
+ persistent: opts.persistent
245415
+ };
245416
+ if (!listener)
245417
+ listener = EMPTY_FN;
245418
+ let closer;
245419
+ if (opts.usePolling) {
245420
+ const enableBin = opts.interval !== opts.binaryInterval;
245421
+ options8.interval = enableBin && isBinaryPath(basename5) ? opts.binaryInterval : opts.interval;
245422
+ closer = setFsWatchFileListener(path19, absolutePath, options8, {
245423
+ listener,
245424
+ rawEmitter: this.fsw._emitRaw
245425
+ });
245426
+ } else {
245427
+ closer = setFsWatchListener(path19, absolutePath, options8, {
245428
+ listener,
245429
+ errHandler: this._boundHandleError,
245430
+ rawEmitter: this.fsw._emitRaw
245431
+ });
245432
+ }
245433
+ return closer;
245434
+ }
245435
+ _handleFile(file2, stats, initialAdd) {
245436
+ if (this.fsw.closed) {
245437
+ return;
245438
+ }
245439
+ const dirname14 = sp2.dirname(file2);
245440
+ const basename5 = sp2.basename(file2);
245441
+ const parent = this.fsw._getWatchedDir(dirname14);
245442
+ let prevStats = stats;
245443
+ if (parent.has(basename5))
245444
+ return;
245445
+ const listener = async (path19, newStats) => {
245446
+ if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
245447
+ return;
245448
+ if (!newStats || newStats.mtimeMs === 0) {
245449
+ try {
245450
+ const newStats2 = await stat3(file2);
245451
+ if (this.fsw.closed)
245452
+ return;
245453
+ const at13 = newStats2.atimeMs;
245454
+ const mt12 = newStats2.mtimeMs;
245455
+ if (!at13 || at13 <= mt12 || mt12 !== prevStats.mtimeMs) {
245456
+ this.fsw._emit(EV.CHANGE, file2, newStats2);
245457
+ }
245458
+ if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
245459
+ this.fsw._closeFile(path19);
245460
+ prevStats = newStats2;
245461
+ const closer2 = this._watchWithNodeFs(file2, listener);
245462
+ if (closer2)
245463
+ this.fsw._addPathCloser(path19, closer2);
245464
+ } else {
245465
+ prevStats = newStats2;
245466
+ }
245467
+ } catch (error48) {
245468
+ this.fsw._remove(dirname14, basename5);
245469
+ }
245470
+ } else if (parent.has(basename5)) {
245471
+ const at13 = newStats.atimeMs;
245472
+ const mt12 = newStats.mtimeMs;
245473
+ if (!at13 || at13 <= mt12 || mt12 !== prevStats.mtimeMs) {
245474
+ this.fsw._emit(EV.CHANGE, file2, newStats);
245475
+ }
245476
+ prevStats = newStats;
245477
+ }
245478
+ };
245479
+ const closer = this._watchWithNodeFs(file2, listener);
245480
+ if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file2)) {
245481
+ if (!this.fsw._throttle(EV.ADD, file2, 0))
245482
+ return;
245483
+ this.fsw._emit(EV.ADD, file2, stats);
245484
+ }
245485
+ return closer;
245486
+ }
245487
+ async _handleSymlink(entry, directory, path19, item) {
245488
+ if (this.fsw.closed) {
245489
+ return;
245490
+ }
245491
+ const full = entry.fullPath;
245492
+ const dir = this.fsw._getWatchedDir(directory);
245493
+ if (!this.fsw.options.followSymlinks) {
245494
+ this.fsw._incrReadyCount();
245495
+ let linkPath;
245496
+ try {
245497
+ linkPath = await fsrealpath(path19);
245498
+ } catch (e8) {
245499
+ this.fsw._emitReady();
245500
+ return true;
245501
+ }
245502
+ if (this.fsw.closed)
245503
+ return;
245504
+ if (dir.has(item)) {
245505
+ if (this.fsw._symlinkPaths.get(full) !== linkPath) {
245506
+ this.fsw._symlinkPaths.set(full, linkPath);
245507
+ this.fsw._emit(EV.CHANGE, path19, entry.stats);
245508
+ }
245509
+ } else {
245510
+ dir.add(item);
245511
+ this.fsw._symlinkPaths.set(full, linkPath);
245512
+ this.fsw._emit(EV.ADD, path19, entry.stats);
245513
+ }
245514
+ this.fsw._emitReady();
245515
+ return true;
245516
+ }
245517
+ if (this.fsw._symlinkPaths.has(full)) {
245518
+ return true;
245519
+ }
245520
+ this.fsw._symlinkPaths.set(full, true);
245521
+ }
245522
+ _handleRead(directory, initialAdd, wh2, target, dir, depth, throttler) {
245523
+ directory = sp2.join(directory, "");
245524
+ const throttleKey = target ? `${directory}:${target}` : directory;
245525
+ throttler = this.fsw._throttle("readdir", throttleKey, 1000);
245526
+ if (!throttler)
245527
+ return;
245528
+ const previous = this.fsw._getWatchedDir(wh2.path);
245529
+ const current = new Set;
245530
+ let stream = this.fsw._readdirp(directory, {
245531
+ fileFilter: (entry) => wh2.filterPath(entry),
245532
+ directoryFilter: (entry) => wh2.filterDir(entry)
245533
+ });
245534
+ if (!stream)
245535
+ return;
245536
+ stream.on(STR_DATA, async (entry) => {
245537
+ if (this.fsw.closed) {
245538
+ stream = undefined;
245539
+ return;
245540
+ }
245541
+ const item = entry.path;
245542
+ let path19 = sp2.join(directory, item);
245543
+ current.add(item);
245544
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path19, item)) {
245545
+ return;
245546
+ }
245547
+ if (this.fsw.closed) {
245548
+ stream = undefined;
245549
+ return;
245550
+ }
245551
+ if (item === target || !target && !previous.has(item)) {
245552
+ this.fsw._incrReadyCount();
245553
+ path19 = sp2.join(dir, sp2.relative(dir, path19));
245554
+ this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
245555
+ }
245556
+ }).on(EV.ERROR, this._boundHandleError);
245557
+ return new Promise((resolve7, reject) => {
245558
+ if (!stream)
245559
+ return reject();
245560
+ stream.once(STR_END, () => {
245561
+ if (this.fsw.closed) {
245562
+ stream = undefined;
245563
+ return;
245564
+ }
245565
+ const wasThrottled = throttler ? throttler.clear() : false;
245566
+ resolve7(undefined);
245567
+ previous.getChildren().filter((item) => {
245568
+ return item !== directory && !current.has(item);
245569
+ }).forEach((item) => {
245570
+ this.fsw._remove(directory, item);
245571
+ });
245572
+ stream = undefined;
245573
+ if (wasThrottled)
245574
+ this._handleRead(directory, false, wh2, target, dir, depth, throttler);
245575
+ });
245576
+ });
245577
+ }
245578
+ async _handleDir(dir, stats, initialAdd, depth, target, wh2, realpath2) {
245579
+ const parentDir = this.fsw._getWatchedDir(sp2.dirname(dir));
245580
+ const tracked = parentDir.has(sp2.basename(dir));
245581
+ if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
245582
+ this.fsw._emit(EV.ADD_DIR, dir, stats);
245583
+ }
245584
+ parentDir.add(sp2.basename(dir));
245585
+ this.fsw._getWatchedDir(dir);
245586
+ let throttler;
245587
+ let closer;
245588
+ const oDepth = this.fsw.options.depth;
245589
+ if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath2)) {
245590
+ if (!target) {
245591
+ await this._handleRead(dir, initialAdd, wh2, target, dir, depth, throttler);
245592
+ if (this.fsw.closed)
245593
+ return;
245594
+ }
245595
+ closer = this._watchWithNodeFs(dir, (dirPath, stats2) => {
245596
+ if (stats2 && stats2.mtimeMs === 0)
245597
+ return;
245598
+ this._handleRead(dirPath, false, wh2, target, dir, depth, throttler);
245599
+ });
245600
+ }
245601
+ return closer;
245602
+ }
245603
+ async _addToNodeFs(path19, initialAdd, priorWh, depth, target) {
245604
+ const ready = this.fsw._emitReady;
245605
+ if (this.fsw._isIgnored(path19) || this.fsw.closed) {
245606
+ ready();
245607
+ return false;
245608
+ }
245609
+ const wh2 = this.fsw._getWatchHelpers(path19);
245610
+ if (priorWh) {
245611
+ wh2.filterPath = (entry) => priorWh.filterPath(entry);
245612
+ wh2.filterDir = (entry) => priorWh.filterDir(entry);
245613
+ }
245614
+ try {
245615
+ const stats = await statMethods[wh2.statMethod](wh2.watchPath);
245616
+ if (this.fsw.closed)
245617
+ return;
245618
+ if (this.fsw._isIgnored(wh2.watchPath, stats)) {
245619
+ ready();
245620
+ return false;
245621
+ }
245622
+ const follow = this.fsw.options.followSymlinks;
245623
+ let closer;
245624
+ if (stats.isDirectory()) {
245625
+ const absPath = sp2.resolve(path19);
245626
+ const targetPath = follow ? await fsrealpath(path19) : path19;
245627
+ if (this.fsw.closed)
245628
+ return;
245629
+ closer = await this._handleDir(wh2.watchPath, stats, initialAdd, depth, target, wh2, targetPath);
245630
+ if (this.fsw.closed)
245631
+ return;
245632
+ if (absPath !== targetPath && targetPath !== undefined) {
245633
+ this.fsw._symlinkPaths.set(absPath, targetPath);
245634
+ }
245635
+ } else if (stats.isSymbolicLink()) {
245636
+ const targetPath = follow ? await fsrealpath(path19) : path19;
245637
+ if (this.fsw.closed)
245638
+ return;
245639
+ const parent = sp2.dirname(wh2.watchPath);
245640
+ this.fsw._getWatchedDir(parent).add(wh2.watchPath);
245641
+ this.fsw._emit(EV.ADD, wh2.watchPath, stats);
245642
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path19, wh2, targetPath);
245643
+ if (this.fsw.closed)
245644
+ return;
245645
+ if (targetPath !== undefined) {
245646
+ this.fsw._symlinkPaths.set(sp2.resolve(path19), targetPath);
245647
+ }
245648
+ } else {
245649
+ closer = this._handleFile(wh2.watchPath, stats, initialAdd);
245650
+ }
245651
+ ready();
245652
+ if (closer)
245653
+ this.fsw._addPathCloser(path19, closer);
245654
+ return false;
245655
+ } catch (error48) {
245656
+ if (this.fsw._handleError(error48)) {
245657
+ ready();
245658
+ return path19;
245659
+ }
245660
+ }
245661
+ }
245662
+ }
245663
+
245664
+ // node_modules/chokidar/index.js
245665
+ /*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
245666
+ var SLASH = "/";
245667
+ var SLASH_SLASH = "//";
245668
+ var ONE_DOT = ".";
245669
+ var TWO_DOTS = "..";
245670
+ var STRING_TYPE = "string";
245671
+ var BACK_SLASH_RE = /\\/g;
245672
+ var DOUBLE_SLASH_RE = /\/\//g;
245673
+ var DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
245674
+ var REPLACER_RE = /^\.[/\\]/;
245675
+ function arrify(item) {
245676
+ return Array.isArray(item) ? item : [item];
245677
+ }
245678
+ var isMatcherObject = (matcher) => typeof matcher === "object" && matcher !== null && !(matcher instanceof RegExp);
245679
+ function createPattern(matcher) {
245680
+ if (typeof matcher === "function")
245681
+ return matcher;
245682
+ if (typeof matcher === "string")
245683
+ return (string4) => matcher === string4;
245684
+ if (matcher instanceof RegExp)
245685
+ return (string4) => matcher.test(string4);
245686
+ if (typeof matcher === "object" && matcher !== null) {
245687
+ return (string4) => {
245688
+ if (matcher.path === string4)
245689
+ return true;
245690
+ if (matcher.recursive) {
245691
+ const relative6 = sp3.relative(matcher.path, string4);
245692
+ if (!relative6) {
245693
+ return false;
245694
+ }
245695
+ return !relative6.startsWith("..") && !sp3.isAbsolute(relative6);
245696
+ }
245697
+ return false;
245698
+ };
245699
+ }
245700
+ return () => false;
245701
+ }
245702
+ function normalizePath(path19) {
245703
+ if (typeof path19 !== "string")
245704
+ throw new Error("string expected");
245705
+ path19 = sp3.normalize(path19);
245706
+ path19 = path19.replace(/\\/g, "/");
245707
+ let prepend = false;
245708
+ if (path19.startsWith("//"))
245709
+ prepend = true;
245710
+ path19 = path19.replace(DOUBLE_SLASH_RE, "/");
245711
+ if (prepend)
245712
+ path19 = "/" + path19;
245713
+ return path19;
245714
+ }
245715
+ function matchPatterns(patterns, testString, stats) {
245716
+ const path19 = normalizePath(testString);
245717
+ for (let index = 0;index < patterns.length; index++) {
245718
+ const pattern = patterns[index];
245719
+ if (pattern(path19, stats)) {
245720
+ return true;
245721
+ }
245722
+ }
245723
+ return false;
245724
+ }
245725
+ function anymatch(matchers, testString) {
245726
+ if (matchers == null) {
245727
+ throw new TypeError("anymatch: specify first argument");
245728
+ }
245729
+ const matchersArray = arrify(matchers);
245730
+ const patterns = matchersArray.map((matcher) => createPattern(matcher));
245731
+ if (testString == null) {
245732
+ return (testString2, stats) => {
245733
+ return matchPatterns(patterns, testString2, stats);
245734
+ };
245735
+ }
245736
+ return matchPatterns(patterns, testString);
245737
+ }
245738
+ var unifyPaths = (paths_) => {
245739
+ const paths = arrify(paths_).flat();
245740
+ if (!paths.every((p4) => typeof p4 === STRING_TYPE)) {
245741
+ throw new TypeError(`Non-string provided as watch path: ${paths}`);
245742
+ }
245743
+ return paths.map(normalizePathToUnix);
245744
+ };
245745
+ var toUnix = (string4) => {
245746
+ let str = string4.replace(BACK_SLASH_RE, SLASH);
245747
+ let prepend = false;
245748
+ if (str.startsWith(SLASH_SLASH)) {
245749
+ prepend = true;
245750
+ }
245751
+ str = str.replace(DOUBLE_SLASH_RE, SLASH);
245752
+ if (prepend) {
245753
+ str = SLASH + str;
245754
+ }
245755
+ return str;
245756
+ };
245757
+ var normalizePathToUnix = (path19) => toUnix(sp3.normalize(toUnix(path19)));
245758
+ var normalizeIgnored = (cwd = "") => (path19) => {
245759
+ if (typeof path19 === "string") {
245760
+ return normalizePathToUnix(sp3.isAbsolute(path19) ? path19 : sp3.join(cwd, path19));
245761
+ } else {
245762
+ return path19;
245763
+ }
245764
+ };
245765
+ var getAbsolutePath = (path19, cwd) => {
245766
+ if (sp3.isAbsolute(path19)) {
245767
+ return path19;
245768
+ }
245769
+ return sp3.join(cwd, path19);
245770
+ };
245771
+ var EMPTY_SET = Object.freeze(new Set);
245772
+
245773
+ class DirEntry {
245774
+ path;
245775
+ _removeWatcher;
245776
+ items;
245777
+ constructor(dir, removeWatcher) {
245778
+ this.path = dir;
245779
+ this._removeWatcher = removeWatcher;
245780
+ this.items = new Set;
245781
+ }
245782
+ add(item) {
245783
+ const { items } = this;
245784
+ if (!items)
245785
+ return;
245786
+ if (item !== ONE_DOT && item !== TWO_DOTS)
245787
+ items.add(item);
245788
+ }
245789
+ async remove(item) {
245790
+ const { items } = this;
245791
+ if (!items)
245792
+ return;
245793
+ items.delete(item);
245794
+ if (items.size > 0)
245795
+ return;
245796
+ const dir = this.path;
245797
+ try {
245798
+ await readdir3(dir);
245799
+ } catch (err) {
245800
+ if (this._removeWatcher) {
245801
+ this._removeWatcher(sp3.dirname(dir), sp3.basename(dir));
245802
+ }
245803
+ }
245804
+ }
245805
+ has(item) {
245806
+ const { items } = this;
245807
+ if (!items)
245808
+ return;
245809
+ return items.has(item);
245810
+ }
245811
+ getChildren() {
245812
+ const { items } = this;
245813
+ if (!items)
245814
+ return [];
245815
+ return [...items.values()];
245816
+ }
245817
+ dispose() {
245818
+ this.items.clear();
245819
+ this.path = "";
245820
+ this._removeWatcher = EMPTY_FN;
245821
+ this.items = EMPTY_SET;
245822
+ Object.freeze(this);
245823
+ }
245824
+ }
245825
+ var STAT_METHOD_F = "stat";
245826
+ var STAT_METHOD_L = "lstat";
245827
+
245828
+ class WatchHelper {
245829
+ fsw;
245830
+ path;
245831
+ watchPath;
245832
+ fullWatchPath;
245833
+ dirParts;
245834
+ followSymlinks;
245835
+ statMethod;
245836
+ constructor(path19, follow, fsw) {
245837
+ this.fsw = fsw;
245838
+ const watchPath = path19;
245839
+ this.path = path19 = path19.replace(REPLACER_RE, "");
245840
+ this.watchPath = watchPath;
245841
+ this.fullWatchPath = sp3.resolve(watchPath);
245842
+ this.dirParts = [];
245843
+ this.dirParts.forEach((parts) => {
245844
+ if (parts.length > 1)
245845
+ parts.pop();
245846
+ });
245847
+ this.followSymlinks = follow;
245848
+ this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
245849
+ }
245850
+ entryPath(entry) {
245851
+ return sp3.join(this.watchPath, sp3.relative(this.watchPath, entry.fullPath));
245852
+ }
245853
+ filterPath(entry) {
245854
+ const { stats } = entry;
245855
+ if (stats && stats.isSymbolicLink())
245856
+ return this.filterDir(entry);
245857
+ const resolvedPath = this.entryPath(entry);
245858
+ return this.fsw._isntIgnored(resolvedPath, stats) && this.fsw._hasReadPermissions(stats);
245859
+ }
245860
+ filterDir(entry) {
245861
+ return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
245862
+ }
245863
+ }
245864
+
245865
+ class FSWatcher extends EventEmitter3 {
245866
+ closed;
245867
+ options;
245868
+ _closers;
245869
+ _ignoredPaths;
245870
+ _throttled;
245871
+ _streams;
245872
+ _symlinkPaths;
245873
+ _watched;
245874
+ _pendingWrites;
245875
+ _pendingUnlinks;
245876
+ _readyCount;
245877
+ _emitReady;
245878
+ _closePromise;
245879
+ _userIgnored;
245880
+ _readyEmitted;
245881
+ _emitRaw;
245882
+ _boundRemove;
245883
+ _nodeFsHandler;
245884
+ constructor(_opts = {}) {
245885
+ super();
245886
+ this.closed = false;
245887
+ this._closers = new Map;
245888
+ this._ignoredPaths = new Set;
245889
+ this._throttled = new Map;
245890
+ this._streams = new Set;
245891
+ this._symlinkPaths = new Map;
245892
+ this._watched = new Map;
245893
+ this._pendingWrites = new Map;
245894
+ this._pendingUnlinks = new Map;
245895
+ this._readyCount = 0;
245896
+ this._readyEmitted = false;
245897
+ const awf = _opts.awaitWriteFinish;
245898
+ const DEF_AWF = { stabilityThreshold: 2000, pollInterval: 100 };
245899
+ const opts = {
245900
+ persistent: true,
245901
+ ignoreInitial: false,
245902
+ ignorePermissionErrors: false,
245903
+ interval: 100,
245904
+ binaryInterval: 300,
245905
+ followSymlinks: true,
245906
+ usePolling: false,
245907
+ atomic: true,
245908
+ ..._opts,
245909
+ ignored: _opts.ignored ? arrify(_opts.ignored) : arrify([]),
245910
+ awaitWriteFinish: awf === true ? DEF_AWF : typeof awf === "object" ? { ...DEF_AWF, ...awf } : false
245911
+ };
245912
+ if (isIBMi)
245913
+ opts.usePolling = true;
245914
+ if (opts.atomic === undefined)
245915
+ opts.atomic = !opts.usePolling;
245916
+ const envPoll = process.env.CHOKIDAR_USEPOLLING;
245917
+ if (envPoll !== undefined) {
245918
+ const envLower = envPoll.toLowerCase();
245919
+ if (envLower === "false" || envLower === "0")
245920
+ opts.usePolling = false;
245921
+ else if (envLower === "true" || envLower === "1")
245922
+ opts.usePolling = true;
245923
+ else
245924
+ opts.usePolling = !!envLower;
245925
+ }
245926
+ const envInterval = process.env.CHOKIDAR_INTERVAL;
245927
+ if (envInterval)
245928
+ opts.interval = Number.parseInt(envInterval, 10);
245929
+ let readyCalls = 0;
245930
+ this._emitReady = () => {
245931
+ readyCalls++;
245932
+ if (readyCalls >= this._readyCount) {
245933
+ this._emitReady = EMPTY_FN;
245934
+ this._readyEmitted = true;
245935
+ process.nextTick(() => this.emit(EVENTS.READY));
245936
+ }
245937
+ };
245938
+ this._emitRaw = (...args) => this.emit(EVENTS.RAW, ...args);
245939
+ this._boundRemove = this._remove.bind(this);
245940
+ this.options = opts;
245941
+ this._nodeFsHandler = new NodeFsHandler(this);
245942
+ Object.freeze(opts);
245943
+ }
245944
+ _addIgnoredPath(matcher) {
245945
+ if (isMatcherObject(matcher)) {
245946
+ for (const ignored of this._ignoredPaths) {
245947
+ if (isMatcherObject(ignored) && ignored.path === matcher.path && ignored.recursive === matcher.recursive) {
245948
+ return;
245949
+ }
245950
+ }
245951
+ }
245952
+ this._ignoredPaths.add(matcher);
245953
+ }
245954
+ _removeIgnoredPath(matcher) {
245955
+ this._ignoredPaths.delete(matcher);
245956
+ if (typeof matcher === "string") {
245957
+ for (const ignored of this._ignoredPaths) {
245958
+ if (isMatcherObject(ignored) && ignored.path === matcher) {
245959
+ this._ignoredPaths.delete(ignored);
245960
+ }
245961
+ }
245962
+ }
245963
+ }
245964
+ add(paths_, _origAdd, _internal) {
245965
+ const { cwd } = this.options;
245966
+ this.closed = false;
245967
+ this._closePromise = undefined;
245968
+ let paths = unifyPaths(paths_);
245969
+ if (cwd) {
245970
+ paths = paths.map((path19) => {
245971
+ const absPath = getAbsolutePath(path19, cwd);
245972
+ return absPath;
245973
+ });
245974
+ }
245975
+ paths.forEach((path19) => {
245976
+ this._removeIgnoredPath(path19);
245977
+ });
245978
+ this._userIgnored = undefined;
245979
+ if (!this._readyCount)
245980
+ this._readyCount = 0;
245981
+ this._readyCount += paths.length;
245982
+ Promise.all(paths.map(async (path19) => {
245983
+ const res = await this._nodeFsHandler._addToNodeFs(path19, !_internal, undefined, 0, _origAdd);
245984
+ if (res)
245985
+ this._emitReady();
245986
+ return res;
245987
+ })).then((results) => {
245988
+ if (this.closed)
245989
+ return;
245990
+ results.forEach((item) => {
245991
+ if (item)
245992
+ this.add(sp3.dirname(item), sp3.basename(_origAdd || item));
245993
+ });
245994
+ });
245995
+ return this;
245996
+ }
245997
+ unwatch(paths_) {
245998
+ if (this.closed)
245999
+ return this;
246000
+ const paths = unifyPaths(paths_);
246001
+ const { cwd } = this.options;
246002
+ paths.forEach((path19) => {
246003
+ if (!sp3.isAbsolute(path19) && !this._closers.has(path19)) {
246004
+ if (cwd)
246005
+ path19 = sp3.join(cwd, path19);
246006
+ path19 = sp3.resolve(path19);
246007
+ }
246008
+ this._closePath(path19);
246009
+ this._addIgnoredPath(path19);
246010
+ if (this._watched.has(path19)) {
246011
+ this._addIgnoredPath({
246012
+ path: path19,
246013
+ recursive: true
246014
+ });
246015
+ }
246016
+ this._userIgnored = undefined;
246017
+ });
246018
+ return this;
246019
+ }
246020
+ close() {
246021
+ if (this._closePromise) {
246022
+ return this._closePromise;
246023
+ }
246024
+ this.closed = true;
246025
+ this.removeAllListeners();
246026
+ const closers = [];
246027
+ this._closers.forEach((closerList) => closerList.forEach((closer) => {
246028
+ const promise2 = closer();
246029
+ if (promise2 instanceof Promise)
246030
+ closers.push(promise2);
246031
+ }));
246032
+ this._streams.forEach((stream) => stream.destroy());
246033
+ this._userIgnored = undefined;
246034
+ this._readyCount = 0;
246035
+ this._readyEmitted = false;
246036
+ this._watched.forEach((dirent) => dirent.dispose());
246037
+ this._closers.clear();
246038
+ this._watched.clear();
246039
+ this._streams.clear();
246040
+ this._symlinkPaths.clear();
246041
+ this._throttled.clear();
246042
+ this._closePromise = closers.length ? Promise.all(closers).then(() => {
246043
+ return;
246044
+ }) : Promise.resolve();
246045
+ return this._closePromise;
246046
+ }
246047
+ getWatched() {
246048
+ const watchList = {};
246049
+ this._watched.forEach((entry, dir) => {
246050
+ const key2 = this.options.cwd ? sp3.relative(this.options.cwd, dir) : dir;
246051
+ const index = key2 || ONE_DOT;
246052
+ watchList[index] = entry.getChildren().sort();
246053
+ });
246054
+ return watchList;
246055
+ }
246056
+ emitWithAll(event, args) {
246057
+ this.emit(event, ...args);
246058
+ if (event !== EVENTS.ERROR)
246059
+ this.emit(EVENTS.ALL, event, ...args);
246060
+ }
246061
+ async _emit(event, path19, stats) {
246062
+ if (this.closed)
246063
+ return;
246064
+ const opts = this.options;
246065
+ if (isWindows4)
246066
+ path19 = sp3.normalize(path19);
246067
+ if (opts.cwd)
246068
+ path19 = sp3.relative(opts.cwd, path19);
246069
+ const args = [path19];
246070
+ if (stats != null)
246071
+ args.push(stats);
246072
+ const awf = opts.awaitWriteFinish;
246073
+ let pw;
246074
+ if (awf && (pw = this._pendingWrites.get(path19))) {
246075
+ pw.lastChange = new Date;
246076
+ return this;
246077
+ }
246078
+ if (opts.atomic) {
246079
+ if (event === EVENTS.UNLINK) {
246080
+ this._pendingUnlinks.set(path19, [event, ...args]);
246081
+ setTimeout(() => {
246082
+ this._pendingUnlinks.forEach((entry, path20) => {
246083
+ this.emit(...entry);
246084
+ this.emit(EVENTS.ALL, ...entry);
246085
+ this._pendingUnlinks.delete(path20);
246086
+ });
246087
+ }, typeof opts.atomic === "number" ? opts.atomic : 100);
246088
+ return this;
246089
+ }
246090
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path19)) {
246091
+ event = EVENTS.CHANGE;
246092
+ this._pendingUnlinks.delete(path19);
246093
+ }
246094
+ }
246095
+ if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
246096
+ const awfEmit = (err, stats2) => {
246097
+ if (err) {
246098
+ event = EVENTS.ERROR;
246099
+ args[0] = err;
246100
+ this.emitWithAll(event, args);
246101
+ } else if (stats2) {
246102
+ if (args.length > 1) {
246103
+ args[1] = stats2;
246104
+ } else {
246105
+ args.push(stats2);
246106
+ }
246107
+ this.emitWithAll(event, args);
246108
+ }
246109
+ };
246110
+ this._awaitWriteFinish(path19, awf.stabilityThreshold, event, awfEmit);
246111
+ return this;
246112
+ }
246113
+ if (event === EVENTS.CHANGE) {
246114
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path19, 50);
246115
+ if (isThrottled)
246116
+ return this;
246117
+ }
246118
+ if (opts.alwaysStat && stats === undefined && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
246119
+ const fullPath = opts.cwd ? sp3.join(opts.cwd, path19) : path19;
246120
+ let stats2;
246121
+ try {
246122
+ stats2 = await stat4(fullPath);
246123
+ } catch (err) {}
246124
+ if (!stats2 || this.closed)
246125
+ return;
246126
+ args.push(stats2);
246127
+ }
246128
+ this.emitWithAll(event, args);
246129
+ return this;
246130
+ }
246131
+ _handleError(error48) {
246132
+ const code2 = error48 && error48.code;
246133
+ if (error48 && code2 !== "ENOENT" && code2 !== "ENOTDIR" && (!this.options.ignorePermissionErrors || code2 !== "EPERM" && code2 !== "EACCES")) {
246134
+ this.emit(EVENTS.ERROR, error48);
246135
+ }
246136
+ return error48 || this.closed;
246137
+ }
246138
+ _throttle(actionType, path19, timeout3) {
246139
+ if (!this._throttled.has(actionType)) {
246140
+ this._throttled.set(actionType, new Map);
246141
+ }
246142
+ const action = this._throttled.get(actionType);
246143
+ if (!action)
246144
+ throw new Error("invalid throttle");
246145
+ const actionPath = action.get(path19);
246146
+ if (actionPath) {
246147
+ actionPath.count++;
246148
+ return false;
246149
+ }
246150
+ let timeoutObject;
246151
+ const clear = () => {
246152
+ const item = action.get(path19);
246153
+ const count2 = item ? item.count : 0;
246154
+ action.delete(path19);
246155
+ clearTimeout(timeoutObject);
246156
+ if (item)
246157
+ clearTimeout(item.timeoutObject);
246158
+ return count2;
246159
+ };
246160
+ timeoutObject = setTimeout(clear, timeout3);
246161
+ const thr = { timeoutObject, clear, count: 0 };
246162
+ action.set(path19, thr);
246163
+ return thr;
246164
+ }
246165
+ _incrReadyCount() {
246166
+ return this._readyCount++;
246167
+ }
246168
+ _awaitWriteFinish(path19, threshold, event, awfEmit) {
246169
+ const awf = this.options.awaitWriteFinish;
246170
+ if (typeof awf !== "object")
246171
+ return;
246172
+ const pollInterval = awf.pollInterval;
246173
+ let timeoutHandler;
246174
+ let fullPath = path19;
246175
+ if (this.options.cwd && !sp3.isAbsolute(path19)) {
246176
+ fullPath = sp3.join(this.options.cwd, path19);
246177
+ }
246178
+ const now = new Date;
246179
+ const writes = this._pendingWrites;
246180
+ function awaitWriteFinishFn(prevStat) {
246181
+ statcb(fullPath, (err, curStat) => {
246182
+ if (err || !writes.has(path19)) {
246183
+ if (err && err.code !== "ENOENT")
246184
+ awfEmit(err);
246185
+ return;
246186
+ }
246187
+ const now2 = Number(new Date);
246188
+ if (prevStat && curStat.size !== prevStat.size) {
246189
+ writes.get(path19).lastChange = now2;
246190
+ }
246191
+ const pw = writes.get(path19);
246192
+ const df3 = now2 - pw.lastChange;
246193
+ if (df3 >= threshold) {
246194
+ writes.delete(path19);
246195
+ awfEmit(undefined, curStat);
246196
+ } else {
246197
+ timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
246198
+ }
246199
+ });
246200
+ }
246201
+ if (!writes.has(path19)) {
246202
+ writes.set(path19, {
246203
+ lastChange: now,
246204
+ cancelWait: () => {
246205
+ writes.delete(path19);
246206
+ clearTimeout(timeoutHandler);
246207
+ return event;
246208
+ }
246209
+ });
246210
+ timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval);
246211
+ }
246212
+ }
246213
+ _isIgnored(path19, stats) {
246214
+ if (this.options.atomic && DOT_RE.test(path19))
246215
+ return true;
246216
+ if (!this._userIgnored) {
246217
+ const { cwd } = this.options;
246218
+ const ign = this.options.ignored;
246219
+ const ignored = (ign || []).map(normalizeIgnored(cwd));
246220
+ const ignoredPaths = [...this._ignoredPaths];
246221
+ const list3 = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
246222
+ this._userIgnored = anymatch(list3, undefined);
246223
+ }
246224
+ return this._userIgnored(path19, stats);
246225
+ }
246226
+ _isntIgnored(path19, stat5) {
246227
+ return !this._isIgnored(path19, stat5);
246228
+ }
246229
+ _getWatchHelpers(path19) {
246230
+ return new WatchHelper(path19, this.options.followSymlinks, this);
246231
+ }
246232
+ _getWatchedDir(directory) {
246233
+ const dir = sp3.resolve(directory);
246234
+ if (!this._watched.has(dir))
246235
+ this._watched.set(dir, new DirEntry(dir, this._boundRemove));
246236
+ return this._watched.get(dir);
246237
+ }
246238
+ _hasReadPermissions(stats) {
246239
+ if (this.options.ignorePermissionErrors)
246240
+ return true;
246241
+ return Boolean(Number(stats.mode) & 256);
246242
+ }
246243
+ _remove(directory, item, isDirectory3) {
246244
+ const path19 = sp3.join(directory, item);
246245
+ const fullPath = sp3.resolve(path19);
246246
+ isDirectory3 = isDirectory3 != null ? isDirectory3 : this._watched.has(path19) || this._watched.has(fullPath);
246247
+ if (!this._throttle("remove", path19, 100))
246248
+ return;
246249
+ if (!isDirectory3 && this._watched.size === 1) {
246250
+ this.add(directory, item, true);
246251
+ }
246252
+ const wp5 = this._getWatchedDir(path19);
246253
+ const nestedDirectoryChildren = wp5.getChildren();
246254
+ nestedDirectoryChildren.forEach((nested) => this._remove(path19, nested));
246255
+ const parent = this._getWatchedDir(directory);
246256
+ const wasTracked = parent.has(item);
246257
+ parent.remove(item);
246258
+ if (this._symlinkPaths.has(fullPath)) {
246259
+ this._symlinkPaths.delete(fullPath);
246260
+ }
246261
+ let relPath = path19;
246262
+ if (this.options.cwd)
246263
+ relPath = sp3.relative(this.options.cwd, path19);
246264
+ if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
246265
+ const event = this._pendingWrites.get(relPath).cancelWait();
246266
+ if (event === EVENTS.ADD)
246267
+ return;
246268
+ }
246269
+ this._watched.delete(path19);
246270
+ this._watched.delete(fullPath);
246271
+ const eventName = isDirectory3 ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
246272
+ if (wasTracked && !this._isIgnored(path19))
246273
+ this._emit(eventName, path19);
246274
+ this._closePath(path19);
246275
+ }
246276
+ _closePath(path19) {
246277
+ this._closeFile(path19);
246278
+ const dir = sp3.dirname(path19);
246279
+ this._getWatchedDir(dir).remove(sp3.basename(path19));
246280
+ }
246281
+ _closeFile(path19) {
246282
+ const closers = this._closers.get(path19);
246283
+ if (!closers)
246284
+ return;
246285
+ closers.forEach((closer) => closer());
246286
+ this._closers.delete(path19);
246287
+ }
246288
+ _addPathCloser(path19, closer) {
246289
+ if (!closer)
246290
+ return;
246291
+ let list3 = this._closers.get(path19);
246292
+ if (!list3) {
246293
+ list3 = [];
246294
+ this._closers.set(path19, list3);
246295
+ }
246296
+ list3.push(closer);
246297
+ }
246298
+ _readdirp(root2, opts) {
246299
+ if (this.closed)
246300
+ return;
246301
+ const options8 = { type: EVENTS.ALL, alwaysStat: true, lstat: true, ...opts, depth: 0 };
246302
+ let stream = readdirp(root2, options8);
246303
+ this._streams.add(stream);
246304
+ stream.once(STR_CLOSE, () => {
246305
+ stream = undefined;
246306
+ });
246307
+ stream.once(STR_END, () => {
246308
+ if (stream) {
246309
+ this._streams.delete(stream);
246310
+ stream = undefined;
246311
+ }
246312
+ });
246313
+ return stream;
246314
+ }
246315
+ }
246316
+ function watch(paths, options8 = {}) {
246317
+ const watcher = new FSWatcher(options8);
246318
+ watcher.add(paths);
246319
+ return watcher;
246320
+ }
246321
+
246322
+ // src/cli/dev/dev-server/watcher.ts
246323
+ var import_debounce = __toESM(require_debounce(), 1);
246324
+ var WATCH_DEBOUNCE_MS = 300;
246325
+ var WATCH_QUEUE_DELAY_MS = 500;
246326
+
246327
+ class WatchBase44 extends EventEmitter4 {
246328
+ itemsToWatch;
246329
+ logger;
246330
+ watchers = [];
246331
+ queueWaitForCreation = [];
246332
+ queueWaitForCreationTimeout = null;
246333
+ constructor(itemsToWatch, logger) {
246334
+ super();
246335
+ this.itemsToWatch = itemsToWatch;
246336
+ this.logger = logger;
246337
+ }
246338
+ async start() {
246339
+ if (this.watchers.length > 0 || this.queueWaitForCreation.length > 0) {
246340
+ return;
246341
+ }
246342
+ for (const item of this.itemsToWatch) {
246343
+ if (await pathExists(item.path)) {
246344
+ this.watchers.push(this.watchTarget(item));
246345
+ } else {
246346
+ this.queueWaitForCreation.push(item);
246347
+ }
246348
+ }
246349
+ this.watchCreationQueue();
246350
+ }
246351
+ async close() {
246352
+ if (this.queueWaitForCreationTimeout) {
246353
+ clearTimeout(this.queueWaitForCreationTimeout);
246354
+ this.queueWaitForCreationTimeout = null;
246355
+ }
246356
+ for (const watcher of this.watchers) {
246357
+ await watcher.close();
246358
+ }
246359
+ this.watchers = [];
246360
+ this.queueWaitForCreation = [];
246361
+ }
246362
+ watchCreationQueue() {
246363
+ if (this.queueWaitForCreationTimeout) {
246364
+ clearTimeout(this.queueWaitForCreationTimeout);
246365
+ }
246366
+ this.queueWaitForCreationTimeout = setTimeout(async () => {
246367
+ const toRemove = [];
246368
+ for (const entry of this.queueWaitForCreation) {
246369
+ if (await pathExists(entry.path)) {
246370
+ this.watchers.push(this.watchTarget(entry));
246371
+ toRemove.push(entry);
246372
+ }
246373
+ }
246374
+ this.queueWaitForCreation = this.queueWaitForCreation.filter((entry) => !toRemove.includes(entry));
246375
+ if (this.queueWaitForCreation.length > 0) {
246376
+ this.watchCreationQueue();
246377
+ } else {
246378
+ this.queueWaitForCreationTimeout = null;
246379
+ }
246380
+ }, WATCH_QUEUE_DELAY_MS);
246381
+ }
246382
+ watchTarget(item) {
246383
+ const handler = import_debounce.default(async (_event, path19) => {
246384
+ this.emit("change", item.name, relative6(item.path, path19));
246385
+ }, WATCH_DEBOUNCE_MS);
246386
+ const watcher = watch(item.path, {
246387
+ ignoreInitial: true
246388
+ });
246389
+ watcher.on("all", handler);
246390
+ watcher.on("unlinkDir", async (deletedPath) => {
246391
+ if (deletedPath !== item.path) {
246392
+ return;
246393
+ }
246394
+ await watcher.close();
246395
+ this.queueWaitForCreation.push(item);
246396
+ this.watchCreationQueue();
246397
+ setTimeout(() => {
246398
+ this.watchers = this.watchers.filter((watcher2) => !watcher2.closed);
246399
+ });
246400
+ });
246401
+ watcher.on("error", (err) => {
246402
+ this.logger.error(`Watch handler failed for ${item.path}`, err instanceof Error ? err : undefined);
246403
+ });
246404
+ return watcher;
246405
+ }
246406
+ }
246407
+
244311
246408
  // src/cli/dev/dev-server/main.ts
244312
246409
  var DEFAULT_PORT = 4400;
244313
246410
  var BASE44_APP_URL = "https://base44.app";
@@ -244315,7 +246412,7 @@ async function createDevServer(options8) {
244315
246412
  const { port: userPort } = options8;
244316
246413
  const port = userPort ?? await getPorts({ port: DEFAULT_PORT });
244317
246414
  const baseUrl = `http://localhost:${port}`;
244318
- const { functions, entities } = await options8.loadResources();
246415
+ const { functions, entities, project: project2 } = await options8.loadResources();
244319
246416
  const app = import_express4.default();
244320
246417
  const remoteProxy = import_http_proxy_middleware2.createProxyMiddleware({
244321
246418
  target: BASE44_APP_URL,
@@ -244335,10 +246432,10 @@ async function createDevServer(options8) {
244335
246432
  });
244336
246433
  const devLogger = createDevLogger();
244337
246434
  const functionManager = new FunctionManager(functions, devLogger);
246435
+ const functionRoutes = createFunctionRouter(functionManager, devLogger);
246436
+ app.use("/api/apps/:appId/functions", functionRoutes);
244338
246437
  if (functionManager.getFunctionNames().length > 0) {
244339
246438
  R2.info(`Loaded functions: ${functionManager.getFunctionNames().join(", ")}`);
244340
- const functionRoutes = createFunctionRouter(functionManager, devLogger);
244341
- app.use("/api/apps/:appId/functions", functionRoutes);
244342
246439
  }
244343
246440
  const db2 = new Database(entities);
244344
246441
  if (db2.getCollectionNames().length > 0) {
@@ -244357,8 +246454,8 @@ async function createDevServer(options8) {
244357
246454
  devLogger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
244358
246455
  remoteProxy(req, res, next);
244359
246456
  });
244360
- return new Promise((resolve6, reject) => {
244361
- const server = app.listen(port, "127.0.0.1", (err) => {
246457
+ const server = await new Promise((resolve8, reject) => {
246458
+ const s5 = app.listen(port, "127.0.0.1", (err) => {
244362
246459
  if (err) {
244363
246460
  if ("code" in err && err.code === "EADDRINUSE") {
244364
246461
  reject(new Error(`Port ${port} is already in use. Stop the other process and try again.`));
@@ -244366,24 +246463,48 @@ async function createDevServer(options8) {
244366
246463
  reject(err);
244367
246464
  }
244368
246465
  } else {
244369
- const io6 = createRealtimeServer(server);
244370
- emitEntityEvent = (appId, entityName, event) => {
244371
- broadcastEntityEvent(io6, appId, entityName, event);
244372
- };
244373
- const shutdown = () => {
244374
- io6.close();
244375
- functionManager.stopAll();
244376
- server.close();
244377
- };
244378
- process.on("SIGINT", shutdown);
244379
- process.on("SIGTERM", shutdown);
244380
- resolve6({
244381
- port,
244382
- server
244383
- });
246466
+ resolve8(s5);
244384
246467
  }
244385
246468
  });
244386
246469
  });
246470
+ const io6 = createRealtimeServer(server);
246471
+ emitEntityEvent = (appId, entityName, event) => {
246472
+ broadcastEntityEvent(io6, appId, entityName, event);
246473
+ };
246474
+ const base44ConfigWatcher = new WatchBase44([
246475
+ {
246476
+ name: "functions",
246477
+ path: join18(dirname15(project2.configPath), project2.functionsDir)
246478
+ }
246479
+ ], devLogger);
246480
+ base44ConfigWatcher.on("change", async (name2) => {
246481
+ try {
246482
+ if (name2 === "functions") {
246483
+ const { functions: functions2 } = await options8.loadResources();
246484
+ const previousFunctionCount = functionManager.getFunctionNames().length;
246485
+ functionManager.reload(functions2);
246486
+ const names = functionManager.getFunctionNames();
246487
+ if (names.length > 0) {
246488
+ devLogger.log(`Reloaded functions: ${names.sort().join(", ")}`);
246489
+ } else if (previousFunctionCount > 0) {
246490
+ devLogger.log("All functions removed");
246491
+ }
246492
+ }
246493
+ } catch (error48) {
246494
+ const errorMessage = error48 instanceof Error ? error48.message : String(error48);
246495
+ devLogger.error(errorMessage);
246496
+ }
246497
+ });
246498
+ await base44ConfigWatcher.start();
246499
+ const shutdown = () => {
246500
+ base44ConfigWatcher.close();
246501
+ io6.close();
246502
+ functionManager.stopAll();
246503
+ server.close();
246504
+ };
246505
+ process.on("SIGINT", shutdown);
246506
+ process.on("SIGTERM", shutdown);
246507
+ return { port, server };
244387
246508
  }
244388
246509
 
244389
246510
  // src/cli/commands/dev.ts
@@ -244407,8 +246528,8 @@ function getDevCommand(context) {
244407
246528
  }
244408
246529
 
244409
246530
  // src/cli/commands/project/eject.ts
244410
- import { resolve as resolve6 } from "node:path";
244411
- var import_lodash2 = __toESM(require_lodash(), 1);
246531
+ import { resolve as resolve8 } from "node:path";
246532
+ var import_kebabCase2 = __toESM(require_kebabCase(), 1);
244412
246533
  async function eject(options8) {
244413
246534
  const projects = await listProjects();
244414
246535
  const ejectableProjects = projects.filter((p4) => p4.isManagedSourceCode !== false);
@@ -244446,7 +246567,7 @@ async function eject(options8) {
244446
246567
  selectedProject = selected;
244447
246568
  }
244448
246569
  const projectId = selectedProject.id;
244449
- const suggestedPath = await isDirEmpty() ? `./` : `./${import_lodash2.default(selectedProject.name)}`;
246570
+ const suggestedPath = await isDirEmpty() ? `./` : `./${import_kebabCase2.default(selectedProject.name)}`;
244450
246571
  const selectedPath = options8.path ?? await Ze({
244451
246572
  message: "Where should we create your project?",
244452
246573
  placeholder: suggestedPath,
@@ -244456,7 +246577,7 @@ async function eject(options8) {
244456
246577
  Ne("Operation cancelled.");
244457
246578
  throw new CLIExitError(0);
244458
246579
  }
244459
- const resolvedPath = resolve6(selectedPath);
246580
+ const resolvedPath = resolve8(selectedPath);
244460
246581
  await runTask("Downloading your project's code...", async (updateMessage) => {
244461
246582
  await createProjectFilesForExistingProject({
244462
246583
  projectId,
@@ -244532,7 +246653,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
244532
246653
  import { release, type } from "node:os";
244533
246654
 
244534
246655
  // node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
244535
- import { dirname as dirname12, posix, sep } from "path";
246656
+ import { dirname as dirname16, posix, sep } from "path";
244536
246657
  function createModulerModifier() {
244537
246658
  const getModuleFromFileName = createGetModuleFromFilename();
244538
246659
  return async (frames) => {
@@ -244541,12 +246662,12 @@ function createModulerModifier() {
244541
246662
  return frames;
244542
246663
  };
244543
246664
  }
244544
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname12(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
244545
- const normalizedBase = isWindows4 ? normalizeWindowsPath2(basePath) : basePath;
246665
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname16(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
246666
+ const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
244546
246667
  return (filename) => {
244547
246668
  if (!filename)
244548
246669
  return;
244549
- const normalizedFilename = isWindows4 ? normalizeWindowsPath2(filename) : filename;
246670
+ const normalizedFilename = isWindows5 ? normalizeWindowsPath2(filename) : filename;
244550
246671
  let { dir, base: file2, ext } = posix.parse(normalizedFilename);
244551
246672
  if (ext === ".js" || ext === ".mjs" || ext === ".cjs")
244552
246673
  file2 = file2.slice(0, -1 * ext.length);
@@ -246819,14 +248940,14 @@ async function addSourceContext(frames) {
246819
248940
  return frames;
246820
248941
  }
246821
248942
  function getContextLinesFromFile(path19, ranges, output) {
246822
- return new Promise((resolve7) => {
248943
+ return new Promise((resolve9) => {
246823
248944
  const stream = createReadStream2(path19);
246824
248945
  const lineReaded = createInterface2({
246825
248946
  input: stream
246826
248947
  });
246827
248948
  function destroyStreamAndResolve() {
246828
248949
  stream.destroy();
246829
- resolve7();
248950
+ resolve9();
246830
248951
  }
246831
248952
  let lineNumber = 0;
246832
248953
  let currentRangeIndex = 0;
@@ -247938,15 +250059,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
247938
250059
  return true;
247939
250060
  if (this.featureFlagsPoller === undefined)
247940
250061
  return false;
247941
- return new Promise((resolve7) => {
250062
+ return new Promise((resolve9) => {
247942
250063
  const timeout3 = setTimeout(() => {
247943
250064
  cleanup();
247944
- resolve7(false);
250065
+ resolve9(false);
247945
250066
  }, timeoutMs);
247946
250067
  const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
247947
250068
  clearTimeout(timeout3);
247948
250069
  cleanup();
247949
- resolve7(count2 > 0);
250070
+ resolve9(count2 > 0);
247950
250071
  });
247951
250072
  });
247952
250073
  }
@@ -248759,6 +250880,6 @@ export {
248759
250880
  CLIExitError
248760
250881
  };
248761
250882
 
248762
- //# debugId=DD6BC70CB401183F64756E2164756E21
250883
+ //# debugId=6C526A437589482264756E2164756E21
248763
250884
 
248764
- //# chunkId=019cafc1-f5f3-7db3-bea1-c78b57ef5cd6
250885
+ //# chunkId=019cbdc7-6e94-7511-a3d1-bbbcfd1b4420