@somewhere-cloud/cli 0.38.174 → 0.38.176

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.
@@ -76977,7 +76977,9 @@ var files_exports = {};
76977
76977
  __export(files_exports, {
76978
76978
  BINARY_EXTS: () => BINARY_EXTS,
76979
76979
  IGNORE: () => IGNORE,
76980
+ MAX_DEPLOY_BLOB_BYTES: () => MAX_DEPLOY_BLOB_BYTES,
76980
76981
  MAX_FILE_SIZE: () => MAX_FILE_SIZE,
76982
+ MAX_INLINE_DEPLOY_BYTES: () => MAX_INLINE_DEPLOY_BYTES,
76981
76983
  SENSITIVE_FILE_REASON: () => SENSITIVE_FILE_REASON,
76982
76984
  TEST_FOLDERS: () => TEST_FOLDERS,
76983
76985
  classifyInto: () => classifyInto,
@@ -76996,7 +76998,7 @@ __export(files_exports, {
76996
76998
  });
76997
76999
  import { isUtf8 } from "node:buffer";
76998
77000
  import { existsSync as existsSync13, readdirSync as readdirSync3, readFileSync as readFileSync15, statSync as statSync2 } from "node:fs";
76999
- import { extname as extname3, isAbsolute as isAbsolute2, join as join16, relative as relative6 } from "node:path";
77001
+ import { extname as extname3, isAbsolute as isAbsolute2, join as join16, posix as posix2, relative as relative6 } from "node:path";
77000
77002
  function isTestSourcePath(relPath) {
77001
77003
  return TEST_SOURCE_NAME.test(relPath.slice(relPath.lastIndexOf("/") + 1));
77002
77004
  }
@@ -77035,6 +77037,31 @@ function isFunctionPath(p2) {
77035
77037
  function isBinaryPath2(p2) {
77036
77038
  return BINARY_EXTS.has(extname3(p2).toLowerCase());
77037
77039
  }
77040
+ function compilerAssetMatcher(sources) {
77041
+ const resolved = /* @__PURE__ */ new Set();
77042
+ const aliasedNames = /* @__PURE__ */ new Set();
77043
+ const scriptImports = /\b(?:import\s*(?:\(\s*|(?=['"])|[^;"'`]*?\bfrom\s*)|export\s+[^;"'`]*?\bfrom\s*|require\s*\(\s*|new\s+URL\s*\(\s*)(['"])([^'"\r\n]+)\1/g;
77044
+ const cssImports = /url\(\s*(?:"([^"]+)"|'([^']+)'|([^\s)]+))|@import\s+["']([^"']+)["']/g;
77045
+ for (const [file, source] of sources) {
77046
+ const stylesheet = /\.(?:css|scss|sass|less)$/i.test(file);
77047
+ const imports = stylesheet ? Array.from(source.matchAll(cssImports), (match) => match[1] ?? match[2] ?? match[3] ?? match[4]) : Array.from(source.matchAll(scriptImports), (match) => match[2]);
77048
+ for (const specifier of imports) {
77049
+ const path3 = specifier.split(/[?#]/, 1)[0];
77050
+ if (!path3 || path3.startsWith("//") || /^[a-z][a-z0-9+.-]*:/i.test(path3))
77051
+ continue;
77052
+ if (path3.startsWith("/"))
77053
+ resolved.add(posix2.normalize(path3).slice(1));
77054
+ else if (stylesheet || path3.startsWith("."))
77055
+ resolved.add(posix2.normalize(posix2.join(posix2.dirname(file), path3)));
77056
+ else
77057
+ aliasedNames.add(posix2.basename(path3));
77058
+ }
77059
+ }
77060
+ return (path3) => {
77061
+ const stem = path3.slice(0, path3.length - posix2.extname(path3).length);
77062
+ return resolved.has(path3) || resolved.has(stem) || aliasedNames.has(posix2.basename(path3)) || aliasedNames.has(posix2.basename(stem));
77063
+ };
77064
+ }
77038
77065
  function collectFiles(baseDir, options2 = {}) {
77039
77066
  const out = { dotfilesLeftOut: false, files: {}, binaryFiles: {}, functions: {}, skipped: [], oversize: [], notes: [], excluded: [], sensitive: [], published: [] };
77040
77067
  const ignore = loadDeployIgnore(baseDir);
@@ -77102,8 +77129,24 @@ function collectFiles(baseDir, options2 = {}) {
77102
77129
  }
77103
77130
  out.sensitive.sort((a, b2) => a.path.localeCompare(b2.path));
77104
77131
  }
77132
+ if (options2.deployBlobs && (publish.reduce((total, path3) => total + (sizes.get(path3) ?? 0), 0) > MAX_INLINE_DEPLOY_BYTES || publish.some((path3) => (sizes.get(path3) ?? 0) > MAX_FILE_SIZE))) {
77133
+ const compilerSources = corpusFiles(publish.filter((path3) => /\.(?:[cm]?[jt]sx?|css|scss|sass|less)$/i.test(path3)));
77134
+ const isCompilerAsset = compilerAssetMatcher(compilerSources);
77135
+ out.blobs = /* @__PURE__ */ new Map();
77136
+ for (const path3 of publish) {
77137
+ const size = sizes.get(path3) ?? 0;
77138
+ const served = path3.replace(/^public\//, "");
77139
+ if (classifyKey(path3).kind === "function" || /^(?:api|db|_lib|_compiled|_internal|_source)\//i.test(served) || /(?:^|\/)(?:package(?:-lock)?\.json|npm-shrinkwrap\.json|tsconfig[^/]*\.json)$/i.test(path3) || /\.(?:[cm]?[jt]sx?|css|scss|sass|less|html?|wasm)$/i.test(path3) || !(/^(?:public|static)\//.test(path3) || BINARY_EXTS.has(extname3(path3).toLowerCase()) || /\.(?:svg|json|csv)$/i.test(path3)) || isCompilerAsset(path3))
77140
+ continue;
77141
+ out.blobs.set(path3, size);
77142
+ }
77143
+ }
77105
77144
  for (const relPath of publish) {
77106
77145
  const bytes = sizes.get(relPath) ?? 0;
77146
+ if (out.blobs?.has(relPath) && bytes <= MAX_DEPLOY_BLOB_BYTES) {
77147
+ out.published.push(relPath);
77148
+ continue;
77149
+ }
77107
77150
  if (bytes > MAX_FILE_SIZE) {
77108
77151
  out.oversize.push({ path: relPath, bytes });
77109
77152
  out.skipped.push({ path: relPath, reason: `${formatBytes(bytes)} exceeds the ${formatBytes(MAX_FILE_SIZE)} per-file limit` });
@@ -77357,7 +77400,7 @@ function sensitiveReferenceRefusal(collected) {
77357
77400
  "If nothing loads it (for example, only a comment mentions it), add it to .somewhereignore or move it out of this folder, then run the command again."
77358
77401
  ].join("\n");
77359
77402
  }
77360
- var IGNORE, MAX_FILE_SIZE, BINARY_EXTS, TEST_SOURCE_NAME, TEST_FOLDERS, SENSITIVE_FILE_REASON, DeployIgnoreMatcher;
77403
+ var IGNORE, MAX_FILE_SIZE, MAX_DEPLOY_BLOB_BYTES, MAX_INLINE_DEPLOY_BYTES, BINARY_EXTS, TEST_SOURCE_NAME, TEST_FOLDERS, SENSITIVE_FILE_REASON, DeployIgnoreMatcher;
77361
77404
  var init_files = __esm({
77362
77405
  "dist/lib/files.js"() {
77363
77406
  "use strict";
@@ -77379,6 +77422,8 @@ var init_files = __esm({
77379
77422
  ".vercel"
77380
77423
  ]);
77381
77424
  MAX_FILE_SIZE = 5 * 1024 * 1024;
77425
+ MAX_DEPLOY_BLOB_BYTES = 25 * 1024 * 1024;
77426
+ MAX_INLINE_DEPLOY_BYTES = 20 * 1024 * 1024;
77382
77427
  BINARY_EXTS = /* @__PURE__ */ new Set([
77383
77428
  ".png",
77384
77429
  ".jpg",
@@ -77416,6 +77461,7 @@ var init_files = __esm({
77416
77461
  __name(isFunctionPath, "isFunctionPath");
77417
77462
  __name(isBinaryPath2, "isBinaryPath");
77418
77463
  SENSITIVE_FILE_REASON = "blocked by the sensitive-path policy \u2014 never uploaded";
77464
+ __name(compilerAssetMatcher, "compilerAssetMatcher");
77419
77465
  __name(collectFiles, "collectFiles");
77420
77466
  __name(walk, "walk");
77421
77467
  __name(classifyKey, "classifyKey");
@@ -78856,6 +78902,65 @@ var init_build_errors = __esm({
78856
78902
  }
78857
78903
  });
78858
78904
 
78905
+ // dist/lib/deploy-blobs.js
78906
+ import { createReadStream } from "node:fs";
78907
+ import { join as join23 } from "node:path";
78908
+ async function uploadDeployBlobs(client, dir, projectId, paths, hashes) {
78909
+ const files = /* @__PURE__ */ new Map();
78910
+ for (const [path3, size] of paths) {
78911
+ const sha2563 = hashes[path3];
78912
+ files.set(sha2563, { sha256: sha2563, size, path: path3 });
78913
+ }
78914
+ process.stderr.write(`Checking ${paths.size} static files...
78915
+ `);
78916
+ const checkStarted = performance.now();
78917
+ const { missing } = await client.call("POST", "/deploy/blobs/check", {
78918
+ project_id: projectId,
78919
+ files: [...files.values()].map(({ sha256: sha2563, size }) => ({ sha256: sha2563, size }))
78920
+ }, void 0, { timeoutMs: LONG_CALL_TIMEOUT_MS });
78921
+ const checkMs = performance.now() - checkStarted;
78922
+ process.stderr.write(`Uploading ${missing.length} of ${files.size} distinct static files.
78923
+ `);
78924
+ const uploadStarted = performance.now();
78925
+ let next = 0;
78926
+ let failure2;
78927
+ const query = new URLSearchParams({ project_id: projectId });
78928
+ await Promise.all(Array.from({ length: Math.min(missing.length, PARALLEL_UPLOADS) }, async () => {
78929
+ while (next < missing.length && !failure2) {
78930
+ const file = files.get(missing[next++]);
78931
+ if (!file)
78932
+ throw new Error("The deploy returned an unknown file hash.");
78933
+ try {
78934
+ const response = await client.callStream("PUT", `/deploy/blobs/${file.sha256}?${query}`, () => createReadStream(join23(dir, file.path)), {
78935
+ headers: { "Content-Type": "application/octet-stream", "Content-Length": String(file.size) },
78936
+ replayableBody: true,
78937
+ timeoutMs: LONG_CALL_TIMEOUT_MS
78938
+ });
78939
+ const answer = await response.json().catch(() => null);
78940
+ if (!response.ok || answer?.ok !== true) {
78941
+ throw new CliApiError(answer?.error ?? "BLOB_UPLOAD_FAILED", answer?.message ?? `Upload returned HTTP ${response.status}.`, response.status);
78942
+ }
78943
+ } catch (cause) {
78944
+ failure2 ??= new CliApiError(cause instanceof CliApiError ? cause.code : "BLOB_UPLOAD_FAILED", `Could not upload "${file.path}". ${cause instanceof Error ? cause.message : String(cause)}`, cause instanceof CliApiError ? cause.statusCode : 0);
78945
+ }
78946
+ }
78947
+ }));
78948
+ if (failure2)
78949
+ throw failure2;
78950
+ const uploadMs = performance.now() - uploadStarted;
78951
+ const blobFiles = Object.fromEntries([...paths.keys()].map((path3) => [path3, `sha256:${hashes[path3]}`]));
78952
+ return { blobFiles, checkMs, uploadMs };
78953
+ }
78954
+ var PARALLEL_UPLOADS;
78955
+ var init_deploy_blobs = __esm({
78956
+ "dist/lib/deploy-blobs.js"() {
78957
+ "use strict";
78958
+ init_client();
78959
+ PARALLEL_UPLOADS = 32;
78960
+ __name(uploadDeployBlobs, "uploadDeployBlobs");
78961
+ }
78962
+ });
78963
+
78859
78964
  // dist/lib/temp-auth.js
78860
78965
  import { createHash as createHash5 } from "node:crypto";
78861
78966
  function leadingZeroBits(buf) {
@@ -78925,7 +79030,7 @@ var init_temp_auth = __esm({
78925
79030
 
78926
79031
  // dist/lib/project-notices.js
78927
79032
  import { existsSync as existsSync20, mkdirSync as mkdirSync11, readFileSync as readFileSync20, writeFileSync as writeFileSync14 } from "node:fs";
78928
- import { dirname as dirname8, join as join23 } from "node:path";
79033
+ import { dirname as dirname8, join as join24 } from "node:path";
78929
79034
  function localDay(now2) {
78930
79035
  const date4 = new Date(now2);
78931
79036
  return [date4.getFullYear(), date4.getMonth() + 1, date4.getDate()].map((part) => String(part).padStart(2, "0")).join("-");
@@ -78950,7 +79055,7 @@ function formatProjectNotice(notice) {
78950
79055
  async function showProjectNotices(client, projectRef3, options2 = {}) {
78951
79056
  const now2 = options2.now ?? Date.now();
78952
79057
  const day = localDay(now2);
78953
- const statePath = options2.statePath ?? join23(cliConfigDir(), "project-notices.json");
79058
+ const statePath = options2.statePath ?? join24(cliConfigDir(), "project-notices.json");
78954
79059
  const write = options2.write ?? ((line) => process.stderr.write(`${line}
78955
79060
  `));
78956
79061
  try {
@@ -78987,7 +79092,7 @@ var init_project_notices = __esm({
78987
79092
 
78988
79093
  // dist/lib/test-identities.js
78989
79094
  import { chmodSync as chmodSync2, existsSync as existsSync21, mkdirSync as mkdirSync12, readFileSync as readFileSync21, renameSync as renameSync3, rmSync as rmSync6, writeFileSync as writeFileSync15 } from "node:fs";
78990
- import { join as join24 } from "node:path";
79095
+ import { join as join25 } from "node:path";
78991
79096
  import { randomBytes as randomBytes3 } from "node:crypto";
78992
79097
  function parseActorSpecs(values) {
78993
79098
  if (!values.length)
@@ -79023,7 +79128,7 @@ function productionOrigin(prodFallback, requested) {
79023
79128
  return { origin, host };
79024
79129
  }
79025
79130
  function stateDir(root) {
79026
- return join24(root, TEST_STATE_DIR);
79131
+ return join25(root, TEST_STATE_DIR);
79027
79132
  }
79028
79133
  function ensurePrivateDir(dir) {
79029
79134
  mkdirSync12(dir, { recursive: true, mode: 448 });
@@ -79036,7 +79141,7 @@ function writePrivateFile(path3, content) {
79036
79141
  renameSync3(tmp, path3);
79037
79142
  }
79038
79143
  function ensureGitignored(root) {
79039
- const path3 = join24(root, ".gitignore");
79144
+ const path3 = join25(root, ".gitignore");
79040
79145
  if (!existsSync21(path3)) {
79041
79146
  writeFileSync15(path3, `# somewhere test-users: private signed-in test state
79042
79147
  ${TEST_STATE_GITIGNORE_LINE}
@@ -79054,7 +79159,7 @@ ${TEST_STATE_GITIGNORE_LINE}
79054
79159
  return "added";
79055
79160
  }
79056
79161
  function readManifest(root) {
79057
- const path3 = join24(stateDir(root), MANIFEST_FILE);
79162
+ const path3 = join25(stateDir(root), MANIFEST_FILE);
79058
79163
  if (!existsSync21(path3))
79059
79164
  return null;
79060
79165
  const invalid = /* @__PURE__ */ __name((why) => Object.assign(new Error(`${path3} is not a valid test-users manifest (${why}); nothing was changed.`), { code: "MANIFEST_INVALID" }), "invalid");
@@ -79084,7 +79189,7 @@ function preparedActorState(root, target, name) {
79084
79189
  if (!actor || manifest?.project_id !== target.projectId || manifest.origin !== target.origin) {
79085
79190
  throw new Error("No prepared actor for this app. Run somewhere test-users prepare with the actor name.");
79086
79191
  }
79087
- const path3 = join24(stateDir(root), actor.state_file);
79192
+ const path3 = join25(stateDir(root), actor.state_file);
79088
79193
  const domain = new URL(target.origin).hostname;
79089
79194
  let state;
79090
79195
  try {
@@ -79098,7 +79203,7 @@ function preparedActorState(root, target, name) {
79098
79203
  return { path: path3, state: { cookies: state.cookies, origins: state.origins ?? [] }, access: token };
79099
79204
  }
79100
79205
  function writeManifest(root, manifest) {
79101
- writePrivateFile(join24(stateDir(root), MANIFEST_FILE), JSON.stringify(manifest, null, 2) + "\n");
79206
+ writePrivateFile(join25(stateDir(root), MANIFEST_FILE), JSON.stringify(manifest, null, 2) + "\n");
79102
79207
  }
79103
79208
  function tokenTimes(accessToken) {
79104
79209
  const part = accessToken.split(".")[1];
@@ -79213,7 +79318,7 @@ function removeStateFiles(root, actors) {
79213
79318
  for (const actor of actors) {
79214
79319
  if (!ACTOR.test(actor.name) || actor.state_file !== `${actor.name}.state.json`)
79215
79320
  continue;
79216
- const path3 = join24(stateDir(root), actor.state_file);
79321
+ const path3 = join25(stateDir(root), actor.state_file);
79217
79322
  if (existsSync21(path3)) {
79218
79323
  rmSync6(path3, { force: true });
79219
79324
  removed.push(actor.state_file);
@@ -79225,7 +79330,7 @@ var TEST_STATE_DIR, TEST_STATE_GITIGNORE_LINE, MANIFEST_FILE, CLEANUP_RECEIPT_FI
79225
79330
  var init_test_identities = __esm({
79226
79331
  "dist/lib/test-identities.js"() {
79227
79332
  "use strict";
79228
- TEST_STATE_DIR = join24(".somewhere", "test");
79333
+ TEST_STATE_DIR = join25(".somewhere", "test");
79229
79334
  TEST_STATE_GITIGNORE_LINE = ".somewhere/test/";
79230
79335
  MANIFEST_FILE = "manifest.json";
79231
79336
  CLEANUP_RECEIPT_FILE = "cleanup-receipt.json";
@@ -79258,7 +79363,7 @@ var init_test_identities = __esm({
79258
79363
 
79259
79364
  // dist/lib/form-accounts.js
79260
79365
  import { existsSync as existsSync22, readdirSync as readdirSync4, readFileSync as readFileSync22, rmSync as rmSync7 } from "node:fs";
79261
- import { join as join25 } from "node:path";
79366
+ import { join as join26 } from "node:path";
79262
79367
  import { randomBytes as randomBytes4 } from "node:crypto";
79263
79368
  function readDeletionAnswer(ids, answer) {
79264
79369
  const out = { done: [], kept: /* @__PURE__ */ new Map(), dropped: /* @__PURE__ */ new Map(), teamsDeleted: answer.groups_deleted ?? [] };
@@ -79334,12 +79439,12 @@ function generatedPassword() {
79334
79439
  function accountsDir(root, projectId) {
79335
79440
  if (!/^[A-Za-z0-9-]{1,64}$/.test(projectId))
79336
79441
  throw new Error("Unexpected project id in the test run record.");
79337
- return join25(root, ".somewhere", "tests", "accounts", projectId);
79442
+ return join26(root, ".somewhere", "tests", "accounts", projectId);
79338
79443
  }
79339
79444
  function recordAttempt(control, root, email2) {
79340
79445
  const dir = control.journalDir(root);
79341
79446
  ensurePrivateDir(dir);
79342
- const path3 = join25(dir, `${Date.now()}-${randomBytes4(4).toString("hex")}.json`);
79447
+ const path3 = join26(dir, `${Date.now()}-${randomBytes4(4).toString("hex")}.json`);
79343
79448
  const record3 = {
79344
79449
  project_id: control.projectId,
79345
79450
  email: email2,
@@ -79387,7 +79492,7 @@ async function sweepAccounts(control, root) {
79387
79492
  return result;
79388
79493
  const pending = [];
79389
79494
  for (const name of readdirSync4(dir).filter((entry) => /^\d+-[0-9a-f]{8}\.json$/.test(entry))) {
79390
- const path3 = join25(dir, name);
79495
+ const path3 = join26(dir, name);
79391
79496
  let record3;
79392
79497
  try {
79393
79498
  record3 = JSON.parse(readFileSync22(path3, "utf8"));
@@ -79578,9 +79683,9 @@ var init_test_target = __esm({
79578
79683
 
79579
79684
  // dist/lib/preview-credential.js
79580
79685
  import { existsSync as existsSync23, readFileSync as readFileSync23, unlinkSync as unlinkSync4 } from "node:fs";
79581
- import { join as join26 } from "node:path";
79686
+ import { join as join27 } from "node:path";
79582
79687
  function loadPreviewCredential(projectId, previewSessionId) {
79583
- const path3 = join26(cliConfigDir(), SUBDIR, fileName(projectId, previewSessionId));
79688
+ const path3 = join27(cliConfigDir(), SUBDIR, fileName(projectId, previewSessionId));
79584
79689
  if (!existsSync23(path3))
79585
79690
  return null;
79586
79691
  try {
@@ -79591,7 +79696,7 @@ function loadPreviewCredential(projectId, previewSessionId) {
79591
79696
  }
79592
79697
  }
79593
79698
  function forgetPreviewCredential(projectId, previewSessionId) {
79594
- const path3 = join26(cliConfigDir(), SUBDIR, fileName(projectId, previewSessionId));
79699
+ const path3 = join27(cliConfigDir(), SUBDIR, fileName(projectId, previewSessionId));
79595
79700
  if (existsSync23(path3))
79596
79701
  unlinkSync4(path3);
79597
79702
  }
@@ -79629,9 +79734,9 @@ var init_preview_credential = __esm({
79629
79734
 
79630
79735
  // dist/lib/preview-record.js
79631
79736
  import { existsSync as existsSync24, mkdirSync as mkdirSync13, readFileSync as readFileSync24, rmSync as rmSync8, writeFileSync as writeFileSync16 } from "node:fs";
79632
- import { join as join27 } from "node:path";
79737
+ import { join as join28 } from "node:path";
79633
79738
  function loadPreviewRecord(dir, projectId) {
79634
- const path3 = join27(dir, PREVIEW_RECORD);
79739
+ const path3 = join28(dir, PREVIEW_RECORD);
79635
79740
  if (!existsSync24(path3))
79636
79741
  return null;
79637
79742
  try {
@@ -79644,11 +79749,11 @@ function loadPreviewRecord(dir, projectId) {
79644
79749
  }
79645
79750
  }
79646
79751
  function savePreviewRecord(dir, record3) {
79647
- mkdirSync13(join27(dir, ".somewhere"), { recursive: true });
79648
- writeFileSync16(join27(dir, PREVIEW_RECORD), JSON.stringify({ ...record3, saved_at: (/* @__PURE__ */ new Date()).toISOString() }) + "\n");
79752
+ mkdirSync13(join28(dir, ".somewhere"), { recursive: true });
79753
+ writeFileSync16(join28(dir, PREVIEW_RECORD), JSON.stringify({ ...record3, saved_at: (/* @__PURE__ */ new Date()).toISOString() }) + "\n");
79649
79754
  }
79650
79755
  function clearPreviewRecord(dir) {
79651
- rmSync8(join27(dir, PREVIEW_RECORD), { force: true });
79756
+ rmSync8(join28(dir, PREVIEW_RECORD), { force: true });
79652
79757
  }
79653
79758
  function openPreviewsFromStatus(status) {
79654
79759
  const data2 = unwrapPlatformData(status);
@@ -79702,7 +79807,7 @@ var init_preview_record = __esm({
79702
79807
  "dist/lib/preview-record.js"() {
79703
79808
  "use strict";
79704
79809
  init_platform_command();
79705
- PREVIEW_RECORD = join27(".somewhere", "preview.json");
79810
+ PREVIEW_RECORD = join28(".somewhere", "preview.json");
79706
79811
  __name(loadPreviewRecord, "loadPreviewRecord");
79707
79812
  __name(savePreviewRecord, "savePreviewRecord");
79708
79813
  __name(clearPreviewRecord, "clearPreviewRecord");
@@ -79816,7 +79921,7 @@ var init_test_diagnostics = __esm({
79816
79921
  });
79817
79922
 
79818
79923
  // dist/lib/test-control.js
79819
- import { join as join28 } from "node:path";
79924
+ import { join as join29 } from "node:path";
79820
79925
  function productionControl(client, target, options2 = {}) {
79821
79926
  const projectId = target.projectId;
79822
79927
  return {
@@ -79956,7 +80061,7 @@ function previewControl(tool, target, _root) {
79956
80061
  function previewAccountsDir(root, projectId, previewSessionId) {
79957
80062
  if (!/^[A-Za-z0-9-]{1,64}$/.test(projectId) || !/^draft_[A-Za-z0-9-]{1,80}$/.test(previewSessionId))
79958
80063
  throw new Error("Unexpected project or preview id in the test run record.");
79959
- return join28(root, ".somewhere", "tests", "preview-accounts", projectId, previewSessionId);
80064
+ return join29(root, ".somewhere", "tests", "preview-accounts", projectId, previewSessionId);
79960
80065
  }
79961
80066
  async function createPreviewManagedUser(tool) {
79962
80067
  let created;
@@ -80037,14 +80142,14 @@ var init_test_connectivity = __esm({
80037
80142
  // dist/lib/test-run.js
80038
80143
  import { createRequire as createRequire7 } from "node:module";
80039
80144
  import { pathToFileURL } from "node:url";
80040
- import { join as join29, dirname as dirname9 } from "node:path";
80145
+ import { join as join30, dirname as dirname9 } from "node:path";
80041
80146
  import { spawn as spawn4, spawnSync as spawnSync3 } from "node:child_process";
80042
80147
  import { appendFileSync as appendFileSync2, existsSync as existsSync25, readFileSync as readFileSync25, readdirSync as readdirSync5, rmSync as rmSync9 } from "node:fs";
80043
80148
  import { createHash as createHash6, randomUUID as randomUUID6 } from "node:crypto";
80044
80149
  function testImportEnv(root, env) {
80045
80150
  if (!readProjectPin(root)?.versionOnly)
80046
80151
  return env;
80047
- const hook2 = pathToFileURL(join29(CLI_PACKAGE_ROOT, "bin", "starter-test-imports.mjs"));
80152
+ const hook2 = pathToFileURL(join30(CLI_PACKAGE_ROOT, "bin", "starter-test-imports.mjs"));
80048
80153
  return { ...env, NODE_OPTIONS: [env.NODE_OPTIONS, "--import=" + hook2.href].filter(Boolean).join(" ") };
80049
80154
  }
80050
80155
  function testDependencyError(root) {
@@ -80054,7 +80159,7 @@ function testDependencyError(root) {
80054
80159
  return new Error(missingProjectDependencies(root).includes("@playwright/test") ? INSTALL_PROJECT_DEPENDENCIES : "Install project test dependencies: npm install -D @playwright/test @somewhere-cloud/cli");
80055
80160
  }
80056
80161
  async function prepareRunner(root) {
80057
- const require6 = createRequire7(join29(root, "package.json"));
80162
+ const require6 = createRequire7(join30(root, "package.json"));
80058
80163
  let cli;
80059
80164
  let pw;
80060
80165
  try {
@@ -80074,7 +80179,7 @@ async function prepareRunner(root) {
80074
80179
  throw error3;
80075
80180
  channel = void 0;
80076
80181
  process.stderr.write("Chrome is not installed; installing Playwright Chromium in the CLI cache.\n");
80077
- process.env.PLAYWRIGHT_BROWSERS_PATH ??= join29(cliConfigDir(), "cache", "playwright");
80182
+ process.env.PLAYWRIGHT_BROWSERS_PATH ??= join30(cliConfigDir(), "cache", "playwright");
80078
80183
  const install = spawnSync3(process.execPath, [cli, "install", "chromium"], { stdio: "inherit", env: process.env });
80079
80184
  if (install.status !== 0)
80080
80185
  throw new Error("Playwright Chromium installation failed");
@@ -80086,7 +80191,7 @@ async function prepareRunner(root) {
80086
80191
  mark("browser-probe:end");
80087
80192
  let playwright = "unknown";
80088
80193
  try {
80089
- playwright = JSON.parse(readFileSync25(join29(dirname9(cli), "package.json"), "utf8")).version ?? "unknown";
80194
+ playwright = JSON.parse(readFileSync25(join30(dirname9(cli), "package.json"), "utf8")).version ?? "unknown";
80090
80195
  } catch {
80091
80196
  }
80092
80197
  return { cli, channel, version: version2, browserLaunchMs, playwright };
@@ -80115,9 +80220,9 @@ async function runTests(input) {
80115
80220
  throw new Error(`The live release is ${target.releaseId}, not ${input.expectRelease} from this deploy (another deploy or rollback happened), so the tests were not run.`);
80116
80221
  }
80117
80222
  const { origin } = target;
80118
- const dir = join29(root, ".somewhere", "tests");
80223
+ const dir = join30(root, ".somewhere", "tests");
80119
80224
  ensurePrivateDir(dir);
80120
- const ignorePath = join29(root, ".gitignore");
80225
+ const ignorePath = join30(root, ".gitignore");
80121
80226
  const ignored = existsSync25(ignorePath) ? readFileSync25(ignorePath, "utf8") : "";
80122
80227
  for (const line of [".somewhere/", "playwright-report/", "test-results/"])
80123
80228
  if (!ignored.split(/\r?\n/).includes(line))
@@ -80129,9 +80234,9 @@ ${line}
80129
80234
  const files = options2.files ?? [];
80130
80235
  const failed = Boolean(options2.failed);
80131
80236
  const browser = `${prepared.channel ?? "chromium"} ${prepared.version}`;
80132
- const artifacts = join29(dir, createHash6("sha256").update(projectId + origin + (target.environment === "preview" ? `${target.previewSessionId}:${target.releaseId}` : "")).digest("hex").slice(0, 16));
80237
+ const artifacts = join30(dir, createHash6("sha256").update(projectId + origin + (target.environment === "preview" ? `${target.previewSessionId}:${target.releaseId}` : "")).digest("hex").slice(0, 16));
80133
80238
  if (failed) {
80134
- const lastRun = join29(artifacts, ".last-run.json");
80239
+ const lastRun = join30(artifacts, ".last-run.json");
80135
80240
  if (!existsSync25(lastRun) || !JSON.parse(readFileSync25(lastRun, "utf8")).failedTests?.length) {
80136
80241
  throw new Error("No failed tests are recorded from the last run here; run somewhere test.");
80137
80242
  }
@@ -80140,9 +80245,9 @@ ${line}
80140
80245
  process.env.SW_TEST_RUN = randomUUID6();
80141
80246
  for (const line of describeSweep(await span("sweep:before", {}, () => sweepAccounts(control, root)), "Before this run"))
80142
80247
  process.stderr.write(line + "\n");
80143
- const config2 = join29(dir, "runner.config.cjs");
80248
+ const config2 = join30(dir, "runner.config.cjs");
80144
80249
  const use = { baseURL: origin, channel: prepared.channel, trace: "off", video: "off", screenshot: "off", launchOptions: { args: ["--disable-features=AsyncDns"] } };
80145
- writePrivateFile(config2, `module.exports = ${JSON.stringify({ testDir: join29(root, "tests"), testMatch: "**/*.spec.ts", fullyParallel: true, forbidOnly: !subset, retries: 0, workers: Number(options2.workers), outputDir: artifacts, reporter: [[join29(CLI_PACKAGE_ROOT, "dist", "lib", "test-reporter.js")]], use, ...options2.phone ? { projects: [{ name: "desktop" }, { name: "phone", use: { viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true } }] } : {} })};
80250
+ writePrivateFile(config2, `module.exports = ${JSON.stringify({ testDir: join30(root, "tests"), testMatch: "**/*.spec.ts", fullyParallel: true, forbidOnly: !subset, retries: 0, workers: Number(options2.workers), outputDir: artifacts, reporter: [[join30(CLI_PACKAGE_ROOT, "dist", "lib", "test-reporter.js")]], use, ...options2.phone ? { projects: [{ name: "desktop" }, { name: "phone", use: { viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true } }] } : {} })};
80146
80251
  `);
80147
80252
  const args = [prepared.cli, "test", "--config", config2, ...files];
80148
80253
  if (options2.grep)
@@ -80150,7 +80255,7 @@ ${line}
80150
80255
  if (failed)
80151
80256
  args.push("--last-failed");
80152
80257
  const rerunFlags = `${options2.preview ? " --preview" : ""}${options2.phone ? " --phone" : ""}${options2.workers !== "5" ? ` --workers ${options2.workers}` : ""}`;
80153
- const resultsPath = join29(dir, "results.json");
80258
+ const resultsPath = join30(dir, "results.json");
80154
80259
  rmSync9(resultsPath, { force: true });
80155
80260
  mark("runner:spawn");
80156
80261
  const child = spawn4(process.execPath, args, { cwd: root, stdio: ["inherit", input.toStderr ? "pipe" : "inherit", "inherit"], env: { ...runnerEnv, SW_TEST_TARGET: JSON.stringify(target), SW_TEST_RELEASE: target.releaseId, PLAYWRIGHT_NO_COPY_PROMPT: "1", SW_TEST_ORIGIN: origin, SW_TEST_BROWSER_LAUNCH_MS: String(prepared.browserLaunchMs), SW_TEST_BROWSER: browser, SW_TEST_SUBSET: String(subset), SW_TEST_JSON: String(Boolean(options2.json)), SW_TEST_RESULTS: resultsPath, SW_TEST_RUN: process.env.SW_TEST_RUN, SW_TEST_RUN_PID: String(process.pid), SW_TEST_RERUN_FLAGS: rerunFlags } });
@@ -80170,7 +80275,7 @@ ${line}
80170
80275
  if (!existsSync25(path3))
80171
80276
  return;
80172
80277
  for (const entry of readdirSync5(path3, { withFileTypes: true })) {
80173
- const file = join29(path3, entry.name);
80278
+ const file = join30(path3, entry.name);
80174
80279
  if (entry.isDirectory())
80175
80280
  cleanArtifacts(file);
80176
80281
  else if (entry.name !== ".last-run.json" && !entry.name.endsWith(".png"))
@@ -80855,26 +80960,26 @@ var init_browser_actions = __esm({
80855
80960
  import { spawn as spawn5 } from "node:child_process";
80856
80961
  import { existsSync as existsSync26, mkdtempSync, rmSync as rmSync10 } from "node:fs";
80857
80962
  import { homedir as homedir3, tmpdir, userInfo } from "node:os";
80858
- import { join as join30 } from "node:path";
80963
+ import { join as join31 } from "node:path";
80859
80964
  import { readdirSync as readdirSync6 } from "node:fs";
80860
80965
  function candidatePaths() {
80861
80966
  const home = homedir3();
80862
80967
  const out = [];
80863
80968
  if (process.platform === "darwin") {
80864
- out.push("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary", "/Applications/Chromium.app/Contents/MacOS/Chromium", "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge", "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser", join30(home, "Applications/Google Chrome.app/Contents/MacOS/Google Chrome"));
80969
+ out.push("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary", "/Applications/Chromium.app/Contents/MacOS/Chromium", "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge", "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser", join31(home, "Applications/Google Chrome.app/Contents/MacOS/Google Chrome"));
80865
80970
  } else if (process.platform === "win32") {
80866
80971
  const programFiles = [
80867
80972
  process.env["PROGRAMFILES"] ?? "C:\\Program Files",
80868
80973
  process.env["PROGRAMFILES(X86)"] ?? "C:\\Program Files (x86)",
80869
- process.env["LOCALAPPDATA"] ?? join30(home, "AppData", "Local")
80974
+ process.env["LOCALAPPDATA"] ?? join31(home, "AppData", "Local")
80870
80975
  ];
80871
80976
  for (const base of programFiles) {
80872
- out.push(join30(base, "Google\\Chrome\\Application\\chrome.exe"), join30(base, "Microsoft\\Edge\\Application\\msedge.exe"), join30(base, "Chromium\\Application\\chrome.exe"));
80977
+ out.push(join31(base, "Google\\Chrome\\Application\\chrome.exe"), join31(base, "Microsoft\\Edge\\Application\\msedge.exe"), join31(base, "Chromium\\Application\\chrome.exe"));
80873
80978
  }
80874
80979
  } else {
80875
80980
  out.push("/usr/bin/google-chrome", "/usr/bin/google-chrome-stable", "/usr/bin/chromium", "/usr/bin/chromium-browser", "/usr/bin/microsoft-edge", "/snap/bin/chromium");
80876
80981
  }
80877
- out.push(...puppeteerCachePaths(join30(home, ".cache", "puppeteer")));
80982
+ out.push(...puppeteerCachePaths(join31(home, ".cache", "puppeteer")));
80878
80983
  return out;
80879
80984
  }
80880
80985
  function puppeteerCachePaths(cacheDir) {
@@ -80890,13 +80995,13 @@ function puppeteerCachePaths(cacheDir) {
80890
80995
  continue;
80891
80996
  let builds;
80892
80997
  try {
80893
- builds = readdirSync6(join30(cacheDir, product)).sort().reverse();
80998
+ builds = readdirSync6(join31(cacheDir, product)).sort().reverse();
80894
80999
  } catch {
80895
81000
  continue;
80896
81001
  }
80897
81002
  for (const build of builds) {
80898
- const base = join30(cacheDir, product, build);
80899
- out.push(join30(base, "chrome-mac-arm64", "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"), join30(base, "chrome-mac-x64", "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"), join30(base, "chrome-linux64", "chrome"), join30(base, "chrome-win64", "chrome.exe"), join30(base, "chrome-headless-shell-mac-arm64", "chrome-headless-shell"), join30(base, "chrome-headless-shell-mac-x64", "chrome-headless-shell"), join30(base, "chrome-headless-shell-linux64", "chrome-headless-shell"), join30(base, "chrome-headless-shell-win64", "chrome-headless-shell.exe"));
81003
+ const base = join31(cacheDir, product, build);
81004
+ out.push(join31(base, "chrome-mac-arm64", "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"), join31(base, "chrome-mac-x64", "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"), join31(base, "chrome-linux64", "chrome"), join31(base, "chrome-win64", "chrome.exe"), join31(base, "chrome-headless-shell-mac-arm64", "chrome-headless-shell"), join31(base, "chrome-headless-shell-mac-x64", "chrome-headless-shell"), join31(base, "chrome-headless-shell-linux64", "chrome-headless-shell"), join31(base, "chrome-headless-shell-win64", "chrome-headless-shell.exe"));
80900
81005
  }
80901
81006
  }
80902
81007
  return out;
@@ -80943,7 +81048,7 @@ function readEndpoint(child, timeoutMs) {
80943
81048
  });
80944
81049
  }
80945
81050
  async function launchLocalBrowser(opts) {
80946
- const profileDir = mkdtempSync(join30(tmpdir(), "somewhere-browser-"));
81051
+ const profileDir = mkdtempSync(join31(tmpdir(), "somewhere-browser-"));
80947
81052
  const browserEnv = process.platform === "darwin" ? { ...process.env, HOME: userInfo().homedir } : process.env;
80948
81053
  const child = spawn5(opts.executablePath, [
80949
81054
  "--headless=new",
@@ -81133,7 +81238,7 @@ var init_chrome = __esm({
81133
81238
 
81134
81239
  // dist/lib/browser-run.js
81135
81240
  import { writeFileSync as writeFileSync17 } from "node:fs";
81136
- import { join as join31, resolve as resolve13 } from "node:path";
81241
+ import { join as join32, resolve as resolve13 } from "node:path";
81137
81242
  import { pathToFileURL as pathToFileURL2 } from "node:url";
81138
81243
  function isLoopbackUrl(raw) {
81139
81244
  let url3;
@@ -81150,7 +81255,7 @@ function isLoopbackUrl(raw) {
81150
81255
  return /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(host);
81151
81256
  }
81152
81257
  async function domOutlineScript() {
81153
- const path3 = join31(CLI_PACKAGE_ROOT, "runtime", "browser-probes.mjs");
81258
+ const path3 = join32(CLI_PACKAGE_ROOT, "runtime", "browser-probes.mjs");
81154
81259
  const probes = await import(pathToFileURL2(path3).href);
81155
81260
  return probes.DOM_OUTLINE_SCRIPT;
81156
81261
  }
@@ -81677,15 +81782,15 @@ var init_browser_run = __esm({
81677
81782
 
81678
81783
  // dist/lib/verify-report.js
81679
81784
  import { chmodSync as chmodSync3, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync2, renameSync as renameSync4, writeFileSync as writeFileSync18 } from "node:fs";
81680
- import { join as join32 } from "node:path";
81785
+ import { join as join33 } from "node:path";
81681
81786
  function saveVerifyReport(report2) {
81682
- const root = join32(cliConfigDir(), "verify-reports");
81787
+ const root = join33(cliConfigDir(), "verify-reports");
81683
81788
  mkdirSync14(root, { recursive: true, mode: 448 });
81684
81789
  chmodSync3(root, 448);
81685
- const directory2 = mkdtempSync2(join32(root, "run-"));
81790
+ const directory2 = mkdtempSync2(join33(root, "run-"));
81686
81791
  chmodSync3(directory2, 448);
81687
- const pending = join32(directory2, "report.pending");
81688
- const destination = join32(directory2, "report.json");
81792
+ const pending = join33(directory2, "report.pending");
81793
+ const destination = join33(directory2, "report.json");
81689
81794
  writeFileSync18(pending, JSON.stringify(report2, null, 2) + "\n", { mode: 384, flag: "wx" });
81690
81795
  renameSync4(pending, destination);
81691
81796
  return destination;
@@ -82228,9 +82333,9 @@ var init_browser = __esm({
82228
82333
  // dist/lib/verify-keep.js
82229
82334
  import { createHash as createHash7, randomBytes as randomBytes5 } from "node:crypto";
82230
82335
  import { closeSync as closeSync4, existsSync as existsSync27, openSync as openSync4, readFileSync as readFileSync28, rmSync as rmSync11, statSync as statSync5, writeSync } from "node:fs";
82231
- import { join as join33 } from "node:path";
82336
+ import { join as join34 } from "node:path";
82232
82337
  function path(root) {
82233
- return join33(stateDir(root), KEEP_FILE);
82338
+ return join34(stateDir(root), KEEP_FILE);
82234
82339
  }
82235
82340
  function readFile(root) {
82236
82341
  if (!existsSync27(path(root)))
@@ -82291,7 +82396,7 @@ function reusableIdentities(entry, now2) {
82291
82396
  }
82292
82397
  function lockKeep(root, key, now2 = Date.now()) {
82293
82398
  ensurePrivateDir(stateDir(root));
82294
- const lock = join33(stateDir(root), `verify-actors-${key}.lock`);
82399
+ const lock = join34(stateDir(root), `verify-actors-${key}.lock`);
82295
82400
  for (let attempt = 0; attempt < 2; attempt++) {
82296
82401
  try {
82297
82402
  const fd = openSync4(lock, "wx", 384);
@@ -84251,7 +84356,7 @@ var init_verify = __esm({
84251
84356
 
84252
84357
  // dist/commands/deploy.js
84253
84358
  import { existsSync as existsSync29, readFileSync as readFileSync30 } from "node:fs";
84254
- import { join as join34 } from "node:path";
84359
+ import { join as join35 } from "node:path";
84255
84360
  import { basename as basename5, resolve as resolve16 } from "node:path";
84256
84361
  function resolveTargetDir(dir, cwd = process.cwd()) {
84257
84362
  return dir ? resolve16(cwd, dir) : cwd;
@@ -84627,8 +84732,10 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
84627
84732
  const verifyFlow = opts.verify && !opts.dryRun ? loadVerifyFlow(typeof opts.verify === "string" ? opts.verify : void 0, targetDir) : void 0;
84628
84733
  const collectionStartedAt = performance.now();
84629
84734
  const collected = collectFiles(targetDir, {
84630
- include: opts.include ?? []
84735
+ include: opts.include ?? [],
84736
+ deployBlobs: process.env.SOMEWHERE_DEPLOY_BLOBS === "1" && !opts.dryRun && opts.scope !== "functions"
84631
84737
  });
84738
+ const hashStartedAt = collected.blobs?.size && opts.timing ? performance.now() : void 0;
84632
84739
  const publishedHashes = hashFiles(targetDir, collected.published);
84633
84740
  const collectionEndedAt = performance.now();
84634
84741
  const collectionMs = collectionEndedAt - collectionStartedAt;
@@ -84643,7 +84750,8 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
84643
84750
  error(sensitiveRefusal);
84644
84751
  process.exit(1);
84645
84752
  }
84646
- const sizeRefusal = oversizeRefusal(collected);
84753
+ const tooLargeBlob = [...collected.blobs ?? []].find(([, size]) => size > MAX_DEPLOY_BLOB_BYTES);
84754
+ const sizeRefusal = tooLargeBlob ? `"${tooLargeBlob[0]}" exceeds the 25 MiB static file limit. Reduce its size or serve it from file storage.` : oversizeRefusal(collected);
84647
84755
  if (sizeRefusal) {
84648
84756
  if (opts.json)
84649
84757
  printJsonError("FILE_TOO_LARGE", sizeRefusal);
@@ -84663,16 +84771,24 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
84663
84771
  for (const [path3, content] of Object.entries(submittedFunctions))
84664
84772
  sizes.set(path3, Buffer.byteLength(content));
84665
84773
  const payloadBytes = [...sizes.values()].reduce((total, bytes) => total + bytes, 0);
84666
- const limitBytes = 20 * 1024 * 1024;
84774
+ const limitBytes = MAX_INLINE_DEPLOY_BYTES;
84667
84775
  if (payloadBytes > limitBytes) {
84668
- const message3 = `This deploy contains ${(payloadBytes / 1024 ** 2).toFixed(1)} MiB of files. The limit is 20 MiB per deploy. Move large assets to file storage before deploying.`;
84776
+ const message3 = `This deploy contains ${(payloadBytes / 1024 ** 2).toFixed(1)} MiB of files. The inline limit is 20 MiB per deploy. Move large assets to file storage before deploying.`;
84669
84777
  if (opts.json)
84670
84778
  printJsonError("DEPLOY_TOO_LARGE", message3, { payload_bytes: payloadBytes, limit_bytes: limitBytes });
84671
84779
  else
84672
84780
  error(message3);
84673
84781
  process.exit(1);
84674
84782
  }
84675
- if (Object.keys(files).length === 0 && Object.keys(binaryFiles).length === 0 && Object.keys(functions).length === 0) {
84783
+ if (collected.blobs?.size && collected.published.length > 2e4) {
84784
+ const message3 = "A site can contain up to 20,000 files.";
84785
+ if (opts.json)
84786
+ printJsonError("DEPLOY_TOO_MANY_FILES", message3);
84787
+ else
84788
+ error(message3);
84789
+ process.exit(1);
84790
+ }
84791
+ if (!collected.blobs?.size && Object.keys(files).length === 0 && Object.keys(binaryFiles).length === 0 && Object.keys(functions).length === 0) {
84676
84792
  const message3 = `No deployable source found. Create an index.html or add raw app source files, or add API handlers under api/, then run \`${cliInvocation()} deploy\` again.`;
84677
84793
  if (opts.json)
84678
84794
  printJsonError("NO_DEPLOYABLE_SOURCE", message3);
@@ -84687,7 +84803,7 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
84687
84803
  const sourceUnchanged = !opts.project && !opts.temporary && unchangedSinceLastPublish(foundProjectEntry, targetDir, publishedHashes);
84688
84804
  if (sourceUnchanged)
84689
84805
  process.stderr.write("No file changed since this folder's last deploy; types were not checked again.\n");
84690
- const hasTsconfig = !sourceUnchanged && existsSync29(join34(targetDir, "tsconfig.json"));
84806
+ const hasTsconfig = !sourceUnchanged && existsSync29(join35(targetDir, "tsconfig.json"));
84691
84807
  const missingDependencies = hasTsconfig && missingProjectDependencies(targetDir).length > 0;
84692
84808
  const checkingTypes = hasTsconfig && !missingDependencies;
84693
84809
  if (checkingTypes && typecheckCompilerSource(targetDir) === "npx") {
@@ -84993,8 +85109,12 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
84993
85109
  if (process.stderr.isTTY)
84994
85110
  spinner?.start();
84995
85111
  }
84996
- const totalFiles = Object.keys(files).length + Object.keys(binaryFiles).length + Object.keys(functions).length;
85112
+ const totalFiles = Object.keys(files).length + Object.keys(binaryFiles).length + (collected.blobs?.size ?? 0) + Object.keys(functions).length;
84997
85113
  const inventory = uploadInventory(files, binaryFiles, functions, scope);
85114
+ if (collected.blobs?.size) {
85115
+ inventory.static_files.push(...collected.blobs.keys());
85116
+ inventory.static_files.sort((a, b2) => a.localeCompare(b2));
85117
+ }
84998
85118
  if (opts.dryRun && !opts.json) {
84999
85119
  spinner?.stop();
85000
85120
  info(dim(`Dry run: sending ${totalFiles} files to Somewhere to check what would change. Nothing is published.`));
@@ -85109,6 +85229,17 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
85109
85229
  }
85110
85230
  return;
85111
85231
  }
85232
+ if (collected.blobs?.size) {
85233
+ spinner?.stop();
85234
+ const { blobFiles, checkMs, uploadMs } = await uploadDeployBlobs(client, targetDir, projectId, collected.blobs, publishedHashes);
85235
+ body.blob_files = blobFiles;
85236
+ if (hashStartedAt !== void 0) {
85237
+ process.stderr.write(`Static file timings (ms) \u2014 hash ${Math.round(collectionEndedAt - hashStartedAt)}, check ${Math.round(checkMs)}, upload ${Math.round(uploadMs)}
85238
+ `);
85239
+ }
85240
+ if (process.stderr.isTTY)
85241
+ spinner?.start();
85242
+ }
85112
85243
  const requestStartedAt = performance.now();
85113
85244
  deployRequestStartedAt = (/* @__PURE__ */ new Date()).toISOString();
85114
85245
  const preparationMs = requestStartedAt - collectionEndedAt;
@@ -85573,7 +85704,7 @@ function withLocalEnvHint(warning, dir) {
85573
85704
  if (!key)
85574
85705
  return warning;
85575
85706
  try {
85576
- const source = readFileSync30(join34(dir, ".env"), "utf8");
85707
+ const source = readFileSync30(join35(dir, ".env"), "utf8");
85577
85708
  if (new RegExp(`^\\s*(?:export\\s+)?${key}\\s*=`, "m").test(source)) {
85578
85709
  return `${warning} Copy ${key} from your local .env file.`;
85579
85710
  }
@@ -85890,6 +86021,7 @@ var init_deploy = __esm({
85890
86021
  init_build_errors();
85891
86022
  init_config();
85892
86023
  init_project_urls();
86024
+ init_deploy_blobs();
85893
86025
  init_files();
85894
86026
  init_version();
85895
86027
  init_temp_auth();
@@ -86087,7 +86219,7 @@ var init_deploys = __esm({
86087
86219
 
86088
86220
  // dist/commands/pull.js
86089
86221
  import { existsSync as existsSync30, lstatSync as lstatSync4, mkdirSync as mkdirSync15, readFileSync as readFileSync31, readdirSync as readdirSync7, rmSync as rmSync12, writeFileSync as writeFileSync19 } from "node:fs";
86090
- import { basename as basename6, dirname as dirname12, join as join35, relative as relative10, resolve as resolve17 } from "node:path";
86222
+ import { basename as basename6, dirname as dirname12, join as join36, relative as relative10, resolve as resolve17 } from "node:path";
86091
86223
  function registerPull(program2) {
86092
86224
  program2.command("pull [project]").description(`Download a project's deployed source files to the current directory. Scaffolds a tsconfig.json + package.json (only if absent) so \`${cliInvocation()} typecheck\` can catch undefined symbols locally before you deploy. In a linked folder, plain pull is the safe update when live is newer: files you have not edited move to the live version, your local edits and local-only files (AGENTS.md, notes, tests) are kept, and it stops without writing anything if a file changed both here and live.`).option("--env <env>", "Environment to pull from (dev or prod)", "prod").option("--out <dir>", "Output directory", ".").option("--force", "Also replace files you edited here with live, and delete published files you edited that live no longer has. Never deletes a file a deploy would not upload (AGENTS.md, CLAUDE.md, README.md, tests, dotfiles, .somewhereignore matches)").option("--json", "Print the raw source response as JSON").action(async (projectArg, opts) => {
86093
86225
  const token = getToken();
@@ -86124,7 +86256,7 @@ function registerPull(program2) {
86124
86256
  }
86125
86257
  spinner?.stop();
86126
86258
  const deployStateEntry = loadProjectConfigEntry(outDir);
86127
- const configStat = lstatSync4(join35(outDir, ".somewhere.json"), { throwIfNoEntry: false });
86259
+ const configStat = lstatSync4(join36(outDir, ".somewhere.json"), { throwIfNoEntry: false });
86128
86260
  if (configStat && (configStat.isSymbolicLink() || !configStat.isFile() || !deployStateEntry)) {
86129
86261
  error("Cannot read the destination .somewhere.json. Pull into a fresh folder or repair the link first.");
86130
86262
  process.exit(1);
@@ -86160,7 +86292,7 @@ function registerPull(program2) {
86160
86292
  if (i < parts.length && source.has(parts.slice(0, i).join("/"))) {
86161
86293
  throw new Error(`Conflicting exported source path: ${path3}`);
86162
86294
  }
86163
- const target2 = join35(outDir, ...parts.slice(0, i));
86295
+ const target2 = join36(outDir, ...parts.slice(0, i));
86164
86296
  const stat7 = lstatSync4(target2, { throwIfNoEntry: false });
86165
86297
  if (!stat7)
86166
86298
  continue;
@@ -86168,7 +86300,7 @@ function registerPull(program2) {
86168
86300
  throw new Error(`Pull would conflict with local path ${path3}. Pull into a fresh folder.`);
86169
86301
  }
86170
86302
  }
86171
- const target = join35(outDir, path3);
86303
+ const target = join36(outDir, path3);
86172
86304
  if (!existsSync30(target))
86173
86305
  continue;
86174
86306
  const local = readFileSync31(target);
@@ -86196,7 +86328,7 @@ function registerPull(program2) {
86196
86328
  }
86197
86329
  const written = [];
86198
86330
  const writeOne = /* @__PURE__ */ __name((relPath, contents) => {
86199
- const target = join35(outDir, relPath);
86331
+ const target = join36(outDir, relPath);
86200
86332
  if (existsSync30(target) && !overwrite.has(relPath)) {
86201
86333
  return;
86202
86334
  }
@@ -86259,18 +86391,18 @@ function registerPull(program2) {
86259
86391
  }
86260
86392
  function scaffoldTypecheckFiles(outDir, staticFiles) {
86261
86393
  const added = [];
86262
- const tsconfigPath = join35(outDir, SCAFFOLD_TSCONFIG_FILENAME);
86394
+ const tsconfigPath = join36(outDir, SCAFFOLD_TSCONFIG_FILENAME);
86263
86395
  if (!existsSync30(tsconfigPath)) {
86264
86396
  writeFileSync19(tsconfigPath, buildScaffoldTsconfig());
86265
86397
  added.push(SCAFFOLD_TSCONFIG_FILENAME);
86266
86398
  }
86267
- const packagePath = join35(outDir, SCAFFOLD_PACKAGE_FILENAME);
86399
+ const packagePath = join36(outDir, SCAFFOLD_PACKAGE_FILENAME);
86268
86400
  if (!existsSync30(packagePath)) {
86269
86401
  const deps = extractDeps(staticFiles["package.json"]);
86270
86402
  writeFileSync19(packagePath, buildScaffoldPackageJson(basename6(outDir), deps));
86271
86403
  added.push(SCAFFOLD_PACKAGE_FILENAME);
86272
86404
  }
86273
- const gitignorePath = join35(outDir, SCAFFOLD_GITIGNORE_FILENAME);
86405
+ const gitignorePath = join36(outDir, SCAFFOLD_GITIGNORE_FILENAME);
86274
86406
  if (!existsSync30(gitignorePath)) {
86275
86407
  writeFileSync19(gitignorePath, buildScaffoldGitignore());
86276
86408
  added.push(SCAFFOLD_GITIGNORE_FILENAME);
@@ -86292,7 +86424,7 @@ function reconcileRemovedFiles(outDir, expected, force, base = null) {
86292
86424
  for (const entry of readdirSync7(dir, { withFileTypes: true })) {
86293
86425
  if (IGNORE.has(entry.name) || entry.name.startsWith(".") && entry.name !== ".well-known")
86294
86426
  continue;
86295
- const fullPath = join35(dir, entry.name);
86427
+ const fullPath = join36(dir, entry.name);
86296
86428
  if (entry.isDirectory()) {
86297
86429
  walk2(fullPath);
86298
86430
  continue;
@@ -87176,7 +87308,7 @@ var init_db_rows = __esm({
87176
87308
  import { createWriteStream as createWriteStream2, writeFileSync as writeFileSync20 } from "node:fs";
87177
87309
  import { rename, unlink } from "node:fs/promises";
87178
87310
  import { randomUUID as randomUUID7 } from "node:crypto";
87179
- import { basename as basename7, dirname as dirname13, join as join36 } from "node:path";
87311
+ import { basename as basename7, dirname as dirname13, join as join37 } from "node:path";
87180
87312
  import { Readable as Readable2 } from "node:stream";
87181
87313
  import { pipeline as pipeline2 } from "node:stream/promises";
87182
87314
  async function backgroundExport(client, projectId, plane, output, json, spinner) {
@@ -87208,7 +87340,7 @@ async function backgroundExport(client, projectId, plane, output, json, spinner)
87208
87340
  throw new Error(`Downloading the export failed (HTTP ${response.status}).`);
87209
87341
  const body = Readable2.fromWeb(response.body);
87210
87342
  if (output) {
87211
- const temp = join36(dirname13(output), `.${basename7(output)}.${randomUUID7()}.tmp`);
87343
+ const temp = join37(dirname13(output), `.${basename7(output)}.${randomUUID7()}.tmp`);
87212
87344
  try {
87213
87345
  await pipeline2(body, createWriteStream2(temp, { flags: "wx", mode: 384 }));
87214
87346
  await rename(temp, output);
@@ -87888,16 +88020,16 @@ var init_postgres = __esm({
87888
88020
 
87889
88021
  // dist/lib/local-docs.js
87890
88022
  import { appendFileSync as appendFileSync3, existsSync as existsSync31, lstatSync as lstatSync5, mkdirSync as mkdirSync16, mkdtempSync as mkdtempSync3, readFileSync as readFileSync33, renameSync as renameSync5, rmSync as rmSync13, writeFileSync as writeFileSync21 } from "node:fs";
87891
- import { join as join37 } from "node:path";
88023
+ import { join as join38 } from "node:path";
87892
88024
  function localDocsVersion(root = process.cwd()) {
87893
- const path3 = join37(root, FOLDER, DOCS, STAMP);
88025
+ const path3 = join38(root, FOLDER, DOCS, STAMP);
87894
88026
  if (!existsSync31(path3))
87895
88027
  return void 0;
87896
88028
  const stamp2 = JSON.parse(readFileSync33(path3, "utf8"));
87897
88029
  return typeof stamp2.version === "string" && /^[a-f0-9]{16}$/.test(stamp2.version) ? stamp2.version : void 0;
87898
88030
  }
87899
88031
  function ensureGitIgnore(root) {
87900
- const path3 = join37(root, ".gitignore");
88032
+ const path3 = join38(root, ".gitignore");
87901
88033
  const text = existsSync31(path3) ? readFileSync33(path3, "utf8") : "";
87902
88034
  if (text.split(/\r?\n/).some((line) => line === ".somewhere/" || line === "/.somewhere/"))
87903
88035
  return;
@@ -87905,8 +88037,8 @@ function ensureGitIgnore(root) {
87905
88037
  `);
87906
88038
  }
87907
88039
  function saveLocalDocs(version2, files, root = process.cwd()) {
87908
- const state = join37(root, FOLDER);
87909
- const target = join37(state, DOCS);
88040
+ const state = join38(root, FOLDER);
88041
+ const target = join38(state, DOCS);
87910
88042
  if (existsSync31(state) && !lstatSync5(state).isDirectory())
87911
88043
  throw new Error(`${state} must be a directory.`);
87912
88044
  if (existsSync31(target) && (!lstatSync5(target).isDirectory() || !localDocsVersion(root))) {
@@ -87914,17 +88046,17 @@ function saveLocalDocs(version2, files, root = process.cwd()) {
87914
88046
  }
87915
88047
  ensureGitIgnore(root);
87916
88048
  mkdirSync16(state, { recursive: true });
87917
- const staging = mkdtempSync3(join37(state, "docs-pull-"));
87918
- const next = join37(staging, "next");
87919
- const previous = join37(staging, "previous");
88049
+ const staging = mkdtempSync3(join38(state, "docs-pull-"));
88050
+ const next = join38(staging, "next");
88051
+ const previous = join38(staging, "previous");
87920
88052
  let installed = false;
87921
88053
  try {
87922
88054
  mkdirSync16(next);
87923
88055
  for (const [name, content] of files)
87924
- writeFileSync21(join37(next, name), content, { flag: "wx" });
88056
+ writeFileSync21(join38(next, name), content, { flag: "wx" });
87925
88057
  const pulledAt = (/* @__PURE__ */ new Date()).toISOString();
87926
- writeFileSync21(join37(next, STAMP), JSON.stringify({ version: version2, pulledAt }) + "\n");
87927
- writeFileSync21(join37(next, "README.md"), `# Somewhere docs
88058
+ writeFileSync21(join38(next, STAMP), JSON.stringify({ version: version2, pulledAt }) + "\n");
88059
+ writeFileSync21(join38(next, "README.md"), `# Somewhere docs
87928
88060
 
87929
88061
  Pulled platform docs version ${version2} on ${pulledAt}. Run \`${cliInvocation()} docs\` to check whether this copy is older than the current docs and \`${cliInvocation()} docs pull\` to refresh it.
87930
88062
  `, { flag: "wx" });
@@ -88004,11 +88136,11 @@ var init_advisor_context = __esm({
88004
88136
  // dist/lib/advisor-runs.js
88005
88137
  import { randomBytes as randomBytes7, randomUUID as randomUUID8 } from "node:crypto";
88006
88138
  import { chmodSync as chmodSync4, existsSync as existsSync32, mkdirSync as mkdirSync17, readFileSync as readFileSync35, renameSync as renameSync6, writeFileSync as writeFileSync22 } from "node:fs";
88007
- import { join as join38 } from "node:path";
88139
+ import { join as join39 } from "node:path";
88008
88140
  function path2(id) {
88009
88141
  if (!/^[a-f0-9-]{36}$/i.test(id))
88010
88142
  throw Error("Invalid Advisor request ID.");
88011
- return join38(directory(), id + ".json");
88143
+ return join39(directory(), id + ".json");
88012
88144
  }
88013
88145
  function save(record3) {
88014
88146
  mkdirSync17(directory(), { recursive: true, mode: 448 });
@@ -88146,7 +88278,7 @@ var init_advisor_runs = __esm({
88146
88278
  init_config();
88147
88279
  init_http();
88148
88280
  init_advisor_context();
88149
- directory = /* @__PURE__ */ __name(() => join38(cliConfigDir(), "advisor-runs"), "directory");
88281
+ directory = /* @__PURE__ */ __name(() => join39(cliConfigDir(), "advisor-runs"), "directory");
88150
88282
  __name(path2, "path");
88151
88283
  __name(save, "save");
88152
88284
  PAYLOAD_RETENTION_MS = 24 * 60 * 60 * 1e3;
@@ -88165,7 +88297,7 @@ var init_advisor_runs = __esm({
88165
88297
  // dist/lib/advisor-app.js
88166
88298
  import { createHash as createHash8 } from "node:crypto";
88167
88299
  import { existsSync as existsSync33, mkdirSync as mkdirSync18, readFileSync as readFileSync36, rmSync as rmSync14, writeFileSync as writeFileSync23 } from "node:fs";
88168
- import { join as join39 } from "node:path";
88300
+ import { join as join40 } from "node:path";
88169
88301
  async function gatherAdvisorApp(client, ref) {
88170
88302
  const project = await client.call("GET", `/projects/${encodeURIComponent(ref)}`);
88171
88303
  if (typeof project.id !== "string" || project.deleted === true)
@@ -88199,7 +88331,7 @@ async function gatherAdvisorApp(client, ref) {
88199
88331
  }
88200
88332
  function loadAdvisorTurns(dir, projectId, account, now2 = Date.now()) {
88201
88333
  try {
88202
- const saved = JSON.parse(readFileSync36(join39(dir, FILE), "utf8"));
88334
+ const saved = JSON.parse(readFileSync36(join40(dir, FILE), "utf8"));
88203
88335
  if (saved.project_id !== projectId || saved.owner !== ownerOf(account) || !Array.isArray(saved.turns))
88204
88336
  return [];
88205
88337
  const last = saved.turns.at(-1);
@@ -88209,16 +88341,16 @@ function loadAdvisorTurns(dir, projectId, account, now2 = Date.now()) {
88209
88341
  }
88210
88342
  }
88211
88343
  function saveAdvisorTurn(dir, projectId, account, earlier, turn) {
88212
- mkdirSync18(join39(dir, DIR), { recursive: true, mode: 448 });
88213
- writeFileSync23(join39(dir, FILE), JSON.stringify({ project_id: projectId, owner: ownerOf(account), turns: [...earlier, { question: turn.question.slice(0, 2e3), answer: turn.answer.slice(0, 3e3), at: turn.at }].slice(-3) }) + "\n", { mode: 384 });
88344
+ mkdirSync18(join40(dir, DIR), { recursive: true, mode: 448 });
88345
+ writeFileSync23(join40(dir, FILE), JSON.stringify({ project_id: projectId, owner: ownerOf(account), turns: [...earlier, { question: turn.question.slice(0, 2e3), answer: turn.answer.slice(0, 3e3), at: turn.at }].slice(-3) }) + "\n", { mode: 384 });
88214
88346
  ensureAdvisorStateIgnored(dir);
88215
88347
  }
88216
88348
  function clearAdvisorTurns(dir) {
88217
- if (existsSync33(join39(dir, FILE)))
88218
- rmSync14(join39(dir, FILE), { force: true });
88349
+ if (existsSync33(join40(dir, FILE)))
88350
+ rmSync14(join40(dir, FILE), { force: true });
88219
88351
  }
88220
88352
  function ensureAdvisorStateIgnored(dir) {
88221
- const path3 = join39(dir, ".gitignore");
88353
+ const path3 = join40(dir, ".gitignore");
88222
88354
  const covered = [".somewhere/", ".somewhere", "/.somewhere/", "/.somewhere", ".somewhere/advisor-conversation.json"];
88223
88355
  if (!existsSync33(path3)) {
88224
88356
  writeFileSync23(path3, "# somewhere: local CLI state (Advisor follow-ups, test users)\n.somewhere/\n");
@@ -88238,7 +88370,7 @@ var init_advisor_app = __esm({
88238
88370
  "use strict";
88239
88371
  __name(gatherAdvisorApp, "gatherAdvisorApp");
88240
88372
  DIR = ".somewhere";
88241
- FILE = join39(DIR, "advisor-conversation.json");
88373
+ FILE = join40(DIR, "advisor-conversation.json");
88242
88374
  IDLE_MS = 30 * 6e4;
88243
88375
  ownerOf = /* @__PURE__ */ __name((account) => createHash8("sha256").update(`advisor:${account}`).digest("hex"), "ownerOf");
88244
88376
  __name(loadAdvisorTurns, "loadAdvisorTurns");
@@ -90366,7 +90498,7 @@ var init_claim = __esm({
90366
90498
  import { createRequire as createRequire9 } from "node:module";
90367
90499
  import { realpathSync as realpathSync4 } from "node:fs";
90368
90500
  import { createConnection, createServer as createNetServer } from "node:net";
90369
- import { join as join40 } from "node:path";
90501
+ import { join as join41 } from "node:path";
90370
90502
  import { pathToFileURL as pathToFileURL3 } from "node:url";
90371
90503
  function deployedOrigin(value) {
90372
90504
  const url3 = new URL(value);
@@ -90464,7 +90596,7 @@ async function startFrontendDev(cwd, target, port = 8787, open4 = false) {
90464
90596
  throw new Error(INSTALL_PROJECT_DEPENDENCIES);
90465
90597
  let vitePath;
90466
90598
  try {
90467
- vitePath = createRequire9(join40(cwd, "package.json")).resolve("vite");
90599
+ vitePath = createRequire9(join41(cwd, "package.json")).resolve("vite");
90468
90600
  } catch {
90469
90601
  if (readProjectPin(cwd)?.versionOnly) {
90470
90602
  throw new Error("Install the local frontend tools: npm install -D --save-exact vite@7.2.2");
@@ -90608,7 +90740,7 @@ var init_preview_jobs = __esm({
90608
90740
  // dist/commands/dev.js
90609
90741
  import { randomUUID as randomUUID9 } from "node:crypto";
90610
90742
  import { existsSync as existsSync36 } from "node:fs";
90611
- import { join as join41, relative as relative11 } from "node:path";
90743
+ import { join as join42, relative as relative11 } from "node:path";
90612
90744
  function previewFinishedReason(err) {
90613
90745
  if (!(err instanceof CliApiError) || err.code !== "DRAFT_SESSION_TERMINAL")
90614
90746
  return null;
@@ -91596,7 +91728,7 @@ async function deployBatch(client, projectId, cwd, changed, deleted, draftId, ex
91596
91728
  const updateBinary = {};
91597
91729
  const deleteKeys = [];
91598
91730
  for (const rel of changed) {
91599
- const abs = join41(cwd, rel);
91731
+ const abs = join42(cwd, rel);
91600
91732
  if (!existsSync36(abs))
91601
91733
  continue;
91602
91734
  classifyInto({ files: updateFiles, functions: updateFunctions, binaryFiles: updateBinary }, cwd, rel);
@@ -91662,7 +91794,7 @@ async function deployBatch(client, projectId, cwd, changed, deleted, draftId, ex
91662
91794
  for (const rel of deleted)
91663
91795
  delete nextFiles[rel];
91664
91796
  for (const rel of changed)
91665
- if (existsSync36(join41(cwd, rel)))
91797
+ if (existsSync36(join42(cwd, rel)))
91666
91798
  Object.assign(nextFiles, hashFiles(cwd, [rel]));
91667
91799
  savePreviewRecord(cwd, { ...record3, preview_id: nextCandidate, files: nextFiles });
91668
91800
  }
@@ -91858,7 +91990,7 @@ var init_dev = __esm({
91858
91990
 
91859
91991
  // dist/commands/check.js
91860
91992
  import { existsSync as existsSync37 } from "node:fs";
91861
- import { join as join42, resolve as resolve21 } from "node:path";
91993
+ import { join as join43, resolve as resolve21 } from "node:path";
91862
91994
  function buildCheckBody(collected, projectId) {
91863
91995
  const body = { project_id: projectId, files: collected.files };
91864
91996
  if (Object.keys(collected.functions).length > 0)
@@ -91963,7 +92095,7 @@ async function runLocalPreflight(targetDir, collected, typecheck = async (dir) =
91963
92095
  if (collected.excluded.length)
91964
92096
  source.not_published = collected.excluded;
91965
92097
  let typecheckStep;
91966
- if (!existsSync37(join42(targetDir, "tsconfig.json"))) {
92098
+ if (!existsSync37(join43(targetDir, "tsconfig.json"))) {
91967
92099
  typecheckStep = { name: "typecheck", status: "skipped", reason: MISSING_TSCONFIG_GUIDANCE };
91968
92100
  } else if (missingProjectDependencies(targetDir).length) {
91969
92101
  typecheckStep = { name: "typecheck", status: "skipped", reason: missingTypecheckDependenciesMessage() };
@@ -92156,7 +92288,7 @@ var init_check = __esm({
92156
92288
  });
92157
92289
 
92158
92290
  // dist/commands/api.js
92159
- import { createReadStream } from "node:fs";
92291
+ import { createReadStream as createReadStream2 } from "node:fs";
92160
92292
  import { stat as stat5 } from "node:fs/promises";
92161
92293
  import { extname as extname5, resolve as resolve22 } from "node:path";
92162
92294
  function registerApi(program2) {
@@ -92218,7 +92350,7 @@ function registerApi(program2) {
92218
92350
  };
92219
92351
  if (file)
92220
92352
  headers["Content-Length"] = String(file.size);
92221
- const response = await client.callStream(method.toUpperCase(), apiPath, () => source ? createReadStream(source) : process.stdin, {
92353
+ const response = await client.callStream(method.toUpperCase(), apiPath, () => source ? createReadStream2(source) : process.stdin, {
92222
92354
  headers,
92223
92355
  timeoutMs: LONG_CALL_TIMEOUT_MS,
92224
92356
  replayableBody: Boolean(source)
@@ -92377,10 +92509,10 @@ var init_api2 = __esm({
92377
92509
  });
92378
92510
 
92379
92511
  // dist/commands/fs.js
92380
- import { createReadStream as createReadStream2, createWriteStream as createWriteStream3 } from "node:fs";
92512
+ import { createReadStream as createReadStream3, createWriteStream as createWriteStream3 } from "node:fs";
92381
92513
  import { stat as stat6, rename as rename2, unlink as unlink2 } from "node:fs/promises";
92382
92514
  import { randomUUID as randomUUID10 } from "node:crypto";
92383
- import { basename as basename9, dirname as dirname14, extname as extname6, join as join43, resolve as resolve23 } from "node:path";
92515
+ import { basename as basename9, dirname as dirname14, extname as extname6, join as join44, resolve as resolve23 } from "node:path";
92384
92516
  import { pipeline as pipeline3 } from "node:stream/promises";
92385
92517
  function registerFs(program2) {
92386
92518
  const fs2 = program2.command("fs").description("Manage project file storage");
@@ -92395,7 +92527,7 @@ function registerFs(program2) {
92395
92527
  throw new Error(`${local} is not a file.`);
92396
92528
  const project = resolveProject(opts.project);
92397
92529
  const client = new ApiClient(getToken());
92398
- const result = await readEnvelope(await client.callStream("PUT", fsPath(project, remote), () => createReadStream2(source), {
92530
+ const result = await readEnvelope(await client.callStream("PUT", fsPath(project, remote), () => createReadStream3(source), {
92399
92531
  replayableBody: true,
92400
92532
  timeoutMs: LONG_CALL_TIMEOUT_MS,
92401
92533
  headers: {
@@ -92424,7 +92556,7 @@ function registerFs(program2) {
92424
92556
  if (!response.body)
92425
92557
  throw new Error("The server returned an empty file response.");
92426
92558
  const destination = resolve23(local);
92427
- tempPath = join43(dirname14(destination), `.${basename9(destination)}.${randomUUID10()}.tmp`);
92559
+ tempPath = join44(dirname14(destination), `.${basename9(destination)}.${randomUUID10()}.tmp`);
92428
92560
  await pipeline3(response.body, createWriteStream3(tempPath, { flags: "wx" }));
92429
92561
  await rename2(tempPath, destination);
92430
92562
  tempPath = void 0;
@@ -110234,7 +110366,7 @@ var require_polyfill = __commonJS({
110234
110366
  var {
110235
110367
  dirname: dirname17,
110236
110368
  isAbsolute: isAbsolute7,
110237
- join: join53,
110369
+ join: join54,
110238
110370
  parse: parse3,
110239
110371
  resolve: resolve27,
110240
110372
  sep: sep2,
@@ -110515,8 +110647,8 @@ var require_polyfill = __commonJS({
110515
110647
  const dir = await readdir3(src);
110516
110648
  for (let i = 0; i < dir.length; i++) {
110517
110649
  const item = dir[i];
110518
- const srcItem = join53(src, item);
110519
- const destItem = join53(dest, item);
110650
+ const srcItem = join54(src, item);
110651
+ const destItem = join54(dest, item);
110520
110652
  const { destStat } = await checkPaths(srcItem, destItem, opts);
110521
110653
  await startCopy(destStat, srcItem, destItem, opts);
110522
110654
  }
@@ -110592,7 +110724,7 @@ var require_cp = __commonJS({
110592
110724
  // node_modules/@npmcli/fs/lib/with-temp-dir.js
110593
110725
  var require_with_temp_dir = __commonJS({
110594
110726
  "node_modules/@npmcli/fs/lib/with-temp-dir.js"(exports, module) {
110595
- var { join: join53, sep: sep2 } = __require("path");
110727
+ var { join: join54, sep: sep2 } = __require("path");
110596
110728
  var getOptions = require_get_options();
110597
110729
  var { mkdir, mkdtemp, rm } = __require("fs/promises");
110598
110730
  var withTempDir = /* @__PURE__ */ __name(async (root, fn, opts) => {
@@ -110600,7 +110732,7 @@ var require_with_temp_dir = __commonJS({
110600
110732
  copy: ["tmpPrefix"]
110601
110733
  });
110602
110734
  await mkdir(root, { recursive: true });
110603
- const target = await mkdtemp(join53(`${root}${sep2}`, options2.tmpPrefix || ""));
110735
+ const target = await mkdtemp(join54(`${root}${sep2}`, options2.tmpPrefix || ""));
110604
110736
  let err;
110605
110737
  let result;
110606
110738
  try {
@@ -110625,13 +110757,13 @@ var require_with_temp_dir = __commonJS({
110625
110757
  var require_readdir_scoped = __commonJS({
110626
110758
  "node_modules/@npmcli/fs/lib/readdir-scoped.js"(exports, module) {
110627
110759
  var { readdir: readdir3 } = __require("fs/promises");
110628
- var { join: join53 } = __require("path");
110760
+ var { join: join54 } = __require("path");
110629
110761
  var readdirScoped = /* @__PURE__ */ __name(async (dir) => {
110630
110762
  const results = [];
110631
110763
  for (const item of await readdir3(dir)) {
110632
110764
  if (item.startsWith("@")) {
110633
- for (const scopedItem of await readdir3(join53(dir, item))) {
110634
- results.push(join53(item, scopedItem));
110765
+ for (const scopedItem of await readdir3(join54(dir, item))) {
110766
+ results.push(join54(item, scopedItem));
110635
110767
  }
110636
110768
  } else {
110637
110769
  results.push(item);
@@ -110646,7 +110778,7 @@ var require_readdir_scoped = __commonJS({
110646
110778
  // node_modules/@npmcli/fs/lib/move-file.js
110647
110779
  var require_move_file = __commonJS({
110648
110780
  "node_modules/@npmcli/fs/lib/move-file.js"(exports, module) {
110649
- var { dirname: dirname17, join: join53, resolve: resolve27, relative: relative15, isAbsolute: isAbsolute7 } = __require("path");
110781
+ var { dirname: dirname17, join: join54, resolve: resolve27, relative: relative15, isAbsolute: isAbsolute7 } = __require("path");
110650
110782
  var fs2 = __require("fs/promises");
110651
110783
  var pathExists = /* @__PURE__ */ __name(async (path3) => {
110652
110784
  try {
@@ -110676,7 +110808,7 @@ var require_move_file = __commonJS({
110676
110808
  if (sourceStat.isDirectory()) {
110677
110809
  const files = await fs2.readdir(source);
110678
110810
  await Promise.all(files.map(
110679
- (file) => moveFile(join53(source, file), join53(destination, file), options2, false, symlinks)
110811
+ (file) => moveFile(join54(source, file), join54(destination, file), options2, false, symlinks)
110680
110812
  ));
110681
110813
  } else if (sourceStat.isSymbolicLink()) {
110682
110814
  symlinks.push({ source, destination });
@@ -130044,12 +130176,12 @@ var require_url = __commonJS({
130044
130176
  "node_modules/tuf-js/dist/utils/url.js"(exports) {
130045
130177
  "use strict";
130046
130178
  Object.defineProperty(exports, "__esModule", { value: true });
130047
- exports.join = join53;
130179
+ exports.join = join54;
130048
130180
  var url_1 = __require("url");
130049
- function join53(base, path3) {
130181
+ function join54(base, path3) {
130050
130182
  return new url_1.URL(ensureTrailingSlash(base) + removeLeadingSlash(path3)).toString();
130051
130183
  }
130052
- __name(join53, "join");
130184
+ __name(join54, "join");
130053
130185
  function ensureTrailingSlash(path3) {
130054
130186
  return path3.endsWith("/") ? path3 : path3 + "/";
130055
130187
  }
@@ -132386,7 +132518,7 @@ var require_dist15 = __commonJS({
132386
132518
  // dist/lib/update-security.js
132387
132519
  import { createHash as createHash9, timingSafeEqual } from "node:crypto";
132388
132520
  import { mkdirSync as mkdirSync19, readFileSync as readFileSync39, statSync as statSync7 } from "node:fs";
132389
- import { join as join44 } from "node:path";
132521
+ import { join as join45 } from "node:path";
132390
132522
  import { Readable as Readable3 } from "node:stream";
132391
132523
  import { pipeline as pipeline4 } from "node:stream/promises";
132392
132524
  function expectedTarballUrl(version2) {
@@ -132751,8 +132883,8 @@ async function verifyLockedArtifact(artifact, extractionDir, release2) {
132751
132883
  seen2.add(path3);
132752
132884
  return true;
132753
132885
  });
132754
- const manifestPath = join44(extractionDir, "package.json");
132755
- const lockPath = join44(extractionDir, "npm-shrinkwrap.json");
132886
+ const manifestPath = join45(extractionDir, "package.json");
132887
+ const lockPath = join45(extractionDir, "npm-shrinkwrap.json");
132756
132888
  let manifest;
132757
132889
  let lock;
132758
132890
  try {
@@ -132796,7 +132928,7 @@ async function verifyLockedArtifact(artifact, extractionDir, release2) {
132796
132928
  }
132797
132929
  let bundledManifest;
132798
132930
  try {
132799
- const bundledPath = join44(extractionDir, ...lockPath2.split("/"), "package.json");
132931
+ const bundledPath = join45(extractionDir, ...lockPath2.split("/"), "package.json");
132800
132932
  bundledManifest = JSON.parse(readFileSync39(bundledPath, "utf8"));
132801
132933
  } catch (cause) {
132802
132934
  throw new Error(`the verified artifact has an unreadable bundled dependency ${lockPath2}: ${message(cause)}`);
@@ -132870,7 +133002,7 @@ import { randomBytes as randomBytes8 } from "node:crypto";
132870
133002
  import { closeSync as closeSync5, constants as constants2, fstatSync, mkdtempSync as mkdtempSync4, openSync as openSync5, readFileSync as readFileSync40, readSync, rmSync as rmSync15, unlinkSync as unlinkSync5, writeFileSync as writeFileSync25 } from "node:fs";
132871
133003
  import { createServer } from "node:http";
132872
133004
  import { tmpdir as tmpdir2 } from "node:os";
132873
- import { join as join45 } from "node:path";
133005
+ import { join as join46 } from "node:path";
132874
133006
  function refuse2(cause) {
132875
133007
  error(`Update refused: ${message2(cause)}.`);
132876
133008
  info(`To install the latest release with npm instead, run: ${teal(NPM_UPDATE_COMMAND)}`);
@@ -132878,7 +133010,7 @@ function refuse2(cause) {
132878
133010
  }
132879
133011
  function currentVersion2() {
132880
133012
  try {
132881
- const pkg = JSON.parse(readFileSync40(join45(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
133013
+ const pkg = JSON.parse(readFileSync40(join46(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
132882
133014
  return pkg.version;
132883
133015
  } catch {
132884
133016
  return "0.0.0";
@@ -133017,10 +133149,10 @@ async function serveArtifactSnapshot(artifact) {
133017
133149
  }
133018
133150
  async function installVerifiedTarball(tarballPath, tempDir, release2) {
133019
133151
  const ambientEnvironment = { ...process.env };
133020
- const packageDir = join45(tempDir, "authenticated-package");
133021
- const cacheDir = join45(tempDir, "empty-cache");
133022
- const userConfigPath = join45(tempDir, "user-npmrc");
133023
- const globalConfigPath = join45(tempDir, "global-npmrc");
133152
+ const packageDir = join46(tempDir, "authenticated-package");
133153
+ const cacheDir = join46(tempDir, "empty-cache");
133154
+ const userConfigPath = join46(tempDir, "user-npmrc");
133155
+ const globalConfigPath = join46(tempDir, "global-npmrc");
133024
133156
  writeFileSync25(userConfigPath, "", { mode: 384 });
133025
133157
  writeFileSync25(globalConfigPath, "", { mode: 384 });
133026
133158
  const artifact = snapshotAuthenticatedArtifact(tarballPath);
@@ -133092,8 +133224,8 @@ async function runUpdate(opts, dependencies = {}) {
133092
133224
  const provenance = await fetchJson(fetchImpl, release2.attestationUrl, "the official npm provenance endpoint");
133093
133225
  await (dependencies.verifyProvenance ?? verifyPublishedProvenance)(provenance, release2);
133094
133226
  const tarball = await downloadTarball(fetchImpl, release2);
133095
- tempDir = mkdtempSync4(join45(tmpdir2(), "somewhere-update-"));
133096
- const tarballPath = join45(tempDir, `cli-${release2.version}.tgz`);
133227
+ tempDir = mkdtempSync4(join46(tmpdir2(), "somewhere-update-"));
133228
+ const tarballPath = join46(tempDir, `cli-${release2.version}.tgz`);
133097
133229
  writeFileSync25(tarballPath, tarball, { mode: 384 });
133098
133230
  info(`Cryptographically verified provenance and integrity for ${CLI_PACKAGE}@${release2.version}.`);
133099
133231
  info(`Updating ${CLI_PACKAGE} from its authenticated dependency lock \u2026`);
@@ -135578,7 +135710,7 @@ import { randomUUID as randomUUID12 } from "node:crypto";
135578
135710
  import { setDefaultResultOrder } from "node:dns";
135579
135711
  import { lookup } from "node:dns/promises";
135580
135712
  import { existsSync as existsSync38, mkdirSync as mkdirSync20, readFileSync as readFileSync42, writeFileSync as writeFileSync26 } from "node:fs";
135581
- import { basename as basename10, dirname as dirname15, join as join46, relative as relative12, resolve as resolve24 } from "node:path";
135713
+ import { basename as basename10, dirname as dirname15, join as join47, relative as relative12, resolve as resolve24 } from "node:path";
135582
135714
  function launchOptions(extra = {}) {
135583
135715
  return { ...extra, args: ["--disable-features=AsyncDns", ...extra.args ?? []] };
135584
135716
  }
@@ -135628,7 +135760,7 @@ function undeployedChanges(root, projectId, preview = false) {
135628
135760
  return null;
135629
135761
  base = { project_id: record3.project_id, release_id: record3.preview_id, files: record3.files };
135630
135762
  } else {
135631
- const path3 = join46(root, ".somewhere", "base-files.json");
135763
+ const path3 = join47(root, ".somewhere", "base-files.json");
135632
135764
  if (!existsSync38(path3))
135633
135765
  return null;
135634
135766
  base = JSON.parse(readFileSync42(path3, "utf8"));
@@ -135801,7 +135933,7 @@ var init_app_test = __esm({
135801
135933
  for (const line of describeSweep(await sweepAccounts(control, root), "Before this script"))
135802
135934
  process.stderr.write(line + "\n");
135803
135935
  const scriptName = process.argv[1] ? basename10(process.argv[1]).replace(/\.[cm]?[jt]s$/, "") : "app-check";
135804
- const app = new _AppTest(root, control, resolve24(root, options2.results ?? join46(".somewhere", `${scriptName}${preview ? "-preview" : ""}.json`)));
135936
+ const app = new _AppTest(root, control, resolve24(root, options2.results ?? join47(".somewhere", `${scriptName}${preview ? "-preview" : ""}.json`)));
135805
135937
  return app;
135806
135938
  }
135807
135939
  /** What this run tests: the project, environment, preview, origin and script. */
@@ -136575,7 +136707,7 @@ var init_reference_check_note = __esm({
136575
136707
  // dist/lib/test-scripts.js
136576
136708
  import { createRequire as createRequire10 } from "node:module";
136577
136709
  import { existsSync as existsSync39, mkdirSync as mkdirSync21, readFileSync as readFileSync43, readdirSync as readdirSync8, rmSync as rmSync17, statSync as statSync8, writeFileSync as writeFileSync27 } from "node:fs";
136578
- import { dirname as dirname16, join as join47, relative as relative13, resolve as resolve25 } from "node:path";
136710
+ import { dirname as dirname16, join as join48, relative as relative13, resolve as resolve25 } from "node:path";
136579
136711
  import { spawn as spawn7, spawnSync as spawnSync5 } from "node:child_process";
136580
136712
  function hasSpecFiles(root) {
136581
136713
  const walk2 = /* @__PURE__ */ __name((dir) => {
@@ -136584,24 +136716,24 @@ function hasSpecFiles(root) {
136584
136716
  for (const entry of readdirSync8(dir, { withFileTypes: true })) {
136585
136717
  if (entry.name === "node_modules" || entry.name.startsWith("."))
136586
136718
  continue;
136587
- const path3 = join47(dir, entry.name);
136719
+ const path3 = join48(dir, entry.name);
136588
136720
  if (entry.isDirectory() ? walk2(path3) : /\.spec\.ts$/.test(entry.name))
136589
136721
  return true;
136590
136722
  }
136591
136723
  return false;
136592
136724
  }, "walk");
136593
- return walk2(join47(root, "tests"));
136725
+ return walk2(join48(root, "tests"));
136594
136726
  }
136595
136727
  function listScripts(root, files) {
136596
136728
  if (files.length)
136597
136729
  return files.map((file) => relative13(root, resolve25(root, file)));
136598
- const dir = join47(root, "tests");
136730
+ const dir = join48(root, "tests");
136599
136731
  if (!existsSync39(dir))
136600
136732
  return [];
136601
- return readdirSync8(dir).filter((name) => isScript(name) && statSync8(join47(dir, name)).isFile()).sort().map((name) => join47("tests", name));
136733
+ return readdirSync8(dir).filter((name) => isScript(name) && statSync8(join48(dir, name)).isFile()).sort().map((name) => join48("tests", name));
136602
136734
  }
136603
136735
  function scriptBrowserEnv(root) {
136604
- const require6 = createRequire10(join47(root, "package.json"));
136736
+ const require6 = createRequire10(join48(root, "package.json"));
136605
136737
  let cli;
136606
136738
  try {
136607
136739
  cli = require6.resolve("@playwright/test/cli");
@@ -136612,7 +136744,7 @@ function scriptBrowserEnv(root) {
136612
136744
  const probe = spawnSync5(process.execPath, ["-e", "require(process.argv[1]).chromium.launch().then(b => b.close()).then(() => process.exit(0), () => process.exit(3))", require6.resolve("@playwright/test")], { env, stdio: "ignore" });
136613
136745
  if (probe.status === 0)
136614
136746
  return env;
136615
- env.PLAYWRIGHT_BROWSERS_PATH ??= join47(cliConfigDir(), "cache", "playwright");
136747
+ env.PLAYWRIGHT_BROWSERS_PATH ??= join48(cliConfigDir(), "cache", "playwright");
136616
136748
  process.stderr.write("Installing Playwright Chromium in the CLI cache (once).\n");
136617
136749
  const install = spawnSync5(process.execPath, [cli, "install", "chromium"], { stdio: "inherit", env });
136618
136750
  if (install.status !== 0)
@@ -136635,7 +136767,7 @@ async function runScripts(root, scripts, extraArgs, env = scriptBrowserEnv(root)
136635
136767
  env = testImportEnv(root, env);
136636
136768
  const results = [];
136637
136769
  for (const script of scripts) {
136638
- if (!existsSync39(join47(root, script))) {
136770
+ if (!existsSync39(join48(root, script))) {
136639
136771
  results.push({ script, ok: false, exitCode: 1, ms: 0, reason: "no such file" });
136640
136772
  continue;
136641
136773
  }
@@ -136644,7 +136776,7 @@ async function runScripts(root, scripts, extraArgs, env = scriptBrowserEnv(root)
136644
136776
  `);
136645
136777
  const started = performance.now();
136646
136778
  let output = "";
136647
- const handOver = join47(root, ".somewhere", "tests", `report-${results.length}.json`);
136779
+ const handOver = join48(root, ".somewhere", "tests", `report-${results.length}.json`);
136648
136780
  mkdirSync21(dirname16(handOver), { recursive: true });
136649
136781
  rmSync17(handOver, { force: true });
136650
136782
  const askedForBrowserLog = /(^|,)\s*(pw:browser|pw:\*|\*)\s*(,|$)/.test(env.DEBUG ?? "");
@@ -136707,7 +136839,7 @@ function describeScriptResults(results, options2 = {}) {
136707
136839
  return results.some((result) => result.browserCrashed) ? lines.map((line) => line.startsWith("Next: ") ? `Next: give the browser access as the FAIL line says, then run ${TEST_COMMAND} again.` : line) : lines;
136708
136840
  }
136709
136841
  function lastFailedScripts(root) {
136710
- const path3 = join47(root, LAST);
136842
+ const path3 = join48(root, LAST);
136711
136843
  if (!existsSync39(path3))
136712
136844
  return [];
136713
136845
  try {
@@ -136717,10 +136849,10 @@ function lastFailedScripts(root) {
136717
136849
  }
136718
136850
  }
136719
136851
  function recordScriptResults(root, results, rerunOnly) {
136720
- const previous = rerunOnly && existsSync39(join47(root, LAST)) ? JSON.parse(readFileSync43(join47(root, LAST), "utf8")).results ?? [] : [];
136852
+ const previous = rerunOnly && existsSync39(join48(root, LAST)) ? JSON.parse(readFileSync43(join48(root, LAST), "utf8")).results ?? [] : [];
136721
136853
  const merged = [...previous.filter((p2) => !results.some((r) => r.script === p2.script)), ...results];
136722
- mkdirSync21(join47(root, ".somewhere", "tests"), { recursive: true });
136723
- writeFileSync27(join47(root, LAST), JSON.stringify({ finished: (/* @__PURE__ */ new Date()).toISOString(), results: merged }, null, 2) + "\n");
136854
+ mkdirSync21(join48(root, ".somewhere", "tests"), { recursive: true });
136855
+ writeFileSync27(join48(root, LAST), JSON.stringify({ finished: (/* @__PURE__ */ new Date()).toISOString(), results: merged }, null, 2) + "\n");
136724
136856
  }
136725
136857
  var BROWSER_CRASH, BROWSER_CRASH_REASON, isScript, LAST;
136726
136858
  var init_test_scripts = __esm({
@@ -136738,7 +136870,7 @@ var init_test_scripts = __esm({
136738
136870
  __name(failureReason, "failureReason");
136739
136871
  __name(runScripts, "runScripts");
136740
136872
  __name(describeScriptResults, "describeScriptResults");
136741
- LAST = join47(".somewhere", "tests", "scripts-last.json");
136873
+ LAST = join48(".somewhere", "tests", "scripts-last.json");
136742
136874
  __name(lastFailedScripts, "lastFailedScripts");
136743
136875
  __name(recordScriptResults, "recordScriptResults");
136744
136876
  }
@@ -136834,7 +136966,7 @@ var init_test = __esm({
136834
136966
 
136835
136967
  // dist/commands/test-users.js
136836
136968
  import { existsSync as existsSync40, readFileSync as readFileSync44, rmSync as rmSync18 } from "node:fs";
136837
- import { basename as basename11, join as join48 } from "node:path";
136969
+ import { basename as basename11, join as join49 } from "node:path";
136838
136970
  import { randomBytes as randomBytes9 } from "node:crypto";
136839
136971
  async function resolveTarget(projectOpt, originOpt) {
136840
136972
  const root = process.cwd();
@@ -136935,7 +137067,7 @@ function registerTestUsers(program2) {
136935
137067
  const record3 = /* @__PURE__ */ __name((spec, issued, receivedAt) => {
136936
137068
  const times = expiryOf(issued, receivedAt);
136937
137069
  const file = `${spec.name}.state.json`;
136938
- writePrivateFile(join48(dir, file), JSON.stringify(buildStorageState(target.origin, target.host, issued, times), null, 2) + "\n");
137070
+ writePrivateFile(join49(dir, file), JSON.stringify(buildStorageState(target.origin, target.host, issued, times), null, 2) + "\n");
136939
137071
  const actor = {
136940
137072
  name: spec.name,
136941
137073
  user_id: issued.user.id,
@@ -137037,7 +137169,7 @@ function registerTestUsers(program2) {
137037
137169
  if (name !== opts.linkOut || !/^[A-Za-z0-9._-]{1,64}$/.test(name))
137038
137170
  throw new Error(`--link-out takes a file name; it is written under ${TEST_STATE_DIR}/.`);
137039
137171
  ensurePrivateDir(stateDir(target.root));
137040
- writePrivateFile(join48(stateDir(target.root), name), newest.magic_link + "\n");
137172
+ writePrivateFile(join49(stateDir(target.root), name), newest.magic_link + "\n");
137041
137173
  linkFile = `${TEST_STATE_DIR}/${name}`;
137042
137174
  }
137043
137175
  const message3 = {
@@ -137108,12 +137240,12 @@ function registerTestUsers(program2) {
137108
137240
  local_state: { removed: localRemoved, kept: manifest.actors.map((actor) => actor.state_file).filter((file) => !localRemoved.includes(file)) },
137109
137241
  actors: manifest.actors.map(({ name, user_id, email: email2, role, created_at }) => ({ name, user_id, email: email2, role, created_at }))
137110
137242
  };
137111
- writePrivateFile(join48(stateDir(target.root), CLEANUP_RECEIPT_FILE), JSON.stringify(receipt, null, 2) + "\n");
137243
+ writePrivateFile(join49(stateDir(target.root), CLEANUP_RECEIPT_FILE), JSON.stringify(receipt, null, 2) + "\n");
137112
137244
  const left = manifest.actors.filter((actor) => !removed.includes(actor.user_id));
137113
137245
  if (left.length)
137114
137246
  writeManifest(target.root, { ...manifest, actors: left, status: "partial" });
137115
137247
  else
137116
- rmSync18(join48(stateDir(target.root), MANIFEST_FILE), { force: true });
137248
+ rmSync18(join49(stateDir(target.root), MANIFEST_FILE), { force: true });
137117
137249
  if (opts.json) {
137118
137250
  printJson(receipt);
137119
137251
  if (left.length)
@@ -137153,7 +137285,7 @@ var init_test_users = __esm({
137153
137285
  });
137154
137286
 
137155
137287
  // dist/commands/support.js
137156
- import { join as join49 } from "node:path";
137288
+ import { join as join50 } from "node:path";
137157
137289
  function commandPaths(program2) {
137158
137290
  const paths = /* @__PURE__ */ new Set();
137159
137291
  const walk2 = /* @__PURE__ */ __name((command, prefix) => {
@@ -137238,7 +137370,7 @@ function emitPacket(packet, opts) {
137238
137370
  if (opts.out) {
137239
137371
  if (!/^[A-Za-z0-9._-]{1,64}$/.test(opts.out))
137240
137372
  throw new Error("--out takes a plain file name in the current folder.");
137241
- writePrivateFile(join49(process.cwd(), opts.out), JSON.stringify(packet, null, 2) + "\n");
137373
+ writePrivateFile(join50(process.cwd(), opts.out), JSON.stringify(packet, null, 2) + "\n");
137242
137374
  }
137243
137375
  if (opts.json) {
137244
137376
  printJson(packet);
@@ -137529,10 +137661,10 @@ var init_startup_notice = __esm({
137529
137661
 
137530
137662
  // dist/lib/last-run.js
137531
137663
  import { lstatSync as lstatSync6, mkdirSync as mkdirSync22, renameSync as renameSync7, unlinkSync as unlinkSync6, writeFileSync as writeFileSync28 } from "node:fs";
137532
- import { join as join50 } from "node:path";
137664
+ import { join as join51 } from "node:path";
137533
137665
  function removeStaleRunRecord(dir = cliConfigDir()) {
137534
137666
  for (const name of RUN_RECORD_FILES) {
137535
- const path3 = join50(dir, name);
137667
+ const path3 = join51(dir, name);
137536
137668
  try {
137537
137669
  if (lstatSync6(path3).isDirectory()) {
137538
137670
  process.stderr.write(`Could not remove ${path3}: it is a directory, not this CLI's run record. Check it yourself.
@@ -137572,8 +137704,8 @@ function recordLastRun(cliVersion) {
137572
137704
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
137573
137705
  cli_version: cliVersion
137574
137706
  };
137575
- const path3 = join50(dir, "last-run.json");
137576
- const temporary = join50(dir, "last-run.json.tmp");
137707
+ const path3 = join51(dir, "last-run.json");
137708
+ const temporary = join51(dir, "last-run.json.tmp");
137577
137709
  writeFileSync28(temporary, JSON.stringify(record3) + "\n", { mode: 384 });
137578
137710
  renameSync7(temporary, path3);
137579
137711
  } catch {
@@ -137612,7 +137744,7 @@ __export(dist_exports, {
137612
137744
  });
137613
137745
  import { spawnSync as spawnSync6 } from "node:child_process";
137614
137746
  import { readFileSync as readFileSync46 } from "node:fs";
137615
- import { join as join51 } from "node:path";
137747
+ import { join as join52 } from "node:path";
137616
137748
  async function runCli() {
137617
137749
  const pinned = decidePin(process.cwd(), CLI_VERSION2, process.argv, process.env);
137618
137750
  if (pinned.notice)
@@ -137640,7 +137772,7 @@ async function runCli() {
137640
137772
  process.exit(child.status ?? 1);
137641
137773
  }
137642
137774
  removeStaleRunRecord();
137643
- const pkg = JSON.parse(readFileSync46(join51(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
137775
+ const pkg = JSON.parse(readFileSync46(join52(CLI_PACKAGE_ROOT, "package.json"), "utf8"));
137644
137776
  const program2 = new Command().name(cliInvocation()).description(`CLI for somewhere.cloud. Run ${cliInvocation()} init first, then read generated AGENTS.md: call shapes and access patterns for a typical app; docs are for exceptions.`).version(pkg.version);
137645
137777
  recordLastRun(pkg.version);
137646
137778
  const jsonOutputRequested = process.argv.includes("--json");
@@ -138058,7 +138190,7 @@ var init_screenshot_guard = __esm({
138058
138190
 
138059
138191
  // dist/lib/playwright-fixtures.js
138060
138192
  import { createRequire as createRequire11 } from "node:module";
138061
- import { join as join52 } from "node:path";
138193
+ import { join as join53 } from "node:path";
138062
138194
  function waitOnNavigation(page) {
138063
138195
  async function wait(options2) {
138064
138196
  if (options2?.waitUntil === "commit")
@@ -138110,7 +138242,7 @@ async function previewControlForWorker() {
138110
138242
  function runner() {
138111
138243
  if (loaded)
138112
138244
  return loaded;
138113
- const require6 = createRequire11(join52(process.cwd(), "package.json"));
138245
+ const require6 = createRequire11(join53(process.cwd(), "package.json"));
138114
138246
  let pw;
138115
138247
  try {
138116
138248
  pw = require6("@playwright/test");