@base44-preview/cli 0.1.15-pr.626.da7a7d8 → 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 +236 -220
- package/dist/cli/index.js.map +12 -11
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -239590,94 +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 walkBuildOutput(outputDir) {
|
|
239639
|
-
const found = await globby("**/*", {
|
|
239640
|
-
cwd: outputDir,
|
|
239641
|
-
dot: true,
|
|
239642
|
-
onlyFiles: true,
|
|
239643
|
-
followSymbolicLinks: false,
|
|
239644
|
-
ignoreFiles: [ASSETS_IGNORE_FILE]
|
|
239645
|
-
});
|
|
239646
|
-
return found.filter((path) => !ALWAYS_IGNORED.has(basename5(path))).sort();
|
|
239647
|
-
}
|
|
239648
|
-
async function hashAssetFile(appId, absolutePath) {
|
|
239649
|
-
const hash = createHash("sha256").update(Buffer.from(appId, "utf8"));
|
|
239650
|
-
for await (const chunk of createReadStream(absolutePath)) {
|
|
239651
|
-
hash.update(chunk);
|
|
239652
|
-
}
|
|
239653
|
-
return hash.digest("hex").slice(0, 32);
|
|
239654
|
-
}
|
|
239655
|
-
async function buildAssetManifest(assetsDir, appId) {
|
|
239656
|
-
const manifest = {};
|
|
239657
|
-
const filesByHash = new Map;
|
|
239658
|
-
const relativeFilePaths = await walkBuildOutput(assetsDir);
|
|
239659
|
-
if (relativeFilePaths.length > MAX_ASSET_COUNT) {
|
|
239660
|
-
throw new InvalidInputError(`Too many static assets: found ${relativeFilePaths.length}, the limit is ${MAX_ASSET_COUNT} files.`);
|
|
239661
|
-
}
|
|
239662
|
-
for (const relativePath of relativeFilePaths) {
|
|
239663
|
-
const absolutePath = join16(assetsDir, ...relativePath.split("/"));
|
|
239664
|
-
const { size } = await stat(absolutePath);
|
|
239665
|
-
const hash = await hashAssetFile(appId, absolutePath);
|
|
239666
|
-
manifest[`/${relativePath}`] = { hash, size };
|
|
239667
|
-
if (!filesByHash.has(hash)) {
|
|
239668
|
-
filesByHash.set(hash, {
|
|
239669
|
-
absolutePath,
|
|
239670
|
-
hash,
|
|
239671
|
-
size,
|
|
239672
|
-
contentType: getAssetContentType(absolutePath)
|
|
239673
|
-
});
|
|
239674
|
-
}
|
|
239675
|
-
}
|
|
239676
|
-
return { manifest, filesByHash };
|
|
239677
|
-
}
|
|
239678
|
-
|
|
239679
239593
|
// src/core/site/modules.ts
|
|
239680
|
-
import { stat
|
|
239594
|
+
import { stat } from "node:fs/promises";
|
|
239681
239595
|
import { relative as relative5, resolve as resolve3, sep } from "node:path";
|
|
239682
239596
|
var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
|
|
239683
239597
|
var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
|
|
@@ -239752,7 +239666,7 @@ async function collectModules(config) {
|
|
|
239752
239666
|
const modules = [...modulesByName.values()];
|
|
239753
239667
|
let totalBytes = 0;
|
|
239754
239668
|
for (const module of modules) {
|
|
239755
|
-
module.size = (await
|
|
239669
|
+
module.size = (await stat(module.absolutePath)).size;
|
|
239756
239670
|
totalBytes += module.size;
|
|
239757
239671
|
}
|
|
239758
239672
|
if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
|
|
@@ -239771,8 +239685,104 @@ function addSourcemap(modulesByName, configDir, name) {
|
|
|
239771
239685
|
});
|
|
239772
239686
|
}
|
|
239773
239687
|
|
|
239774
|
-
// src/core/site/
|
|
239775
|
-
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";
|
|
239776
239786
|
|
|
239777
239787
|
// ../../node_modules/p-map/index.js
|
|
239778
239788
|
async function pMap(iterable, mapper, {
|
|
@@ -239898,7 +239908,99 @@ async function pMap(iterable, mapper, {
|
|
|
239898
239908
|
}
|
|
239899
239909
|
var pMapSkip = Symbol("skip");
|
|
239900
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
|
+
|
|
239901
240002
|
// src/core/site/upload.ts
|
|
240003
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
239902
240004
|
var DEFAULT_UPLOAD_CONCURRENCY = 3;
|
|
239903
240005
|
var MAX_UPLOAD_CONCURRENCY = 50;
|
|
239904
240006
|
var MAX_UPLOAD_ATTEMPTS = 3;
|
|
@@ -240016,85 +240118,6 @@ async function putPresigned(upload, absolutePath) {
|
|
|
240016
240118
|
}
|
|
240017
240119
|
}
|
|
240018
240120
|
|
|
240019
|
-
// src/core/site/wrangler-config.ts
|
|
240020
|
-
import { dirname as dirname12, join as join17, resolve as resolve4 } from "node:path";
|
|
240021
|
-
var WRANGLER_REDIRECT_PATH = join17(".wrangler", "deploy", "config.json");
|
|
240022
|
-
var RedirectConfigSchema = looseObject({
|
|
240023
|
-
configPath: string2().min(1)
|
|
240024
|
-
});
|
|
240025
|
-
var WranglerConfigSchema = looseObject({
|
|
240026
|
-
main: string2().min(1, "wrangler config is missing a 'main' entry module"),
|
|
240027
|
-
no_bundle: boolean2().optional(),
|
|
240028
|
-
rules: array(looseObject({ type: string2(), globs: array(string2()) })).optional(),
|
|
240029
|
-
assets: looseObject({
|
|
240030
|
-
directory: string2().optional(),
|
|
240031
|
-
html_handling: string2().optional(),
|
|
240032
|
-
not_found_handling: string2().optional(),
|
|
240033
|
-
run_worker_first: union([boolean2(), array(string2())]).optional(),
|
|
240034
|
-
headers: string2().optional(),
|
|
240035
|
-
redirects: string2().optional()
|
|
240036
|
-
}).optional(),
|
|
240037
|
-
compatibility_date: string2().optional(),
|
|
240038
|
-
compatibility_flags: array(string2()).optional(),
|
|
240039
|
-
vars: record(string2(), unknown()).optional(),
|
|
240040
|
-
upload_source_maps: boolean2().optional()
|
|
240041
|
-
});
|
|
240042
|
-
async function detectFullStackArtifact(projectRoot) {
|
|
240043
|
-
const redirectPath = join17(projectRoot, WRANGLER_REDIRECT_PATH);
|
|
240044
|
-
return await pathExists(redirectPath) ? redirectPath : null;
|
|
240045
|
-
}
|
|
240046
|
-
async function resolveWranglerConfig(redirectPath) {
|
|
240047
|
-
const configPath = await resolveRedirectedConfigPath(redirectPath);
|
|
240048
|
-
const parsed = await readJsonFile(configPath);
|
|
240049
|
-
const result = WranglerConfigSchema.safeParse(parsed);
|
|
240050
|
-
if (!result.success) {
|
|
240051
|
-
throw new ConfigInvalidError(`Invalid wrangler config: ${prettifyError(result.error)}`, configPath);
|
|
240052
|
-
}
|
|
240053
|
-
const config = result.data;
|
|
240054
|
-
if (config.no_bundle !== true) {
|
|
240055
|
-
throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 only deploys pre-bundled Workers output (no_bundle: true).");
|
|
240056
|
-
}
|
|
240057
|
-
const configDir = dirname12(configPath);
|
|
240058
|
-
const assetsDirectory = config.assets?.directory ? resolve4(configDir, config.assets.directory) : null;
|
|
240059
|
-
return {
|
|
240060
|
-
configPath,
|
|
240061
|
-
configDir,
|
|
240062
|
-
main: config.main,
|
|
240063
|
-
assetsDirectory,
|
|
240064
|
-
assetsConfig: config.assets ? toResolvedAssetsConfig(config.assets) : null,
|
|
240065
|
-
compatibilityDate: config.compatibility_date ?? null,
|
|
240066
|
-
compatibilityFlags: config.compatibility_flags ?? [],
|
|
240067
|
-
rules: (config.rules ?? []).map((rule) => ({
|
|
240068
|
-
type: rule.type,
|
|
240069
|
-
globs: rule.globs
|
|
240070
|
-
})),
|
|
240071
|
-
uploadSourceMaps: config.upload_source_maps ?? false
|
|
240072
|
-
};
|
|
240073
|
-
}
|
|
240074
|
-
async function resolveRedirectedConfigPath(redirectPath) {
|
|
240075
|
-
const parsed = await readJsonFile(redirectPath);
|
|
240076
|
-
const result = RedirectConfigSchema.safeParse(parsed);
|
|
240077
|
-
if (!result.success) {
|
|
240078
|
-
throw new ConfigInvalidError(`Invalid deploy redirect file: ${prettifyError(result.error)}`, redirectPath);
|
|
240079
|
-
}
|
|
240080
|
-
const configPath = resolve4(dirname12(redirectPath), result.data.configPath);
|
|
240081
|
-
if (!await pathExists(configPath)) {
|
|
240082
|
-
throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
|
|
240083
|
-
hints: [{ message: "Rebuild the project to regenerate the artifact" }]
|
|
240084
|
-
});
|
|
240085
|
-
}
|
|
240086
|
-
return configPath;
|
|
240087
|
-
}
|
|
240088
|
-
function toResolvedAssetsConfig(assets) {
|
|
240089
|
-
return {
|
|
240090
|
-
htmlHandling: assets.html_handling,
|
|
240091
|
-
notFoundHandling: assets.not_found_handling,
|
|
240092
|
-
runWorkerFirst: assets.run_worker_first,
|
|
240093
|
-
headers: assets.headers,
|
|
240094
|
-
redirects: assets.redirects
|
|
240095
|
-
};
|
|
240096
|
-
}
|
|
240097
|
-
|
|
240098
240121
|
// src/core/site/deployment.ts
|
|
240099
240122
|
var NO_ASSETS = { manifest: {}, filesByHash: new Map };
|
|
240100
240123
|
var DEPLOYMENTS_API_ENV = "BASE44_DEPLOYMENTS_API";
|
|
@@ -240121,12 +240144,11 @@ async function deployToDeployments(options) {
|
|
|
240121
240144
|
return { deploymentId: finalized.deploymentId, gitHash };
|
|
240122
240145
|
}
|
|
240123
240146
|
async function resolveWorkerBuild(projectRoot, progress) {
|
|
240124
|
-
const
|
|
240125
|
-
if (!
|
|
240147
|
+
const built = await resolveFullStackBuild(projectRoot);
|
|
240148
|
+
if (!built) {
|
|
240126
240149
|
return null;
|
|
240127
240150
|
}
|
|
240128
|
-
const config =
|
|
240129
|
-
const assetsDir = config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null;
|
|
240151
|
+
const { config, modules, assetsDir } = built;
|
|
240130
240152
|
return {
|
|
240131
240153
|
config: {
|
|
240132
240154
|
main: config.main,
|
|
@@ -240134,7 +240156,7 @@ async function resolveWorkerBuild(projectRoot, progress) {
|
|
|
240134
240156
|
compatibility_flags: config.compatibilityFlags,
|
|
240135
240157
|
assets: buildAssetsConfig(config.assetsConfig, progress)
|
|
240136
240158
|
},
|
|
240137
|
-
modules
|
|
240159
|
+
modules,
|
|
240138
240160
|
assetsDir
|
|
240139
240161
|
};
|
|
240140
240162
|
}
|
|
@@ -247054,6 +247076,12 @@ async function ensureAppContext(ctx, options = {}) {
|
|
|
247054
247076
|
ctx.app = appContext;
|
|
247055
247077
|
ctx.errorReporter.setContext({ appId: appContext.id });
|
|
247056
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
|
+
}
|
|
247057
247085
|
|
|
247058
247086
|
// src/cli/utils/version-check.ts
|
|
247059
247087
|
async function checkForUpgrade() {
|
|
@@ -249731,52 +249759,37 @@ async function maybeAskToBuild(isNonInteractive, buildCommand) {
|
|
|
249731
249759
|
}
|
|
249732
249760
|
// src/core/version/artifacts.ts
|
|
249733
249761
|
import { createHash as createHash2 } from "node:crypto";
|
|
249734
|
-
import { createReadStream as createReadStream3 } from "node:fs";
|
|
249735
|
-
import { stat as stat3 } from "node:fs/promises";
|
|
249736
249762
|
import { join as join27, resolve as resolve10 } from "node:path";
|
|
249737
249763
|
var MAX_FILE_COUNT = 50000;
|
|
249738
249764
|
var HASH_CONCURRENCY = 32;
|
|
249739
249765
|
var ENTRY2 = "index.html";
|
|
249740
249766
|
async function digestFile(absolutePath) {
|
|
249741
|
-
const hash = createHash2("sha256");
|
|
249742
|
-
for await (const chunk of createReadStream3(absolutePath)) {
|
|
249743
|
-
hash.update(chunk);
|
|
249744
|
-
}
|
|
249767
|
+
const hash = await hashFileInto(createHash2("sha256"), absolutePath);
|
|
249745
249768
|
return `sha256:${hash.digest("hex")}`;
|
|
249746
249769
|
}
|
|
249747
|
-
async function collectBuildOutput(outputDir) {
|
|
249748
|
-
const
|
|
249749
|
-
if (
|
|
249770
|
+
async function collectBuildOutput(outputDir, options = {}) {
|
|
249771
|
+
const found = await describeBuildOutput(outputDir);
|
|
249772
|
+
if (found.length === 0) {
|
|
249750
249773
|
throw new InvalidInputError(`No files found in ${outputDir}. Build the site before creating a version.`, {
|
|
249751
249774
|
hints: [
|
|
249752
249775
|
{ message: "Run 'base44 build' first", command: "base44 build" }
|
|
249753
249776
|
]
|
|
249754
249777
|
});
|
|
249755
249778
|
}
|
|
249756
|
-
if (
|
|
249757
|
-
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}.`);
|
|
249758
249781
|
}
|
|
249759
|
-
if (!
|
|
249782
|
+
if (options.requireEntry !== false && !found.some((f) => f.path === ENTRY2)) {
|
|
249760
249783
|
throw new InvalidInputError(`${outputDir} has no ${ENTRY2}, so nothing could enter the site.`);
|
|
249761
249784
|
}
|
|
249762
|
-
return await pMap(
|
|
249763
|
-
const absolutePath = join27(outputDir, ...path.split("/"));
|
|
249764
|
-
const { size } = await stat3(absolutePath);
|
|
249765
|
-
return {
|
|
249766
|
-
path,
|
|
249767
|
-
absolutePath,
|
|
249768
|
-
size,
|
|
249769
|
-
digest: await digestFile(absolutePath)
|
|
249770
|
-
};
|
|
249771
|
-
}, { concurrency: HASH_CONCURRENCY });
|
|
249785
|
+
return await pMap(found, async (file) => ({ ...file, digest: await digestFile(file.absolutePath) }), { concurrency: HASH_CONCURRENCY });
|
|
249772
249786
|
}
|
|
249773
249787
|
async function collectSiteWorker(projectRoot) {
|
|
249774
|
-
const
|
|
249775
|
-
if (!
|
|
249788
|
+
const built = await resolveFullStackBuild(projectRoot);
|
|
249789
|
+
if (!built) {
|
|
249776
249790
|
return null;
|
|
249777
249791
|
}
|
|
249778
|
-
const config =
|
|
249779
|
-
const modules = await collectModules(config);
|
|
249792
|
+
const { config, modules, assetsDir } = built;
|
|
249780
249793
|
const entry = resolve10(config.configDir, config.main);
|
|
249781
249794
|
const main = modules.find((m) => m.absolutePath === entry)?.name;
|
|
249782
249795
|
if (!main) {
|
|
@@ -249792,7 +249805,7 @@ async function collectSiteWorker(projectRoot) {
|
|
|
249792
249805
|
}), { concurrency: HASH_CONCURRENCY }),
|
|
249793
249806
|
compatibilityDate: config.compatibilityDate,
|
|
249794
249807
|
compatibilityFlags: config.compatibilityFlags,
|
|
249795
|
-
assetsDir
|
|
249808
|
+
assetsDir
|
|
249796
249809
|
};
|
|
249797
249810
|
}
|
|
249798
249811
|
async function readRawResources(dir) {
|
|
@@ -249869,15 +249882,15 @@ async function readSettingsIfPresent(projectRoot) {
|
|
|
249869
249882
|
}
|
|
249870
249883
|
// src/cli/commands/project/build.ts
|
|
249871
249884
|
async function buildAction(ctx) {
|
|
249872
|
-
const
|
|
249873
|
-
const target = await resolvePublishTarget(app
|
|
249885
|
+
const app = requireApp(ctx);
|
|
249886
|
+
const target = await resolvePublishTarget(app.projectRoot);
|
|
249874
249887
|
await runSiteBuild(ctx, {
|
|
249875
249888
|
root: target.root,
|
|
249876
249889
|
buildCommand: target.buildCommand,
|
|
249877
|
-
appId: app
|
|
249890
|
+
appId: app.id
|
|
249878
249891
|
});
|
|
249879
249892
|
return {
|
|
249880
|
-
outroMessage: `Site built with app id ${theme.styles.bold(app
|
|
249893
|
+
outroMessage: `Site built with app id ${theme.styles.bold(app.id)}`
|
|
249881
249894
|
};
|
|
249882
249895
|
}
|
|
249883
249896
|
function getBuildCommand() {
|
|
@@ -250837,24 +250850,27 @@ function concurrencyOption() {
|
|
|
250837
250850
|
|
|
250838
250851
|
// src/cli/commands/publish.ts
|
|
250839
250852
|
async function publishAction(ctx, options) {
|
|
250840
|
-
const { runTask, log, jsonMode
|
|
250841
|
-
const
|
|
250853
|
+
const { runTask, log, jsonMode } = ctx;
|
|
250854
|
+
const app = requireApp(ctx);
|
|
250855
|
+
const target = await resolvePublishTarget(app.projectRoot, {
|
|
250842
250856
|
outputDir: options.outputDir
|
|
250843
250857
|
});
|
|
250844
250858
|
if (options.build !== false) {
|
|
250845
250859
|
await tagStep("build", () => runSiteBuild(ctx, {
|
|
250846
250860
|
root: target.root,
|
|
250847
250861
|
buildCommand: target.buildCommand,
|
|
250848
|
-
appId: app
|
|
250862
|
+
appId: app.id
|
|
250849
250863
|
}));
|
|
250850
250864
|
}
|
|
250851
250865
|
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
250852
250866
|
const result = await runTask("Publishing...", async (updateMessage) => {
|
|
250853
250867
|
const artifacts = await tagStep("create_version", async () => {
|
|
250854
250868
|
const siteWorker = await collectSiteWorker(target.root);
|
|
250855
|
-
const
|
|
250869
|
+
const assetsDir = siteWorker ? siteWorker.assetsDir : requireOutputDir(target);
|
|
250856
250870
|
return {
|
|
250857
|
-
files: await collectBuildOutput(
|
|
250871
|
+
files: assetsDir ? await collectBuildOutput(assetsDir, {
|
|
250872
|
+
requireEntry: siteWorker === null
|
|
250873
|
+
}) : [],
|
|
250858
250874
|
...siteWorker ? { siteWorker } : {},
|
|
250859
250875
|
...await collectResources(target.configDir, target)
|
|
250860
250876
|
};
|
|
@@ -253951,11 +253967,11 @@ import { relative as relative9 } from "node:path";
|
|
|
253951
253967
|
// ../../node_modules/chokidar/index.js
|
|
253952
253968
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
253953
253969
|
import { stat as statcb, Stats } from "node:fs";
|
|
253954
|
-
import { readdir as readdir3, stat as
|
|
253970
|
+
import { readdir as readdir3, stat as stat6 } from "node:fs/promises";
|
|
253955
253971
|
import * as sp3 from "node:path";
|
|
253956
253972
|
|
|
253957
253973
|
// ../../node_modules/readdirp/index.js
|
|
253958
|
-
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";
|
|
253959
253975
|
import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
|
|
253960
253976
|
import { Readable as Readable6 } from "node:stream";
|
|
253961
253977
|
var EntryTypes = {
|
|
@@ -254037,7 +254053,7 @@ class ReaddirpStream extends Readable6 {
|
|
|
254037
254053
|
const { root, type } = opts;
|
|
254038
254054
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
254039
254055
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
254040
|
-
const statMethod = opts.lstat ? lstat2 :
|
|
254056
|
+
const statMethod = opts.lstat ? lstat2 : stat4;
|
|
254041
254057
|
if (wantBigintFsStats) {
|
|
254042
254058
|
this._stat = (path) => statMethod(path, { bigint: true });
|
|
254043
254059
|
} else {
|
|
@@ -254190,7 +254206,7 @@ function readdirp(root, options = {}) {
|
|
|
254190
254206
|
|
|
254191
254207
|
// ../../node_modules/chokidar/handler.js
|
|
254192
254208
|
import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
|
|
254193
|
-
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";
|
|
254194
254210
|
import { type as osType } from "node:os";
|
|
254195
254211
|
import * as sp2 from "node:path";
|
|
254196
254212
|
var STR_DATA = "data";
|
|
@@ -254216,7 +254232,7 @@ var EVENTS = {
|
|
|
254216
254232
|
};
|
|
254217
254233
|
var EV = EVENTS;
|
|
254218
254234
|
var THROTTLE_MODE_WATCH = "watch";
|
|
254219
|
-
var statMethods = { lstat: lstat3, stat:
|
|
254235
|
+
var statMethods = { lstat: lstat3, stat: stat5 };
|
|
254220
254236
|
var KEY_LISTENERS = "listeners";
|
|
254221
254237
|
var KEY_ERR = "errHandlers";
|
|
254222
254238
|
var KEY_RAW = "rawEmitters";
|
|
@@ -254687,7 +254703,7 @@ class NodeFsHandler {
|
|
|
254687
254703
|
return;
|
|
254688
254704
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
254689
254705
|
try {
|
|
254690
|
-
const newStats = await
|
|
254706
|
+
const newStats = await stat5(file);
|
|
254691
254707
|
if (this.fsw.closed)
|
|
254692
254708
|
return;
|
|
254693
254709
|
const at = newStats.atimeMs;
|
|
@@ -255359,7 +255375,7 @@ class FSWatcher extends EventEmitter3 {
|
|
|
255359
255375
|
const fullPath = opts.cwd ? sp3.join(opts.cwd, path) : path;
|
|
255360
255376
|
let stats;
|
|
255361
255377
|
try {
|
|
255362
|
-
stats = await
|
|
255378
|
+
stats = await stat6(fullPath);
|
|
255363
255379
|
} catch (err) {}
|
|
255364
255380
|
if (!stats || this.closed)
|
|
255365
255381
|
return;
|
|
@@ -258349,7 +258365,7 @@ class ReduceableCache {
|
|
|
258349
258365
|
}
|
|
258350
258366
|
}
|
|
258351
258367
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
|
|
258352
|
-
import { createReadStream as
|
|
258368
|
+
import { createReadStream as createReadStream3 } from "node:fs";
|
|
258353
258369
|
import { createInterface as createInterface2 } from "node:readline";
|
|
258354
258370
|
var LRU_FILE_CONTENTS_CACHE = new ReduceableCache(25);
|
|
258355
258371
|
var LRU_FILE_CONTENTS_FS_READ_FAILED = new ReduceableCache(20);
|
|
@@ -258393,7 +258409,7 @@ async function addSourceContext(frames) {
|
|
|
258393
258409
|
}
|
|
258394
258410
|
function getContextLinesFromFile(path, ranges, output) {
|
|
258395
258411
|
return new Promise((resolve) => {
|
|
258396
|
-
const stream =
|
|
258412
|
+
const stream = createReadStream3(path);
|
|
258397
258413
|
const lineReaded = createInterface2({
|
|
258398
258414
|
input: stream
|
|
258399
258415
|
});
|
|
@@ -260344,4 +260360,4 @@ export {
|
|
|
260344
260360
|
runCLI
|
|
260345
260361
|
};
|
|
260346
260362
|
|
|
260347
|
-
//# debugId=
|
|
260363
|
+
//# debugId=049BFBB8889BAA6E64756E2164756E21
|