@base44-preview/cli 0.1.15-pr.626.454d562 → 0.1.15-pr.626.6cd5550

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 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/modules.ts
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 stat(module.absolutePath)).size;
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/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";
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 built = await resolveFullStackBuild(projectRoot);
240148
- if (!built) {
240124
+ const redirectPath = await detectFullStackArtifact(projectRoot);
240125
+ if (!redirectPath) {
240149
240126
  return null;
240150
240127
  }
240151
- const { config, modules, assetsDir } = built;
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
  }
@@ -247076,12 +247054,6 @@ async function ensureAppContext(ctx, options = {}) {
247076
247054
  ctx.app = appContext;
247077
247055
  ctx.errorReporter.setContext({ appId: appContext.id });
247078
247056
  }
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
- }
247085
247057
 
247086
247058
  // src/cli/utils/version-check.ts
247087
247059
  async function checkForUpgrade() {
@@ -247324,7 +247296,6 @@ async function createVersion(artifacts, options = {}) {
247324
247296
  site_worker: {
247325
247297
  main: artifacts.siteWorker.main,
247326
247298
  modules: artifacts.siteWorker.modules.map(declaredFile),
247327
- assets: artifacts.siteWorker.assets.map(declaredFile),
247328
247299
  compatibility_date: artifacts.siteWorker.compatibilityDate,
247329
247300
  compatibility_flags: artifacts.siteWorker.compatibilityFlags
247330
247301
  }
@@ -247335,8 +247306,7 @@ async function createVersion(artifacts, options = {}) {
247335
247306
  }, "declaring a version")).json(), "declare");
247336
247307
  const declaredFiles = [
247337
247308
  ...artifacts.files,
247338
- ...artifacts.siteWorker?.modules ?? [],
247339
- ...artifacts.siteWorker?.assets ?? []
247309
+ ...artifacts.siteWorker?.modules ?? []
247340
247310
  ];
