@base44-preview/cli 0.1.16-pr.626.e28b7e8 → 0.1.16-pr.634.3cc42b9
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 +255 -729
- package/dist/cli/index.js.map +19 -31
- 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" ? join28(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 join28(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: join28,
|
|
31972
31972
|
line,
|
|
31973
31973
|
softline,
|
|
31974
31974
|
hardline,
|
|
@@ -228657,20 +228657,6 @@ function isCLIError(error) {
|
|
|
228657
228657
|
function isUserError(error) {
|
|
228658
228658
|
return error instanceof UserError;
|
|
228659
228659
|
}
|
|
228660
|
-
var STEP = Symbol.for("base44.commandStep");
|
|
228661
|
-
async function tagStep(step, run) {
|
|
228662
|
-
try {
|
|
228663
|
-
return await run();
|
|
228664
|
-
} catch (error) {
|
|
228665
|
-
if (error !== null && typeof error === "object" && !(STEP in error) && Object.isExtensible(error)) {
|
|
228666
|
-
Object.defineProperty(error, STEP, { value: step, enumerable: false });
|
|
228667
|
-
}
|
|
228668
|
-
throw error;
|
|
228669
|
-
}
|
|
228670
|
-
}
|
|
228671
|
-
function stepOf(error) {
|
|
228672
|
-
return error !== null && typeof error === "object" && STEP in error ? error[STEP] : undefined;
|
|
228673
|
-
}
|
|
228674
228660
|
|
|
228675
228661
|
// src/core/utils/fs.ts
|
|
228676
228662
|
async function pathExists(path) {
|
|
@@ -228797,7 +228783,7 @@ function normalizeBase44Env() {
|
|
|
228797
228783
|
loadProjectEnvFiles();
|
|
228798
228784
|
|
|
228799
228785
|
// src/cli/index.ts
|
|
228800
|
-
import { dirname as
|
|
228786
|
+
import { dirname as dirname28, join as join37 } from "node:path";
|
|
228801
228787
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
228802
228788
|
|
|
228803
228789
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
@@ -230719,10 +230705,10 @@ var TemplatesConfigSchema = object({
|
|
|
230719
230705
|
templates: array(TemplateSchema)
|
|
230720
230706
|
});
|
|
230721
230707
|
var SiteConfigSchema = object({
|
|
230722
|
-
buildCommand: string2().optional(),
|
|
230723
|
-
serveCommand: string2().optional(),
|
|
230724
|
-
outputDirectory: string2().optional(),
|
|
230725
|
-
installCommand: string2().optional()
|
|
230708
|
+
buildCommand: string2().optional().default("npm run build"),
|
|
230709
|
+
serveCommand: string2().optional().default("npm run dev"),
|
|
230710
|
+
outputDirectory: string2().optional().default("./dist"),
|
|
230711
|
+
installCommand: string2().optional().default("npm install")
|
|
230726
230712
|
});
|
|
230727
230713
|
var PluginMetadataSchema = object({
|
|
230728
230714
|
namespace: string2().min(1, "Plugin namespace cannot be empty").regex(/^[a-zA-Z0-9_-]+$/, "Plugin namespace can only contain letters, numbers, underscores, and dashes")
|
|
@@ -239604,8 +239590,91 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
239604
239590
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
239605
239591
|
import { join as join18 } from "node:path";
|
|
239606
239592
|
|
|
239607
|
-
// src/core/site/
|
|
239593
|
+
// src/core/site/manifest.ts
|
|
239594
|
+
import { createHash } from "node:crypto";
|
|
239595
|
+
import { createReadStream } from "node:fs";
|
|
239608
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
|
+
// src/core/site/modules.ts
|
|
239677
|
+
import { stat as stat2 } from "node:fs/promises";
|
|
239609
239678
|
import { relative as relative5, resolve as resolve3, sep } from "node:path";
|
|
239610
239679
|
var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
|
|
239611
239680
|
var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
|
|
@@ -239680,7 +239749,7 @@ async function collectModules(config) {
|
|
|
239680
239749
|
const modules = [...modulesByName.values()];
|
|
239681
239750
|
let totalBytes = 0;
|
|
239682
239751
|
for (const module of modules) {
|
|
239683
|
-
module.size = (await
|
|
239752
|
+
module.size = (await stat2(module.absolutePath)).size;
|
|
239684
239753
|
totalBytes += module.size;
|
|
239685
239754
|
}
|
|
239686
239755
|
if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
|
|
@@ -239699,104 +239768,8 @@ function addSourcemap(modulesByName, configDir, name) {
|
|
|
239699
239768
|
});
|
|
239700
239769
|
}
|
|
239701
239770
|
|
|
239702
|
-
// src/core/site/
|
|
239703
|
-
import {
|
|
239704
|
-
var WRANGLER_REDIRECT_PATH = join16(".wrangler", "deploy", "config.json");
|
|
239705
|
-
var RedirectConfigSchema = looseObject({
|
|
239706
|
-
configPath: string2().min(1)
|
|
239707
|
-
});
|
|
239708
|
-
var WranglerConfigSchema = looseObject({
|
|
239709
|
-
main: string2().min(1, "wrangler config is missing a 'main' entry module"),
|
|
239710
|
-
no_bundle: boolean2().optional(),
|
|
239711
|
-
rules: array(looseObject({ type: string2(), globs: array(string2()) })).optional(),
|
|
239712
|
-
assets: looseObject({
|
|
239713
|
-
directory: string2().optional(),
|
|
239714
|
-
html_handling: string2().optional(),
|
|
239715
|
-
not_found_handling: string2().optional(),
|
|
239716
|
-
run_worker_first: union([boolean2(), array(string2())]).optional(),
|
|
239717
|
-
headers: string2().optional(),
|
|
239718
|
-
redirects: string2().optional()
|
|
239719
|
-
}).optional(),
|
|
239720
|
-
compatibility_date: string2().optional(),
|
|
239721
|
-
compatibility_flags: array(string2()).optional(),
|
|
239722
|
-
vars: record(string2(), unknown()).optional(),
|
|
239723
|
-
upload_source_maps: boolean2().optional()
|
|
239724
|
-
});
|
|
239725
|
-
async function detectFullStackArtifact(projectRoot) {
|
|
239726
|
-
const redirectPath = join16(projectRoot, WRANGLER_REDIRECT_PATH);
|
|
239727
|
-
return await pathExists(redirectPath) ? redirectPath : null;
|
|
239728
|
-
}
|
|
239729
|
-
async function resolveWranglerConfig(redirectPath) {
|
|
239730
|
-
const configPath = await resolveRedirectedConfigPath(redirectPath);
|
|
239731
|
-
const parsed = await readJsonFile(configPath);
|
|
239732
|
-
const result = WranglerConfigSchema.safeParse(parsed);
|
|
239733
|
-
if (!result.success) {
|
|
239734
|
-
throw new ConfigInvalidError(`Invalid wrangler config: ${prettifyError(result.error)}`, configPath);
|
|
239735
|
-
}
|
|
239736
|
-
const config = result.data;
|
|
239737
|
-
if (config.no_bundle !== true) {
|
|
239738
|
-
throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
|
|
239739
|
-
}
|
|
239740
|
-
const configDir = dirname12(configPath);
|
|
239741
|
-
const assetsDirectory = config.assets?.directory ? resolve4(configDir, config.assets.directory) : null;
|
|
239742
|
-
return {
|
|
239743
|
-
configPath,
|
|
239744
|
-
configDir,
|
|
239745
|
-
main: config.main,
|
|
239746
|
-
assetsDirectory,
|
|
239747
|
-
assetsConfig: config.assets ? toResolvedAssetsConfig(config.assets) : null,
|
|
239748
|
-
compatibilityDate: config.compatibility_date ?? null,
|
|
239749
|
-
compatibilityFlags: config.compatibility_flags ?? [],
|
|
239750
|
-
rules: (config.rules ?? []).map((rule) => ({
|
|
239751
|
-
type: rule.type,
|
|
239752
|
-
globs: rule.globs
|
|
239753
|
-
})),
|
|
239754
|
-
uploadSourceMaps: config.upload_source_maps ?? false
|
|
239755
|
-
};
|
|
239756
|
-
}
|
|
239757
|
-
async function resolveRedirectedConfigPath(redirectPath) {
|
|
239758
|
-
const parsed = await readJsonFile(redirectPath);
|
|
239759
|
-
const result = RedirectConfigSchema.safeParse(parsed);
|
|
239760
|
-
if (!result.success) {
|
|
239761
|
-
throw new ConfigInvalidError(`Invalid deploy redirect file: ${prettifyError(result.error)}`, redirectPath);
|
|
239762
|
-
}
|
|
239763
|
-
const configPath = resolve4(dirname12(redirectPath), result.data.configPath);
|
|
239764
|
-
if (!await pathExists(configPath)) {
|
|
239765
|
-
throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
|
|
239766
|
-
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
239767
|
-
});
|
|
239768
|
-
}
|
|
239769
|
-
return configPath;
|
|
239770
|
-
}
|
|
239771
|
-
function toResolvedAssetsConfig(assets) {
|
|
239772
|
-
return {
|
|
239773
|
-
htmlHandling: assets.html_handling,
|
|
239774
|
-
notFoundHandling: assets.not_found_handling,
|
|
239775
|
-
runWorkerFirst: assets.run_worker_first,
|
|
239776
|
-
headers: assets.headers,
|
|
239777
|
-
redirects: assets.redirects
|
|
239778
|
-
};
|
|
239779
|
-
}
|
|
239780
|
-
|
|
239781
|
-
// src/core/site/full-stack.ts
|
|
239782
|
-
async function resolveFullStackBuild(projectRoot) {
|
|
239783
|
-
const redirectPath = await detectFullStackArtifact(projectRoot);
|
|
239784
|
-
if (!redirectPath) {
|
|
239785
|
-
return null;
|
|
239786
|
-
}
|
|
239787
|
-
const config = await resolveWranglerConfig(redirectPath);
|
|
239788
|
-
return {
|
|
239789
|
-
config,
|
|
239790
|
-
modules: await collectModules(config),
|
|
239791
|
-
assetsDir: config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null
|
|
239792
|
-
};
|
|
239793
|
-
}
|
|
239794
|
-
|
|
239795
|
-
// src/core/site/manifest.ts
|
|
239796
|
-
import { createHash } from "node:crypto";
|
|
239797
|
-
import { createReadStream } from "node:fs";
|
|
239798
|
-
import { stat as stat2 } from "node:fs/promises";
|
|
239799
|
-
import { basename as basename5, extname, join as join17 } from "node:path";
|
|
239771
|
+
// src/core/site/upload.ts
|
|
239772
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
239800
239773
|
|
|
239801
239774
|
// ../../node_modules/p-map/index.js
|
|
239802
239775
|
async function pMap(iterable, mapper, {
|
|
@@ -239922,99 +239895,7 @@ async function pMap(iterable, mapper, {
|
|
|
239922
239895
|
}
|
|
239923
239896
|
var pMapSkip = Symbol("skip");
|
|
239924
239897
|
|
|
239925
|
-
// src/core/site/manifest.ts
|
|
239926
|
-
var MAX_ASSET_COUNT = 1e5;
|
|
239927
|
-
var ASSETS_IGNORE_FILE = ".assetsignore";
|
|
239928
|
-
var ALWAYS_IGNORED = new Set([
|
|
239929
|
-
ASSETS_IGNORE_FILE,
|
|
239930
|
-
"wrangler.json",
|
|
239931
|
-
".dev.vars"
|
|
239932
|
-
]);
|
|
239933
|
-
var MIME_TYPES = {
|
|
239934
|
-
".html": "text/html",
|
|
239935
|
-
".htm": "text/html",
|
|
239936
|
-
".css": "text/css",
|
|
239937
|
-
".js": "text/javascript",
|
|
239938
|
-
".mjs": "text/javascript",
|
|
239939
|
-
".json": "application/json",
|
|
239940
|
-
".map": "application/json",
|
|
239941
|
-
".txt": "text/plain",
|
|
239942
|
-
".xml": "application/xml",
|
|
239943
|
-
".svg": "image/svg+xml",
|
|
239944
|
-
".png": "image/png",
|
|
239945
|
-
".jpg": "image/jpeg",
|
|
239946
|
-
".jpeg": "image/jpeg",
|
|
239947
|
-
".gif": "image/gif",
|
|
239948
|
-
".webp": "image/webp",
|
|
239949
|
-
".avif": "image/avif",
|
|
239950
|
-
".ico": "image/x-icon",
|
|
239951
|
-
".woff": "font/woff",
|
|
239952
|
-
".woff2": "font/woff2",
|
|
239953
|
-
".ttf": "font/ttf",
|
|
239954
|
-
".otf": "font/otf",
|
|
239955
|
-
".eot": "application/vnd.ms-fontobject",
|
|
239956
|
-
".mp3": "audio/mpeg",
|
|
239957
|
-
".mp4": "video/mp4",
|
|
239958
|
-
".webm": "video/webm",
|
|
239959
|
-
".pdf": "application/pdf",
|
|
239960
|
-
".wasm": "application/wasm",
|
|
239961
|
-
".webmanifest": "application/manifest+json"
|
|
239962
|
-
};
|
|
239963
|
-
function getAssetContentType(filePath) {
|
|
239964
|
-
return MIME_TYPES[extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
239965
|
-
}
|
|
239966
|
-
async function walkBuildOutput(outputDir) {
|
|
239967
|
-
const found = await globby("**/*", {
|
|
239968
|
-
cwd: outputDir,
|
|
239969
|
-
dot: true,
|
|
239970
|
-
onlyFiles: true,
|
|
239971
|
-
followSymbolicLinks: false,
|
|
239972
|
-
ignoreFiles: [ASSETS_IGNORE_FILE]
|
|
239973
|
-
});
|
|
239974
|
-
return found.filter((path) => !ALWAYS_IGNORED.has(basename5(path))).sort();
|
|
239975
|
-
}
|
|
239976
|
-
var STAT_CONCURRENCY = 32;
|
|
239977
|
-
async function describeBuildOutput(outputDir) {
|
|
239978
|
-
const relativePaths = await walkBuildOutput(outputDir);
|
|
239979
|
-
return await pMap(relativePaths, async (path) => {
|
|
239980
|
-
const absolutePath = join17(outputDir, ...path.split("/"));
|
|
239981
|
-
return { path, absolutePath, size: (await stat2(absolutePath)).size };
|
|
239982
|
-
}, { concurrency: STAT_CONCURRENCY });
|
|
239983
|
-
}
|
|
239984
|
-
async function hashFileInto(hash, absolutePath) {
|
|
239985
|
-
for await (const chunk of createReadStream(absolutePath)) {
|
|
239986
|
-
hash.update(chunk);
|
|
239987
|
-
}
|
|
239988
|
-
return hash;
|
|
239989
|
-
}
|
|
239990
|
-
async function hashAssetFile(appId, absolutePath) {
|
|
239991
|
-
const hash = await hashFileInto(createHash("sha256").update(Buffer.from(appId, "utf8")), absolutePath);
|
|
239992
|
-
return hash.digest("hex").slice(0, 32);
|
|
239993
|
-
}
|
|
239994
|
-
async function buildAssetManifest(assetsDir, appId) {
|
|
239995
|
-
const manifest = {};
|
|
239996
|
-
const filesByHash = new Map;
|
|
239997
|
-
const files = await describeBuildOutput(assetsDir);
|
|
239998
|
-
if (files.length > MAX_ASSET_COUNT) {
|
|
239999
|
-
throw new InvalidInputError(`Too many static assets: found ${files.length}, the limit is ${MAX_ASSET_COUNT} files.`);
|
|
240000
|
-
}
|
|
240001
|
-
for (const { path: relativePath, absolutePath, size } of files) {
|
|
240002
|
-
const hash = await hashAssetFile(appId, absolutePath);
|
|
240003
|
-
manifest[`/${relativePath}`] = { hash, size };
|
|
240004
|
-
if (!filesByHash.has(hash)) {
|
|
240005
|
-
filesByHash.set(hash, {
|
|
240006
|
-
absolutePath,
|
|
240007
|
-
hash,
|
|
240008
|
-
size,
|
|
240009
|
-
contentType: getAssetContentType(absolutePath)
|
|
240010
|
-
});
|
|
240011
|
-
}
|
|
240012
|
-
}
|
|
240013
|
-
return { manifest, filesByHash };
|
|
240014
|
-
}
|
|
240015
|
-
|
|
240016
239898
|
// src/core/site/upload.ts
|
|
240017
|
-
import { readFile as readFile2 } from "node:fs/promises";
|
|
240018
239899
|
var DEFAULT_UPLOAD_CONCURRENCY = 3;
|
|
240019
239900
|
var MAX_UPLOAD_CONCURRENCY = 50;
|
|
240020
239901
|
var MAX_UPLOAD_ATTEMPTS = 3;
|
|
@@ -240113,17 +239994,11 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
240113
239994
|
if (!file) {
|
|
240114
239995
|
throw new InternalError(`Server requested upload of unknown asset path: ${upload.path}`);
|
|
240115
239996
|
}
|
|
240116
|
-
await
|
|
240117
|
-
}
|
|
240118
|
-
async function putPresigned(upload, absolutePath) {
|
|
240119
|
-
const content = await readFile2(absolutePath);
|
|
239997
|
+
const content = await readFile2(file.absolutePath);
|
|
240120
239998
|
try {
|
|
240121
239999
|
await distribution_default.put(upload.url, {
|
|
240122
240000
|
body: new Uint8Array(content),
|
|
240123
|
-
headers: {
|
|
240124
|
-
"Content-Type": upload.contentType,
|
|
240125
|
-
...upload.checksumSha256 ? { "x-amz-checksum-sha256": upload.checksumSha256 } : {}
|
|
240126
|
-
},
|
|
240001
|
+
headers: { "Content-Type": upload.contentType },
|
|
240127
240002
|
timeout: 120000,
|
|
240128
240003
|
retry: UPLOAD_RETRY
|
|
240129
240004
|
});
|
|
@@ -240132,6 +240007,85 @@ async function putPresigned(upload, absolutePath) {
|
|
|
240132
240007
|
}
|
|
240133
240008
|
}
|
|
240134
240009
|
|
|
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
|
+
|
|
240135
240089
|
// src/core/site/deployment.ts
|
|
240136
240090
|
var NO_ASSETS = { manifest: {}, filesByHash: new Map };
|
|
240137
240091
|
var DEPLOYMENTS_API_ENV = "BASE44_DEPLOYMENTS_API";
|
|
@@ -240158,11 +240112,12 @@ async function deployToDeployments(options) {
|
|
|
240158
240112
|
return { deploymentId: finalized.deploymentId, gitHash };
|
|
240159
240113
|
}
|
|
240160
240114
|
async function resolveWorkerBuild(projectRoot, progress) {
|
|
240161
|
-
const
|
|
240162
|
-
if (!
|
|
240115
|
+
const redirectPath = await detectFullStackArtifact(projectRoot);
|
|
240116
|
+
if (!redirectPath) {
|
|
240163
240117
|
return null;
|
|
240164
240118
|
}
|
|
240165
|
-
const
|
|
240119
|
+
const config = await resolveWranglerConfig(redirectPath);
|
|
240120
|
+
const assetsDir = config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null;
|
|
240166
240121
|
return {
|
|
240167
240122
|
config: {
|
|
240168
240123
|
main: config.main,
|
|
@@ -240170,7 +240125,7 @@ async function resolveWorkerBuild(projectRoot, progress) {
|
|
|
240170
240125
|
compatibility_flags: config.compatibilityFlags,
|
|
240171
240126
|
assets: buildAssetsConfig(config.assetsConfig, progress)
|
|
240172
240127
|
},
|
|
240173
|
-
modules,
|
|
240128
|
+
modules: await collectModules(config),
|
|
240174
240129
|
assetsDir
|
|
240175
240130
|
};
|
|
240176
240131
|
}
|
|
@@ -246714,13 +246669,6 @@ async function resolveGitHash(projectRoot, explicit) {
|
|
|
246714
246669
|
}
|
|
246715
246670
|
return hash;
|
|
246716
246671
|
}
|
|
246717
|
-
async function resolveProvenanceCommit(projectRoot, explicit) {
|
|
246718
|
-
if (explicit) {
|
|
246719
|
-
return await resolveGitHash(projectRoot, explicit);
|
|
246720
|
-
}
|
|
246721
|
-
const hash = await gitHead(projectRoot);
|
|
246722
|
-
return hash && isGitCommitHash(hash) ? hash : undefined;
|
|
246723
|
-
}
|
|
246724
246672
|
async function gitHead(projectRoot) {
|
|
246725
246673
|
try {
|
|
246726
246674
|
const { stdout } = await execa("git", ["rev-parse", "HEAD"], {
|
|
@@ -246743,7 +246691,7 @@ function hasResourcesToDeploy(projectData) {
|
|
|
246743
246691
|
connectors,
|
|
246744
246692
|
authConfig
|
|
246745
246693
|
} = projectData;
|
|
246746
|
-
const hasSite =
|
|
246694
|
+
const hasSite = project.site !== undefined;
|
|
246747
246695
|
const hasEntities = entities.length > 0;
|
|
246748
246696
|
const hasFunctions = functions.length > 0;
|
|
246749
246697
|
const hasActors = actors.length > 0;
|
|
@@ -246809,49 +246757,6 @@ async function deployAll(projectData, options) {
|
|
|
246809
246757
|
}
|
|
246810
246758
|
return { connectorResults };
|
|
246811
246759
|
}
|
|
246812
|
-
// src/core/project/target.ts
|
|
246813
|
-
import { dirname as dirname13, join as join19, resolve as resolve6 } from "node:path";
|
|
246814
|
-
var DEFAULT_BUILD_COMMAND = "npm run build";
|
|
246815
|
-
var DEFAULT_OUTPUT_DIRECTORY = "dist";
|
|
246816
|
-
async function resolveBuildTarget(projectRoot, overrides = {}) {
|
|
246817
|
-
const project = await readSettingsIfPresent(projectRoot);
|
|
246818
|
-
const root = project?.root ?? projectRoot ?? process.cwd();
|
|
246819
|
-
return {
|
|
246820
|
-
root,
|
|
246821
|
-
configDir: project ? dirname13(project.configPath) : join19(root, PROJECT_SUBDIR),
|
|
246822
|
-
buildCommand: project ? project.site?.buildCommand : DEFAULT_BUILD_COMMAND,
|
|
246823
|
-
outputDir: outputDirectory(project, root, overrides.outputDir),
|
|
246824
|
-
entitiesDir: project?.entitiesDir ?? "entities",
|
|
246825
|
-
agentsDir: project?.agentsDir ?? "agents"
|
|
246826
|
-
};
|
|
246827
|
-
}
|
|
246828
|
-
function outputDirectory(project, root, override) {
|
|
246829
|
-
const configured = override ?? (project ? project.site?.outputDirectory : DEFAULT_OUTPUT_DIRECTORY);
|
|
246830
|
-
return configured ? resolve6(root, configured) : null;
|
|
246831
|
-
}
|
|
246832
|
-
function requireOutputDir(target) {
|
|
246833
|
-
if (target.outputDir === null) {
|
|
246834
|
-
throw new ConfigNotFoundError("No site configuration found.", {
|
|
246835
|
-
hints: [
|
|
246836
|
-
{
|
|
246837
|
-
message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
|
|
246838
|
-
},
|
|
246839
|
-
{ message: `Or pass --output-dir <dir>, relative to ${target.root}` }
|
|
246840
|
-
]
|
|
246841
|
-
});
|
|
246842
|
-
}
|
|
246843
|
-
return target.outputDir;
|
|
246844
|
-
}
|
|
246845
|
-
async function readSettingsIfPresent(projectRoot) {
|
|
246846
|
-
try {
|
|
246847
|
-
return await readProjectSettings(projectRoot);
|
|
246848
|
-
} catch (error) {
|
|
246849
|
-
if (error instanceof ConfigNotFoundError) {
|
|
246850
|
-
return null;
|
|
246851
|
-
}
|
|
246852
|
-
throw error;
|
|
246853
|
-
}
|
|
246854
|
-
}
|
|
246855
246760
|
// src/core/clients/base44-client.ts
|
|
246856
246761
|
var retriedRequests = new WeakSet;
|
|
246857
246762
|
async function captureRequestBody(request, options) {
|
|
@@ -247133,12 +247038,6 @@ async function ensureAppContext(ctx, options = {}) {
|
|
|
247133
247038
|
ctx.app = appContext;
|
|
247134
247039
|
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
247135
247040
|
}
|
|
247136
|
-
function requireApp(ctx) {
|
|
247137
|
-
if (!ctx.app) {
|
|
247138
|
-
throw new InternalError("This command read an app context it never resolved — it is declared with requireAppContext: false.");
|
|
247139
|
-
}
|
|
247140
|
-
return ctx.app;
|
|
247141
|
-
}
|
|
247142
247041
|
|
|
247143
247042
|
// src/cli/utils/version-check.ts
|
|
247144
247043
|
async function checkForUpgrade() {
|
|
@@ -247322,10 +247221,6 @@ function writeJsonError(error) {
|
|
|
247322
247221
|
const envelope = {
|
|
247323
247222
|
error: error instanceof Error ? error.message : String(error)
|
|
247324
247223
|
};
|
|
247325
|
-
const step = stepOf(error);
|
|
247326
|
-
if (step !== undefined) {
|
|
247327
|
-
envelope.step = step;
|
|
247328
|
-
}
|
|
247329
247224
|
if (isCLIError(error)) {
|
|
247330
247225
|
envelope.code = error.code;
|
|
247331
247226
|
if (error.details.length > 0) {
|
|
@@ -247695,7 +247590,7 @@ function getActorsCommand() {
|
|
|
247695
247590
|
}
|
|
247696
247591
|
|
|
247697
247592
|
// src/cli/commands/agent-skills/pull.ts
|
|
247698
|
-
import { dirname as
|
|
247593
|
+
import { dirname as dirname13, join as join19 } from "node:path";
|
|
247699
247594
|
// src/core/utils/dependencies.ts
|
|
247700
247595
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
247701
247596
|
function verifyDenoInstalled(context) {
|
|
@@ -247784,7 +247679,7 @@ async function pullAction({
|
|
|
247784
247679
|
runTask
|
|
247785
247680
|
}) {
|
|
247786
247681
|
const { project } = await readProjectConfig();
|
|
247787
|
-
const dir =
|
|
247682
|
+
const dir = join19(dirname13(project.configPath), project.agentSkillsDir);
|
|
247788
247683
|
const remote = await runTask("Fetching agent skills from Base44", () => fetchAgentSkills(), {
|
|
247789
247684
|
successMessage: "Agent skills fetched successfully",
|
|
247790
247685
|
errorMessage: "Failed to fetch agent skills"
|
|
@@ -247840,14 +247735,14 @@ function getAgentSkillsCommand() {
|
|
|
247840
247735
|
}
|
|
247841
247736
|
|
|
247842
247737
|
// src/cli/commands/agents/pull.ts
|
|
247843
|
-
import { dirname as
|
|
247738
|
+
import { dirname as dirname14, join as join20 } from "node:path";
|
|
247844
247739
|
async function pullAgentsAction({
|
|
247845
247740
|
log,
|
|
247846
247741
|
runTask
|
|
247847
247742
|
}) {
|
|
247848
247743
|
const { project } = await readProjectConfig();
|
|
247849
|
-
const configDir =
|
|
247850
|
-
const agentsDir =
|
|
247744
|
+
const configDir = dirname14(project.configPath);
|
|
247745
|
+
const agentsDir = join20(configDir, project.agentsDir);
|
|
247851
247746
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
247852
247747
|
return await fetchAgents();
|
|
247853
247748
|
}, {
|
|
@@ -247917,12 +247812,12 @@ function getAgentsCommand() {
|
|
|
247917
247812
|
}
|
|
247918
247813
|
|
|
247919
247814
|
// src/cli/commands/auth/password-login.ts
|
|
247920
|
-
import { dirname as
|
|
247815
|
+
import { dirname as dirname15, join as join21 } from "node:path";
|
|
247921
247816
|
async function passwordLoginAction({ log, runTask }, action) {
|
|
247922
247817
|
const shouldEnable = action === "enable";
|
|
247923
247818
|
const { project } = await readProjectConfig();
|
|
247924
|
-
const configDir =
|
|
247925
|
-
const authDir =
|
|
247819
|
+
const configDir = dirname15(project.configPath);
|
|
247820
|
+
const authDir = join21(configDir, project.authDir);
|
|
247926
247821
|
const updated = await runTask("Updating local auth config", async () => {
|
|
247927
247822
|
const current = await readAuthConfig(authDir) ?? DEFAULT_AUTH_CONFIG;
|
|
247928
247823
|
const merged = { ...current, enableUsernamePassword: shouldEnable };
|
|
@@ -247942,14 +247837,14 @@ function getPasswordLoginCommand() {
|
|
|
247942
247837
|
}
|
|
247943
247838
|
|
|
247944
247839
|
// src/cli/commands/auth/pull.ts
|
|
247945
|
-
import { dirname as
|
|
247840
|
+
import { dirname as dirname16, join as join22 } from "node:path";
|
|
247946
247841
|
async function pullAuthAction({
|
|
247947
247842
|
log,
|
|
247948
247843
|
runTask
|
|
247949
247844
|
}) {
|
|
247950
247845
|
const { project } = await readProjectConfig();
|
|
247951
|
-
const configDir =
|
|
247952
|
-
const authDir =
|
|
247846
|
+
const configDir = dirname16(project.configPath);
|
|
247847
|
+
const authDir = join22(configDir, project.authDir);
|
|
247953
247848
|
const remoteConfig = await runTask("Fetching auth config from Base44", async () => {
|
|
247954
247849
|
return await pullAuthConfig();
|
|
247955
247850
|
}, {
|
|
@@ -248013,7 +247908,7 @@ function getAuthPushCommand() {
|
|
|
248013
247908
|
}
|
|
248014
247909
|
|
|
248015
247910
|
// src/cli/commands/auth/social-login.ts
|
|
248016
|
-
import { dirname as
|
|
247911
|
+
import { dirname as dirname17, join as join23, resolve as resolve6 } from "node:path";
|
|
248017
247912
|
var PROVIDER_LABELS = {
|
|
248018
247913
|
google: "Google",
|
|
248019
247914
|
microsoft: "Microsoft",
|
|
@@ -248053,7 +247948,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask }, provider, a
|
|
|
248053
247948
|
let clientSecret;
|
|
248054
247949
|
if (useCustomOAuth && oauth && oauthCli && hasSecretOptions(options)) {
|
|
248055
247950
|
if (options.envFile) {
|
|
248056
|
-
const secrets = await parseEnvFile(
|
|
247951
|
+
const secrets = await parseEnvFile(resolve6(options.envFile));
|
|
248057
247952
|
const value = secrets[oauthCli.envVar];
|
|
248058
247953
|
if (!value) {
|
|
248059
247954
|
throw new InvalidInputError(`Key "${oauthCli.envVar}" not found in ${options.envFile}.`);
|
|
@@ -248083,8 +247978,8 @@ async function socialLoginAction({ log, isNonInteractive, runTask }, provider, a
|
|
|
248083
247978
|
}
|
|
248084
247979
|
}
|
|
248085
247980
|
const { project } = await readProjectConfig();
|
|
248086
|
-
const configDir =
|
|
248087
|
-
const authDir =
|
|
247981
|
+
const configDir = dirname17(project.configPath);
|
|
247982
|
+
const authDir = join23(configDir, project.authDir);
|
|
248088
247983
|
const { config: updated } = await runTask("Updating local auth config", async () => updateSocialLoginConfig(authDir, provider, shouldEnable, useCustomOAuth && options.clientId ? { clientId: options.clientId } : undefined));
|
|
248089
247984
|
if (clientSecret) {
|
|
248090
247985
|
await runTask("Saving client secret", async () => pushCustomOAuthSecret(provider, clientSecret));
|
|
@@ -248109,7 +248004,7 @@ function getSocialLoginCommand() {
|
|
|
248109
248004
|
}
|
|
248110
248005
|
|
|
248111
248006
|
// src/cli/commands/auth/sso.ts
|
|
248112
|
-
import { dirname as
|
|
248007
|
+
import { dirname as dirname18, join as join24, resolve as resolve7 } from "node:path";
|
|
248113
248008
|
var SSOConfigFileSchema = object({
|
|
248114
248009
|
provider: _enum(Object.values(KNOWN_SSO_PROVIDERS)),
|
|
248115
248010
|
clientId: string2(),
|
|
@@ -248125,7 +248020,7 @@ var SSOConfigFileSchema = object({
|
|
|
248125
248020
|
ssoName: string2().optional()
|
|
248126
248021
|
});
|
|
248127
248022
|
async function loadSSOConfigFile(filePath) {
|
|
248128
|
-
const resolved =
|
|
248023
|
+
const resolved = resolve7(filePath);
|
|
248129
248024
|
const raw = await readJsonFile(resolved);
|
|
248130
248025
|
const result = SSOConfigFileSchema.safeParse(raw);
|
|
248131
248026
|
if (!result.success) {
|
|
@@ -248213,7 +248108,7 @@ async function ssoEnableAction({ isNonInteractive, runTask }, options) {
|
|
|
248213
248108
|
}
|
|
248214
248109
|
let clientSecret;
|
|
248215
248110
|
if (merged.envFile && !merged.clientSecret) {
|
|
248216
|
-
const secrets = await parseEnvFile(
|
|
248111
|
+
const secrets = await parseEnvFile(resolve7(merged.envFile));
|
|
248217
248112
|
const value = secrets.sso_client_secret;
|
|
248218
248113
|
if (!value) {
|
|
248219
248114
|
throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
|
|
@@ -248272,8 +248167,8 @@ async function ssoEnableAction({ isNonInteractive, runTask }, options) {
|
|
|
248272
248167
|
throw error;
|
|
248273
248168
|
}
|
|
248274
248169
|
const { project } = await readProjectConfig();
|
|
248275
|
-
const configDir =
|
|
248276
|
-
const authDir =
|
|
248170
|
+
const configDir = dirname18(project.configPath);
|
|
248171
|
+
const authDir = join24(configDir, project.authDir);
|
|
248277
248172
|
await runTask("Updating local auth config", async () => updateSSOConfig(authDir, provider, true));
|
|
248278
248173
|
await runTask("Saving SSO credentials", async () => pushSSOSecrets(secrets));
|
|
248279
248174
|
return {
|
|
@@ -248288,8 +248183,8 @@ async function ssoDisableAction({ log, runTask }, options) {
|
|
|
248288
248183
|
throw new InvalidInputError("Configuration options cannot be used with disable. To disable SSO: base44 auth sso disable");
|
|
248289
248184
|
}
|
|
248290
248185
|
const { project } = await readProjectConfig();
|
|
248291
|
-
const configDir =
|
|
248292
|
-
const authDir =
|
|
248186
|
+
const configDir = dirname18(project.configPath);
|
|
248187
|
+
const authDir = join24(configDir, project.authDir);
|
|
248293
248188
|
const updated = await runTask("Updating local auth config", async () => updateSSOConfig(authDir, null, false));
|
|
248294
248189
|
await runTask("Removing SSO credentials", async () => deleteSSOSecrets());
|
|
248295
248190
|
if (!hasAnyLoginMethod(updated)) {
|
|
@@ -249171,13 +249066,13 @@ function getConnectorsListAvailableCommand() {
|
|
|
249171
249066
|
}
|
|
249172
249067
|
|
|
249173
249068
|
// src/cli/commands/connectors/pull.ts
|
|
249174
|
-
import { dirname as
|
|
249069
|
+
import { dirname as dirname19, join as join25, resolve as resolve8 } from "node:path";
|
|
249175
249070
|
async function resolveConnectorsDir(options) {
|
|
249176
249071
|
if (!getAppContext().projectRoot) {
|
|
249177
|
-
return
|
|
249072
|
+
return resolve8(options.dir ?? "connectors");
|
|
249178
249073
|
}
|
|
249179
249074
|
const { project } = await readProjectConfig();
|
|
249180
|
-
return
|
|
249075
|
+
return join25(dirname19(project.configPath), project.connectorsDir);
|
|
249181
249076
|
}
|
|
249182
249077
|
async function pullConnectorsAction({ log, runTask, jsonMode }, options) {
|
|
249183
249078
|
const connectorsDir = await resolveConnectorsDir(options);
|
|
@@ -249218,10 +249113,10 @@ function getConnectorsPullCommand() {
|
|
|
249218
249113
|
}
|
|
249219
249114
|
|
|
249220
249115
|
// src/cli/commands/connectors/push.ts
|
|
249221
|
-
import { resolve as
|
|
249116
|
+
import { resolve as resolve9 } from "node:path";
|
|
249222
249117
|
async function readConnectorsToPush(options) {
|
|
249223
249118
|
if (!getAppContext().projectRoot) {
|
|
249224
|
-
return readAllConnectors(
|
|
249119
|
+
return readAllConnectors(resolve9(options.dir ?? "connectors"));
|
|
249225
249120
|
}
|
|
249226
249121
|
const { connectors } = await readProjectConfig();
|
|
249227
249122
|
return connectors;
|
|
@@ -249564,11 +249459,11 @@ function getListCommand() {
|
|
|
249564
249459
|
}
|
|
249565
249460
|
|
|
249566
249461
|
// src/cli/commands/functions/pull.ts
|
|
249567
|
-
import { dirname as
|
|
249462
|
+
import { dirname as dirname20, join as join26 } from "node:path";
|
|
249568
249463
|
async function pullFunctionsAction({ log, runTask }, name) {
|
|
249569
249464
|
const { project, functions } = await readProjectConfig();
|
|
249570
|
-
const configDir =
|
|
249571
|
-
const functionsDir =
|
|
249465
|
+
const configDir = dirname20(project.configPath);
|
|
249466
|
+
const functionsDir = join26(configDir, project.functionsDir);
|
|
249572
249467
|
const pluginFunctionNames = new Set(functions.filter((fn) => fn.source.type === "plugin").map((fn) => fn.name));
|
|
249573
249468
|
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
249574
249469
|
const { functions } = await listDeployedFunctions();
|
|
@@ -249632,7 +249527,7 @@ async function runSiteBuild({ runTask }, { root, buildCommand, appId }) {
|
|
|
249632
249527
|
throw new ConfigNotFoundError("No site build command found.", {
|
|
249633
249528
|
hints: [
|
|
249634
249529
|
{
|
|
249635
|
-
message: `Add 'site
|
|
249530
|
+
message: `Add a 'site' block to your config.jsonc (e.g., "site": { "buildCommand": "npm run build" }). Inside one, buildCommand defaults to "npm run build".`
|
|
249636
249531
|
}
|
|
249637
249532
|
]
|
|
249638
249533
|
});
|
|
@@ -249671,11 +249566,14 @@ async function maybeAskToBuild(isNonInteractive, buildCommand) {
|
|
|
249671
249566
|
|
|
249672
249567
|
// src/cli/commands/project/build.ts
|
|
249673
249568
|
async function buildAction(ctx) {
|
|
249674
|
-
const app =
|
|
249675
|
-
|
|
249569
|
+
const { app } = ctx;
|
|
249570
|
+
if (!app?.projectRoot) {
|
|
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);
|
|
249676
249574
|
await runSiteBuild(ctx, {
|
|
249677
|
-
root:
|
|
249678
|
-
buildCommand:
|
|
249575
|
+
root: project.root,
|
|
249576
|
+
buildCommand: project.site?.buildCommand,
|
|
249679
249577
|
appId: app.id
|
|
249680
249578
|
});
|
|
249681
249579
|
return {
|
|
@@ -249683,15 +249581,15 @@ async function buildAction(ctx) {
|
|
|
249683
249581
|
};
|
|
249684
249582
|
}
|
|
249685
249583
|
function getBuildCommand() {
|
|
249686
|
-
return new Base44Command("build"
|
|
249584
|
+
return new Base44Command("build").description("Build the site with the Base44 app id injected").action(buildAction);
|
|
249687
249585
|
}
|
|
249688
249586
|
|
|
249689
249587
|
// src/cli/commands/project/create.ts
|
|
249690
|
-
import { basename as basename6, resolve as
|
|
249588
|
+
import { basename as basename6, resolve as resolve10 } from "node:path";
|
|
249691
249589
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
249692
249590
|
|
|
249693
249591
|
// src/cli/commands/project/scaffold-shared.ts
|
|
249694
|
-
import { join as
|
|
249592
|
+
import { join as join27 } from "node:path";
|
|
249695
249593
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
249696
249594
|
async function getTemplateById(templateId) {
|
|
249697
249595
|
const templates = await listTemplates();
|
|
@@ -249754,7 +249652,7 @@ async function completeProjectSetup({
|
|
|
249754
249652
|
env: { VITE_BASE44_APP_ID: projectId }
|
|
249755
249653
|
})`${buildCommand}`;
|
|
249756
249654
|
updateMessage("Deploying site...");
|
|
249757
|
-
return await deploySite(
|
|
249655
|
+
return await deploySite(join27(resolvedPath, outputDirectory));
|
|
249758
249656
|
}, {
|
|
249759
249657
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
249760
249658
|
errorMessage: "Failed to deploy site"
|
|
@@ -249883,7 +249781,7 @@ async function createInteractive(options, ctx) {
|
|
|
249883
249781
|
}, ctx);
|
|
249884
249782
|
}
|
|
249885
249783
|
async function createNonInteractive(options, ctx) {
|
|
249886
|
-
ctx.log.info(`Creating a new project at ${
|
|
249784
|
+
ctx.log.info(`Creating a new project at ${resolve10(options.path)}`);
|
|
249887
249785
|
const template = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
249888
249786
|
return await executeCreate({
|
|
249889
249787
|
template,
|
|
@@ -249907,7 +249805,7 @@ async function executeCreate({
|
|
|
249907
249805
|
}, ctx) {
|
|
249908
249806
|
const { log, runTask } = ctx;
|
|
249909
249807
|
const name = rawName.trim();
|
|
249910
|
-
const resolvedPath =
|
|
249808
|
+
const resolvedPath = resolve10(projectPath);
|
|
249911
249809
|
const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
|
|
249912
249810
|
const { projectId } = await runTask("Setting up your project...", async () => {
|
|
249913
249811
|
return await createProjectFiles({
|
|
@@ -250548,7 +250446,7 @@ function getLogsCommand() {
|
|
|
250548
250446
|
}
|
|
250549
250447
|
|
|
250550
250448
|
// src/cli/commands/project/scaffold.ts
|
|
250551
|
-
import { basename as basename7, resolve as
|
|
250449
|
+
import { basename as basename7, resolve as resolve11 } from "node:path";
|
|
250552
250450
|
function resolveAppId(options) {
|
|
250553
250451
|
const appId = options.appId;
|
|
250554
250452
|
if (!appId) {
|
|
@@ -250564,7 +250462,7 @@ function resolveAppId(options) {
|
|
|
250564
250462
|
async function scaffoldAction(ctx, name, options, command) {
|
|
250565
250463
|
const { log, runTask } = ctx;
|
|
250566
250464
|
const appId = resolveAppId(command.optsWithGlobals());
|
|
250567
|
-
const resolvedPath =
|
|
250465
|
+
const resolvedPath = resolve11("./");
|
|
250568
250466
|
const projectName = (name ?? basename7(resolvedPath)).trim();
|
|
250569
250467
|
const template = await getTemplateById("backend-only");
|
|
250570
250468
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
@@ -250612,321 +250510,6 @@ function getVisibilityCommand() {
|
|
|
250612
250510
|
])).action(setVisibility);
|
|
250613
250511
|
}
|
|
250614
250512
|
|
|
250615
|
-
// src/core/version/schema.ts
|
|
250616
|
-
var DeclareVersionResponseSchema = object({
|
|
250617
|
-
session_id: string2(),
|
|
250618
|
-
uploads: array(object({
|
|
250619
|
-
path: string2(),
|
|
250620
|
-
url: string2(),
|
|
250621
|
-
content_type: string2(),
|
|
250622
|
-
content_length: number2(),
|
|
250623
|
-
checksum_sha256: string2()
|
|
250624
|
-
}))
|
|
250625
|
-
}).transform((data) => ({
|
|
250626
|
-
sessionId: data.session_id,
|
|
250627
|
-
uploads: data.uploads.map((upload) => ({
|
|
250628
|
-
path: upload.path,
|
|
250629
|
-
url: upload.url,
|
|
250630
|
-
contentType: upload.content_type,
|
|
250631
|
-
contentLength: upload.content_length,
|
|
250632
|
-
checksumSha256: upload.checksum_sha256
|
|
250633
|
-
}))
|
|
250634
|
-
}));
|
|
250635
|
-
var CreateVersionResponseSchema = object({
|
|
250636
|
-
version_id: string2(),
|
|
250637
|
-
manifest_hash: string2()
|
|
250638
|
-
}).transform((data) => ({
|
|
250639
|
-
versionId: data.version_id,
|
|
250640
|
-
manifestHash: data.manifest_hash
|
|
250641
|
-
}));
|
|
250642
|
-
var EnvironmentResponseSchema = object({
|
|
250643
|
-
name: string2(),
|
|
250644
|
-
version_id: string2(),
|
|
250645
|
-
manifest_hash: string2(),
|
|
250646
|
-
deployment_id: string2()
|
|
250647
|
-
}).transform((data) => ({
|
|
250648
|
-
name: data.name,
|
|
250649
|
-
versionId: data.version_id,
|
|
250650
|
-
manifestHash: data.manifest_hash,
|
|
250651
|
-
deploymentId: data.deployment_id
|
|
250652
|
-
}));
|
|
250653
|
-
|
|
250654
|
-
// src/core/version/api.ts
|
|
250655
|
-
var DEFAULT_VERSION_UPLOAD_CONCURRENCY = 8;
|
|
250656
|
-
var MAX_VERSION_UPLOAD_CONCURRENCY = 16;
|
|
250657
|
-
function declaredFile({ path, size, digest }) {
|
|
250658
|
-
return { path, size, digest };
|
|
250659
|
-
}
|
|
250660
|
-
function declaredModule(module) {
|
|
250661
|
-
return { ...declaredFile(module), type: module.type };
|
|
250662
|
-
}
|
|
250663
|
-
function declaredAssetsConfig(config) {
|
|
250664
|
-
const stated = {
|
|
250665
|
-
html_handling: config?.htmlHandling ?? null,
|
|
250666
|
-
not_found_handling: config?.notFoundHandling ?? null,
|
|
250667
|
-
run_worker_first: config?.runWorkerFirst ?? null,
|
|
250668
|
-
headers: config?.headers ?? null,
|
|
250669
|
-
redirects: config?.redirects ?? null
|
|
250670
|
-
};
|
|
250671
|
-
return Object.values(stated).every((v) => v === null) ? null : stated;
|
|
250672
|
-
}
|
|
250673
|
-
async function post(path, json, doing) {
|
|
250674
|
-
try {
|
|
250675
|
-
return await getAppClient().post(path, { json, timeout: 180000 });
|
|
250676
|
-
} catch (error) {
|
|
250677
|
-
throw await ApiError.fromHttpError(error, doing);
|
|
250678
|
-
}
|
|
250679
|
-
}
|
|
250680
|
-
var KEYED_RETRY = {
|
|
250681
|
-
limit: 3,
|
|
250682
|
-
methods: ["patch"],
|
|
250683
|
-
statusCodes: [408, 500, 502, 503, 504],
|
|
250684
|
-
retryOnTimeout: true
|
|
250685
|
-
};
|
|
250686
|
-
async function patch(path, json, doing, retry) {
|
|
250687
|
-
try {
|
|
250688
|
-
return await getAppClient().patch(path, {
|
|
250689
|
-
json,
|
|
250690
|
-
timeout: 180000,
|
|
250691
|
-
...retry ? { retry } : {}
|
|
250692
|
-
});
|
|
250693
|
-
} catch (error) {
|
|
250694
|
-
throw await ApiError.fromHttpError(error, doing);
|
|
250695
|
-
}
|
|
250696
|
-
}
|
|
250697
|
-
function parse10(schema, body, what) {
|
|
250698
|
-
const result = schema.safeParse(body);
|
|
250699
|
-
if (!result.success) {
|
|
250700
|
-
throw new SchemaValidationError(`Invalid ${what} response from server`, result.error);
|
|
250701
|
-
}
|
|
250702
|
-
return result.data;
|
|
250703
|
-
}
|
|
250704
|
-
async function createVersion(artifacts, options = {}) {
|
|
250705
|
-
const declared = parse10(DeclareVersionResponseSchema, await (await post("versions", {
|
|
250706
|
-
static_bundle: artifacts.files.map(declaredFile),
|
|
250707
|
-
...artifacts.siteWorker ? {
|
|
250708
|
-
site_worker: {
|
|
250709
|
-
main: artifacts.siteWorker.main,
|
|
250710
|
-
modules: artifacts.siteWorker.modules.map(declaredModule),
|
|
250711
|
-
assets: artifacts.siteWorker.assets.map(declaredFile),
|
|
250712
|
-
compatibility_date: artifacts.siteWorker.compatibilityDate,
|
|
250713
|
-
compatibility_flags: artifacts.siteWorker.compatibilityFlags,
|
|
250714
|
-
assets_config: declaredAssetsConfig(artifacts.siteWorker.assetsConfig)
|
|
250715
|
-
}
|
|
250716
|
-
} : {},
|
|
250717
|
-
entities: artifacts.entities,
|
|
250718
|
-
agents: artifacts.agents,
|
|
250719
|
-
source_commit: options.sourceCommit
|
|
250720
|
-
}, "declaring a version")).json(), "declare");
|
|
250721
|
-
const declaredFiles = [
|
|
250722
|
-
...artifacts.files,
|
|
250723
|
-
...artifacts.siteWorker?.modules ?? [],
|
|
250724
|
-
...artifacts.siteWorker?.assets ?? []
|
|
250725
|
-
];
|
|
250726
|
-
options.progress?.onDeclared?.({ fileCount: declaredFiles.length });
|
|
250727
|
-
if (declared.uploads.length !== declaredFiles.length) {
|
|
250728
|
-
throw new InternalError(`Declared ${declaredFiles.length} files but the server signed ${declared.uploads.length} upload URLs.`);
|
|
250729
|
-
}
|
|
250730
|
-
const drifted = declared.uploads.findIndex((upload, index) => upload.path !== declaredFiles[index].path);
|
|
250731
|
-
if (drifted !== -1) {
|
|
250732
|
-
throw new InternalError(`Upload ${drifted} is signed for ${declared.uploads[drifted].path}, but that slot declared ${declaredFiles[drifted].path}.`);
|
|
250733
|
-
}
|
|
250734
|
-
let uploadedFiles = 0;
|
|
250735
|
-
await pMap(declared.uploads, async (upload, index) => {
|
|
250736
|
-
await putPresigned(upload, declaredFiles[index].absolutePath);
|
|
250737
|
-
uploadedFiles++;
|
|
250738
|
-
options.progress?.onUpload?.({
|
|
250739
|
-
uploadedFiles,
|
|
250740
|
-
totalFiles: declared.uploads.length
|
|
250741
|
-
});
|
|
250742
|
-
}, { concurrency: options.concurrency ?? DEFAULT_VERSION_UPLOAD_CONCURRENCY });
|
|
250743
|
-
return parse10(CreateVersionResponseSchema, await (await post(`versions/${encodeURIComponent(declared.sessionId)}/finalize`, {}, "creating a version")).json(), "create version");
|
|
250744
|
-
}
|
|
250745
|
-
async function setEnvironmentVersion(environment, versionId, options = {}) {
|
|
250746
|
-
return parse10(EnvironmentResponseSchema, await (await patch(`environments/${encodeURIComponent(environment)}`, {
|
|
250747
|
-
version_id: versionId,
|
|
250748
|
-
...options.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}
|
|
250749
|
-
}, "setting the environment's version", options.idempotencyKey ? KEYED_RETRY : undefined)).json(), "environment");
|
|
250750
|
-
}
|
|
250751
|
-
// src/core/version/artifacts.ts
|
|
250752
|
-
import { createHash as createHash2 } from "node:crypto";
|
|
250753
|
-
import { join as join29, resolve as resolve13 } from "node:path";
|
|
250754
|
-
var MAX_FILE_COUNT = 50000;
|
|
250755
|
-
var HASH_CONCURRENCY = 32;
|
|
250756
|
-
var ENTRY2 = "index.html";
|
|
250757
|
-
async function digestFile(absolutePath) {
|
|
250758
|
-
const hash = await hashFileInto(createHash2("sha256"), absolutePath);
|
|
250759
|
-
return `sha256:${hash.digest("hex")}`;
|
|
250760
|
-
}
|
|
250761
|
-
async function collectBuildOutput(outputDir, options = {}) {
|
|
250762
|
-
const found = await describeBuildOutput(outputDir);
|
|
250763
|
-
if (found.length > MAX_FILE_COUNT) {
|
|
250764
|
-
throw new InvalidInputError(`Too many files: found ${found.length}, the limit is ${MAX_FILE_COUNT}.`);
|
|
250765
|
-
}
|
|
250766
|
-
if (options.entryFile) {
|
|
250767
|
-
if (found.length === 0) {
|
|
250768
|
-
throw new InvalidInputError(`No files found in ${outputDir}. Build the site before creating a version.`, {
|
|
250769
|
-
hints: [
|
|
250770
|
-
{ message: "Run 'base44 build' first", command: "base44 build" }
|
|
250771
|
-
]
|
|
250772
|
-
});
|
|
250773
|
-
}
|
|
250774
|
-
if (!found.some((f) => f.path === options.entryFile)) {
|
|
250775
|
-
throw new InvalidInputError(`${outputDir} has no ${options.entryFile}, so nothing could enter the site.`);
|
|
250776
|
-
}
|
|
250777
|
-
}
|
|
250778
|
-
return await pMap(found, async (file) => ({ ...file, digest: await digestFile(file.absolutePath) }), { concurrency: HASH_CONCURRENCY });
|
|
250779
|
-
}
|
|
250780
|
-
async function collectSiteWorker(projectRoot) {
|
|
250781
|
-
const built = await resolveFullStackBuild(projectRoot);
|
|
250782
|
-
if (!built) {
|
|
250783
|
-
return null;
|
|
250784
|
-
}
|
|
250785
|
-
const { config, modules, assetsDir } = built;
|
|
250786
|
-
const entry = resolve13(config.configDir, config.main);
|
|
250787
|
-
const main = modules.find((m) => m.absolutePath === entry)?.name;
|
|
250788
|
-
if (!main) {
|
|
250789
|
-
throw new InvalidInputError(`The Worker's entry module ${config.main} is not among the ${modules.length} modules collected from ${config.configDir}.`);
|
|
250790
|
-
}
|
|
250791
|
-
return {
|
|
250792
|
-
main,
|
|
250793
|
-
modules: await pMap(modules, async ({ name, absolutePath, size, type }) => ({
|
|
250794
|
-
path: name,
|
|
250795
|
-
absolutePath,
|
|
250796
|
-
size,
|
|
250797
|
-
digest: await digestFile(absolutePath),
|
|
250798
|
-
type
|
|
250799
|
-
}), { concurrency: HASH_CONCURRENCY }),
|
|
250800
|
-
assets: assetsDir ? await collectBuildOutput(assetsDir) : [],
|
|
250801
|
-
compatibilityDate: config.compatibilityDate,
|
|
250802
|
-
compatibilityFlags: config.compatibilityFlags,
|
|
250803
|
-
assetsConfig: config.assetsConfig
|
|
250804
|
-
};
|
|
250805
|
-
}
|
|
250806
|
-
async function readRawResources(dir) {
|
|
250807
|
-
if (!await pathExists(dir)) {
|
|
250808
|
-
return {};
|
|
250809
|
-
}
|
|
250810
|
-
const files = await globby(`**/*.${CONFIG_FILE_EXTENSION_GLOB}`, {
|
|
250811
|
-
cwd: dir,
|
|
250812
|
-
onlyFiles: true,
|
|
250813
|
-
followSymbolicLinks: false
|
|
250814
|
-
});
|
|
250815
|
-
const payloads = {};
|
|
250816
|
-
for (const relativePath of files.sort()) {
|
|
250817
|
-
const name = relativePath.replace(/\.jsonc?$/, "");
|
|
250818
|
-
payloads[name] = await readJsonFile(join29(dir, ...relativePath.split("/")));
|
|
250819
|
-
}
|
|
250820
|
-
return payloads;
|
|
250821
|
-
}
|
|
250822
|
-
async function collectResources(configDir, dirs) {
|
|
250823
|
-
const [entities, agents] = await Promise.all([
|
|
250824
|
-
readRawResources(join29(configDir, dirs.entitiesDir)),
|
|
250825
|
-
readRawResources(join29(configDir, dirs.agentsDir))
|
|
250826
|
-
]);
|
|
250827
|
-
return { entities, agents };
|
|
250828
|
-
}
|
|
250829
|
-
async function collectArtifacts(target) {
|
|
250830
|
-
const siteWorker = await collectSiteWorker(target.root);
|
|
250831
|
-
return {
|
|
250832
|
-
files: siteWorker ? [] : await collectBuildOutput(requireOutputDir(target), {
|
|
250833
|
-
entryFile: ENTRY2
|
|
250834
|
-
}),
|
|
250835
|
-
...siteWorker ? { siteWorker } : {},
|
|
250836
|
-
...await collectResources(target.configDir, target)
|
|
250837
|
-
};
|
|
250838
|
-
}
|
|
250839
|
-
// src/core/version/gate.ts
|
|
250840
|
-
var VERSIONS_API_ENV = "BASE44_VERSIONS_API";
|
|
250841
|
-
function versionsApiEnabled(env = process.env) {
|
|
250842
|
-
const value = env[VERSIONS_API_ENV];
|
|
250843
|
-
return value === "1" || value === "true";
|
|
250844
|
-
}
|
|
250845
|
-
// src/core/version/publish.ts
|
|
250846
|
-
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
250847
|
-
var DEFAULT_ENVIRONMENT = "production";
|
|
250848
|
-
async function tagStep2(step, run) {
|
|
250849
|
-
return await tagStep(step, run);
|
|
250850
|
-
}
|
|
250851
|
-
async function publishVersion(artifacts, options = {}) {
|
|
250852
|
-
const version = await tagStep2("create_version", () => createVersion(artifacts, {
|
|
250853
|
-
sourceCommit: options.sourceCommit,
|
|
250854
|
-
concurrency: options.concurrency,
|
|
250855
|
-
progress: options.progress
|
|
250856
|
-
}));
|
|
250857
|
-
const environment = await tagStep2("deploy", () => setEnvironmentVersion(options.target ?? DEFAULT_ENVIRONMENT, version.versionId, {
|
|
250858
|
-
idempotencyKey: randomUUID4()
|
|
250859
|
-
}));
|
|
250860
|
-
return {
|
|
250861
|
-
environment: environment.name,
|
|
250862
|
-
versionId: environment.versionId,
|
|
250863
|
-
manifestHash: environment.manifestHash,
|
|
250864
|
-
deploymentId: environment.deploymentId
|
|
250865
|
-
};
|
|
250866
|
-
}
|
|
250867
|
-
// src/cli/commands/versions/options.ts
|
|
250868
|
-
function outputDirOption() {
|
|
250869
|
-
return new Option2("--output-dir <dir>", "Build output directory (defaults to the project's, else dist)");
|
|
250870
|
-
}
|
|
250871
|
-
function targetOption() {
|
|
250872
|
-
return new Option2("--target <name>", "Environment to serve the version at");
|
|
250873
|
-
}
|
|
250874
|
-
function gitHashOption() {
|
|
250875
|
-
return new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser((value) => {
|
|
250876
|
-
if (!isGitCommitHash(value)) {
|
|
250877
|
-
throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
|
|
250878
|
-
}
|
|
250879
|
-
return value;
|
|
250880
|
-
});
|
|
250881
|
-
}
|
|
250882
|
-
function concurrencyOption() {
|
|
250883
|
-
return new Option2("--concurrency <n>", "Parallel file uploads").default(DEFAULT_VERSION_UPLOAD_CONCURRENCY).argParser((value) => {
|
|
250884
|
-
const parsed = Number(value);
|
|
250885
|
-
if (!Number.isInteger(parsed) || parsed < 1 || parsed > MAX_VERSION_UPLOAD_CONCURRENCY) {
|
|
250886
|
-
throw new InvalidArgumentError2(`Expected a whole number between 1 and ${MAX_VERSION_UPLOAD_CONCURRENCY}.`);
|
|
250887
|
-
}
|
|
250888
|
-
return parsed;
|
|
250889
|
-
});
|
|
250890
|
-
}
|
|
250891
|
-
|
|
250892
|
-
// src/cli/commands/publish.ts
|
|
250893
|
-
async function publishAction(ctx, options) {
|
|
250894
|
-
const { runTask, log, jsonMode } = ctx;
|
|
250895
|
-
const app = requireApp(ctx);
|
|
250896
|
-
const target = await tagStep2("create_version", () => resolveBuildTarget(app.projectRoot, { outputDir: options.outputDir }));
|
|
250897
|
-
if (options.build !== false) {
|
|
250898
|
-
await tagStep2("build", () => runSiteBuild(ctx, {
|
|
250899
|
-
root: target.root,
|
|
250900
|
-
buildCommand: target.buildCommand,
|
|
250901
|
-
appId: app.id
|
|
250902
|
-
}));
|
|
250903
|
-
}
|
|
250904
|
-
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
250905
|
-
const result = await runTask("Publishing...", async (updateMessage) => {
|
|
250906
|
-
const artifacts = await tagStep2("create_version", () => collectArtifacts(target));
|
|
250907
|
-
return await publishVersion(artifacts, {
|
|
250908
|
-
sourceCommit: gitHash,
|
|
250909
|
-
target: options.target,
|
|
250910
|
-
concurrency: options.concurrency,
|
|
250911
|
-
progress: {
|
|
250912
|
-
onDeclared: ({ fileCount }) => updateMessage(`Uploading ${fileCount} files`),
|
|
250913
|
-
onUpload: ({ uploadedFiles, totalFiles }) => updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} files`)
|
|
250914
|
-
}
|
|
250915
|
-
});
|
|
250916
|
-
}, { successMessage: "Published", errorMessage: "Publish failed" });
|
|
250917
|
-
if (!jsonMode) {
|
|
250918
|
-
log.message(theme.styles.dim(`version ${result.versionId}`));
|
|
250919
|
-
}
|
|
250920
|
-
return {
|
|
250921
|
-
outroMessage: `${result.environment} now serves ${result.versionId}`,
|
|
250922
|
-
stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
|
|
250923
|
-
` : undefined
|
|
250924
|
-
};
|
|
250925
|
-
}
|
|
250926
|
-
function getPublishCommand() {
|
|
250927
|
-
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);
|
|
250928
|
-
}
|
|
250929
|
-
|
|
250930
250513
|
// src/core/resources/sandbox/schema.ts
|
|
250931
250514
|
var FileErrorSchema = object({
|
|
250932
250515
|
code: string2(),
|
|
@@ -251312,7 +250895,7 @@ function getSecretsListCommand() {
|
|
|
251312
250895
|
}
|
|
251313
250896
|
|
|
251314
250897
|
// src/cli/commands/secrets/set.ts
|
|
251315
|
-
import { resolve as
|
|
250898
|
+
import { resolve as resolve12 } from "node:path";
|
|
251316
250899
|
function parseEntries(entries) {
|
|
251317
250900
|
const secrets = {};
|
|
251318
250901
|
for (const entry of entries) {
|
|
@@ -251343,7 +250926,7 @@ async function setSecretsAction({ log, runTask }, entries, options) {
|
|
|
251343
250926
|
validateInput(entries, options);
|
|
251344
250927
|
let secrets;
|
|
251345
250928
|
if (options.envFile) {
|
|
251346
|
-
secrets = await parseEnvFile(
|
|
250929
|
+
secrets = await parseEnvFile(resolve12(options.envFile));
|
|
251347
250930
|
if (Object.keys(secrets).length === 0) {
|
|
251348
250931
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
251349
250932
|
}
|
|
@@ -251372,7 +250955,7 @@ function getSecretsCommand() {
|
|
|
251372
250955
|
}
|
|
251373
250956
|
|
|
251374
250957
|
// src/cli/commands/site/deploy.ts
|
|
251375
|
-
import { resolve as
|
|
250958
|
+
import { resolve as resolve13 } from "node:path";
|
|
251376
250959
|
async function deployAction2(ctx, options) {
|
|
251377
250960
|
const { isNonInteractive } = ctx;
|
|
251378
250961
|
if (isNonInteractive && !options.yes) {
|
|
@@ -251437,7 +251020,7 @@ async function deployTarball({ runTask }, project) {
|
|
|
251437
251020
|
throw new ConfigNotFoundError("No site configuration found.", {
|
|
251438
251021
|
hints: [
|
|
251439
251022
|
{
|
|
251440
|
-
message: `Add 'site
|
|
251023
|
+
message: `Add a 'site' block to your config.jsonc (e.g., "site": { "outputDirectory": "dist" }). Inside one, outputDirectory defaults to "./dist".`
|
|
251441
251024
|
}
|
|
251442
251025
|
]
|
|
251443
251026
|
});
|
|
@@ -251450,7 +251033,7 @@ async function deployTarball({ runTask }, project) {
|
|
|
251450
251033
|
}
|
|
251451
251034
|
function siteOutputDir(project) {
|
|
251452
251035
|
const outputDirectory = project.site?.outputDirectory;
|
|
251453
|
-
return outputDirectory ?
|
|
251036
|
+
return outputDirectory ? resolve13(project.root, outputDirectory) : null;
|
|
251454
251037
|
}
|
|
251455
251038
|
function getSiteDeployCommand() {
|
|
251456
251039
|
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)");
|
|
@@ -251582,10 +251165,10 @@ function toPascalCase(name) {
|
|
|
251582
251165
|
return name.split(/[-_\s]+/).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("");
|
|
251583
251166
|
}
|
|
251584
251167
|
// src/core/types/update-project.ts
|
|
251585
|
-
import { join as
|
|
251168
|
+
import { join as join30 } from "node:path";
|
|
251586
251169
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
251587
251170
|
async function updateProjectConfig(projectRoot) {
|
|
251588
|
-
const tsconfigPath =
|
|
251171
|
+
const tsconfigPath = join30(projectRoot, "tsconfig.json");
|
|
251589
251172
|
if (!await pathExists(tsconfigPath)) {
|
|
251590
251173
|
return false;
|
|
251591
251174
|
}
|
|
@@ -251634,59 +251217,6 @@ function getTypesCommand() {
|
|
|
251634
251217
|
return new Command2("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
|
|
251635
251218
|
}
|
|
251636
251219
|
|
|
251637
|
-
// src/cli/commands/versions/create.ts
|
|
251638
|
-
async function createAction2(ctx, options) {
|
|
251639
|
-
const { runTask, jsonMode } = ctx;
|
|
251640
|
-
const target = await resolveBuildTarget(requireApp(ctx).projectRoot, {
|
|
251641
|
-
outputDir: options.outputDir
|
|
251642
|
-
});
|
|
251643
|
-
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
251644
|
-
const version = await runTask("Creating version...", async (updateMessage) => await createVersion(await collectArtifacts(target), {
|
|
251645
|
-
sourceCommit: gitHash,
|
|
251646
|
-
concurrency: options.concurrency,
|
|
251647
|
-
progress: {
|
|
251648
|
-
onDeclared: ({ fileCount }) => updateMessage(`Uploading ${fileCount} files`),
|
|
251649
|
-
onUpload: ({ uploadedFiles, totalFiles }) => updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} files`)
|
|
251650
|
-
}
|
|
251651
|
-
}), {
|
|
251652
|
-
successMessage: "Version created",
|
|
251653
|
-
errorMessage: "Create version failed"
|
|
251654
|
-
});
|
|
251655
|
-
return {
|
|
251656
|
-
outroMessage: `Version ${version.versionId} (${version.manifestHash})`,
|
|
251657
|
-
stdout: jsonMode ? `${JSON.stringify(version, null, 2)}
|
|
251658
|
-
` : undefined
|
|
251659
|
-
};
|
|
251660
|
-
}
|
|
251661
|
-
function getVersionCreateCommand() {
|
|
251662
|
-
return new Base44Command("create").description("Record the built output as a version, without deploying it").addOption(outputDirOption()).addOption(gitHashOption()).addOption(concurrencyOption()).action(createAction2);
|
|
251663
|
-
}
|
|
251664
|
-
|
|
251665
|
-
// src/cli/commands/versions/deploy.ts
|
|
251666
|
-
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
251667
|
-
async function deployAction3({ runTask, jsonMode }, versionId, options) {
|
|
251668
|
-
const environment = options.target ?? DEFAULT_ENVIRONMENT;
|
|
251669
|
-
const result = await runTask(`Pointing ${environment} at ${versionId}...`, async () => await setEnvironmentVersion(environment, versionId, {
|
|
251670
|
-
idempotencyKey: randomUUID5()
|
|
251671
|
-
}), {
|
|
251672
|
-
successMessage: "Environment updated",
|
|
251673
|
-
errorMessage: "Could not update the environment"
|
|
251674
|
-
});
|
|
251675
|
-
return {
|
|
251676
|
-
outroMessage: `${result.name} now serves ${result.versionId}`,
|
|
251677
|
-
stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
|
|
251678
|
-
` : undefined
|
|
251679
|
-
};
|
|
251680
|
-
}
|
|
251681
|
-
function getVersionDeployCommand() {
|
|
251682
|
-
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);
|
|
251683
|
-
}
|
|
251684
|
-
|
|
251685
|
-
// src/cli/commands/versions/index.ts
|
|
251686
|
-
function getVersionsCommand() {
|
|
251687
|
-
return new Command2("versions").description("Record app versions and serve them").addCommand(getVersionCreateCommand()).addCommand(getVersionDeployCommand());
|
|
251688
|
-
}
|
|
251689
|
-
|
|
251690
251220
|
// src/core/resources/workflow/schema.ts
|
|
251691
251221
|
var WorkflowRunStatusSchema = _enum([
|
|
251692
251222
|
"running",
|
|
@@ -252103,7 +251633,7 @@ function createDevLogger(label, labelColor = theme.styles.dim) {
|
|
|
252103
251633
|
// src/cli/dev/dev-server/main.ts
|
|
252104
251634
|
var import_cors = __toESM(require_lib4(), 1);
|
|
252105
251635
|
var import_express6 = __toESM(require_express(), 1);
|
|
252106
|
-
import { dirname as
|
|
251636
|
+
import { dirname as dirname26, join as join36 } from "node:path";
|
|
252107
251637
|
|
|
252108
251638
|
// ../../node_modules/get-port/index.js
|
|
252109
251639
|
import net from "node:net";
|
|
@@ -252233,7 +251763,7 @@ var $tmpName = promisify11(tmp.tmpName);
|
|
|
252233
251763
|
|
|
252234
251764
|
// src/cli/dev/dev-server/function-manager.ts
|
|
252235
251765
|
import { spawn as spawn2 } from "node:child_process";
|
|
252236
|
-
import { dirname as
|
|
251766
|
+
import { dirname as dirname23, join as join31 } from "node:path";
|
|
252237
251767
|
import { pathToFileURL } from "node:url";
|
|
252238
251768
|
|
|
252239
251769
|
// src/cli/dev/dev-server/base-function-manager.ts
|
|
@@ -252338,7 +251868,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
252338
251868
|
}
|
|
252339
251869
|
spawnFunction(func, port) {
|
|
252340
251870
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
252341
|
-
const importMapPath =
|
|
251871
|
+
const importMapPath = join31(dirname23(this.wrapperPath), "import-map.json");
|
|
252342
251872
|
const process2 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
|
|
252343
251873
|
env: {
|
|
252344
251874
|
...globalThis.process.env,
|
|
@@ -252412,7 +251942,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
252412
251942
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
252413
251943
|
import { isBuiltin } from "node:module";
|
|
252414
251944
|
import { homedir as homedir3 } from "node:os";
|
|
252415
|
-
import { join as
|
|
251945
|
+
import { join as join33 } from "node:path";
|
|
252416
251946
|
import { pathToFileURL as pathToFileURL6 } from "node:url";
|
|
252417
251947
|
var depsPromise;
|
|
252418
251948
|
function loadDeps() {
|
|
@@ -252533,9 +252063,9 @@ export default {
|
|
|
252533
252063
|
};
|
|
252534
252064
|
`;
|
|
252535
252065
|
function ensureBundlerConfig() {
|
|
252536
|
-
const dir =
|
|
252066
|
+
const dir = join33(homedir3(), ".base44", "function-bundler");
|
|
252537
252067
|
mkdirSync2(dir, { recursive: true });
|
|
252538
|
-
const configPath =
|
|
252068
|
+
const configPath = join33(dir, "deno.json");
|
|
252539
252069
|
writeFileSync2(configPath, `${JSON.stringify({ nodeModulesDir: "auto" }, null, 2)}
|
|
252540
252070
|
`);
|
|
252541
252071
|
return configPath;
|
|
@@ -253916,11 +253446,11 @@ async function createEntityRoutes(db, logger, broadcast) {
|
|
|
253916
253446
|
// src/cli/dev/dev-server/routes/integrations.ts
|
|
253917
253447
|
var import_express5 = __toESM(require_express(), 1);
|
|
253918
253448
|
var import_multer = __toESM(require_multer(), 1);
|
|
253919
|
-
import { createHash as
|
|
253449
|
+
import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
|
|
253920
253450
|
import fs28 from "node:fs";
|
|
253921
253451
|
import path18 from "node:path";
|
|
253922
253452
|
function createFileToken(fileUri) {
|
|
253923
|
-
return
|
|
253453
|
+
return createHash2("sha256").update(fileUri).digest("hex");
|
|
253924
253454
|
}
|
|
253925
253455
|
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
253926
253456
|
const router = import_express5.Router({ mergeParams: true });
|
|
@@ -253933,14 +253463,14 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
253933
253463
|
destination: mediaFilesDir,
|
|
253934
253464
|
filename: (_req, file, cb) => {
|
|
253935
253465
|
const ext = path18.extname(file.originalname);
|
|
253936
|
-
cb(null, `${
|
|
253466
|
+
cb(null, `${randomUUID4()}${ext}`);
|
|
253937
253467
|
}
|
|
253938
253468
|
});
|
|
253939
253469
|
const privateStorage = import_multer.default.diskStorage({
|
|
253940
253470
|
destination: privateFilesDir,
|
|
253941
253471
|
filename: (_req, file, cb) => {
|
|
253942
253472
|
const ext = path18.extname(file.originalname);
|
|
253943
|
-
cb(null, `${
|
|
253473
|
+
cb(null, `${randomUUID4()}${ext}`);
|
|
253944
253474
|
}
|
|
253945
253475
|
});
|
|
253946
253476
|
const upload = import_multer.default({ storage, limits: { fileSize: MAX_FILE_SIZE } });
|
|
@@ -255802,8 +255332,8 @@ async function createDevServer(options) {
|
|
|
255802
255332
|
broadcastEntityEvent(io, appId, entityName, event);
|
|
255803
255333
|
};
|
|
255804
255334
|
const base44ConfigWatcher = new WatchBase44({
|
|
255805
|
-
functions:
|
|
255806
|
-
entities:
|
|
255335
|
+
functions: join36(dirname26(project.configPath), project.functionsDir),
|
|
255336
|
+
entities: join36(dirname26(project.configPath), project.entitiesDir)
|
|
255807
255337
|
}, devLogger);
|
|
255808
255338
|
base44ConfigWatcher.on("change", async (name) => {
|
|
255809
255339
|
try {
|
|
@@ -256031,7 +255561,7 @@ function startServeCommand(runner, backend) {
|
|
|
256031
255561
|
async function remoteDevAction(app) {
|
|
256032
255562
|
const site = await resolveConfiguredSite(app);
|
|
256033
255563
|
if (!site) {
|
|
256034
|
-
throw new ConfigInvalidError(
|
|
255564
|
+
throw new ConfigInvalidError(`base44 dev --remote serves the frontend against the production backend, but this project has no 'site' block in base44/config.jsonc. Add one; inside it serveCommand defaults to "npm run dev".`);
|
|
256035
255565
|
}
|
|
256036
255566
|
const appBaseUrl = await getSiteUrl();
|
|
256037
255567
|
const runner = createServeCommandRunner({
|
|
@@ -256200,7 +255730,7 @@ Examples:
|
|
|
256200
255730
|
}
|
|
256201
255731
|
|
|
256202
255732
|
// src/cli/commands/project/eject.ts
|
|
256203
|
-
import { resolve as
|
|
255733
|
+
import { resolve as resolve17 } from "node:path";
|
|
256204
255734
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
256205
255735
|
async function eject(ctx, options, command) {
|
|
256206
255736
|
const { log, runTask, isNonInteractive } = ctx;
|
|
@@ -256264,7 +255794,7 @@ async function eject(ctx, options, command) {
|
|
|
256264
255794
|
Ne("Operation cancelled.");
|
|
256265
255795
|
throw new CLIExitError(0);
|
|
256266
255796
|
}
|
|
256267
|
-
const resolvedPath =
|
|
255797
|
+
const resolvedPath = resolve17(selectedPath);
|
|
256268
255798
|
await runTask("Downloading your project's code...", async (updateMessage) => {
|
|
256269
255799
|
await createProjectFilesForExistingProject({
|
|
256270
255800
|
projectId,
|
|
@@ -256348,10 +255878,6 @@ function createProgram(context) {
|
|
|
256348
255878
|
program.addCommand(getBranchesCommand());
|
|
256349
255879
|
program.addCommand(getAuthCommand());
|
|
256350
255880
|
program.addCommand(getSiteCommand());
|
|
256351
|
-
if (versionsApiEnabled()) {
|
|
256352
|
-
program.addCommand(getPublishCommand());
|
|
256353
|
-
program.addCommand(getVersionsCommand());
|
|
256354
|
-
}
|
|
256355
255881
|
program.addCommand(getTypesCommand());
|
|
256356
255882
|
program.addCommand(getExecCommand());
|
|
256357
255883
|
program.addCommand(getDevCommand());
|
|
@@ -256364,7 +255890,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
256364
255890
|
import { release, type } from "node:os";
|
|
256365
255891
|
|
|
256366
255892
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
256367
|
-
import { dirname as
|
|
255893
|
+
import { dirname as dirname27, posix, sep as sep2 } from "path";
|
|
256368
255894
|
function createModulerModifier() {
|
|
256369
255895
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
256370
255896
|
return async (frames) => {
|
|
@@ -256373,7 +255899,7 @@ function createModulerModifier() {
|
|
|
256373
255899
|
return frames;
|
|
256374
255900
|
};
|
|
256375
255901
|
}
|
|
256376
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
255902
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname27(process.argv[1]) : process.cwd(), isWindows = sep2 === "\\") {
|
|
256377
255903
|
const normalizedBase = isWindows ? normalizeWindowsPath2(basePath) : basePath;
|
|
256378
255904
|
return (filename) => {
|
|
256379
255905
|
if (!filename)
|
|
@@ -260362,9 +259888,9 @@ function addCommandInfoToErrorReporter(program, errorReporter) {
|
|
|
260362
259888
|
});
|
|
260363
259889
|
}
|
|
260364
259890
|
// src/cli/index.ts
|
|
260365
|
-
var __dirname4 =
|
|
259891
|
+
var __dirname4 = dirname28(fileURLToPath6(import.meta.url));
|
|
260366
259892
|
async function runCLI(options) {
|
|
260367
|
-
ensureNpmAssets(
|
|
259893
|
+
ensureNpmAssets(join37(__dirname4, "../assets"));
|
|
260368
259894
|
const errorReporter = new ErrorReporter;
|
|
260369
259895
|
errorReporter.registerProcessErrorHandlers();
|
|
260370
259896
|
const jsonMode = process.argv.includes("--json");
|
|
@@ -260403,4 +259929,4 @@ export {
|
|
|
260403
259929
|
runCLI
|
|
260404
259930
|
};
|
|
260405
259931
|
|
|
260406
|
-
//# debugId=
|
|
259932
|
+
//# debugId=E2C8B2D4450DEEB964756E2164756E21
|