@base44-preview/cli 0.1.15-pr.632.1a53729 → 0.1.16-pr.626.51eb442
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 +694 -218
- package/dist/cli/index.js.map +25 -13
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -31177,7 +31177,7 @@ function cleanDoc(doc) {
|
|
|
31177
31177
|
return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
|
|
31178
31178
|
}
|
|
31179
31179
|
function replaceEndOfLine(doc, replacement = literalline) {
|
|
31180
|
-
return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ?
|
|
31180
|
+
return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join30(replacement, currentDoc.split(`
|
|
31181
31181
|
`)) : currentDoc);
|
|
31182
31182
|
}
|
|
31183
31183
|
function canBreakFn(doc) {
|
|
@@ -31257,7 +31257,7 @@ function indentIfBreak(contents, options) {
|
|
|
31257
31257
|
negate: options.negate
|
|
31258
31258
|
};
|
|
31259
31259
|
}
|
|
31260
|
-
function
|
|
31260
|
+
function join30(separator, docs) {
|
|
31261
31261
|
assertDoc(separator);
|
|
31262
31262
|
assertDocArray(docs);
|
|
31263
31263
|
const parts = [];
|
|
@@ -31968,7 +31968,7 @@ var init_doc = __esm(() => {
|
|
|
31968
31968
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
31969
31969
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
31970
31970
|
builders = {
|
|
31971
|
-
join:
|
|
31971
|
+
join: join30,
|
|
31972
31972
|
line,
|
|
31973
31973
|
softline,
|
|
31974
31974
|
hardline,
|
|
@@ -228783,7 +228783,7 @@ function normalizeBase44Env() {
|
|
|
228783
228783
|
loadProjectEnvFiles();
|
|
228784
228784
|
|
|
228785
228785
|
// src/cli/index.ts
|
|
228786
|
-
import { dirname as
|
|
228786
|
+
import { dirname as dirname29, join as join39 } from "node:path";
|
|
228787
228787
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
228788
228788
|
|
|
228789
228789
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -239236,7 +239236,7 @@ import { join as join13 } from "node:path";
|
|
|
239236
239236
|
// package.json
|
|
239237
239237
|
var package_default = {
|
|
239238
239238
|
name: "base44",
|
|
239239
|
-
version: "0.1.
|
|
239239
|
+
version: "0.1.16",
|
|
239240
239240
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
239241
239241
|
type: "module",
|
|
239242
239242
|
bin: {
|
|
@@ -239590,91 +239590,8 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
239590
239590
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
239591
239591
|
import { join as join18 } from "node:path";
|
|
239592
239592
|
|
|
239593
|
-
// src/core/site/manifest.ts
|
|
239594
|
-
import { createHash } from "node:crypto";
|
|
239595
|
-
import { createReadStream } from "node:fs";
|
|
239596
|
-
import { stat } from "node:fs/promises";
|
|
239597
|
-
import { basename as basename5, extname, join as join16 } from "node:path";
|
|
239598
|
-
var MAX_ASSET_COUNT = 1e5;
|
|
239599
|
-
var ASSETS_IGNORE_FILE = ".assetsignore";
|
|
239600
|
-
var ALWAYS_IGNORED = new Set([
|
|
239601
|
-
ASSETS_IGNORE_FILE,
|
|
239602
|
-
"wrangler.json",
|
|
239603
|
-
".dev.vars"
|
|
239604
|
-
]);
|
|
239605
|
-
var MIME_TYPES = {
|
|
239606
|
-
".html": "text/html",
|
|
239607
|
-
".htm": "text/html",
|
|
239608
|
-
".css": "text/css",
|
|
239609
|
-
".js": "text/javascript",
|
|
239610
|
-
".mjs": "text/javascript",
|
|
239611
|
-
".json": "application/json",
|
|
239612
|
-
".map": "application/json",
|
|
239613
|
-
".txt": "text/plain",
|
|
239614
|
-
".xml": "application/xml",
|
|
239615
|
-
".svg": "image/svg+xml",
|
|
239616
|
-
".png": "image/png",
|
|
239617
|
-
".jpg": "image/jpeg",
|
|
239618
|
-
".jpeg": "image/jpeg",
|
|
239619
|
-
".gif": "image/gif",
|
|
239620
|
-
".webp": "image/webp",
|
|
239621
|
-
".avif": "image/avif",
|
|
239622
|
-
".ico": "image/x-icon",
|
|
239623
|
-
".woff": "font/woff",
|
|
239624
|
-
".woff2": "font/woff2",
|
|
239625
|
-
".ttf": "font/ttf",
|
|
239626
|
-
".otf": "font/otf",
|
|
239627
|
-
".eot": "application/vnd.ms-fontobject",
|
|
239628
|
-
".mp3": "audio/mpeg",
|
|
239629
|
-
".mp4": "video/mp4",
|
|
239630
|
-
".webm": "video/webm",
|
|
239631
|
-
".pdf": "application/pdf",
|
|
239632
|
-
".wasm": "application/wasm",
|
|
239633
|
-
".webmanifest": "application/manifest+json"
|
|
239634
|
-
};
|
|
239635
|
-
function getAssetContentType(filePath) {
|
|
239636
|
-
return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
239637
|
-
}
|
|
239638
|
-
async function hashAssetFile(appId, absolutePath) {
|
|
239639
|
-
const hash = createHash("sha256").update(Buffer.from(appId, "utf8"));
|
|
239640
|
-
for await (const chunk of createReadStream(absolutePath)) {
|
|
239641
|
-
hash.update(chunk);
|
|
239642
|
-
}
|
|
239643
|
-
return hash.digest("hex").slice(0, 32);
|
|
239644
|
-
}
|
|
239645
|
-
async function buildAssetManifest(assetsDir, appId) {
|
|
239646
|
-
const manifest = {};
|
|
239647
|
-
const filesByHash = new Map;
|
|
239648
|
-
const found = await globby("**/*", {
|
|
239649
|
-
cwd: assetsDir,
|
|
239650
|
-
dot: true,
|
|
239651
|
-
onlyFiles: true,
|
|
239652
|
-
followSymbolicLinks: false,
|
|
239653
|
-
ignoreFiles: [ASSETS_IGNORE_FILE]
|
|
239654
|
-
});
|
|
239655
|
-
const relativeFilePaths = found.filter((path) => !ALWAYS_IGNORED.has(basename5(path)));
|
|
239656
|
-
if (relativeFilePaths.length > MAX_ASSET_COUNT) {
|
|
239657
|
-
throw new InvalidInputError(`Too many static assets: found ${relativeFilePaths.length}, the limit is ${MAX_ASSET_COUNT} files.`);
|
|
239658
|
-
}
|
|
239659
|
-
for (const relativePath of relativeFilePaths.sort()) {
|
|
239660
|
-
const absolutePath = join16(assetsDir, ...relativePath.split("/"));
|
|
239661
|
-
const { size } = await stat(absolutePath);
|
|
239662
|
-
const hash = await hashAssetFile(appId, absolutePath);
|
|
239663
|
-
manifest[`/${relativePath}`] = { hash, size };
|
|
239664
|
-
if (!filesByHash.has(hash)) {
|
|
239665
|
-
filesByHash.set(hash, {
|
|
239666
|
-
absolutePath,
|
|
239667
|
-
hash,
|
|
239668
|
-
size,
|
|
239669
|
-
contentType: getAssetContentType(absolutePath)
|
|
239670
|
-
});
|
|
239671
|
-
}
|
|
239672
|
-
}
|
|
239673
|
-
return { manifest, filesByHash };
|
|
239674
|
-
}
|
|
239675
|
-
|
|
239676
239593
|
// src/core/site/modules.ts
|
|
239677
|
-
import { stat
|
|
239594
|
+
import { stat } from "node:fs/promises";
|
|
239678
239595
|
import { relative as relative5, resolve as resolve3, sep } from "node:path";
|
|
239679
239596
|
var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
|
|
239680
239597
|
var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
|
|
@@ -239749,7 +239666,7 @@ async function collectModules(config) {
|
|
|
239749
239666
|
const modules = [...modulesByName.values()];
|
|
239750
239667
|
let totalBytes = 0;
|
|
239751
239668
|
for (const module of modules) {
|
|
239752
|
-
module.size = (await
|
|
239669
|
+
module.size = (await stat(module.absolutePath)).size;
|
|
239753
239670
|
totalBytes += module.size;
|
|
239754
239671
|
}
|
|
239755
239672
|
if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
|
|
@@ -239768,8 +239685,104 @@ function addSourcemap(modulesByName, configDir, name) {
|
|
|
239768
239685
|
});
|
|
239769
239686
|
}
|
|
239770
239687
|
|
|
239771
|
-
// src/core/site/
|
|
239772
|
-
import {
|
|
239688
|
+
// src/core/site/wrangler-config.ts
|
|
239689
|
+
import { dirname as dirname12, join as join16, resolve as resolve4 } from "node:path";
|
|
239690
|
+
var WRANGLER_REDIRECT_PATH = join16(".wrangler", "deploy", "config.json");
|
|
239691
|
+
var RedirectConfigSchema = looseObject({
|
|
239692
|
+
configPath: string2().min(1)
|
|
239693
|
+
});
|
|
239694
|
+
var WranglerConfigSchema = looseObject({
|
|
239695
|
+
main: string2().min(1, "wrangler config is missing a 'main' entry module"),
|
|
239696
|
+
no_bundle: boolean2().optional(),
|
|
239697
|
+
rules: array(looseObject({ type: string2(), globs: array(string2()) })).optional(),
|
|
239698
|
+
assets: looseObject({
|
|
239699
|
+
directory: string2().optional(),
|
|
239700
|
+
html_handling: string2().optional(),
|
|
239701
|
+
not_found_handling: string2().optional(),
|
|
239702
|
+
run_worker_first: union([boolean2(), array(string2())]).optional(),
|
|
239703
|
+
headers: string2().optional(),
|
|
239704
|
+
redirects: string2().optional()
|
|
239705
|
+
}).optional(),
|
|
239706
|
+
compatibility_date: string2().optional(),
|
|
239707
|
+
compatibility_flags: array(string2()).optional(),
|
|
239708
|
+
vars: record(string2(), unknown()).optional(),
|
|
239709
|
+
upload_source_maps: boolean2().optional()
|
|
239710
|
+
});
|
|
239711
|
+
async function detectFullStackArtifact(projectRoot) {
|
|
239712
|
+
const redirectPath = join16(projectRoot, WRANGLER_REDIRECT_PATH);
|
|
239713
|
+
return await pathExists(redirectPath) ? redirectPath : null;
|
|
239714
|
+
}
|
|
239715
|
+
async function resolveWranglerConfig(redirectPath) {
|
|
239716
|
+
const configPath = await resolveRedirectedConfigPath(redirectPath);
|
|
239717
|
+
const parsed = await readJsonFile(configPath);
|
|
239718
|
+
const result = WranglerConfigSchema.safeParse(parsed);
|
|
239719
|
+
if (!result.success) {
|
|
239720
|
+
throw new ConfigInvalidError(`Invalid wrangler config: ${prettifyError(result.error)}`, configPath);
|
|
239721
|
+
}
|
|
239722
|
+
const config = result.data;
|
|
239723
|
+
if (config.no_bundle !== true) {
|
|
239724
|
+
throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
|
|
239725
|
+
}
|
|
239726
|
+
const configDir = dirname12(configPath);
|
|
239727
|
+
const assetsDirectory = config.assets?.directory ? resolve4(configDir, config.assets.directory) : null;
|
|
239728
|
+
return {
|
|
239729
|
+
configPath,
|
|
239730
|
+
configDir,
|
|
239731
|
+
main: config.main,
|
|
239732
|
+
assetsDirectory,
|
|
239733
|
+
assetsConfig: config.assets ? toResolvedAssetsConfig(config.assets) : null,
|
|
239734
|
+
compatibilityDate: config.compatibility_date ?? null,
|
|
239735
|
+
compatibilityFlags: config.compatibility_flags ?? [],
|
|
239736
|
+
rules: (config.rules ?? []).map((rule) => ({
|
|
239737
|
+
type: rule.type,
|
|
239738
|
+
globs: rule.globs
|
|
239739
|
+
})),
|
|
239740
|
+
uploadSourceMaps: config.upload_source_maps ?? false
|
|
239741
|
+
};
|
|
239742
|
+
}
|
|
239743
|
+
async function resolveRedirectedConfigPath(redirectPath) {
|
|
239744
|
+
const parsed = await readJsonFile(redirectPath);
|
|
239745
|
+
const result = RedirectConfigSchema.safeParse(parsed);
|
|
239746
|
+
if (!result.success) {
|
|
239747
|
+
throw new ConfigInvalidError(`Invalid deploy redirect file: ${prettifyError(result.error)}`, redirectPath);
|
|
239748
|
+
}
|
|
239749
|
+
const configPath = resolve4(dirname12(redirectPath), result.data.configPath);
|
|
239750
|
+
if (!await pathExists(configPath)) {
|
|
239751
|
+
throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
|
|
239752
|
+
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
239753
|
+
});
|
|
239754
|
+
}
|
|
239755
|
+
return configPath;
|
|
239756
|
+
}
|
|
239757
|
+
function toResolvedAssetsConfig(assets) {
|
|
239758
|
+
return {
|
|
239759
|
+
htmlHandling: assets.html_handling,
|
|
239760
|
+
notFoundHandling: assets.not_found_handling,
|
|
239761
|
+
runWorkerFirst: assets.run_worker_first,
|
|
239762
|
+
headers: assets.headers,
|
|
239763
|
+
redirects: assets.redirects
|
|
239764
|
+
};
|
|
239765
|
+
}
|
|
239766
|
+
|
|
239767
|
+
// src/core/site/full-stack.ts
|
|
239768
|
+
async function resolveFullStackBuild(projectRoot) {
|
|
239769
|
+
const redirectPath = await detectFullStackArtifact(projectRoot);
|
|
239770
|
+
if (!redirectPath) {
|
|
239771
|
+
return null;
|
|
239772
|
+
}
|
|
239773
|
+
const config = await resolveWranglerConfig(redirectPath);
|
|
239774
|
+
return {
|
|
239775
|
+
config,
|
|
239776
|
+
modules: await collectModules(config),
|
|
239777
|
+
assetsDir: config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null
|
|
239778
|
+
};
|
|
239779
|
+
}
|
|
239780
|
+
|
|
239781
|
+
// src/core/site/manifest.ts
|
|
239782
|
+
import { createHash } from "node:crypto";
|
|
239783
|
+
import { createReadStream } from "node:fs";
|
|
239784
|
+
import { stat as stat2 } from "node:fs/promises";
|
|
239785
|
+
import { basename as basename5, extname, join as join17 } from "node:path";
|
|
239773
239786
|
|
|
239774
239787
|
// ../../node_modules/p-map/index.js
|
|
239775
239788
|
async function pMap(iterable, mapper, {
|
|
@@ -239895,7 +239908,99 @@ async function pMap(iterable, mapper, {
|
|
|
239895
239908
|
}
|
|
239896
239909
|
var pMapSkip = Symbol("skip");
|
|
239897
239910
|
|
|
239911
|
+
// src/core/site/manifest.ts
|
|
239912
|
+
var MAX_ASSET_COUNT = 1e5;
|
|
239913
|
+
var ASSETS_IGNORE_FILE = ".assetsignore";
|
|
239914
|
+
var ALWAYS_IGNORED = new Set([
|
|
239915
|
+
ASSETS_IGNORE_FILE,
|
|
239916
|
+
"wrangler.json",
|
|
239917
|
+
".dev.vars"
|
|
239918
|
+
]);
|
|
239919
|
+
var MIME_TYPES = {
|
|
239920
|
+
".html": "text/html",
|
|
239921
|
+
".htm": "text/html",
|
|
239922
|
+
".css": "text/css",
|
|
239923
|
+
".js": "text/javascript",
|
|
239924
|
+
".mjs": "text/javascript",
|
|
239925
|
+
".json": "application/json",
|
|
239926
|
+
".map": "application/json",
|
|
239927
|
+
".txt": "text/plain",
|
|
239928
|
+
".xml": "application/xml",
|
|
239929
|
+
".svg": "image/svg+xml",
|
|
239930
|
+
".png": "image/png",
|
|
239931
|
+
".jpg": "image/jpeg",
|
|
239932
|
+
".jpeg": "image/jpeg",
|
|
239933
|
+
".gif": "image/gif",
|
|
239934
|
+
".webp": "image/webp",
|
|
239935
|
+
".avif": "image/avif",
|
|
239936
|
+
".ico": "image/x-icon",
|
|
239937
|
+
".woff": "font/woff",
|
|
239938
|
+
".woff2": "font/woff2",
|
|
239939
|
+
".ttf": "font/ttf",
|
|
239940
|
+
".otf": "font/otf",
|
|
239941
|
+
".eot": "application/vnd.ms-fontobject",
|
|
239942
|
+
".mp3": "audio/mpeg",
|
|
239943
|
+
".mp4": "video/mp4",
|
|
239944
|
+
".webm": "video/webm",
|
|
239945
|
+
".pdf": "application/pdf",
|
|
239946
|
+
".wasm": "application/wasm",
|
|
239947
|
+
".webmanifest": "application/manifest+json"
|
|
239948
|
+
};
|
|
239949
|
+
function getAssetContentType(filePath) {
|
|
239950
|
+
return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
239951
|
+
}
|
|
239952
|
+
async function walkBuildOutput(outputDir) {
|
|
239953
|
+
const found = await globby("**/*", {
|
|
239954
|
+
cwd: outputDir,
|
|
239955
|
+
dot: true,
|
|
239956
|
+
onlyFiles: true,
|
|
239957
|
+
followSymbolicLinks: false,
|
|
239958
|
+
ignoreFiles: [ASSETS_IGNORE_FILE]
|
|
239959
|
+
});
|
|
239960
|
+
return found.filter((path) => !ALWAYS_IGNORED.has(basename5(path))).sort();
|
|
239961
|
+
}
|
|
239962
|
+
var STAT_CONCURRENCY = 32;
|
|
239963
|
+
async function describeBuildOutput(outputDir) {
|
|
239964
|
+
const relativePaths = await walkBuildOutput(outputDir);
|
|
239965
|
+
return await pMap(relativePaths, async (path) => {
|
|
239966
|
+
const absolutePath = join17(outputDir, ...path.split("/"));
|
|
239967
|
+
return { path, absolutePath, size: (await stat2(absolutePath)).size };
|
|
239968
|
+
}, { concurrency: STAT_CONCURRENCY });
|
|
239969
|
+
}
|
|
239970
|
+
async function hashFileInto(hash, absolutePath) {
|
|
239971
|
+
for await (const chunk of createReadStream(absolutePath)) {
|
|
239972
|
+
hash.update(chunk);
|
|
239973
|
+
}
|
|
239974
|
+
return hash;
|
|
239975
|
+
}
|
|
239976
|
+
async function hashAssetFile(appId, absolutePath) {
|
|
239977
|
+
const hash = await hashFileInto(createHash("sha256").update(Buffer.from(appId, "utf8")), absolutePath);
|
|
239978
|
+
return hash.digest("hex").slice(0, 32);
|
|
239979
|
+
}
|
|
239980
|
+
async function buildAssetManifest(assetsDir, appId) {
|
|
239981
|
+
const manifest = {};
|
|
239982
|
+
const filesByHash = new Map;
|
|
239983
|
+
const files = await describeBuildOutput(assetsDir);
|
|
239984
|
+
if (files.length > MAX_ASSET_COUNT) {
|
|
239985
|
+
throw new InvalidInputError(`Too many static assets: found ${files.length}, the limit is ${MAX_ASSET_COUNT} files.`);
|
|
239986
|
+
}
|
|
239987
|
+
for (const { path: relativePath, absolutePath, size } of files) {
|
|
239988
|
+
const hash = await hashAssetFile(appId, absolutePath);
|
|
239989
|
+
manifest[`/${relativePath}`] = { hash, size };
|
|
239990
|
+
if (!filesByHash.has(hash)) {
|
|
239991
|
+
filesByHash.set(hash, {
|
|
239992
|
+
absolutePath,
|
|
239993
|
+
hash,
|
|
239994
|
+
size,
|
|
239995
|
+
contentType: getAssetContentType(absolutePath)
|
|
239996
|
+
});
|
|
239997
|
+
}
|
|
239998
|
+
}
|
|
239999
|
+
return { manifest, filesByHash };
|
|
240000
|
+
}
|
|
240001
|
+
|
|
239898
240002
|
// src/core/site/upload.ts
|
|
240003
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
239899
240004
|
var DEFAULT_UPLOAD_CONCURRENCY = 3;
|
|
239900
240005
|
var MAX_UPLOAD_CONCURRENCY = 50;
|
|
239901
240006
|
var MAX_UPLOAD_ATTEMPTS = 3;
|
|
@@ -239994,11 +240099,17 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
239994
240099
|
if (!file) {
|
|
239995
240100
|
throw new InternalError(`Server requested upload of unknown asset path: ${upload.path}`);
|
|
239996
240101
|
}
|
|
239997
|
-
|
|
240102
|
+
await putPresigned(upload, file.absolutePath);
|
|
240103
|
+
}
|
|
240104
|
+
async function putPresigned(upload, absolutePath) {
|
|
240105
|
+
const content = await readFile2(absolutePath);
|
|
239998
240106
|
try {
|
|
239999
240107
|
await distribution_default.put(upload.url, {
|
|
240000
240108
|
body: new Uint8Array(content),
|
|
240001
|
-
headers: {
|
|
240109
|
+
headers: {
|
|
240110
|
+
"Content-Type": upload.contentType,
|
|
240111
|
+
...upload.checksumSha256 ? { "x-amz-checksum-sha256": upload.checksumSha256 } : {}
|
|
240112
|
+
},
|
|
240002
240113
|
timeout: 120000,
|
|
240003
240114
|
retry: UPLOAD_RETRY
|
|
240004
240115
|
});
|
|
@@ -240007,85 +240118,6 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
240007
240118
|
}
|
|
240008
240119
|
}
|
|
240009
240120
|
|
|
240010
|
-
// src/core/site/wrangler-config.ts
|
|
240011
|
-
import { dirname as dirname12, join as join17, resolve as resolve4 } from "node:path";
|
|
240012
|
-
var WRANGLER_REDIRECT_PATH = join17(".wrangler", "deploy", "config.json");
|
|
240013
|
-
var RedirectConfigSchema = looseObject({
|
|
240014
|
-
configPath: string2().min(1)
|
|
240015
|
-
});
|
|
240016
|
-
var WranglerConfigSchema = looseObject({
|
|
240017
|
-
main: string2().min(1, "wrangler config is missing a 'main' entry module"),
|
|
240018
|
-
no_bundle: boolean2().optional(),
|
|
240019
|
-
rules: array(looseObject({ type: string2(), globs: array(string2()) })).optional(),
|
|
240020
|
-
assets: looseObject({
|
|
240021
|
-
directory: string2().optional(),
|
|
240022
|
-
html_handling: string2().optional(),
|
|
240023
|
-
not_found_handling: string2().optional(),
|
|
240024
|
-
run_worker_first: union([boolean2(), array(string2())]).optional(),
|
|
240025
|
-
headers: string2().optional(),
|
|
240026
|
-
redirects: string2().optional()
|
|
240027
|
-
}).optional(),
|
|
240028
|
-
compatibility_date: string2().optional(),
|
|
240029
|
-
compatibility_flags: array(string2()).optional(),
|
|
240030
|
-
vars: record(string2(), unknown()).optional(),
|
|
240031
|
-
upload_source_maps: boolean2().optional()
|
|
240032
|
-
});
|
|
240033
|
-
async function detectFullStackArtifact(projectRoot) {
|
|
240034
|
-
const redirectPath = join17(projectRoot, WRANGLER_REDIRECT_PATH);
|
|
240035
|
-
return await pathExists(redirectPath) ? redirectPath : null;
|
|
240036
|
-
}
|
|
240037
|
-
async function resolveWranglerConfig(redirectPath) {
|
|
240038
|
-
const configPath = await resolveRedirectedConfigPath(redirectPath);
|
|
240039
|
-
const parsed = await readJsonFile(configPath);
|
|
240040
|
-
const result = WranglerConfigSchema.safeParse(parsed);
|
|
240041
|
-
if (!result.success) {
|
|
240042
|
-
throw new ConfigInvalidError(`Invalid wrangler config: ${prettifyError(result.error)}`, configPath);
|
|
240043
|
-
}
|
|
240044
|
-
const config = result.data;
|
|
240045
|
-
if (config.no_bundle !== true) {
|
|
240046
|
-
throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
|
|
240047
|
-
}
|
|
240048
|
-
const configDir = dirname12(configPath);
|
|
240049
|
-
const assetsDirectory = config.assets?.directory ? resolve4(configDir, config.assets.directory) : null;
|
|
240050
|
-
return {
|
|
240051
|
-
configPath,
|
|
240052
|
-
configDir,
|
|
240053
|
-
main: config.main,
|
|
240054
|
-
assetsDirectory,
|
|
240055
|
-
assetsConfig: config.assets ? toResolvedAssetsConfig(config.assets) : null,
|
|
240056
|
-
compatibilityDate: config.compatibility_date ?? null,
|
|
240057
|
-
compatibilityFlags: config.compatibility_flags ?? [],
|
|
240058
|
-
rules: (config.rules ?? []).map((rule) => ({
|
|
240059
|
-
type: rule.type,
|
|
240060
|
-
globs: rule.globs
|
|
240061
|
-
})),
|
|
240062
|
-
uploadSourceMaps: config.upload_source_maps ?? false
|
|
240063
|
-
};
|
|
240064
|
-
}
|
|
240065
|
-
async function resolveRedirectedConfigPath(redirectPath) {
|
|
240066
|
-
const parsed = await readJsonFile(redirectPath);
|
|
240067
|
-
const result = RedirectConfigSchema.safeParse(parsed);
|
|
240068
|
-
if (!result.success) {
|
|
240069
|
-
throw new ConfigInvalidError(`Invalid deploy redirect file: ${prettifyError(result.error)}`, redirectPath);
|
|
240070
|
-
}
|
|
240071
|
-
const configPath = resolve4(dirname12(redirectPath), result.data.configPath);
|
|
240072
|
-
if (!await pathExists(configPath)) {
|
|
240073
|
-
throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
|
|
240074
|
-
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
240075
|
-
});
|
|
240076
|
-
}
|
|
240077
|
-
return configPath;
|
|
240078
|
-
}
|
|
240079
|
-
function toResolvedAssetsConfig(assets) {
|
|
240080
|
-
return {
|
|
240081
|
-
htmlHandling: assets.html_handling,
|
|
240082
|
-
notFoundHandling: assets.not_found_handling,
|
|
240083
|
-
runWorkerFirst: assets.run_worker_first,
|
|
240084
|
-
headers: assets.headers,
|
|
240085
|
-
redirects: assets.redirects
|
|
240086
|
-
};
|
|
240087
|
-
}
|
|
240088
|
-
|
|
240089
240121
|
// src/core/site/deployment.ts
|
|
240090
240122
|
var NO_ASSETS = { manifest: {}, filesByHash: new Map };
|
|
240091
240123
|
var DEPLOYMENTS_API_ENV = "BASE44_DEPLOYMENTS_API";
|
|
@@ -240112,12 +240144,11 @@ async function deployToDeployments(options) {
|
|
|
240112
240144
|
return { deploymentId: finalized.deploymentId, gitHash };
|
|
240113
240145
|
}
|
|
240114
240146
|
async function resolveWorkerBuild(projectRoot, progress) {
|
|
240115
|
-
const
|
|
240116
|
-
if (!
|
|
240147
|
+
const built = await resolveFullStackBuild(projectRoot);
|
|
240148
|
+
if (!built) {
|
|
240117
240149
|
return null;
|
|
240118
240150
|
}
|
|
240119
|
-
const config =
|
|
240120
|
-
const assetsDir = config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null;
|
|
240151
|
+
const { config, modules, assetsDir } = built;
|
|
240121
240152
|
return {
|
|
240122
240153
|
config: {
|
|
240123
240154
|
main: config.main,
|
|
@@ -240125,7 +240156,7 @@ async function resolveWorkerBuild(projectRoot, progress) {
|
|
|
240125
240156
|
compatibility_flags: config.compatibilityFlags,
|
|
240126
240157
|
assets: buildAssetsConfig(config.assetsConfig, progress)
|
|
240127
240158
|
},
|
|
240128
|
-
modules
|
|
240159
|
+
modules,
|
|
240129
240160
|
assetsDir
|
|
240130
240161
|
};
|
|
240131
240162
|
}
|
|
@@ -246669,6 +246700,13 @@ async function resolveGitHash(projectRoot, explicit) {
|
|
|
246669
246700
|
}
|
|
246670
246701
|
return hash;
|
|
246671
246702
|
}
|
|
246703
|
+
async function resolveProvenanceCommit(projectRoot, explicit) {
|
|
246704
|
+
if (explicit) {
|
|
246705
|
+
return await resolveGitHash(projectRoot, explicit);
|
|
246706
|
+
}
|
|
246707
|
+
const hash = await gitHead(projectRoot);
|
|
246708
|
+
return hash && isGitCommitHash(hash) ? hash : undefined;
|
|
246709
|
+
}
|
|
246672
246710
|
async function gitHead(projectRoot) {
|
|
246673
246711
|
try {
|
|
246674
246712
|
const { stdout } = await execa("git", ["rev-parse", "HEAD"], {
|
|
@@ -247038,6 +247076,12 @@ async function ensureAppContext(ctx, options = {}) {
|
|
|
247038
247076
|
ctx.app = appContext;
|
|
247039
247077
|
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
247040
247078
|
}
|
|
247079
|
+
function requireApp(ctx) {
|
|
247080
|
+
if (!ctx.app) {
|
|
247081
|
+
throw new InternalError("This command read an app context it never resolved — it is declared with requireAppContext: false.");
|
|
247082
|
+
}
|
|
247083
|
+
return ctx.app;
|
|
247084
|
+
}
|
|
247041
247085
|
|
|
247042
247086
|
// src/cli/utils/version-check.ts
|
|
247043
247087
|
async function checkForUpgrade() {
|
|
@@ -247204,6 +247248,178 @@ async function resolveBranchName(name) {
|
|
|
247204
247248
|
return matches[0].id;
|
|
247205
247249
|
}
|
|
247206
247250
|
|
|
247251
|
+
// src/core/version/publish.ts
|
|
247252
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
247253
|
+
|
|
247254
|
+
// src/core/version/schema.ts
|
|
247255
|
+
var DeclareVersionResponseSchema = object({
|
|
247256
|
+
session_id: string2(),
|
|
247257
|
+
uploads: array(object({
|
|
247258
|
+
path: string2(),
|
|
247259
|
+
url: string2(),
|
|
247260
|
+
content_type: string2(),
|
|
247261
|
+
content_length: number2(),
|
|
247262
|
+
checksum_sha256: string2()
|
|
247263
|
+
}))
|
|
247264
|
+
}).transform((data) => ({
|
|
247265
|
+
sessionId: data.session_id,
|
|
247266
|
+
uploads: data.uploads.map((upload) => ({
|
|
247267
|
+
path: upload.path,
|
|
247268
|
+
url: upload.url,
|
|
247269
|
+
contentType: upload.content_type,
|
|
247270
|
+
contentLength: upload.content_length,
|
|
247271
|
+
checksumSha256: upload.checksum_sha256
|
|
247272
|
+
}))
|
|
247273
|
+
}));
|
|
247274
|
+
var CreateVersionResponseSchema = object({
|
|
247275
|
+
version_id: string2(),
|
|
247276
|
+
manifest_hash: string2()
|
|
247277
|
+
}).transform((data) => ({
|
|
247278
|
+
versionId: data.version_id,
|
|
247279
|
+
manifestHash: data.manifest_hash
|
|
247280
|
+
}));
|
|
247281
|
+
var EnvironmentResponseSchema = object({
|
|
247282
|
+
name: string2(),
|
|
247283
|
+
version_id: string2(),
|
|
247284
|
+
manifest_hash: string2(),
|
|
247285
|
+
deployment_id: string2()
|
|
247286
|
+
}).transform((data) => ({
|
|
247287
|
+
name: data.name,
|
|
247288
|
+
versionId: data.version_id,
|
|
247289
|
+
manifestHash: data.manifest_hash,
|
|
247290
|
+
deploymentId: data.deployment_id
|
|
247291
|
+
}));
|
|
247292
|
+
|
|
247293
|
+
// src/core/version/api.ts
|
|
247294
|
+
var DEFAULT_VERSION_UPLOAD_CONCURRENCY = 8;
|
|
247295
|
+
var MAX_VERSION_UPLOAD_CONCURRENCY = 16;
|
|
247296
|
+
function declaredFile({ path, size, digest }) {
|
|
247297
|
+
return { path, size, digest };
|
|
247298
|
+
}
|
|
247299
|
+
function declaredModule(module) {
|
|
247300
|
+
return { ...declaredFile(module), type: module.type };
|
|
247301
|
+
}
|
|
247302
|
+
function declaredAssetsConfig(config) {
|
|
247303
|
+
const stated = {
|
|
247304
|
+
html_handling: config?.htmlHandling ?? null,
|
|
247305
|
+
not_found_handling: config?.notFoundHandling ?? null,
|
|
247306
|
+
run_worker_first: config?.runWorkerFirst ?? null,
|
|
247307
|
+
headers: config?.headers ?? null,
|
|
247308
|
+
redirects: config?.redirects ?? null
|
|
247309
|
+
};
|
|
247310
|
+
return Object.values(stated).every((v) => v === null) ? null : stated;
|
|
247311
|
+
}
|
|
247312
|
+
async function post(path, json, doing) {
|
|
247313
|
+
try {
|
|
247314
|
+
return await getAppClient().post(path, { json, timeout: 180000 });
|
|
247315
|
+
} catch (error) {
|
|
247316
|
+
throw await ApiError.fromHttpError(error, doing);
|
|
247317
|
+
}
|
|
247318
|
+
}
|
|
247319
|
+
var KEYED_RETRY = {
|
|
247320
|
+
limit: 3,
|
|
247321
|
+
methods: ["patch"],
|
|
247322
|
+
statusCodes: [408, 500, 502, 503, 504]
|
|
247323
|
+
};
|
|
247324
|
+
async function patch(path, json, doing, retry) {
|
|
247325
|
+
try {
|
|
247326
|
+
return await getAppClient().patch(path, {
|
|
247327
|
+
json,
|
|
247328
|
+
timeout: 180000,
|
|
247329
|
+
...retry ? { retry } : {}
|
|
247330
|
+
});
|
|
247331
|
+
} catch (error) {
|
|
247332
|
+
throw await ApiError.fromHttpError(error, doing);
|
|
247333
|
+
}
|
|
247334
|
+
}
|
|
247335
|
+
function parse10(schema, body, what) {
|
|
247336
|
+
const result = schema.safeParse(body);
|
|
247337
|
+
if (!result.success) {
|
|
247338
|
+
throw new SchemaValidationError(`Invalid ${what} response from server`, result.error);
|
|
247339
|
+
}
|
|
247340
|
+
return result.data;
|
|
247341
|
+
}
|
|
247342
|
+
async function createVersion(artifacts, options = {}) {
|
|
247343
|
+
const declared = parse10(DeclareVersionResponseSchema, await (await post("versions", {
|
|
247344
|
+
static_bundle: artifacts.files.map(declaredFile),
|
|
247345
|
+
...artifacts.siteWorker ? {
|
|
247346
|
+
site_worker: {
|
|
247347
|
+
main: artifacts.siteWorker.main,
|
|
247348
|
+
modules: artifacts.siteWorker.modules.map(declaredModule),
|
|
247349
|
+
assets: artifacts.siteWorker.assets.map(declaredFile),
|
|
247350
|
+
compatibility_date: artifacts.siteWorker.compatibilityDate,
|
|
247351
|
+
compatibility_flags: artifacts.siteWorker.compatibilityFlags,
|
|
247352
|
+
assets_config: declaredAssetsConfig(artifacts.siteWorker.assetsConfig)
|
|
247353
|
+
}
|
|
247354
|
+
} : {},
|
|
247355
|
+
entities: artifacts.entities,
|
|
247356
|
+
agents: artifacts.agents,
|
|
247357
|
+
source_commit: options.sourceCommit
|
|
247358
|
+
}, "declaring a version")).json(), "declare");
|
|
247359
|
+
const declaredFiles = [
|
|
247360
|
+
...artifacts.files,
|
|
247361
|
+
...artifacts.siteWorker?.modules ?? [],
|
|
247362
|
+
...artifacts.siteWorker?.assets ?? []
|
|
247363
|
+
];
|
|
247364
|
+
options.progress?.onDeclared?.({ fileCount: declaredFiles.length });
|
|
247365
|
+
if (declared.uploads.length !== declaredFiles.length) {
|
|
247366
|
+
throw new InternalError(`Declared ${declaredFiles.length} files but the server signed ${declared.uploads.length} upload URLs.`);
|
|
247367
|
+
}
|
|
247368
|
+
const drifted = declared.uploads.findIndex((upload, index) => upload.path !== declaredFiles[index].path);
|
|
247369
|
+
if (drifted !== -1) {
|
|
247370
|
+
throw new InternalError(`Upload ${drifted} is signed for ${declared.uploads[drifted].path}, but that slot declared ${declaredFiles[drifted].path}.`);
|
|
247371
|
+
}
|
|
247372
|
+
let uploadedFiles = 0;
|
|
247373
|
+
await pMap(declared.uploads, async (upload, index) => {
|
|
247374
|
+
await putPresigned(upload, declaredFiles[index].absolutePath);
|
|
247375
|
+
uploadedFiles++;
|
|
247376
|
+
options.progress?.onUpload?.({
|
|
247377
|
+
uploadedFiles,
|
|
247378
|
+
totalFiles: declared.uploads.length
|
|
247379
|
+
});
|
|
247380
|
+
}, { concurrency: options.concurrency ?? DEFAULT_VERSION_UPLOAD_CONCURRENCY });
|
|
247381
|
+
return parse10(CreateVersionResponseSchema, await (await post(`versions/${encodeURIComponent(declared.sessionId)}/finalize`, {}, "creating a version")).json(), "create version");
|
|
247382
|
+
}
|
|
247383
|
+
async function setEnvironmentVersion(environment, versionId, options = {}) {
|
|
247384
|
+
return parse10(EnvironmentResponseSchema, await (await patch(`environments/${encodeURIComponent(environment)}`, {
|
|
247385
|
+
version_id: versionId,
|
|
247386
|
+
...options.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}
|
|
247387
|
+
}, "setting the environment's version", options.idempotencyKey ? KEYED_RETRY : undefined)).json(), "environment");
|
|
247388
|
+
}
|
|
247389
|
+
|
|
247390
|
+
// src/core/version/publish.ts
|
|
247391
|
+
var STEP = Symbol.for("base44.publishStep");
|
|
247392
|
+
var DEFAULT_ENVIRONMENT = "production";
|
|
247393
|
+
async function tagStep(step, run) {
|
|
247394
|
+
try {
|
|
247395
|
+
return await run();
|
|
247396
|
+
} catch (error) {
|
|
247397
|
+
if (error !== null && typeof error === "object" && !(STEP in error) && Object.isExtensible(error)) {
|
|
247398
|
+
Object.defineProperty(error, STEP, { value: step, enumerable: false });
|
|
247399
|
+
}
|
|
247400
|
+
throw error;
|
|
247401
|
+
}
|
|
247402
|
+
}
|
|
247403
|
+
function stepOf(error) {
|
|
247404
|
+
return error !== null && typeof error === "object" && STEP in error ? error[STEP] : undefined;
|
|
247405
|
+
}
|
|
247406
|
+
async function publishVersion(artifacts, options = {}) {
|
|
247407
|
+
const version = await tagStep("create_version", () => createVersion(artifacts, {
|
|
247408
|
+
sourceCommit: options.sourceCommit,
|
|
247409
|
+
concurrency: options.concurrency,
|
|
247410
|
+
progress: options.progress
|
|
247411
|
+
}));
|
|
247412
|
+
const environment = await tagStep("deploy", () => setEnvironmentVersion(options.target ?? DEFAULT_ENVIRONMENT, version.versionId, {
|
|
247413
|
+
idempotencyKey: randomUUID4()
|
|
247414
|
+
}));
|
|
247415
|
+
return {
|
|
247416
|
+
environment: environment.name,
|
|
247417
|
+
versionId: environment.versionId,
|
|
247418
|
+
manifestHash: environment.manifestHash,
|
|
247419
|
+
deploymentId: environment.deploymentId
|
|
247420
|
+
};
|
|
247421
|
+
}
|
|
247422
|
+
|
|
247207
247423
|
// src/cli/utils/command/Base44Command.ts
|
|
247208
247424
|
function writeJsonSuccess(result) {
|
|
247209
247425
|
if (result.stdout) {
|
|
@@ -247221,6 +247437,10 @@ function writeJsonError(error) {
|
|
|
247221
247437
|
const envelope = {
|
|
247222
247438
|
error: error instanceof Error ? error.message : String(error)
|
|
247223
247439
|
};
|
|
247440
|
+
const step = stepOf(error);
|
|
247441
|
+
if (step !== undefined) {
|
|
247442
|
+
envelope.step = step;
|
|
247443
|
+
}
|
|
247224
247444
|
if (isCLIError(error)) {
|
|
247225
247445
|
envelope.code = error.code;
|
|
247226
247446
|
if (error.details.length > 0) {
|
|
@@ -249563,17 +249783,153 @@ async function maybeAskToBuild(isNonInteractive, buildCommand) {
|
|
|
249563
249783
|
});
|
|
249564
249784
|
return !Ct(answer) && answer;
|
|
249565
249785
|
}
|
|
249786
|
+
// src/core/version/artifacts.ts
|
|
249787
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
249788
|
+
import { join as join28, resolve as resolve11 } from "node:path";
|
|
249789
|
+
|
|
249790
|
+
// src/core/version/project.ts
|
|
249791
|
+
import { dirname as dirname21, join as join27, resolve as resolve10 } from "node:path";
|
|
249792
|
+
var DEFAULT_BUILD_COMMAND = "npm run build";
|
|
249793
|
+
var DEFAULT_OUTPUT_DIRECTORY = "dist";
|
|
249794
|
+
async function resolvePublishTarget(projectRoot, overrides = {}) {
|
|
249795
|
+
const project = await readSettingsIfPresent(projectRoot);
|
|
249796
|
+
const root = project?.root ?? projectRoot ?? process.cwd();
|
|
249797
|
+
return {
|
|
249798
|
+
root,
|
|
249799
|
+
configDir: project ? dirname21(project.configPath) : join27(root, PROJECT_SUBDIR),
|
|
249800
|
+
buildCommand: project ? project.site?.buildCommand : DEFAULT_BUILD_COMMAND,
|
|
249801
|
+
outputDir: outputDirectory(project, root, overrides.outputDir),
|
|
249802
|
+
entitiesDir: project?.entitiesDir ?? "entities",
|
|
249803
|
+
agentsDir: project?.agentsDir ?? "agents"
|
|
249804
|
+
};
|
|
249805
|
+
}
|
|
249806
|
+
function outputDirectory(project, root, override) {
|
|
249807
|
+
const configured = override ?? (project ? project.site?.outputDirectory : DEFAULT_OUTPUT_DIRECTORY);
|
|
249808
|
+
return configured ? resolve10(root, configured) : null;
|
|
249809
|
+
}
|
|
249810
|
+
function requireOutputDir(target) {
|
|
249811
|
+
if (target.outputDir === null) {
|
|
249812
|
+
throw new ConfigNotFoundError("No site configuration found.", {
|
|
249813
|
+
hints: [
|
|
249814
|
+
{
|
|
249815
|
+
message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
|
|
249816
|
+
},
|
|
249817
|
+
{ message: `Or pass --output-dir <dir>, relative to ${target.root}` }
|
|
249818
|
+
]
|
|
249819
|
+
});
|
|
249820
|
+
}
|
|
249821
|
+
return target.outputDir;
|
|
249822
|
+
}
|
|
249823
|
+
async function readSettingsIfPresent(projectRoot) {
|
|
249824
|
+
try {
|
|
249825
|
+
return await readProjectSettings(projectRoot);
|
|
249826
|
+
} catch (error) {
|
|
249827
|
+
if (error instanceof ConfigNotFoundError) {
|
|
249828
|
+
return null;
|
|
249829
|
+
}
|
|
249830
|
+
throw error;
|
|
249831
|
+
}
|
|
249832
|
+
}
|
|
249566
249833
|
|
|
249834
|
+
// src/core/version/artifacts.ts
|
|
249835
|
+
var MAX_FILE_COUNT = 50000;
|
|
249836
|
+
var HASH_CONCURRENCY = 32;
|
|
249837
|
+
var ENTRY2 = "index.html";
|
|
249838
|
+
async function digestFile(absolutePath) {
|
|
249839
|
+
const hash = await hashFileInto(createHash2("sha256"), absolutePath);
|
|
249840
|
+
return `sha256:${hash.digest("hex")}`;
|
|
249841
|
+
}
|
|
249842
|
+
async function collectBuildOutput(outputDir, options = {}) {
|
|
249843
|
+
const found = await describeBuildOutput(outputDir);
|
|
249844
|
+
if (found.length > MAX_FILE_COUNT) {
|
|
249845
|
+
throw new InvalidInputError(`Too many files: found ${found.length}, the limit is ${MAX_FILE_COUNT}.`);
|
|
249846
|
+
}
|
|
249847
|
+
if (options.entryFile) {
|
|
249848
|
+
if (found.length === 0) {
|
|
249849
|
+
throw new InvalidInputError(`No files found in ${outputDir}. Build the site before creating a version.`, {
|
|
249850
|
+
hints: [
|
|
249851
|
+
{ message: "Run 'base44 build' first", command: "base44 build" }
|
|
249852
|
+
]
|
|
249853
|
+
});
|
|
249854
|
+
}
|
|
249855
|
+
if (!found.some((f) => f.path === options.entryFile)) {
|
|
249856
|
+
throw new InvalidInputError(`${outputDir} has no ${options.entryFile}, so nothing could enter the site.`);
|
|
249857
|
+
}
|
|
249858
|
+
}
|
|
249859
|
+
return await pMap(found, async (file) => ({ ...file, digest: await digestFile(file.absolutePath) }), { concurrency: HASH_CONCURRENCY });
|
|
249860
|
+
}
|
|
249861
|
+
async function collectSiteWorker(projectRoot) {
|
|
249862
|
+
const built = await resolveFullStackBuild(projectRoot);
|
|
249863
|
+
if (!built) {
|
|
249864
|
+
return null;
|
|
249865
|
+
}
|
|
249866
|
+
const { config, modules, assetsDir } = built;
|
|
249867
|
+
const entry = resolve11(config.configDir, config.main);
|
|
249868
|
+
const main = modules.find((m) => m.absolutePath === entry)?.name;
|
|
249869
|
+
if (!main) {
|
|
249870
|
+
throw new InvalidInputError(`The Worker's entry module ${config.main} is not among the ${modules.length} modules collected from ${config.configDir}.`);
|
|
249871
|
+
}
|
|
249872
|
+
return {
|
|
249873
|
+
main,
|
|
249874
|
+
modules: await pMap(modules, async ({ name, absolutePath, size, type }) => ({
|
|
249875
|
+
path: name,
|
|
249876
|
+
absolutePath,
|
|
249877
|
+
size,
|
|
249878
|
+
digest: await digestFile(absolutePath),
|
|
249879
|
+
type
|
|
249880
|
+
}), { concurrency: HASH_CONCURRENCY }),
|
|
249881
|
+
assets: assetsDir ? await collectBuildOutput(assetsDir) : [],
|
|
249882
|
+
compatibilityDate: config.compatibilityDate,
|
|
249883
|
+
compatibilityFlags: config.compatibilityFlags,
|
|
249884
|
+
assetsConfig: config.assetsConfig
|
|
249885
|
+
};
|
|
249886
|
+
}
|
|
249887
|
+
async function readRawResources(dir) {
|
|
249888
|
+
if (!await pathExists(dir)) {
|
|
249889
|
+
return {};
|
|
249890
|
+
}
|
|
249891
|
+
const files = await globby(`**/*.${CONFIG_FILE_EXTENSION_GLOB}`, {
|
|
249892
|
+
cwd: dir,
|
|
249893
|
+
onlyFiles: true,
|
|
249894
|
+
followSymbolicLinks: false
|
|
249895
|
+
});
|
|
249896
|
+
const payloads = {};
|
|
249897
|
+
for (const relativePath of files.sort()) {
|
|
249898
|
+
const name = relativePath.replace(/\.jsonc?$/, "");
|
|
249899
|
+
payloads[name] = await readJsonFile(join28(dir, ...relativePath.split("/")));
|
|
249900
|
+
}
|
|
249901
|
+
return payloads;
|
|
249902
|
+
}
|
|
249903
|
+
async function collectResources(configDir, dirs) {
|
|
249904
|
+
const [entities, agents] = await Promise.all([
|
|
249905
|
+
readRawResources(join28(configDir, dirs.entitiesDir)),
|
|
249906
|
+
readRawResources(join28(configDir, dirs.agentsDir))
|
|
249907
|
+
]);
|
|
249908
|
+
return { entities, agents };
|
|
249909
|
+
}
|
|
249910
|
+
async function collectArtifacts(target) {
|
|
249911
|
+
const siteWorker = await collectSiteWorker(target.root);
|
|
249912
|
+
return {
|
|
249913
|
+
files: siteWorker ? [] : await collectBuildOutput(requireOutputDir(target), {
|
|
249914
|
+
entryFile: ENTRY2
|
|
249915
|
+
}),
|
|
249916
|
+
...siteWorker ? { siteWorker } : {},
|
|
249917
|
+
...await collectResources(target.configDir, target)
|
|
249918
|
+
};
|
|
249919
|
+
}
|
|
249920
|
+
// src/core/version/gate.ts
|
|
249921
|
+
var VERSIONS_API_ENV = "BASE44_VERSIONS_API";
|
|
249922
|
+
function versionsApiEnabled(env = process.env) {
|
|
249923
|
+
const value = env[VERSIONS_API_ENV];
|
|
249924
|
+
return value === "1" || value === "true";
|
|
249925
|
+
}
|
|
249567
249926
|
// src/cli/commands/project/build.ts
|
|
249568
249927
|
async function buildAction(ctx) {
|
|
249569
|
-
const
|
|
249570
|
-
|
|
249571
|
-
throw new ConfigInvalidError("base44 build requires a linked local project. Run it from a project with base44/.app.jsonc.");
|
|
249572
|
-
}
|
|
249573
|
-
const { project } = await readProjectConfig(app.projectRoot);
|
|
249928
|
+
const app = requireApp(ctx);
|
|
249929
|
+
const target = await resolvePublishTarget(app.projectRoot);
|
|
249574
249930
|
await runSiteBuild(ctx, {
|
|
249575
|
-
root:
|
|
249576
|
-
buildCommand:
|
|
249931
|
+
root: target.root,
|
|
249932
|
+
buildCommand: target.buildCommand,
|
|
249577
249933
|
appId: app.id
|
|
249578
249934
|
});
|
|
249579
249935
|
return {
|
|
@@ -249581,15 +249937,15 @@ async function buildAction(ctx) {
|
|
|
249581
249937
|
};
|
|
249582
249938
|
}
|
|
249583
249939
|
function getBuildCommand() {
|
|
249584
|
-
return new Base44Command("build").description("Build the site with the Base44 app id injected").action(buildAction);
|
|
249940
|
+
return new Base44Command("build", { requireAuth: false }).description("Build the site with the Base44 app id injected").action(buildAction);
|
|
249585
249941
|
}
|
|
249586
249942
|
|
|
249587
249943
|
// src/cli/commands/project/create.ts
|
|
249588
|
-
import { basename as basename6, resolve as
|
|
249944
|
+
import { basename as basename6, resolve as resolve12 } from "node:path";
|
|
249589
249945
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
249590
249946
|
|
|
249591
249947
|
// src/cli/commands/project/scaffold-shared.ts
|
|
249592
|
-
import { join as
|
|
249948
|
+
import { join as join29 } from "node:path";
|
|
249593
249949
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
249594
249950
|
async function getTemplateById(templateId) {
|
|
249595
249951
|
const templates = await listTemplates();
|
|
@@ -249652,7 +250008,7 @@ async function completeProjectSetup({
|
|
|
249652
250008
|
env: { VITE_BASE44_APP_ID: projectId }
|
|
249653
250009
|
})`${buildCommand}`;
|
|
249654
250010
|
updateMessage("Deploying site...");
|
|
249655
|
-
return await deploySite(
|
|
250011
|
+
return await deploySite(join29(resolvedPath, outputDirectory));
|
|
249656
250012
|
}, {
|
|
249657
250013
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
249658
250014
|
errorMessage: "Failed to deploy site"
|
|
@@ -249781,7 +250137,7 @@ async function createInteractive(options, ctx) {
|
|
|
249781
250137
|
}, ctx);
|
|
249782
250138
|
}
|
|
249783
250139
|
async function createNonInteractive(options, ctx) {
|
|
249784
|
-
ctx.log.info(`Creating a new project at ${
|
|
250140
|
+
ctx.log.info(`Creating a new project at ${resolve12(options.path)}`);
|
|
249785
250141
|
const template = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
249786
250142
|
return await executeCreate({
|
|
249787
250143
|
template,
|
|
@@ -249805,7 +250161,7 @@ async function executeCreate({
|
|
|
249805
250161
|
}, ctx) {
|
|
249806
250162
|
const { log, runTask } = ctx;
|
|
249807
250163
|
const name = rawName.trim();
|
|
249808
|
-
const resolvedPath =
|
|
250164
|
+
const resolvedPath = resolve12(projectPath);
|
|
249809
250165
|
const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
|
|
249810
250166
|
const { projectId } = await runTask("Setting up your project...", async () => {
|
|
249811
250167
|
return await createProjectFiles({
|
|
@@ -250446,7 +250802,7 @@ function getLogsCommand() {
|
|
|
250446
250802
|
}
|
|
250447
250803
|
|
|
250448
250804
|
// src/cli/commands/project/scaffold.ts
|
|
250449
|
-
import { basename as basename7, resolve as
|
|
250805
|
+
import { basename as basename7, resolve as resolve13 } from "node:path";
|
|
250450
250806
|
function resolveAppId(options) {
|
|
250451
250807
|
const appId = options.appId;
|
|
250452
250808
|
if (!appId) {
|
|
@@ -250462,7 +250818,7 @@ function resolveAppId(options) {
|
|
|
250462
250818
|
async function scaffoldAction(ctx, name, options, command) {
|
|
250463
250819
|
const { log, runTask } = ctx;
|
|
250464
250820
|
const appId = resolveAppId(command.optsWithGlobals());
|
|
250465
|
-
const resolvedPath =
|
|
250821
|
+
const resolvedPath = resolve13("./");
|
|
250466
250822
|
const projectName = (name ?? basename7(resolvedPath)).trim();
|
|
250467
250823
|
const template = await getTemplateById("backend-only");
|
|
250468
250824
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
@@ -250510,6 +250866,69 @@ function getVisibilityCommand() {
|
|
|
250510
250866
|
])).action(setVisibility);
|
|
250511
250867
|
}
|
|
250512
250868
|
|
|
250869
|
+
// src/cli/commands/versions/options.ts
|
|
250870
|
+
function outputDirOption() {
|
|
250871
|
+
return new Option2("--output-dir <dir>", "Build output directory (defaults to the project's, else dist)");
|
|
250872
|
+
}
|
|
250873
|
+
function targetOption() {
|
|
250874
|
+
return new Option2("--target <name>", "Environment to serve the version at");
|
|
250875
|
+
}
|
|
250876
|
+
function gitHashOption() {
|
|
250877
|
+
return new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser((value) => {
|
|
250878
|
+
if (!isGitCommitHash(value)) {
|
|
250879
|
+
throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
|
|
250880
|
+
}
|
|
250881
|
+
return value;
|
|
250882
|
+
});
|
|
250883
|
+
}
|
|
250884
|
+
function concurrencyOption() {
|
|
250885
|
+
return new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser((value) => {
|
|
250886
|
+
const parsed = Number(value);
|
|
250887
|
+
if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_VERSION_UPLOAD_CONCURRENCY) {
|
|
250888
|
+
throw new InvalidArgumentError2(`Expected a whole number between 1 and ${MAX_VERSION_UPLOAD_CONCURRENCY}.`);
|
|
250889
|
+
}
|
|
250890
|
+
return parsed;
|
|
250891
|
+
});
|
|
250892
|
+
}
|
|
250893
|
+
|
|
250894
|
+
// src/cli/commands/publish.ts
|
|
250895
|
+
async function publishAction(ctx, options) {
|
|
250896
|
+
const { runTask, log, jsonMode } = ctx;
|
|
250897
|
+
const app = requireApp(ctx);
|
|
250898
|
+
const target = await tagStep("create_version", () => resolvePublishTarget(app.projectRoot, { outputDir: options.outputDir }));
|
|
250899
|
+
if (options.build !== false) {
|
|
250900
|
+
await tagStep("build", () => runSiteBuild(ctx, {
|
|
250901
|
+
root: target.root,
|
|
250902
|
+
buildCommand: target.buildCommand,
|
|
250903
|
+
appId: app.id
|
|
250904
|
+
}));
|
|
250905
|
+
}
|
|
250906
|
+
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
250907
|
+
const result = await runTask("Publishing...", async (updateMessage) => {
|
|
250908
|
+
const artifacts = await tagStep("create_version", () => collectArtifacts(target));
|
|
250909
|
+
return await publishVersion(artifacts, {
|
|
250910
|
+
sourceCommit: gitHash,
|
|
250911
|
+
target: options.target,
|
|
250912
|
+
concurrency: options.concurrency,
|
|
250913
|
+
progress: {
|
|
250914
|
+
onDeclared: ({ fileCount }) => updateMessage(`Uploading ${fileCount} files`),
|
|
250915
|
+
onUpload: ({ uploadedFiles, totalFiles }) => updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} files`)
|
|
250916
|
+
}
|
|
250917
|
+
});
|
|
250918
|
+
}, { successMessage: "Published", errorMessage: "Publish failed" });
|
|
250919
|
+
if (!jsonMode) {
|
|
250920
|
+
log.message(theme.styles.dim(`version ${result.versionId}`));
|
|
250921
|
+
}
|
|
250922
|
+
return {
|
|
250923
|
+
outroMessage: `${result.environment} now serves ${result.versionId}`,
|
|
250924
|
+
stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
|
|
250925
|
+
` : undefined
|
|
250926
|
+
};
|
|
250927
|
+
}
|
|
250928
|
+
function getPublishCommand() {
|
|
250929
|
+
return new Base44Command("publish").description("Build the app, record it as a version, and serve that version").option("--no-build", "Publish the existing build output without rebuilding").addOption(outputDirOption()).addOption(targetOption()).addOption(gitHashOption()).addOption(concurrencyOption()).action(publishAction);
|
|
250930
|
+
}
|
|
250931
|
+
|
|
250513
250932
|
// src/core/resources/sandbox/schema.ts
|
|
250514
250933
|
var FileErrorSchema = object({
|
|
250515
250934
|
code: string2(),
|
|
@@ -250895,7 +251314,7 @@ function getSecretsListCommand() {
|
|
|
250895
251314
|
}
|
|
250896
251315
|
|
|
250897
251316
|
// src/cli/commands/secrets/set.ts
|
|
250898
|
-
import { resolve as
|
|
251317
|
+
import { resolve as resolve14 } from "node:path";
|
|
250899
251318
|
function parseEntries(entries) {
|
|
250900
251319
|
const secrets = {};
|
|
250901
251320
|
for (const entry of entries) {
|
|
@@ -250926,7 +251345,7 @@ async function setSecretsAction({ log, runTask }, entries, options) {
|
|
|
250926
251345
|
validateInput(entries, options);
|
|
250927
251346
|
let secrets;
|
|
250928
251347
|
if (options.envFile) {
|
|
250929
|
-
secrets = await parseEnvFile(
|
|
251348
|
+
secrets = await parseEnvFile(resolve14(options.envFile));
|
|
250930
251349
|
if (Object.keys(secrets).length === 0) {
|
|
250931
251350
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
250932
251351
|
}
|
|
@@ -250955,7 +251374,7 @@ function getSecretsCommand() {
|
|
|
250955
251374
|
}
|
|
250956
251375
|
|
|
250957
251376
|
// src/cli/commands/site/deploy.ts
|
|
250958
|
-
import { resolve as
|
|
251377
|
+
import { resolve as resolve15 } from "node:path";
|
|
250959
251378
|
async function deployAction2(ctx, options) {
|
|
250960
251379
|
const { isNonInteractive } = ctx;
|
|
250961
251380
|
if (isNonInteractive && !options.yes) {
|
|
@@ -251033,7 +251452,7 @@ async function deployTarball({ runTask }, project) {
|
|
|
251033
251452
|
}
|
|
251034
251453
|
function siteOutputDir(project) {
|
|
251035
251454
|
const outputDirectory = project.site?.outputDirectory;
|
|
251036
|
-
return outputDirectory ?
|
|
251455
|
+
return outputDirectory ? resolve15(project.root, outputDirectory) : null;
|
|
251037
251456
|
}
|
|
251038
251457
|
function getSiteDeployCommand() {
|
|
251039
251458
|
const command = new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)");
|
|
@@ -251165,10 +251584,10 @@ function toPascalCase(name) {
|
|
|
251165
251584
|
return name.split(/[-_\s]+/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
|
|
251166
251585
|
}
|
|
251167
251586
|
// src/core/types/update-project.ts
|
|
251168
|
-
import { join as
|
|
251587
|
+
import { join as join33 } from "node:path";
|
|
251169
251588
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
251170
251589
|
async function updateProjectConfig(projectRoot) {
|
|
251171
|
-
const tsconfigPath =
|
|
251590
|
+
const tsconfigPath = join33(projectRoot, "tsconfig.json");
|
|
251172
251591
|
if (!await pathExists(tsconfigPath)) {
|
|
251173
251592
|
return false;
|
|
251174
251593
|
}
|
|
@@ -251217,6 +251636,59 @@ function getTypesCommand() {
|
|
|
251217
251636
|
return new Command2("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
|
|
251218
251637
|
}
|
|
251219
251638
|
|
|
251639
|
+
// src/cli/commands/versions/create.ts
|
|
251640
|
+
async function createAction2(ctx, options) {
|
|
251641
|
+
const { runTask, jsonMode } = ctx;
|
|
251642
|
+
const target = await resolvePublishTarget(requireApp(ctx).projectRoot, {
|
|
251643
|
+
outputDir: options.outputDir
|
|
251644
|
+
});
|
|
251645
|
+
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
251646
|
+
const version = await runTask("Creating version...", async (updateMessage) => await createVersion(await collectArtifacts(target), {
|
|
251647
|
+
sourceCommit: gitHash,
|
|
251648
|
+
concurrency: options.concurrency,
|
|
251649
|
+
progress: {
|
|
251650
|
+
onDeclared: ({ fileCount }) => updateMessage(`Uploading ${fileCount} files`),
|
|
251651
|
+
onUpload: ({ uploadedFiles, totalFiles }) => updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} files`)
|
|
251652
|
+
}
|
|
251653
|
+
}), {
|
|
251654
|
+
successMessage: "Version created",
|
|
251655
|
+
errorMessage: "Create version failed"
|
|
251656
|
+
});
|
|
251657
|
+
return {
|
|
251658
|
+
outroMessage: `Version ${version.versionId} (${version.manifestHash})`,
|
|
251659
|
+
stdout: jsonMode ? `${JSON.stringify(version, null, 2)}
|
|
251660
|
+
` : undefined
|
|
251661
|
+
};
|
|
251662
|
+
}
|
|
251663
|
+
function getVersionCreateCommand() {
|
|
251664
|
+
return new Base44Command("create").description("Record the built output as a version, without deploying it").addOption(outputDirOption()).addOption(gitHashOption()).addOption(concurrencyOption()).action(createAction2);
|
|
251665
|
+
}
|
|
251666
|
+
|
|
251667
|
+
// src/cli/commands/versions/deploy.ts
|
|
251668
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
251669
|
+
async function deployAction3({ runTask, jsonMode }, versionId, options) {
|
|
251670
|
+
const environment = options.target ?? DEFAULT_ENVIRONMENT;
|
|
251671
|
+
const result = await runTask(`Pointing ${environment} at ${versionId}...`, async () => await setEnvironmentVersion(environment, versionId, {
|
|
251672
|
+
idempotencyKey: randomUUID5()
|
|
251673
|
+
}), {
|
|
251674
|
+
successMessage: "Environment updated",
|
|
251675
|
+
errorMessage: "Could not update the environment"
|
|
251676
|
+
});
|
|
251677
|
+
return {
|
|
251678
|
+
outroMessage: `${result.name} now serves ${result.versionId}`,
|
|
251679
|
+
stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
|
|
251680
|
+
` : undefined
|
|
251681
|
+
};
|
|
251682
|
+
}
|
|
251683
|
+
function getVersionDeployCommand() {
|
|
251684
|
+
return new Base44Command("deploy").description("Point an environment at an already-recorded version (also the rollback)").argument("<version-id>", "The version to serve").addOption(targetOption()).action(deployAction3);
|
|
251685
|
+
}
|
|
251686
|
+
|
|
251687
|
+
// src/cli/commands/versions/index.ts
|
|
251688
|
+
function getVersionsCommand() {
|
|
251689
|
+
return new Command2("versions").description("Record app versions and serve them").addCommand(getVersionCreateCommand()).addCommand(getVersionDeployCommand());
|
|
251690
|
+
}
|
|
251691
|
+
|
|
251220
251692
|
// src/core/resources/workflow/schema.ts
|
|
251221
251693
|
var WorkflowRunStatusSchema = _enum([
|
|
251222
251694
|
"running",
|
|
@@ -251633,7 +252105,7 @@ function createDevLogger(label, labelColor = theme.styles.dim) {
|
|
|
251633
252105
|
// src/cli/dev/dev-server/main.ts
|
|
251634
252106
|
var import_cors = __toESM(require_lib4(), 1);
|
|
251635
252107
|
var import_express6 = __toESM(require_express(), 1);
|
|
251636
|
-
import { dirname as
|
|
252108
|
+
import { dirname as dirname27, join as join38 } from "node:path";
|
|
251637
252109
|
|
|
251638
252110
|
// ../../node_modules/get-port/index.js
|
|
251639
252111
|
import net from "node:net";
|
|
@@ -251763,7 +252235,7 @@ var $tmpName = promisify11(tmp.tmpName);
|
|
|
251763
252235
|
|
|
251764
252236
|
// src/cli/dev/dev-server/function-manager.ts
|
|
251765
252237
|
import { spawn as spawn2 } from "node:child_process";
|
|
251766
|
-
import { dirname as
|
|
252238
|
+
import { dirname as dirname24, join as join34 } from "node:path";
|
|
251767
252239
|
import { pathToFileURL } from "node:url";
|
|
251768
252240
|
|
|
251769
252241
|
// src/cli/dev/dev-server/base-function-manager.ts
|
|
@@ -251868,7 +252340,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
251868
252340
|
}
|
|
251869
252341
|
spawnFunction(func, port) {
|
|
251870
252342
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
251871
|
-
const importMapPath =
|
|
252343
|
+
const importMapPath = join34(dirname24(this.wrapperPath), "import-map.json");
|
|
251872
252344
|
const process2 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
|
|
251873
252345
|
env: {
|
|
251874
252346
|
...globalThis.process.env,
|
|
@@ -251942,7 +252414,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
251942
252414
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
251943
252415
|
import { isBuiltin } from "node:module";
|
|
251944
252416
|
import { homedir as homedir3 } from "node:os";
|
|
251945
|
-
import { join as
|
|
252417
|
+
import { join as join35 } from "node:path";
|
|
251946
252418
|
import { pathToFileURL as pathToFileURL6 } from "node:url";
|
|
251947
252419
|
var depsPromise;
|
|
251948
252420
|
function loadDeps() {
|
|
@@ -252063,9 +252535,9 @@ export default {
|
|
|
252063
252535
|
};
|
|
252064
252536
|
`;
|
|
252065
252537
|
function ensureBundlerConfig() {
|
|
252066
|
-
const dir =
|
|
252538
|
+
const dir = join35(homedir3(), ".base44", "function-bundler");
|
|
252067
252539
|
mkdirSync2(dir, { recursive: true });
|
|
252068
|
-
const configPath =
|
|
252540
|
+
const configPath = join35(dir, "deno.json");
|
|
252069
252541
|
writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
|
|
252070
252542
|
`);
|
|
252071
252543
|
return configPath;
|
|
@@ -253446,11 +253918,11 @@ async function createEntityRoutes(db, logger, broadcast) {
|
|
|
253446
253918
|
// src/cli/dev/dev-server/routes/integrations.ts
|
|
253447
253919
|
var import_express5 = __toESM(require_express(), 1);
|
|
253448
253920
|
var import_multer = __toESM(require_multer(), 1);
|
|
253449
|
-
import { createHash as
|
|
253921
|
+
import { createHash as createHash3, randomUUID as randomUUID6 } from "node:crypto";
|
|
253450
253922
|
import fs28 from "node:fs";
|
|
253451
253923
|
import path18 from "node:path";
|
|
253452
253924
|
function createFileToken(fileUri) {
|
|
253453
|
-
return
|
|
253925
|
+
return createHash3("sha256").update(fileUri).digest("hex");
|
|
253454
253926
|
}
|
|
253455
253927
|
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
253456
253928
|
const router = import_express5.Router({ mergeParams: true });
|
|
@@ -253463,14 +253935,14 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
253463
253935
|
destination: mediaFilesDir,
|
|
253464
253936
|
filename: (_req, file, cb) => {
|
|
253465
253937
|
const ext = path18.extname(file.originalname);
|
|
253466
|
-
cb(null, `${
|
|
253938
|
+
cb(null, `${randomUUID6()}${ext}`);
|
|
253467
253939
|
}
|
|
253468
253940
|
});
|
|
253469
253941
|
const privateStorage = import_multer.default.diskStorage({
|
|
253470
253942
|
destination: privateFilesDir,
|
|
253471
253943
|
filename: (_req, file, cb) => {
|
|
253472
253944
|
const ext = path18.extname(file.originalname);
|
|
253473
|
-
cb(null, `${
|
|
253945
|
+
cb(null, `${randomUUID6()}${ext}`);
|
|
253474
253946
|
}
|
|
253475
253947
|
});
|
|
253476
253948
|
const upload = import_multer.default({ storage, limits: { fileSize: MAX_FILE_SIZE } });
|
|
@@ -255332,8 +255804,8 @@ async function createDevServer(options) {
|
|
|
255332
255804
|
broadcastEntityEvent(io, appId, entityName, event);
|
|
255333
255805
|
};
|
|
255334
255806
|
const base44ConfigWatcher = new WatchBase44({
|
|
255335
|
-
functions:
|
|
255336
|
-
entities:
|
|
255807
|
+
functions: join38(dirname27(project.configPath), project.functionsDir),
|
|
255808
|
+
entities: join38(dirname27(project.configPath), project.entitiesDir)
|
|
255337
255809
|
}, devLogger);
|
|
255338
255810
|
base44ConfigWatcher.on("change", async (name) => {
|
|
255339
255811
|
try {
|
|
@@ -255730,7 +256202,7 @@ Examples:
|
|
|
255730
256202
|
}
|
|
255731
256203
|
|
|
255732
256204
|
// src/cli/commands/project/eject.ts
|
|
255733
|
-
import { resolve as
|
|
256205
|
+
import { resolve as resolve19 } from "node:path";
|
|
255734
256206
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
255735
256207
|
async function eject(ctx, options, command) {
|
|
255736
256208
|
const { log, runTask, isNonInteractive } = ctx;
|
|
@@ -255794,7 +256266,7 @@ async function eject(ctx, options, command) {
|
|
|
255794
256266
|
Ne("Operation cancelled.");
|
|
255795
256267
|
throw new CLIExitError(0);
|
|
255796
256268
|
}
|
|
255797
|
-
const resolvedPath =
|
|
256269
|
+
const resolvedPath = resolve19(selectedPath);
|
|
255798
256270
|
await runTask("Downloading your project's code...", async (updateMessage) => {
|
|
255799
256271
|
await createProjectFilesForExistingProject({
|
|
255800
256272
|
projectId,
|
|
@@ -255878,6 +256350,10 @@ function createProgram(context) {
|
|
|
255878
256350
|
program.addCommand(getBranchesCommand());
|
|
255879
256351
|
program.addCommand(getAuthCommand());
|
|
255880
256352
|
program.addCommand(getSiteCommand());
|
|
256353
|
+
if (versionsApiEnabled()) {
|
|
256354
|
+
program.addCommand(getPublishCommand());
|
|
256355
|
+
program.addCommand(getVersionsCommand());
|
|
256356
|
+
}
|
|
255881
256357
|
program.addCommand(getTypesCommand());
|
|
255882
256358
|
program.addCommand(getExecCommand());
|
|
255883
256359
|
program.addCommand(getDevCommand());
|
|
@@ -255890,7 +256366,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
255890
256366
|
import { release, type } from "node:os";
|
|
255891
256367
|
|
|
255892
256368
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
255893
|
-
import { dirname as
|
|
256369
|
+
import { dirname as dirname28, posix, sep as sep2 } from "path";
|
|
255894
256370
|
function createModulerModifier() {
|
|
255895
256371
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
255896
256372
|
return async (frames) => {
|
|
@@ -255899,7 +256375,7 @@ function createModulerModifier() {
|
|
|
255899
256375
|
return frames;
|
|
255900
256376
|
};
|
|
255901
256377
|
}
|
|
255902
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
256378
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname28(process.argv[1]) : process.cwd(), isWindows = sep2 === "\\") {
|
|
255903
256379
|
const normalizedBase = isWindows ? normalizeWindowsPath2(basePath) : basePath;
|
|
255904
256380
|
return (filename) => {
|
|
255905
256381
|
if (!filename)
|
|
@@ -259888,9 +260364,9 @@ function addCommandInfoToErrorReporter(program, errorReporter) {
|
|
|
259888
260364
|
});
|
|
259889
260365
|
}
|
|
259890
260366
|
// src/cli/index.ts
|
|
259891
|
-
var __dirname4 =
|
|
260367
|
+
var __dirname4 = dirname29(fileURLToPath6(import.meta.url));
|
|
259892
260368
|
async function runCLI(options) {
|
|
259893
|
-
ensureNpmAssets(
|
|
260369
|
+
ensureNpmAssets(join39(__dirname4, "../assets"));
|
|
259894
260370
|
const errorReporter = new ErrorReporter;
|
|
259895
260371
|
errorReporter.registerProcessErrorHandlers();
|
|
259896
260372
|
const jsonMode = process.argv.includes("--json");
|
|
@@ -259929,4 +260405,4 @@ export {
|
|
|
259929
260405
|
runCLI
|
|
259930
260406
|
};
|
|
259931
260407
|
|
|
259932
|
-
//# debugId=
|
|
260408
|
+
//# debugId=C69AFB00876B9AF264756E2164756E21
|