@base44-preview/cli 0.1.15-pr.626.6dabe64 → 0.1.15-pr.626.71e30f2
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 +288 -295
- package/dist/cli/index.js.map +17 -18
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -239590,8 +239590,94 @@ 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/
|
|
239593
|
+
// src/core/site/manifest.ts
|
|
239594
|
+
import { createHash } from "node:crypto";
|
|
239595
|
+
import { createReadStream } from "node:fs";
|
|
239594
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
|
+
// src/core/site/modules.ts
|
|
239680
|
+
import { stat as stat2 } from "node:fs/promises";
|
|
239595
239681
|
import { relative as relative5, resolve as resolve3, sep } from "node:path";
|
|
239596
239682
|
var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
|
|
239597
239683
|
var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
|
|
@@ -239666,7 +239752,7 @@ async function collectModules(config) {
|
|
|
239666
239752
|
const modules = [...modulesByName.values()];
|
|
239667
239753
|
let totalBytes = 0;
|
|
239668
239754
|
for (const module of modules) {
|
|
239669
|
-
module.size = (await
|
|
239755
|
+
module.size = (await stat2(module.absolutePath)).size;
|
|
239670
239756
|
totalBytes += module.size;
|
|
239671
239757
|
}
|
|
239672
239758
|
if (totalBytes > MAX_TOTAL_MODULE_BYTES) {
|
|
@@ -239685,104 +239771,8 @@ function addSourcemap(modulesByName, configDir, name) {
|
|
|
239685
239771
|
});
|
|
239686
239772
|
}
|
|
239687
239773
|
|
|
239688
|
-
// src/core/site/
|
|
239689
|
-
import {
|
|
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";
|
|
239774
|
+
// src/core/site/upload.ts
|
|
239775
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
239786
239776
|
|
|
239787
239777
|
// ../../node_modules/p-map/index.js
|
|
239788
239778
|
async function pMap(iterable, mapper, {
|
|
@@ -239908,99 +239898,7 @@ async function pMap(iterable, mapper, {
|
|
|
239908
239898
|
}
|
|
239909
239899
|
var pMapSkip = Symbol("skip");
|
|
239910
239900
|
|
|
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
|
-
|
|
240002
239901
|
// src/core/site/upload.ts
|
|
240003
|
-
import { readFile as readFile2 } from "node:fs/promises";
|
|
240004
239902
|
var DEFAULT_UPLOAD_CONCURRENCY = 3;
|
|
240005
239903
|
var MAX_UPLOAD_CONCURRENCY = 50;
|
|
240006
239904
|
var MAX_UPLOAD_ATTEMPTS = 3;
|
|
@@ -240118,6 +240016,85 @@ async function putPresigned(upload, absolutePath) {
|
|
|
240118
240016
|
}
|
|
240119
240017
|
}
|
|
240120
240018
|
|
|
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
|
+
|
|
240121
240098
|
// src/core/site/deployment.ts
|
|
240122
240099
|
var NO_ASSETS = { manifest: {}, filesByHash: new Map };
|
|
240123
240100
|
var DEPLOYMENTS_API_ENV = "BASE44_DEPLOYMENTS_API";
|
|
@@ -240144,11 +240121,12 @@ async function deployToDeployments(options) {
|
|
|
240144
240121
|
return { deploymentId: finalized.deploymentId, gitHash };
|
|
240145
240122
|
}
|
|
240146
240123
|
async function resolveWorkerBuild(projectRoot, progress) {
|
|
240147
|
-
const
|
|
240148
|
-
if (!
|
|
240124
|
+
const redirectPath = await detectFullStackArtifact(projectRoot);
|
|
240125
|
+
if (!redirectPath) {
|
|
240149
240126
|
return null;
|
|
240150
240127
|
}
|
|
240151
|
-
const
|
|
240128
|
+
const config = await resolveWranglerConfig(redirectPath);
|
|
240129
|
+
const assetsDir = config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null;
|
|
240152
240130
|
return {
|
|
240153
240131
|
config: {
|
|
240154
240132
|
main: config.main,
|
|
@@ -240156,7 +240134,7 @@ async function resolveWorkerBuild(projectRoot, progress) {
|
|
|
240156
240134
|
compatibility_flags: config.compatibilityFlags,
|
|
240157
240135
|
assets: buildAssetsConfig(config.assetsConfig, progress)
|
|
240158
240136
|
},
|
|
240159
|
-
modules,
|
|
240137
|
+
modules: await collectModules(config),
|
|
240160
240138
|
assetsDir
|
|
240161
240139
|
};
|
|
240162
240140
|
}
|
|
@@ -247324,7 +247302,6 @@ async function createVersion(artifacts, options = {}) {
|
|
|
247324
247302
|
site_worker: {
|
|
247325
247303
|
main: artifacts.siteWorker.main,
|
|
247326
247304
|
modules: artifacts.siteWorker.modules.map(declaredFile),
|
|
247327
|
-
assets: artifacts.siteWorker.assets.map(declaredFile),
|
|
247328
247305
|
compatibility_date: artifacts.siteWorker.compatibilityDate,
|
|
247329
247306
|
compatibility_flags: artifacts.siteWorker.compatibilityFlags
|
|
247330
247307
|
}
|
|
@@ -247335,17 +247312,15 @@ async function createVersion(artifacts, options = {}) {
|
|
|
247335
247312
|
}, "declaring a version")).json(), "declare");
|
|
247336
247313
|
const declaredFiles = [
|
|
247337
247314
|
...artifacts.files,
|
|
247338
|
-
...artifacts.siteWorker?.modules ?? []
|
|
247339
|
-
...artifacts.siteWorker?.assets ?? []
|
|
247315
|
+
...artifacts.siteWorker?.modules ?? []
|
|
247340
247316
|
];
|
|
247341
|
-
options.progress?.onDeclared?.({
|
|
247317
|
+
options.progress?.onDeclared?.({
|
|
247318
|
+
fileCount: declaredFiles.length,
|
|
247319
|
+
owedFiles: declared.uploads.length
|
|
247320
|
+
});
|
|
247342
247321
|
if (declared.uploads.length !== declaredFiles.length) {
|
|
247343
247322
|
throw new InternalError(`Declared ${declaredFiles.length} files but the server signed ${declared.uploads.length} upload URLs.`);
|
|
247344
247323
|
}
|
|
247345
|
-
const drifted = declared.uploads.findIndex((upload, index) => upload.path !== declaredFiles[index].path);
|
|
247346
|
-
if (drifted !== -1) {
|
|
247347
|
-
throw new InternalError(`Upload ${drifted} is signed for ${declared.uploads[drifted].path}, but that slot declared ${declaredFiles[drifted].path}.`);
|
|
247348
|
-
}
|
|
247349
247324
|
let uploadedFiles = 0;
|
|
247350
247325
|
await pMap(declared.uploads, async (upload, index) => {
|
|
247351
247326
|
await putPresigned(upload, declaredFiles[index].absolutePath);
|
|
@@ -247371,7 +247346,7 @@ async function tagStep(step, run) {
|
|
|
247371
247346
|
try {
|
|
247372
247347
|
return await run();
|
|
247373
247348
|
} catch (error) {
|
|
247374
|
-
if (error !== null && typeof error === "object" && !(STEP in error)
|
|
247349
|
+
if (error !== null && typeof error === "object" && !(STEP in error)) {
|
|
247375
247350
|
Object.defineProperty(error, STEP, { value: step, enumerable: false });
|
|
247376
247351
|
}
|
|
247377
247352
|
throw error;
|
|
@@ -249762,84 +249737,53 @@ async function maybeAskToBuild(isNonInteractive, buildCommand) {
|
|
|
249762
249737
|
}
|
|
249763
249738
|
// src/core/version/artifacts.ts
|
|
249764
249739
|
import { createHash as createHash2 } from "node:crypto";
|
|
249765
|
-
import {
|
|
249766
|
-
|
|
249767
|
-
|
|
249768
|
-
import { dirname as dirname21, join as join27, resolve as resolve10 } from "node:path";
|
|
249769
|
-
var DEFAULT_BUILD_COMMAND = "npm run build";
|
|
249770
|
-
var DEFAULT_OUTPUT_DIRECTORY = "dist";
|
|
249771
|
-
async function resolvePublishTarget(projectRoot, overrides = {}) {
|
|
249772
|
-
const project = await readSettingsIfPresent(projectRoot);
|
|
249773
|
-
const root = project?.root ?? projectRoot ?? process.cwd();
|
|
249774
|
-
return {
|
|
249775
|
-
root,
|
|
249776
|
-
configDir: project ? dirname21(project.configPath) : join27(root, PROJECT_SUBDIR),
|
|
249777
|
-
buildCommand: project ? project.site?.buildCommand : DEFAULT_BUILD_COMMAND,
|
|
249778
|
-
outputDir: outputDirectory(project, root, overrides.outputDir),
|
|
249779
|
-
entitiesDir: project?.entitiesDir ?? "entities",
|
|
249780
|
-
agentsDir: project?.agentsDir ?? "agents"
|
|
249781
|
-
};
|
|
249782
|
-
}
|
|
249783
|
-
function outputDirectory(project, root, override) {
|
|
249784
|
-
const configured = override ?? (project ? project.site?.outputDirectory : DEFAULT_OUTPUT_DIRECTORY);
|
|
249785
|
-
return configured ? resolve10(root, configured) : null;
|
|
249786
|
-
}
|
|
249787
|
-
function requireOutputDir(target) {
|
|
249788
|
-
if (target.outputDir === null) {
|
|
249789
|
-
throw new ConfigNotFoundError("No site configuration found.", {
|
|
249790
|
-
hints: [
|
|
249791
|
-
{
|
|
249792
|
-
message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
|
|
249793
|
-
},
|
|
249794
|
-
{ message: `Or pass --output-dir <dir>, relative to ${target.root}` }
|
|
249795
|
-
]
|
|
249796
|
-
});
|
|
249797
|
-
}
|
|
249798
|
-
return target.outputDir;
|
|
249799
|
-
}
|
|
249800
|
-
async function readSettingsIfPresent(projectRoot) {
|
|
249801
|
-
try {
|
|
249802
|
-
return await readProjectSettings(projectRoot);
|
|
249803
|
-
} catch (error) {
|
|
249804
|
-
if (error instanceof ConfigNotFoundError) {
|
|
249805
|
-
return null;
|
|
249806
|
-
}
|
|
249807
|
-
throw error;
|
|
249808
|
-
}
|
|
249809
|
-
}
|
|
249810
|
-
|
|
249811
|
-
// src/core/version/artifacts.ts
|
|
249740
|
+
import { createReadStream as createReadStream3 } from "node:fs";
|
|
249741
|
+
import { stat as stat3 } from "node:fs/promises";
|
|
249742
|
+
import { join as join27, resolve as resolve10 } from "node:path";
|
|
249812
249743
|
var MAX_FILE_COUNT = 50000;
|
|
249813
249744
|
var HASH_CONCURRENCY = 32;
|
|
249814
249745
|
var ENTRY2 = "index.html";
|
|
249815
249746
|
async function digestFile(absolutePath) {
|
|
249816
|
-
const hash =
|
|
249747
|
+
const hash = createHash2("sha256");
|
|
249748
|
+
for await (const chunk of createReadStream3(absolutePath)) {
|
|
249749
|
+
hash.update(chunk);
|
|
249750
|
+
}
|
|
249817
249751
|
return `sha256:${hash.digest("hex")}`;
|
|
249818
249752
|
}
|
|
249819
249753
|
async function collectBuildOutput(outputDir, options = {}) {
|
|
249820
|
-
const
|
|
249821
|
-
if (
|
|
249754
|
+
const relativePaths = await walkBuildOutput(outputDir);
|
|
249755
|
+
if (relativePaths.length === 0) {
|
|
249822
249756
|
throw new InvalidInputError(`No files found in ${outputDir}. Build the site before creating a version.`, {
|
|
249823
249757
|
hints: [
|
|
249824
249758
|
{ message: "Run 'base44 build' first", command: "base44 build" }
|
|
249825
249759
|
]
|
|
249826
249760
|
});
|
|
249827
249761
|
}
|
|
249828
|
-
if (
|
|
249829
|
-
throw new InvalidInputError(`Too many files: found ${
|
|
249762
|
+
if (relativePaths.length > MAX_FILE_COUNT) {
|
|
249763
|
+
throw new InvalidInputError(`Too many files: found ${relativePaths.length}, the limit is ${MAX_FILE_COUNT}.`);
|
|
249830
249764
|
}
|
|
249831
|
-
if (options.requireEntry !== false && !
|
|
249765
|
+
if (options.requireEntry !== false && !relativePaths.includes(ENTRY2)) {
|
|
249832
249766
|
throw new InvalidInputError(`${outputDir} has no ${ENTRY2}, so nothing could enter the site.`);
|
|
249833
249767
|
}
|
|
249834
|
-
return await pMap(
|
|
249768
|
+
return await pMap(relativePaths, async (path) => {
|
|
249769
|
+
const absolutePath = join27(outputDir, ...path.split("/"));
|
|
249770
|
+
const { size } = await stat3(absolutePath);
|
|
249771
|
+
return {
|
|
249772
|
+
path,
|
|
249773
|
+
absolutePath,
|
|
249774
|
+
size,
|
|
249775
|
+
digest: await digestFile(absolutePath)
|
|
249776
|
+
};
|
|
249777
|
+
}, { concurrency: HASH_CONCURRENCY });
|
|
249835
249778
|
}
|
|
249836
249779
|
async function collectSiteWorker(projectRoot) {
|
|
249837
|
-
const
|
|
249838
|
-
if (!
|
|
249780
|
+
const redirectPath = await detectFullStackArtifact(projectRoot);
|
|
249781
|
+
if (!redirectPath) {
|
|
249839
249782
|
return null;
|
|
249840
249783
|
}
|
|
249841
|
-
const
|
|
249842
|
-
const
|
|
249784
|
+
const config = await resolveWranglerConfig(redirectPath);
|
|
249785
|
+
const modules = await collectModules(config);
|
|
249786
|
+
const entry = resolve10(config.configDir, config.main);
|
|
249843
249787
|
const main = modules.find((m) => m.absolutePath === entry)?.name;
|
|
249844
249788
|
if (!main) {
|
|
249845
249789
|
throw new InvalidInputError(`The Worker's entry module ${config.main} is not among the ${modules.length} modules collected from ${config.configDir}.`);
|
|
@@ -249852,9 +249796,9 @@ async function collectSiteWorker(projectRoot) {
|
|
|
249852
249796
|
size,
|
|
249853
249797
|
digest: await digestFile(absolutePath)
|
|
249854
249798
|
}), { concurrency: HASH_CONCURRENCY }),
|
|
249855
|
-
assets: assetsDir ? await collectBuildOutput(assetsDir, { requireEntry: false }) : [],
|
|
249856
249799
|
compatibilityDate: config.compatibilityDate,
|
|
249857
|
-
compatibilityFlags: config.compatibilityFlags
|
|
249800
|
+
compatibilityFlags: config.compatibilityFlags,
|
|
249801
|
+
assetsDir: config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null
|
|
249858
249802
|
};
|
|
249859
249803
|
}
|
|
249860
249804
|
async function readRawResources(dir) {
|
|
@@ -249869,31 +249813,66 @@ async function readRawResources(dir) {
|
|
|
249869
249813
|
const payloads = {};
|
|
249870
249814
|
for (const relativePath of files.sort()) {
|
|
249871
249815
|
const name = relativePath.replace(/\.jsonc?$/, "");
|
|
249872
|
-
payloads[name] = await readJsonFile(
|
|
249816
|
+
payloads[name] = await readJsonFile(join27(dir, ...relativePath.split("/")));
|
|
249873
249817
|
}
|
|
249874
249818
|
return payloads;
|
|
249875
249819
|
}
|
|
249876
249820
|
async function collectResources(configDir, dirs) {
|
|
249877
249821
|
const [entities, agents] = await Promise.all([
|
|
249878
|
-
readRawResources(
|
|
249879
|
-
readRawResources(
|
|
249822
|
+
readRawResources(join27(configDir, dirs.entitiesDir)),
|
|
249823
|
+
readRawResources(join27(configDir, dirs.agentsDir))
|
|
249880
249824
|
]);
|
|
249881
249825
|
return { entities, agents };
|
|
249882
249826
|
}
|
|
249883
|
-
async function collectArtifacts(target) {
|
|
249884
|
-
const siteWorker = await collectSiteWorker(target.root);
|
|
249885
|
-
return {
|
|
249886
|
-
files: siteWorker ? [] : await collectBuildOutput(requireOutputDir(target)),
|
|
249887
|
-
...siteWorker ? { siteWorker } : {},
|
|
249888
|
-
...await collectResources(target.configDir, target)
|
|
249889
|
-
};
|
|
249890
|
-
}
|
|
249891
249827
|
// src/core/version/gate.ts
|
|
249892
249828
|
var VERSIONS_API_ENV = "BASE44_VERSIONS_API";
|
|
249893
249829
|
function versionsApiEnabled(env = process.env) {
|
|
249894
249830
|
const value = env[VERSIONS_API_ENV];
|
|
249895
249831
|
return value === "1" || value === "true";
|
|
249896
249832
|
}
|
|
249833
|
+
// src/core/version/project.ts
|
|
249834
|
+
import { dirname as dirname21, join as join28, resolve as resolve11 } from "node:path";
|
|
249835
|
+
var DEFAULT_BUILD_COMMAND = "npm run build";
|
|
249836
|
+
var DEFAULT_OUTPUT_DIRECTORY = "dist";
|
|
249837
|
+
async function resolvePublishTarget(projectRoot, overrides = {}) {
|
|
249838
|
+
const project = await readSettingsIfPresent(projectRoot);
|
|
249839
|
+
const root = project?.root ?? projectRoot ?? process.cwd();
|
|
249840
|
+
return {
|
|
249841
|
+
root,
|
|
249842
|
+
configDir: project ? dirname21(project.configPath) : join28(root, PROJECT_SUBDIR),
|
|
249843
|
+
buildCommand: project ? project.site?.buildCommand : DEFAULT_BUILD_COMMAND,
|
|
249844
|
+
outputDir: outputDirectory(project, root, overrides.outputDir),
|
|
249845
|
+
entitiesDir: project?.entitiesDir ?? "entities",
|
|
249846
|
+
agentsDir: project?.agentsDir ?? "agents"
|
|
249847
|
+
};
|
|
249848
|
+
}
|
|
249849
|
+
function outputDirectory(project, root, override) {
|
|
249850
|
+
const configured = override ?? (project ? project.site?.outputDirectory : DEFAULT_OUTPUT_DIRECTORY);
|
|
249851
|
+
return configured ? resolve11(root, configured) : null;
|
|
249852
|
+
}
|
|
249853
|
+
function requireOutputDir(target) {
|
|
249854
|
+
if (target.outputDir === null) {
|
|
249855
|
+
throw new ConfigNotFoundError("No site configuration found.", {
|
|
249856
|
+
hints: [
|
|
249857
|
+
{
|
|
249858
|
+
message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
|
|
249859
|
+
},
|
|
249860
|
+
{ message: `Or pass --output-dir <dir>, relative to ${target.root}` }
|
|
249861
|
+
]
|
|
249862
|
+
});
|
|
249863
|
+
}
|
|
249864
|
+
return target.outputDir;
|
|
249865
|
+
}
|
|
249866
|
+
async function readSettingsIfPresent(projectRoot) {
|
|
249867
|
+
try {
|
|
249868
|
+
return await readProjectSettings(projectRoot);
|
|
249869
|
+
} catch (error) {
|
|
249870
|
+
if (error instanceof ConfigNotFoundError) {
|
|
249871
|
+
return null;
|
|
249872
|
+
}
|
|
249873
|
+
throw error;
|
|
249874
|
+
}
|
|
249875
|
+
}
|
|
249897
249876
|
// src/cli/commands/project/build.ts
|
|
249898
249877
|
async function buildAction(ctx) {
|
|
249899
249878
|
const app = requireApp(ctx);
|
|
@@ -250866,7 +250845,9 @@ function concurrencyOption() {
|
|
|
250866
250845
|
async function publishAction(ctx, options) {
|
|
250867
250846
|
const { runTask, log, jsonMode } = ctx;
|
|
250868
250847
|
const app = requireApp(ctx);
|
|
250869
|
-
const target = await
|
|
250848
|
+
const target = await resolvePublishTarget(app.projectRoot, {
|
|
250849
|
+
outputDir: options.outputDir
|
|
250850
|
+
});
|
|
250870
250851
|
if (options.build !== false) {
|
|
250871
250852
|
await tagStep("build", () => runSiteBuild(ctx, {
|
|
250872
250853
|
root: target.root,
|
|
@@ -250876,13 +250857,23 @@ async function publishAction(ctx, options) {
|
|
|
250876
250857
|
}
|
|
250877
250858
|
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
250878
250859
|
const result = await runTask("Publishing...", async (updateMessage) => {
|
|
250879
|
-
const artifacts = await tagStep("create_version", () =>
|
|
250860
|
+
const artifacts = await tagStep("create_version", async () => {
|
|
250861
|
+
const siteWorker = await collectSiteWorker(target.root);
|
|
250862
|
+
const assetsDir = siteWorker ? siteWorker.assetsDir : requireOutputDir(target);
|
|
250863
|
+
return {
|
|
250864
|
+
files: assetsDir ? await collectBuildOutput(assetsDir, {
|
|
250865
|
+
requireEntry: siteWorker === null
|
|
250866
|
+
}) : [],
|
|
250867
|
+
...siteWorker ? { siteWorker } : {},
|
|
250868
|
+
...await collectResources(target.configDir, target)
|
|
250869
|
+
};
|
|
250870
|
+
});
|
|
250880
250871
|
return await publishVersion(artifacts, {
|
|
250881
250872
|
sourceCommit: gitHash,
|
|
250882
250873
|
target: options.target,
|
|
250883
250874
|
concurrency: options.concurrency,
|
|
250884
250875
|
progress: {
|
|
250885
|
-
onDeclared: ({ fileCount }) => updateMessage(`Uploading ${fileCount} files`),
|
|
250876
|
+
onDeclared: ({ fileCount, owedFiles }) => updateMessage(`Uploading ${owedFiles} of ${fileCount} files`),
|
|
250886
250877
|
onUpload: ({ uploadedFiles, totalFiles }) => updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} files`)
|
|
250887
250878
|
}
|
|
250888
250879
|
});
|
|
@@ -251592,17 +251583,19 @@ function getTypesCommand() {
|
|
|
251592
251583
|
}
|
|
251593
251584
|
|
|
251594
251585
|
// src/cli/commands/versions/create.ts
|
|
251595
|
-
async function createAction2(
|
|
251596
|
-
const
|
|
251597
|
-
const target = await resolvePublishTarget(requireApp(ctx).projectRoot, {
|
|
251586
|
+
async function createAction2({ runTask, jsonMode, app }, options) {
|
|
251587
|
+
const target = await resolvePublishTarget(app?.projectRoot, {
|
|
251598
251588
|
outputDir: options.outputDir
|
|
251599
251589
|
});
|
|
251600
251590
|
const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
|
|
251601
|
-
const version = await runTask("Creating version...", async (updateMessage) => await createVersion(
|
|
251591
|
+
const version = await runTask("Creating version...", async (updateMessage) => await createVersion({
|
|
251592
|
+
files: await collectBuildOutput(requireOutputDir(target)),
|
|
251593
|
+
...await collectResources(target.configDir, target)
|
|
251594
|
+
}, {
|
|
251602
251595
|
sourceCommit: gitHash,
|
|
251603
251596
|
concurrency: options.concurrency,
|
|
251604
251597
|
progress: {
|
|
251605
|
-
onDeclared: ({ fileCount }) => updateMessage(`Uploading ${fileCount} files`),
|
|
251598
|
+
onDeclared: ({ fileCount, owedFiles }) => updateMessage(`Uploading ${owedFiles} of ${fileCount} files`),
|
|
251606
251599
|
onUpload: ({ uploadedFiles, totalFiles }) => updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} files`)
|
|
251607
251600
|
}
|
|
251608
251601
|
}), {
|
|
@@ -251636,7 +251629,7 @@ async function deployAction3({ runTask, jsonMode }, versionId, options) {
|
|
|
251636
251629
|
};
|
|
251637
251630
|
}
|
|
251638
251631
|
function getVersionDeployCommand() {
|
|
251639
|
-
return new Base44Command("deploy").description("Point an environment at an already-recorded version (also the rollback)").argument("<version-id>", "The version to serve").
|
|
251632
|
+
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);
|
|
251640
251633
|
}
|
|
251641
251634
|
|
|
251642
251635
|
// src/cli/commands/versions/index.ts
|
|
@@ -253967,11 +253960,11 @@ import { relative as relative9 } from "node:path";
|
|
|
253967
253960
|
// ../../node_modules/chokidar/index.js
|
|
253968
253961
|
import { EventEmitter as EventEmitter3 } from "node:events";
|
|
253969
253962
|
import { stat as statcb, Stats } from "node:fs";
|
|
253970
|
-
import { readdir as readdir3, stat as
|
|
253963
|
+
import { readdir as readdir3, stat as stat7 } from "node:fs/promises";
|
|
253971
253964
|
import * as sp3 from "node:path";
|
|
253972
253965
|
|
|
253973
253966
|
// ../../node_modules/readdirp/index.js
|
|
253974
|
-
import { lstat as lstat2, readdir as readdir2, realpath, stat as
|
|
253967
|
+
import { lstat as lstat2, readdir as readdir2, realpath, stat as stat5 } from "node:fs/promises";
|
|
253975
253968
|
import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
|
|
253976
253969
|
import { Readable as Readable6 } from "node:stream";
|
|
253977
253970
|
var EntryTypes = {
|
|
@@ -254053,7 +254046,7 @@ class ReaddirpStream extends Readable6 {
|
|
|
254053
254046
|
const { root, type } = opts;
|
|
254054
254047
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
254055
254048
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
254056
|
-
const statMethod = opts.lstat ? lstat2 :
|
|
254049
|
+
const statMethod = opts.lstat ? lstat2 : stat5;
|
|
254057
254050
|
if (wantBigintFsStats) {
|
|
254058
254051
|
this._stat = (path) => statMethod(path, { bigint: true });
|
|
254059
254052
|
} else {
|
|
@@ -254206,7 +254199,7 @@ function readdirp(root, options = {}) {
|
|
|
254206
254199
|
|
|
254207
254200
|
// ../../node_modules/chokidar/handler.js
|
|
254208
254201
|
import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
|
|
254209
|
-
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as
|
|
254202
|
+
import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat6 } from "node:fs/promises";
|
|
254210
254203
|
import { type as osType } from "node:os";
|
|
254211
254204
|
import * as sp2 from "node:path";
|
|
254212
254205
|
var STR_DATA = "data";
|
|
@@ -254232,7 +254225,7 @@ var EVENTS = {
|
|
|
254232
254225
|
};
|
|
254233
254226
|
var EV = EVENTS;
|
|
254234
254227
|
var THROTTLE_MODE_WATCH = "watch";
|
|
254235
|
-
var statMethods = { lstat: lstat3, stat:
|
|
254228
|
+
var statMethods = { lstat: lstat3, stat: stat6 };
|
|
254236
254229
|
var KEY_LISTENERS = "listeners";
|
|
254237
254230
|
var KEY_ERR = "errHandlers";
|
|
254238
254231
|
var KEY_RAW = "rawEmitters";
|
|
@@ -254703,7 +254696,7 @@ class NodeFsHandler {
|
|
|
254703
254696
|
return;
|
|
254704
254697
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
254705
254698
|
try {
|
|
254706
|
-
const newStats = await
|
|
254699
|
+
const newStats = await stat6(file);
|
|
254707
254700
|
if (this.fsw.closed)
|
|
254708
254701
|
return;
|
|
254709
254702
|
const at = newStats.atimeMs;
|
|
@@ -255375,7 +255368,7 @@ class FSWatcher extends EventEmitter3 {
|
|
|
255375
255368
|
const fullPath = opts.cwd ? sp3.join(opts.cwd, path) : path;
|
|
255376
255369
|
let stats;
|
|
255377
255370
|
try {
|
|
255378
|
-
stats = await
|
|
255371
|
+
stats = await stat7(fullPath);
|
|
255379
255372
|
} catch (err) {}
|
|
255380
255373
|
if (!stats || this.closed)
|
|
255381
255374
|
return;
|
|
@@ -258365,7 +258358,7 @@ class ReduceableCache {
|
|
|
258365
258358
|
}
|
|
258366
258359
|
}
|
|
258367
258360
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
|
|
258368
|
-
import { createReadStream as
|
|
258361
|
+
import { createReadStream as createReadStream4 } from "node:fs";
|
|
258369
258362
|
import { createInterface as createInterface2 } from "node:readline";
|
|
258370
258363
|
var LRU_FILE_CONTENTS_CACHE = new ReduceableCache(25);
|
|
258371
258364
|
var LRU_FILE_CONTENTS_FS_READ_FAILED = new ReduceableCache(20);
|
|
@@ -258409,7 +258402,7 @@ async function addSourceContext(frames) {
|
|
|
258409
258402
|
}
|
|
258410
258403
|
function getContextLinesFromFile(path, ranges, output) {
|
|
258411
258404
|
return new Promise((resolve) => {
|
|
258412
|
-
const stream =
|
|
258405
|
+
const stream = createReadStream4(path);
|
|
258413
258406
|
const lineReaded = createInterface2({
|
|
258414
258407
|
input: stream
|
|
258415
258408
|
});
|
|
@@ -260360,4 +260353,4 @@ export {
|
|
|
260360
260353
|
runCLI
|
|
260361
260354
|
};
|
|
260362
260355
|
|
|
260363
|
-
//# debugId=
|
|
260356
|
+
//# debugId=7DA2F8B50E7BAF0364756E2164756E21
|