@base44-preview/cli 0.1.11-pr.602.9833770 → 0.1.12-pr.584.81e385d
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 +1119 -700
- package/dist/cli/index.js.map +18 -14
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -23354,15 +23354,15 @@ var require_windows = __commonJS(function(exports, module) {
|
|
|
23354
23354
|
}
|
|
23355
23355
|
return false;
|
|
23356
23356
|
}
|
|
23357
|
-
function checkStat(
|
|
23358
|
-
if (!
|
|
23357
|
+
function checkStat(stat3, path11, options) {
|
|
23358
|
+
if (!stat3.isSymbolicLink() && !stat3.isFile()) {
|
|
23359
23359
|
return false;
|
|
23360
23360
|
}
|
|
23361
23361
|
return checkPathExt(path11, options);
|
|
23362
23362
|
}
|
|
23363
23363
|
function isexe(path11, options, cb) {
|
|
23364
|
-
fs14.stat(path11, function(er,
|
|
23365
|
-
cb(er, er ? false : checkStat(
|
|
23364
|
+
fs14.stat(path11, function(er, stat3) {
|
|
23365
|
+
cb(er, er ? false : checkStat(stat3, path11, options));
|
|
23366
23366
|
});
|
|
23367
23367
|
}
|
|
23368
23368
|
function sync(path11, options) {
|
|
@@ -23376,20 +23376,20 @@ var require_mode = __commonJS(function(exports, module) {
|
|
|
23376
23376
|
isexe.sync = sync;
|
|
23377
23377
|
var fs14 = __require("fs");
|
|
23378
23378
|
function isexe(path11, options, cb) {
|
|
23379
|
-
fs14.stat(path11, function(er,
|
|
23380
|
-
cb(er, er ? false : checkStat(
|
|
23379
|
+
fs14.stat(path11, function(er, stat3) {
|
|
23380
|
+
cb(er, er ? false : checkStat(stat3, options));
|
|
23381
23381
|
});
|
|
23382
23382
|
}
|
|
23383
23383
|
function sync(path11, options) {
|
|
23384
23384
|
return checkStat(fs14.statSync(path11), options);
|
|
23385
23385
|
}
|
|
23386
|
-
function checkStat(
|
|
23387
|
-
return
|
|
23386
|
+
function checkStat(stat3, options) {
|
|
23387
|
+
return stat3.isFile() && checkMode(stat3, options);
|
|
23388
23388
|
}
|
|
23389
|
-
function checkMode(
|
|
23390
|
-
var mod =
|
|
23391
|
-
var uid =
|
|
23392
|
-
var gid =
|
|
23389
|
+
function checkMode(stat3, options) {
|
|
23390
|
+
var mod = stat3.mode;
|
|
23391
|
+
var uid = stat3.uid;
|
|
23392
|
+
var gid = stat3.gid;
|
|
23393
23393
|
var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
|
|
23394
23394
|
var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
|
|
23395
23395
|
var u = parseInt("100", 8);
|
|
@@ -23421,12 +23421,12 @@ var require_isexe = __commonJS(function(exports, module) {
|
|
|
23421
23421
|
if (typeof Promise !== "function") {
|
|
23422
23422
|
throw new TypeError("callback not provided");
|
|
23423
23423
|
}
|
|
23424
|
-
return new Promise(function(
|
|
23424
|
+
return new Promise(function(resolve6, reject) {
|
|
23425
23425
|
isexe(path11, options || {}, function(er, is) {
|
|
23426
23426
|
if (er) {
|
|
23427
23427
|
reject(er);
|
|
23428
23428
|
} else {
|
|
23429
|
-
|
|
23429
|
+
resolve6(is);
|
|
23430
23430
|
}
|
|
23431
23431
|
});
|
|
23432
23432
|
});
|
|
@@ -23488,27 +23488,27 @@ var require_which = __commonJS(function(exports, module) {
|
|
|
23488
23488
|
opt = {};
|
|
23489
23489
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
23490
23490
|
const found = [];
|
|
23491
|
-
const step = (i) => new Promise((
|
|
23491
|
+
const step = (i) => new Promise((resolve6, reject) => {
|
|
23492
23492
|
if (i === pathEnv.length)
|
|
23493
|
-
return opt.all && found.length ?
|
|
23493
|
+
return opt.all && found.length ? resolve6(found) : reject(getNotFoundError(cmd));
|
|
23494
23494
|
const ppRaw = pathEnv[i];
|
|
23495
23495
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
23496
23496
|
const pCmd = path11.join(pathPart, cmd);
|
|
23497
23497
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
23498
|
-
|
|
23498
|
+
resolve6(subStep(p, i, 0));
|
|
23499
23499
|
});
|
|
23500
|
-
const subStep = (p, i, ii) => new Promise((
|
|
23500
|
+
const subStep = (p, i, ii) => new Promise((resolve6, reject) => {
|
|
23501
23501
|
if (ii === pathExt.length)
|
|
23502
|
-
return
|
|
23502
|
+
return resolve6(step(i + 1));
|
|
23503
23503
|
const ext = pathExt[ii];
|
|
23504
23504
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
23505
23505
|
if (!er && is) {
|
|
23506
23506
|
if (opt.all)
|
|
23507
23507
|
found.push(p + ext);
|
|
23508
23508
|
else
|
|
23509
|
-
return
|
|
23509
|
+
return resolve6(p + ext);
|
|
23510
23510
|
}
|
|
23511
|
-
return
|
|
23511
|
+
return resolve6(subStep(p, i, ii + 1));
|
|
23512
23512
|
});
|
|
23513
23513
|
});
|
|
23514
23514
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -27036,7 +27036,7 @@ var require_lodash8 = __commonJS(function(exports, module) {
|
|
|
27036
27036
|
}
|
|
27037
27037
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
27038
27038
|
});
|
|
27039
|
-
function
|
|
27039
|
+
function join18(array2, separator) {
|
|
27040
27040
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
27041
27041
|
}
|
|
27042
27042
|
function last(array2) {
|
|
@@ -28968,7 +28968,7 @@ __p += '`;
|
|
|
28968
28968
|
lodash.isUndefined = isUndefined;
|
|
28969
28969
|
lodash.isWeakMap = isWeakMap;
|
|
28970
28970
|
lodash.isWeakSet = isWeakSet;
|
|
28971
|
-
lodash.join =
|
|
28971
|
+
lodash.join = join18;
|
|
28972
28972
|
lodash.kebabCase = kebabCase;
|
|
28973
28973
|
lodash.last = last;
|
|
28974
28974
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -31178,7 +31178,7 @@ function cleanDoc(doc2) {
|
|
|
31178
31178
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
31179
31179
|
}
|
|
31180
31180
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
31181
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
31181
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join27(replacement, currentDoc.split(`
|
|
31182
31182
|
`)) : currentDoc);
|
|
31183
31183
|
}
|
|
31184
31184
|
function canBreakFn(doc2) {
|
|
@@ -31258,7 +31258,7 @@ function indentIfBreak(contents, options) {
|
|
|
31258
31258
|
negate: options.negate
|
|
31259
31259
|
};
|
|
31260
31260
|
}
|
|
31261
|
-
function
|
|
31261
|
+
function join27(separator, docs) {
|
|
31262
31262
|
assertDoc(separator);
|
|
31263
31263
|
assertDocArray(docs);
|
|
31264
31264
|
const parts = [];
|
|
@@ -31969,7 +31969,7 @@ var init_doc = __esm(() => {
|
|
|
31969
31969
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
31970
31970
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
31971
31971
|
builders = {
|
|
31972
|
-
join:
|
|
31972
|
+
join: join27,
|
|
31973
31973
|
line,
|
|
31974
31974
|
softline,
|
|
31975
31975
|
hardline,
|
|
@@ -120387,7 +120387,7 @@ function skipVoid(str, ptr, banNewLines, banComments) {
|
|
|
120387
120387
|
ptr++;
|
|
120388
120388
|
return banComments || c24 !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
|
|
120389
120389
|
}
|
|
120390
|
-
function skipUntil(str, ptr,
|
|
120390
|
+
function skipUntil(str, ptr, sep2, end, banNewLines = false) {
|
|
120391
120391
|
if (!end) {
|
|
120392
120392
|
ptr = indexOfNewline(str, ptr);
|
|
120393
120393
|
return ptr < 0 ? str.length : ptr;
|
|
@@ -120396,7 +120396,7 @@ function skipUntil(str, ptr, sep, end, banNewLines = false) {
|
|
|
120396
120396
|
let c24 = str[i5];
|
|
120397
120397
|
if (c24 === "#") {
|
|
120398
120398
|
i5 = indexOfNewline(str, i5);
|
|
120399
|
-
} else if (c24 ===
|
|
120399
|
+
} else if (c24 === sep2) {
|
|
120400
120400
|
return i5 + 1;
|
|
120401
120401
|
} else if (c24 === end || banNewLines && (c24 === `
|
|
120402
120402
|
` || c24 === "\r" && str[i5 + 1] === `
|
|
@@ -121176,7 +121176,7 @@ function getDataProtocolModuleFormat(parsed) {
|
|
|
121176
121176
|
const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(parsed.pathname) || [null, null, null];
|
|
121177
121177
|
return mimeToFormat(mime);
|
|
121178
121178
|
}
|
|
121179
|
-
function
|
|
121179
|
+
function extname2(url3) {
|
|
121180
121180
|
const pathname = url3.pathname;
|
|
121181
121181
|
let index = pathname.length;
|
|
121182
121182
|
while (index--) {
|
|
@@ -121191,7 +121191,7 @@ function extname(url3) {
|
|
|
121191
121191
|
return "";
|
|
121192
121192
|
}
|
|
121193
121193
|
function getFileProtocolModuleFormat(url3, _context, ignoreErrors) {
|
|
121194
|
-
const value =
|
|
121194
|
+
const value = extname2(url3);
|
|
121195
121195
|
if (value === ".js") {
|
|
121196
121196
|
const packageType = getPackageType(url3);
|
|
121197
121197
|
if (packageType !== "none") {
|
|
@@ -123906,14 +123906,14 @@ async function printToDoc(originalText, options8) {
|
|
|
123906
123906
|
async function printDocToString2(doc2, options8) {
|
|
123907
123907
|
return printDocToStringWithoutNormalizeOptions(doc2, await normalize_format_options_default(options8));
|
|
123908
123908
|
}
|
|
123909
|
-
function createParsersAndPrinters(
|
|
123909
|
+
function createParsersAndPrinters(modules2) {
|
|
123910
123910
|
const parsers2 = /* @__PURE__ */ Object.create(null);
|
|
123911
123911
|
const printers2 = /* @__PURE__ */ Object.create(null);
|
|
123912
123912
|
for (const {
|
|
123913
123913
|
importPlugin: importPlugin2,
|
|
123914
123914
|
parsers: parserNames = [],
|
|
123915
123915
|
printers: printerNames = []
|
|
123916
|
-
} of
|
|
123916
|
+
} of modules2) {
|
|
123917
123917
|
const loadPlugin2 = async () => {
|
|
123918
123918
|
const plugin = await importPlugin2();
|
|
123919
123919
|
Object.assign(parsers2, plugin.parsers);
|
|
@@ -136883,7 +136883,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
136883
136883
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
136884
136884
|
}
|
|
136885
136885
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
136886
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
136886
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join29(replacement, currentDoc.split(`
|
|
136887
136887
|
`)) : currentDoc);
|
|
136888
136888
|
}
|
|
136889
136889
|
function canBreakFn2(doc2) {
|
|
@@ -136969,7 +136969,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
136969
136969
|
negate: options8.negate
|
|
136970
136970
|
};
|
|
136971
136971
|
}
|
|
136972
|
-
function
|
|
136972
|
+
function join29(separator, docs) {
|
|
136973
136973
|
assertDoc2(separator);
|
|
136974
136974
|
assertDocArray2(docs);
|
|
136975
136975
|
const parts = [];
|
|
@@ -137634,7 +137634,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
137634
137634
|
}
|
|
137635
137635
|
}
|
|
137636
137636
|
var builders2 = {
|
|
137637
|
-
join:
|
|
137637
|
+
join: join29,
|
|
137638
137638
|
line: line3,
|
|
137639
137639
|
softline: softline2,
|
|
137640
137640
|
hardline: hardline4,
|
|
@@ -138289,11 +138289,11 @@ var require_prettier = __commonJS(function(exports, module) {
|
|
|
138289
138289
|
var require_formatter = __commonJS(function(exports) {
|
|
138290
138290
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
138291
138291
|
function adopt(value) {
|
|
138292
|
-
return value instanceof P9 ? value : new P9(function(
|
|
138293
|
-
|
|
138292
|
+
return value instanceof P9 ? value : new P9(function(resolve15) {
|
|
138293
|
+
resolve15(value);
|
|
138294
138294
|
});
|
|
138295
138295
|
}
|
|
138296
|
-
return new (P9 || (P9 = Promise))(function(
|
|
138296
|
+
return new (P9 || (P9 = Promise))(function(resolve15, reject) {
|
|
138297
138297
|
function fulfilled(value) {
|
|
138298
138298
|
try {
|
|
138299
138299
|
step(generator.next(value));
|
|
@@ -138309,7 +138309,7 @@ var require_formatter = __commonJS(function(exports) {
|
|
|
138309
138309
|
}
|
|
138310
138310
|
}
|
|
138311
138311
|
function step(result) {
|
|
138312
|
-
result.done ?
|
|
138312
|
+
result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
138313
138313
|
}
|
|
138314
138314
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
138315
138315
|
});
|
|
@@ -142962,7 +142962,7 @@ var require_url = __commonJS(function(exports) {
|
|
|
142962
142962
|
};
|
|
142963
142963
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
142964
142964
|
exports.parse = undefined;
|
|
142965
|
-
exports.resolve =
|
|
142965
|
+
exports.resolve = resolve15;
|
|
142966
142966
|
exports.cwd = cwd;
|
|
142967
142967
|
exports.getProtocol = getProtocol;
|
|
142968
142968
|
exports.getExtension = getExtension;
|
|
@@ -142974,7 +142974,7 @@ var require_url = __commonJS(function(exports) {
|
|
|
142974
142974
|
exports.fromFileSystemPath = fromFileSystemPath;
|
|
142975
142975
|
exports.toFileSystemPath = toFileSystemPath;
|
|
142976
142976
|
exports.safePointerToPath = safePointerToPath;
|
|
142977
|
-
exports.relative =
|
|
142977
|
+
exports.relative = relative5;
|
|
142978
142978
|
var convert_path_to_posix_1 = __importDefault(require_convert_path_to_posix());
|
|
142979
142979
|
var path_1 = __importStar(__require("path"));
|
|
142980
142980
|
var forwardSlashPattern = /\//g;
|
|
@@ -142990,7 +142990,7 @@ var require_url = __commonJS(function(exports) {
|
|
|
142990
142990
|
var urlDecodePatterns = [/%23/g, "#", /%24/g, "$", /%26/g, "&", /%2C/g, ",", /%40/g, "@"];
|
|
142991
142991
|
var parse11 = (u4) => new URL(u4);
|
|
142992
142992
|
exports.parse = parse11;
|
|
142993
|
-
function
|
|
142993
|
+
function resolve15(from, to5) {
|
|
142994
142994
|
const fromUrl = new URL((0, convert_path_to_posix_1.default)(from), "https://aaa.nonexistanturl.com");
|
|
142995
142995
|
const resolvedUrl = new URL((0, convert_path_to_posix_1.default)(to5), fromUrl);
|
|
142996
142996
|
const endSpaces = to5.match(/(\s*)$/)?.[1] || "";
|
|
@@ -143124,9 +143124,9 @@ var require_url = __commonJS(function(exports) {
|
|
|
143124
143124
|
return decodeURIComponent(value).replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
|
|
143125
143125
|
});
|
|
143126
143126
|
}
|
|
143127
|
-
function
|
|
143127
|
+
function relative5(from, to5) {
|
|
143128
143128
|
if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
|
|
143129
|
-
return
|
|
143129
|
+
return resolve15(from, to5);
|
|
143130
143130
|
}
|
|
143131
143131
|
const fromDir = path_1.default.dirname(stripHash(from));
|
|
143132
143132
|
const toPath4 = stripHash(to5);
|
|
@@ -143802,7 +143802,7 @@ var require_plugins = __commonJS(function(exports) {
|
|
|
143802
143802
|
let plugin;
|
|
143803
143803
|
let lastError;
|
|
143804
143804
|
let index = 0;
|
|
143805
|
-
return new Promise((
|
|
143805
|
+
return new Promise((resolve15, reject) => {
|
|
143806
143806
|
runNextPlugin();
|
|
143807
143807
|
function runNextPlugin() {
|
|
143808
143808
|
plugin = plugins[index++];
|
|
@@ -143830,7 +143830,7 @@ var require_plugins = __commonJS(function(exports) {
|
|
|
143830
143830
|
}
|
|
143831
143831
|
}
|
|
143832
143832
|
function onSuccess(result) {
|
|
143833
|
-
|
|
143833
|
+
resolve15({
|
|
143834
143834
|
plugin,
|
|
143835
143835
|
result
|
|
143836
143836
|
});
|
|
@@ -145163,11 +145163,11 @@ var require_lib3 = __commonJS(function(exports) {
|
|
|
145163
145163
|
var require_resolver = __commonJS(function(exports) {
|
|
145164
145164
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145165
145165
|
function adopt(value) {
|
|
145166
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145167
|
-
|
|
145166
|
+
return value instanceof P9 ? value : new P9(function(resolve15) {
|
|
145167
|
+
resolve15(value);
|
|
145168
145168
|
});
|
|
145169
145169
|
}
|
|
145170
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145170
|
+
return new (P9 || (P9 = Promise))(function(resolve15, reject) {
|
|
145171
145171
|
function fulfilled(value) {
|
|
145172
145172
|
try {
|
|
145173
145173
|
step(generator.next(value));
|
|
@@ -145183,7 +145183,7 @@ var require_resolver = __commonJS(function(exports) {
|
|
|
145183
145183
|
}
|
|
145184
145184
|
}
|
|
145185
145185
|
function step(result) {
|
|
145186
|
-
result.done ?
|
|
145186
|
+
result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145187
145187
|
}
|
|
145188
145188
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145189
145189
|
});
|
|
@@ -145304,11 +145304,11 @@ var require_optionValidator = __commonJS(function(exports) {
|
|
|
145304
145304
|
var require_src3 = __commonJS(function(exports) {
|
|
145305
145305
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
|
|
145306
145306
|
function adopt(value) {
|
|
145307
|
-
return value instanceof P9 ? value : new P9(function(
|
|
145308
|
-
|
|
145307
|
+
return value instanceof P9 ? value : new P9(function(resolve15) {
|
|
145308
|
+
resolve15(value);
|
|
145309
145309
|
});
|
|
145310
145310
|
}
|
|
145311
|
-
return new (P9 || (P9 = Promise))(function(
|
|
145311
|
+
return new (P9 || (P9 = Promise))(function(resolve15, reject) {
|
|
145312
145312
|
function fulfilled(value) {
|
|
145313
145313
|
try {
|
|
145314
145314
|
step(generator.next(value));
|
|
@@ -145324,7 +145324,7 @@ var require_src3 = __commonJS(function(exports) {
|
|
|
145324
145324
|
}
|
|
145325
145325
|
}
|
|
145326
145326
|
function step(result) {
|
|
145327
|
-
result.done ?
|
|
145327
|
+
result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
145328
145328
|
}
|
|
145329
145329
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
145330
145330
|
});
|
|
@@ -146453,7 +146453,7 @@ var require_depd = __commonJS(function(exports, module) {
|
|
|
146453
146453
|
* Copyright(c) 2014-2018 Douglas Christopher Wilson
|
|
146454
146454
|
* MIT Licensed
|
|
146455
146455
|
*/
|
|
146456
|
-
var
|
|
146456
|
+
var relative5 = __require("path").relative;
|
|
146457
146457
|
module.exports = depd;
|
|
146458
146458
|
var basePath = process.cwd();
|
|
146459
146459
|
function containsNamespace(str, namespace) {
|
|
@@ -146649,7 +146649,7 @@ var require_depd = __commonJS(function(exports, module) {
|
|
|
146649
146649
|
return formatted;
|
|
146650
146650
|
}
|
|
146651
146651
|
function formatLocation(callSite) {
|
|
146652
|
-
return
|
|
146652
|
+
return relative5(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
|
|
146653
146653
|
}
|
|
146654
146654
|
function getStack() {
|
|
146655
146655
|
var limit = Error.stackTraceLimit;
|
|
@@ -150645,7 +150645,7 @@ var require_dbcs_data = __commonJS(function(exports, module) {
|
|
|
150645
150645
|
// ../../node_modules/iconv-lite/encodings/index.js
|
|
150646
150646
|
var require_encodings = __commonJS(function(exports, module) {
|
|
150647
150647
|
var mergeModules = require_merge_exports();
|
|
150648
|
-
var
|
|
150648
|
+
var modules2 = [
|
|
150649
150649
|
require_internal(),
|
|
150650
150650
|
require_utf32(),
|
|
150651
150651
|
require_utf16(),
|
|
@@ -150656,8 +150656,8 @@ var require_encodings = __commonJS(function(exports, module) {
|
|
|
150656
150656
|
require_dbcs_codec(),
|
|
150657
150657
|
require_dbcs_data()
|
|
150658
150658
|
];
|
|
150659
|
-
for (i5 = 0;i5 <
|
|
150660
|
-
module =
|
|
150659
|
+
for (i5 = 0;i5 < modules2.length; i5++) {
|
|
150660
|
+
module = modules2[i5];
|
|
150661
150661
|
mergeModules(exports, module);
|
|
150662
150662
|
}
|
|
150663
150663
|
var module;
|
|
@@ -150986,11 +150986,11 @@ var require_raw_body = __commonJS(function(exports, module) {
|
|
|
150986
150986
|
if (done) {
|
|
150987
150987
|
return readStream(stream, encoding, length, limit, wrap(done));
|
|
150988
150988
|
}
|
|
150989
|
-
return new Promise(function executor(
|
|
150989
|
+
return new Promise(function executor(resolve15, reject) {
|
|
150990
150990
|
readStream(stream, encoding, length, limit, function onRead2(err, buf) {
|
|
150991
150991
|
if (err)
|
|
150992
150992
|
return reject(err);
|
|
150993
|
-
|
|
150993
|
+
resolve15(buf);
|
|
150994
150994
|
});
|
|
150995
150995
|
});
|
|
150996
150996
|
}
|
|
@@ -160794,7 +160794,7 @@ var require_mime_types = __commonJS(function(exports) {
|
|
|
160794
160794
|
* MIT Licensed
|
|
160795
160795
|
*/
|
|
160796
160796
|
var db2 = require_db();
|
|
160797
|
-
var
|
|
160797
|
+
var extname3 = __require("path").extname;
|
|
160798
160798
|
var mimeScore = require_mimeScore();
|
|
160799
160799
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
160800
160800
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
@@ -160851,7 +160851,7 @@ var require_mime_types = __commonJS(function(exports) {
|
|
|
160851
160851
|
if (!path18 || typeof path18 !== "string") {
|
|
160852
160852
|
return false;
|
|
160853
160853
|
}
|
|
160854
|
-
var extension2 =
|
|
160854
|
+
var extension2 = extname3("x." + path18).toLowerCase().slice(1);
|
|
160855
160855
|
if (!extension2) {
|
|
160856
160856
|
return false;
|
|
160857
160857
|
}
|
|
@@ -164111,16 +164111,16 @@ var require_view = __commonJS(function(exports, module) {
|
|
|
164111
164111
|
var debug = require_src4()("express:view");
|
|
164112
164112
|
var path18 = __require("node:path");
|
|
164113
164113
|
var fs28 = __require("node:fs");
|
|
164114
|
-
var
|
|
164114
|
+
var dirname21 = path18.dirname;
|
|
164115
164115
|
var basename7 = path18.basename;
|
|
164116
|
-
var
|
|
164117
|
-
var
|
|
164118
|
-
var
|
|
164116
|
+
var extname3 = path18.extname;
|
|
164117
|
+
var join30 = path18.join;
|
|
164118
|
+
var resolve15 = path18.resolve;
|
|
164119
164119
|
module.exports = View;
|
|
164120
164120
|
function View(name2, options8) {
|
|
164121
164121
|
var opts = options8 || {};
|
|
164122
164122
|
this.defaultEngine = opts.defaultEngine;
|
|
164123
|
-
this.ext =
|
|
164123
|
+
this.ext = extname3(name2);
|
|
164124
164124
|
this.name = name2;
|
|
164125
164125
|
this.root = opts.root;
|
|
164126
164126
|
if (!this.ext && !this.defaultEngine) {
|
|
@@ -164149,8 +164149,8 @@ var require_view = __commonJS(function(exports, module) {
|
|
|
164149
164149
|
debug('lookup "%s"', name2);
|
|
164150
164150
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
164151
164151
|
var root2 = roots[i5];
|
|
164152
|
-
var loc =
|
|
164153
|
-
var dir =
|
|
164152
|
+
var loc = resolve15(root2, name2);
|
|
164153
|
+
var dir = dirname21(loc);
|
|
164154
164154
|
var file2 = basename7(loc);
|
|
164155
164155
|
path19 = this.resolve(dir, file2);
|
|
164156
164156
|
}
|
|
@@ -164174,16 +164174,16 @@ var require_view = __commonJS(function(exports, module) {
|
|
|
164174
164174
|
});
|
|
164175
164175
|
sync = false;
|
|
164176
164176
|
};
|
|
164177
|
-
View.prototype.resolve = function
|
|
164177
|
+
View.prototype.resolve = function resolve16(dir, file2) {
|
|
164178
164178
|
var ext = this.ext;
|
|
164179
|
-
var path19 =
|
|
164180
|
-
var
|
|
164181
|
-
if (
|
|
164179
|
+
var path19 = join30(dir, file2);
|
|
164180
|
+
var stat4 = tryStat(path19);
|
|
164181
|
+
if (stat4 && stat4.isFile()) {
|
|
164182
164182
|
return path19;
|
|
164183
164183
|
}
|
|
164184
|
-
path19 =
|
|
164185
|
-
|
|
164186
|
-
if (
|
|
164184
|
+
path19 = join30(dir, basename7(file2, ext), "index" + ext);
|
|
164185
|
+
stat4 = tryStat(path19);
|
|
164186
|
+
if (stat4 && stat4.isFile()) {
|
|
164187
164187
|
return path19;
|
|
164188
164188
|
}
|
|
164189
164189
|
};
|
|
@@ -164234,9 +164234,9 @@ var require_etag = __commonJS(function(exports, module) {
|
|
|
164234
164234
|
}
|
|
164235
164235
|
return obj && typeof obj === "object" && "ctime" in obj && toString2.call(obj.ctime) === "[object Date]" && "mtime" in obj && toString2.call(obj.mtime) === "[object Date]" && "ino" in obj && typeof obj.ino === "number" && "size" in obj && typeof obj.size === "number";
|
|
164236
164236
|
}
|
|
164237
|
-
function stattag(
|
|
164238
|
-
var mtime =
|
|
164239
|
-
var size =
|
|
164237
|
+
function stattag(stat4) {
|
|
164238
|
+
var mtime = stat4.mtime.getTime().toString(16);
|
|
164239
|
+
var size = stat4.size.toString(16);
|
|
164240
164240
|
return '"' + size + "-" + mtime + '"';
|
|
164241
164241
|
}
|
|
164242
164242
|
});
|
|
@@ -166333,7 +166333,7 @@ var require_application = __commonJS(function(exports, module) {
|
|
|
166333
166333
|
var compileETag = require_utils10().compileETag;
|
|
166334
166334
|
var compileQueryParser = require_utils10().compileQueryParser;
|
|
166335
166335
|
var compileTrust = require_utils10().compileTrust;
|
|
166336
|
-
var
|
|
166336
|
+
var resolve15 = __require("node:path").resolve;
|
|
166337
166337
|
var once9 = require_once();
|
|
166338
166338
|
var Router = require_router();
|
|
166339
166339
|
var slice = Array.prototype.slice;
|
|
@@ -166387,7 +166387,7 @@ var require_application = __commonJS(function(exports, module) {
|
|
|
166387
166387
|
this.mountpath = "/";
|
|
166388
166388
|
this.locals.settings = this.settings;
|
|
166389
166389
|
this.set("view", View);
|
|
166390
|
-
this.set("views",
|
|
166390
|
+
this.set("views", resolve15("views"));
|
|
166391
166391
|
this.set("jsonp callback name", "callback");
|
|
166392
166392
|
if (env4 === "production") {
|
|
166393
166393
|
this.enable("view cache");
|
|
@@ -167875,11 +167875,11 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
167875
167875
|
var statuses = require_statuses();
|
|
167876
167876
|
var Stream2 = __require("stream");
|
|
167877
167877
|
var util2 = __require("util");
|
|
167878
|
-
var
|
|
167879
|
-
var
|
|
167878
|
+
var extname3 = path18.extname;
|
|
167879
|
+
var join30 = path18.join;
|
|
167880
167880
|
var normalize2 = path18.normalize;
|
|
167881
|
-
var
|
|
167882
|
-
var
|
|
167881
|
+
var resolve15 = path18.resolve;
|
|
167882
|
+
var sep2 = path18.sep;
|
|
167883
167883
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
167884
167884
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000;
|
|
167885
167885
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
@@ -167907,7 +167907,7 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
167907
167907
|
this._maxage = opts.maxAge || opts.maxage;
|
|
167908
167908
|
this._maxage = typeof this._maxage === "string" ? ms9(this._maxage) : Number(this._maxage);
|
|
167909
167909
|
this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
|
|
167910
|
-
this._root = opts.root ?
|
|
167910
|
+
this._root = opts.root ? resolve15(opts.root) : null;
|
|
167911
167911
|
}
|
|
167912
167912
|
util2.inherits(SendStream, Stream2);
|
|
167913
167913
|
SendStream.prototype.error = function error48(status, err) {
|
|
@@ -168040,23 +168040,23 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168040
168040
|
var parts;
|
|
168041
168041
|
if (root2 !== null) {
|
|
168042
168042
|
if (path19) {
|
|
168043
|
-
path19 = normalize2("." +
|
|
168043
|
+
path19 = normalize2("." + sep2 + path19);
|
|
168044
168044
|
}
|
|
168045
168045
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
168046
168046
|
debug('malicious path "%s"', path19);
|
|
168047
168047
|
this.error(403);
|
|
168048
168048
|
return res;
|
|
168049
168049
|
}
|
|
168050
|
-
parts = path19.split(
|
|
168051
|
-
path19 = normalize2(
|
|
168050
|
+
parts = path19.split(sep2);
|
|
168051
|
+
path19 = normalize2(join30(root2, path19));
|
|
168052
168052
|
} else {
|
|
168053
168053
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
168054
168054
|
debug('malicious path "%s"', path19);
|
|
168055
168055
|
this.error(403);
|
|
168056
168056
|
return res;
|
|
168057
168057
|
}
|
|
168058
|
-
parts = normalize2(path19).split(
|
|
168059
|
-
path19 =
|
|
168058
|
+
parts = normalize2(path19).split(sep2);
|
|
168059
|
+
path19 = resolve15(path19);
|
|
168060
168060
|
}
|
|
168061
168061
|
if (containsDotFile(parts)) {
|
|
168062
168062
|
debug('%s dotfile "%s"', this._dotfiles, path19);
|
|
@@ -168079,8 +168079,8 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168079
168079
|
this.sendFile(path19);
|
|
168080
168080
|
return res;
|
|
168081
168081
|
};
|
|
168082
|
-
SendStream.prototype.send = function send2(path19,
|
|
168083
|
-
var len =
|
|
168082
|
+
SendStream.prototype.send = function send2(path19, stat4) {
|
|
168083
|
+
var len = stat4.size;
|
|
168084
168084
|
var options8 = this.options;
|
|
168085
168085
|
var opts = {};
|
|
168086
168086
|
var res = this.res;
|
|
@@ -168092,7 +168092,7 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168092
168092
|
return;
|
|
168093
168093
|
}
|
|
168094
168094
|
debug('pipe "%s"', path19);
|
|
168095
|
-
this.setHeader(path19,
|
|
168095
|
+
this.setHeader(path19, stat4);
|
|
168096
168096
|
this.type(path19);
|
|
168097
168097
|
if (this.isConditionalGET()) {
|
|
168098
168098
|
if (this.isPreconditionFailure()) {
|
|
@@ -168149,19 +168149,19 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168149
168149
|
var i5 = 0;
|
|
168150
168150
|
var self2 = this;
|
|
168151
168151
|
debug('stat "%s"', path19);
|
|
168152
|
-
fs28.stat(path19, function onstat(err,
|
|
168153
|
-
var pathEndsWithSep = path19[path19.length - 1] ===
|
|
168154
|
-
if (err && err.code === "ENOENT" && !
|
|
168152
|
+
fs28.stat(path19, function onstat(err, stat4) {
|
|
168153
|
+
var pathEndsWithSep = path19[path19.length - 1] === sep2;
|
|
168154
|
+
if (err && err.code === "ENOENT" && !extname3(path19) && !pathEndsWithSep) {
|
|
168155
168155
|
return next(err);
|
|
168156
168156
|
}
|
|
168157
168157
|
if (err)
|
|
168158
168158
|
return self2.onStatError(err);
|
|
168159
|
-
if (
|
|
168159
|
+
if (stat4.isDirectory())
|
|
168160
168160
|
return self2.redirect(path19);
|
|
168161
168161
|
if (pathEndsWithSep)
|
|
168162
168162
|
return self2.error(404);
|
|
168163
|
-
self2.emit("file", path19,
|
|
168164
|
-
self2.send(path19,
|
|
168163
|
+
self2.emit("file", path19, stat4);
|
|
168164
|
+
self2.send(path19, stat4);
|
|
168165
168165
|
});
|
|
168166
168166
|
function next(err) {
|
|
168167
168167
|
if (self2._extensions.length <= i5) {
|
|
@@ -168169,13 +168169,13 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168169
168169
|
}
|
|
168170
168170
|
var p4 = path19 + "." + self2._extensions[i5++];
|
|
168171
168171
|
debug('stat "%s"', p4);
|
|
168172
|
-
fs28.stat(p4, function(err2,
|
|
168172
|
+
fs28.stat(p4, function(err2, stat4) {
|
|
168173
168173
|
if (err2)
|
|
168174
168174
|
return next(err2);
|
|
168175
|
-
if (
|
|
168175
|
+
if (stat4.isDirectory())
|
|
168176
168176
|
return next();
|
|
168177
|
-
self2.emit("file", p4,
|
|
168178
|
-
self2.send(p4,
|
|
168177
|
+
self2.emit("file", p4, stat4);
|
|
168178
|
+
self2.send(p4, stat4);
|
|
168179
168179
|
});
|
|
168180
168180
|
}
|
|
168181
168181
|
};
|
|
@@ -168188,15 +168188,15 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168188
168188
|
return self2.onStatError(err);
|
|
168189
168189
|
return self2.error(404);
|
|
168190
168190
|
}
|
|
168191
|
-
var p4 =
|
|
168191
|
+
var p4 = join30(path19, self2._index[i5]);
|
|
168192
168192
|
debug('stat "%s"', p4);
|
|
168193
|
-
fs28.stat(p4, function(err2,
|
|
168193
|
+
fs28.stat(p4, function(err2, stat4) {
|
|
168194
168194
|
if (err2)
|
|
168195
168195
|
return next(err2);
|
|
168196
|
-
if (
|
|
168196
|
+
if (stat4.isDirectory())
|
|
168197
168197
|
return next();
|
|
168198
|
-
self2.emit("file", p4,
|
|
168199
|
-
self2.send(p4,
|
|
168198
|
+
self2.emit("file", p4, stat4);
|
|
168199
|
+
self2.send(p4, stat4);
|
|
168200
168200
|
});
|
|
168201
168201
|
}
|
|
168202
168202
|
next();
|
|
@@ -168223,14 +168223,14 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168223
168223
|
var res = this.res;
|
|
168224
168224
|
if (res.getHeader("Content-Type"))
|
|
168225
168225
|
return;
|
|
168226
|
-
var ext =
|
|
168226
|
+
var ext = extname3(path19);
|
|
168227
168227
|
var type2 = mime.contentType(ext) || "application/octet-stream";
|
|
168228
168228
|
debug("content-type %s", type2);
|
|
168229
168229
|
res.setHeader("Content-Type", type2);
|
|
168230
168230
|
};
|
|
168231
|
-
SendStream.prototype.setHeader = function setHeader(path19,
|
|
168231
|
+
SendStream.prototype.setHeader = function setHeader(path19, stat4) {
|
|
168232
168232
|
var res = this.res;
|
|
168233
|
-
this.emit("headers", res, path19,
|
|
168233
|
+
this.emit("headers", res, path19, stat4);
|
|
168234
168234
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
168235
168235
|
debug("accept ranges");
|
|
168236
168236
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -168244,12 +168244,12 @@ var require_send = __commonJS(function(exports, module) {
|
|
|
168244
168244
|
res.setHeader("Cache-Control", cacheControl);
|
|
168245
168245
|
}
|
|
168246
168246
|
if (this._lastModified && !res.getHeader("Last-Modified")) {
|
|
168247
|
-
var modified =
|
|
168247
|
+
var modified = stat4.mtime.toUTCString();
|
|
168248
168248
|
debug("modified %s", modified);
|
|
168249
168249
|
res.setHeader("Last-Modified", modified);
|
|
168250
168250
|
}
|
|
168251
168251
|
if (this._etag && !res.getHeader("ETag")) {
|
|
168252
|
-
var val = etag(
|
|
168252
|
+
var val = etag(stat4);
|
|
168253
168253
|
debug("etag %s", val);
|
|
168254
168254
|
res.setHeader("ETag", val);
|
|
168255
168255
|
}
|
|
@@ -168383,8 +168383,8 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
168383
168383
|
var setCharset = require_utils10().setCharset;
|
|
168384
168384
|
var cookie = require_cookie();
|
|
168385
168385
|
var send = require_send();
|
|
168386
|
-
var
|
|
168387
|
-
var
|
|
168386
|
+
var extname3 = path18.extname;
|
|
168387
|
+
var resolve15 = path18.resolve;
|
|
168388
168388
|
var vary = require_vary();
|
|
168389
168389
|
var { Buffer: Buffer7 } = __require("node:buffer");
|
|
168390
168390
|
var res = Object.create(http.ServerResponse.prototype);
|
|
@@ -168593,7 +168593,7 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
168593
168593
|
}
|
|
168594
168594
|
opts = Object.create(opts);
|
|
168595
168595
|
opts.headers = headers;
|
|
168596
|
-
var fullPath = !opts.root ?
|
|
168596
|
+
var fullPath = !opts.root ? resolve15(path19) : path19;
|
|
168597
168597
|
return this.sendFile(fullPath, opts, done);
|
|
168598
168598
|
};
|
|
168599
168599
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -168624,7 +168624,7 @@ var require_response = __commonJS(function(exports, module) {
|
|
|
168624
168624
|
};
|
|
168625
168625
|
res.attachment = function attachment(filename) {
|
|
168626
168626
|
if (filename) {
|
|
168627
|
-
this.type(
|
|
168627
|
+
this.type(extname3(filename));
|
|
168628
168628
|
}
|
|
168629
168629
|
this.set("Content-Disposition", contentDisposition(filename));
|
|
168630
168630
|
return this;
|
|
@@ -168854,7 +168854,7 @@ var require_serve_static = __commonJS(function(exports, module) {
|
|
|
168854
168854
|
var encodeUrl = require_encodeurl();
|
|
168855
168855
|
var escapeHtml = require_escape_html();
|
|
168856
168856
|
var parseUrl = require_parseurl();
|
|
168857
|
-
var
|
|
168857
|
+
var resolve15 = __require("path").resolve;
|
|
168858
168858
|
var send = require_send();
|
|
168859
168859
|
var url3 = __require("url");
|
|
168860
168860
|
module.exports = serveStatic;
|
|
@@ -168873,7 +168873,7 @@ var require_serve_static = __commonJS(function(exports, module) {
|
|
|
168873
168873
|
throw new TypeError("option setHeaders must be function");
|
|
168874
168874
|
}
|
|
168875
168875
|
opts.maxage = opts.maxage || opts.maxAge || 0;
|
|
168876
|
-
opts.root =
|
|
168876
|
+
opts.root = resolve15(root2);
|
|
168877
168877
|
var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
|
|
168878
168878
|
return function serveStatic2(req, res, next) {
|
|
168879
168879
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -169797,8 +169797,8 @@ var require_follow_redirects = __commonJS(function(exports, module) {
|
|
|
169797
169797
|
}
|
|
169798
169798
|
return parsed;
|
|
169799
169799
|
}
|
|
169800
|
-
function resolveUrl(
|
|
169801
|
-
return useNativeURL ? new URL2(
|
|
169800
|
+
function resolveUrl(relative5, base) {
|
|
169801
|
+
return useNativeURL ? new URL2(relative5, base) : parseUrl(url3.resolve(base, relative5));
|
|
169802
169802
|
}
|
|
169803
169803
|
function validateUrl(input) {
|
|
169804
169804
|
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
@@ -172247,8 +172247,8 @@ var require_executor = __commonJS(function(exports, module) {
|
|
|
172247
172247
|
}
|
|
172248
172248
|
resetBuffer() {
|
|
172249
172249
|
this.buffer = new Waterfall;
|
|
172250
|
-
this.buffer.chain(new Promise((
|
|
172251
|
-
this._triggerBuffer =
|
|
172250
|
+
this.buffer.chain(new Promise((resolve15) => {
|
|
172251
|
+
this._triggerBuffer = resolve15;
|
|
172252
172252
|
}));
|
|
172253
172253
|
if (this.ready)
|
|
172254
172254
|
this._triggerBuffer();
|
|
@@ -173268,7 +173268,7 @@ var require_storage = __commonJS(function(exports, module) {
|
|
|
173268
173268
|
throw e8;
|
|
173269
173269
|
}
|
|
173270
173270
|
};
|
|
173271
|
-
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((
|
|
173271
|
+
var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve15, reject) => {
|
|
173272
173272
|
try {
|
|
173273
173273
|
const stream = writeFileStream(filename, { mode });
|
|
173274
173274
|
const readable2 = Readable6.from(lines);
|
|
@@ -173285,7 +173285,7 @@ var require_storage = __commonJS(function(exports, module) {
|
|
|
173285
173285
|
if (err)
|
|
173286
173286
|
reject(err);
|
|
173287
173287
|
else
|
|
173288
|
-
|
|
173288
|
+
resolve15();
|
|
173289
173289
|
});
|
|
173290
173290
|
});
|
|
173291
173291
|
readable2.on("error", (err) => {
|
|
@@ -173456,7 +173456,7 @@ var require_persistence = __commonJS(function(exports, module) {
|
|
|
173456
173456
|
return { data: tdata, indexes };
|
|
173457
173457
|
}
|
|
173458
173458
|
treatRawStreamAsync(rawStream) {
|
|
173459
|
-
return new Promise((
|
|
173459
|
+
return new Promise((resolve15, reject) => {
|
|
173460
173460
|
const dataById = {};
|
|
173461
173461
|
const indexes = {};
|
|
173462
173462
|
let corruptItems = 0;
|
|
@@ -173499,7 +173499,7 @@ var require_persistence = __commonJS(function(exports, module) {
|
|
|
173499
173499
|
}
|
|
173500
173500
|
}
|
|
173501
173501
|
const data = Object.values(dataById);
|
|
173502
|
-
|
|
173502
|
+
resolve15({ data, indexes });
|
|
173503
173503
|
});
|
|
173504
173504
|
lineStream.on("error", function(err) {
|
|
173505
173505
|
reject(err, null);
|
|
@@ -183032,7 +183032,7 @@ var require_mime_types2 = __commonJS(function(exports) {
|
|
|
183032
183032
|
* MIT Licensed
|
|
183033
183033
|
*/
|
|
183034
183034
|
var db2 = require_db2();
|
|
183035
|
-
var
|
|
183035
|
+
var extname3 = __require("path").extname;
|
|
183036
183036
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
183037
183037
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
183038
183038
|
exports.charset = charset;
|
|
@@ -183087,7 +183087,7 @@ var require_mime_types2 = __commonJS(function(exports) {
|
|
|
183087
183087
|
if (!path18 || typeof path18 !== "string") {
|
|
183088
183088
|
return false;
|
|
183089
183089
|
}
|
|
183090
|
-
var extension2 =
|
|
183090
|
+
var extension2 = extname3("x." + path18).toLowerCase().substr(1);
|
|
183091
183091
|
if (!extension2) {
|
|
183092
183092
|
return false;
|
|
183093
183093
|
}
|
|
@@ -193079,7 +193079,7 @@ var require_mime_types3 = __commonJS(function(exports) {
|
|
|
193079
193079
|
* MIT Licensed
|
|
193080
193080
|
*/
|
|
193081
193081
|
var db2 = require_db3();
|
|
193082
|
-
var
|
|
193082
|
+
var extname3 = __require("path").extname;
|
|
193083
193083
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
193084
193084
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
193085
193085
|
exports.charset = charset;
|
|
@@ -193134,7 +193134,7 @@ var require_mime_types3 = __commonJS(function(exports) {
|
|
|
193134
193134
|
if (!path18 || typeof path18 !== "string") {
|
|
193135
193135
|
return false;
|
|
193136
193136
|
}
|
|
193137
|
-
var extension2 =
|
|
193137
|
+
var extension2 = extname3("x." + path18).toLowerCase().substr(1);
|
|
193138
193138
|
if (!extension2) {
|
|
193139
193139
|
return false;
|
|
193140
193140
|
}
|
|
@@ -199110,13 +199110,13 @@ var require_broadcast_operator = __commonJS(function(exports) {
|
|
|
199110
199110
|
return true;
|
|
199111
199111
|
}
|
|
199112
199112
|
emitWithAck(ev2, ...args) {
|
|
199113
|
-
return new Promise((
|
|
199113
|
+
return new Promise((resolve15, reject) => {
|
|
199114
199114
|
args.push((err, responses) => {
|
|
199115
199115
|
if (err) {
|
|
199116
199116
|
err.responses = responses;
|
|
199117
199117
|
return reject(err);
|
|
199118
199118
|
} else {
|
|
199119
|
-
return
|
|
199119
|
+
return resolve15(responses);
|
|
199120
199120
|
}
|
|
199121
199121
|
});
|
|
199122
199122
|
this.emit(ev2, ...args);
|
|
@@ -199304,12 +199304,12 @@ var require_socket2 = __commonJS(function(exports) {
|
|
|
199304
199304
|
}
|
|
199305
199305
|
emitWithAck(ev2, ...args) {
|
|
199306
199306
|
const withErr = this.flags.timeout !== undefined;
|
|
199307
|
-
return new Promise((
|
|
199307
|
+
return new Promise((resolve15, reject) => {
|
|
199308
199308
|
args.push((arg1, arg2) => {
|
|
199309
199309
|
if (withErr) {
|
|
199310
|
-
return arg1 ? reject(arg1) :
|
|
199310
|
+
return arg1 ? reject(arg1) : resolve15(arg2);
|
|
199311
199311
|
} else {
|
|
199312
|
-
return
|
|
199312
|
+
return resolve15(arg1);
|
|
199313
199313
|
}
|
|
199314
199314
|
});
|
|
199315
199315
|
this.emit(ev2, ...args);
|
|
@@ -199764,13 +199764,13 @@ var require_namespace = __commonJS(function(exports) {
|
|
|
199764
199764
|
return true;
|
|
199765
199765
|
}
|
|
199766
199766
|
serverSideEmitWithAck(ev2, ...args) {
|
|
199767
|
-
return new Promise((
|
|
199767
|
+
return new Promise((resolve15, reject) => {
|
|
199768
199768
|
args.push((err, responses) => {
|
|
199769
199769
|
if (err) {
|
|
199770
199770
|
err.responses = responses;
|
|
199771
199771
|
return reject(err);
|
|
199772
199772
|
} else {
|
|
199773
|
-
return
|
|
199773
|
+
return resolve15(responses);
|
|
199774
199774
|
}
|
|
199775
199775
|
});
|
|
199776
199776
|
this.serverSideEmit(ev2, ...args);
|
|
@@ -203305,7 +203305,7 @@ var require_cluster_adapter = __commonJS(function(exports) {
|
|
|
203305
203305
|
return localSockets;
|
|
203306
203306
|
}
|
|
203307
203307
|
const requestId = randomId();
|
|
203308
|
-
return new Promise((
|
|
203308
|
+
return new Promise((resolve15, reject) => {
|
|
203309
203309
|
const timeout3 = setTimeout(() => {
|
|
203310
203310
|
const storedRequest2 = this.requests.get(requestId);
|
|
203311
203311
|
if (storedRequest2) {
|
|
@@ -203315,7 +203315,7 @@ var require_cluster_adapter = __commonJS(function(exports) {
|
|
|
203315
203315
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
203316
203316
|
const storedRequest = {
|
|
203317
203317
|
type: MessageType.FETCH_SOCKETS,
|
|
203318
|
-
resolve:
|
|
203318
|
+
resolve: resolve15,
|
|
203319
203319
|
timeout: timeout3,
|
|
203320
203320
|
current: 0,
|
|
203321
203321
|
expected: expectedResponseCount,
|
|
@@ -203525,7 +203525,7 @@ var require_cluster_adapter = __commonJS(function(exports) {
|
|
|
203525
203525
|
return localSockets;
|
|
203526
203526
|
}
|
|
203527
203527
|
const requestId = randomId();
|
|
203528
|
-
return new Promise((
|
|
203528
|
+
return new Promise((resolve15, reject) => {
|
|
203529
203529
|
const timeout3 = setTimeout(() => {
|
|
203530
203530
|
const storedRequest2 = this.customRequests.get(requestId);
|
|
203531
203531
|
if (storedRequest2) {
|
|
@@ -203535,7 +203535,7 @@ var require_cluster_adapter = __commonJS(function(exports) {
|
|
|
203535
203535
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
203536
203536
|
const storedRequest = {
|
|
203537
203537
|
type: MessageType.FETCH_SOCKETS,
|
|
203538
|
-
resolve:
|
|
203538
|
+
resolve: resolve15,
|
|
203539
203539
|
timeout: timeout3,
|
|
203540
203540
|
missingUids: new Set([...this.nodesMap.keys()]),
|
|
203541
203541
|
responses: localSockets
|
|
@@ -204264,13 +204264,13 @@ var require_dist4 = __commonJS(function(exports, module) {
|
|
|
204264
204264
|
this.engine.close();
|
|
204265
204265
|
(0, uws_1.restoreAdapter)();
|
|
204266
204266
|
if (this.httpServer) {
|
|
204267
|
-
return new Promise((
|
|
204267
|
+
return new Promise((resolve15) => {
|
|
204268
204268
|
this.httpServer.close((err) => {
|
|
204269
204269
|
fn9 && fn9(err);
|
|
204270
204270
|
if (err) {
|
|
204271
204271
|
debug("server was not running");
|
|
204272
204272
|
}
|
|
204273
|
-
|
|
204273
|
+
resolve15();
|
|
204274
204274
|
});
|
|
204275
204275
|
});
|
|
204276
204276
|
} else {
|
|
@@ -213006,7 +213006,7 @@ var require_mime_types4 = __commonJS(function(exports) {
|
|
|
213006
213006
|
* MIT Licensed
|
|
213007
213007
|
*/
|
|
213008
213008
|
var db2 = require_db4();
|
|
213009
|
-
var
|
|
213009
|
+
var extname3 = __require("path").extname;
|
|
213010
213010
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
213011
213011
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
213012
213012
|
exports.charset = charset;
|
|
@@ -213061,7 +213061,7 @@ var require_mime_types4 = __commonJS(function(exports) {
|
|
|
213061
213061
|
if (!path18 || typeof path18 !== "string") {
|
|
213062
213062
|
return false;
|
|
213063
213063
|
}
|
|
213064
|
-
var extension2 =
|
|
213064
|
+
var extension2 = extname3("x." + path18).toLowerCase().substr(1);
|
|
213065
213065
|
if (!extension2) {
|
|
213066
213066
|
return false;
|
|
213067
213067
|
}
|
|
@@ -217393,8 +217393,8 @@ var require_mkdirp = __commonJS(function(exports, module) {
|
|
|
217393
217393
|
});
|
|
217394
217394
|
break;
|
|
217395
217395
|
default:
|
|
217396
|
-
xfs.stat(p4, function(er22,
|
|
217397
|
-
if (er22 || !
|
|
217396
|
+
xfs.stat(p4, function(er22, stat4) {
|
|
217397
|
+
if (er22 || !stat4.isDirectory())
|
|
217398
217398
|
cb2(er10, made);
|
|
217399
217399
|
else
|
|
217400
217400
|
cb2(null, made);
|
|
@@ -217425,13 +217425,13 @@ var require_mkdirp = __commonJS(function(exports, module) {
|
|
|
217425
217425
|
sync(p4, opts, made);
|
|
217426
217426
|
break;
|
|
217427
217427
|
default:
|
|
217428
|
-
var
|
|
217428
|
+
var stat4;
|
|
217429
217429
|
try {
|
|
217430
|
-
|
|
217430
|
+
stat4 = xfs.statSync(p4);
|
|
217431
217431
|
} catch (err1) {
|
|
217432
217432
|
throw err0;
|
|
217433
217433
|
}
|
|
217434
|
-
if (!
|
|
217434
|
+
if (!stat4.isDirectory())
|
|
217435
217435
|
throw err0;
|
|
217436
217436
|
break;
|
|
217437
217437
|
}
|
|
@@ -217634,7 +217634,7 @@ var require_buffer_list = __commonJS(function(exports, module) {
|
|
|
217634
217634
|
}
|
|
217635
217635
|
}, {
|
|
217636
217636
|
key: "join",
|
|
217637
|
-
value: function
|
|
217637
|
+
value: function join33(s5) {
|
|
217638
217638
|
if (this.length === 0)
|
|
217639
217639
|
return "";
|
|
217640
217640
|
var p4 = this.head;
|
|
@@ -218932,14 +218932,14 @@ var require_async_iterator = __commonJS(function(exports, module) {
|
|
|
218932
218932
|
};
|
|
218933
218933
|
}
|
|
218934
218934
|
function readAndResolve(iter) {
|
|
218935
|
-
var
|
|
218936
|
-
if (
|
|
218935
|
+
var resolve15 = iter[kLastResolve];
|
|
218936
|
+
if (resolve15 !== null) {
|
|
218937
218937
|
var data = iter[kStream].read();
|
|
218938
218938
|
if (data !== null) {
|
|
218939
218939
|
iter[kLastPromise] = null;
|
|
218940
218940
|
iter[kLastResolve] = null;
|
|
218941
218941
|
iter[kLastReject] = null;
|
|
218942
|
-
|
|
218942
|
+
resolve15(createIterResult(data, false));
|
|
218943
218943
|
}
|
|
218944
218944
|
}
|
|
218945
218945
|
}
|
|
@@ -218947,13 +218947,13 @@ var require_async_iterator = __commonJS(function(exports, module) {
|
|
|
218947
218947
|
process.nextTick(readAndResolve, iter);
|
|
218948
218948
|
}
|
|
218949
218949
|
function wrapForNext(lastPromise, iter) {
|
|
218950
|
-
return function(
|
|
218950
|
+
return function(resolve15, reject) {
|
|
218951
218951
|
lastPromise.then(function() {
|
|
218952
218952
|
if (iter[kEnded]) {
|
|
218953
|
-
|
|
218953
|
+
resolve15(createIterResult(undefined, true));
|
|
218954
218954
|
return;
|
|
218955
218955
|
}
|
|
218956
|
-
iter[kHandlePromise](
|
|
218956
|
+
iter[kHandlePromise](resolve15, reject);
|
|
218957
218957
|
}, reject);
|
|
218958
218958
|
};
|
|
218959
218959
|
}
|
|
@@ -218972,12 +218972,12 @@ var require_async_iterator = __commonJS(function(exports, module) {
|
|
|
218972
218972
|
return Promise.resolve(createIterResult(undefined, true));
|
|
218973
218973
|
}
|
|
218974
218974
|
if (this[kStream].destroyed) {
|
|
218975
|
-
return new Promise(function(
|
|
218975
|
+
return new Promise(function(resolve15, reject) {
|
|
218976
218976
|
process.nextTick(function() {
|
|
218977
218977
|
if (_this[kError]) {
|
|
218978
218978
|
reject(_this[kError]);
|
|
218979
218979
|
} else {
|
|
218980
|
-
|
|
218980
|
+
resolve15(createIterResult(undefined, true));
|
|
218981
218981
|
}
|
|
218982
218982
|
});
|
|
218983
218983
|
});
|
|
@@ -219000,13 +219000,13 @@ var require_async_iterator = __commonJS(function(exports, module) {
|
|
|
219000
219000
|
return this;
|
|
219001
219001
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
219002
219002
|
var _this2 = this;
|
|
219003
|
-
return new Promise(function(
|
|
219003
|
+
return new Promise(function(resolve15, reject) {
|
|
219004
219004
|
_this2[kStream].destroy(null, function(err) {
|
|
219005
219005
|
if (err) {
|
|
219006
219006
|
reject(err);
|
|
219007
219007
|
return;
|
|
219008
219008
|
}
|
|
219009
|
-
|
|
219009
|
+
resolve15(createIterResult(undefined, true));
|
|
219010
219010
|
});
|
|
219011
219011
|
});
|
|
219012
219012
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -219028,15 +219028,15 @@ var require_async_iterator = __commonJS(function(exports, module) {
|
|
|
219028
219028
|
value: stream._readableState.endEmitted,
|
|
219029
219029
|
writable: true
|
|
219030
219030
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
219031
|
-
value: function value(
|
|
219031
|
+
value: function value(resolve15, reject) {
|
|
219032
219032
|
var data = iterator[kStream].read();
|
|
219033
219033
|
if (data) {
|
|
219034
219034
|
iterator[kLastPromise] = null;
|
|
219035
219035
|
iterator[kLastResolve] = null;
|
|
219036
219036
|
iterator[kLastReject] = null;
|
|
219037
|
-
|
|
219037
|
+
resolve15(createIterResult(data, false));
|
|
219038
219038
|
} else {
|
|
219039
|
-
iterator[kLastResolve] =
|
|
219039
|
+
iterator[kLastResolve] = resolve15;
|
|
219040
219040
|
iterator[kLastReject] = reject;
|
|
219041
219041
|
}
|
|
219042
219042
|
},
|
|
@@ -219055,12 +219055,12 @@ var require_async_iterator = __commonJS(function(exports, module) {
|
|
|
219055
219055
|
iterator[kError] = err;
|
|
219056
219056
|
return;
|
|
219057
219057
|
}
|
|
219058
|
-
var
|
|
219059
|
-
if (
|
|
219058
|
+
var resolve15 = iterator[kLastResolve];
|
|
219059
|
+
if (resolve15 !== null) {
|
|
219060
219060
|
iterator[kLastPromise] = null;
|
|
219061
219061
|
iterator[kLastResolve] = null;
|
|
219062
219062
|
iterator[kLastReject] = null;
|
|
219063
|
-
|
|
219063
|
+
resolve15(createIterResult(undefined, true));
|
|
219064
219064
|
}
|
|
219065
219065
|
iterator[kEnded] = true;
|
|
219066
219066
|
});
|
|
@@ -219072,7 +219072,7 @@ var require_async_iterator = __commonJS(function(exports, module) {
|
|
|
219072
219072
|
|
|
219073
219073
|
// ../../node_modules/readable-stream/lib/internal/streams/from.js
|
|
219074
219074
|
var require_from = __commonJS(function(exports, module) {
|
|
219075
|
-
function asyncGeneratorStep(gen,
|
|
219075
|
+
function asyncGeneratorStep(gen, resolve15, reject, _next, _throw, key2, arg) {
|
|
219076
219076
|
try {
|
|
219077
219077
|
var info = gen[key2](arg);
|
|
219078
219078
|
var value = info.value;
|
|
@@ -219081,7 +219081,7 @@ var require_from = __commonJS(function(exports, module) {
|
|
|
219081
219081
|
return;
|
|
219082
219082
|
}
|
|
219083
219083
|
if (info.done) {
|
|
219084
|
-
|
|
219084
|
+
resolve15(value);
|
|
219085
219085
|
} else {
|
|
219086
219086
|
Promise.resolve(value).then(_next, _throw);
|
|
219087
219087
|
}
|
|
@@ -219089,13 +219089,13 @@ var require_from = __commonJS(function(exports, module) {
|
|
|
219089
219089
|
function _asyncToGenerator(fn9) {
|
|
219090
219090
|
return function() {
|
|
219091
219091
|
var self2 = this, args = arguments;
|
|
219092
|
-
return new Promise(function(
|
|
219092
|
+
return new Promise(function(resolve15, reject) {
|
|
219093
219093
|
var gen = fn9.apply(self2, args);
|
|
219094
219094
|
function _next(value) {
|
|
219095
|
-
asyncGeneratorStep(gen,
|
|
219095
|
+
asyncGeneratorStep(gen, resolve15, reject, _next, _throw, "next", value);
|
|
219096
219096
|
}
|
|
219097
219097
|
function _throw(err) {
|
|
219098
|
-
asyncGeneratorStep(gen,
|
|
219098
|
+
asyncGeneratorStep(gen, resolve15, reject, _next, _throw, "throw", err);
|
|
219099
219099
|
}
|
|
219100
219100
|
_next(undefined);
|
|
219101
219101
|
});
|
|
@@ -221222,7 +221222,7 @@ var require_dist5 = __commonJS(function(exports, module) {
|
|
|
221222
221222
|
determineAgent: () => determineAgent
|
|
221223
221223
|
});
|
|
221224
221224
|
module.exports = __toCommonJS2(src_exports);
|
|
221225
|
-
var
|
|
221225
|
+
var import_promises26 = __require("node:fs/promises");
|
|
221226
221226
|
var import_node_fs24 = __require("node:fs");
|
|
221227
221227
|
var DEVIN_LOCAL_PATH = "/opt/.devin";
|
|
221228
221228
|
var CURSOR2 = "cursor";
|
|
@@ -221280,7 +221280,7 @@ var require_dist5 = __commonJS(function(exports, module) {
|
|
|
221280
221280
|
return { isAgent: true, agent: { name: REPLIT } };
|
|
221281
221281
|
}
|
|
221282
221282
|
try {
|
|
221283
|
-
await (0,
|
|
221283
|
+
await (0, import_promises26.access)(DEVIN_LOCAL_PATH, import_node_fs24.constants.F_OK);
|
|
221284
221284
|
return { isAgent: true, agent: { name: DEVIN } };
|
|
221285
221285
|
} catch (error48) {}
|
|
221286
221286
|
return { isAgent: false, agent: undefined };
|
|
@@ -237842,7 +237842,7 @@ function normalizeBase44Env() {
|
|
|
237842
237842
|
loadProjectEnvFiles();
|
|
237843
237843
|
|
|
237844
237844
|
// src/cli/index.ts
|
|
237845
|
-
import { dirname as
|
|
237845
|
+
import { dirname as dirname26, join as join37 } from "node:path";
|
|
237846
237846
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
237847
237847
|
|
|
237848
237848
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -238926,7 +238926,7 @@ var {
|
|
|
238926
238926
|
} = import__.default;
|
|
238927
238927
|
|
|
238928
238928
|
// src/cli/commands/agent-skills/pull.ts
|
|
238929
|
-
import { dirname as
|
|
238929
|
+
import { dirname as dirname11, join as join18 } from "node:path";
|
|
238930
238930
|
// ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
238931
238931
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
238932
238932
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
@@ -245542,19 +245542,27 @@ var PublishedUrlResponseSchema = exports_external.object({
|
|
|
245542
245542
|
var CreateDeploymentResponseSchema = exports_external.object({
|
|
245543
245543
|
deployment_id: exports_external.string(),
|
|
245544
245544
|
session_id: exports_external.string(),
|
|
245545
|
-
asset_uploads: exports_external.
|
|
245546
|
-
|
|
245547
|
-
|
|
245548
|
-
|
|
245549
|
-
|
|
245550
|
-
|
|
245551
|
-
|
|
245552
|
-
|
|
245553
|
-
|
|
245545
|
+
asset_uploads: exports_external.discriminatedUnion("type", [
|
|
245546
|
+
exports_external.object({
|
|
245547
|
+
type: exports_external.literal("cf"),
|
|
245548
|
+
url: exports_external.string(),
|
|
245549
|
+
jwt: exports_external.string(),
|
|
245550
|
+
buckets: exports_external.array(exports_external.array(exports_external.string()))
|
|
245551
|
+
}),
|
|
245552
|
+
exports_external.object({
|
|
245553
|
+
type: exports_external.literal("s3"),
|
|
245554
|
+
uploads: exports_external.array(exports_external.object({
|
|
245555
|
+
path: exports_external.string(),
|
|
245556
|
+
content_type: exports_external.string(),
|
|
245557
|
+
content_length: exports_external.number(),
|
|
245558
|
+
url: exports_external.string()
|
|
245559
|
+
}))
|
|
245560
|
+
})
|
|
245561
|
+
]).nullable().optional()
|
|
245554
245562
|
}).transform((data) => ({
|
|
245555
245563
|
deploymentId: data.deployment_id,
|
|
245556
245564
|
sessionId: data.session_id,
|
|
245557
|
-
assetUploads: data.asset_uploads == null ? null : {
|
|
245565
|
+
assetUploads: data.asset_uploads == null ? null : data.asset_uploads.type === "cf" ? data.asset_uploads : {
|
|
245558
245566
|
type: "s3",
|
|
245559
245567
|
uploads: data.asset_uploads.uploads.map((upload) => ({
|
|
245560
245568
|
path: upload.path,
|
|
@@ -245564,6 +245572,9 @@ var CreateDeploymentResponseSchema = exports_external.object({
|
|
|
245564
245572
|
}))
|
|
245565
245573
|
}
|
|
245566
245574
|
}));
|
|
245575
|
+
var AssetUploadResponseSchema = exports_external.looseObject({
|
|
245576
|
+
result: exports_external.looseObject({ jwt: exports_external.string().nullable().optional() }).nullable().optional()
|
|
245577
|
+
});
|
|
245567
245578
|
var FinalizeDeploymentResponseSchema = exports_external.object({
|
|
245568
245579
|
deployment_id: exports_external.string()
|
|
245569
245580
|
}).transform((data) => ({
|
|
@@ -247927,7 +247938,7 @@ import { join as join12 } from "node:path";
|
|
|
247927
247938
|
// package.json
|
|
247928
247939
|
var package_default = {
|
|
247929
247940
|
name: "base44",
|
|
247930
|
-
version: "0.1.
|
|
247941
|
+
version: "0.1.12",
|
|
247931
247942
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
247932
247943
|
type: "module",
|
|
247933
247944
|
bin: {
|
|
@@ -248152,7 +248163,7 @@ async function createProjectFilesForExistingProject(options) {
|
|
|
248152
248163
|
};
|
|
248153
248164
|
}
|
|
248154
248165
|
// src/core/project/deploy.ts
|
|
248155
|
-
import { resolve as
|
|
248166
|
+
import { resolve as resolve6 } from "node:path";
|
|
248156
248167
|
|
|
248157
248168
|
// src/core/site/api.ts
|
|
248158
248169
|
async function uploadSite(archivePath) {
|
|
@@ -248176,6 +248187,13 @@ async function uploadSite(archivePath) {
|
|
|
248176
248187
|
}
|
|
248177
248188
|
return result.data;
|
|
248178
248189
|
}
|
|
248190
|
+
var MODULE_CONTENT_TYPES = {
|
|
248191
|
+
esm: "application/javascript+module",
|
|
248192
|
+
sourcemap: "application/source-map",
|
|
248193
|
+
wasm: "application/wasm",
|
|
248194
|
+
text: "text/plain",
|
|
248195
|
+
data: "application/octet-stream"
|
|
248196
|
+
};
|
|
248179
248197
|
async function createDeployment(request) {
|
|
248180
248198
|
const appClient = getAppClient();
|
|
248181
248199
|
let response;
|
|
@@ -248193,12 +248211,19 @@ async function createDeployment(request) {
|
|
|
248193
248211
|
}
|
|
248194
248212
|
return result.data;
|
|
248195
248213
|
}
|
|
248196
|
-
async function
|
|
248214
|
+
async function finalizeDeployment(deploymentId, sessionId, payload) {
|
|
248197
248215
|
const formData = new FormData;
|
|
248198
|
-
|
|
248199
|
-
|
|
248200
|
-
}
|
|
248201
|
-
|
|
248216
|
+
if ("indexHtml" in payload) {
|
|
248217
|
+
formData.append("index.html", new File([payload.indexHtml], "index.html", { type: "text/html" }));
|
|
248218
|
+
} else {
|
|
248219
|
+
formData.append("payload", JSON.stringify({ completion_jwt: payload.completionJwt }));
|
|
248220
|
+
for (const module of payload.modules) {
|
|
248221
|
+
const content = await readFile(module.absolutePath);
|
|
248222
|
+
formData.append(module.name, new File([new Uint8Array(content)], module.name, {
|
|
248223
|
+
type: MODULE_CONTENT_TYPES[module.type]
|
|
248224
|
+
}));
|
|
248225
|
+
}
|
|
248226
|
+
}
|
|
248202
248227
|
const appClient = getAppClient();
|
|
248203
248228
|
let response;
|
|
248204
248229
|
try {
|
|
@@ -248263,10 +248288,120 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
248263
248288
|
cwd: pathToArchive
|
|
248264
248289
|
}, ["."]);
|
|
248265
248290
|
}
|
|
248291
|
+
// src/core/site/deploy-app.ts
|
|
248292
|
+
import { resolve as resolve4 } from "node:path";
|
|
248293
|
+
|
|
248294
|
+
// src/core/site/wrangler-config.ts
|
|
248295
|
+
import { dirname as dirname10, join as join15, resolve as resolve3 } from "node:path";
|
|
248296
|
+
var WRANGLER_REDIRECT_PATH = join15(".wrangler", "deploy", "config.json");
|
|
248297
|
+
var RedirectConfigSchema = exports_external.looseObject({
|
|
248298
|
+
configPath: exports_external.string().min(1)
|
|
248299
|
+
});
|
|
248300
|
+
var WranglerConfigSchema = exports_external.looseObject({
|
|
248301
|
+
main: exports_external.string().min(1, "wrangler config is missing a 'main' entry module"),
|
|
248302
|
+
no_bundle: exports_external.boolean().optional(),
|
|
248303
|
+
rules: exports_external.array(exports_external.looseObject({ type: exports_external.string(), globs: exports_external.array(exports_external.string()) })).optional(),
|
|
248304
|
+
assets: exports_external.looseObject({
|
|
248305
|
+
directory: exports_external.string().optional(),
|
|
248306
|
+
html_handling: exports_external.string().optional(),
|
|
248307
|
+
not_found_handling: exports_external.string().optional(),
|
|
248308
|
+
run_worker_first: exports_external.union([exports_external.boolean(), exports_external.array(exports_external.string())]).optional(),
|
|
248309
|
+
headers: exports_external.string().optional(),
|
|
248310
|
+
redirects: exports_external.string().optional()
|
|
248311
|
+
}).optional(),
|
|
248312
|
+
compatibility_date: exports_external.string().optional(),
|
|
248313
|
+
compatibility_flags: exports_external.array(exports_external.string()).optional(),
|
|
248314
|
+
vars: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
|
|
248315
|
+
upload_source_maps: exports_external.boolean().optional()
|
|
248316
|
+
});
|
|
248317
|
+
async function detectFullStackArtifact(projectRoot) {
|
|
248318
|
+
const redirectPath = join15(projectRoot, WRANGLER_REDIRECT_PATH);
|
|
248319
|
+
return await pathExists(redirectPath) ? redirectPath : null;
|
|
248320
|
+
}
|
|
248321
|
+
async function resolveWranglerConfig(projectRoot) {
|
|
248322
|
+
const redirectPath = await detectFullStackArtifact(projectRoot);
|
|
248323
|
+
if (!redirectPath) {
|
|
248324
|
+
throw new InvalidInputError("No Workers build artifact found. Expected a .wrangler/deploy/config.json redirect file.", {
|
|
248325
|
+
hints: [{ message: "Run your framework's build command first" }]
|
|
248326
|
+
});
|
|
248327
|
+
}
|
|
248328
|
+
const configPath = await resolveRedirectedConfigPath(redirectPath);
|
|
248329
|
+
const parsed = await readJsonFile(configPath);
|
|
248330
|
+
const result = WranglerConfigSchema.safeParse(parsed);
|
|
248331
|
+
if (!result.success) {
|
|
248332
|
+
throw new ConfigInvalidError(`Invalid wrangler config: ${exports_external.prettifyError(result.error)}`, configPath);
|
|
248333
|
+
}
|
|
248334
|
+
const config9 = result.data;
|
|
248335
|
+
if (config9.no_bundle !== true) {
|
|
248336
|
+
throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
|
|
248337
|
+
}
|
|
248338
|
+
const configDir = dirname10(configPath);
|
|
248339
|
+
const assetsDirectory = config9.assets?.directory ? resolve3(configDir, config9.assets.directory) : null;
|
|
248340
|
+
return {
|
|
248341
|
+
configPath,
|
|
248342
|
+
configDir,
|
|
248343
|
+
main: config9.main,
|
|
248344
|
+
assetsDirectory,
|
|
248345
|
+
assetsConfig: config9.assets ? toResolvedAssetsConfig(config9.assets) : null,
|
|
248346
|
+
compatibilityDate: config9.compatibility_date ?? null,
|
|
248347
|
+
compatibilityFlags: config9.compatibility_flags ?? [],
|
|
248348
|
+
vars: config9.vars ?? {},
|
|
248349
|
+
rules: (config9.rules ?? []).map((rule) => ({
|
|
248350
|
+
type: rule.type,
|
|
248351
|
+
globs: rule.globs
|
|
248352
|
+
})),
|
|
248353
|
+
uploadSourceMaps: config9.upload_source_maps ?? false
|
|
248354
|
+
};
|
|
248355
|
+
}
|
|
248356
|
+
async function resolveRedirectedConfigPath(redirectPath) {
|
|
248357
|
+
const parsed = await readJsonFile(redirectPath);
|
|
248358
|
+
const result = RedirectConfigSchema.safeParse(parsed);
|
|
248359
|
+
if (!result.success) {
|
|
248360
|
+
throw new ConfigInvalidError(`Invalid deploy redirect file: ${exports_external.prettifyError(result.error)}`, redirectPath);
|
|
248361
|
+
}
|
|
248362
|
+
const configPath = resolve3(dirname10(redirectPath), result.data.configPath);
|
|
248363
|
+
if (!await pathExists(configPath)) {
|
|
248364
|
+
throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
|
|
248365
|
+
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
248366
|
+
});
|
|
248367
|
+
}
|
|
248368
|
+
return configPath;
|
|
248369
|
+
}
|
|
248370
|
+
function toResolvedAssetsConfig(assets) {
|
|
248371
|
+
return {
|
|
248372
|
+
htmlHandling: assets.html_handling,
|
|
248373
|
+
notFoundHandling: assets.not_found_handling,
|
|
248374
|
+
runWorkerFirst: assets.run_worker_first,
|
|
248375
|
+
headers: assets.headers,
|
|
248376
|
+
redirects: assets.redirects
|
|
248377
|
+
};
|
|
248378
|
+
}
|
|
248379
|
+
|
|
248380
|
+
// src/core/site/deploy-app.ts
|
|
248381
|
+
var STATIC_DEPLOYMENTS_ENV = "BASE44_STATIC_DEPLOYMENTS";
|
|
248382
|
+
function staticDeploymentsEnabled(env2 = process.env) {
|
|
248383
|
+
const value = env2[STATIC_DEPLOYMENTS_ENV];
|
|
248384
|
+
return value === "1" || value === "true";
|
|
248385
|
+
}
|
|
248386
|
+
async function planAppDeploy(target) {
|
|
248387
|
+
const outputDirectory = target.site?.outputDirectory;
|
|
248388
|
+
const outputDir = outputDirectory ? resolve4(target.root, outputDirectory) : null;
|
|
248389
|
+
if (await detectFullStackArtifact(target.root)) {
|
|
248390
|
+
return { kind: "deployment", outputDir };
|
|
248391
|
+
}
|
|
248392
|
+
if (!outputDir) {
|
|
248393
|
+
return { kind: "none" };
|
|
248394
|
+
}
|
|
248395
|
+
return staticDeploymentsEnabled() ? { kind: "deployment", outputDir } : { kind: "tarball", outputDir };
|
|
248396
|
+
}
|
|
248397
|
+
// src/core/site/deployment.ts
|
|
248398
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
248399
|
+
import { join as join17 } from "node:path";
|
|
248400
|
+
|
|
248266
248401
|
// src/core/site/manifest.ts
|
|
248267
248402
|
import { createHash } from "node:crypto";
|
|
248268
248403
|
import { readFile as readFile2, stat } from "node:fs/promises";
|
|
248269
|
-
import { basename as basename4, join as
|
|
248404
|
+
import { basename as basename4, extname, join as join16 } from "node:path";
|
|
248270
248405
|
var MAX_ASSET_SIZE_BYTES = 25 * 1024 * 1024;
|
|
248271
248406
|
var MAX_ASSET_COUNT = 1e5;
|
|
248272
248407
|
var ASSETS_IGNORE_FILE = ".assetsignore";
|
|
@@ -248275,6 +248410,39 @@ var ALWAYS_IGNORED = new Set([
|
|
|
248275
248410
|
"wrangler.json",
|
|
248276
248411
|
".dev.vars"
|
|
248277
248412
|
]);
|
|
248413
|
+
var MIME_TYPES = {
|
|
248414
|
+
".html": "text/html",
|
|
248415
|
+
".htm": "text/html",
|
|
248416
|
+
".css": "text/css",
|
|
248417
|
+
".js": "text/javascript",
|
|
248418
|
+
".mjs": "text/javascript",
|
|
248419
|
+
".json": "application/json",
|
|
248420
|
+
".map": "application/json",
|
|
248421
|
+
".txt": "text/plain",
|
|
248422
|
+
".xml": "application/xml",
|
|
248423
|
+
".svg": "image/svg+xml",
|
|
248424
|
+
".png": "image/png",
|
|
248425
|
+
".jpg": "image/jpeg",
|
|
248426
|
+
".jpeg": "image/jpeg",
|
|
248427
|
+
".gif": "image/gif",
|
|
248428
|
+
".webp": "image/webp",
|
|
248429
|
+
".avif": "image/avif",
|
|
248430
|
+
".ico": "image/x-icon",
|
|
248431
|
+
".woff": "font/woff",
|
|
248432
|
+
".woff2": "font/woff2",
|
|
248433
|
+
".ttf": "font/ttf",
|
|
248434
|
+
".otf": "font/otf",
|
|
248435
|
+
".eot": "application/vnd.ms-fontobject",
|
|
248436
|
+
".mp3": "audio/mpeg",
|
|
248437
|
+
".mp4": "video/mp4",
|
|
248438
|
+
".webm": "video/webm",
|
|
248439
|
+
".pdf": "application/pdf",
|
|
248440
|
+
".wasm": "application/wasm",
|
|
248441
|
+
".webmanifest": "application/manifest+json"
|
|
248442
|
+
};
|
|
248443
|
+
function getAssetContentType(filePath) {
|
|
248444
|
+
return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
248445
|
+
}
|
|
248278
248446
|
function hashAsset(appId, content) {
|
|
248279
248447
|
return createHash("sha256").update(Buffer.from(appId, "utf8")).update(content).digest("hex").slice(0, 32);
|
|
248280
248448
|
}
|
|
@@ -248293,7 +248461,7 @@ async function buildAssetManifest(assetsDir, appId) {
|
|
|
248293
248461
|
throw new InvalidInputError(`Too many static assets: found ${relativeFilePaths.length}, the limit is ${MAX_ASSET_COUNT} files.`);
|
|
248294
248462
|
}
|
|
248295
248463
|
for (const relativePath of relativeFilePaths.sort()) {
|
|
248296
|
-
const absolutePath =
|
|
248464
|
+
const absolutePath = join16(assetsDir, ...relativePath.split("/"));
|
|
248297
248465
|
const { size } = await stat(absolutePath);
|
|
248298
248466
|
if (size > MAX_ASSET_SIZE_BYTES) {
|
|
248299
248467
|
throw new InvalidInputError(`Static asset "${relativePath}" is ${size} bytes, which exceeds the 25 MiB per-file limit.`);
|
|
@@ -248302,14 +248470,111 @@ async function buildAssetManifest(assetsDir, appId) {
|
|
|
248302
248470
|
const hash2 = hashAsset(appId, content);
|
|
248303
248471
|
manifest[`/${relativePath}`] = { hash: hash2, size };
|
|
248304
248472
|
if (!filesByHash.has(hash2)) {
|
|
248305
|
-
filesByHash.set(hash2, {
|
|
248473
|
+
filesByHash.set(hash2, {
|
|
248474
|
+
absolutePath,
|
|
248475
|
+
hash: hash2,
|
|
248476
|
+
size,
|
|
248477
|
+
contentType: getAssetContentType(absolutePath)
|
|
248478
|
+
});
|
|
248306
248479
|
}
|
|
248307
248480
|
}
|
|
248308
248481
|
return { manifest, filesByHash };
|
|
248309
248482
|
}
|
|
248310
|
-
|
|
248311
|
-
|
|
248312
|
-
import {
|
|
248483
|
+
|
|
248484
|
+
// src/core/site/modules.ts
|
|
248485
|
+
import { stat as stat2 } from "node:fs/promises";
|
|
248486
|
+
import { relative as relative3, resolve as resolve5, sep } from "node:path";
|
|
248487
|
+
var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
|
|
248488
|
+
var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
|
|
248489
|
+
var RULE_TYPE_TO_MODULE_TYPE = {
|
|
248490
|
+
ESModule: "esm",
|
|
248491
|
+
CompiledWasm: "wasm",
|
|
248492
|
+
Text: "text",
|
|
248493
|
+
Data: "data"
|
|
248494
|
+
};
|
|
248495
|
+
function toPosix(path11) {
|
|
248496
|
+
return path11.split(sep).join("/");
|
|
248497
|
+
}
|
|
248498
|
+
async function collectModules(config9) {
|
|
248499
|
+
const entryPath = resolve5(config9.configDir, config9.main);
|
|
248500
|
+
if (!await pathExists(entryPath)) {
|
|
248501
|
+
throw new InvalidInputError(`Worker entry module does not exist: ${entryPath} (from "main" in ${config9.configPath})`, {
|
|
248502
|
+
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
248503
|
+
});
|
|
248504
|
+
}
|
|
248505
|
+
const modulesByName = new Map;
|
|
248506
|
+
const entryName = toPosix(relative3(config9.configDir, entryPath));
|
|
248507
|
+
modulesByName.set(entryName, {
|
|
248508
|
+
name: entryName,
|
|
248509
|
+
absolutePath: entryPath,
|
|
248510
|
+
size: 0,
|
|
248511
|
+
type: "esm"
|
|
248512
|
+
});
|
|
248513
|
+
const ignore = [...MODULE_IGNORE];
|
|
248514
|
+
if (config9.assetsDirectory?.startsWith(config9.configDir + sep)) {
|
|
248515
|
+
ignore.push(`${toPosix(relative3(config9.configDir, config9.assetsDirectory))}/**`);
|
|
248516
|
+
}
|
|
248517
|
+
for (const rule of config9.rules) {
|
|
248518
|
+
const type = RULE_TYPE_TO_MODULE_TYPE[rule.type];
|
|
248519
|
+
if (!type) {
|
|
248520
|
+
throw new InvalidInputError(`Unsupported module rule type "${rule.type}" in ${config9.configPath}. Supported: ${Object.keys(RULE_TYPE_TO_MODULE_TYPE).join(", ")}.`);
|
|
248521
|
+
}
|
|
248522
|
+
const matches = await globby(rule.globs, {
|
|
248523
|
+
cwd: config9.configDir,
|
|
248524
|
+
onlyFiles: true,
|
|
248525
|
+
dot: true,
|
|
248526
|
+
ignore
|
|
248527
|
+
});
|
|
248528
|
+
for (const match of matches.sort()) {
|
|
248529
|
+
if (!modulesByName.has(match)) {
|
|
248530
|
+
modulesByName.set(match, {
|
|
248531
|
+
name: match,
|
|
248532
|
+
absolutePath: resolve5(config9.configDir, match),
|
|
248533
|
+
size: 0,
|
|
248534
|
+
type
|
|
248535
|
+
});
|
|
248536
|
+
}
|
|
248537
|
+
}
|
|
248538
|
+
}
|
|
248539
|
+
if (config9.uploadSourceMaps) {
|
|
248540
|
+
const maps = await globby("**/*.map", {
|
|
248541
|
+
cwd: config9.configDir,
|
|
248542
|
+
onlyFiles: true,
|
|
248543
|
+
dot: true,
|
|
248544
|
+
ignore
|
|
248545
|
+
});
|
|
248546
|
+
for (const map2 of maps.sort()) {
|
|
248547
|
+
addSourcemap(modulesByName, config9.configDir, map2);
|
|
248548
|
+
}
|
|
248549
|
+
} else {
|
|
248550
|
+
for (const name2 of [...modulesByName.keys()]) {
|
|
248551
|
+
const mapName = `${name2}.map`;
|
|
248552
|
+
if (await pathExists(resolve5(config9.configDir, mapName))) {
|
|
248553
|
+
addSourcemap(modulesByName, config9.configDir, mapName);
|
|
248554
|
+
}
|
|
248555
|
+
}
|
|
248556
|
+
}
|
|
248557
|
+
const modules = [...modulesByName.values()];
|
|
248558
|
+
let totalBytes = 0;
|
|
248559
|
+
for (const module of modules) {
|
|
248560
|
+
module.size = (await stat2(module.absolutePath)).size;
|
|
248561
|
+
totalBytes += module.size;
|
|
248562
|
+
}
|
|
248563
|
+
if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
|
|
248564
|
+
throw new InvalidInputError(`Worker modules total ${totalBytes} bytes, which exceeds the 40 MB limit for a Base44 deploy.`);
|
|
248565
|
+
}
|
|
248566
|
+
return modules;
|
|
248567
|
+
}
|
|
248568
|
+
function addSourcemap(modulesByName, configDir, name2) {
|
|
248569
|
+
if (modulesByName.has(name2))
|
|
248570
|
+
return;
|
|
248571
|
+
modulesByName.set(name2, {
|
|
248572
|
+
name: name2,
|
|
248573
|
+
absolutePath: resolve5(configDir, name2),
|
|
248574
|
+
size: 0,
|
|
248575
|
+
type: "sourcemap"
|
|
248576
|
+
});
|
|
248577
|
+
}
|
|
248313
248578
|
|
|
248314
248579
|
// src/core/site/upload.ts
|
|
248315
248580
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
@@ -248345,7 +248610,7 @@ async function pMap(iterable, mapper, {
|
|
|
248345
248610
|
const cleanup = () => {
|
|
248346
248611
|
signal?.removeEventListener("abort", signalListener);
|
|
248347
248612
|
};
|
|
248348
|
-
const
|
|
248613
|
+
const resolve6 = (value) => {
|
|
248349
248614
|
resolve_(value);
|
|
248350
248615
|
cleanup();
|
|
248351
248616
|
};
|
|
@@ -248378,7 +248643,7 @@ async function pMap(iterable, mapper, {
|
|
|
248378
248643
|
}
|
|
248379
248644
|
isResolved = true;
|
|
248380
248645
|
if (skippedIndexesMap.size === 0) {
|
|
248381
|
-
|
|
248646
|
+
resolve6(result);
|
|
248382
248647
|
return;
|
|
248383
248648
|
}
|
|
248384
248649
|
const pureResult = [];
|
|
@@ -248388,7 +248653,7 @@ async function pMap(iterable, mapper, {
|
|
|
248388
248653
|
}
|
|
248389
248654
|
pureResult.push(value);
|
|
248390
248655
|
}
|
|
248391
|
-
|
|
248656
|
+
resolve6(pureResult);
|
|
248392
248657
|
}
|
|
248393
248658
|
return;
|
|
248394
248659
|
}
|
|
@@ -248443,6 +248708,83 @@ var DEFAULT_UPLOAD_CONCURRENCY = 3;
|
|
|
248443
248708
|
var MAX_UPLOAD_CONCURRENCY = 50;
|
|
248444
248709
|
var MAX_UPLOAD_ATTEMPTS = 3;
|
|
248445
248710
|
var RETRY_BASE_DELAY_MS = 500;
|
|
248711
|
+
var UPLOAD_RETRY = {
|
|
248712
|
+
limit: MAX_UPLOAD_ATTEMPTS - 1,
|
|
248713
|
+
delay: (attempt) => RETRY_BASE_DELAY_MS * 2 ** (attempt - 1)
|
|
248714
|
+
};
|
|
248715
|
+
async function uploadDeploymentAssets(assetUploads, assets, options = {}) {
|
|
248716
|
+
const { concurrency, progress } = options;
|
|
248717
|
+
progress?.onAssets?.({
|
|
248718
|
+
totalAssets: Object.keys(assets.manifest).length,
|
|
248719
|
+
newAssets: countOwedAssets(assetUploads)
|
|
248720
|
+
});
|
|
248721
|
+
if (!assetUploads) {
|
|
248722
|
+
return null;
|
|
248723
|
+
}
|
|
248724
|
+
const uploadOptions = { concurrency, onProgress: progress?.onAssetUpload };
|
|
248725
|
+
if (assetUploads.type === "cf") {
|
|
248726
|
+
return await uploadAssetBuckets(assetUploads, assets.filesByHash, uploadOptions);
|
|
248727
|
+
}
|
|
248728
|
+
await uploadPresignedAssets(assetUploads.uploads, assets, uploadOptions);
|
|
248729
|
+
return null;
|
|
248730
|
+
}
|
|
248731
|
+
function countOwedAssets(assetUploads) {
|
|
248732
|
+
if (!assetUploads)
|
|
248733
|
+
return 0;
|
|
248734
|
+
return assetUploads.type === "cf" ? new Set(assetUploads.buckets.flat()).size : assetUploads.uploads.length;
|
|
248735
|
+
}
|
|
248736
|
+
async function uploadAssetBuckets(target, filesByHash, options = {}) {
|
|
248737
|
+
const { concurrency = DEFAULT_UPLOAD_CONCURRENCY, onProgress } = options;
|
|
248738
|
+
const { buckets } = target;
|
|
248739
|
+
const totalFiles = buckets.reduce((sum, bucket) => sum + bucket.length, 0);
|
|
248740
|
+
let uploadedFiles = 0;
|
|
248741
|
+
let completionJwt = null;
|
|
248742
|
+
await pMap(buckets, async (bucket) => {
|
|
248743
|
+
const jwt3 = await uploadAssetBucket(target, bucket, filesByHash);
|
|
248744
|
+
if (jwt3) {
|
|
248745
|
+
completionJwt = jwt3;
|
|
248746
|
+
}
|
|
248747
|
+
uploadedFiles += bucket.length;
|
|
248748
|
+
onProgress?.({ uploadedFiles, totalFiles });
|
|
248749
|
+
}, { concurrency });
|
|
248750
|
+
if (!completionJwt) {
|
|
248751
|
+
throw new ApiError("Asset upload finished but the server did not return a completion token.");
|
|
248752
|
+
}
|
|
248753
|
+
return completionJwt;
|
|
248754
|
+
}
|
|
248755
|
+
async function uploadAssetBucket(target, bucket, filesByHash) {
|
|
248756
|
+
const formData = await buildBucketForm(bucket, filesByHash);
|
|
248757
|
+
let response;
|
|
248758
|
+
try {
|
|
248759
|
+
response = await distribution_default.post(target.url, {
|
|
248760
|
+
searchParams: { base64: "true" },
|
|
248761
|
+
headers: { Authorization: `Bearer ${target.jwt}` },
|
|
248762
|
+
body: formData,
|
|
248763
|
+
timeout: 120000,
|
|
248764
|
+
retry: { ...UPLOAD_RETRY, methods: ["post"] }
|
|
248765
|
+
});
|
|
248766
|
+
} catch (error48) {
|
|
248767
|
+
if (error48 instanceof HTTPError && (error48.response.status === 401 || error48.response.status === 403)) {
|
|
248768
|
+
throw new ApiError("This deploy's upload session has expired — rerun deploy. Already-uploaded assets are skipped on the next attempt.", { statusCode: error48.response.status, cause: error48 });
|
|
248769
|
+
}
|
|
248770
|
+
throw await ApiError.fromHttpError(error48, "uploading assets to Cloudflare");
|
|
248771
|
+
}
|
|
248772
|
+
const parsed = AssetUploadResponseSchema.safeParse(await response.json());
|
|
248773
|
+
const jwt3 = parsed.success ? parsed.data.result?.jwt : null;
|
|
248774
|
+
return jwt3 || null;
|
|
248775
|
+
}
|
|
248776
|
+
async function buildBucketForm(bucket, filesByHash) {
|
|
248777
|
+
const formData = new FormData;
|
|
248778
|
+
for (const hash2 of bucket) {
|
|
248779
|
+
const file2 = filesByHash.get(hash2);
|
|
248780
|
+
if (!file2) {
|
|
248781
|
+
throw new InternalError(`Server requested upload of unknown asset hash: ${hash2}`);
|
|
248782
|
+
}
|
|
248783
|
+
const content = await readFile3(file2.absolutePath);
|
|
248784
|
+
formData.append(hash2, new File([content.toString("base64")], hash2, { type: file2.contentType }));
|
|
248785
|
+
}
|
|
248786
|
+
return formData;
|
|
248787
|
+
}
|
|
248446
248788
|
async function uploadPresignedAssets(uploads, assets, options = {}) {
|
|
248447
248789
|
const { concurrency = DEFAULT_UPLOAD_CONCURRENCY, onProgress } = options;
|
|
248448
248790
|
let uploadedFiles = 0;
|
|
@@ -248464,375 +248806,80 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
248464
248806
|
body: new Uint8Array(content),
|
|
248465
248807
|
headers: { "Content-Type": upload.contentType },
|
|
248466
248808
|
timeout: 120000,
|
|
248467
|
-
retry:
|
|
248468
|
-
limit: MAX_UPLOAD_ATTEMPTS - 1,
|
|
248469
|
-
delay: (attempt) => RETRY_BASE_DELAY_MS * 2 ** (attempt - 1)
|
|
248470
|
-
}
|
|
248809
|
+
retry: UPLOAD_RETRY
|
|
248471
248810
|
});
|
|
248472
248811
|
} catch (error48) {
|
|
248473
248812
|
throw await ApiError.fromHttpError(error48, "uploading static assets");
|
|
248474
248813
|
}
|
|
248475
248814
|
}
|
|
248476
248815
|
|
|
248477
|
-
// src/core/site/
|
|
248478
|
-
|
|
248479
|
-
|
|
248480
|
-
const
|
|
248481
|
-
|
|
248482
|
-
|
|
248483
|
-
|
|
248816
|
+
// src/core/site/deployment.ts
|
|
248817
|
+
var NO_ASSETS = { manifest: {}, filesByHash: new Map };
|
|
248818
|
+
async function deployToDeployments(options) {
|
|
248819
|
+
const { projectRoot, outputDir, gitHash, concurrency, progress } = options;
|
|
248820
|
+
const worker = await resolveWorkerBuild(projectRoot, progress);
|
|
248821
|
+
const assetsDir = worker ? worker.assetsDir : outputDir;
|
|
248822
|
+
const assets = assetsDir ? await buildAssetManifest(assetsDir, getAppContext().id) : NO_ASSETS;
|
|
248823
|
+
const completion = worker ? { modules: worker.modules } : { indexHtml: await readIndexHtml(assetsDir, assets) };
|
|
248484
248824
|
const created = await createDeployment({
|
|
248485
248825
|
git_hash: gitHash,
|
|
248826
|
+
config: worker?.config,
|
|
248486
248827
|
asset_manifest: assets.manifest
|
|
248487
248828
|
});
|
|
248488
|
-
|
|
248489
|
-
|
|
248490
|
-
|
|
248491
|
-
});
|
|
248492
|
-
if (created.assetUploads) {
|
|
248493
|
-
await uploadPresignedAssets(created.assetUploads.uploads, assets, {
|
|
248494
|
-
concurrency,
|
|
248495
|
-
onProgress: progress?.onAssetUpload
|
|
248496
|
-
});
|
|
248829
|
+
const completionJwt = await uploadDeploymentAssets(created.assetUploads, assets, { concurrency, progress });
|
|
248830
|
+
if ("modules" in completion) {
|
|
248831
|
+
progress?.onWorker?.({ moduleCount: completion.modules.length });
|
|
248497
248832
|
}
|
|
248498
|
-
const
|
|
248499
|
-
|
|
248500
|
-
return { deploymentId: finalized.deploymentId };
|
|
248833
|
+
const finalized = await finalizeDeployment(created.deploymentId, created.sessionId, "modules" in completion ? { ...completion, completionJwt } : completion);
|
|
248834
|
+
return { deploymentId: finalized.deploymentId, gitHash };
|
|
248501
248835
|
}
|
|
248502
|
-
|
|
248503
|
-
|
|
248504
|
-
|
|
248505
|
-
project,
|
|
248506
|
-
entities,
|
|
248507
|
-
functions,
|
|
248508
|
-
agents,
|
|
248509
|
-
agentSkills,
|
|
248510
|
-
connectors,
|
|
248511
|
-
authConfig
|
|
248512
|
-
} = projectData;
|
|
248513
|
-
const hasSite = Boolean(project.site?.outputDirectory);
|
|
248514
|
-
const hasEntities = entities.length > 0;
|
|
248515
|
-
const hasFunctions = functions.length > 0;
|
|
248516
|
-
const hasAgents = agents.length > 0;
|
|
248517
|
-
const hasAgentSkills = agentSkills.length > 0;
|
|
248518
|
-
const hasConnectors = connectors.length > 0;
|
|
248519
|
-
const hasAuthConfig = authConfig.length > 0;
|
|
248520
|
-
const hasVisibility = Boolean(project.visibility);
|
|
248521
|
-
return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
248522
|
-
}
|
|
248523
|
-
async function deployAll(projectData, options) {
|
|
248524
|
-
const {
|
|
248525
|
-
project,
|
|
248526
|
-
entities,
|
|
248527
|
-
functions,
|
|
248528
|
-
agents,
|
|
248529
|
-
agentSkills,
|
|
248530
|
-
connectors,
|
|
248531
|
-
authConfig
|
|
248532
|
-
} = projectData;
|
|
248533
|
-
await setAppVisibility(project.visibility);
|
|
248534
|
-
if (project.visibility) {
|
|
248535
|
-
options?.onVisibilitySet?.(project.visibility);
|
|
248536
|
-
}
|
|
248537
|
-
await entityResource.push(entities);
|
|
248538
|
-
await deployFunctionsSequentially(functions, {
|
|
248539
|
-
onStart: options?.onFunctionStart,
|
|
248540
|
-
onResult: options?.onFunctionResult
|
|
248541
|
-
});
|
|
248542
|
-
await agentSkillResource.push(agentSkills);
|
|
248543
|
-
await agentResource.push(agents);
|
|
248544
|
-
await authConfigResource.push(authConfig);
|
|
248545
|
-
const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
|
|
248546
|
-
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
248547
|
-
if (project.site?.outputDirectory) {
|
|
248548
|
-
const outputDir = resolve3(project.root, project.site.outputDirectory);
|
|
248549
|
-
const { appUrl } = await deploySite(outputDir);
|
|
248550
|
-
return { appUrl, connectorResults };
|
|
248551
|
-
}
|
|
248552
|
-
return { connectorResults };
|
|
248553
|
-
}
|
|
248554
|
-
// src/core/clients/base44-client.ts
|
|
248555
|
-
var retriedRequests = new WeakSet;
|
|
248556
|
-
async function captureRequestBody(request, options) {
|
|
248557
|
-
if (request.body == null) {
|
|
248558
|
-
return;
|
|
248559
|
-
}
|
|
248560
|
-
try {
|
|
248561
|
-
const cloned = request.clone();
|
|
248562
|
-
const text = await cloned.text();
|
|
248563
|
-
options.context.__requestBody = text;
|
|
248564
|
-
} catch {}
|
|
248565
|
-
}
|
|
248566
|
-
async function handleUnauthorized(request, _options, response) {
|
|
248567
|
-
if (response.status !== 401) {
|
|
248568
|
-
return;
|
|
248569
|
-
}
|
|
248570
|
-
if (hasWorkspaceApiKeyAuth()) {
|
|
248571
|
-
return;
|
|
248572
|
-
}
|
|
248573
|
-
if (retriedRequests.has(request)) {
|
|
248574
|
-
return;
|
|
248575
|
-
}
|
|
248576
|
-
const newAccessToken = await refreshAndSaveTokens();
|
|
248577
|
-
if (!newAccessToken) {
|
|
248578
|
-
return;
|
|
248579
|
-
}
|
|
248580
|
-
retriedRequests.add(request);
|
|
248581
|
-
const requestId = request.headers.get("X-Request-ID");
|
|
248582
|
-
return distribution_default(request.clone(), {
|
|
248583
|
-
headers: {
|
|
248584
|
-
...requestId && { "X-Request-ID": requestId },
|
|
248585
|
-
Authorization: `Bearer ${newAccessToken}`
|
|
248586
|
-
}
|
|
248587
|
-
});
|
|
248588
|
-
}
|
|
248589
|
-
var base44Client = distribution_default.create({
|
|
248590
|
-
prefixUrl: getBase44ApiUrl(),
|
|
248591
|
-
headers: {
|
|
248592
|
-
"User-Agent": "Base44 CLI"
|
|
248593
|
-
},
|
|
248594
|
-
hooks: {
|
|
248595
|
-
beforeRequest: [
|
|
248596
|
-
(request) => {
|
|
248597
|
-
request.headers.set("X-Request-ID", randomUUID2());
|
|
248598
|
-
},
|
|
248599
|
-
captureRequestBody,
|
|
248600
|
-
async (request) => {
|
|
248601
|
-
const workspaceApiKey = getWorkspaceApiKeyFromEnv();
|
|
248602
|
-
if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
|
|
248603
|
-
request.headers.set("api_key", workspaceApiKey);
|
|
248604
|
-
return;
|
|
248605
|
-
}
|
|
248606
|
-
try {
|
|
248607
|
-
const auth = await readAuth();
|
|
248608
|
-
if (isTokenExpired(auth)) {
|
|
248609
|
-
const newAccessToken = await refreshAndSaveTokens();
|
|
248610
|
-
if (newAccessToken) {
|
|
248611
|
-
request.headers.set("Authorization", `Bearer ${newAccessToken}`);
|
|
248612
|
-
return;
|
|
248613
|
-
}
|
|
248614
|
-
}
|
|
248615
|
-
request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
|
|
248616
|
-
} catch {}
|
|
248617
|
-
}
|
|
248618
|
-
],
|
|
248619
|
-
afterResponse: [handleUnauthorized]
|
|
248620
|
-
}
|
|
248621
|
-
});
|
|
248622
|
-
function getAppClient() {
|
|
248623
|
-
const { id } = getAppContext();
|
|
248624
|
-
return base44Client.extend({
|
|
248625
|
-
prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
|
|
248626
|
-
});
|
|
248627
|
-
}
|
|
248628
|
-
function getSandboxClient(appId) {
|
|
248629
|
-
return base44Client.extend({
|
|
248630
|
-
prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
|
|
248631
|
-
});
|
|
248632
|
-
}
|
|
248633
|
-
// src/core/clients/oauth-client.ts
|
|
248634
|
-
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
248635
|
-
var oauthClient = distribution_default.create({
|
|
248636
|
-
prefixUrl: getBase44ApiUrl(),
|
|
248637
|
-
headers: {
|
|
248638
|
-
"User-Agent": "Base44 CLI"
|
|
248639
|
-
},
|
|
248640
|
-
hooks: {
|
|
248641
|
-
beforeRequest: [
|
|
248642
|
-
(request) => {
|
|
248643
|
-
request.headers.set("X-Request-ID", randomUUID3());
|
|
248644
|
-
}
|
|
248645
|
-
]
|
|
248836
|
+
async function resolveWorkerBuild(projectRoot, progress) {
|
|
248837
|
+
if (!await detectFullStackArtifact(projectRoot)) {
|
|
248838
|
+
return null;
|
|
248646
248839
|
}
|
|
248647
|
-
|
|
248648
|
-
|
|
248649
|
-
|
|
248650
|
-
const response = await oauthClient.post("oauth/device/code", {
|
|
248651
|
-
json: {
|
|
248652
|
-
client_id: AUTH_CLIENT_ID,
|
|
248653
|
-
scope: "apps:read apps:write sandbox:write"
|
|
248654
|
-
},
|
|
248655
|
-
throwHttpErrors: false
|
|
248656
|
-
});
|
|
248657
|
-
if (!response.ok) {
|
|
248658
|
-
throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
|
|
248840
|
+
const config9 = await resolveWranglerConfig(projectRoot);
|
|
248841
|
+
if (!config9.compatibilityFlags.includes("nodejs_compat")) {
|
|
248842
|
+
progress?.onWarning?.("The wrangler config has no 'nodejs_compat' compatibility flag; Node.js built-ins will be unavailable at runtime. Enable it in your framework's Cloudflare adapter settings if your server code needs Node APIs.");
|
|
248659
248843
|
}
|
|
248660
|
-
|
|
248661
|
-
|
|
248662
|
-
throw new SchemaValidationError("Invalid device code response from server", result.error);
|
|
248844
|
+
if (Object.keys(config9.vars).length > 0) {
|
|
248845
|
+
progress?.onWarning?.("wrangler 'vars' are not supported and were ignored — a worker's environment comes from the app's secrets (base44 secrets set).");
|
|
248663
248846
|
}
|
|
248664
|
-
|
|
248665
|
-
|
|
248666
|
-
|
|
248667
|
-
|
|
248668
|
-
|
|
248669
|
-
|
|
248670
|
-
|
|
248671
|
-
const response = await oauthClient.post("oauth/token", {
|
|
248672
|
-
body: searchParams.toString(),
|
|
248673
|
-
headers: {
|
|
248674
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
248675
|
-
},
|
|
248676
|
-
throwHttpErrors: false
|
|
248677
|
-
});
|
|
248678
|
-
const json2 = await response.json();
|
|
248679
|
-
if (!response.ok) {
|
|
248680
|
-
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
248681
|
-
if (!errorResult.success) {
|
|
248682
|
-
throw new SchemaValidationError("Token request failed", errorResult.error);
|
|
248683
|
-
}
|
|
248684
|
-
const { error: error48, error_description } = errorResult.data;
|
|
248685
|
-
if (error48 === "authorization_pending" || error48 === "slow_down") {
|
|
248686
|
-
return null;
|
|
248687
|
-
}
|
|
248688
|
-
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
248689
|
-
statusCode: response.status
|
|
248690
|
-
});
|
|
248691
|
-
}
|
|
248692
|
-
const result = TokenResponseSchema.safeParse(json2);
|
|
248693
|
-
if (!result.success) {
|
|
248694
|
-
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
248695
|
-
}
|
|
248696
|
-
return result.data;
|
|
248697
|
-
}
|
|
248698
|
-
async function renewAccessToken(refreshToken) {
|
|
248699
|
-
const searchParams = new URLSearchParams;
|
|
248700
|
-
searchParams.set("grant_type", "refresh_token");
|
|
248701
|
-
searchParams.set("refresh_token", refreshToken);
|
|
248702
|
-
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
248703
|
-
const response = await oauthClient.post("oauth/token", {
|
|
248704
|
-
body: searchParams.toString(),
|
|
248705
|
-
headers: {
|
|
248706
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
248847
|
+
const assetsDir = config9.assetsDirectory && await pathExists(config9.assetsDirectory) ? config9.assetsDirectory : null;
|
|
248848
|
+
return {
|
|
248849
|
+
config: {
|
|
248850
|
+
main: config9.main,
|
|
248851
|
+
compatibility_date: config9.compatibilityDate,
|
|
248852
|
+
compatibility_flags: config9.compatibilityFlags,
|
|
248853
|
+
assets: buildAssetsConfig(config9.assetsConfig, progress)
|
|
248707
248854
|
},
|
|
248708
|
-
|
|
248709
|
-
|
|
248710
|
-
|
|
248711
|
-
if (!response.ok) {
|
|
248712
|
-
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
248713
|
-
if (!errorResult.success) {
|
|
248714
|
-
throw new ApiError(`Token refresh failed: ${response.statusText}`, {
|
|
248715
|
-
statusCode: response.status
|
|
248716
|
-
});
|
|
248717
|
-
}
|
|
248718
|
-
const { error: error48, error_description } = errorResult.data;
|
|
248719
|
-
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
248720
|
-
statusCode: response.status
|
|
248721
|
-
});
|
|
248722
|
-
}
|
|
248723
|
-
const result = TokenResponseSchema.safeParse(json2);
|
|
248724
|
-
if (!result.success) {
|
|
248725
|
-
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
248726
|
-
}
|
|
248727
|
-
return result.data;
|
|
248855
|
+
modules: await collectModules(config9),
|
|
248856
|
+
assetsDir
|
|
248857
|
+
};
|
|
248728
248858
|
}
|
|
248729
|
-
async function
|
|
248730
|
-
|
|
248731
|
-
|
|
248732
|
-
});
|
|
248733
|
-
if (!response.ok) {
|
|
248734
|
-
throw new ApiError(`Failed to fetch user info: ${response.status}`, {
|
|
248735
|
-
statusCode: response.status
|
|
248736
|
-
});
|
|
248859
|
+
async function readIndexHtml(assetsDir, assets) {
|
|
248860
|
+
if (!assetsDir || !assets.manifest["/index.html"]) {
|
|
248861
|
+
throw new InvalidInputError(`No index.html found in "${assetsDir ?? "the site output directory"}" — a static site needs one at the output directory root.`);
|
|
248737
248862
|
}
|
|
248738
|
-
|
|
248739
|
-
if (!result.success) {
|
|
248740
|
-
throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
|
|
248741
|
-
}
|
|
248742
|
-
return result.data;
|
|
248743
|
-
}
|
|
248744
|
-
// src/cli/commands/auth/login-flow.ts
|
|
248745
|
-
async function generateAndDisplayDeviceCode(log, runTask) {
|
|
248746
|
-
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
248747
|
-
return await generateDeviceCode();
|
|
248748
|
-
}, {
|
|
248749
|
-
successMessage: "Device code generated",
|
|
248750
|
-
errorMessage: "Failed to generate device code"
|
|
248751
|
-
});
|
|
248752
|
-
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
248753
|
-
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
248754
|
-
return deviceCodeResponse;
|
|
248863
|
+
return new Uint8Array(await readFile4(join17(assetsDir, "index.html")));
|
|
248755
248864
|
}
|
|
248756
|
-
|
|
248757
|
-
|
|
248758
|
-
|
|
248759
|
-
|
|
248760
|
-
|
|
248761
|
-
const result = await getTokenFromDeviceCode(deviceCode);
|
|
248762
|
-
if (result !== null) {
|
|
248763
|
-
tokenResponse = result;
|
|
248764
|
-
return true;
|
|
248765
|
-
}
|
|
248766
|
-
return false;
|
|
248767
|
-
}, {
|
|
248768
|
-
interval: interval * 1000,
|
|
248769
|
-
timeout: expiresIn * 1000
|
|
248770
|
-
});
|
|
248771
|
-
}, {
|
|
248772
|
-
successMessage: "Authentication completed!",
|
|
248773
|
-
errorMessage: "Authentication failed"
|
|
248774
|
-
});
|
|
248775
|
-
} catch (error48) {
|
|
248776
|
-
if (error48 instanceof Error && error48.message.includes("timed out")) {
|
|
248777
|
-
throw new AuthExpiredError("Authentication timed out. Please try again.");
|
|
248778
|
-
}
|
|
248779
|
-
throw error48;
|
|
248865
|
+
function buildAssetsConfig(assetsConfig, progress) {
|
|
248866
|
+
if (!assetsConfig)
|
|
248867
|
+
return null;
|
|
248868
|
+
if (assetsConfig.headers || assetsConfig.redirects) {
|
|
248869
|
+
progress?.onWarning?.("_headers/_redirects files are not supported yet and were ignored for this deploy.");
|
|
248780
248870
|
}
|
|
248781
|
-
|
|
248782
|
-
|
|
248871
|
+
let runWorkerFirst;
|
|
248872
|
+
if (Array.isArray(assetsConfig.runWorkerFirst)) {
|
|
248873
|
+
progress?.onWarning?.("'run_worker_first' route patterns are not supported yet and were ignored for this deploy.");
|
|
248874
|
+
} else {
|
|
248875
|
+
runWorkerFirst = assetsConfig.runWorkerFirst;
|
|
248783
248876
|
}
|
|
248784
|
-
return tokenResponse;
|
|
248785
|
-
}
|
|
248786
|
-
async function saveAuthData(response, userInfo) {
|
|
248787
|
-
const expiresAt = Date.now() + response.expiresIn * 1000;
|
|
248788
|
-
await writeAuth({
|
|
248789
|
-
accessToken: response.accessToken,
|
|
248790
|
-
refreshToken: response.refreshToken,
|
|
248791
|
-
expiresAt,
|
|
248792
|
-
email: userInfo.email,
|
|
248793
|
-
name: userInfo.name
|
|
248794
|
-
});
|
|
248795
|
-
}
|
|
248796
|
-
async function login({
|
|
248797
|
-
log,
|
|
248798
|
-
runTask
|
|
248799
|
-
}) {
|
|
248800
|
-
const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
|
|
248801
|
-
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
|
|
248802
|
-
const userInfo = await getUserInfo(token.accessToken);
|
|
248803
|
-
await saveAuthData(token, userInfo);
|
|
248804
248877
|
return {
|
|
248805
|
-
|
|
248878
|
+
html_handling: assetsConfig.htmlHandling,
|
|
248879
|
+
not_found_handling: assetsConfig.notFoundHandling,
|
|
248880
|
+
run_worker_first: runWorkerFirst
|
|
248806
248881
|
};
|
|
248807
248882
|
}
|
|
248808
|
-
|
|
248809
|
-
// src/cli/utils/command/middleware.ts
|
|
248810
|
-
async function ensureAuth(ctx) {
|
|
248811
|
-
if (hasWorkspaceApiKeyAuth()) {
|
|
248812
|
-
ctx.errorReporter.setContext({
|
|
248813
|
-
user: { email: "workspace-api-key", name: "Workspace API key" }
|
|
248814
|
-
});
|
|
248815
|
-
return;
|
|
248816
|
-
}
|
|
248817
|
-
await seedAuthFromEnv();
|
|
248818
|
-
const loggedIn = await isLoggedIn();
|
|
248819
|
-
if (!loggedIn) {
|
|
248820
|
-
ctx.log.info("You need to login first to continue.");
|
|
248821
|
-
await login(ctx);
|
|
248822
|
-
}
|
|
248823
|
-
try {
|
|
248824
|
-
const userInfo = await readAuth();
|
|
248825
|
-
ctx.errorReporter.setContext({
|
|
248826
|
-
user: { email: userInfo.email, name: userInfo.name }
|
|
248827
|
-
});
|
|
248828
|
-
} catch {}
|
|
248829
|
-
}
|
|
248830
|
-
async function ensureAppContext(ctx, options = {}) {
|
|
248831
|
-
const appContext = await initAppContext(options);
|
|
248832
|
-
ctx.app = appContext;
|
|
248833
|
-
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
248834
|
-
}
|
|
248835
|
-
|
|
248836
248883
|
// ../../node_modules/is-plain-obj/index.js
|
|
248837
248884
|
function isPlainObject2(value) {
|
|
248838
248885
|
if (typeof value !== "object" || value === null) {
|
|
@@ -248930,13 +248977,13 @@ var getJoinLength = (uint8Arrays) => {
|
|
|
248930
248977
|
var isTemplateString = (templates) => Array.isArray(templates) && Array.isArray(templates.raw);
|
|
248931
248978
|
var parseTemplates = (templates, expressions) => {
|
|
248932
248979
|
let tokens = [];
|
|
248933
|
-
for (const [index,
|
|
248980
|
+
for (const [index, template] of templates.entries()) {
|
|
248934
248981
|
tokens = parseTemplate({
|
|
248935
248982
|
templates,
|
|
248936
248983
|
expressions,
|
|
248937
248984
|
tokens,
|
|
248938
248985
|
index,
|
|
248939
|
-
template
|
|
248986
|
+
template
|
|
248940
248987
|
});
|
|
248941
248988
|
}
|
|
248942
248989
|
if (tokens.length === 0) {
|
|
@@ -248945,11 +248992,11 @@ var parseTemplates = (templates, expressions) => {
|
|
|
248945
248992
|
const [file2, ...commandArguments] = tokens;
|
|
248946
248993
|
return [file2, commandArguments, {}];
|
|
248947
248994
|
};
|
|
248948
|
-
var parseTemplate = ({ templates, expressions, tokens, index, template
|
|
248949
|
-
if (
|
|
248995
|
+
var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
|
|
248996
|
+
if (template === undefined) {
|
|
248950
248997
|
throw new TypeError(`Invalid backslash sequence: ${templates.raw[index]}`);
|
|
248951
248998
|
}
|
|
248952
|
-
const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(
|
|
248999
|
+
const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(template, templates.raw[index]);
|
|
248953
249000
|
const newTokens = concatTokens(tokens, nextTokens, leadingWhitespaces);
|
|
248954
249001
|
if (index === expressions.length) {
|
|
248955
249002
|
return newTokens;
|
|
@@ -248958,18 +249005,18 @@ var parseTemplate = ({ templates, expressions, tokens, index, template: template
|
|
|
248958
249005
|
const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
|
|
248959
249006
|
return concatTokens(newTokens, expressionTokens, trailingWhitespaces);
|
|
248960
249007
|
};
|
|
248961
|
-
var splitByWhitespaces = (
|
|
249008
|
+
var splitByWhitespaces = (template, rawTemplate) => {
|
|
248962
249009
|
if (rawTemplate.length === 0) {
|
|
248963
249010
|
return { nextTokens: [], leadingWhitespaces: false, trailingWhitespaces: false };
|
|
248964
249011
|
}
|
|
248965
249012
|
const nextTokens = [];
|
|
248966
249013
|
let templateStart = 0;
|
|
248967
249014
|
const leadingWhitespaces = DELIMITERS.has(rawTemplate[0]);
|
|
248968
|
-
for (let templateIndex = 0, rawIndex = 0;templateIndex <
|
|
249015
|
+
for (let templateIndex = 0, rawIndex = 0;templateIndex < template.length; templateIndex += 1, rawIndex += 1) {
|
|
248969
249016
|
const rawCharacter = rawTemplate[rawIndex];
|
|
248970
249017
|
if (DELIMITERS.has(rawCharacter)) {
|
|
248971
249018
|
if (templateStart !== templateIndex) {
|
|
248972
|
-
nextTokens.push(
|
|
249019
|
+
nextTokens.push(template.slice(templateStart, templateIndex));
|
|
248973
249020
|
}
|
|
248974
249021
|
templateStart = templateIndex + 1;
|
|
248975
249022
|
} else if (rawCharacter === "\\") {
|
|
@@ -248985,9 +249032,9 @@ var splitByWhitespaces = (template2, rawTemplate) => {
|
|
|
248985
249032
|
}
|
|
248986
249033
|
}
|
|
248987
249034
|
}
|
|
248988
|
-
const trailingWhitespaces = templateStart ===
|
|
249035
|
+
const trailingWhitespaces = templateStart === template.length;
|
|
248989
249036
|
if (!trailingWhitespaces) {
|
|
248990
|
-
nextTokens.push(
|
|
249037
|
+
nextTokens.push(template.slice(templateStart));
|
|
248991
249038
|
}
|
|
248992
249039
|
return { nextTokens, leadingWhitespaces, trailingWhitespaces };
|
|
248993
249040
|
};
|
|
@@ -250381,8 +250428,8 @@ var disconnect = (anyProcess) => {
|
|
|
250381
250428
|
// ../../node_modules/execa/lib/utils/deferred.js
|
|
250382
250429
|
var createDeferred = () => {
|
|
250383
250430
|
const methods = {};
|
|
250384
|
-
const promise2 = new Promise((
|
|
250385
|
-
Object.assign(methods, { resolve:
|
|
250431
|
+
const promise2 = new Promise((resolve6, reject) => {
|
|
250432
|
+
Object.assign(methods, { resolve: resolve6, reject });
|
|
250386
250433
|
});
|
|
250387
250434
|
return Object.assign(promise2, methods);
|
|
250388
250435
|
};
|
|
@@ -254746,11 +254793,11 @@ var addConcurrentStream = (concurrentStreams, stream, waitName) => {
|
|
|
254746
254793
|
const promises = weakMap.get(stream);
|
|
254747
254794
|
const promise2 = createDeferred();
|
|
254748
254795
|
promises.push(promise2);
|
|
254749
|
-
const
|
|
254750
|
-
return { resolve:
|
|
254796
|
+
const resolve6 = promise2.resolve.bind(promise2);
|
|
254797
|
+
return { resolve: resolve6, promises };
|
|
254751
254798
|
};
|
|
254752
|
-
var waitForConcurrentStreams = async ({ resolve:
|
|
254753
|
-
|
|
254799
|
+
var waitForConcurrentStreams = async ({ resolve: resolve6, promises }, subprocess) => {
|
|
254800
|
+
resolve6();
|
|
254754
254801
|
const [isSubprocessExit] = await Promise.race([
|
|
254755
254802
|
Promise.allSettled([true, subprocess]),
|
|
254756
254803
|
Promise.all([false, ...promises])
|
|
@@ -255329,6 +255376,370 @@ var {
|
|
|
255329
255376
|
getCancelSignal: getCancelSignal2
|
|
255330
255377
|
} = getIpcExport();
|
|
255331
255378
|
|
|
255379
|
+
// src/core/utils/git.ts
|
|
255380
|
+
var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
|
|
255381
|
+
function isGitCommitHash(value) {
|
|
255382
|
+
return GIT_HASH_PATTERN.test(value);
|
|
255383
|
+
}
|
|
255384
|
+
|
|
255385
|
+
// src/core/site/git-hash.ts
|
|
255386
|
+
async function resolveGitHash(projectRoot, explicit) {
|
|
255387
|
+
const hash2 = explicit ?? await gitHead(projectRoot);
|
|
255388
|
+
if (!hash2 || !isGitCommitHash(hash2)) {
|
|
255389
|
+
throw new InvalidInputError(explicit ? `'${explicit}' is not a git commit hash.` : "Deployments are addressed by the commit that produced the build, and no git commit was found.", {
|
|
255390
|
+
hints: [
|
|
255391
|
+
{
|
|
255392
|
+
message: "Run the deploy from a git checkout, or pass the commit explicitly with --git-hash."
|
|
255393
|
+
}
|
|
255394
|
+
]
|
|
255395
|
+
});
|
|
255396
|
+
}
|
|
255397
|
+
return hash2;
|
|
255398
|
+
}
|
|
255399
|
+
async function gitHead(projectRoot) {
|
|
255400
|
+
try {
|
|
255401
|
+
const { stdout } = await execa("git", ["rev-parse", "HEAD"], {
|
|
255402
|
+
cwd: projectRoot
|
|
255403
|
+
});
|
|
255404
|
+
return stdout.trim();
|
|
255405
|
+
} catch {
|
|
255406
|
+
return null;
|
|
255407
|
+
}
|
|
255408
|
+
}
|
|
255409
|
+
// src/core/project/deploy.ts
|
|
255410
|
+
function hasResourcesToDeploy(projectData) {
|
|
255411
|
+
const {
|
|
255412
|
+
project,
|
|
255413
|
+
entities,
|
|
255414
|
+
functions,
|
|
255415
|
+
agents,
|
|
255416
|
+
agentSkills,
|
|
255417
|
+
connectors,
|
|
255418
|
+
authConfig
|
|
255419
|
+
} = projectData;
|
|
255420
|
+
const hasSite = Boolean(project.site?.outputDirectory);
|
|
255421
|
+
const hasEntities = entities.length > 0;
|
|
255422
|
+
const hasFunctions = functions.length > 0;
|
|
255423
|
+
const hasAgents = agents.length > 0;
|
|
255424
|
+
const hasAgentSkills = agentSkills.length > 0;
|
|
255425
|
+
const hasConnectors = connectors.length > 0;
|
|
255426
|
+
const hasAuthConfig = authConfig.length > 0;
|
|
255427
|
+
const hasVisibility = Boolean(project.visibility);
|
|
255428
|
+
return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
|
|
255429
|
+
}
|
|
255430
|
+
async function deployAll(projectData, options) {
|
|
255431
|
+
const {
|
|
255432
|
+
project,
|
|
255433
|
+
entities,
|
|
255434
|
+
functions,
|
|
255435
|
+
agents,
|
|
255436
|
+
agentSkills,
|
|
255437
|
+
connectors,
|
|
255438
|
+
authConfig
|
|
255439
|
+
} = projectData;
|
|
255440
|
+
await setAppVisibility(project.visibility);
|
|
255441
|
+
if (project.visibility) {
|
|
255442
|
+
options?.onVisibilitySet?.(project.visibility);
|
|
255443
|
+
}
|
|
255444
|
+
await entityResource.push(entities);
|
|
255445
|
+
await deployFunctionsSequentially(functions, {
|
|
255446
|
+
onStart: options?.onFunctionStart,
|
|
255447
|
+
onResult: options?.onFunctionResult
|
|
255448
|
+
});
|
|
255449
|
+
await agentSkillResource.push(agentSkills);
|
|
255450
|
+
await agentResource.push(agents);
|
|
255451
|
+
await authConfigResource.push(authConfig);
|
|
255452
|
+
const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
|
|
255453
|
+
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
255454
|
+
if (project.site?.outputDirectory) {
|
|
255455
|
+
const outputDir = resolve6(project.root, project.site.outputDirectory);
|
|
255456
|
+
const { appUrl } = await deploySite(outputDir);
|
|
255457
|
+
return { appUrl, connectorResults };
|
|
255458
|
+
}
|
|
255459
|
+
return { connectorResults };
|
|
255460
|
+
}
|
|
255461
|
+
// src/core/clients/base44-client.ts
|
|
255462
|
+
var retriedRequests = new WeakSet;
|
|
255463
|
+
async function captureRequestBody(request, options) {
|
|
255464
|
+
if (request.body == null) {
|
|
255465
|
+
return;
|
|
255466
|
+
}
|
|
255467
|
+
try {
|
|
255468
|
+
const cloned = request.clone();
|
|
255469
|
+
const text = await cloned.text();
|
|
255470
|
+
options.context.__requestBody = text;
|
|
255471
|
+
} catch {}
|
|
255472
|
+
}
|
|
255473
|
+
async function handleUnauthorized(request, _options, response) {
|
|
255474
|
+
if (response.status !== 401) {
|
|
255475
|
+
return;
|
|
255476
|
+
}
|
|
255477
|
+
if (hasWorkspaceApiKeyAuth()) {
|
|
255478
|
+
return;
|
|
255479
|
+
}
|
|
255480
|
+
if (retriedRequests.has(request)) {
|
|
255481
|
+
return;
|
|
255482
|
+
}
|
|
255483
|
+
const newAccessToken = await refreshAndSaveTokens();
|
|
255484
|
+
if (!newAccessToken) {
|
|
255485
|
+
return;
|
|
255486
|
+
}
|
|
255487
|
+
retriedRequests.add(request);
|
|
255488
|
+
const requestId = request.headers.get("X-Request-ID");
|
|
255489
|
+
return distribution_default(request.clone(), {
|
|
255490
|
+
headers: {
|
|
255491
|
+
...requestId && { "X-Request-ID": requestId },
|
|
255492
|
+
Authorization: `Bearer ${newAccessToken}`
|
|
255493
|
+
}
|
|
255494
|
+
});
|
|
255495
|
+
}
|
|
255496
|
+
var base44Client = distribution_default.create({
|
|
255497
|
+
prefixUrl: getBase44ApiUrl(),
|
|
255498
|
+
headers: {
|
|
255499
|
+
"User-Agent": "Base44 CLI"
|
|
255500
|
+
},
|
|
255501
|
+
hooks: {
|
|
255502
|
+
beforeRequest: [
|
|
255503
|
+
(request) => {
|
|
255504
|
+
request.headers.set("X-Request-ID", randomUUID2());
|
|
255505
|
+
},
|
|
255506
|
+
captureRequestBody,
|
|
255507
|
+
async (request) => {
|
|
255508
|
+
const workspaceApiKey = getWorkspaceApiKeyFromEnv();
|
|
255509
|
+
if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
|
|
255510
|
+
request.headers.set("api_key", workspaceApiKey);
|
|
255511
|
+
return;
|
|
255512
|
+
}
|
|
255513
|
+
try {
|
|
255514
|
+
const auth = await readAuth();
|
|
255515
|
+
if (isTokenExpired(auth)) {
|
|
255516
|
+
const newAccessToken = await refreshAndSaveTokens();
|
|
255517
|
+
if (newAccessToken) {
|
|
255518
|
+
request.headers.set("Authorization", `Bearer ${newAccessToken}`);
|
|
255519
|
+
return;
|
|
255520
|
+
}
|
|
255521
|
+
}
|
|
255522
|
+
request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
|
|
255523
|
+
} catch {}
|
|
255524
|
+
}
|
|
255525
|
+
],
|
|
255526
|
+
afterResponse: [handleUnauthorized]
|
|
255527
|
+
}
|
|
255528
|
+
});
|
|
255529
|
+
function getAppClient() {
|
|
255530
|
+
const { id } = getAppContext();
|
|
255531
|
+
return base44Client.extend({
|
|
255532
|
+
prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
|
|
255533
|
+
});
|
|
255534
|
+
}
|
|
255535
|
+
function getSandboxClient(appId) {
|
|
255536
|
+
return base44Client.extend({
|
|
255537
|
+
prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
|
|
255538
|
+
});
|
|
255539
|
+
}
|
|
255540
|
+
// src/core/clients/oauth-client.ts
|
|
255541
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
255542
|
+
var oauthClient = distribution_default.create({
|
|
255543
|
+
prefixUrl: getBase44ApiUrl(),
|
|
255544
|
+
headers: {
|
|
255545
|
+
"User-Agent": "Base44 CLI"
|
|
255546
|
+
},
|
|
255547
|
+
hooks: {
|
|
255548
|
+
beforeRequest: [
|
|
255549
|
+
(request) => {
|
|
255550
|
+
request.headers.set("X-Request-ID", randomUUID3());
|
|
255551
|
+
}
|
|
255552
|
+
]
|
|
255553
|
+
}
|
|
255554
|
+
});
|
|
255555
|
+
// src/core/auth/api.ts
|
|
255556
|
+
async function generateDeviceCode() {
|
|
255557
|
+
const response = await oauthClient.post("oauth/device/code", {
|
|
255558
|
+
json: {
|
|
255559
|
+
client_id: AUTH_CLIENT_ID,
|
|
255560
|
+
scope: "apps:read apps:write sandbox:write"
|
|
255561
|
+
},
|
|
255562
|
+
throwHttpErrors: false
|
|
255563
|
+
});
|
|
255564
|
+
if (!response.ok) {
|
|
255565
|
+
throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
|
|
255566
|
+
}
|
|
255567
|
+
const result = DeviceCodeResponseSchema.safeParse(await response.json());
|
|
255568
|
+
if (!result.success) {
|
|
255569
|
+
throw new SchemaValidationError("Invalid device code response from server", result.error);
|
|
255570
|
+
}
|
|
255571
|
+
return result.data;
|
|
255572
|
+
}
|
|
255573
|
+
async function getTokenFromDeviceCode(deviceCode) {
|
|
255574
|
+
const searchParams = new URLSearchParams;
|
|
255575
|
+
searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
|
|
255576
|
+
searchParams.set("device_code", deviceCode);
|
|
255577
|
+
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
255578
|
+
const response = await oauthClient.post("oauth/token", {
|
|
255579
|
+
body: searchParams.toString(),
|
|
255580
|
+
headers: {
|
|
255581
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
255582
|
+
},
|
|
255583
|
+
throwHttpErrors: false
|
|
255584
|
+
});
|
|
255585
|
+
const json2 = await response.json();
|
|
255586
|
+
if (!response.ok) {
|
|
255587
|
+
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
255588
|
+
if (!errorResult.success) {
|
|
255589
|
+
throw new SchemaValidationError("Token request failed", errorResult.error);
|
|
255590
|
+
}
|
|
255591
|
+
const { error: error48, error_description } = errorResult.data;
|
|
255592
|
+
if (error48 === "authorization_pending" || error48 === "slow_down") {
|
|
255593
|
+
return null;
|
|
255594
|
+
}
|
|
255595
|
+
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
255596
|
+
statusCode: response.status
|
|
255597
|
+
});
|
|
255598
|
+
}
|
|
255599
|
+
const result = TokenResponseSchema.safeParse(json2);
|
|
255600
|
+
if (!result.success) {
|
|
255601
|
+
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
255602
|
+
}
|
|
255603
|
+
return result.data;
|
|
255604
|
+
}
|
|
255605
|
+
async function renewAccessToken(refreshToken) {
|
|
255606
|
+
const searchParams = new URLSearchParams;
|
|
255607
|
+
searchParams.set("grant_type", "refresh_token");
|
|
255608
|
+
searchParams.set("refresh_token", refreshToken);
|
|
255609
|
+
searchParams.set("client_id", AUTH_CLIENT_ID);
|
|
255610
|
+
const response = await oauthClient.post("oauth/token", {
|
|
255611
|
+
body: searchParams.toString(),
|
|
255612
|
+
headers: {
|
|
255613
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
255614
|
+
},
|
|
255615
|
+
throwHttpErrors: false
|
|
255616
|
+
});
|
|
255617
|
+
const json2 = await response.json();
|
|
255618
|
+
if (!response.ok) {
|
|
255619
|
+
const errorResult = OAuthErrorSchema.safeParse(json2);
|
|
255620
|
+
if (!errorResult.success) {
|
|
255621
|
+
throw new ApiError(`Token refresh failed: ${response.statusText}`, {
|
|
255622
|
+
statusCode: response.status
|
|
255623
|
+
});
|
|
255624
|
+
}
|
|
255625
|
+
const { error: error48, error_description } = errorResult.data;
|
|
255626
|
+
throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
|
|
255627
|
+
statusCode: response.status
|
|
255628
|
+
});
|
|
255629
|
+
}
|
|
255630
|
+
const result = TokenResponseSchema.safeParse(json2);
|
|
255631
|
+
if (!result.success) {
|
|
255632
|
+
throw new SchemaValidationError("Invalid token response from server", result.error);
|
|
255633
|
+
}
|
|
255634
|
+
return result.data;
|
|
255635
|
+
}
|
|
255636
|
+
async function getUserInfo(accessToken) {
|
|
255637
|
+
const response = await oauthClient.get("oauth/userinfo", {
|
|
255638
|
+
headers: { Authorization: `Bearer ${accessToken}` }
|
|
255639
|
+
});
|
|
255640
|
+
if (!response.ok) {
|
|
255641
|
+
throw new ApiError(`Failed to fetch user info: ${response.status}`, {
|
|
255642
|
+
statusCode: response.status
|
|
255643
|
+
});
|
|
255644
|
+
}
|
|
255645
|
+
const result = UserInfoSchema.safeParse(await response.json());
|
|
255646
|
+
if (!result.success) {
|
|
255647
|
+
throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
|
|
255648
|
+
}
|
|
255649
|
+
return result.data;
|
|
255650
|
+
}
|
|
255651
|
+
// src/cli/commands/auth/login-flow.ts
|
|
255652
|
+
async function generateAndDisplayDeviceCode(log, runTask) {
|
|
255653
|
+
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
255654
|
+
return await generateDeviceCode();
|
|
255655
|
+
}, {
|
|
255656
|
+
successMessage: "Device code generated",
|
|
255657
|
+
errorMessage: "Failed to generate device code"
|
|
255658
|
+
});
|
|
255659
|
+
log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
|
|
255660
|
+
Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
|
|
255661
|
+
return deviceCodeResponse;
|
|
255662
|
+
}
|
|
255663
|
+
async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
|
|
255664
|
+
let tokenResponse;
|
|
255665
|
+
try {
|
|
255666
|
+
await runTask("Waiting for authentication...", async () => {
|
|
255667
|
+
await pWaitFor(async () => {
|
|
255668
|
+
const result = await getTokenFromDeviceCode(deviceCode);
|
|
255669
|
+
if (result !== null) {
|
|
255670
|
+
tokenResponse = result;
|
|
255671
|
+
return true;
|
|
255672
|
+
}
|
|
255673
|
+
return false;
|
|
255674
|
+
}, {
|
|
255675
|
+
interval: interval * 1000,
|
|
255676
|
+
timeout: expiresIn * 1000
|
|
255677
|
+
});
|
|
255678
|
+
}, {
|
|
255679
|
+
successMessage: "Authentication completed!",
|
|
255680
|
+
errorMessage: "Authentication failed"
|
|
255681
|
+
});
|
|
255682
|
+
} catch (error48) {
|
|
255683
|
+
if (error48 instanceof Error && error48.message.includes("timed out")) {
|
|
255684
|
+
throw new AuthExpiredError("Authentication timed out. Please try again.");
|
|
255685
|
+
}
|
|
255686
|
+
throw error48;
|
|
255687
|
+
}
|
|
255688
|
+
if (tokenResponse === undefined) {
|
|
255689
|
+
throw new InternalError("Failed to retrieve authentication token.");
|
|
255690
|
+
}
|
|
255691
|
+
return tokenResponse;
|
|
255692
|
+
}
|
|
255693
|
+
async function saveAuthData(response, userInfo) {
|
|
255694
|
+
const expiresAt = Date.now() + response.expiresIn * 1000;
|
|
255695
|
+
await writeAuth({
|
|
255696
|
+
accessToken: response.accessToken,
|
|
255697
|
+
refreshToken: response.refreshToken,
|
|
255698
|
+
expiresAt,
|
|
255699
|
+
email: userInfo.email,
|
|
255700
|
+
name: userInfo.name
|
|
255701
|
+
});
|
|
255702
|
+
}
|
|
255703
|
+
async function login({
|
|
255704
|
+
log,
|
|
255705
|
+
runTask
|
|
255706
|
+
}) {
|
|
255707
|
+
const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
|
|
255708
|
+
const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
|
|
255709
|
+
const userInfo = await getUserInfo(token.accessToken);
|
|
255710
|
+
await saveAuthData(token, userInfo);
|
|
255711
|
+
return {
|
|
255712
|
+
outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
|
|
255713
|
+
};
|
|
255714
|
+
}
|
|
255715
|
+
|
|
255716
|
+
// src/cli/utils/command/middleware.ts
|
|
255717
|
+
async function ensureAuth(ctx) {
|
|
255718
|
+
if (hasWorkspaceApiKeyAuth()) {
|
|
255719
|
+
ctx.errorReporter.setContext({
|
|
255720
|
+
user: { email: "workspace-api-key", name: "Workspace API key" }
|
|
255721
|
+
});
|
|
255722
|
+
return;
|
|
255723
|
+
}
|
|
255724
|
+
await seedAuthFromEnv();
|
|
255725
|
+
const loggedIn = await isLoggedIn();
|
|
255726
|
+
if (!loggedIn) {
|
|
255727
|
+
ctx.log.info("You need to login first to continue.");
|
|
255728
|
+
await login(ctx);
|
|
255729
|
+
}
|
|
255730
|
+
try {
|
|
255731
|
+
const userInfo = await readAuth();
|
|
255732
|
+
ctx.errorReporter.setContext({
|
|
255733
|
+
user: { email: userInfo.email, name: userInfo.name }
|
|
255734
|
+
});
|
|
255735
|
+
} catch {}
|
|
255736
|
+
}
|
|
255737
|
+
async function ensureAppContext(ctx, options = {}) {
|
|
255738
|
+
const appContext = await initAppContext(options);
|
|
255739
|
+
ctx.app = appContext;
|
|
255740
|
+
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
255741
|
+
}
|
|
255742
|
+
|
|
255332
255743
|
// src/cli/utils/version-check.ts
|
|
255333
255744
|
async function checkForUpgrade() {
|
|
255334
255745
|
const testLatestVersion = getTestOverrides()?.latestVersion;
|
|
@@ -255741,11 +256152,6 @@ function verifyDenoInstalled(context) {
|
|
|
255741
256152
|
});
|
|
255742
256153
|
}
|
|
255743
256154
|
}
|
|
255744
|
-
// src/core/utils/git.ts
|
|
255745
|
-
var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
|
|
255746
|
-
function isGitCommitHash(value) {
|
|
255747
|
-
return GIT_HASH_PATTERN.test(value);
|
|
255748
|
-
}
|
|
255749
256155
|
// src/core/workspace/schema.ts
|
|
255750
256156
|
var WorkspaceSchema = exports_external.object({
|
|
255751
256157
|
id: exports_external.string(),
|
|
@@ -255820,7 +256226,7 @@ async function pullAction({
|
|
|
255820
256226
|
runTask: runTask2
|
|
255821
256227
|
}) {
|
|
255822
256228
|
const { project: project2 } = await readProjectConfig();
|
|
255823
|
-
const dir =
|
|
256229
|
+
const dir = join18(dirname11(project2.configPath), project2.agentSkillsDir);
|
|
255824
256230
|
const remote = await runTask2("Fetching agent skills from Base44", () => fetchAgentSkills(), {
|
|
255825
256231
|
successMessage: "Agent skills fetched successfully",
|
|
255826
256232
|
errorMessage: "Failed to fetch agent skills"
|
|
@@ -255876,14 +256282,14 @@ function getAgentSkillsCommand() {
|
|
|
255876
256282
|
}
|
|
255877
256283
|
|
|
255878
256284
|
// src/cli/commands/agents/pull.ts
|
|
255879
|
-
import { dirname as
|
|
256285
|
+
import { dirname as dirname12, join as join19 } from "node:path";
|
|
255880
256286
|
async function pullAgentsAction({
|
|
255881
256287
|
log,
|
|
255882
256288
|
runTask: runTask2
|
|
255883
256289
|
}) {
|
|
255884
256290
|
const { project: project2 } = await readProjectConfig();
|
|
255885
|
-
const configDir =
|
|
255886
|
-
const agentsDir =
|
|
256291
|
+
const configDir = dirname12(project2.configPath);
|
|
256292
|
+
const agentsDir = join19(configDir, project2.agentsDir);
|
|
255887
256293
|
const remoteAgents = await runTask2("Fetching agents from Base44", async () => {
|
|
255888
256294
|
return await fetchAgents();
|
|
255889
256295
|
}, {
|
|
@@ -255953,12 +256359,12 @@ function getAgentsCommand() {
|
|
|
255953
256359
|
}
|
|
255954
256360
|
|
|
255955
256361
|
// src/cli/commands/auth/password-login.ts
|
|
255956
|
-
import { dirname as
|
|
256362
|
+
import { dirname as dirname13, join as join20 } from "node:path";
|
|
255957
256363
|
async function passwordLoginAction({ log, runTask: runTask2 }, action) {
|
|
255958
256364
|
const shouldEnable = action === "enable";
|
|
255959
256365
|
const { project: project2 } = await readProjectConfig();
|
|
255960
|
-
const configDir =
|
|
255961
|
-
const authDir =
|
|
256366
|
+
const configDir = dirname13(project2.configPath);
|
|
256367
|
+
const authDir = join20(configDir, project2.authDir);
|
|
255962
256368
|
const updated = await runTask2("Updating local auth config", async () => {
|
|
255963
256369
|
const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
|
|
255964
256370
|
const merged = { ...current, enableUsernamePassword: shouldEnable };
|
|
@@ -255978,14 +256384,14 @@ function getPasswordLoginCommand() {
|
|
|
255978
256384
|
}
|
|
255979
256385
|
|
|
255980
256386
|
// src/cli/commands/auth/pull.ts
|
|
255981
|
-
import { dirname as
|
|
256387
|
+
import { dirname as dirname14, join as join21 } from "node:path";
|
|
255982
256388
|
async function pullAuthAction({
|
|
255983
256389
|
log,
|
|
255984
256390
|
runTask: runTask2
|
|
255985
256391
|
}) {
|
|
255986
256392
|
const { project: project2 } = await readProjectConfig();
|
|
255987
|
-
const configDir =
|
|
255988
|
-
const authDir =
|
|
256393
|
+
const configDir = dirname14(project2.configPath);
|
|
256394
|
+
const authDir = join21(configDir, project2.authDir);
|
|
255989
256395
|
const remoteConfig = await runTask2("Fetching auth config from Base44", async () => {
|
|
255990
256396
|
return await pullAuthConfig();
|
|
255991
256397
|
}, {
|
|
@@ -256049,7 +256455,7 @@ function getAuthPushCommand() {
|
|
|
256049
256455
|
}
|
|
256050
256456
|
|
|
256051
256457
|
// src/cli/commands/auth/social-login.ts
|
|
256052
|
-
import { dirname as
|
|
256458
|
+
import { dirname as dirname15, join as join22, resolve as resolve7 } from "node:path";
|
|
256053
256459
|
var PROVIDER_LABELS = {
|
|
256054
256460
|
google: "Google",
|
|
256055
256461
|
microsoft: "Microsoft",
|
|
@@ -256089,7 +256495,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
256089
256495
|
let clientSecret;
|
|
256090
256496
|
if (useCustomOAuth && oauth && oauthCli && hasSecretOptions(options)) {
|
|
256091
256497
|
if (options.envFile) {
|
|
256092
|
-
const secrets = await parseEnvFile(
|
|
256498
|
+
const secrets = await parseEnvFile(resolve7(options.envFile));
|
|
256093
256499
|
const value = secrets[oauthCli.envVar];
|
|
256094
256500
|
if (!value) {
|
|
256095
256501
|
throw new InvalidInputError(`Key "${oauthCli.envVar}" not found in ${options.envFile}.`);
|
|
@@ -256119,8 +256525,8 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
|
|
|
256119
256525
|
}
|
|
256120
256526
|
}
|
|
256121
256527
|
const { project: project2 } = await readProjectConfig();
|
|
256122
|
-
const configDir =
|
|
256123
|
-
const authDir =
|
|
256528
|
+
const configDir = dirname15(project2.configPath);
|
|
256529
|
+
const authDir = join22(configDir, project2.authDir);
|
|
256124
256530
|
const { config: updated } = await runTask2("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
|
|
256125
256531
|
if (clientSecret) {
|
|
256126
256532
|
await runTask2("Saving client secret", async () => pushCustomOAuthSecret(provider, clientSecret));
|
|
@@ -256145,7 +256551,7 @@ function getSocialLoginCommand() {
|
|
|
256145
256551
|
}
|
|
256146
256552
|
|
|
256147
256553
|
// src/cli/commands/auth/sso.ts
|
|
256148
|
-
import { dirname as
|
|
256554
|
+
import { dirname as dirname16, join as join23, resolve as resolve8 } from "node:path";
|
|
256149
256555
|
var SSOConfigFileSchema = exports_external.object({
|
|
256150
256556
|
provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
|
|
256151
256557
|
clientId: exports_external.string(),
|
|
@@ -256161,7 +256567,7 @@ var SSOConfigFileSchema = exports_external.object({
|
|
|
256161
256567
|
ssoName: exports_external.string().optional()
|
|
256162
256568
|
});
|
|
256163
256569
|
async function loadSSOConfigFile(filePath) {
|
|
256164
|
-
const resolved =
|
|
256570
|
+
const resolved = resolve8(filePath);
|
|
256165
256571
|
const raw2 = await readJsonFile(resolved);
|
|
256166
256572
|
const result = SSOConfigFileSchema.safeParse(raw2);
|
|
256167
256573
|
if (!result.success) {
|
|
@@ -256249,7 +256655,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
256249
256655
|
}
|
|
256250
256656
|
let clientSecret;
|
|
256251
256657
|
if (merged.envFile && !merged.clientSecret) {
|
|
256252
|
-
const secrets2 = await parseEnvFile(
|
|
256658
|
+
const secrets2 = await parseEnvFile(resolve8(merged.envFile));
|
|
256253
256659
|
const value = secrets2.sso_client_secret;
|
|
256254
256660
|
if (!value) {
|
|
256255
256661
|
throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
|
|
@@ -256308,8 +256714,8 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
|
|
|
256308
256714
|
throw error48;
|
|
256309
256715
|
}
|
|
256310
256716
|
const { project: project2 } = await readProjectConfig();
|
|
256311
|
-
const configDir =
|
|
256312
|
-
const authDir =
|
|
256717
|
+
const configDir = dirname16(project2.configPath);
|
|
256718
|
+
const authDir = join23(configDir, project2.authDir);
|
|
256313
256719
|
await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
|
|
256314
256720
|
await runTask2("Saving SSO credentials", async () => pushSSOSecrets(secrets));
|
|
256315
256721
|
return {
|
|
@@ -256324,8 +256730,8 @@ async function ssoDisableAction({ log, runTask: runTask2 }, options) {
|
|
|
256324
256730
|
throw new InvalidInputError("Configuration options cannot be used with disable. To disable SSO: base44 auth sso disable");
|
|
256325
256731
|
}
|
|
256326
256732
|
const { project: project2 } = await readProjectConfig();
|
|
256327
|
-
const configDir =
|
|
256328
|
-
const authDir =
|
|
256733
|
+
const configDir = dirname16(project2.configPath);
|
|
256734
|
+
const authDir = join23(configDir, project2.authDir);
|
|
256329
256735
|
const updated = await runTask2("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
|
|
256330
256736
|
await runTask2("Removing SSO credentials", async () => deleteSSOSecrets());
|
|
256331
256737
|
if (!hasAnyLoginMethod(updated)) {
|
|
@@ -256887,19 +257293,19 @@ var baseOpen = async (options) => {
|
|
|
256887
257293
|
}
|
|
256888
257294
|
const subprocess = childProcess3.spawn(command2, cliArguments, childProcessOptions);
|
|
256889
257295
|
if (options.wait) {
|
|
256890
|
-
return new Promise((
|
|
257296
|
+
return new Promise((resolve9, reject) => {
|
|
256891
257297
|
subprocess.once("error", reject);
|
|
256892
257298
|
subprocess.once("close", (exitCode) => {
|
|
256893
257299
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
256894
257300
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
256895
257301
|
return;
|
|
256896
257302
|
}
|
|
256897
|
-
|
|
257303
|
+
resolve9(subprocess);
|
|
256898
257304
|
});
|
|
256899
257305
|
});
|
|
256900
257306
|
}
|
|
256901
257307
|
if (isFallbackAttempt) {
|
|
256902
|
-
return new Promise((
|
|
257308
|
+
return new Promise((resolve9, reject) => {
|
|
256903
257309
|
subprocess.once("error", reject);
|
|
256904
257310
|
subprocess.once("spawn", () => {
|
|
256905
257311
|
subprocess.once("close", (exitCode) => {
|
|
@@ -256909,17 +257315,17 @@ var baseOpen = async (options) => {
|
|
|
256909
257315
|
return;
|
|
256910
257316
|
}
|
|
256911
257317
|
subprocess.unref();
|
|
256912
|
-
|
|
257318
|
+
resolve9(subprocess);
|
|
256913
257319
|
});
|
|
256914
257320
|
});
|
|
256915
257321
|
});
|
|
256916
257322
|
}
|
|
256917
257323
|
subprocess.unref();
|
|
256918
|
-
return new Promise((
|
|
257324
|
+
return new Promise((resolve9, reject) => {
|
|
256919
257325
|
subprocess.once("error", reject);
|
|
256920
257326
|
subprocess.once("spawn", () => {
|
|
256921
257327
|
subprocess.off("error", reject);
|
|
256922
|
-
|
|
257328
|
+
resolve9(subprocess);
|
|
256923
257329
|
});
|
|
256924
257330
|
});
|
|
256925
257331
|
};
|
|
@@ -257182,13 +257588,13 @@ function getConnectorsListAvailableCommand() {
|
|
|
257182
257588
|
}
|
|
257183
257589
|
|
|
257184
257590
|
// src/cli/commands/connectors/pull.ts
|
|
257185
|
-
import { dirname as
|
|
257591
|
+
import { dirname as dirname17, join as join24, resolve as resolve9 } from "node:path";
|
|
257186
257592
|
async function resolveConnectorsDir(options) {
|
|
257187
257593
|
if (!getAppContext().projectRoot) {
|
|
257188
|
-
return
|
|
257594
|
+
return resolve9(options.dir ?? "connectors");
|
|
257189
257595
|
}
|
|
257190
257596
|
const { project: project2 } = await readProjectConfig();
|
|
257191
|
-
return
|
|
257597
|
+
return join24(dirname17(project2.configPath), project2.connectorsDir);
|
|
257192
257598
|
}
|
|
257193
257599
|
async function pullConnectorsAction({ log, runTask: runTask2, jsonMode }, options) {
|
|
257194
257600
|
const connectorsDir = await resolveConnectorsDir(options);
|
|
@@ -257229,10 +257635,10 @@ function getConnectorsPullCommand() {
|
|
|
257229
257635
|
}
|
|
257230
257636
|
|
|
257231
257637
|
// src/cli/commands/connectors/push.ts
|
|
257232
|
-
import { resolve as
|
|
257638
|
+
import { resolve as resolve10 } from "node:path";
|
|
257233
257639
|
async function readConnectorsToPush(options) {
|
|
257234
257640
|
if (!getAppContext().projectRoot) {
|
|
257235
|
-
return readAllConnectors(
|
|
257641
|
+
return readAllConnectors(resolve10(options.dir ?? "connectors"));
|
|
257236
257642
|
}
|
|
257237
257643
|
const { connectors } = await readProjectConfig();
|
|
257238
257644
|
return connectors;
|
|
@@ -257596,11 +258002,11 @@ function getListCommand() {
|
|
|
257596
258002
|
}
|
|
257597
258003
|
|
|
257598
258004
|
// src/cli/commands/functions/pull.ts
|
|
257599
|
-
import { dirname as
|
|
258005
|
+
import { dirname as dirname18, join as join25 } from "node:path";
|
|
257600
258006
|
async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
|
|
257601
258007
|
const { project: project2, functions } = await readProjectConfig();
|
|
257602
|
-
const configDir =
|
|
257603
|
-
const functionsDir =
|
|
258008
|
+
const configDir = dirname18(project2.configPath);
|
|
258009
|
+
const functionsDir = join25(configDir, project2.functionsDir);
|
|
257604
258010
|
const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
|
|
257605
258011
|
const remoteFunctions = await runTask2("Fetching functions from Base44", async () => {
|
|
257606
258012
|
const { functions: functions2 } = await listDeployedFunctions();
|
|
@@ -257733,11 +258139,11 @@ function getBuildCommand() {
|
|
|
257733
258139
|
}
|
|
257734
258140
|
|
|
257735
258141
|
// src/cli/commands/project/create.ts
|
|
257736
|
-
import { basename as basename5, resolve as
|
|
258142
|
+
import { basename as basename5, resolve as resolve11 } from "node:path";
|
|
257737
258143
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
257738
258144
|
|
|
257739
258145
|
// src/cli/commands/project/scaffold-shared.ts
|
|
257740
|
-
import { join as
|
|
258146
|
+
import { join as join26 } from "node:path";
|
|
257741
258147
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
257742
258148
|
async function getTemplateById(templateId) {
|
|
257743
258149
|
const templates = await listTemplates();
|
|
@@ -257800,7 +258206,7 @@ async function completeProjectSetup({
|
|
|
257800
258206
|
env: { VITE_BASE44_APP_ID: projectId }
|
|
257801
258207
|
})`${buildCommand}`;
|
|
257802
258208
|
updateMessage("Deploying site...");
|
|
257803
|
-
return await deploySite(
|
|
258209
|
+
return await deploySite(join26(resolvedPath, outputDirectory));
|
|
257804
258210
|
}, {
|
|
257805
258211
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
257806
258212
|
errorMessage: "Failed to deploy site"
|
|
@@ -257929,7 +258335,7 @@ async function createInteractive(options, ctx) {
|
|
|
257929
258335
|
}, ctx);
|
|
257930
258336
|
}
|
|
257931
258337
|
async function createNonInteractive(options, ctx) {
|
|
257932
|
-
ctx.log.info(`Creating a new project at ${
|
|
258338
|
+
ctx.log.info(`Creating a new project at ${resolve11(options.path)}`);
|
|
257933
258339
|
const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
257934
258340
|
return await executeCreate({
|
|
257935
258341
|
template: template2,
|
|
@@ -257953,7 +258359,7 @@ async function executeCreate({
|
|
|
257953
258359
|
}, ctx) {
|
|
257954
258360
|
const { log, runTask: runTask2 } = ctx;
|
|
257955
258361
|
const name2 = rawName.trim();
|
|
257956
|
-
const resolvedPath =
|
|
258362
|
+
const resolvedPath = resolve11(projectPath);
|
|
257957
258363
|
const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
|
|
257958
258364
|
const { projectId } = await runTask2("Setting up your project...", async () => {
|
|
257959
258365
|
return await createProjectFiles({
|
|
@@ -258350,7 +258756,7 @@ async function followLogs(functionNames, options, availableFunctionNames, jsonMo
|
|
|
258350
258756
|
for (const entry of fresh)
|
|
258351
258757
|
writeFollowLine(entry, jsonMode);
|
|
258352
258758
|
first = false;
|
|
258353
|
-
await new Promise((
|
|
258759
|
+
await new Promise((resolve12) => setTimeout(resolve12, 2000));
|
|
258354
258760
|
}
|
|
258355
258761
|
}
|
|
258356
258762
|
function formatLogs(entries, env3) {
|
|
@@ -258472,7 +258878,7 @@ function getLogsCommand() {
|
|
|
258472
258878
|
}
|
|
258473
258879
|
|
|
258474
258880
|
// src/cli/commands/project/scaffold.ts
|
|
258475
|
-
import { basename as basename6, resolve as
|
|
258881
|
+
import { basename as basename6, resolve as resolve12 } from "node:path";
|
|
258476
258882
|
function resolveAppId(options) {
|
|
258477
258883
|
const appId = options.appId;
|
|
258478
258884
|
if (!appId) {
|
|
@@ -258488,7 +258894,7 @@ function resolveAppId(options) {
|
|
|
258488
258894
|
async function scaffoldAction(ctx, name2, options, command2) {
|
|
258489
258895
|
const { log, runTask: runTask2 } = ctx;
|
|
258490
258896
|
const appId = resolveAppId(command2.optsWithGlobals());
|
|
258491
|
-
const resolvedPath =
|
|
258897
|
+
const resolvedPath = resolve12("./");
|
|
258492
258898
|
const projectName = (name2 ?? basename6(resolvedPath)).trim();
|
|
258493
258899
|
const template2 = await getTemplateById("backend-only");
|
|
258494
258900
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
@@ -258885,7 +259291,7 @@ function getSecretsListCommand() {
|
|
|
258885
259291
|
}
|
|
258886
259292
|
|
|
258887
259293
|
// src/cli/commands/secrets/set.ts
|
|
258888
|
-
import { resolve as
|
|
259294
|
+
import { resolve as resolve13 } from "node:path";
|
|
258889
259295
|
function parseEntries(entries) {
|
|
258890
259296
|
const secrets = {};
|
|
258891
259297
|
for (const entry of entries) {
|
|
@@ -258916,7 +259322,7 @@ async function setSecretsAction({ log, runTask: runTask2 }, entries, options) {
|
|
|
258916
259322
|
validateInput(entries, options);
|
|
258917
259323
|
let secrets;
|
|
258918
259324
|
if (options.envFile) {
|
|
258919
|
-
secrets = await parseEnvFile(
|
|
259325
|
+
secrets = await parseEnvFile(resolve13(options.envFile));
|
|
258920
259326
|
if (Object.keys(secrets).length === 0) {
|
|
258921
259327
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
258922
259328
|
}
|
|
@@ -258945,7 +259351,6 @@ function getSecretsCommand() {
|
|
|
258945
259351
|
}
|
|
258946
259352
|
|
|
258947
259353
|
// src/cli/commands/site/deploy.ts
|
|
258948
|
-
import { resolve as resolve11 } from "node:path";
|
|
258949
259354
|
async function deployAction2(ctx, options) {
|
|
258950
259355
|
const { isNonInteractive } = ctx;
|
|
258951
259356
|
if (isNonInteractive && !options.yes) {
|
|
@@ -258953,7 +259358,7 @@ async function deployAction2(ctx, options) {
|
|
|
258953
259358
|
}
|
|
258954
259359
|
const project2 = await readProjectSettings();
|
|
258955
259360
|
const outputDirectory = project2.site?.outputDirectory;
|
|
258956
|
-
if (
|
|
259361
|
+
if ((await planAppDeploy(project2)).kind === "none") {
|
|
258957
259362
|
throw new ConfigNotFoundError("No site configuration found.", {
|
|
258958
259363
|
hints: [
|
|
258959
259364
|
{
|
|
@@ -258964,24 +259369,37 @@ async function deployAction2(ctx, options) {
|
|
|
258964
259369
|
}
|
|
258965
259370
|
if (!options.yes) {
|
|
258966
259371
|
const shouldDeploy = await Re({
|
|
258967
|
-
message: `Deploy site from ${outputDirectory}?`
|
|
259372
|
+
message: outputDirectory ? `Deploy site from ${outputDirectory}?` : "Deploy site?"
|
|
258968
259373
|
});
|
|
258969
259374
|
if (Ct(shouldDeploy) || !shouldDeploy) {
|
|
258970
259375
|
return { outroMessage: "Deployment cancelled" };
|
|
258971
259376
|
}
|
|
258972
259377
|
}
|
|
258973
259378
|
await maybeBuildBeforeDeploy(ctx, project2, options.build);
|
|
258974
|
-
const
|
|
258975
|
-
|
|
258976
|
-
|
|
258977
|
-
|
|
258978
|
-
|
|
259379
|
+
const plan = await planAppDeploy(project2);
|
|
259380
|
+
switch (plan.kind) {
|
|
259381
|
+
case "deployment":
|
|
259382
|
+
return await deployToDeploymentsApi(ctx, project2.root, plan.outputDir, options);
|
|
259383
|
+
case "tarball":
|
|
259384
|
+
return await deployTarball(ctx, plan.outputDir);
|
|
259385
|
+
case "none":
|
|
259386
|
+
return { outroMessage: "Nothing to deploy" };
|
|
259387
|
+
}
|
|
259388
|
+
}
|
|
259389
|
+
async function deployToDeploymentsApi(ctx, projectRoot, outputDir, options) {
|
|
259390
|
+
const { runTask: runTask2, log } = ctx;
|
|
259391
|
+
const gitHash = await resolveGitHash(projectRoot, options.gitHash);
|
|
258979
259392
|
const progressLines = [];
|
|
258980
|
-
const
|
|
259393
|
+
const warnings = [];
|
|
259394
|
+
const { deploymentId } = await runTask2("Deploying site...", async (updateMessage) => await deployToDeployments({
|
|
259395
|
+
projectRoot,
|
|
258981
259396
|
outputDir,
|
|
258982
259397
|
gitHash,
|
|
258983
|
-
concurrency,
|
|
259398
|
+
concurrency: options.concurrency,
|
|
258984
259399
|
progress: {
|
|
259400
|
+
onWarning: (message) => {
|
|
259401
|
+
warnings.push(message);
|
|
259402
|
+
},
|
|
258985
259403
|
onAssets: ({ totalAssets, newAssets }) => {
|
|
258986
259404
|
const line = `Found ${totalAssets} static assets (${newAssets} new)`;
|
|
258987
259405
|
progressLines.push(line);
|
|
@@ -258989,17 +259407,19 @@ async function deployToDeploymentsApi({ runTask: runTask2, log, jsonMode }, outp
|
|
|
258989
259407
|
},
|
|
258990
259408
|
onAssetUpload: ({ uploadedFiles, totalFiles }) => {
|
|
258991
259409
|
updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
|
|
259410
|
+
},
|
|
259411
|
+
onWorker: ({ moduleCount }) => {
|
|
259412
|
+
updateMessage(`Deploying worker (${moduleCount} modules)…`);
|
|
258992
259413
|
}
|
|
258993
259414
|
}
|
|
258994
259415
|
}), { successMessage: "Site deployed", errorMessage: "Site deploy failed" });
|
|
258995
259416
|
for (const line of progressLines) {
|
|
258996
259417
|
log.message(theme.styles.dim(line));
|
|
258997
259418
|
}
|
|
258998
|
-
|
|
258999
|
-
|
|
259000
|
-
|
|
259001
|
-
|
|
259002
|
-
};
|
|
259419
|
+
for (const warning of warnings) {
|
|
259420
|
+
log.warn(warning);
|
|
259421
|
+
}
|
|
259422
|
+
return deploymentResult(ctx, deploymentId, gitHash);
|
|
259003
259423
|
}
|
|
259004
259424
|
async function deployTarball({ runTask: runTask2 }, outputDir) {
|
|
259005
259425
|
const { appUrl } = await runTask2("Creating archive and deploying site...", async () => await deploySite(outputDir), {
|
|
@@ -259008,18 +259428,21 @@ async function deployTarball({ runTask: runTask2 }, outputDir) {
|
|
|
259008
259428
|
});
|
|
259009
259429
|
return { outroMessage: `Visit your site at: ${appUrl}` };
|
|
259010
259430
|
}
|
|
259431
|
+
function deploymentResult({ jsonMode }, deploymentId, gitHash) {
|
|
259432
|
+
return {
|
|
259433
|
+
outroMessage: `Deployment ${deploymentId} (commit ${gitHash.slice(0, 12)})`,
|
|
259434
|
+
stdout: jsonMode ? `${JSON.stringify({ deploymentId, gitHash }, null, 2)}
|
|
259435
|
+
` : undefined
|
|
259436
|
+
};
|
|
259437
|
+
}
|
|
259011
259438
|
function getSiteDeployCommand() {
|
|
259012
|
-
|
|
259013
|
-
|
|
259014
|
-
|
|
259015
|
-
|
|
259016
|
-
|
|
259017
|
-
}
|
|
259018
|
-
return value;
|
|
259019
|
-
}));
|
|
259020
|
-
command2.addOption(new Option("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency));
|
|
259439
|
+
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").addOption(new Option("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash)).addOption(new Option("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency)).action(deployAction2);
|
|
259440
|
+
}
|
|
259441
|
+
function parseGitHash(value) {
|
|
259442
|
+
if (!isGitCommitHash(value)) {
|
|
259443
|
+
throw new InvalidArgumentError("Expected a git commit hash (7-64 hex chars).");
|
|
259021
259444
|
}
|
|
259022
|
-
return
|
|
259445
|
+
return value;
|
|
259023
259446
|
}
|
|
259024
259447
|
function parseConcurrency(value) {
|
|
259025
259448
|
const parsed = Number(value);
|
|
@@ -259028,10 +259451,6 @@ function parseConcurrency(value) {
|
|
|
259028
259451
|
}
|
|
259029
259452
|
return parsed;
|
|
259030
259453
|
}
|
|
259031
|
-
function staticDeploymentsEnabled(env3 = process.env) {
|
|
259032
|
-
const value = env3.BASE44_STATIC_DEPLOYMENTS;
|
|
259033
|
-
return value === "1" || value === "true";
|
|
259034
|
-
}
|
|
259035
259454
|
|
|
259036
259455
|
// src/cli/commands/site/open.ts
|
|
259037
259456
|
async function openAction({
|
|
@@ -259137,10 +259556,10 @@ function toPascalCase(name2) {
|
|
|
259137
259556
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
259138
259557
|
}
|
|
259139
259558
|
// src/core/types/update-project.ts
|
|
259140
|
-
import { join as
|
|
259559
|
+
import { join as join29 } from "node:path";
|
|
259141
259560
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
259142
259561
|
async function updateProjectConfig(projectRoot) {
|
|
259143
|
-
const tsconfigPath =
|
|
259562
|
+
const tsconfigPath = join29(projectRoot, "tsconfig.json");
|
|
259144
259563
|
if (!await pathExists(tsconfigPath)) {
|
|
259145
259564
|
return false;
|
|
259146
259565
|
}
|
|
@@ -259604,7 +260023,7 @@ function createDevLogger(label2, labelColor = theme.styles.dim) {
|
|
|
259604
260023
|
// src/cli/dev/dev-server/main.ts
|
|
259605
260024
|
var import_cors = __toESM(require_lib4(), 1);
|
|
259606
260025
|
var import_express6 = __toESM(require_express(), 1);
|
|
259607
|
-
import { dirname as
|
|
260026
|
+
import { dirname as dirname24, join as join36 } from "node:path";
|
|
259608
260027
|
|
|
259609
260028
|
// ../../node_modules/get-port/index.js
|
|
259610
260029
|
import net from "node:net";
|
|
@@ -259631,14 +260050,14 @@ var getLocalHosts = () => {
|
|
|
259631
260050
|
}
|
|
259632
260051
|
return results;
|
|
259633
260052
|
};
|
|
259634
|
-
var checkAvailablePort = (options8) => new Promise((
|
|
260053
|
+
var checkAvailablePort = (options8) => new Promise((resolve15, reject) => {
|
|
259635
260054
|
const server = net.createServer();
|
|
259636
260055
|
server.unref();
|
|
259637
260056
|
server.on("error", reject);
|
|
259638
260057
|
server.listen(options8, () => {
|
|
259639
260058
|
const { port } = server.address();
|
|
259640
260059
|
server.close(() => {
|
|
259641
|
-
|
|
260060
|
+
resolve15(port);
|
|
259642
260061
|
});
|
|
259643
260062
|
});
|
|
259644
260063
|
});
|
|
@@ -259739,7 +260158,7 @@ var $setGracefulCleanup = tmp.setGracefulCleanup;
|
|
|
259739
260158
|
|
|
259740
260159
|
// src/cli/dev/dev-server/function-manager.ts
|
|
259741
260160
|
import { spawn as spawn2 } from "node:child_process";
|
|
259742
|
-
import { dirname as
|
|
260161
|
+
import { dirname as dirname21, join as join30 } from "node:path";
|
|
259743
260162
|
import { pathToFileURL } from "node:url";
|
|
259744
260163
|
|
|
259745
260164
|
// src/cli/dev/dev-server/base-function-manager.ts
|
|
@@ -259844,7 +260263,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
259844
260263
|
}
|
|
259845
260264
|
spawnFunction(func, port) {
|
|
259846
260265
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
259847
|
-
const importMapPath =
|
|
260266
|
+
const importMapPath = join30(dirname21(this.wrapperPath), "import-map.json");
|
|
259848
260267
|
const process23 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
|
|
259849
260268
|
env: {
|
|
259850
260269
|
...globalThis.process.env,
|
|
@@ -259883,7 +260302,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
259883
260302
|
});
|
|
259884
260303
|
}
|
|
259885
260304
|
waitForReady(name2, runningFunc) {
|
|
259886
|
-
return new Promise((
|
|
260305
|
+
return new Promise((resolve15, reject) => {
|
|
259887
260306
|
runningFunc.process.on("exit", (code2) => {
|
|
259888
260307
|
if (!runningFunc.ready) {
|
|
259889
260308
|
clearTimeout(timeout3);
|
|
@@ -259906,7 +260325,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
259906
260325
|
runningFunc.ready = true;
|
|
259907
260326
|
clearTimeout(timeout3);
|
|
259908
260327
|
runningFunc.process.stdout?.off("data", onData);
|
|
259909
|
-
|
|
260328
|
+
resolve15(runningFunc.port);
|
|
259910
260329
|
}
|
|
259911
260330
|
};
|
|
259912
260331
|
runningFunc.process.stdout?.on("data", onData);
|
|
@@ -259918,7 +260337,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
259918
260337
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
259919
260338
|
import { isBuiltin } from "node:module";
|
|
259920
260339
|
import { homedir as homedir3 } from "node:os";
|
|
259921
|
-
import { join as
|
|
260340
|
+
import { join as join31 } from "node:path";
|
|
259922
260341
|
import { pathToFileURL as pathToFileURL6 } from "node:url";
|
|
259923
260342
|
var depsPromise;
|
|
259924
260343
|
function loadDeps() {
|
|
@@ -260039,9 +260458,9 @@ export default {
|
|
|
260039
260458
|
};
|
|
260040
260459
|
`;
|
|
260041
260460
|
function ensureBundlerConfig() {
|
|
260042
|
-
const dir =
|
|
260461
|
+
const dir = join31(homedir3(), ".base44", "function-bundler");
|
|
260043
260462
|
mkdirSync2(dir, { recursive: true });
|
|
260044
|
-
const configPath =
|
|
260463
|
+
const configPath = join31(dir, "deno.json");
|
|
260045
260464
|
writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
|
|
260046
260465
|
`);
|
|
260047
260466
|
return configPath;
|
|
@@ -261511,16 +261930,16 @@ function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
|
261511
261930
|
|
|
261512
261931
|
// src/cli/dev/dev-server/watcher.ts
|
|
261513
261932
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
261514
|
-
import { relative as
|
|
261933
|
+
import { relative as relative7 } from "node:path";
|
|
261515
261934
|
|
|
261516
261935
|
// ../../node_modules/chokidar/index.js
|
|
261517
261936
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
261518
261937
|
import { stat as statcb, Stats } from "node:fs";
|
|
261519
|
-
import { readdir as readdir3, stat as
|
|
261938
|
+
import { readdir as readdir3, stat as stat6 } from "node:fs/promises";
|
|
261520
261939
|
import * as sp3 from "node:path";
|
|
261521
261940
|
|
|
261522
261941
|
// ../../node_modules/readdirp/index.js
|
|
261523
|
-
import { lstat as lstat2, readdir as readdir2, realpath, stat as
|
|
261942
|
+
import { lstat as lstat2, readdir as readdir2, realpath, stat as stat4 } from "node:fs/promises";
|
|
261524
261943
|
import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
|
|
261525
261944
|
import { Readable as Readable6 } from "node:stream";
|
|
261526
261945
|
var EntryTypes = {
|
|
@@ -261602,7 +262021,7 @@ class ReaddirpStream extends Readable6 {
|
|
|
261602
262021
|
const { root: root2, type } = opts;
|
|
261603
262022
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
261604
262023
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
261605
|
-
const statMethod = opts.lstat ? lstat2 :
|
|
262024
|
+
const statMethod = opts.lstat ? lstat2 : stat4;
|
|
261606
262025
|
if (wantBigintFsStats) {
|
|
261607
262026
|
this._stat = (path19) => statMethod(path19, { bigint: true });
|
|
261608
262027
|
} else {
|
|
@@ -261755,7 +262174,7 @@ function readdirp(root2, options8 = {}) {
|
|
|
261755
262174
|
|
|
261756
262175
|
// ../../node_modules/chokidar/handler.js
|
|
261757
262176
|
import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
|
|
261758
|
-
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as
|
|
262177
|
+
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat5 } from "node:fs/promises";
|
|
261759
262178
|
import { type as osType } from "node:os";
|
|
261760
262179
|
import * as sp2 from "node:path";
|
|
261761
262180
|
var STR_DATA = "data";
|
|
@@ -261781,7 +262200,7 @@ var EVENTS = {
|
|
|
261781
262200
|
};
|
|
261782
262201
|
var EV = EVENTS;
|
|
261783
262202
|
var THROTTLE_MODE_WATCH = "watch";
|
|
261784
|
-
var statMethods = { lstat: lstat3, stat:
|
|
262203
|
+
var statMethods = { lstat: lstat3, stat: stat5 };
|
|
261785
262204
|
var KEY_LISTENERS = "listeners";
|
|
261786
262205
|
var KEY_ERR = "errHandlers";
|
|
261787
262206
|
var KEY_RAW = "rawEmitters";
|
|
@@ -262241,9 +262660,9 @@ class NodeFsHandler {
|
|
|
262241
262660
|
if (this.fsw.closed) {
|
|
262242
262661
|
return;
|
|
262243
262662
|
}
|
|
262244
|
-
const
|
|
262663
|
+
const dirname23 = sp2.dirname(file2);
|
|
262245
262664
|
const basename8 = sp2.basename(file2);
|
|
262246
|
-
const parent = this.fsw._getWatchedDir(
|
|
262665
|
+
const parent = this.fsw._getWatchedDir(dirname23);
|
|
262247
262666
|
let prevStats = stats;
|
|
262248
262667
|
if (parent.has(basename8))
|
|
262249
262668
|
return;
|
|
@@ -262252,7 +262671,7 @@ class NodeFsHandler {
|
|
|
262252
262671
|
return;
|
|
262253
262672
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
262254
262673
|
try {
|
|
262255
|
-
const newStats2 = await
|
|
262674
|
+
const newStats2 = await stat5(file2);
|
|
262256
262675
|
if (this.fsw.closed)
|
|
262257
262676
|
return;
|
|
262258
262677
|
const at13 = newStats2.atimeMs;
|
|
@@ -262270,7 +262689,7 @@ class NodeFsHandler {
|
|
|
262270
262689
|
prevStats = newStats2;
|
|
262271
262690
|
}
|
|
262272
262691
|
} catch (error48) {
|
|
262273
|
-
this.fsw._remove(
|
|
262692
|
+
this.fsw._remove(dirname23, basename8);
|
|
262274
262693
|
}
|
|
262275
262694
|
} else if (parent.has(basename8)) {
|
|
262276
262695
|
const at13 = newStats.atimeMs;
|
|
@@ -262359,7 +262778,7 @@ class NodeFsHandler {
|
|
|
262359
262778
|
this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
|
|
262360
262779
|
}
|
|
262361
262780
|
}).on(EV.ERROR, this._boundHandleError);
|
|
262362
|
-
return new Promise((
|
|
262781
|
+
return new Promise((resolve16, reject) => {
|
|
262363
262782
|
if (!stream)
|
|
262364
262783
|
return reject();
|
|
262365
262784
|
stream.once(STR_END, () => {
|
|
@@ -262368,7 +262787,7 @@ class NodeFsHandler {
|
|
|
262368
262787
|
return;
|
|
262369
262788
|
}
|
|
262370
262789
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
262371
|
-
|
|
262790
|
+
resolve16(undefined);
|
|
262372
262791
|
previous.getChildren().filter((item) => {
|
|
262373
262792
|
return item !== directory && !current.has(item);
|
|
262374
262793
|
}).forEach((item) => {
|
|
@@ -262493,11 +262912,11 @@ function createPattern(matcher) {
|
|
|
262493
262912
|
if (matcher.path === string4)
|
|
262494
262913
|
return true;
|
|
262495
262914
|
if (matcher.recursive) {
|
|
262496
|
-
const
|
|
262497
|
-
if (!
|
|
262915
|
+
const relative7 = sp3.relative(matcher.path, string4);
|
|
262916
|
+
if (!relative7) {
|
|
262498
262917
|
return false;
|
|
262499
262918
|
}
|
|
262500
|
-
return !
|
|
262919
|
+
return !relative7.startsWith("..") && !sp3.isAbsolute(relative7);
|
|
262501
262920
|
}
|
|
262502
262921
|
return false;
|
|
262503
262922
|
};
|
|
@@ -262924,7 +263343,7 @@ class FSWatcher extends EventEmitter3 {
|
|
|
262924
263343
|
const fullPath = opts.cwd ? sp3.join(opts.cwd, path19) : path19;
|
|
262925
263344
|
let stats2;
|
|
262926
263345
|
try {
|
|
262927
|
-
stats2 = await
|
|
263346
|
+
stats2 = await stat6(fullPath);
|
|
262928
263347
|
} catch (err) {}
|
|
262929
263348
|
if (!stats2 || this.closed)
|
|
262930
263349
|
return;
|
|
@@ -263028,8 +263447,8 @@ class FSWatcher extends EventEmitter3 {
|
|
|
263028
263447
|
}
|
|
263029
263448
|
return this._userIgnored(path19, stats);
|
|
263030
263449
|
}
|
|
263031
|
-
_isntIgnored(path19,
|
|
263032
|
-
return !this._isIgnored(path19,
|
|
263450
|
+
_isntIgnored(path19, stat7) {
|
|
263451
|
+
return !this._isIgnored(path19, stat7);
|
|
263033
263452
|
}
|
|
263034
263453
|
_getWatchHelpers(path19) {
|
|
263035
263454
|
return new WatchHelper(path19, this.options.followSymlinks, this);
|
|
@@ -263196,7 +263615,7 @@ class WatchBase44 extends EventEmitter4 {
|
|
|
263196
263615
|
ignoreInitial: true
|
|
263197
263616
|
});
|
|
263198
263617
|
watcher.on("all", import_debounce.default(async (_event, path19) => {
|
|
263199
|
-
this.emit("change", name2,
|
|
263618
|
+
this.emit("change", name2, relative7(targetPath, path19));
|
|
263200
263619
|
}, WATCH_DEBOUNCE_MS));
|
|
263201
263620
|
watcher.on("error", (err) => {
|
|
263202
263621
|
this.logger.error(`Watch handler failed for ${targetPath}`, err);
|
|
@@ -263285,7 +263704,7 @@ async function createDevServer(options8) {
|
|
|
263285
263704
|
}
|
|
263286
263705
|
remoteProxy(req, res, next);
|
|
263287
263706
|
});
|
|
263288
|
-
const server = await new Promise((
|
|
263707
|
+
const server = await new Promise((resolve17, reject) => {
|
|
263289
263708
|
const s5 = app.listen(port, "127.0.0.1", (err) => {
|
|
263290
263709
|
if (err) {
|
|
263291
263710
|
if ("code" in err && err.code === "EADDRINUSE") {
|
|
@@ -263294,7 +263713,7 @@ async function createDevServer(options8) {
|
|
|
263294
263713
|
reject(err);
|
|
263295
263714
|
}
|
|
263296
263715
|
} else {
|
|
263297
|
-
|
|
263716
|
+
resolve17(s5);
|
|
263298
263717
|
}
|
|
263299
263718
|
});
|
|
263300
263719
|
});
|
|
@@ -263303,8 +263722,8 @@ async function createDevServer(options8) {
|
|
|
263303
263722
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
263304
263723
|
};
|
|
263305
263724
|
const base44ConfigWatcher = new WatchBase44({
|
|
263306
|
-
functions:
|
|
263307
|
-
entities:
|
|
263725
|
+
functions: join36(dirname24(project2.configPath), project2.functionsDir),
|
|
263726
|
+
entities: join36(dirname24(project2.configPath), project2.entitiesDir)
|
|
263308
263727
|
}, devLogger);
|
|
263309
263728
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
263310
263729
|
try {
|
|
@@ -263344,13 +263763,13 @@ async function createDevServer(options8) {
|
|
|
263344
263763
|
if (!server.listening) {
|
|
263345
263764
|
return;
|
|
263346
263765
|
}
|
|
263347
|
-
await new Promise((
|
|
263766
|
+
await new Promise((resolve17, reject) => {
|
|
263348
263767
|
server.close((error48) => {
|
|
263349
263768
|
if (error48) {
|
|
263350
263769
|
reject(error48);
|
|
263351
263770
|
return;
|
|
263352
263771
|
}
|
|
263353
|
-
|
|
263772
|
+
resolve17();
|
|
263354
263773
|
});
|
|
263355
263774
|
});
|
|
263356
263775
|
};
|
|
@@ -263421,15 +263840,15 @@ class ServeRunner {
|
|
|
263421
263840
|
return;
|
|
263422
263841
|
}
|
|
263423
263842
|
this.stopping = true;
|
|
263424
|
-
const exited = new Promise((
|
|
263843
|
+
const exited = new Promise((resolve17) => child.once("exit", () => resolve17()));
|
|
263425
263844
|
if (process23.platform === "win32" && child.pid) {
|
|
263426
263845
|
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
263427
263846
|
stdio: "ignore",
|
|
263428
263847
|
windowsHide: true
|
|
263429
263848
|
});
|
|
263430
|
-
await new Promise((
|
|
263431
|
-
taskkill.once("exit", () =>
|
|
263432
|
-
taskkill.once("error", () =>
|
|
263849
|
+
await new Promise((resolve17) => {
|
|
263850
|
+
taskkill.once("exit", () => resolve17());
|
|
263851
|
+
taskkill.once("error", () => resolve17());
|
|
263433
263852
|
});
|
|
263434
263853
|
} else if (child.pid) {
|
|
263435
263854
|
try {
|
|
@@ -263624,13 +264043,13 @@ async function runScript(options8) {
|
|
|
263624
264043
|
}
|
|
263625
264044
|
// src/cli/commands/exec.ts
|
|
263626
264045
|
function readStdin2() {
|
|
263627
|
-
return new Promise((
|
|
264046
|
+
return new Promise((resolve17, reject) => {
|
|
263628
264047
|
let data = "";
|
|
263629
264048
|
process.stdin.setEncoding("utf-8");
|
|
263630
264049
|
process.stdin.on("data", (chunk) => {
|
|
263631
264050
|
data += chunk;
|
|
263632
264051
|
});
|
|
263633
|
-
process.stdin.on("end", () =>
|
|
264052
|
+
process.stdin.on("end", () => resolve17(data));
|
|
263634
264053
|
process.stdin.on("error", reject);
|
|
263635
264054
|
});
|
|
263636
264055
|
}
|
|
@@ -263701,7 +264120,7 @@ Examples:
|
|
|
263701
264120
|
}
|
|
263702
264121
|
|
|
263703
264122
|
// src/cli/commands/project/eject.ts
|
|
263704
|
-
import { resolve as
|
|
264123
|
+
import { resolve as resolve17 } from "node:path";
|
|
263705
264124
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
263706
264125
|
async function eject(ctx, options8, command2) {
|
|
263707
264126
|
const { log, runTask: runTask2, isNonInteractive } = ctx;
|
|
@@ -263765,7 +264184,7 @@ async function eject(ctx, options8, command2) {
|
|
|
263765
264184
|
Ne("Operation cancelled.");
|
|
263766
264185
|
throw new CLIExitError(0);
|
|
263767
264186
|
}
|
|
263768
|
-
const resolvedPath =
|
|
264187
|
+
const resolvedPath = resolve17(selectedPath);
|
|
263769
264188
|
await runTask2("Downloading your project's code...", async (updateMessage) => {
|
|
263770
264189
|
await createProjectFilesForExistingProject({
|
|
263771
264190
|
projectId,
|
|
@@ -263859,7 +264278,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
263859
264278
|
import { release, type } from "node:os";
|
|
263860
264279
|
|
|
263861
264280
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
263862
|
-
import { dirname as
|
|
264281
|
+
import { dirname as dirname25, posix, sep as sep2 } from "path";
|
|
263863
264282
|
function createModulerModifier() {
|
|
263864
264283
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
263865
264284
|
return async (frames) => {
|
|
@@ -263868,7 +264287,7 @@ function createModulerModifier() {
|
|
|
263868
264287
|
return frames;
|
|
263869
264288
|
};
|
|
263870
264289
|
}
|
|
263871
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
264290
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname25(process.argv[1]) : process.cwd(), isWindows5 = sep2 === "\\") {
|
|
263872
264291
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
263873
264292
|
return (filename) => {
|
|
263874
264293
|
if (!filename)
|
|
@@ -266146,14 +266565,14 @@ async function addSourceContext(frames) {
|
|
|
266146
266565
|
return frames;
|
|
266147
266566
|
}
|
|
266148
266567
|
function getContextLinesFromFile(path19, ranges, output) {
|
|
266149
|
-
return new Promise((
|
|
266568
|
+
return new Promise((resolve18) => {
|
|
266150
266569
|
const stream = createReadStream2(path19);
|
|
266151
266570
|
const lineReaded = createInterface2({
|
|
266152
266571
|
input: stream
|
|
266153
266572
|
});
|
|
266154
266573
|
function destroyStreamAndResolve() {
|
|
266155
266574
|
stream.destroy();
|
|
266156
|
-
|
|
266575
|
+
resolve18();
|
|
266157
266576
|
}
|
|
266158
266577
|
let lineNumber = 0;
|
|
266159
266578
|
let currentRangeIndex = 0;
|
|
@@ -267265,15 +267684,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
267265
267684
|
return true;
|
|
267266
267685
|
if (this.featureFlagsPoller === undefined)
|
|
267267
267686
|
return false;
|
|
267268
|
-
return new Promise((
|
|
267687
|
+
return new Promise((resolve18) => {
|
|
267269
267688
|
const timeout3 = setTimeout(() => {
|
|
267270
267689
|
cleanup();
|
|
267271
|
-
|
|
267690
|
+
resolve18(false);
|
|
267272
267691
|
}, timeoutMs);
|
|
267273
267692
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
|
|
267274
267693
|
clearTimeout(timeout3);
|
|
267275
267694
|
cleanup();
|
|
267276
|
-
|
|
267695
|
+
resolve18(count2 > 0);
|
|
267277
267696
|
});
|
|
267278
267697
|
});
|
|
267279
267698
|
}
|
|
@@ -268057,9 +268476,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
268057
268476
|
});
|
|
268058
268477
|
}
|
|
268059
268478
|
// src/cli/index.ts
|
|
268060
|
-
var __dirname4 =
|
|
268479
|
+
var __dirname4 = dirname26(fileURLToPath6(import.meta.url));
|
|
268061
268480
|
async function runCLI(options8) {
|
|
268062
|
-
ensureNpmAssets(
|
|
268481
|
+
ensureNpmAssets(join37(__dirname4, "../assets"));
|
|
268063
268482
|
const errorReporter = new ErrorReporter;
|
|
268064
268483
|
errorReporter.registerProcessErrorHandlers();
|
|
268065
268484
|
const jsonMode = process.argv.includes("--json");
|
|
@@ -268098,4 +268517,4 @@ export {
|
|
|
268098
268517
|
runCLI
|
|
268099
268518
|
};
|
|
268100
268519
|
|
|
268101
|
-
//# debugId=
|
|
268520
|
+
//# debugId=9741A962D703AE2864756E2164756E21
|