@base44-preview/cli 0.1.15-pr.626.d48e59b → 0.1.15-pr.626.db74099
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 +351 -289
- package/dist/cli/index.js.map +17 -16
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -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,7 +240099,10 @@ 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),
|
|
@@ -240010,85 +240118,6 @@ async function uploadPresignedAsset(upload, assets) {
|
|
|
240010
240118
|
}
|
|
240011
240119
|
}
|
|
240012
240120
|
|
|
240013
|
-
// src/core/site/wrangler-config.ts
|
|
240014
|
-
import { dirname as dirname12, join as join17, resolve as resolve4 } from "node:path";
|
|
240015
|
-
var WRANGLER_REDIRECT_PATH = join17(".wrangler", "deploy", "config.json");
|
|
240016
|
-
var RedirectConfigSchema = looseObject({
|
|
240017
|
-
configPath: string2().min(1)
|
|
240018
|
-
});
|
|
240019
|
-
var WranglerConfigSchema = looseObject({
|
|
240020
|
-
main: string2().min(1, "wrangler config is missing a 'main' entry module"),
|
|
240021
|
-
no_bundle: boolean2().optional(),
|
|
240022
|
-
rules: array(looseObject({ type: string2(), globs: array(string2()) })).optional(),
|
|
240023
|
-
assets: looseObject({
|
|
240024
|
-
directory: string2().optional(),
|
|
240025
|
-
html_handling: string2().optional(),
|
|
240026
|
-
not_found_handling: string2().optional(),
|
|
240027
|
-
run_worker_first: union([boolean2(), array(string2())]).optional(),
|
|
240028
|
-
headers: string2().optional(),
|
|
240029
|
-
redirects: string2().optional()
|
|
240030
|
-
}).optional(),
|
|
240031
|
-
compatibility_date: string2().optional(),
|
|
240032
|
-
compatibility_flags: array(string2()).optional(),
|
|
240033
|
-
vars: record(string2(), unknown()).optional(),
|
|
240034
|
-
upload_source_maps: boolean2().optional()
|
|
240035
|
-
});
|
|
240036
|
-
async function detectFullStackArtifact(projectRoot) {
|
|
240037
|
-
const redirectPath = join17(projectRoot, WRANGLER_REDIRECT_PATH);
|
|
240038
|
-
return await pathExists(redirectPath) ? redirectPath : null;
|
|
240039
|
-
}
|
|
240040
|
-
async function resolveWranglerConfig(redirectPath) {
|
|
240041
|
-
const configPath = await resolveRedirectedConfigPath(redirectPath);
|
|
240042
|
-
const parsed = await readJsonFile(configPath);
|
|
240043
|
-
const result = WranglerConfigSchema.safeParse(parsed);
|
|
240044
|
-
if (!result.success) {
|
|
240045
|
-
throw new ConfigInvalidError(`Invalid wrangler config: ${prettifyError(result.error)}`, configPath);
|
|
240046
|
-
}
|
|
240047
|
-
const config = result.data;
|
|
240048
|
-
if (config.no_bundle !== true) {
|
|
240049
|
-
throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
|
|
240050
|
-
}
|
|
240051
|
-
const configDir = dirname12(configPath);
|
|
240052
|
-
const assetsDirectory = config.assets?.directory ? resolve4(configDir, config.assets.directory) : null;
|
|
240053
|
-
return {
|
|
240054
|
-
configPath,
|
|
240055
|
-
configDir,
|
|
240056
|
-
main: config.main,
|
|
240057
|
-
assetsDirectory,
|
|
240058
|
-
assetsConfig: config.assets ? toResolvedAssetsConfig(config.assets) : null,
|
|
240059
|
-
compatibilityDate: config.compatibility_date ?? null,
|
|
240060
|
-
compatibilityFlags: config.compatibility_flags ?? [],
|
|
240061
|
-
rules: (config.rules ?? []).map((rule) => ({
|
|
240062
|
-
type: rule.type,
|
|
240063
|
-
globs: rule.globs
|
|
240064
|
-
})),
|
|
240065
|
-
uploadSourceMaps: config.upload_source_maps ?? false
|
|
240066
|
-
};
|
|
240067
|
-
}
|
|
240068
|
-
async function resolveRedirectedConfigPath(redirectPath) {
|
|
240069
|
-
const parsed = await readJsonFile(redirectPath);
|
|
240070
|
-
const result = RedirectConfigSchema.safeParse(parsed);
|
|
240071
|
-
if (!result.success) {
|
|
240072
|
-
throw new ConfigInvalidError(`Invalid deploy redirect file: ${prettifyError(result.error)}`, redirectPath);
|
|
240073
|
-
}
|
|
240074
|
-
const configPath = resolve4(dirname12(redirectPath), result.data.configPath);
|
|
240075
|
-
if (!await pathExists(configPath)) {
|
|
240076
|
-
throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
|
|
240077
|
-
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
240078
|
-
});
|
|
240079
|
-
}
|
|
240080
|
-
return configPath;
|
|
240081
|
-
}
|
|
240082
|
-
function toResolvedAssetsConfig(assets) {
|
|
240083
|
-
return {
|
|
240084
|
-
htmlHandling: assets.html_handling,
|
|
240085
|
-
notFoundHandling: assets.not_found_handling,
|
|
240086
|
-
runWorkerFirst: assets.run_worker_first,
|
|
240087
|
-
headers: assets.headers,
|
|
240088
|
-
redirects: assets.redirects
|
|
240089
|
-
};
|
|
240090
|
-
}
|
|
240091
|
-
|
|
240092
240121
|
// src/core/site/deployment.ts
|
|
240093
240122
|
var NO_ASSETS = { manifest: {}, filesByHash: new Map };
|
|
240094
240123
|
var DEPLOYMENTS_API_ENV = "BASE44_DEPLOYMENTS_API";
|
|
@@ -240115,12 +240144,11 @@ async function deployToDeployments(options) {
|
|
|
240115
240144
|
return { deploymentId: finalized.deploymentId, gitHash };
|
|
240116
240145
|
}
|
|
240117
240146
|
async function resolveWorkerBuild(projectRoot, progress) {
|
|
240118
|
-
const
|
|
240119
|
-
if (!
|
|
240147
|
+
const built = await resolveFullStackBuild(projectRoot);
|
|
240148
|
+
if (!built) {
|
|
240120
240149
|
return null;
|
|
240121
240150
|
}
|
|
240122
|
-
const config =
|
|
240123
|
-
const assetsDir = config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null;
|
|
240151
|
+
const { config, modules, assetsDir } = built;
|
|
240124
240152
|
return {
|
|
240125
240153
|
config: {
|
|
240126
240154
|
main: config.main,
|
|
@@ -240128,7 +240156,7 @@ async function resolveWorkerBuild(projectRoot, progress) {
|
|
|
240128
240156
|
compatibility_flags: config.compatibilityFlags,
|
|
240129
240157
|
assets: buildAssetsConfig(config.assetsConfig, progress)
|
|
240130
240158
|
},
|
|
240131
|
-
modules
|
|
240159
|
+
modules,
|
|
240132
240160
|
assetsDir
|
|
240133
240161
|
};
|
|
240134
240162
|
}
|
|
@@ -247048,6 +247076,12 @@ async function ensureAppContext(ctx, options = {}) {
|
|
|
247048
247076
|
ctx.app = appContext;
|
|
247049
247077
|
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
247050
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
|
+
}
|
|
247051
247085
|
|
|
247052
247086
|
// src/cli/utils/version-check.ts
|
|
247053
247087
|
async function checkForUpgrade() {
|
|
@@ -247244,17 +247278,24 @@ var CreateVersionResponseSchema = object({
|
|
|
247244
247278
|
versionId: data.version_id,
|
|
247245
247279
|
manifestHash: data.manifest_hash
|
|
247246
247280
|
}));
|
|
247247
|
-
var
|
|
247248
|
-
|
|
247249
|
-
|
|
247281
|
+
var EnvironmentResponseSchema = object({
|
|
247282
|
+
name: string2(),
|
|
247283
|
+
version_id: string2(),
|
|
247284
|
+
manifest_hash: string2(),
|
|
247285
|
+
deployment_id: string2()
|
|
247250
247286
|
}).transform((data) => ({
|
|
247251
|
-
|
|
247252
|
-
|
|
247287
|
+
name: data.name,
|
|
247288
|
+
versionId: data.version_id,
|
|
247289
|
+
manifestHash: data.manifest_hash,
|
|
247290
|
+
deploymentId: data.deployment_id
|
|
247253
247291
|
}));
|
|
247254
247292
|
|
|
247255
247293
|
// src/core/version/api.ts
|
|
247256
247294
|
var DEFAULT_VERSION_UPLOAD_CONCURRENCY = 8;
|
|
247257
247295
|
var MAX_VERSION_UPLOAD_CONCURRENCY = 16;
|
|
247296
|
+
function declaredFile({ path, size, digest }) {
|
|
247297
|
+
return { path, size, digest };
|
|
247298
|
+
}
|
|
247258
247299
|
async function post(path, json, doing) {
|
|
247259
247300
|
try {
|
|
247260
247301
|
return await getAppClient().post(path, { json, timeout: 180000 });
|
|
@@ -247262,6 +247303,13 @@ async function post(path, json, doing) {
|
|
|
247262
247303
|
throw await ApiError.fromHttpError(error, doing);
|
|
247263
247304
|
}
|
|
247264
247305
|
}
|
|
247306
|
+
async function patch(path, json, doing) {
|
|
247307
|
+
try {
|
|
247308
|
+
return await getAppClient().patch(path, { json, timeout: 180000 });
|
|
247309
|
+
} catch (error) {
|
|
247310
|
+
throw await ApiError.fromHttpError(error, doing);
|
|
247311
|
+
}
|
|
247312
|
+
}
|
|
247265
247313
|
function parse10(schema, body, what) {
|
|
247266
247314
|
const result = schema.safeParse(body);
|
|
247267
247315
|
if (!result.success) {
|
|
@@ -247271,49 +247319,51 @@ function parse10(schema, body, what) {
|
|
|
247271
247319
|
}
|
|
247272
247320
|
async function createVersion(artifacts, options = {}) {
|
|
247273
247321
|
const declared = parse10(DeclareVersionResponseSchema, await (await post("versions", {
|
|
247274
|
-
static_bundle: artifacts.files.map(
|
|
247275
|
-
|
|
247276
|
-
|
|
247277
|
-
|
|
247278
|
-
|
|
247322
|
+
static_bundle: artifacts.files.map(declaredFile),
|
|
247323
|
+
...artifacts.siteWorker ? {
|
|
247324
|
+
site_worker: {
|
|
247325
|
+
main: artifacts.siteWorker.main,
|
|
247326
|
+
modules: artifacts.siteWorker.modules.map(declaredFile),
|
|
247327
|
+
compatibility_date: artifacts.siteWorker.compatibilityDate,
|
|
247328
|
+
compatibility_flags: artifacts.siteWorker.compatibilityFlags
|
|
247329
|
+
}
|
|
247330
|
+
} : {},
|
|
247279
247331
|
entities: artifacts.entities,
|
|
247280
247332
|
agents: artifacts.agents,
|
|
247281
|
-
source_commit: options.sourceCommit
|
|
247282
|
-
frontend_commit: options.sourceCommit
|
|
247333
|
+
source_commit: options.sourceCommit
|
|
247283
247334
|
}, "declaring a version")).json(), "declare");
|
|
247335
|
+
const declaredFiles = [
|
|
247336
|
+
...artifacts.files,
|
|
247337
|
+
...artifacts.siteWorker?.modules ?? []
|
|
247338
|
+
];
|
|
247284
247339
|
options.progress?.onDeclared?.({
|
|
247285
|
-
fileCount:
|
|
247340
|
+
fileCount: declaredFiles.length,
|
|
247286
247341
|
owedFiles: declared.uploads.length
|
|
247287
247342
|
});
|
|
247288
|
-
|
|
247289
|
-
|
|
247290
|
-
|
|
247291
|
-
|
|
247292
|
-
|
|
247293
|
-
|
|
247294
|
-
|
|
247295
|
-
|
|
247296
|
-
|
|
247297
|
-
|
|
247298
|
-
|
|
247299
|
-
|
|
247300
|
-
}
|
|
247301
|
-
]))
|
|
247302
|
-
}, {
|
|
247303
|
-
concurrency: options.concurrency ?? DEFAULT_VERSION_UPLOAD_CONCURRENCY,
|
|
247304
|
-
onProgress: options.progress?.onUpload
|
|
247305
|
-
});
|
|
247343
|
+
if (declared.uploads.length !== declaredFiles.length) {
|
|
247344
|
+
throw new InternalError(`Declared ${declaredFiles.length} files but the server signed ${declared.uploads.length} upload URLs.`);
|
|
247345
|
+
}
|
|
247346
|
+
let uploadedFiles = 0;
|
|
247347
|
+
await pMap(declared.uploads, async (upload, index) => {
|
|
247348
|
+
await putPresigned(upload, declaredFiles[index].absolutePath);
|
|
247349
|
+
uploadedFiles++;
|
|
247350
|
+
options.progress?.onUpload?.({
|
|
247351
|
+
uploadedFiles,
|
|
247352
|
+
totalFiles: declared.uploads.length
|
|
247353
|
+
});
|
|
247354
|
+
}, { concurrency: options.concurrency ?? DEFAULT_VERSION_UPLOAD_CONCURRENCY });
|
|
247306
247355
|
return parse10(CreateVersionResponseSchema, await (await post(`versions/${encodeURIComponent(declared.sessionId)}/finalize`, {}, "creating a version")).json(), "create version");
|
|
247307
247356
|
}
|
|
247308
|
-
async function
|
|
247309
|
-
return parse10(
|
|
247310
|
-
|
|
247357
|
+
async function setEnvironmentVersion(environment, versionId, options = {}) {
|
|
247358
|
+
return parse10(EnvironmentResponseSchema, await (await patch(`environments/${encodeURIComponent(environment)}`, {
|
|
247359
|
+
version_id: versionId,
|
|
247311
247360
|
...options.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}
|
|
247312
|
-
}, "
|
|
247361
|
+
}, "setting the environment's version")).json(), "environment");
|
|
247313
247362
|
}
|
|
247314
247363
|
|
|
247315
247364
|
// src/core/version/publish.ts
|
|
247316
247365
|
var STEP = Symbol.for("base44.publishStep");
|
|
247366
|
+
var DEFAULT_ENVIRONMENT = "production";
|
|
247317
247367
|
async function tagStep(step, run) {
|
|
247318
247368
|
try {
|
|
247319
247369
|
return await run();
|
|
@@ -247333,11 +247383,15 @@ async function publishVersion(artifacts, options = {}) {
|
|
|
247333
247383
|
concurrency: options.concurrency,
|
|
247334
247384
|
progress: options.progress
|
|
247335
247385
|
}));
|
|
247336
|
-
const
|
|
247337
|
-
target: options.target,
|
|
247386
|
+
const environment = await tagStep("deploy", () => setEnvironmentVersion(options.target ?? DEFAULT_ENVIRONMENT, version.versionId, {
|
|
247338
247387
|
idempotencyKey: randomUUID4()
|
|
247339
247388
|
}));
|
|
247340
|
-
return {
|
|
247389
|
+
return {
|
|
247390
|
+
environment: environment.name,
|
|
247391
|
+
versionId: environment.versionId,
|
|
247392
|
+
manifestHash: environment.manifestHash,
|
|
247393
|
+
deploymentId: environment.deploymentId
|
|
247394
|
+
};
|
|
247341
247395
|
}
|
|
247342
247396
|
|
|
247343
247397
|
// src/cli/utils/command/Base44Command.ts
|
|
@@ -249705,56 +249759,54 @@ async function maybeAskToBuild(isNonInteractive, buildCommand) {
|
|
|
249705
249759
|
}
|
|
249706
249760
|
// src/core/version/artifacts.ts
|
|
249707
249761
|
import { createHash as createHash2 } from "node:crypto";
|
|
249708
|
-
import {
|
|
249709
|
-
|
|
249710
|
-
|
|
249711
|
-
var MAX_FILE_COUNT = 1e5;
|
|
249712
|
-
var ASSETS_IGNORE_FILE2 = ".assetsignore";
|
|
249713
|
-
var ALWAYS_IGNORED2 = new Set([
|
|
249714
|
-
ASSETS_IGNORE_FILE2,
|
|
249715
|
-
"wrangler.json",
|
|
249716
|
-
".dev.vars"
|
|
249717
|
-
]);
|
|
249762
|
+
import { join as join27, resolve as resolve10 } from "node:path";
|
|
249763
|
+
var MAX_FILE_COUNT = 50000;
|
|
249764
|
+
var HASH_CONCURRENCY = 32;
|
|
249718
249765
|
var ENTRY2 = "index.html";
|
|
249719
249766
|
async function digestFile(absolutePath) {
|
|
249720
|
-
const hash = createHash2("sha256");
|
|
249721
|
-
for await (const chunk of createReadStream3(absolutePath)) {
|
|
249722
|
-
hash.update(chunk);
|
|
249723
|
-
}
|
|
249767
|
+
const hash = await hashFileInto(createHash2("sha256"), absolutePath);
|
|
249724
249768
|
return `sha256:${hash.digest("hex")}`;
|
|
249725
249769
|
}
|
|
249726
|
-
async function collectBuildOutput(outputDir) {
|
|
249727
|
-
const found = await
|
|
249728
|
-
|
|
249729
|
-
dot: true,
|
|
249730
|
-
onlyFiles: true,
|
|
249731
|
-
followSymbolicLinks: false,
|
|
249732
|
-
ignoreFiles: [ASSETS_IGNORE_FILE2]
|
|
249733
|
-
});
|
|
249734
|
-
const relativePaths = found.filter((path) => !ALWAYS_IGNORED2.has(basename6(path))).sort();
|
|
249735
|
-
if (relativePaths.length === 0) {
|
|
249770
|
+
async function collectBuildOutput(outputDir, options = {}) {
|
|
249771
|
+
const found = await describeBuildOutput(outputDir);
|
|
249772
|
+
if (found.length === 0) {
|
|
249736
249773
|
throw new InvalidInputError(`No files found in ${outputDir}. Build the site before creating a version.`, {
|
|
249737
249774
|
hints: [
|
|
249738
249775
|
{ message: "Run 'base44 build' first", command: "base44 build" }
|
|
249739
249776
|
]
|
|
249740
249777
|
});
|
|
249741
249778
|
}
|
|
249742
|
-
if (
|
|
249743
|
-
throw new InvalidInputError(`Too many files: found ${
|
|
249779
|
+
if (found.length > MAX_FILE_COUNT) {
|
|
249780
|
+
throw new InvalidInputError(`Too many files: found ${found.length}, the limit is ${MAX_FILE_COUNT}.`);
|
|
249744
249781
|
}
|
|
249745
|
-
if (!
|
|
249782
|
+
if (options.requireEntry !== false && !found.some((f) => f.path === ENTRY2)) {
|
|
249746
249783
|
throw new InvalidInputError(`${outputDir} has no ${ENTRY2}, so nothing could enter the site.`);
|
|
249747
249784
|
}
|
|
249748
|
-
return await
|
|
249749
|
-
|
|
249750
|
-
|
|
249751
|
-
|
|
249752
|
-
|
|
249785
|
+
return await pMap(found, async (file) => ({ ...file, digest: await digestFile(file.absolutePath) }), { concurrency: HASH_CONCURRENCY });
|
|
249786
|
+
}
|
|
249787
|
+
async function collectSiteWorker(projectRoot) {
|
|
249788
|
+
const built = await resolveFullStackBuild(projectRoot);
|
|
249789
|
+
if (!built) {
|
|
249790
|
+
return null;
|
|
249791
|
+
}
|
|
249792
|
+
const { config, modules, assetsDir } = built;
|
|
249793
|
+
const entry = resolve10(config.configDir, config.main);
|
|
249794
|
+
const main = modules.find((m) => m.absolutePath === entry)?.name;
|
|
249795
|
+
if (!main) {
|
|
249796
|
+
throw new InvalidInputError(`The Worker's entry module ${config.main} is not among the ${modules.length} modules collected from ${config.configDir}.`);
|
|
249797
|
+
}
|
|
249798
|
+
return {
|
|
249799
|
+
main,
|
|
249800
|
+
modules: await pMap(modules, async ({ name, absolutePath, size }) => ({
|
|
249801
|
+
path: name,
|
|
249753
249802
|
absolutePath,
|
|
249754
249803
|
size,
|
|
249755
249804
|
digest: await digestFile(absolutePath)
|
|
249756
|
-
}
|
|
249757
|
-
|
|
249805
|
+
}), { concurrency: HASH_CONCURRENCY }),
|
|
249806
|
+
compatibilityDate: config.compatibilityDate,
|
|
249807
|
+
compatibilityFlags: config.compatibilityFlags,
|
|
249808
|
+
assetsDir
|
|
249809
|
+
};
|
|
249758
249810
|
}
|
|
249759
249811
|
async function readRawResources(dir) {
|
|
249760
249812
|
if (!await pathExists(dir)) {
|
|
@@ -249786,7 +249838,7 @@ function versionsApiEnabled(env = process.env) {
|
|
|
249786
249838
|
return value === "1" || value === "true";
|
|
249787
249839
|
}
|
|
249788
249840
|
// src/core/version/project.ts
|
|
249789
|
-
import { dirname as dirname21, join as join28, resolve as
|
|
249841
|
+
import { dirname as dirname21, join as join28, resolve as resolve11 } from "node:path";
|
|
249790
249842
|
var DEFAULT_BUILD_COMMAND = "npm run build";
|
|
249791
249843
|
var DEFAULT_OUTPUT_DIRECTORY = "dist";
|
|
249792
249844
|
async function resolvePublishTarget(projectRoot, overrides = {}) {
|
|
@@ -249803,7 +249855,7 @@ async function resolvePublishTarget(projectRoot, overrides = {}) {
|
|
|
249803
249855
|
}
|
|
249804
249856
|
function outputDirectory(project, root, override) {
|
|
249805
249857
|
const configured = override ?? (project ? project.site?.outputDirectory : DEFAULT_OUTPUT_DIRECTORY);
|
|
249806
|
-
return configured ?
|
|
249858
|
+
return configured ? resolve11(root, configured) : null;
|
|
249807
249859
|
}
|
|
249808
249860
|
function requireOutputDir(target) {
|
|
249809
249861
|
if (target.outputDir === null) {
|
|
@@ -249830,15 +249882,15 @@ async function readSettingsIfPresent(projectRoot) {
|
|
|
249830
249882
|
}
|
|
249831
249883
|
// src/cli/commands/project/build.ts
|
|
249832
249884
|
async function buildAction(ctx) {
|
|
249833
|
-
const
|
|
249834
|
-
const target = await resolvePublishTarget(app
|
|
249885
|
+
const app = requireApp(ctx);
|
|
249886
|
+
const target = await resolvePublishTarget(app.projectRoot);
|
|
249835
249887
|
await runSiteBuild(ctx, {
|
|
249836
249888
|
root: target.root,
|
|
249837
249889
|
buildCommand: target.buildCommand,
|
|
249838
|
-
appId: app
|
|
249890
|
+
appId: app.id
|
|
249839
249891
|
});
|
|
249840
249892
|
return {
|
|
249841
|
-
outroMessage: `Site built with app id ${theme.styles.bold(app
|
|
249893
|
+
outroMessage: `Site built with app id ${theme.styles.bold(app.id)}`
|
|
249842
249894
|
};
|
|
249843
249895
|
}
|
|
249844
249896
|
function getBuildCommand() {
|
|
@@ -249846,7 +249898,7 @@ function getBuildCommand() {
|
|
|
249846
249898
|
}
|
|
249847
249899
|
|
|
249848
249900
|
// src/cli/commands/project/create.ts
|
|
249849
|
-
import { basename as
|
|
249901
|
+
import { basename as basename6, resolve as resolve12 } from "node:path";
|
|
249850
249902
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
249851
249903
|
|
|
249852
249904
|
// src/cli/commands/project/scaffold-shared.ts
|
|
@@ -250011,8 +250063,8 @@ async function createInteractive(options, ctx) {
|
|
|
250011
250063
|
name: () => {
|
|
250012
250064
|
return options.name ? Promise.resolve(options.name) : Ze({
|
|
250013
250065
|
message: "What is the name of your project?",
|
|
250014
|
-
placeholder:
|
|
250015
|
-
initialValue:
|
|
250066
|
+
placeholder: basename6(process.cwd()),
|
|
250067
|
+
initialValue: basename6(process.cwd()),
|
|
250016
250068
|
validate: (value) => {
|
|
250017
250069
|
if (!value || value.trim().length === 0) {
|
|
250018
250070
|
return "Every project deserves a name";
|
|
@@ -250042,7 +250094,7 @@ async function createInteractive(options, ctx) {
|
|
|
250042
250094
|
}, ctx);
|
|
250043
250095
|
}
|
|
250044
250096
|
async function createNonInteractive(options, ctx) {
|
|
250045
|
-
ctx.log.info(`Creating a new project at ${
|
|
250097
|
+
ctx.log.info(`Creating a new project at ${resolve12(options.path)}`);
|
|
250046
250098
|
const template = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
|
|
250047
250099
|
return await executeCreate({
|
|
250048
250100
|
template,
|
|
@@ -250066,7 +250118,7 @@ async function executeCreate({
|
|
|
250066
250118
|
}, ctx) {
|
|
250067
250119
|
const { log, runTask } = ctx;
|
|
250068
250120
|
const name = rawName.trim();
|
|
250069
|
-
const resolvedPath =
|
|
250121
|
+
const resolvedPath = resolve12(projectPath);
|
|
250070
250122
|
const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
|
|
250071
250123
|
const { projectId } = await runTask("Setting up your project...", async () => {
|
|
250072
250124
|
return await createProjectFiles({
|
|
@@ -250707,7 +250759,7 @@ function getLogsCommand() {
|
|
|
250707
250759
|
}
|
|
250708
250760
|
|
|
250709
250761
|
// src/cli/commands/project/scaffold.ts
|
|
250710
|
-
import { basename as
|
|
250762
|
+
import { basename as basename7, resolve as resolve13 } from "node:path";
|
|
250711
250763
|
function resolveAppId(options) {
|
|
250712
250764
|
const appId = options.appId;
|
|
250713
250765
|
if (!appId) {
|
|
@@ -250723,8 +250775,8 @@ function resolveAppId(options) {
|
|
|
250723
250775
|
async function scaffoldAction(ctx, name, options, command) {
|
|
250724
250776
|
const { log, runTask } = ctx;
|
|
250725
250777
|
const appId = resolveAppId(command.optsWithGlobals());
|
|
250726
|
-
const resolvedPath =
|
|
250727
|
-
const projectName = (name ??
|
|
250778
|
+
const resolvedPath = resolve13("./");
|
|
250779
|
+
const projectName = (name ?? basename7(resolvedPath)).trim();
|
|
250728
250780
|
const template = await getTemplateById("backend-only");
|
|
250729
250781
|
log.info(`Scaffolding project at ${resolvedPath}`);
|
|
250730
250782
|
const { projectId } = await runTask("Setting up your project...", async () => {
|
|
@@ -250798,24 +250850,31 @@ function concurrencyOption() {
|
|
|
250798
250850
|
|
|
250799
250851
|
// src/cli/commands/publish.ts
|
|
250800
250852
|
async function publishAction(ctx, options) {
|
|
250801
|
-
const { runTask, log, jsonMode
|
|
250802
|
-
const
|
|
250853
|
+
const { runTask, log, jsonMode } = ctx;
|
|
250854
|
+
const app = requireApp(ctx);
|
|
250855
|
+
const target = await resolvePublishTarget(app.projectRoot, {
|
|
250803
250856
|
outputDir: options.outputDir
|
|
250804
250857
|
});
|
|
250805
250858
|
if (options.build !== false) {
|
|
250806
250859
|
await tagStep("build", () => runSiteBuild(ctx, {
|
|
250807
250860
|
root: target.root,
|
|
250808
250861
|
buildCommand: target.buildCommand,
|
|
250809
|
-
appId: app
|
|
250862
|
+
appId: app.id
|
|
250810
250863
|
}));
|
|
250811
250864
|
}
|
|
250812
|
-
const outputDir = requireOutputDir(target);
|
|
250813
250865
|
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
250814
250866
|
const result = await runTask("Publishing...", async (updateMessage) => {
|
|
250815
|
-
const artifacts = {
|
|
250816
|
-
|
|
250817
|
-
|
|
250818
|
-
|
|
250867
|
+
const artifacts = await tagStep("create_version", async () => {
|
|
250868
|
+
const siteWorker = await collectSiteWorker(target.root);
|
|
250869
|
+
const assetsDir = siteWorker ? siteWorker.assetsDir : requireOutputDir(target);
|
|
250870
|
+
return {
|
|
250871
|
+
files: assetsDir ? await collectBuildOutput(assetsDir, {
|
|
250872
|
+
requireEntry: siteWorker === null
|
|
250873
|
+
}) : [],
|
|
250874
|
+
...siteWorker ? { siteWorker } : {},
|
|
250875
|
+
...await collectResources(target.configDir, target)
|
|
250876
|
+
};
|
|
250877
|
+
});
|
|
250819
250878
|
return await publishVersion(artifacts, {
|
|
250820
250879
|
sourceCommit: gitHash,
|
|
250821
250880
|
target: options.target,
|
|
@@ -250830,7 +250889,7 @@ async function publishAction(ctx, options) {
|
|
|
250830
250889
|
log.message(theme.styles.dim(`version ${result.versionId}`));
|
|
250831
250890
|
}
|
|
250832
250891
|
return {
|
|
250833
|
-
outroMessage:
|
|
250892
|
+
outroMessage: `${result.environment} now serves ${result.versionId}`,
|
|
250834
250893
|
stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
|
|
250835
250894
|
` : undefined
|
|
250836
250895
|
};
|
|
@@ -251208,7 +251267,7 @@ function getSecretsListCommand() {
|
|
|
251208
251267
|
}
|
|
251209
251268
|
|
|
251210
251269
|
// src/cli/commands/secrets/set.ts
|
|
251211
|
-
import { resolve as
|
|
251270
|
+
import { resolve as resolve14 } from "node:path";
|
|
251212
251271
|
function parseEntries(entries) {
|
|
251213
251272
|
const secrets = {};
|
|
251214
251273
|
for (const entry of entries) {
|
|
@@ -251239,7 +251298,7 @@ async function setSecretsAction({ log, runTask }, entries, options) {
|
|
|
251239
251298
|
validateInput(entries, options);
|
|
251240
251299
|
let secrets;
|
|
251241
251300
|
if (options.envFile) {
|
|
251242
|
-
secrets = await parseEnvFile(
|
|
251301
|
+
secrets = await parseEnvFile(resolve14(options.envFile));
|
|
251243
251302
|
if (Object.keys(secrets).length === 0) {
|
|
251244
251303
|
throw new InvalidInputError("The env file contains no valid KEY=VALUE entries.");
|
|
251245
251304
|
}
|
|
@@ -251268,7 +251327,7 @@ function getSecretsCommand() {
|
|
|
251268
251327
|
}
|
|
251269
251328
|
|
|
251270
251329
|
// src/cli/commands/site/deploy.ts
|
|
251271
|
-
import { resolve as
|
|
251330
|
+
import { resolve as resolve15 } from "node:path";
|
|
251272
251331
|
async function deployAction2(ctx, options) {
|
|
251273
251332
|
const { isNonInteractive } = ctx;
|
|
251274
251333
|
if (isNonInteractive && !options.yes) {
|
|
@@ -251346,7 +251405,7 @@ async function deployTarball({ runTask }, project) {
|
|
|
251346
251405
|
}
|
|
251347
251406
|
function siteOutputDir(project) {
|
|
251348
251407
|
const outputDirectory = project.site?.outputDirectory;
|
|
251349
|
-
return outputDirectory ?
|
|
251408
|
+
return outputDirectory ? resolve15(project.root, outputDirectory) : null;
|
|
251350
251409
|
}
|
|
251351
251410
|
function getSiteDeployCommand() {
|
|
251352
251411
|
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)");
|
|
@@ -251563,18 +251622,21 @@ function getVersionCreateCommand() {
|
|
|
251563
251622
|
// src/cli/commands/versions/deploy.ts
|
|
251564
251623
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
251565
251624
|
async function deployAction3({ runTask, jsonMode }, versionId, options) {
|
|
251566
|
-
const
|
|
251567
|
-
|
|
251625
|
+
const environment = options.target ?? DEFAULT_ENVIRONMENT;
|
|
251626
|
+
const result = await runTask(`Pointing ${environment} at ${versionId}...`, async () => await setEnvironmentVersion(environment, versionId, {
|
|
251568
251627
|
idempotencyKey: randomUUID5()
|
|
251569
|
-
}), {
|
|
251628
|
+
}), {
|
|
251629
|
+
successMessage: "Environment updated",
|
|
251630
|
+
errorMessage: "Could not update the environment"
|
|
251631
|
+
});
|
|
251570
251632
|
return {
|
|
251571
|
-
outroMessage:
|
|
251572
|
-
stdout: jsonMode ? `${JSON.stringify(
|
|
251633
|
+
outroMessage: `${result.name} now serves ${result.versionId}`,
|
|
251634
|
+
stdout: jsonMode ? `${JSON.stringify(result, null, 2)}
|
|
251573
251635
|
` : undefined
|
|
251574
251636
|
};
|
|
251575
251637
|
}
|
|
251576
251638
|
function getVersionDeployCommand() {
|
|
251577
|
-
return new Base44Command("deploy").description("
|
|
251639
|
+
return new Base44Command("deploy").description("Point an environment at an already-recorded version (also the rollback)").argument("<version-id>", "The version to serve").option("--target <name>", "Environment to point at it").action(deployAction3);
|
|
251578
251640
|
}
|
|
251579
251641
|
|
|
251580
251642
|
// src/cli/commands/versions/index.ts
|
|
@@ -253905,11 +253967,11 @@ import { relative as relative9 } from "node:path";
|
|
|
253905
253967
|
// ../../node_modules/chokidar/index.js
|
|
253906
253968
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
253907
253969
|
import { stat as statcb, Stats } from "node:fs";
|
|
253908
|
-
import { readdir as readdir3, stat as
|
|
253970
|
+
import { readdir as readdir3, stat as stat6 } from "node:fs/promises";
|
|
253909
253971
|
import * as sp3 from "node:path";
|
|
253910
253972
|
|
|
253911
253973
|
// ../../node_modules/readdirp/index.js
|
|
253912
|
-
import { lstat as lstat2, readdir as readdir2, realpath, stat as
|
|
253974
|
+
import { lstat as lstat2, readdir as readdir2, realpath, stat as stat4 } from "node:fs/promises";
|
|
253913
253975
|
import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
|
|
253914
253976
|
import { Readable as Readable6 } from "node:stream";
|
|
253915
253977
|
var EntryTypes = {
|
|
@@ -253991,7 +254053,7 @@ class ReaddirpStream extends Readable6 {
|
|
|
253991
254053
|
const { root, type } = opts;
|
|
253992
254054
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
253993
254055
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
253994
|
-
const statMethod = opts.lstat ? lstat2 :
|
|
254056
|
+
const statMethod = opts.lstat ? lstat2 : stat4;
|
|
253995
254057
|
if (wantBigintFsStats) {
|
|
253996
254058
|
this._stat = (path) => statMethod(path, { bigint: true });
|
|
253997
254059
|
} else {
|
|
@@ -254144,7 +254206,7 @@ function readdirp(root, options = {}) {
|
|
|
254144
254206
|
|
|
254145
254207
|
// ../../node_modules/chokidar/handler.js
|
|
254146
254208
|
import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
|
|
254147
|
-
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as
|
|
254209
|
+
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat5 } from "node:fs/promises";
|
|
254148
254210
|
import { type as osType } from "node:os";
|
|
254149
254211
|
import * as sp2 from "node:path";
|
|
254150
254212
|
var STR_DATA = "data";
|
|
@@ -254170,7 +254232,7 @@ var EVENTS = {
|
|
|
254170
254232
|
};
|
|
254171
254233
|
var EV = EVENTS;
|
|
254172
254234
|
var THROTTLE_MODE_WATCH = "watch";
|
|
254173
|
-
var statMethods = { lstat: lstat3, stat:
|
|
254235
|
+
var statMethods = { lstat: lstat3, stat: stat5 };
|
|
254174
254236
|
var KEY_LISTENERS = "listeners";
|
|
254175
254237
|
var KEY_ERR = "errHandlers";
|
|
254176
254238
|
var KEY_RAW = "rawEmitters";
|
|
@@ -254641,7 +254703,7 @@ class NodeFsHandler {
|
|
|
254641
254703
|
return;
|
|
254642
254704
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
254643
254705
|
try {
|
|
254644
|
-
const newStats = await
|
|
254706
|
+
const newStats = await stat5(file);
|
|
254645
254707
|
if (this.fsw.closed)
|
|
254646
254708
|
return;
|
|
254647
254709
|
const at = newStats.atimeMs;
|
|
@@ -255313,7 +255375,7 @@ class FSWatcher extends EventEmitter3 {
|
|
|
255313
255375
|
const fullPath = opts.cwd ? sp3.join(opts.cwd, path) : path;
|
|
255314
255376
|
let stats;
|
|
255315
255377
|
try {
|
|
255316
|
-
stats = await
|
|
255378
|
+
stats = await stat6(fullPath);
|
|
255317
255379
|
} catch (err) {}
|
|
255318
255380
|
if (!stats || this.closed)
|
|
255319
255381
|
return;
|
|
@@ -256095,7 +256157,7 @@ Examples:
|
|
|
256095
256157
|
}
|
|
256096
256158
|
|
|
256097
256159
|
// src/cli/commands/project/eject.ts
|
|
256098
|
-
import { resolve as
|
|
256160
|
+
import { resolve as resolve19 } from "node:path";
|
|
256099
256161
|
var import_kebabCase2 = __toESM(require_kebabCase(), 1);
|
|
256100
256162
|
async function eject(ctx, options, command) {
|
|
256101
256163
|
const { log, runTask, isNonInteractive } = ctx;
|
|
@@ -256159,7 +256221,7 @@ async function eject(ctx, options, command) {
|
|
|
256159
256221
|
Ne("Operation cancelled.");
|
|
256160
256222
|
throw new CLIExitError(0);
|
|
256161
256223
|
}
|
|
256162
|
-
const resolvedPath =
|
|
256224
|
+
const resolvedPath = resolve19(selectedPath);
|
|
256163
256225
|
await runTask("Downloading your project's code...", async (updateMessage) => {
|
|
256164
256226
|
await createProjectFilesForExistingProject({
|
|
256165
256227
|
projectId,
|
|
@@ -258303,7 +258365,7 @@ class ReduceableCache {
|
|
|
258303
258365
|
}
|
|
258304
258366
|
}
|
|
258305
258367
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
|
|
258306
|
-
import { createReadStream as
|
|
258368
|
+
import { createReadStream as createReadStream3 } from "node:fs";
|
|
258307
258369
|
import { createInterface as createInterface2 } from "node:readline";
|
|
258308
258370
|
var LRU_FILE_CONTENTS_CACHE = new ReduceableCache(25);
|
|
258309
258371
|
var LRU_FILE_CONTENTS_FS_READ_FAILED = new ReduceableCache(20);
|
|
@@ -258347,7 +258409,7 @@ async function addSourceContext(frames) {
|
|
|
258347
258409
|
}
|
|
258348
258410
|
function getContextLinesFromFile(path, ranges, output) {
|
|
258349
258411
|
return new Promise((resolve) => {
|
|
258350
|
-
const stream =
|
|
258412
|
+
const stream = createReadStream3(path);
|
|
258351
258413
|
const lineReaded = createInterface2({
|
|
258352
258414
|
input: stream
|
|
258353
258415
|
});
|
|
@@ -260298,4 +260360,4 @@ export {
|
|
|
260298
260360
|
runCLI
|
|
260299
260361
|
};
|
|
260300
260362
|
|
|
260301
|
-
//# debugId=
|
|
260363
|
+
//# debugId=049BFBB8889BAA6E64756E2164756E21
|