247341
247311
  options.progress?.onDeclared?.({
247342
247312
  fileCount: declaredFiles.length,
@@ -249761,37 +249731,52 @@ async function maybeAskToBuild(isNonInteractive, buildCommand) {
249761
249731
  }
249762
249732
  // src/core/version/artifacts.ts
249763
249733
  import { createHash as createHash2 } from "node:crypto";
249734
+ import { createReadStream as createReadStream3 } from "node:fs";
249735
+ import { stat as stat3 } from "node:fs/promises";
249764
249736
  import { join as join27, resolve as resolve10 } from "node:path";
249765
249737
  var MAX_FILE_COUNT = 50000;
249766
249738
  var HASH_CONCURRENCY = 32;
249767
249739
  var ENTRY2 = "index.html";
249768
249740
  async function digestFile(absolutePath) {
249769
- const hash = await hashFileInto(createHash2("sha256"), absolutePath);
249741
+ const hash = createHash2("sha256");
249742
+ for await (const chunk of createReadStream3(absolutePath)) {
249743
+ hash.update(chunk);
249744
+ }
249770
249745
  return `sha256:${hash.digest("hex")}`;
249771
249746
  }
249772
249747
  async function collectBuildOutput(outputDir, options = {}) {
249773
- const found = await describeBuildOutput(outputDir);
249774
- if (found.length === 0) {
249748
+ const relativePaths = await walkBuildOutput(outputDir);
249749
+ if (relativePaths.length === 0) {
249775
249750
  throw new InvalidInputError(`No files found in ${outputDir}. Build the site before creating a version.`, {
249776
249751
  hints: [
249777
249752
  { message: "Run 'base44 build' first", command: "base44 build" }
249778
249753
  ]
249779
249754
  });
249780
249755
  }
249781
- if (found.length > MAX_FILE_COUNT) {
249782
- throw new InvalidInputError(`Too many files: found ${found.length}, the limit is ${MAX_FILE_COUNT}.`);
249756
+ if (relativePaths.length > MAX_FILE_COUNT) {
249757
+ throw new InvalidInputError(`Too many files: found ${relativePaths.length}, the limit is ${MAX_FILE_COUNT}.`);
249783
249758
  }
249784
- if (options.requireEntry !== false && !found.some((f) => f.path === ENTRY2)) {
249759
+ if (options.requireEntry !== false && !relativePaths.includes(ENTRY2)) {
249785
249760
  throw new InvalidInputError(`${outputDir} has no ${ENTRY2}, so nothing could enter the site.`);
249786
249761
  }
249787
- return await pMap(found, async (file) => ({ ...file, digest: await digestFile(file.absolutePath) }), { concurrency: HASH_CONCURRENCY });
249762
+ return await pMap(relativePaths, async (path) => {
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 });
249788
249772
  }
249789
249773
  async function collectSiteWorker(projectRoot) {
249790
- const built = await resolveFullStackBuild(projectRoot);
249791
- if (!built) {
249774
+ const redirectPath = await detectFullStackArtifact(projectRoot);
249775
+ if (!redirectPath) {
249792
249776
  return null;
249793
249777
  }
249794
- const { config, modules, assetsDir } = built;
249778
+ const config = await resolveWranglerConfig(redirectPath);
249779
+ const modules = await collectModules(config);
249795
249780
  const entry = resolve10(config.configDir, config.main);
249796
249781
  const main = modules.find((m) => m.absolutePath === entry)?.name;
249797
249782
  if (!main) {
@@ -249805,9 +249790,9 @@ async function collectSiteWorker(projectRoot) {
249805
249790
  size,
249806
249791
  digest: await digestFile(absolutePath)
249807
249792
  }), { concurrency: HASH_CONCURRENCY }),
249808
- assets: assetsDir ? await collectBuildOutput(assetsDir, { requireEntry: false }) : [],
249809
249793
  compatibilityDate: config.compatibilityDate,
249810
- compatibilityFlags: config.compatibilityFlags
249794
+ compatibilityFlags: config.compatibilityFlags,
249795
+ assetsDir: config.assetsDirectory && await pathExists(config.assetsDirectory) ? config.assetsDirectory : null
249811
249796
  };
249812
249797
  }
249813
249798
  async function readRawResources(dir) {
@@ -249884,15 +249869,15 @@ async function readSettingsIfPresent(projectRoot) {
249884
249869
  }
249885
249870
  // src/cli/commands/project/build.ts
249886
249871
  async function buildAction(ctx) {
249887
- const app = requireApp(ctx);
249888
- const target = await resolvePublishTarget(app.projectRoot);
249872
+ const { app } = ctx;
249873
+ const target = await resolvePublishTarget(app?.projectRoot);
249889
249874
  await runSiteBuild(ctx, {
249890
249875
  root: target.root,
249891
249876
  buildCommand: target.buildCommand,
249892
- appId: app.id
249877
+ appId: app?.id ?? ""
249893
249878
  });
249894
249879
  return {
249895
- outroMessage: `Site built with app id ${theme.styles.bold(app.id)}`
249880
+ outroMessage: `Site built with app id ${theme.styles.bold(app?.id ?? "")}`
249896
249881
  };
249897
249882
  }
249898
249883
  function getBuildCommand() {
@@ -250852,24 +250837,26 @@ function concurrencyOption() {
250852
250837
 
250853
250838
  // src/cli/commands/publish.ts
250854
250839
  async function publishAction(ctx, options) {
250855
- const { runTask, log, jsonMode } = ctx;
250856
- const app = requireApp(ctx);
250857
- const target = await resolvePublishTarget(app.projectRoot, {
250840
+ const { runTask, log, jsonMode, app } = ctx;
250841
+ const target = await resolvePublishTarget(app?.projectRoot, {
250858
250842
  outputDir: options.outputDir
250859
250843
  });
250860
250844
  if (options.build !== false) {
250861
250845
  await tagStep("build", () => runSiteBuild(ctx, {
250862
250846
  root: target.root,
250863
250847
  buildCommand: target.buildCommand,
250864
- appId: app.id
250848
+ appId: app?.id ?? ""
250865
250849
  }));
250866
250850
  }
250867
250851
  const gitHash = await resolveProvenanceCommit(target.root, options.gitHash);
250868
250852
  const result = await runTask("Publishing...", async (updateMessage) => {
250869
250853
  const artifacts = await tagStep("create_version", async () => {
250870
250854
  const siteWorker = await collectSiteWorker(target.root);
250855
+ const assetsDir = siteWorker ? siteWorker.assetsDir : requireOutputDir(target);
250871
250856
  return {
250872
- files: siteWorker ? [] : await collectBuildOutput(requireOutputDir(target)),
250857
+ files: assetsDir ? await collectBuildOutput(assetsDir, {
250858
+ requireEntry: siteWorker === null
250859
+ }) : [],
250873
250860
  ...siteWorker ? { siteWorker } : {},
250874
250861
  ...await collectResources(target.configDir, target)
250875
250862
  };
@@ -253966,11 +253953,11 @@ import { relative as relative9 } from "node:path";
253966
253953
  // ../../node_modules/chokidar/index.js
253967
253954
  import { EventEmitter as EventEmitter3 } from "node:events";
253968
253955
  import { stat as statcb, Stats } from "node:fs";
253969
- import { readdir as readdir3, stat as stat6 } from "node:fs/promises";
253956
+ import { readdir as readdir3, stat as stat7 } from "node:fs/promises";
253970
253957
  import * as sp3 from "node:path";
253971
253958
 
253972
253959
  // ../../node_modules/readdirp/index.js
253973
- import { lstat as lstat2, readdir as readdir2, realpath, stat as stat4 } from "node:fs/promises";
253960
+ import { lstat as lstat2, readdir as readdir2, realpath, stat as stat5 } from "node:fs/promises";
253974
253961
  import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "node:path";
253975
253962
  import { Readable as Readable6 } from "node:stream";
253976
253963
  var EntryTypes = {
@@ -254052,7 +254039,7 @@ class ReaddirpStream extends Readable6 {
254052
254039
  const { root, type } = opts;
254053
254040
  this._fileFilter = normalizeFilter(opts.fileFilter);
254054
254041
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
254055
- const statMethod = opts.lstat ? lstat2 : stat4;
254042
+ const statMethod = opts.lstat ? lstat2 : stat5;
254056
254043
  if (wantBigintFsStats) {
254057
254044
  this._stat = (path) => statMethod(path, { bigint: true });
254058
254045
  } else {
@@ -254205,7 +254192,7 @@ function readdirp(root, options = {}) {
254205
254192
 
254206
254193
  // ../../node_modules/chokidar/handler.js
254207
254194
  import { watch as fs_watch, unwatchFile, watchFile } from "node:fs";
254208
- import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat5 } from "node:fs/promises";
254195
+ import { realpath as fsrealpath, lstat as lstat3, open as open2, stat as stat6 } from "node:fs/promises";
254209
254196
  import { type as osType } from "node:os";
254210
254197
  import * as sp2 from "node:path";
254211
254198
  var STR_DATA = "data";
@@ -254231,7 +254218,7 @@ var EVENTS = {
254231
254218
  };
254232
254219
  var EV = EVENTS;
254233
254220
  var THROTTLE_MODE_WATCH = "watch";
254234
- var statMethods = { lstat: lstat3, stat: stat5 };
254221
+ var statMethods = { lstat: lstat3, stat: stat6 };
254235
254222
  var KEY_LISTENERS = "listeners";
254236
254223
  var KEY_ERR = "errHandlers";
254237
254224
  var KEY_RAW = "rawEmitters";
@@ -254702,7 +254689,7 @@ class NodeFsHandler {
254702
254689
  return;
254703
254690
  if (!newStats || newStats.mtimeMs === 0) {
254704
254691
  try {
254705
- const newStats = await stat5(file);
254692
+ const newStats = await stat6(file);
254706
254693
  if (this.fsw.closed)
254707
254694
  return;
254708
254695
  const at = newStats.atimeMs;
@@ -255374,7 +255361,7 @@ class FSWatcher extends EventEmitter3 {
255374
255361
  const fullPath = opts.cwd ? sp3.join(opts.cwd, path) : path;
255375
255362
  let stats;
255376
255363
  try {
255377
- stats = await stat6(fullPath);
255364
+ stats = await stat7(fullPath);
255378
255365
  } catch (err) {}
255379
255366
  if (!stats || this.closed)
255380
255367
  return;
@@ -258364,7 +258351,7 @@ class ReduceableCache {
258364
258351
  }
258365
258352
  }
258366
258353
  // ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
258367
- import { createReadStream as createReadStream3 } from "node:fs";
258354
+ import { createReadStream as createReadStream4 } from "node:fs";
258368
258355
  import { createInterface as createInterface2 } from "node:readline";
258369
258356
  var LRU_FILE_CONTENTS_CACHE = new ReduceableCache(25);
258370
258357
  var LRU_FILE_CONTENTS_FS_READ_FAILED = new ReduceableCache(20);
@@ -258408,7 +258395,7 @@ async function addSourceContext(frames) {
258408
258395
  }
258409
258396
  function getContextLinesFromFile(path, ranges, output) {
258410
258397
  return new Promise((resolve) => {
258411
- const stream = createReadStream3(path);
258398
+ const stream = createReadStream4(path);
258412
258399
  const lineReaded = createInterface2({
258413
258400
  input: stream
258414
258401
  });
@@ -260359,4 +260346,4 @@ export {
260359
260346
  runCLI
260360
260347
  };
260361
260348
 
260362
- //# debugId=A3CC3878ECA39CF664756E2164756E21
260349
+ //# debugId=6F5FA046DBD3D8D164756E2164756E21