@mpgd/cli 0.61.0 → 0.62.0

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.
@@ -1,6 +1,6 @@
1
1
  // node_modules/.cache/mpgd-native-build/tools/target/build-target.js
2
2
  import { spawnSync as spawnSync5 } from "node:child_process";
3
- import { cpSync as cpSync4, existsSync as existsSync27, lstatSync as lstatSync15, mkdirSync as mkdirSync13, mkdtempSync as mkdtempSync5, readdirSync as readdirSync9, readFileSync as readFileSync26, realpathSync as realpathSync10, rmSync as rmSync12, statSync as statSync7, writeFileSync as writeFileSync18 } from "node:fs";
3
+ import { cpSync as cpSync4, existsSync as existsSync28, lstatSync as lstatSync16, mkdirSync as mkdirSync13, mkdtempSync as mkdtempSync5, readdirSync as readdirSync10, readFileSync as readFileSync26, realpathSync as realpathSync10, rmSync as rmSync12, statSync as statSync8, writeFileSync as writeFileSync18 } from "node:fs";
4
4
  import { tmpdir as tmpdir5 } from "node:os";
5
5
  import { basename as basename5, dirname as dirname12, join as join16, relative as relative13, resolve as resolve18 } from "node:path";
6
6
  import { loadEnv } from "vite";
@@ -43,8 +43,8 @@ var knownMediaTypes = /* @__PURE__ */ new Map([
43
43
  ["aac", { mediaType: "audio/aac", defaultMethod: "store" }],
44
44
  ["flac", { mediaType: "audio/flac", defaultMethod: "store" }]
45
45
  ]);
46
- function phaserPackMediaTypeForPath(path12) {
47
- const extension = path12.slice(path12.lastIndexOf(".") + 1).toLowerCase();
46
+ function phaserPackMediaTypeForPath(path13) {
47
+ const extension = path13.slice(path13.lastIndexOf(".") + 1).toLowerCase();
48
48
  return knownMediaTypes.get(extension) ?? null;
49
49
  }
50
50
  function parsePhaserPackEntryPath(input) {
@@ -677,9 +677,9 @@ var manifestFileName = "asset-pack-delivery.json";
677
677
  var stagingSequence = 0;
678
678
  var sha256Of = (data) => createHash("sha256").update(data).digest("hex");
679
679
  function realpathBestEffort(target2) {
680
- const exists = (path12) => {
680
+ const exists = (path13) => {
681
681
  try {
682
- lstatSync(path12);
682
+ lstatSync(path13);
683
683
  return true;
684
684
  } catch {
685
685
  return false;
@@ -915,11 +915,11 @@ function buildAssetPacks(options) {
915
915
  `, "utf8");
916
916
  validatePhaserPackDeliveryManifest(JSON.parse(manifestBytes.toString("utf8")));
917
917
  const outputRecords = [];
918
- for (const [path12, data] of outputs) {
919
- const target2 = join(outPath, path12);
918
+ for (const [path13, data] of outputs) {
919
+ const target2 = join(outPath, path13);
920
920
  if (!existsSync(target2)) {
921
921
  outputRecords.push({
922
- path: path12,
922
+ path: path13,
923
923
  bytes: data.length,
924
924
  sha256: sha256Of(data),
925
925
  action: "written",
@@ -931,13 +931,13 @@ function buildAssetPacks(options) {
931
931
  try {
932
932
  existing = readFileSync(target2);
933
933
  } catch {
934
- throw new Error(`Output path is not a readable file: ${path12}`);
934
+ throw new Error(`Output path is not a readable file: ${path13}`);
935
935
  }
936
936
  if (!existing.equals(data)) {
937
- throw new Error(`Output path already holds different bytes (immutable conflict): ${path12}. Change the pack content or revision, or build into a new directory.`);
937
+ throw new Error(`Output path already holds different bytes (immutable conflict): ${path13}. Change the pack content or revision, or build into a new directory.`);
938
938
  }
939
939
  outputRecords.push({
940
- path: path12,
940
+ path: path13,
941
941
  bytes: data.length,
942
942
  sha256: sha256Of(data),
943
943
  action: "unchanged",
@@ -1566,7 +1566,7 @@ var positiveIntegerOption = (failures, name, value) => {
1566
1566
  };
1567
1567
  var VerifyDeadlineError = class extends Error {
1568
1568
  };
1569
- var streamSha256 = async (path12, handle, hasher, deadline) => {
1569
+ var streamSha256 = async (path13, handle, hasher, deadline) => {
1570
1570
  let bytes = 0;
1571
1571
  const stream = handle.createReadStream({
1572
1572
  highWaterMark: STREAM_CHUNK_BYTES,
@@ -1586,7 +1586,7 @@ var streamSha256 = async (path12, handle, hasher, deadline) => {
1586
1586
  if (error instanceof VerifyDeadlineError) {
1587
1587
  throw error;
1588
1588
  }
1589
- throw new Error(`Could not read ${path12}: ${errorText(error)}`);
1589
+ throw new Error(`Could not read ${path13}: ${errorText(error)}`);
1590
1590
  } finally {
1591
1591
  clearTimeout(timer);
1592
1592
  }
@@ -1802,20 +1802,20 @@ var readManifestCapped = async (manifestPath, cap, deadline) => {
1802
1802
  }
1803
1803
  return Buffer.concat(chunks);
1804
1804
  };
1805
- var readExact = async (path12, handle, bytes, deadline) => {
1805
+ var readExact = async (path13, handle, bytes, deadline) => {
1806
1806
  const buffer = Buffer.alloc(bytes);
1807
1807
  let received = 0;
1808
1808
  while (received < bytes) {
1809
1809
  const { bytesRead } = await deadline.race(handle.read(buffer, received, bytes - received, received));
1810
1810
  if (bytesRead === 0) {
1811
- throw new Error(`Archive shrank while being read: ${path12}`);
1811
+ throw new Error(`Archive shrank while being read: ${path13}`);
1812
1812
  }
1813
1813
  received += bytesRead;
1814
1814
  }
1815
1815
  const tail = Buffer.alloc(1);
1816
1816
  const { bytesRead: tailBytes } = await deadline.race(handle.read(tail, 0, 1, bytes));
1817
1817
  if (tailBytes !== 0) {
1818
- throw new Error(`Archive grew while being read: ${path12}`);
1818
+ throw new Error(`Archive grew while being read: ${path13}`);
1819
1819
  }
1820
1820
  return buffer;
1821
1821
  };
@@ -2269,9 +2269,9 @@ var assetPackTargetNamespace = "mpgd-asset-packs";
2269
2269
  var assetPackTargetManifestName = "asset-pack-delivery.json";
2270
2270
  var assetPackTargetPolicyName = "target-policy.json";
2271
2271
  var digest = (bytes) => createHash3("sha256").update(bytes).digest("hex");
2272
- async function fileDigest(path12) {
2272
+ async function fileDigest(path13) {
2273
2273
  const hash = createHash3("sha256");
2274
- for await (const chunk of createReadStream(path12)) {
2274
+ for await (const chunk of createReadStream(path13)) {
2275
2275
  hash.update(chunk);
2276
2276
  }
2277
2277
  return hash.digest("hex");
@@ -2280,8 +2280,8 @@ function inside(parent, child) {
2280
2280
  const step = relative3(parent, child);
2281
2281
  return step === "" || !isAbsolute3(step) && step !== ".." && !step.startsWith(`..${sep3}`);
2282
2282
  }
2283
- async function noSymlink(path12) {
2284
- let current = resolve3(path12);
2283
+ async function noSymlink(path13) {
2284
+ let current = resolve3(path13);
2285
2285
  while (true) {
2286
2286
  const stat2 = await lstat2(current).catch((error) => {
2287
2287
  if (error.code === "ENOENT") {
@@ -2292,7 +2292,7 @@ async function noSymlink(path12) {
2292
2292
  if (stat2?.isSymbolicLink()) {
2293
2293
  const systemAlias = process.platform === "darwin" && (current === "/var" && await realpath2(current) === "/private/var" || current === "/tmp" && await realpath2(current) === "/private/tmp");
2294
2294
  if (!systemAlias) {
2295
- throw new Error(`Asset target path must not traverse a symbolic link: ${path12}`);
2295
+ throw new Error(`Asset target path must not traverse a symbolic link: ${path13}`);
2296
2296
  }
2297
2297
  }
2298
2298
  const parent = dirname2(current);
@@ -2302,12 +2302,12 @@ async function noSymlink(path12) {
2302
2302
  current = parent;
2303
2303
  }
2304
2304
  }
2305
- async function canonicalOutput(path12) {
2306
- let ancestor = path12;
2305
+ async function canonicalOutput(path13) {
2306
+ let ancestor = path13;
2307
2307
  while (true) {
2308
2308
  try {
2309
2309
  const canonical = await realpath2(ancestor);
2310
- return resolve3(canonical, relative3(ancestor, path12));
2310
+ return resolve3(canonical, relative3(ancestor, path13));
2311
2311
  } catch (error) {
2312
2312
  if (error.code !== "ENOENT") {
2313
2313
  throw error;
@@ -2459,18 +2459,18 @@ async function assertAssetPackTargetArtifact(report, artifactRoot, namespacePath
2459
2459
  while (pending.length) {
2460
2460
  const directory = pending.pop();
2461
2461
  for (const entry of await readdir(directory, { withFileTypes: true })) {
2462
- const path12 = join3(directory, entry.name);
2462
+ const path13 = join3(directory, entry.name);
2463
2463
  if (++count > 1e5 || entry.isSymbolicLink()) {
2464
2464
  throw new Error("Asset artifact inventory exceeds its limit or contains a symbolic link");
2465
2465
  }
2466
2466
  if (entry.isDirectory()) {
2467
- pending.push(path12);
2467
+ pending.push(path13);
2468
2468
  } else if (entry.isFile()) {
2469
- if (inside(namespace, path12)) {
2470
- namespaceBytes += (await lstat2(path12)).size;
2469
+ if (inside(namespace, path13)) {
2470
+ namespaceBytes += (await lstat2(path13)).size;
2471
2471
  }
2472
- if (remoteHashes.has(await fileDigest(path12))) {
2473
- throw new Error(`Remote-only asset object is present in the packaged artifact: ${relative3(root, path12)}`);
2472
+ if (remoteHashes.has(await fileDigest(path13))) {
2473
+ throw new Error(`Remote-only asset object is present in the packaged artifact: ${relative3(root, path13)}`);
2474
2474
  }
2475
2475
  } else {
2476
2476
  throw new Error("Asset artifact contains a non-regular entry");
@@ -2512,14 +2512,14 @@ function expectedNamespace(artifact, namespace) {
2512
2512
  }
2513
2513
  }
2514
2514
  async function assertAssetPackNativeArtifact(report, artifact) {
2515
- const path12 = resolve4(artifact);
2516
- const stat2 = await lstat3(path12);
2515
+ const path13 = resolve4(artifact);
2516
+ const stat2 = await lstat3(path13);
2517
2517
  if (stat2.isSymbolicLink()) {
2518
2518
  throw new Error("Native asset artifact must not be a symbolic link");
2519
2519
  }
2520
2520
  if (stat2.isDirectory()) {
2521
2521
  const candidates = [];
2522
- const pending = [path12];
2522
+ const pending = [path13];
2523
2523
  let entries = 0;
2524
2524
  while (pending.length) {
2525
2525
  const directory = pending.pop();
@@ -2531,17 +2531,17 @@ async function assertAssetPackNativeArtifact(report, artifact) {
2531
2531
  if (entry.isDirectory()) {
2532
2532
  pending.push(file);
2533
2533
  } else if (entry.name === assetPackTargetManifestName && basename(directory) === assetPackTargetNamespace) {
2534
- candidates.push(relative4(path12, directory));
2534
+ candidates.push(relative4(path13, directory));
2535
2535
  }
2536
2536
  }
2537
2537
  }
2538
2538
  if (candidates.length !== 1) {
2539
2539
  throw new Error("Native asset artifact requires exactly one packaged pack namespace");
2540
2540
  }
2541
- if (!expectedNamespace(path12, candidates[0].replaceAll("\\", "/") + "/")) {
2541
+ if (!expectedNamespace(path13, candidates[0].replaceAll("\\", "/") + "/")) {
2542
2542
  throw new Error("Native asset namespace is outside the platform web bundle");
2543
2543
  }
2544
- await assertAssetPackTargetArtifact(report, path12, candidates[0]);
2544
+ await assertAssetPackTargetArtifact(report, path13, candidates[0]);
2545
2545
  return;
2546
2546
  }
2547
2547
  if (!stat2.isFile() || stat2.size > 2 * 1024 ** 3) {
@@ -2552,7 +2552,7 @@ async function assertAssetPackNativeArtifact(report, artifact) {
2552
2552
  const files = /* @__PURE__ */ new Map();
2553
2553
  let expanded = 0;
2554
2554
  let entryCount = 0;
2555
- const archive = await openPromise(path12, {
2555
+ const archive = await openPromise(path13, {
2556
2556
  lazyEntries: true,
2557
2557
  strictFileNames: true,
2558
2558
  validateEntrySizes: true
@@ -2600,7 +2600,7 @@ async function assertAssetPackNativeArtifact(report, artifact) {
2600
2600
  throw new Error("Native asset package requires exactly one packaged pack namespace");
2601
2601
  }
2602
2602
  const namespace = namespaces[0];
2603
- if (!expectedNamespace(path12, namespace)) {
2603
+ if (!expectedNamespace(path13, namespace)) {
2604
2604
  throw new Error("Native asset namespace is outside the platform web bundle");
2605
2605
  }
2606
2606
  const namespaceBytes = [...files].filter(([name]) => name.startsWith(namespace)).reduce((sum, [, file]) => sum + file.bytes, 0);
@@ -2942,8 +2942,8 @@ function resolveSecureGamePath(gameRoot, configuredPath) {
2942
2942
  }
2943
2943
  return real;
2944
2944
  }
2945
- function toGameRelativePath(gameRoot, path12) {
2946
- return relative5(realpathSync3(gameRoot), realpathSync3(path12)).split("\\").join("/");
2945
+ function toGameRelativePath(gameRoot, path13) {
2946
+ return relative5(realpathSync3(gameRoot), realpathSync3(path13)).split("\\").join("/");
2947
2947
  }
2948
2948
  function readAppIconConfig(input, label) {
2949
2949
  assertRecord(input, label);
@@ -2964,9 +2964,9 @@ function readVariants(input, label) {
2964
2964
  assertRecord(input, label);
2965
2965
  const variants = {};
2966
2966
  for (const name of variantNames) {
2967
- const path12 = readOptionalString(input[name], `${label}.${name}`);
2968
- if (path12 !== void 0) {
2969
- variants[name] = path12;
2967
+ const path13 = readOptionalString(input[name], `${label}.${name}`);
2968
+ if (path13 !== void 0) {
2969
+ variants[name] = path13;
2970
2970
  }
2971
2971
  }
2972
2972
  for (const key of Object.keys(input)) {
@@ -3008,38 +3008,38 @@ import sharp from "sharp";
3008
3008
  var pngSignature = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
3009
3009
  var maximumDimension = 8192;
3010
3010
  var maximumPixels = maximumDimension * maximumDimension;
3011
- async function validateBrandImage(path12, options) {
3012
- const bytes = readFileSync4(path12);
3011
+ async function validateBrandImage(path13, options) {
3012
+ const bytes = readFileSync4(path13);
3013
3013
  const format = sniffFormat(bytes);
3014
3014
  if (format === "png" && hasPngChunk(bytes, "acTL")) {
3015
- throw new Error(`Animated or multi-page brand images are not supported: ${path12}`);
3015
+ throw new Error(`Animated or multi-page brand images are not supported: ${path13}`);
3016
3016
  }
3017
3017
  const warnings = format === "svg" ? validateSvg(bytes, options.strict) : [];
3018
3018
  let metadata;
3019
3019
  try {
3020
3020
  metadata = await sharp(bytes, { animated: true, limitInputPixels: maximumPixels }).metadata();
3021
3021
  } catch (error) {
3022
- throw new Error(`Invalid brand image ${path12}: ${formatError2(error)}`);
3022
+ throw new Error(`Invalid brand image ${path13}: ${formatError2(error)}`);
3023
3023
  }
3024
3024
  const width = metadata.width;
3025
3025
  const height = metadata.height;
3026
3026
  if (width === void 0 || height === void 0 || width < 1 || height < 1) {
3027
- throw new Error(`Brand image has no usable dimensions: ${path12}`);
3027
+ throw new Error(`Brand image has no usable dimensions: ${path13}`);
3028
3028
  }
3029
3029
  if (width !== height) {
3030
- throw new Error(`Brand image must be square, got ${width}x${height}: ${path12}`);
3030
+ throw new Error(`Brand image must be square, got ${width}x${height}: ${path13}`);
3031
3031
  }
3032
3032
  if (width > maximumDimension || height > maximumDimension) {
3033
- throw new Error(`Brand image exceeds ${maximumDimension}x${maximumDimension}: ${path12}`);
3033
+ throw new Error(`Brand image exceeds ${maximumDimension}x${maximumDimension}: ${path13}`);
3034
3034
  }
3035
3035
  if ((metadata.pages ?? 1) > 1) {
3036
- throw new Error(`Animated or multi-page brand images are not supported: ${path12}`);
3036
+ throw new Error(`Animated or multi-page brand images are not supported: ${path13}`);
3037
3037
  }
3038
3038
  if (format === "png" && options.minimumSize !== void 0 && width < options.minimumSize) {
3039
- throw new Error(`PNG brand image must be at least ${options.minimumSize}x${options.minimumSize}; got ${width}x${height}: ${path12}`);
3039
+ throw new Error(`PNG brand image must be at least ${options.minimumSize}x${options.minimumSize}; got ${width}x${height}: ${path13}`);
3040
3040
  }
3041
3041
  return {
3042
- path: path12,
3042
+ path: path13,
3043
3043
  bytes,
3044
3044
  format,
3045
3045
  width,
@@ -3464,28 +3464,28 @@ async function verifyGeneratedTargetIcons(result) {
3464
3464
  }
3465
3465
  assertManifestOutputsMatchProfile(result);
3466
3466
  for (const output of result.manifest.outputs) {
3467
- const path12 = resolve6(result.outputDir, output.path.slice("icons/".length));
3468
- const bytes = readFileSync5(path12);
3467
+ const path13 = resolve6(result.outputDir, output.path.slice("icons/".length));
3468
+ const bytes = readFileSync5(path13);
3469
3469
  if (sha256(bytes) !== output.sha256) {
3470
- throw new Error(`Stale generated icon output: ${path12}`);
3470
+ throw new Error(`Stale generated icon output: ${path13}`);
3471
3471
  }
3472
3472
  let metadata;
3473
3473
  try {
3474
3474
  metadata = await sharp2(bytes).metadata();
3475
3475
  } catch {
3476
- throw new Error(`Generated icon is not a decodable PNG: ${path12}`);
3476
+ throw new Error(`Generated icon is not a decodable PNG: ${path13}`);
3477
3477
  }
3478
3478
  if (metadata.format !== "png" || metadata.width !== output.width || metadata.height !== output.height || (metadata.pages ?? 1) !== 1) {
3479
- throw new Error(`Generated icon must be a ${output.width}x${output.height} single-page PNG: ${path12}`);
3479
+ throw new Error(`Generated icon must be a ${output.width}x${output.height} single-page PNG: ${path13}`);
3480
3480
  }
3481
3481
  if (await pixelSha256(bytes) !== output.pixelSha256) {
3482
- throw new Error(`Generated icon pixel digest mismatch: ${path12}`);
3482
+ throw new Error(`Generated icon pixel digest mismatch: ${path13}`);
3483
3483
  }
3484
3484
  if (output.opaque && !await isPngOpaque(bytes)) {
3485
- throw new Error(`Generated icon expected to be opaque: ${path12}`);
3485
+ throw new Error(`Generated icon expected to be opaque: ${path13}`);
3486
3486
  }
3487
3487
  if (result.profile.id === "devvit" && bytes.byteLength > devvitIconMaximumBytes) {
3488
- throw new Error(`Devvit marketing icon must be at most ${devvitIconMaximumBytes} bytes: ${path12}`);
3488
+ throw new Error(`Devvit marketing icon must be at most ${devvitIconMaximumBytes} bytes: ${path13}`);
3489
3489
  }
3490
3490
  }
3491
3491
  }
@@ -3497,13 +3497,13 @@ async function resolveOutputImage(input) {
3497
3497
  }
3498
3498
  async function loadVariantSources(gameRoot, appIcon, strict) {
3499
3499
  const entries = await Promise.all(brandImageVariants.map(async (variant) => {
3500
- const path12 = appIcon.variants?.[variant];
3501
- if (path12 === void 0) {
3500
+ const path13 = appIcon.variants?.[variant];
3501
+ if (path13 === void 0) {
3502
3502
  return void 0;
3503
3503
  }
3504
3504
  return [
3505
3505
  variant,
3506
- await validateBrandImage(resolveSecureGamePath(gameRoot, path12), { strict })
3506
+ await validateBrandImage(resolveSecureGamePath(gameRoot, path13), { strict })
3507
3507
  ];
3508
3508
  }));
3509
3509
  return Object.fromEntries(entries.filter((entry) => entry !== void 0));
@@ -3548,14 +3548,14 @@ function assertManifestOutputsMatchProfile(result) {
3548
3548
  throw new Error(`Generated icon output count does not match ${result.profile.id} profile.`);
3549
3549
  }
3550
3550
  for (const expected of expectedOutputs) {
3551
- const path12 = `icons/${expected.file}`;
3552
- const matches = result.manifest.outputs.filter((output2) => output2.path === path12);
3551
+ const path13 = `icons/${expected.file}`;
3552
+ const matches = result.manifest.outputs.filter((output2) => output2.path === path13);
3553
3553
  if (matches.length !== 1) {
3554
- throw new Error(`Generated icon manifest must contain exactly one ${path12} output.`);
3554
+ throw new Error(`Generated icon manifest must contain exactly one ${path13} output.`);
3555
3555
  }
3556
3556
  const output = matches[0];
3557
3557
  if (output === void 0 || output.target !== result.target || output.purpose !== expected.purpose || output.width !== expected.width || output.height !== expected.height || output.format !== "png" || output.opaque !== expected.opaque || !/^[0-9a-f]{64}$/u.test(output.sha256) || !/^[0-9a-f]{64}$/u.test(output.pixelSha256)) {
3558
- throw new Error(`Generated icon manifest output does not match profile: ${path12}`);
3558
+ throw new Error(`Generated icon manifest output does not match profile: ${path13}`);
3559
3559
  }
3560
3560
  }
3561
3561
  }
@@ -3833,8 +3833,8 @@ function indexHtmlLinksExistingManifest(indexFile, manifests) {
3833
3833
  }
3834
3834
  function rootManifestNameFromHref(href) {
3835
3835
  const pathEnd = href.search(/[?#]/u);
3836
- const path12 = (pathEnd < 0 ? href : href.slice(0, pathEnd)).trim();
3837
- const rootRelativePath = path12.startsWith("./") ? path12.slice(2) : path12.startsWith("/") ? path12.slice(1) : path12;
3836
+ const path13 = (pathEnd < 0 ? href : href.slice(0, pathEnd)).trim();
3837
+ const rootRelativePath = path13.startsWith("./") ? path13.slice(2) : path13.startsWith("/") ? path13.slice(1) : path13;
3838
3838
  return rootRelativePath.length > 0 && !rootRelativePath.includes("/") && !rootRelativePath.includes("\\") && installableManifestNames.has(rootRelativePath.toLowerCase()) ? rootRelativePath : void 0;
3839
3839
  }
3840
3840
  function readHtmlAttribute(tag, expectedName) {
@@ -4196,25 +4196,25 @@ function assertExistingWebOutputsAreGeneratedArtifacts(outputs) {
4196
4196
  }
4197
4197
  }
4198
4198
  function isPathWithin(root, candidate) {
4199
- const path12 = relative7(root, candidate);
4200
- return path12 === "" || path12 !== ".." && !path12.startsWith(`..${sep4}`) && !isAbsolute5(path12);
4199
+ const path13 = relative7(root, candidate);
4200
+ return path13 === "" || path13 !== ".." && !path13.startsWith(`..${sep4}`) && !isAbsolute5(path13);
4201
4201
  }
4202
4202
  function pathsOverlap(first, second) {
4203
4203
  return isPathWithin(first, second) || isPathWithin(second, first);
4204
4204
  }
4205
- function canonicalizeWebArtifactOutput(path12) {
4206
- const status = lstatIfPresent(path12);
4205
+ function canonicalizeWebArtifactOutput(path13) {
4206
+ const status = lstatIfPresent(path13);
4207
4207
  if (status?.isSymbolicLink() === true) {
4208
- throw new Error(`Web artifact output must not be a symbolic link: ${path12}`);
4208
+ throw new Error(`Web artifact output must not be a symbolic link: ${path13}`);
4209
4209
  }
4210
4210
  if (status !== void 0 && !status.isDirectory()) {
4211
- throw new Error(`Web artifact output must be a directory when it already exists: ${path12}`);
4211
+ throw new Error(`Web artifact output must be a directory when it already exists: ${path13}`);
4212
4212
  }
4213
- return canonicalizeThroughExistingAncestor(path12);
4213
+ return canonicalizeThroughExistingAncestor(path13);
4214
4214
  }
4215
- function lstatIfPresent(path12) {
4215
+ function lstatIfPresent(path13) {
4216
4216
  try {
4217
- return lstatSync3(path12);
4217
+ return lstatSync3(path13);
4218
4218
  } catch (error) {
4219
4219
  if (error.code === "ENOENT") {
4220
4220
  return void 0;
@@ -4222,14 +4222,14 @@ function lstatIfPresent(path12) {
4222
4222
  throw error;
4223
4223
  }
4224
4224
  }
4225
- function canonicalizeThroughExistingAncestor(path12) {
4226
- const normalizedPath = resolve7(path12);
4225
+ function canonicalizeThroughExistingAncestor(path13) {
4226
+ const normalizedPath = resolve7(path13);
4227
4227
  const suffix = [];
4228
4228
  let existingAncestor = normalizedPath;
4229
4229
  while (!existsSync5(existingAncestor)) {
4230
4230
  const parent = dirname4(existingAncestor);
4231
4231
  if (parent === existingAncestor) {
4232
- throw new Error(`Cannot resolve an existing ancestor for web output: ${path12}`);
4232
+ throw new Error(`Cannot resolve an existing ancestor for web output: ${path13}`);
4233
4233
  }
4234
4234
  suffix.unshift(basename2(existingAncestor));
4235
4235
  existingAncestor = parent;
@@ -4285,18 +4285,18 @@ function stageWrapperIcon(result, wrapperApp) {
4285
4285
  }
4286
4286
  async function stageNativeIconResources(result, shellApp) {
4287
4287
  const snapshots = /* @__PURE__ */ new Map();
4288
- const write = (path12, contents) => {
4289
- if (!snapshots.has(path12)) {
4290
- snapshots.set(path12, existsSync6(path12) ? readFileSync7(path12) : void 0);
4288
+ const write = (path13, contents) => {
4289
+ if (!snapshots.has(path13)) {
4290
+ snapshots.set(path13, existsSync6(path13) ? readFileSync7(path13) : void 0);
4291
4291
  }
4292
- mkdirSync4(dirname5(path12), { recursive: true });
4293
- writeFileSync4(path12, contents);
4292
+ mkdirSync4(dirname5(path13), { recursive: true });
4293
+ writeFileSync4(path13, contents);
4294
4294
  };
4295
- const remove = (path12) => {
4296
- if (!snapshots.has(path12)) {
4297
- snapshots.set(path12, existsSync6(path12) ? readFileSync7(path12) : void 0);
4295
+ const remove = (path13) => {
4296
+ if (!snapshots.has(path13)) {
4297
+ snapshots.set(path13, existsSync6(path13) ? readFileSync7(path13) : void 0);
4298
4298
  }
4299
- rmSync4(path12, { force: true });
4299
+ rmSync4(path13, { force: true });
4300
4300
  };
4301
4301
  if (result.profile.id === "android-adaptive") {
4302
4302
  await stageAndroid(result, shellApp, write, remove);
@@ -4304,11 +4304,11 @@ async function stageNativeIconResources(result, shellApp) {
4304
4304
  stageIos(result, shellApp, write);
4305
4305
  }
4306
4306
  return () => {
4307
- for (const [path12, contents] of [...snapshots.entries()].reverse()) {
4307
+ for (const [path13, contents] of [...snapshots.entries()].reverse()) {
4308
4308
  if (contents === void 0) {
4309
- rmSync4(path12, { force: true });
4309
+ rmSync4(path13, { force: true });
4310
4310
  } else {
4311
- writeFileSync4(path12, contents);
4311
+ writeFileSync4(path13, contents);
4312
4312
  }
4313
4313
  }
4314
4314
  };
@@ -4381,7 +4381,7 @@ function stageWebManifest(result, gameDist, manifestSourceDirectory) {
4381
4381
  stagedPath,
4382
4382
  publicWebManifestPath,
4383
4383
  publicJsonManifestPath
4384
- ].find((path12) => existsSync6(path12));
4384
+ ].find((path13) => existsSync6(path13));
4385
4385
  const manifest = manifestPath !== void 0 ? readWebManifest(manifestPath) : {
4386
4386
  name: basename3(result.gameRoot),
4387
4387
  short_name: basename3(result.gameRoot),
@@ -4404,10 +4404,10 @@ function stageWebManifest(result, gameDist, manifestSourceDirectory) {
4404
4404
  }
4405
4405
  ensureInstallableWebManifestLink(gameDist);
4406
4406
  }
4407
- function readWebManifest(path12) {
4408
- const parsed = JSON.parse(readFileSync7(path12, "utf8"));
4407
+ function readWebManifest(path13) {
4408
+ const parsed = JSON.parse(readFileSync7(path13, "utf8"));
4409
4409
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
4410
- throw new Error(`Web app manifest must contain a JSON object: ${path12}`);
4410
+ throw new Error(`Web app manifest must contain a JSON object: ${path13}`);
4411
4411
  }
4412
4412
  return parsed;
4413
4413
  }
@@ -4426,8 +4426,8 @@ function androidAdaptiveXml(hasMonochrome) {
4426
4426
  </adaptive-icon>
4427
4427
  `;
4428
4428
  }
4429
- async function resizePng(path12, size) {
4430
- return sharp3(path12).resize(size, size, { kernel: sharp3.kernel.lanczos3 }).png({ compressionLevel: 9, effort: 10 }).toBuffer();
4429
+ async function resizePng(path13, size) {
4430
+ return sharp3(path13).resize(size, size, { kernel: sharp3.kernel.lanczos3 }).png({ compressionLevel: 9, effort: 10 }).toBuffer();
4431
4431
  }
4432
4432
  function cacheOutputPath(result, output) {
4433
4433
  return resolve8(result.outputDir, basename3(output.path));
@@ -4566,10 +4566,10 @@ function instantOrNaN(at) {
4566
4566
  function isNotificationTimestamp(at) {
4567
4567
  return !Number.isNaN(instantOrNaN(at));
4568
4568
  }
4569
- function notificationTimeFieldIssue(value, fields, path12 = "") {
4569
+ function notificationTimeFieldIssue(value, fields, path13 = "") {
4570
4570
  if (Array.isArray(value)) {
4571
4571
  for (const [index, item] of value.entries()) {
4572
- const issue = notificationTimeFieldIssue(item, fields, `${path12}[${index}]`);
4572
+ const issue = notificationTimeFieldIssue(item, fields, `${path13}[${index}]`);
4573
4573
  if (issue !== void 0) {
4574
4574
  return issue;
4575
4575
  }
@@ -4584,7 +4584,7 @@ function notificationTimeFieldIssue(value, fields, path12 = "") {
4584
4584
  continue;
4585
4585
  }
4586
4586
  const field = value[key];
4587
- const at = path12 === "" ? key : `${path12}.${key}`;
4587
+ const at = path13 === "" ? key : `${path13}.${key}`;
4588
4588
  if (typeof format !== "string") {
4589
4589
  const issue = notificationTimeFieldIssue(field, format, at);
4590
4590
  if (issue !== void 0) {
@@ -8427,10 +8427,10 @@ function assertCrazyGamesArtifact(root) {
8427
8427
  let bytes = 0;
8428
8428
  function visit(directory) {
8429
8429
  for (const name of readdirSync2(directory)) {
8430
- const path12 = join8(directory, name);
8431
- const stat2 = lstatSync5(path12);
8430
+ const path13 = join8(directory, name);
8431
+ const stat2 = lstatSync5(path13);
8432
8432
  if (stat2.isDirectory()) {
8433
- visit(path12);
8433
+ visit(path13);
8434
8434
  } else if (stat2.isFile()) {
8435
8435
  files += 1;
8436
8436
  bytes += stat2.size;
@@ -8445,8 +8445,8 @@ function assertCrazyGamesArtifact(root) {
8445
8445
  }
8446
8446
  const index = readFileSync8(join8(root, "index.html"), "utf8");
8447
8447
  for (const match of index.matchAll(/\b(?:src|href)\s*=\s*(?:["']([^"']+)["']|([^\s"'`=<>]+))/giu)) {
8448
- const path12 = match[1] ?? match[2];
8449
- if (path12?.startsWith("/") || /^https?:/iu.test(path12 ?? "")) {
8448
+ const path13 = match[1] ?? match[2];
8449
+ if (path13?.startsWith("/") || /^https?:/iu.test(path13 ?? "")) {
8450
8450
  throw new Error("CrazyGames index assets must use relative paths.");
8451
8451
  }
8452
8452
  }
@@ -8458,9 +8458,9 @@ import { existsSync as existsSync7, readFileSync as readFileSync9, writeFileSync
8458
8458
  import { join as join9 } from "node:path";
8459
8459
  var onePlayFrameAncestors = "https://*.onestore.co.kr https://*.onestore.net";
8460
8460
  function writeOnePlayHostingHeaders(root) {
8461
- const path12 = join9(root, "_headers");
8462
- if (!existsSync7(path12)) {
8463
- writeFileSync5(path12, `/*
8461
+ const path13 = join9(root, "_headers");
8462
+ if (!existsSync7(path13)) {
8463
+ writeFileSync5(path13, `/*
8464
8464
  Content-Security-Policy: frame-ancestors ${onePlayFrameAncestors}
8465
8465
  `);
8466
8466
  }
@@ -8955,8 +8955,8 @@ function readConfiguredPath(value) {
8955
8955
  import { readFileSync as readFileSync10 } from "node:fs";
8956
8956
  import { resolve as resolve9 } from "node:path";
8957
8957
  import { pathToFileURL } from "node:url";
8958
- function readJsonFile(path12) {
8959
- return JSON.parse(readFileSync10(resolve9(path12), "utf8"));
8958
+ function readJsonFile(path13) {
8959
+ return JSON.parse(readFileSync10(resolve9(path13), "utf8"));
8960
8960
  }
8961
8961
  function isCliEntrypoint(metaUrl) {
8962
8962
  const scriptPath = process.argv[1];
@@ -9110,20 +9110,20 @@ function listMiniGameArtifactFiles(artifactRoot) {
9110
9110
  throw new Error("Mini-game artifact traversal lost its current directory.");
9111
9111
  }
9112
9112
  for (const entry of readdirSync3(directory, { withFileTypes: true })) {
9113
- const path12 = resolve10(directory, entry.name);
9114
- const stat2 = lstatSync6(path12);
9113
+ const path13 = resolve10(directory, entry.name);
9114
+ const stat2 = lstatSync6(path13);
9115
9115
  if (stat2.isSymbolicLink()) {
9116
- throw new Error(`Mini-game artifacts must not contain symbolic links: ${path12}`);
9116
+ throw new Error(`Mini-game artifacts must not contain symbolic links: ${path13}`);
9117
9117
  }
9118
- const artifactPath = toArtifactRelativePath(root, path12);
9118
+ const artifactPath = toArtifactRelativePath(root, path13);
9119
9119
  assertMiniGameArtifactPathAllowed(artifactPath);
9120
9120
  artifactPaths.push(artifactPath);
9121
9121
  if (stat2.isDirectory()) {
9122
- pending.push(path12);
9122
+ pending.push(path13);
9123
9123
  continue;
9124
9124
  }
9125
9125
  if (!stat2.isFile()) {
9126
- throw new Error(`Mini-game artifacts must contain regular files only: ${path12}`);
9126
+ throw new Error(`Mini-game artifacts must contain regular files only: ${path13}`);
9127
9127
  }
9128
9128
  files.push({ path: artifactPath, bytes: stat2.size });
9129
9129
  }
@@ -9133,22 +9133,22 @@ function listMiniGameArtifactFiles(artifactRoot) {
9133
9133
  return left.path < right.path ? -1 : left.path > right.path ? 1 : 0;
9134
9134
  });
9135
9135
  }
9136
- function assertMiniGameArtifactRelativePath(path12, label) {
9137
- const segments = path12.split("/");
9138
- if (path12.length === 0 || path12.includes("\\") || path12.startsWith("/") || /^[A-Za-z]:/u.test(path12) || isAbsolute6(path12) || segments.some((segment) => segment.length === 0 || segment === "." || segment === "..") || segments.some((segment) => /[. ]$/u.test(segment) || /[<>:"|?*\u0000-\u001f]/u.test(segment) || /^(?:con|prn|aux|nul|clock\$|conin\$|conout\$|com[1-9\u00b9\u00b2\u00b3]|lpt[1-9\u00b9\u00b2\u00b3])(?:\..*)?$/iu.test(segment))) {
9139
- throw new Error(`${label} must be a safe artifact-relative path: ${path12}`);
9136
+ function assertMiniGameArtifactRelativePath(path13, label) {
9137
+ const segments = path13.split("/");
9138
+ if (path13.length === 0 || path13.includes("\\") || path13.startsWith("/") || /^[A-Za-z]:/u.test(path13) || isAbsolute6(path13) || segments.some((segment) => segment.length === 0 || segment === "." || segment === "..") || segments.some((segment) => /[. ]$/u.test(segment) || /[<>:"|?*\u0000-\u001f]/u.test(segment) || /^(?:con|prn|aux|nul|clock\$|conin\$|conout\$|com[1-9\u00b9\u00b2\u00b3]|lpt[1-9\u00b9\u00b2\u00b3])(?:\..*)?$/iu.test(segment))) {
9139
+ throw new Error(`${label} must be a safe artifact-relative path: ${path13}`);
9140
9140
  }
9141
9141
  }
9142
9142
  function assertMiniGameArtifactPathsPortable(paths) {
9143
9143
  const seen = /* @__PURE__ */ new Map();
9144
- for (const path12 of paths) {
9145
- assertMiniGameArtifactRelativePath(path12, "Mini-game artifact path");
9146
- const portableKey = miniGamePortablePathKey(path12);
9144
+ for (const path13 of paths) {
9145
+ assertMiniGameArtifactRelativePath(path13, "Mini-game artifact path");
9146
+ const portableKey = miniGamePortablePathKey(path13);
9147
9147
  const previous = seen.get(portableKey);
9148
9148
  if (previous !== void 0) {
9149
- throw new Error(`Mini-game artifact paths collide on portable filesystems: ${previous}, ${path12}.`);
9149
+ throw new Error(`Mini-game artifact paths collide on portable filesystems: ${previous}, ${path13}.`);
9150
9150
  }
9151
- seen.set(portableKey, path12);
9151
+ seen.set(portableKey, path13);
9152
9152
  }
9153
9153
  }
9154
9154
  function readMiniGameSubpackages(gameConfig) {
@@ -9185,40 +9185,40 @@ function assertSubpackageRoots(subpackages) {
9185
9185
  }
9186
9186
  }
9187
9187
  }
9188
- function resolveArtifactPath2(root, path12) {
9189
- const resolved = resolve10(root, path12);
9188
+ function resolveArtifactPath2(root, path13) {
9189
+ const resolved = resolve10(root, path13);
9190
9190
  const relativePath = relative8(root, resolved);
9191
9191
  if (relativePath.length === 0 || relativePath === ".." || relativePath.startsWith(`..${sep5}`) || isAbsolute6(relativePath)) {
9192
- throw new Error(`Mini-game path escapes its artifact root: ${path12}`);
9192
+ throw new Error(`Mini-game path escapes its artifact root: ${path13}`);
9193
9193
  }
9194
9194
  try {
9195
9195
  const stat2 = lstatSync6(resolved);
9196
9196
  if (stat2.isSymbolicLink()) {
9197
- throw new Error(`Mini-game path must not be a symbolic link: ${path12}`);
9197
+ throw new Error(`Mini-game path must not be a symbolic link: ${path13}`);
9198
9198
  }
9199
9199
  } catch (error) {
9200
- throw new Error(`Mini-game subpackage root does not exist: ${path12} (${formatError4(error)})`);
9200
+ throw new Error(`Mini-game subpackage root does not exist: ${path13} (${formatError4(error)})`);
9201
9201
  }
9202
9202
  return resolved;
9203
9203
  }
9204
- function toArtifactRelativePath(root, path12) {
9205
- const artifactPath = relative8(root, path12).replaceAll("\\", "/");
9204
+ function toArtifactRelativePath(root, path13) {
9205
+ const artifactPath = relative8(root, path13).replaceAll("\\", "/");
9206
9206
  assertMiniGameArtifactRelativePath(artifactPath, "Mini-game artifact file");
9207
9207
  return artifactPath;
9208
9208
  }
9209
- function isInsideRoot(path12, root) {
9210
- return path12 === root || path12.startsWith(`${root}/`);
9209
+ function isInsideRoot(path13, root) {
9210
+ return path13 === root || path13.startsWith(`${root}/`);
9211
9211
  }
9212
- function miniGamePortablePathKey(path12) {
9213
- return path12.normalize("NFC").toLowerCase();
9212
+ function miniGamePortablePathKey(path13) {
9213
+ return path13.normalize("NFC").toLowerCase();
9214
9214
  }
9215
9215
  function assertWithinBudget(actual, maximum, label) {
9216
9216
  if (actual > maximum) {
9217
9217
  throw new Error(`Mini-game ${label} exceeds its package budget: ${String(actual)} > ${String(maximum)} bytes.`);
9218
9218
  }
9219
9219
  }
9220
- function assertMiniGameArtifactPathAllowed(path12) {
9221
- const segments = path12.split("/");
9220
+ function assertMiniGameArtifactPathAllowed(path13) {
9221
+ const segments = path13.split("/");
9222
9222
  const fileName = segments.at(-1) ?? "";
9223
9223
  const normalizedFileName = fileName.toLowerCase();
9224
9224
  const normalizedSegments = segments.map((segment) => segment.toLowerCase());
@@ -9232,16 +9232,16 @@ function assertMiniGameArtifactPathAllowed(path12) {
9232
9232
  "tests"
9233
9233
  ]);
9234
9234
  if (normalizedSegments.some((segment) => forbiddenSegments.has(segment))) {
9235
- throw new Error(`Mini-game artifact contains a forbidden development path: ${path12}`);
9235
+ throw new Error(`Mini-game artifact contains a forbidden development path: ${path13}`);
9236
9236
  }
9237
9237
  if (normalizedFileName === ".ds_store" || normalizedFileName === ".env" || normalizedFileName.startsWith(".env.") || normalizedFileName === ".npmrc" || normalizedFileName === "credentials.json" || normalizedFileName === "project.private.config.json" || /^service-account.*\.json$/iu.test(fileName) || /\.(?:map|jsx|ts|tsx|mts|cts|pem|key|p12|pfx)$/iu.test(fileName)) {
9238
- throw new Error(`Mini-game artifact contains a forbidden development or credential file: ${path12}`);
9238
+ throw new Error(`Mini-game artifact contains a forbidden development or credential file: ${path13}`);
9239
9239
  }
9240
9240
  if (/\.(?:html?|css|svg)$/iu.test(fileName)) {
9241
- throw new Error(`Mini-game artifact contains a browser-only asset: ${path12}`);
9241
+ throw new Error(`Mini-game artifact contains a browser-only asset: ${path13}`);
9242
9242
  }
9243
9243
  if (/\.(?:aac|m4a|mp3|ogg|opus|wav|webm)$/iu.test(fileName)) {
9244
- throw new Error(`Mini-game Canvas MVP does not support audio assets yet: ${path12}`);
9244
+ throw new Error(`Mini-game Canvas MVP does not support audio assets yet: ${path13}`);
9245
9245
  }
9246
9246
  }
9247
9247
  function isRecord3(input) {
@@ -9852,19 +9852,19 @@ var effectiveTargetConfigOutputDirEnv = "MPGD_EFFECTIVE_TARGET_CONFIG_OUTPUT_DIR
9852
9852
  var targetIntegrationConfigKeys = /* @__PURE__ */ new Set([...targetIntegrations, "presentationMode"]);
9853
9853
  var integrationAvailabilityStateSet2 = new Set(integrationAvailabilityStates);
9854
9854
  var presentationModeSet2 = new Set(presentationModes);
9855
- function platformTargetsFilePath(path12 = process.env[platformTargetsFileEnv] ?? "mpgd.targets.json") {
9856
- return resolve11(path12);
9855
+ function platformTargetsFilePath(path13 = process.env[platformTargetsFileEnv] ?? "mpgd.targets.json") {
9856
+ return resolve11(path13);
9857
9857
  }
9858
- function loadPlatformTargetsConfig(path12 = platformTargetsFilePath()) {
9859
- const resolvedPath = platformTargetsFilePath(path12);
9858
+ function loadPlatformTargetsConfig(path13 = platformTargetsFilePath()) {
9859
+ const resolvedPath = platformTargetsFilePath(path13);
9860
9860
  return {
9861
9861
  path: resolvedPath,
9862
9862
  baseDir: dirname6(resolvedPath),
9863
9863
  config: assertPlatformTargetsConfigShape(readJsonFile(resolvedPath))
9864
9864
  };
9865
9865
  }
9866
- function resolveFromPlatformTargetsBase(baseDir, path12) {
9867
- return isAbsolute7(path12) ? path12 : resolve11(baseDir, path12);
9866
+ function resolveFromPlatformTargetsBase(baseDir, path13) {
9867
+ return isAbsolute7(path13) ? path13 : resolve11(baseDir, path13);
9868
9868
  }
9869
9869
  function releaseManifestPath(baseDir = dirname6(platformTargetsFilePath())) {
9870
9870
  return resolveFromPlatformTargetsBase(baseDir, process.env[releaseManifestFileEnv] ?? "artifacts/release-manifest.json");
@@ -10953,14 +10953,14 @@ function writeEffectiveTargetConfigs(options = {}) {
10953
10953
  writeFileSync6(indexPath, indexContent);
10954
10954
  return index;
10955
10955
  }
10956
- function readExistingArtifactIndex(path12, version) {
10957
- if (!existsSync8(path12)) {
10956
+ function readExistingArtifactIndex(path13, version) {
10957
+ if (!existsSync8(path13)) {
10958
10958
  return {
10959
10959
  version,
10960
10960
  artifacts: []
10961
10961
  };
10962
10962
  }
10963
- const parsed = JSON.parse(readFileSync12(path12, "utf8"));
10963
+ const parsed = JSON.parse(readFileSync12(path13, "utf8"));
10964
10964
  if (parsed.version !== version) {
10965
10965
  return {
10966
10966
  version,
@@ -10971,14 +10971,14 @@ function readExistingArtifactIndex(path12, version) {
10971
10971
  }
10972
10972
  function writeEffectiveTargetConfig(target2, config2, outputDir) {
10973
10973
  assertDeploymentTargetName(target2);
10974
- const path12 = join10(outputDir, `${target2}.json`);
10974
+ const path13 = join10(outputDir, `${target2}.json`);
10975
10975
  const content = `${JSON.stringify(config2, null, 2)}
10976
10976
  `;
10977
- mkdirSync5(dirname7(path12), { recursive: true });
10978
- writeFileSync6(path12, content);
10977
+ mkdirSync5(dirname7(path13), { recursive: true });
10978
+ writeFileSync6(path13, content);
10979
10979
  return {
10980
10980
  target: target2,
10981
- path: path12,
10981
+ path: path13,
10982
10982
  digest: sha2562(content),
10983
10983
  version: config2.version
10984
10984
  };
@@ -12114,51 +12114,51 @@ function readNativeVersionEvidence(target2) {
12114
12114
  return {};
12115
12115
  }
12116
12116
  function readIconManifestEvidence(artifactPath) {
12117
- const path12 = readOptionalString2(process.env.MPGD_ICON_MANIFEST_PATH);
12118
- if (path12 === void 0) {
12117
+ const path13 = readOptionalString2(process.env.MPGD_ICON_MANIFEST_PATH);
12118
+ if (path13 === void 0) {
12119
12119
  throw new Error("MPGD_ICON_MANIFEST_PATH is required when generating a release manifest.");
12120
12120
  }
12121
- const bytes = readFileBytes(path12);
12121
+ const bytes = readFileBytes(path13);
12122
12122
  const parsed = JSON.parse(bytes.toString("utf8"));
12123
12123
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
12124
- throw new Error(`Invalid icon manifest: ${path12}`);
12124
+ throw new Error(`Invalid icon manifest: ${path13}`);
12125
12125
  }
12126
12126
  const manifest = parsed;
12127
12127
  const canonicalSource = manifest.canonicalSource;
12128
12128
  if (typeof canonicalSource !== "object" || canonicalSource === null || Array.isArray(canonicalSource)) {
12129
- throw new Error(`Invalid icon manifest canonicalSource: ${path12}`);
12129
+ throw new Error(`Invalid icon manifest canonicalSource: ${path13}`);
12130
12130
  }
12131
12131
  const canonicalSourceRecord = canonicalSource;
12132
12132
  return {
12133
12133
  path: requirePortableArtifactPath(artifactPath),
12134
12134
  digest: createHash8("sha256").update(bytes).digest("hex"),
12135
- sourceSha256: requireManifestString(canonicalSourceRecord, "sha256", path12),
12136
- sharedConfigSha256: requireManifestString(manifest, "sharedConfigSha256", path12),
12137
- renderConfigSha256: requireManifestString(manifest, "renderConfigSha256", path12),
12138
- generatorVersion: requireManifestString(manifest, "generatorVersion", path12),
12139
- targetProfile: requireManifestString(manifest, "targetProfile", path12),
12140
- targetProfileVersion: requireManifestString(manifest, "targetProfileVersion", path12)
12135
+ sourceSha256: requireManifestString(canonicalSourceRecord, "sha256", path13),
12136
+ sharedConfigSha256: requireManifestString(manifest, "sharedConfigSha256", path13),
12137
+ renderConfigSha256: requireManifestString(manifest, "renderConfigSha256", path13),
12138
+ generatorVersion: requireManifestString(manifest, "generatorVersion", path13),
12139
+ targetProfile: requireManifestString(manifest, "targetProfile", path13),
12140
+ targetProfileVersion: requireManifestString(manifest, "targetProfileVersion", path13)
12141
12141
  };
12142
12142
  }
12143
- function requirePortableArtifactPath(path12) {
12144
- const normalized = path12.replaceAll("\\", "/");
12143
+ function requirePortableArtifactPath(path13) {
12144
+ const normalized = path13.replaceAll("\\", "/");
12145
12145
  const segments = normalized.split("/");
12146
- if (normalized.length === 0 || isAbsolute8(path12) || isAbsolute8(normalized) || /^[A-Za-z]:\//u.test(normalized) || segments.some((segment) => segment.length === 0 || segment === "." || segment === "..")) {
12147
- throw new Error(`Invalid icon manifest artifact path: ${path12}`);
12146
+ if (normalized.length === 0 || isAbsolute8(path13) || isAbsolute8(normalized) || /^[A-Za-z]:\//u.test(normalized) || segments.some((segment) => segment.length === 0 || segment === "." || segment === "..")) {
12147
+ throw new Error(`Invalid icon manifest artifact path: ${path13}`);
12148
12148
  }
12149
12149
  return normalized;
12150
12150
  }
12151
- function readFileBytes(path12) {
12151
+ function readFileBytes(path13) {
12152
12152
  try {
12153
- return readFileSync14(path12);
12153
+ return readFileSync14(path13);
12154
12154
  } catch (error) {
12155
- throw new Error(`Failed to read icon manifest ${path12}: ${formatError5(error)}`);
12155
+ throw new Error(`Failed to read icon manifest ${path13}: ${formatError5(error)}`);
12156
12156
  }
12157
12157
  }
12158
- function requireManifestString(record2, key, path12) {
12158
+ function requireManifestString(record2, key, path13) {
12159
12159
  const value = record2[key];
12160
12160
  if (typeof value !== "string" || value.length === 0) {
12161
- throw new Error(`Invalid icon manifest ${key}: ${path12}`);
12161
+ throw new Error(`Invalid icon manifest ${key}: ${path13}`);
12162
12162
  }
12163
12163
  return value;
12164
12164
  }
@@ -12240,15 +12240,15 @@ function makeEffectiveConfigPathsPortable(manifest, baseDir) {
12240
12240
  ]))
12241
12241
  });
12242
12242
  }
12243
- function toPortablePath(baseDir, path12) {
12244
- if (!isAbsolute8(path12)) {
12245
- return path12;
12243
+ function toPortablePath(baseDir, path13) {
12244
+ if (!isAbsolute8(path13)) {
12245
+ return path13;
12246
12246
  }
12247
- const relativePath = relative9(baseDir, path12);
12247
+ const relativePath = relative9(baseDir, path13);
12248
12248
  if (relativePath.length > 0 && !relativePath.startsWith("..") && !isAbsolute8(relativePath)) {
12249
12249
  return relativePath;
12250
12250
  }
12251
- return path12;
12251
+ return path13;
12252
12252
  }
12253
12253
  function createBuildId() {
12254
12254
  const now = /* @__PURE__ */ new Date();
@@ -12648,20 +12648,20 @@ function listPrecacheEntries(artifactRoot) {
12648
12648
  throw new Error("PWA artifact traversal lost its directory.");
12649
12649
  }
12650
12650
  for (const entry of readdirSync4(directory, { withFileTypes: true })) {
12651
- const path12 = resolve13(directory, entry.name);
12651
+ const path13 = resolve13(directory, entry.name);
12652
12652
  if (entry.isSymbolicLink()) {
12653
- throw new Error(`PWA artifact must not contain symbolic links: ${path12}`);
12653
+ throw new Error(`PWA artifact must not contain symbolic links: ${path13}`);
12654
12654
  }
12655
12655
  if (entry.isDirectory()) {
12656
- pendingDirectories.push(path12);
12656
+ pendingDirectories.push(path13);
12657
12657
  } else if (entry.isFile()) {
12658
- files.push(path12);
12658
+ files.push(path13);
12659
12659
  }
12660
12660
  }
12661
12661
  }
12662
- return files.filter((path12) => !path12.endsWith(".map") && !path12.endsWith(`${sep6}pwa-release.json`) && !path12.endsWith(`${sep6}service-worker.js`)).map((path12) => ({
12663
- url: toPrecacheUrl(artifactRoot, path12),
12664
- source: readFileSync15(path12)
12662
+ return files.filter((path13) => !path13.endsWith(".map") && !path13.endsWith(`${sep6}pwa-release.json`) && !path13.endsWith(`${sep6}service-worker.js`)).map((path13) => ({
12663
+ url: toPrecacheUrl(artifactRoot, path13),
12664
+ source: readFileSync15(path13)
12665
12665
  })).sort((left, right) => compareCodeUnits(left.url, right.url));
12666
12666
  }
12667
12667
  function normalizePrecacheEntries(entries) {
@@ -12685,8 +12685,8 @@ function normalizePrecacheUrls(urls) {
12685
12685
  }
12686
12686
  return normalized.sort(compareCodeUnits);
12687
12687
  }
12688
- function toPrecacheUrl(root, path12) {
12689
- const portablePath = relative10(root, path12).split(sep6).join("/");
12688
+ function toPrecacheUrl(root, path13) {
12689
+ const portablePath = relative10(root, path13).split(sep6).join("/");
12690
12690
  return assertMicrosoftStorePwaPrecacheUrl(`./${portablePath}`);
12691
12691
  }
12692
12692
  function requireGameSpecificPwaId(value) {
@@ -13087,23 +13087,23 @@ function pathsOverlap2(first, second) {
13087
13087
  return isPathWithin2(first, second) || isPathWithin2(second, first);
13088
13088
  }
13089
13089
  function isPathWithin2(root, candidate) {
13090
- const path12 = relative11(root, candidate);
13091
- return path12 === "" || path12 !== ".." && !path12.startsWith(`..${sep7}`) && !isAbsolute9(path12);
13090
+ const path13 = relative11(root, candidate);
13091
+ return path13 === "" || path13 !== ".." && !path13.startsWith(`..${sep7}`) && !isAbsolute9(path13);
13092
13092
  }
13093
- function portablePathComparisonKey(path12) {
13094
- const portablePath = path12.replaceAll("\\", "/").split("/").map((segment) => {
13093
+ function portablePathComparisonKey(path13) {
13094
+ const portablePath = path13.replaceAll("\\", "/").split("/").map((segment) => {
13095
13095
  return segment === "." || segment === ".." ? segment : segment.replace(/[. ]+$/u, "");
13096
13096
  }).join("/");
13097
13097
  return canonicalizeThroughExistingAncestor2(portablePath).normalize("NFC").toLowerCase();
13098
13098
  }
13099
- function canonicalizeThroughExistingAncestor2(path12) {
13100
- const normalizedPath = resolve15(path12);
13099
+ function canonicalizeThroughExistingAncestor2(path13) {
13100
+ const normalizedPath = resolve15(path13);
13101
13101
  const suffix = [];
13102
13102
  let existingAncestor = normalizedPath;
13103
13103
  while (!existsSync12(existingAncestor)) {
13104
13104
  const parent = dirname8(existingAncestor);
13105
13105
  if (parent === existingAncestor) {
13106
- throw new Error(`Cannot resolve an existing ancestor for mini-game output: ${path12}`);
13106
+ throw new Error(`Cannot resolve an existing ancestor for mini-game output: ${path13}`);
13107
13107
  }
13108
13108
  suffix.unshift(basename4(existingAncestor));
13109
13109
  existingAncestor = parent;
@@ -13157,8 +13157,8 @@ function cleanupMiniGameArtifactBackup(backupRoot, removeDirectory = removeMiniG
13157
13157
  reportWarning(`The new mini-game artifact is active, but its prior backup could not be removed: ${backupRoot} (${formatError6(error)}). Remove this backup manually.`);
13158
13158
  }
13159
13159
  }
13160
- function removeMiniGameArtifactBackupDirectory(path12) {
13161
- rmSync6(path12, { force: true, maxRetries: 3, recursive: true, retryDelay: 100 });
13160
+ function removeMiniGameArtifactBackupDirectory(path13) {
13161
+ rmSync6(path13, { force: true, maxRetries: 3, recursive: true, retryDelay: 100 });
13162
13162
  }
13163
13163
  function assertMiniGameRequiredFiles(artifactRoot) {
13164
13164
  for (const file of [
@@ -13198,17 +13198,17 @@ function assertMiniGameJavaScriptSafety(artifactRoot, forbiddenMarkers, forbidde
13198
13198
  }
13199
13199
  }
13200
13200
  }
13201
- function assertMiniGameJavaScriptAstSafety(source, path12, forbiddenGlobals) {
13201
+ function assertMiniGameJavaScriptAstSafety(source, path13, forbiddenGlobals) {
13202
13202
  let ast;
13203
13203
  try {
13204
13204
  ast = parse(source, {
13205
13205
  ecmaVersion: "latest",
13206
- sourceType: path12.toLowerCase().endsWith(".mjs") ? "module" : "script",
13206
+ sourceType: path13.toLowerCase().endsWith(".mjs") ? "module" : "script",
13207
13207
  allowHashBang: true,
13208
13208
  allowReturnOutsideFunction: true
13209
13209
  });
13210
13210
  } catch (error) {
13211
- throw new Error(`Mini-game ${path12} is not valid JavaScript: ${formatError6(error)}`);
13211
+ throw new Error(`Mini-game ${path13} is not valid JavaScript: ${formatError6(error)}`);
13212
13212
  }
13213
13213
  const scopeAnalysis = createMiniGameScopeAnalysis(ast);
13214
13214
  const ancestors = [];
@@ -13223,7 +13223,7 @@ function assertMiniGameJavaScriptAstSafety(source, path12, forbiddenGlobals) {
13223
13223
  if (!isAstRecord(input)) {
13224
13224
  return;
13225
13225
  }
13226
- assertSafeNode(input, ancestors, path12, scopeAnalysis, forbiddenGlobals);
13226
+ assertSafeNode(input, ancestors, path13, scopeAnalysis, forbiddenGlobals);
13227
13227
  for (const [key, value] of Object.entries(input)) {
13228
13228
  if (key !== "start" && key !== "end" && key !== "loc" && key !== "range") {
13229
13229
  ancestors.push({ node: input, childKey: key });
@@ -13233,57 +13233,57 @@ function assertMiniGameJavaScriptAstSafety(source, path12, forbiddenGlobals) {
13233
13233
  }
13234
13234
  }
13235
13235
  }
13236
- function assertSafeNode(node, ancestors, path12, scopeAnalysis, forbiddenGlobals) {
13236
+ function assertSafeNode(node, ancestors, path13, scopeAnalysis, forbiddenGlobals) {
13237
13237
  if (node.type === "ImportExpression") {
13238
- throw new Error(`Mini-game ${path12} contains forbidden dynamic import.`);
13238
+ throw new Error(`Mini-game ${path13} contains forbidden dynamic import.`);
13239
13239
  }
13240
13240
  const parent = ancestors.at(-1)?.node;
13241
13241
  if (forbiddenGlobals.size > 0 && isMiniGameProtectedIntrinsicMutation(node, ancestors, scopeAnalysis)) {
13242
- throw new Error(`Mini-game ${path12} contains forbidden protected intrinsic mutation.`);
13242
+ throw new Error(`Mini-game ${path13} contains forbidden protected intrinsic mutation.`);
13243
13243
  }
13244
13244
  if (isMiniGameFunctionNode(node) && (parent?.type === "MethodDefinition" && parent.value === node || parent?.type === "PropertyDefinition" && parent.value === node || parent?.type === "Property" && parent.value === node) && readMiniGameFunctionReturnValues(node).some((value) => {
13245
13245
  return isReturnedDynamicCodeConstructorSource(value, ancestors, scopeAnalysis);
13246
13246
  })) {
13247
- throw new Error(`Mini-game ${path12} contains forbidden dynamic-code constructor.`);
13247
+ throw new Error(`Mini-game ${path13} contains forbidden dynamic-code constructor.`);
13248
13248
  }
13249
13249
  if (node.type === "Identifier" && typeof node.name === "string" && isExecutableIdentifierReference(ancestors)) {
13250
13250
  const scope = scopeAnalysis.scopeByNode.get(node) ?? scopeAnalysis.programScope;
13251
13251
  const binding = resolveMiniGameBinding(node.name, scope);
13252
13252
  if (binding === void 0 && forbiddenGlobals.has(node.name)) {
13253
- throw new Error(`Mini-game ${path12} contains forbidden platform global ${node.name}.`);
13253
+ throw new Error(`Mini-game ${path13} contains forbidden platform global ${node.name}.`);
13254
13254
  }
13255
13255
  if (binding !== void 0 && isInvocationArgument(node, ancestors) && (scopeAnalysis.dynamicCodeConstructorAliases.has(binding) || scopeAnalysis.dynamicCodeConstructorContainers.has(binding) || scopeAnalysis.dynamicCodeConstructorFactories.has(binding) || scopeAnalysis.dynamicCodeConstructorContainerFactories.has(binding))) {
13256
- throw new Error(`Mini-game ${path12} contains forbidden dynamic-code constructor.`);
13256
+ throw new Error(`Mini-game ${path13} contains forbidden dynamic-code constructor.`);
13257
13257
  }
13258
13258
  if (node.name === "eval") {
13259
- throw new Error(`Mini-game ${path12} contains forbidden eval.`);
13259
+ throw new Error(`Mini-game ${path13} contains forbidden eval.`);
13260
13260
  }
13261
13261
  if (node.name === "Function") {
13262
- throw new Error(`Mini-game ${path12} contains forbidden Function constructor.`);
13262
+ throw new Error(`Mini-game ${path13} contains forbidden Function constructor.`);
13263
13263
  }
13264
13264
  if (node.name === "importScripts" && !isTypeofReference(node, ancestors)) {
13265
- throw new Error(`Mini-game ${path12} contains forbidden importScripts.`);
13265
+ throw new Error(`Mini-game ${path13} contains forbidden importScripts.`);
13266
13266
  }
13267
13267
  }
13268
13268
  if (node.type === "MemberExpression") {
13269
13269
  const propertyNames = readMiniGameMemberNames(node, ancestors, scopeAnalysis);
13270
13270
  if (node.computed === true && propertyNames.size === 0 && isGlobalObjectAliasSource(node.object, ancestors, scopeAnalysis) && !isMiniGameSymbolValue(node.property, ancestors, scopeAnalysis)) {
13271
- throw new Error(`Mini-game ${path12} contains forbidden computed global read.`);
13271
+ throw new Error(`Mini-game ${path13} contains forbidden computed global read.`);
13272
13272
  }
13273
13273
  const forbiddenPlatformGlobal = [...propertyNames].find((propertyName) => {
13274
13274
  return forbiddenGlobals.has(propertyName);
13275
13275
  });
13276
13276
  if (forbiddenPlatformGlobal !== void 0) {
13277
- throw new Error(`Mini-game ${path12} contains forbidden platform global ${forbiddenPlatformGlobal}.`);
13277
+ throw new Error(`Mini-game ${path13} contains forbidden platform global ${forbiddenPlatformGlobal}.`);
13278
13278
  }
13279
13279
  const forbiddenDynamicCodeProperty = [...propertyNames].find((propertyName) => {
13280
13280
  return ["eval", "Function", "importScripts"].includes(propertyName);
13281
13281
  });
13282
13282
  if (forbiddenDynamicCodeProperty !== void 0 && (node.computed === true || isGlobalObjectAliasSource(node.object, ancestors, scopeAnalysis)) && !isTypeofReference(node, ancestors)) {
13283
- throw new Error(`Mini-game ${path12} contains forbidden ${forbiddenDynamicCodeProperty}.`);
13283
+ throw new Error(`Mini-game ${path13} contains forbidden ${forbiddenDynamicCodeProperty}.`);
13284
13284
  }
13285
13285
  if (isInvocationArgument(node, ancestors) && isDynamicCodeConstructorSource(node, ancestors, scopeAnalysis)) {
13286
- throw new Error(`Mini-game ${path12} contains forbidden dynamic-code constructor.`);
13286
+ throw new Error(`Mini-game ${path13} contains forbidden dynamic-code constructor.`);
13287
13287
  }
13288
13288
  }
13289
13289
  if (node.type === "Property") {
@@ -13293,17 +13293,17 @@ function assertSafeNode(node, ancestors, path12, scopeAnalysis, forbiddenGlobals
13293
13293
  return forbiddenGlobals.has(propertyName);
13294
13294
  });
13295
13295
  if (isObjectPatternProperty && forbiddenPlatformGlobal !== void 0) {
13296
- throw new Error(`Mini-game ${path12} contains forbidden platform global ${forbiddenPlatformGlobal}.`);
13296
+ throw new Error(`Mini-game ${path13} contains forbidden platform global ${forbiddenPlatformGlobal}.`);
13297
13297
  }
13298
13298
  if (isGlobalObjectDestructuring(ancestors, scopeAnalysis)) {
13299
13299
  if (node.computed === true) {
13300
- throw new Error(`Mini-game ${path12} contains forbidden computed destructuring.`);
13300
+ throw new Error(`Mini-game ${path13} contains forbidden computed destructuring.`);
13301
13301
  }
13302
13302
  const forbiddenDynamicCodeProperty = [...propertyNames].find((propertyName) => {
13303
13303
  return ["eval", "Function", "importScripts"].includes(propertyName);
13304
13304
  });
13305
13305
  if (forbiddenDynamicCodeProperty !== void 0) {
13306
- throw new Error(`Mini-game ${path12} contains forbidden ${forbiddenDynamicCodeProperty} destructuring.`);
13306
+ throw new Error(`Mini-game ${path13} contains forbidden ${forbiddenDynamicCodeProperty} destructuring.`);
13307
13307
  }
13308
13308
  }
13309
13309
  }
@@ -13312,35 +13312,35 @@ function assertSafeNode(node, ancestors, path12, scopeAnalysis, forbiddenGlobals
13312
13312
  const arguments_ = Array.isArray(node.arguments) ? node.arguments : [];
13313
13313
  const firstArgument = arguments_[0];
13314
13314
  if (isDynamicCodeConstructorInvocation(node.callee, arguments_, ancestors, scopeAnalysis)) {
13315
- throw new Error(`Mini-game ${path12} contains forbidden dynamic-code constructor.`);
13315
+ throw new Error(`Mini-game ${path13} contains forbidden dynamic-code constructor.`);
13316
13316
  }
13317
13317
  if (isUnknownComputedGlobalMember(node.callee, ancestors, scopeAnalysis)) {
13318
- throw new Error(`Mini-game ${path12} contains forbidden computed global call.`);
13318
+ throw new Error(`Mini-game ${path13} contains forbidden computed global call.`);
13319
13319
  }
13320
13320
  if (isReflectiveDynamicCodeGlobalRead(node, ancestors, scopeAnalysis, forbiddenGlobals)) {
13321
- throw new Error(`Mini-game ${path12} contains forbidden reflective global lookup.`);
13321
+ throw new Error(`Mini-game ${path13} contains forbidden reflective global lookup.`);
13322
13322
  }
13323
13323
  if (calleeNames.has("createElement") && resolveMiniGameStaticStrings(firstArgument, ancestors, scopeAnalysis).has("script")) {
13324
- throw new Error(`Mini-game ${path12} contains forbidden script element creation.`);
13324
+ throw new Error(`Mini-game ${path13} contains forbidden script element creation.`);
13325
13325
  }
13326
13326
  }
13327
13327
  if (node.type === "NewExpression" && isAstRecord(node.callee)) {
13328
13328
  const calleeNames = readMiniGameMemberNames(node.callee, ancestors, scopeAnalysis);
13329
13329
  if (isDynamicCodeConstructorSource(node.callee, ancestors, scopeAnalysis)) {
13330
- throw new Error(`Mini-game ${path12} contains forbidden dynamic-code constructor.`);
13330
+ throw new Error(`Mini-game ${path13} contains forbidden dynamic-code constructor.`);
13331
13331
  }
13332
13332
  if (isUnknownComputedGlobalMember(node.callee, ancestors, scopeAnalysis)) {
13333
- throw new Error(`Mini-game ${path12} contains forbidden computed global construction.`);
13333
+ throw new Error(`Mini-game ${path13} contains forbidden computed global construction.`);
13334
13334
  }
13335
13335
  const forbiddenWorker = [...calleeNames].find((calleeName) => {
13336
13336
  return calleeName === "Worker" || calleeName === "SharedWorker";
13337
13337
  });
13338
13338
  if (forbiddenWorker !== void 0) {
13339
- throw new Error(`Mini-game ${path12} contains forbidden ${forbiddenWorker} construction.`);
13339
+ throw new Error(`Mini-game ${path13} contains forbidden ${forbiddenWorker} construction.`);
13340
13340
  }
13341
13341
  }
13342
13342
  if (node.type === "TaggedTemplateExpression" && isDynamicCodeConstructorSource(node.tag, ancestors, scopeAnalysis)) {
13343
- throw new Error(`Mini-game ${path12} contains forbidden dynamic-code constructor.`);
13343
+ throw new Error(`Mini-game ${path13} contains forbidden dynamic-code constructor.`);
13344
13344
  }
13345
13345
  }
13346
13346
  function isInvocationArgument(node, ancestors) {
@@ -15191,10 +15191,10 @@ function createEvidence(input, files, effectiveTargetConfig, iconManifest, packa
15191
15191
  files
15192
15192
  };
15193
15193
  }
15194
- function requireEvidenceFile(artifactRoot, files, path12) {
15195
- const file = files.find((candidate) => candidate.path === path12);
15196
- if (file === void 0 || !existsSync12(join11(artifactRoot, path12))) {
15197
- throw new Error(`Mini-game artifact is missing required evidence file: ${path12}`);
15194
+ function requireEvidenceFile(artifactRoot, files, path13) {
15195
+ const file = files.find((candidate) => candidate.path === path13);
15196
+ if (file === void 0 || !existsSync12(join11(artifactRoot, path13))) {
15197
+ throw new Error(`Mini-game artifact is missing required evidence file: ${path13}`);
15198
15198
  }
15199
15199
  return file;
15200
15200
  }
@@ -15268,9 +15268,9 @@ function verifyNamedDigest(artifactRoot, reference, expectedPath, label) {
15268
15268
  throw new Error(`Mini-game artifact ${label} digest mismatch.`);
15269
15269
  }
15270
15270
  }
15271
- function readJson(path12, label) {
15271
+ function readJson(path13, label) {
15272
15272
  try {
15273
- return JSON.parse(readFileSync16(path12, "utf8"));
15273
+ return JSON.parse(readFileSync16(path13, "utf8"));
15274
15274
  } catch (error) {
15275
15275
  throw new Error(`${label} is unreadable: ${formatError6(error)}`);
15276
15276
  }
@@ -15337,8 +15337,8 @@ function assertWechatAppId(appId, production) {
15337
15337
  throw new Error("WeChat Mini Game app id must be a valid AppID or the staging placeholder.");
15338
15338
  }
15339
15339
  }
15340
- function writeJson(path12, input) {
15341
- writeFileSync11(path12, `${JSON.stringify(input, null, 2)}
15340
+ function writeJson(path13, input) {
15341
+ writeFileSync11(path13, `${JSON.stringify(input, null, 2)}
15342
15342
  `);
15343
15343
  }
15344
15344
 
@@ -15393,15 +15393,207 @@ function normalizeNotificationTopicsEnv(baseEnv, fallbackBaseDir = process.cwd()
15393
15393
 
15394
15394
  // node_modules/.cache/mpgd-native-build/tools/target/native-build-attempt.js
15395
15395
  import { randomUUID as randomUUID3 } from "node:crypto";
15396
- import { existsSync as existsSync14, mkdirSync as mkdirSync9, readFileSync as readFileSync17, renameSync as renameSync4, rmSync as rmSync7, writeFileSync as writeFileSync12 } from "node:fs";
15396
+ import { existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync17, renameSync as renameSync4, rmSync as rmSync7, writeFileSync as writeFileSync12 } from "node:fs";
15397
+ import path4 from "node:path";
15398
+
15399
+ // node_modules/.cache/mpgd-native-build/packages/cli/src/native-build-symbols.js
15400
+ import { closeSync as closeSync3, existsSync as existsSync14, lstatSync as lstatSync9, openSync as openSync3, readdirSync as readdirSync6, readSync as readSync2, statSync as statSync3 } from "node:fs";
15397
15401
  import path3 from "node:path";
15402
+ function assertNativeBuildSymbols(value, isPath) {
15403
+ const isRecord6 = (entry) => typeof entry === "object" && entry !== null && !Array.isArray(entry);
15404
+ const pathField = (entry) => typeof entry === "string" && isPath(entry);
15405
+ if (!isRecord6(value) || Object.keys(value).some((key) => key !== "r8Mapping" && key !== "crashlytics") || value.r8Mapping === void 0 === (value.crashlytics === void 0) || value.r8Mapping !== void 0 && !pathField(value.r8Mapping)) {
15406
+ throw new Error("Native build symbols are malformed.");
15407
+ }
15408
+ const crashlytics = value.crashlytics;
15409
+ if (crashlytics === void 0) {
15410
+ return;
15411
+ }
15412
+ if (!isRecord6(crashlytics) || Object.keys(crashlytics).some((key) => !["dsymArchive", "dsyms", "uploadTool", "googleServiceInfo"].includes(key)) || !pathField(crashlytics.dsymArchive) || !pathField(crashlytics.uploadTool) || !pathField(crashlytics.googleServiceInfo) || !isDsymIdentityList(crashlytics.dsyms)) {
15413
+ throw new Error("Native build symbols are malformed.");
15414
+ }
15415
+ }
15416
+ function isDsymIdentityList(value) {
15417
+ return Array.isArray(value) && value.length > 0 && value.length <= 256 && value.every((entry) => typeof entry === "object" && entry !== null && !Array.isArray(entry) && Object.keys(entry).every((key) => key === "bundle" || key === "uuids") && typeof entry.bundle === "string" && isDsymBundleName(entry.bundle) && Array.isArray(entry.uuids) && entry.uuids.length > 0 && entry.uuids.length <= 32 && entry.uuids.every(isDsymUuid));
15418
+ }
15419
+ function isDsymBundleName(name) {
15420
+ return name.length <= 255 && /^[^./\\\u0000-\u001f\u007f][^/\\\u0000-\u001f\u007f]*\.dSYM$/u.test(name);
15421
+ }
15422
+ function isNativeOutputPath(file, target2) {
15423
+ return file.startsWith(`release-output/native/${target2}/`) && !path3.isAbsolute(file) && !file.split(/[\\/]/u).some((segment) => segment === "" || segment === "..");
15424
+ }
15425
+ var androidReleaseMappingPath = "app/build/outputs/mapping/release/mapping.txt";
15426
+ var nativeSymbolFileNames = Object.freeze({
15427
+ r8Mapping: "mapping.txt",
15428
+ dsymArchive: "dSYMs.zip",
15429
+ uploadTool: "upload-symbols",
15430
+ googleServiceInfo: "GoogleService-Info.plist"
15431
+ });
15432
+ var iosCrashlyticsSourcePackagesDirectory = ".mpgd-source-packages";
15433
+ function crashlyticsUploadToolCandidates(input) {
15434
+ return [
15435
+ path3.join(input.sourcePackages, "checkouts/firebase-ios-sdk/Crashlytics/upload-symbols"),
15436
+ path3.join(input.iosProject, "App/Pods/FirebaseCrashlytics/upload-symbols")
15437
+ ];
15438
+ }
15439
+ function collectIosCrashlyticsSymbols(input) {
15440
+ const dsymFolder = path3.join(input.archive, "dSYMs");
15441
+ const dsyms = readArchiveDsyms(dsymFolder);
15442
+ if (dsyms.length === 0) {
15443
+ throw new Error('Crash reporting is on, but the iOS archive has no dSYM; set Debug Information Format to "DWARF with dSYM File" for the Release configuration.');
15444
+ }
15445
+ const tool = crashlyticsUploadToolCandidates(input).find((candidate) => existsSync14(candidate) && lstatSync9(candidate).isFile());
15446
+ if (tool === void 0) {
15447
+ throw new Error("Crash reporting is on, but the iOS build has no Firebase Crashlytics upload-symbols in its Swift Package (firebase-ios-sdk/Crashlytics) or CocoaPods (FirebaseCrashlytics) checkout.");
15448
+ }
15449
+ const plist = path3.join(archivedApp(input.archive), "GoogleService-Info.plist");
15450
+ if (!existsSync14(plist) || !lstatSync9(plist).isFile()) {
15451
+ throw new Error("Crash reporting is on, but the archived iOS app does not bundle GoogleService-Info.plist.");
15452
+ }
15453
+ const output = {
15454
+ dsymArchive: path3.join(input.outputDirectory, nativeSymbolFileNames.dsymArchive),
15455
+ uploadTool: path3.join(input.outputDirectory, nativeSymbolFileNames.uploadTool),
15456
+ googleServiceInfo: path3.join(input.outputDirectory, nativeSymbolFileNames.googleServiceInfo)
15457
+ };
15458
+ input.zipDirectory(dsymFolder, output.dsymArchive);
15459
+ if (!existsSync14(output.dsymArchive) || !statSync3(output.dsymArchive).isFile() || statSync3(output.dsymArchive).size === 0) {
15460
+ throw new Error("The iOS dSYM archive was not written.");
15461
+ }
15462
+ input.copyFile(tool, output.uploadTool);
15463
+ input.copyFile(plist, output.googleServiceInfo);
15464
+ return { ...output, dsyms };
15465
+ }
15466
+ function archivedApp(archive) {
15467
+ const applications = path3.join(archive, "Products/Applications");
15468
+ const apps = existsSync14(applications) ? readdirSync6(applications).filter((name) => name.endsWith(".app")) : [];
15469
+ if (apps.length !== 1) {
15470
+ throw new Error("The iOS archive must contain exactly one application bundle.");
15471
+ }
15472
+ return path3.join(applications, apps[0] ?? "");
15473
+ }
15474
+ function readArchiveDsyms(dsymFolder) {
15475
+ if (!existsSync14(dsymFolder)) {
15476
+ return [];
15477
+ }
15478
+ const bundles = readdirSync6(dsymFolder).filter((name) => name.endsWith(".dSYM") && !name.startsWith(".")).sort();
15479
+ return bundles.map((bundle) => {
15480
+ if (!isDsymBundleName(bundle)) {
15481
+ throw new Error(`dSYM bundle name is not supported: ${JSON.stringify(bundle)}.`);
15482
+ }
15483
+ const dwarf = path3.join(dsymFolder, bundle, "Contents/Resources/DWARF");
15484
+ const files = existsSync14(dwarf) ? readdirSync6(dwarf).filter((name) => lstatSync9(path3.join(dwarf, name)).isFile()).sort() : [];
15485
+ const uuids = [...new Set(files.flatMap((file) => {
15486
+ const candidate = path3.join(dwarf, file);
15487
+ return isMachOFile(candidate) ? readMachOUuids(candidate) : [];
15488
+ }))].sort();
15489
+ if (uuids.length === 0) {
15490
+ throw new Error(`dSYM ${bundle} has no Mach-O UUID.`);
15491
+ }
15492
+ return { bundle, uuids };
15493
+ });
15494
+ }
15495
+ function isMachOFile(file) {
15496
+ const descriptor = openSync3(file, "r");
15497
+ try {
15498
+ const magic = Buffer.alloc(4);
15499
+ if (readSync2(descriptor, magic, 0, 4, 0) !== 4) {
15500
+ return false;
15501
+ }
15502
+ return [4277009103, 4277009102, 3489328638, 3472551422, 3405691582, 3405691583].includes(magic.readUInt32BE(0));
15503
+ } finally {
15504
+ closeSync3(descriptor);
15505
+ }
15506
+ }
15507
+ var lcUuid = 27;
15508
+ var uuidPattern = /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/u;
15509
+ function isDsymUuid(value) {
15510
+ return typeof value === "string" && uuidPattern.test(value);
15511
+ }
15512
+ function readMachOUuids(file) {
15513
+ const descriptor = openSync3(file, "r");
15514
+ try {
15515
+ const read = (offset, length) => {
15516
+ const buffer = Buffer.alloc(length);
15517
+ const bytes = readSync2(descriptor, buffer, 0, length, offset);
15518
+ if (bytes !== length) {
15519
+ throw new Error(`${path3.basename(file)} is not a complete Mach-O file.`);
15520
+ }
15521
+ return buffer;
15522
+ };
15523
+ const magic = read(0, 4).readUInt32BE(0);
15524
+ if (magic === 3405691582 || magic === 3405691583) {
15525
+ const wide = magic === 3405691583;
15526
+ const count = read(4, 4).readUInt32BE(0);
15527
+ if (count === 0 || count > 32) {
15528
+ throw new Error(`${path3.basename(file)} has an invalid universal header.`);
15529
+ }
15530
+ const entrySize = wide ? 32 : 20;
15531
+ const uuids = [];
15532
+ for (let index = 0; index < count; index += 1) {
15533
+ const entry = read(8 + index * entrySize, entrySize);
15534
+ const offset = wide ? Number(entry.readBigUInt64BE(8)) : entry.readUInt32BE(8);
15535
+ uuids.push(...readThinMachOUuid(read, offset, file));
15536
+ }
15537
+ return uuids;
15538
+ }
15539
+ return readThinMachOUuid(read, 0, file);
15540
+ } finally {
15541
+ closeSync3(descriptor);
15542
+ }
15543
+ }
15544
+ function readThinMachOUuid(read, base, file) {
15545
+ const magicBytes = read(base, 4);
15546
+ const magic = magicBytes.readUInt32LE(0);
15547
+ let headerSize;
15548
+ let littleEndian = true;
15549
+ if (magic === 4277009103) {
15550
+ headerSize = 32;
15551
+ } else if (magic === 4277009102) {
15552
+ headerSize = 28;
15553
+ } else if (magicBytes.readUInt32BE(0) === 4277009103) {
15554
+ headerSize = 32;
15555
+ littleEndian = false;
15556
+ } else if (magicBytes.readUInt32BE(0) === 4277009102) {
15557
+ headerSize = 28;
15558
+ littleEndian = false;
15559
+ } else {
15560
+ throw new Error(`${path3.basename(file)} is not a Mach-O file.`);
15561
+ }
15562
+ const u32 = (buffer, offset2) => littleEndian ? buffer.readUInt32LE(offset2) : buffer.readUInt32BE(offset2);
15563
+ const header = read(base, headerSize);
15564
+ const commandCount = u32(header, 16);
15565
+ const commandBytes = u32(header, 20);
15566
+ if (commandCount > 4096 || commandBytes > 16 * 1024 * 1024) {
15567
+ throw new Error(`${path3.basename(file)} has an invalid Mach-O header.`);
15568
+ }
15569
+ const commands = read(base + headerSize, commandBytes);
15570
+ let offset = 0;
15571
+ for (let index = 0; index < commandCount; index += 1) {
15572
+ if (offset + 8 > commands.length) {
15573
+ break;
15574
+ }
15575
+ const command = u32(commands, offset);
15576
+ const size = u32(commands, offset + 4);
15577
+ if (size < 8 || offset + size > commands.length) {
15578
+ break;
15579
+ }
15580
+ if (command === lcUuid && size >= 24) {
15581
+ const hex = commands.subarray(offset + 8, offset + 24).toString("hex").toUpperCase();
15582
+ return [`${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`];
15583
+ }
15584
+ offset += size;
15585
+ }
15586
+ return [];
15587
+ }
15588
+
15589
+ // node_modules/.cache/mpgd-native-build/tools/target/native-build-attempt.js
15398
15590
  function nativeBuildAttemptPath(gameRoot, target2) {
15399
15591
  assertDeploymentTargetName(target2);
15400
- return path3.join(gameRoot, "artifacts/native-build-status", `${target2}.json`);
15592
+ return path4.join(gameRoot, "artifacts/native-build-status", `${target2}.json`);
15401
15593
  }
15402
15594
  function readNativeBuildAttempt(gameRoot, target2) {
15403
15595
  const file = nativeBuildAttemptPath(gameRoot, target2);
15404
- if (!existsSync14(file)) {
15596
+ if (!existsSync15(file)) {
15405
15597
  return void 0;
15406
15598
  }
15407
15599
  const parsed = JSON.parse(readFileSync17(file, "utf8"));
@@ -15409,7 +15601,7 @@ function readNativeBuildAttempt(gameRoot, target2) {
15409
15601
  throw new Error("Native build status must be an object.");
15410
15602
  }
15411
15603
  const record2 = parsed;
15412
- if (record2.target !== target2 || typeof record2.runId !== "string" || typeof record2.pid !== "number" || !Number.isSafeInteger(record2.pid) || record2.pid < 1 || record2.status !== "building" && record2.status !== "failed" && record2.status !== "success" || record2.artifact !== void 0 && typeof record2.artifact !== "string") {
15604
+ if (record2.target !== target2 || typeof record2.runId !== "string" || typeof record2.pid !== "number" || !Number.isSafeInteger(record2.pid) || record2.pid < 1 || record2.status !== "building" && record2.status !== "failed" && record2.status !== "success" || record2.artifact !== void 0 && typeof record2.artifact !== "string" || record2.symbols !== void 0 && (record2.status !== "success" || !isNativeBuildSymbols(record2.symbols, target2))) {
15413
15605
  throw new Error("Native build status is malformed.");
15414
15606
  }
15415
15607
  return record2;
@@ -15429,28 +15621,44 @@ function beginNativeBuildAttempt(gameRoot, target2) {
15429
15621
  }
15430
15622
  writeRecord(file, record2);
15431
15623
  });
15432
- function settle(status, artifact) {
15624
+ function settle(status, artifact, symbols) {
15433
15625
  const current = readNativeBuildAttempt(gameRoot, target2);
15434
15626
  if (current?.runId !== record2.runId || current.status !== "building") {
15435
15627
  throw new Error("Native build status was replaced by another attempt.");
15436
15628
  }
15437
- writeRecord(file, { ...record2, status, ...artifact === void 0 ? {} : { artifact } });
15629
+ writeRecord(file, {
15630
+ ...record2,
15631
+ status,
15632
+ ...artifact === void 0 ? {} : { artifact },
15633
+ ...symbols === void 0 ? {} : { symbols }
15634
+ });
15438
15635
  }
15439
15636
  return {
15440
15637
  runId: record2.runId,
15441
- complete(artifact) {
15442
- if (!artifact.startsWith(`release-output/native/${target2}/`) || path3.isAbsolute(artifact) || artifact.split(/[\\/]/u).some((segment) => segment === "" || segment === "..")) {
15638
+ complete(artifact, symbols) {
15639
+ if (!isNativeOutputPath(artifact, target2)) {
15443
15640
  throw new Error("Native build artifact path is invalid.");
15444
15641
  }
15445
- settle("success", artifact);
15642
+ if (symbols !== void 0) {
15643
+ assertNativeBuildSymbols(symbols, (file2) => isNativeOutputPath(file2, target2));
15644
+ }
15645
+ settle("success", artifact, symbols);
15446
15646
  },
15447
15647
  fail() {
15448
15648
  settle("failed");
15449
15649
  }
15450
15650
  };
15451
15651
  }
15652
+ function isNativeBuildSymbols(value, target2) {
15653
+ try {
15654
+ assertNativeBuildSymbols(value, (file) => isNativeOutputPath(file, target2));
15655
+ return true;
15656
+ } catch {
15657
+ return false;
15658
+ }
15659
+ }
15452
15660
  function writeRecord(file, record2) {
15453
- mkdirSync9(path3.dirname(file), { recursive: true });
15661
+ mkdirSync9(path4.dirname(file), { recursive: true });
15454
15662
  const temporary = `${file}.${randomUUID3()}.tmp`;
15455
15663
  try {
15456
15664
  writeFileSync12(temporary, `${JSON.stringify(record2, null, 2)}
@@ -15470,15 +15678,15 @@ function isProcessAlive(pid) {
15470
15678
  }
15471
15679
 
15472
15680
  // node_modules/.cache/mpgd-native-build/tools/target/native-build-execution.js
15473
- import { existsSync as existsSync26, mkdirSync as mkdirSync12, mkdtempSync as mkdtempSync4, readdirSync as readdirSync8, rmSync as rmSync11, statSync as statSync6 } from "node:fs";
15681
+ import { existsSync as existsSync27, mkdirSync as mkdirSync12, mkdtempSync as mkdtempSync4, readdirSync as readdirSync9, rmSync as rmSync11, statSync as statSync7 } from "node:fs";
15474
15682
  import { tmpdir as tmpdir4 } from "node:os";
15475
15683
  import { dirname as dirname11, isAbsolute as isAbsolute12, join as join15 } from "node:path";
15476
15684
 
15477
15685
  // node_modules/.cache/mpgd-native-build/packages/cli/src/ios-signing-session.js
15478
15686
  import { createHash as createHash12, randomBytes } from "node:crypto";
15479
- import { chmodSync, constants as constants2, copyFileSync as copyFileSync3, existsSync as existsSync15, lstatSync as lstatSync9, mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync2, readFileSync as readFileSync18, rmSync as rmSync8, writeFileSync as writeFileSync13 } from "node:fs";
15687
+ import { chmodSync, constants as constants2, copyFileSync as copyFileSync3, existsSync as existsSync16, lstatSync as lstatSync10, mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync2, readFileSync as readFileSync18, rmSync as rmSync8, writeFileSync as writeFileSync13 } from "node:fs";
15480
15688
  import { tmpdir as tmpdir2 } from "node:os";
15481
- import path4 from "node:path";
15689
+ import path5 from "node:path";
15482
15690
  import { fileURLToPath } from "node:url";
15483
15691
 
15484
15692
  // node_modules/.cache/mpgd-native-build/packages/cli/src/deploy-process.js
@@ -15798,11 +16006,11 @@ async function prepareIosSigningSession(input) {
15798
16006
  }
15799
16007
  const p12File = requiredCredentialFile(input.p12File, "iOS P12");
15800
16008
  const profileFile = requiredCredentialFile(input.provisioningProfileFile, "iOS profile");
15801
- const ownedRoot = mkdtempSync2(path4.join(input.temporaryParent ?? tmpdir2(), "mpgd-ios-signing-"));
15802
- const keychainFile = path4.join(ownedRoot, "signing.keychain-db");
15803
- const decodedProfile = path4.join(ownedRoot, "profile.plist");
15804
- const decodedXml = path4.join(ownedRoot, "profile.xml");
15805
- const exportOptionsPlist = path4.join(ownedRoot, "ExportOptions.plist");
16009
+ const ownedRoot = mkdtempSync2(path5.join(input.temporaryParent ?? tmpdir2(), "mpgd-ios-signing-"));
16010
+ const keychainFile = path5.join(ownedRoot, "signing.keychain-db");
16011
+ const decodedProfile = path5.join(ownedRoot, "profile.plist");
16012
+ const decodedXml = path5.join(ownedRoot, "profile.xml");
16013
+ const exportOptionsPlist = path5.join(ownedRoot, "ExportOptions.plist");
15806
16014
  const keychainPassword = randomBytes(32).toString("hex");
15807
16015
  const environment = {
15808
16016
  ...input.environment ?? process.env,
@@ -15819,12 +16027,12 @@ async function prepareIosSigningSession(input) {
15819
16027
  let installedProfile;
15820
16028
  try {
15821
16029
  chmodSync(ownedRoot, 448);
15822
- mkdirSync10(path4.join(ownedRoot, "Library", "Preferences"), {
16030
+ mkdirSync10(path5.join(ownedRoot, "Library", "Preferences"), {
15823
16031
  recursive: true,
15824
16032
  mode: 448
15825
16033
  });
15826
- const helper = path4.join(path4.dirname(fileURLToPath(import.meta.url)), "ios-keychain-import.swift");
15827
- if (!existsSync15(helper)) {
16034
+ const helper = path5.join(path5.dirname(fileURLToPath(import.meta.url)), "ios-keychain-import.swift");
16035
+ if (!existsSync16(helper)) {
15828
16036
  throw new Error("The installed CLI is missing its iOS signing helper.");
15829
16037
  }
15830
16038
  const imported = await runReleaseProcess({
@@ -15897,13 +16105,13 @@ async function prepareIosSigningSession(input) {
15897
16105
  signal: input.signal
15898
16106
  });
15899
16107
  const profile2 = inspectIosDistributionProfile(parseIosProfilePlist(readFileSync18(decodedXml, "utf8")), { bundleId: input.bundleId, teamId: input.teamId, certificateSha256 });
15900
- const profileDirectory = path4.join(ownedRoot, "Library", "Developer", "Xcode", "UserData", "Provisioning Profiles");
16108
+ const profileDirectory = path5.join(ownedRoot, "Library", "Developer", "Xcode", "UserData", "Provisioning Profiles");
15901
16109
  mkdirSync10(profileDirectory, { recursive: true, mode: 448 });
15902
- const destination = path4.join(profileDirectory, `${profile2.uuid}.mobileprovision`);
16110
+ const destination = path5.join(profileDirectory, `${profile2.uuid}.mobileprovision`);
15903
16111
  if (isSymlink(destination)) {
15904
16112
  throw new Error("The iOS provisioning profile destination must not be a symlink.");
15905
16113
  }
15906
- if (existsSync15(destination)) {
16114
+ if (existsSync16(destination)) {
15907
16115
  if (!readFileSync18(destination).equals(readFileSync18(profileFile))) {
15908
16116
  throw new Error("An existing iOS provisioning profile has the same UUID but different bytes.");
15909
16117
  }
@@ -15966,7 +16174,7 @@ function removeOwnedSigningMaterial(root, profile2) {
15966
16174
  const errors = [];
15967
16175
  if (profile2 !== void 0) {
15968
16176
  try {
15969
- if (existsSync15(profile2.path) || isSymlink(profile2.path)) {
16177
+ if (existsSync16(profile2.path) || isSymlink(profile2.path)) {
15970
16178
  if (isSymlink(profile2.path) || fileDigest2(profile2.path) !== profile2.sha256) {
15971
16179
  throw new Error("Owned iOS provisioning profile changed before cleanup.");
15972
16180
  }
@@ -15992,10 +16200,10 @@ function fileDigest2(file) {
15992
16200
  return createHash12("sha256").update(readFileSync18(file)).digest("hex");
15993
16201
  }
15994
16202
  function requiredCredentialFile(file, label) {
15995
- const absolute = path4.resolve(file);
16203
+ const absolute = path5.resolve(file);
15996
16204
  let stat2;
15997
16205
  try {
15998
- stat2 = lstatSync9(absolute);
16206
+ stat2 = lstatSync10(absolute);
15999
16207
  } catch {
16000
16208
  throw new Error(`${label} is missing or unreadable.`);
16001
16209
  }
@@ -16006,7 +16214,7 @@ function requiredCredentialFile(file, label) {
16006
16214
  }
16007
16215
  function isSymlink(file) {
16008
16216
  try {
16009
- return lstatSync9(file).isSymbolicLink();
16217
+ return lstatSync10(file).isSymbolicLink();
16010
16218
  } catch {
16011
16219
  return false;
16012
16220
  }
@@ -16025,7 +16233,7 @@ function exportPlist(teamId, bundleId, profileUuid, certificateSha1) {
16025
16233
 
16026
16234
  // node_modules/.cache/mpgd-native-build/tools/target/native-android-inspection.js
16027
16235
  import { spawnSync as spawnSync2 } from "node:child_process";
16028
- import { existsSync as existsSync16, statSync as statSync3 } from "node:fs";
16236
+ import { existsSync as existsSync17, statSync as statSync4 } from "node:fs";
16029
16237
 
16030
16238
  // node_modules/.cache/mpgd-native-build/tools/target/native-inspection-environment.js
16031
16239
  var allowedInspectionEnvironmentNames = [
@@ -16061,10 +16269,10 @@ function nativeInspectionEnvironment(source = process.env) {
16061
16269
 
16062
16270
  // node_modules/.cache/mpgd-native-build/tools/target/native-android-inspection.js
16063
16271
  function inspectSignedAndroidBundle(input) {
16064
- if (!existsSync16(input.bundle) || !statSync3(input.bundle).isFile()) {
16272
+ if (!existsSync17(input.bundle) || !statSync4(input.bundle).isFile()) {
16065
16273
  throw new Error("Signed Android app bundle is missing.");
16066
16274
  }
16067
- if (input.bundletoolJar !== void 0 && !existsSync16(input.bundletoolJar)) {
16275
+ if (input.bundletoolJar !== void 0 && !existsSync17(input.bundletoolJar)) {
16068
16276
  throw new Error("Configured bundletool JAR is missing.");
16069
16277
  }
16070
16278
  const runner = input.runner ?? { run: runCommand };
@@ -16153,25 +16361,25 @@ function runCommand(command, args) {
16153
16361
 
16154
16362
  // node_modules/.cache/mpgd-native-build/tools/target/native-build-stage.js
16155
16363
  import { randomUUID as randomUUID4 } from "node:crypto";
16156
- import { cpSync as cpSync3, existsSync as existsSync17, lstatSync as lstatSync10, realpathSync as realpathSync8, rmSync as rmSync9 } from "node:fs";
16157
- import path5 from "node:path";
16364
+ import { cpSync as cpSync3, existsSync as existsSync18, lstatSync as lstatSync11, realpathSync as realpathSync8, rmSync as rmSync9 } from "node:fs";
16365
+ import path6 from "node:path";
16158
16366
  function createNativeShellStage(input) {
16159
16367
  const sourceShell = realpathSync8(input.shellApp);
16160
- const declaredShell = path5.resolve(input.shellApp);
16161
- const declaredWeb = path5.resolve(input.webDir);
16162
- if (!lstatSync10(sourceShell).isDirectory()) {
16368
+ const declaredShell = path6.resolve(input.shellApp);
16369
+ const declaredWeb = path6.resolve(input.webDir);
16370
+ if (!lstatSync11(sourceShell).isDirectory()) {
16163
16371
  throw new Error("Native shell must be a directory.");
16164
16372
  }
16165
- const webRelative = path5.relative(declaredShell, declaredWeb);
16166
- if (webRelative === "" || webRelative.startsWith("..") || path5.isAbsolute(webRelative)) {
16373
+ const webRelative = path6.relative(declaredShell, declaredWeb);
16374
+ if (webRelative === "" || webRelative.startsWith("..") || path6.isAbsolute(webRelative)) {
16167
16375
  throw new Error("Native web directory must be inside its game-owned shell.");
16168
16376
  }
16169
- const sourceWeb = path5.join(sourceShell, webRelative);
16377
+ const sourceWeb = path6.join(sourceShell, webRelative);
16170
16378
  let checkedPath = sourceShell;
16171
- for (const segment of webRelative.split(path5.sep)) {
16172
- checkedPath = path5.join(checkedPath, segment);
16379
+ for (const segment of webRelative.split(path6.sep)) {
16380
+ checkedPath = path6.join(checkedPath, segment);
16173
16381
  try {
16174
- if (lstatSync10(checkedPath).isSymbolicLink()) {
16382
+ if (lstatSync11(checkedPath).isSymbolicLink()) {
16175
16383
  throw new Error("Native web directory must not traverse a symbolic link.");
16176
16384
  }
16177
16385
  } catch (error) {
@@ -16180,11 +16388,11 @@ function createNativeShellStage(input) {
16180
16388
  }
16181
16389
  }
16182
16390
  }
16183
- if (existsSync17(sourceWeb) && !lstatSync10(sourceWeb).isDirectory()) {
16391
+ if (existsSync18(sourceWeb) && !lstatSync11(sourceWeb).isDirectory()) {
16184
16392
  throw new Error("Native web directory must be a directory when it exists.");
16185
16393
  }
16186
- const stage = path5.join(path5.dirname(sourceShell), `.mpgd-native-stage-${randomUUID4()}`);
16187
- if (existsSync17(stage)) {
16394
+ const stage = path6.join(path6.dirname(sourceShell), `.mpgd-native-stage-${randomUUID4()}`);
16395
+ if (existsSync18(stage)) {
16188
16396
  throw new Error("Native staging path already exists.");
16189
16397
  }
16190
16398
  try {
@@ -16192,12 +16400,12 @@ function createNativeShellStage(input) {
16192
16400
  recursive: true,
16193
16401
  dereference: false,
16194
16402
  filter(source) {
16195
- const relative14 = path5.relative(sourceShell, source);
16196
- const segments = relative14.split(path5.sep);
16403
+ const relative14 = path6.relative(sourceShell, source);
16404
+ const segments = relative14.split(path6.sep);
16197
16405
  if (segments.some((segment) => [".gradle", "DerivedData", "Pods", "build"].includes(segment))) {
16198
16406
  return false;
16199
16407
  }
16200
- if (relative14 !== "" && lstatSync10(source).isSymbolicLink() && segments[0] !== "node_modules") {
16408
+ if (relative14 !== "" && lstatSync11(source).isSymbolicLink() && segments[0] !== "node_modules") {
16201
16409
  throw new Error(`Native shell symlink is unsupported in mutable project inputs: ${relative14}.`);
16202
16410
  }
16203
16411
  return true;
@@ -16205,7 +16413,7 @@ function createNativeShellStage(input) {
16205
16413
  });
16206
16414
  return {
16207
16415
  shellApp: stage,
16208
- webDir: path5.join(stage, webRelative),
16416
+ webDir: path6.join(stage, webRelative),
16209
16417
  dispose() {
16210
16418
  rmSync9(stage, { recursive: true, force: true });
16211
16419
  }
@@ -16217,8 +16425,8 @@ function createNativeShellStage(input) {
16217
16425
  }
16218
16426
 
16219
16427
  // node_modules/.cache/mpgd-native-build/tools/target/native-shell-csp.js
16220
- import { existsSync as existsSync18, lstatSync as lstatSync11, readFileSync as readFileSync19, writeFileSync as writeFileSync14 } from "node:fs";
16221
- import path6 from "node:path";
16428
+ import { existsSync as existsSync19, lstatSync as lstatSync12, readFileSync as readFileSync19, writeFileSync as writeFileSync14 } from "node:fs";
16429
+ import path7 from "node:path";
16222
16430
  var capacitorShellContentSecurityPolicy = [
16223
16431
  "default-src 'self'",
16224
16432
  "script-src 'self' 'wasm-unsafe-eval'",
@@ -16262,8 +16470,8 @@ function injectCapacitorShellCsp(html) {
16262
16470
  ${capacitorShellCspMetaTag}${html.slice(insertAt)}`;
16263
16471
  }
16264
16472
  function applyCapacitorShellCsp(webDir) {
16265
- const indexFile = path6.join(webDir, "index.html");
16266
- if (!existsSync18(indexFile) || lstatSync11(indexFile).isSymbolicLink()) {
16473
+ const indexFile = path7.join(webDir, "index.html");
16474
+ if (!existsSync19(indexFile) || lstatSync12(indexFile).isSymbolicLink()) {
16267
16475
  throw new Error("Capacitor shell web bundle must contain a regular index.html.");
16268
16476
  }
16269
16477
  const html = readFileSync19(indexFile, "utf8");
@@ -16274,12 +16482,12 @@ function applyCapacitorShellCsp(webDir) {
16274
16482
  }
16275
16483
 
16276
16484
  // node_modules/.cache/mpgd-native-build/tools/target/native-store-policy.js
16277
- import { existsSync as existsSync21, readFileSync as readFileSync22 } from "node:fs";
16485
+ import { existsSync as existsSync22, readFileSync as readFileSync22 } from "node:fs";
16278
16486
  import { dirname as dirname9, join as join13 } from "node:path";
16279
16487
 
16280
16488
  // node_modules/.cache/mpgd-native-build/packages/cli/src/crash-reporting-starter.js
16281
- import { existsSync as existsSync19, lstatSync as lstatSync12, readFileSync as readFileSync20, writeFileSync as writeFileSync15 } from "node:fs";
16282
- import path7 from "node:path";
16489
+ import { existsSync as existsSync20, lstatSync as lstatSync13, readFileSync as readFileSync20, writeFileSync as writeFileSync15 } from "node:fs";
16490
+ import path8 from "node:path";
16283
16491
  import { satisfies, valid, validRange } from "semver";
16284
16492
 
16285
16493
  // node_modules/.cache/mpgd-native-build/packages/cli/src/native-shell-identity.js
@@ -17729,12 +17937,12 @@ var crashReportingAndroidSteps = Object.freeze([
17729
17937
  `In android/app/build.gradle, add apply plugin: '${crashlyticsGradlePluginId}' right after apply plugin: 'com.google.gms.google-services', inside the same google-services.json check.`
17730
17938
  ]);
17731
17939
  var crashReportingIosSteps = Object.freeze([
17732
- 'Upload dSYMs for every App Store build: add the Crashlytics run script build phase ("${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run") as the last phase of the App target, or run upload-symbols after each archive; see docs/CRASH_REPORTING.md in mpgd-kit.'
17940
+ 'dSYMs: mpgd deploy run uploads them for every App Store build it makes (retry with mpgd deploy symbols). For an archive made in Xcode or another pipeline, add the Crashlytics run script build phase ("${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run") as the last phase of the App target, or run upload-symbols after the archive; see docs/CRASH_REPORTING.md in mpgd-kit.'
17733
17941
  ]);
17734
17942
  function androidShellHasCrashlytics(shellRoot) {
17735
17943
  const read = (relative14) => {
17736
- const file = path7.join(shellRoot, relative14);
17737
- return existsSync19(file) && lstatSync12(file).isFile() ? readFileSync20(file, "utf8") : void 0;
17944
+ const file = path8.join(shellRoot, relative14);
17945
+ return existsSync20(file) && lstatSync13(file).isFile() ? readFileSync20(file, "utf8") : void 0;
17738
17946
  };
17739
17947
  const root = read(androidRootGradle);
17740
17948
  const app = read(androidAppGradle);
@@ -17763,8 +17971,8 @@ function inspectCrashReportingShell(input) {
17763
17971
  }
17764
17972
  const issues = [];
17765
17973
  if (input.platform === "android") {
17766
- const config2 = path7.join(input.shellApp, "android/app/google-services.json");
17767
- if (!existsSync19(config2) || !lstatSync12(config2).isFile() || readFileSync20(config2, "utf8").trim() === "") {
17974
+ const config2 = path8.join(input.shellApp, "android/app/google-services.json");
17975
+ if (!existsSync20(config2) || !lstatSync13(config2).isFile() || readFileSync20(config2, "utf8").trim() === "") {
17768
17976
  issues.push({
17769
17977
  level: "error",
17770
17978
  message: `The shell installs ${crashReportingPlugin}, but android/app/google-services.json is missing; Firebase does not start and the release reports no crashes. Download it from the Firebase console (the same file notifications use).`
@@ -17788,8 +17996,8 @@ function inspectCrashReportingShell(input) {
17788
17996
  }
17789
17997
 
17790
17998
  // node_modules/.cache/mpgd-native-build/packages/cli/src/native-shell-ios-push-files.js
17791
- import { existsSync as existsSync20, lstatSync as lstatSync13, readdirSync as readdirSync6, readFileSync as readFileSync21 } from "node:fs";
17792
- import path8 from "node:path";
17999
+ import { existsSync as existsSync21, lstatSync as lstatSync14, readdirSync as readdirSync7, readFileSync as readFileSync21 } from "node:fs";
18000
+ import path9 from "node:path";
17793
18001
  var maxSwiftSources = 2e3;
17794
18002
  function readIosPushWiringInput(iosProjectDirectory) {
17795
18003
  const project = readContainedFile(iosProjectDirectory, "App.xcodeproj/project.pbxproj");
@@ -17803,32 +18011,32 @@ function readIosPushWiringInput(iosProjectDirectory) {
17803
18011
  };
17804
18012
  }
17805
18013
  function readContainedFile(root, relative14) {
17806
- const file = path8.resolve(root, relative14);
17807
- const within = path8.relative(root, file);
17808
- if (within === "" || within.startsWith("..") || path8.isAbsolute(within)) {
18014
+ const file = path9.resolve(root, relative14);
18015
+ const within = path9.relative(root, file);
18016
+ if (within === "" || within.startsWith("..") || path9.isAbsolute(within)) {
17809
18017
  return void 0;
17810
18018
  }
17811
18019
  let current = root;
17812
- for (const segment of within.split(path8.sep)) {
17813
- current = path8.join(current, segment);
17814
- if (!existsSync20(current) || lstatSync13(current).isSymbolicLink()) {
18020
+ for (const segment of within.split(path9.sep)) {
18021
+ current = path9.join(current, segment);
18022
+ if (!existsSync21(current) || lstatSync14(current).isSymbolicLink()) {
17815
18023
  return void 0;
17816
18024
  }
17817
18025
  }
17818
- return lstatSync13(file).isFile() ? readFileSync21(file, "utf8") : void 0;
18026
+ return lstatSync14(file).isFile() ? readFileSync21(file, "utf8") : void 0;
17819
18027
  }
17820
18028
  function listContainedSwiftFiles(root, relativeRoot) {
17821
18029
  const pending = [relativeRoot];
17822
18030
  const files = [];
17823
18031
  while (pending.length > 0) {
17824
18032
  const relative14 = pending.pop() ?? "";
17825
- const full = path8.join(root, relative14);
17826
- if (!existsSync20(full) || lstatSync13(full).isSymbolicLink() || !lstatSync13(full).isDirectory()) {
18033
+ const full = path9.join(root, relative14);
18034
+ if (!existsSync21(full) || lstatSync14(full).isSymbolicLink() || !lstatSync14(full).isDirectory()) {
17827
18035
  continue;
17828
18036
  }
17829
- for (const entry of readdirSync6(full, { withFileTypes: true })) {
17830
- const child = path8.join(relative14, entry.name);
17831
- if (entry.isDirectory() && child !== path8.join(relativeRoot, "public")) {
18037
+ for (const entry of readdirSync7(full, { withFileTypes: true })) {
18038
+ const child = path9.join(relative14, entry.name);
18039
+ if (entry.isDirectory() && child !== path9.join(relativeRoot, "public")) {
17832
18040
  pending.push(child);
17833
18041
  } else if (entry.isFile() && entry.name.endsWith(".swift")) {
17834
18042
  files.push(child);
@@ -17844,15 +18052,15 @@ function listContainedSwiftFiles(root, relativeRoot) {
17844
18052
  // node_modules/.cache/mpgd-native-build/tools/target/native-store-policy.js
17845
18053
  function inspectNativeStorePolicy(input) {
17846
18054
  const gameConfig = input.gameRoot === void 0 ? void 0 : join13(input.gameRoot, "mpgd.game.json");
17847
- const gameConfigJson = gameConfig !== void 0 && existsSync21(gameConfig) ? readJson2(gameConfig) : void 0;
18055
+ const gameConfigJson = gameConfig !== void 0 && existsSync22(gameConfig) ? readJson2(gameConfig) : void 0;
17848
18056
  const orientation = readGameNativeOrientation(gameConfigJson);
17849
18057
  const shellPackage = join13(input.shellApp, "package.json");
17850
- const shellPackageJson = existsSync21(shellPackage) ? readJson2(shellPackage) : void 0;
18058
+ const shellPackageJson = existsSync22(shellPackage) ? readJson2(shellPackage) : void 0;
17851
18059
  const usesAds = shellUsesAdMob(shellPackageJson);
17852
18060
  const usesPush = shellUsesFirebaseMessaging(shellPackageJson);
17853
18061
  if (input.platform === "ios") {
17854
18062
  const project = join13(input.shellApp, "ios/App/App.xcodeproj/project.pbxproj");
17855
- if (!existsSync21(project)) {
18063
+ if (!existsSync22(project)) {
17856
18064
  return [];
17857
18065
  }
17858
18066
  const projectSource = readFileSync22(project, "utf8");
@@ -17872,19 +18080,19 @@ function inspectNativeStorePolicy(input) {
17872
18080
  iosProject: projectSource
17873
18081
  }));
17874
18082
  const plist = join13(dirname9(dirname9(project)), readIosReleaseInfoPlist(projectSource));
17875
- if (existsSync21(plist)) {
18083
+ if (existsSync22(plist)) {
17876
18084
  const plistSource = readFileSync22(plist, "utf8");
17877
18085
  issues.push(...inspectIosInfoPlistStorePolicy(plistSource), ...inspectIosInfoPlistOrientation(plistSource, orientation, deviceFamily ?? "universal"), ...inspectIosInfoPlistAds(plistSource, usesAds));
17878
18086
  }
17879
18087
  return issues;
17880
18088
  }
17881
18089
  const manifest = join13(input.shellApp, "android/app/src/main/AndroidManifest.xml");
17882
- if (!existsSync21(manifest)) {
18090
+ if (!existsSync22(manifest)) {
17883
18091
  return [];
17884
18092
  }
17885
18093
  const manifestSource = readFileSync22(manifest, "utf8");
17886
18094
  const releaseManifest = join13(input.shellApp, "android/app/src/release/AndroidManifest.xml");
17887
- const releaseSource = existsSync21(releaseManifest) ? readFileSync22(releaseManifest, "utf8") : "";
18095
+ const releaseSource = existsSync22(releaseManifest) ? readFileSync22(releaseManifest, "utf8") : "";
17888
18096
  return [
17889
18097
  ...inspectAndroidManifestOrientation(manifestSource, orientation),
17890
18098
  ...inspectAndroidManifestAds(`${manifestSource}
@@ -17899,7 +18107,11 @@ ${releaseSource}`, usesAds, usesAds ? readGameAdvertisingIdPolicy(gameConfigJson
17899
18107
  }
17900
18108
  function shellInstallsFirebaseMessaging(shellApp) {
17901
18109
  const shellPackage = join13(shellApp, "package.json");
17902
- return existsSync21(shellPackage) && shellUsesFirebaseMessaging(readJson2(shellPackage));
18110
+ return existsSync22(shellPackage) && shellUsesFirebaseMessaging(readJson2(shellPackage));
18111
+ }
18112
+ function shellInstallsCrashlytics(shellApp) {
18113
+ const shellPackage = join13(shellApp, "package.json");
18114
+ return existsSync22(shellPackage) && shellUsesCrashlytics(readJson2(shellPackage));
17903
18115
  }
17904
18116
  function readJson2(file) {
17905
18117
  const source = readFileSync22(file, "utf8");
@@ -17920,16 +18132,36 @@ ${errors.map((issue) => `- ${issue.message}`).join("\n")}`);
17920
18132
  }
17921
18133
  }
17922
18134
 
18135
+ // node_modules/.cache/mpgd-native-build/tools/target/ios-simulator-build-settings.js
18136
+ var iosSimulatorAppTarget = "App";
18137
+ function perTarget(setting) {
18138
+ return `MPGD_SMOKE_${setting}_$(TARGET_NAME)`;
18139
+ }
18140
+ function iosSimulatorSmokeBuildSettings(swiftConditions = []) {
18141
+ const app = iosSimulatorAppTarget;
18142
+ return [
18143
+ `INFOPLIST_FILE=$(${perTarget("INFOPLIST_FILE")}:default=$(inherited))`,
18144
+ `MPGD_SMOKE_INFOPLIST_FILE_${app}=App/Info-Smoke.plist`,
18145
+ `EXCLUDED_SOURCE_FILE_NAMES=$(inherited) $(${perTarget("EXCLUDED_SOURCE_FILE_NAMES")})`,
18146
+ `MPGD_SMOKE_EXCLUDED_SOURCE_FILE_NAMES_${app}=Main.storyboard LaunchScreen.storyboard Assets.xcassets`,
18147
+ "ASSETCATALOG_COMPILER_APPICON_NAME=",
18148
+ ...swiftConditions.length === 0 ? [] : [
18149
+ `SWIFT_ACTIVE_COMPILATION_CONDITIONS=$(inherited) $(${perTarget("SWIFT_ACTIVE_COMPILATION_CONDITIONS")})`,
18150
+ `MPGD_SMOKE_SWIFT_ACTIVE_COMPILATION_CONDITIONS_${app}=${swiftConditions.join(" ")}`
18151
+ ]
18152
+ ];
18153
+ }
18154
+
17923
18155
  // node_modules/.cache/mpgd-native-build/tools/target/native-ios-inspection.js
17924
18156
  import { spawnSync as spawnSync3 } from "node:child_process";
17925
- import { existsSync as existsSync22, mkdtempSync as mkdtempSync3, readFileSync as readFileSync23, rmSync as rmSync10, statSync as statSync4 } from "node:fs";
18157
+ import { existsSync as existsSync23, mkdtempSync as mkdtempSync3, readFileSync as readFileSync23, rmSync as rmSync10, statSync as statSync5 } from "node:fs";
17926
18158
  import { tmpdir as tmpdir3 } from "node:os";
17927
- import path9 from "node:path";
18159
+ import path10 from "node:path";
17928
18160
  function inspectSignedIosArchive(archive, input) {
17929
- return inspectSignedIosApplication(path9.join(archive, "Products/Applications/App.app"), input);
18161
+ return inspectSignedIosApplication(path10.join(archive, "Products/Applications/App.app"), input);
17930
18162
  }
17931
18163
  function inspectSignedIosIpa(ipa, input) {
17932
- if (!existsSync22(ipa) || !statSync4(ipa).isFile()) {
18164
+ if (!existsSync23(ipa) || !statSync5(ipa).isFile()) {
17933
18165
  throw new Error("iOS store IPA is missing.");
17934
18166
  }
17935
18167
  const runner = input.runner ?? { run: runCommand2 };
@@ -17945,24 +18177,24 @@ function inspectSignedIosIpa(ipa, input) {
17945
18177
  if (appManifests.length !== 1) {
17946
18178
  throw new Error("iOS store IPA must contain exactly one app manifest.");
17947
18179
  }
17948
- const appRelative = path9.dirname(appManifests[0] ?? "");
17949
- const extracted = mkdtempSync3(path9.join(tmpdir3(), "mpgd-ios-inspection-"));
18180
+ const appRelative = path10.dirname(appManifests[0] ?? "");
18181
+ const extracted = mkdtempSync3(path10.join(tmpdir3(), "mpgd-ios-inspection-"));
17950
18182
  try {
17951
18183
  const result = runner.run("unzip", ["-q", ipa, "-d", extracted]);
17952
18184
  if (result.status !== 0) {
17953
18185
  throw new Error("iOS store IPA could not be extracted.");
17954
18186
  }
17955
- return inspectSignedIosApplication(path9.join(extracted, appRelative), input);
18187
+ return inspectSignedIosApplication(path10.join(extracted, appRelative), input);
17956
18188
  } finally {
17957
18189
  rmSync10(extracted, { recursive: true, force: true });
17958
18190
  }
17959
18191
  }
17960
18192
  function inspectSignedIosApplication(appPath, input) {
17961
- const plist = path9.join(appPath, "Info.plist");
17962
- if (!existsSync22(plist) || !statSync4(plist).isFile()) {
18193
+ const plist = path10.join(appPath, "Info.plist");
18194
+ if (!existsSync23(plist) || !statSync5(plist).isFile()) {
17963
18195
  throw new Error("Signed iOS app manifest is missing.");
17964
18196
  }
17965
- if (!existsSync22(path9.join(appPath, "Assets.car")) || existsSync22(path9.join(appPath, "Info-Smoke.plist"))) {
18197
+ if (!existsSync23(path10.join(appPath, "Assets.car")) || existsSync23(path10.join(appPath, "Info-Smoke.plist"))) {
17966
18198
  throw new Error("Signed iOS app contains smoke assets or omits release icons.");
17967
18199
  }
17968
18200
  const runner = input.runner ?? { run: runCommand2 };
@@ -18000,14 +18232,14 @@ ${signingInfo.stderr}`;
18000
18232
  return [name, expected];
18001
18233
  }));
18002
18234
  const configFiles = [
18003
- path9.join(appPath, "capacitor.config.json"),
18004
- path9.join(appPath, "public/capacitor.config.json")
18235
+ path10.join(appPath, "capacitor.config.json"),
18236
+ path10.join(appPath, "public/capacitor.config.json")
18005
18237
  ];
18006
- if (!configFiles.some((file) => existsSync22(file))) {
18238
+ if (!configFiles.some((file) => existsSync23(file))) {
18007
18239
  throw new Error("Signed iOS app Capacitor configuration is missing.");
18008
18240
  }
18009
18241
  for (const configFile of configFiles) {
18010
- if (existsSync22(configFile)) {
18242
+ if (existsSync23(configFile)) {
18011
18243
  assertNoDebugServer(configFile);
18012
18244
  }
18013
18245
  }
@@ -18072,8 +18304,8 @@ function runCommand2(command, args) {
18072
18304
 
18073
18305
  // node_modules/.cache/mpgd-native-build/tools/target/native-ios-signing.js
18074
18306
  import { spawnSync as spawnSync4 } from "node:child_process";
18075
- import { existsSync as existsSync23, statSync as statSync5 } from "node:fs";
18076
- import path10 from "node:path";
18307
+ import { existsSync as existsSync24, statSync as statSync6 } from "node:fs";
18308
+ import path11 from "node:path";
18077
18309
  function resolveIosSigningPlan(environment, mode) {
18078
18310
  const teamId = environment.MPGD_IOS_TEAM_ID?.trim();
18079
18311
  if (teamId === void 0 || !/^[A-Z0-9]{10}$/u.test(teamId)) {
@@ -18106,8 +18338,8 @@ function resolveIosSigningPlan(environment, mode) {
18106
18338
  if (configuredExportFile === void 0 || configuredExportFile.trim() === "") {
18107
18339
  throw new Error("iOS store export requires MPGD_IOS_EXPORT_OPTIONS_PLIST.");
18108
18340
  }
18109
- const exportOptionsPlist = path10.resolve(configuredExportFile);
18110
- if (!existsSync23(exportOptionsPlist) || !statSync5(exportOptionsPlist).isFile()) {
18341
+ const exportOptionsPlist = path11.resolve(configuredExportFile);
18342
+ if (!existsSync24(exportOptionsPlist) || !statSync6(exportOptionsPlist).isFile()) {
18111
18343
  throw new Error("iOS export options plist must be an existing host file.");
18112
18344
  }
18113
18345
  const method = spawnSync4("/usr/libexec/PlistBuddy", ["-c", "Print :method", exportOptionsPlist], {
@@ -18121,14 +18353,22 @@ function resolveIosSigningPlan(environment, mode) {
18121
18353
  }
18122
18354
 
18123
18355
  // node_modules/.cache/mpgd-native-build/tools/target/native-release-identity.js
18124
- import { existsSync as existsSync25, readFileSync as readFileSync25, writeFileSync as writeFileSync17 } from "node:fs";
18356
+ import { existsSync as existsSync26, readFileSync as readFileSync25, writeFileSync as writeFileSync17 } from "node:fs";
18125
18357
  import { dirname as dirname10, isAbsolute as isAbsolute11, join as join14, relative as relative12, resolve as resolve17 } from "node:path";
18126
18358
 
18127
18359
  // node_modules/.cache/mpgd-native-build/packages/cli/src/capacitor-shell-starter.js
18128
- import { chmodSync as chmodSync2, existsSync as existsSync24, lstatSync as lstatSync14, mkdirSync as mkdirSync11, readdirSync as readdirSync7, readFileSync as readFileSync24, realpathSync as realpathSync9, renameSync as renameSync5, unlinkSync as unlinkSync2, writeFileSync as writeFileSync16 } from "node:fs";
18129
- import path11 from "node:path";
18360
+ import { chmodSync as chmodSync2, existsSync as existsSync25, lstatSync as lstatSync15, mkdirSync as mkdirSync11, readdirSync as readdirSync8, readFileSync as readFileSync24, realpathSync as realpathSync9, renameSync as renameSync5, unlinkSync as unlinkSync2, writeFileSync as writeFileSync16 } from "node:fs";
18361
+ import path12 from "node:path";
18130
18362
  import { DOMParser as DOMParser2 } from "@xmldom/xmldom";
18131
18363
  import { satisfies as satisfies2, valid as valid2, validRange as validRange2 } from "semver";
18364
+
18365
+ // node_modules/.cache/mpgd-native-build/packages/cli/src/pnpm-build-approvals.js
18366
+ var notificationsBuildApprovals = Object.freeze({
18367
+ "@firebase/util": false,
18368
+ protobufjs: true
18369
+ });
18370
+
18371
+ // node_modules/.cache/mpgd-native-build/packages/cli/src/capacitor-shell-starter.js
18132
18372
  var shellPath = "apps/mobile-capacitor";
18133
18373
  var webPath = `${shellPath}/www`;
18134
18374
  var javaKeywords = new Set(`
@@ -18209,7 +18449,7 @@ var androidDataExtractionRulesXml = [
18209
18449
  ""
18210
18450
  ].join("\n");
18211
18451
  function assertAndroidLauncherClasses(nativeDirectory, gradle) {
18212
- const application = readAndroidApplication(path11.join(nativeDirectory, "app/src/main/AndroidManifest.xml"));
18452
+ const application = readAndroidApplication(path12.join(nativeDirectory, "app/src/main/AndroidManifest.xml"));
18213
18453
  if (application === void 0) {
18214
18454
  throw new Error("Existing android project launcher activity is missing.");
18215
18455
  }
@@ -18217,8 +18457,8 @@ function assertAndroidLauncherClasses(nativeDirectory, gradle) {
18217
18457
  const manifestRoot = application.parentNode;
18218
18458
  const manifestPackage = manifestRoot?.getAttribute("package");
18219
18459
  const namespace = /\bnamespace\s*(?:=\s*)?["']([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)+)["']/u.exec(stripGradleComments(gradle))?.[1] ?? (manifestPackage === null || manifestPackage === "" ? void 0 : manifestPackage);
18220
- const releaseFile = path11.join(nativeDirectory, "app/src/release/AndroidManifest.xml");
18221
- const release = existsSync24(releaseFile) ? readAndroidApplication(releaseFile, false) : void 0;
18460
+ const releaseFile = path12.join(nativeDirectory, "app/src/release/AndroidManifest.xml");
18461
+ const release = existsSync25(releaseFile) ? readAndroidApplication(releaseFile, false) : void 0;
18222
18462
  if (release !== void 0) {
18223
18463
  assertAndroidLauncherEnabled(release, "Release application");
18224
18464
  }
@@ -18328,7 +18568,7 @@ function resolvesAndroidClass(nativeDirectory, qualified, sourceFiles, visited,
18328
18568
  if (!isNativeFile(nativeDirectory, relative14)) {
18329
18569
  continue;
18330
18570
  }
18331
- const source = stripSourceCommentsAndStrings(readFileSync24(path11.join(nativeDirectory, relative14), "utf8"));
18571
+ const source = stripSourceCommentsAndStrings(readFileSync24(path12.join(nativeDirectory, relative14), "utf8"));
18332
18572
  const declaredPackage = /\bpackage\s+([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)+)\s*;?/u.exec(source)?.[1];
18333
18573
  if (declaredPackage !== packageName) {
18334
18574
  continue;
@@ -18384,15 +18624,15 @@ function listNativeFiles(nativeDirectory, relativeRoot, extension) {
18384
18624
  const files = [];
18385
18625
  while (pending.length > 0) {
18386
18626
  const relative14 = pending.pop() ?? "";
18387
- const full = path11.join(nativeDirectory, relative14);
18388
- if (!existsSync24(full) || lstatSync14(full).isSymbolicLink()) {
18627
+ const full = path12.join(nativeDirectory, relative14);
18628
+ if (!existsSync25(full) || lstatSync15(full).isSymbolicLink()) {
18389
18629
  continue;
18390
18630
  }
18391
- for (const entry of readdirSync7(full, { withFileTypes: true })) {
18631
+ for (const entry of readdirSync8(full, { withFileTypes: true })) {
18392
18632
  if (entry.isSymbolicLink()) {
18393
18633
  continue;
18394
18634
  }
18395
- const child = path11.join(relative14, entry.name);
18635
+ const child = path12.join(relative14, entry.name);
18396
18636
  if (entry.isDirectory()) {
18397
18637
  pending.push(child);
18398
18638
  } else if (entry.isFile() && entry.name.endsWith(extension)) {
@@ -18598,7 +18838,7 @@ function assertReferencedIosFiles(nativeDirectory, project, infoRelative) {
18598
18838
  throw new Error(`Existing ios project is incomplete; referenced app file ${relative14} is missing.`);
18599
18839
  }
18600
18840
  }
18601
- const info = readFileSync24(path11.join(nativeDirectory, infoRelative), "utf8");
18841
+ const info = readFileSync24(path12.join(nativeDirectory, infoRelative), "utf8");
18602
18842
  assertSceneDelegateFiles(nativeDirectory, info, "Release", compiledSources);
18603
18843
  return compiledSources;
18604
18844
  }
@@ -18729,7 +18969,7 @@ function readPbxGroupPath(project, parents, referenceId) {
18729
18969
  const groupPath = /\bpath\s*=\s*(?:"([^"]+)"|([^;]+))\s*;/u.exec(group);
18730
18970
  const value = (groupPath?.[1] ?? groupPath?.[2])?.trim();
18731
18971
  if (value !== void 0) {
18732
- if (value.includes("$") || path11.isAbsolute(value)) {
18972
+ if (value.includes("$") || path12.isAbsolute(value)) {
18733
18973
  throw new Error("Existing ios project build input group path is unsupported.");
18734
18974
  }
18735
18975
  parts.push(value);
@@ -18751,7 +18991,7 @@ function assertPbxFileReference(nativeDirectory, project, referenceId, parentGro
18751
18991
  }
18752
18992
  const relative14 = /\bpath\s*=\s*(?:"([^"]+)"|([^;]+))\s*;/u.exec(reference);
18753
18993
  const filePath = (relative14?.[1] ?? relative14?.[2])?.trim();
18754
- if (filePath === void 0 || filePath.includes("$") || path11.isAbsolute(filePath)) {
18994
+ if (filePath === void 0 || filePath.includes("$") || path12.isAbsolute(filePath)) {
18755
18995
  throw new Error("Existing ios project App build input path is unsupported.");
18756
18996
  }
18757
18997
  if (filePath === "public" || filePath === "capacitor.config.json") {
@@ -18778,19 +19018,19 @@ function assertPbxFileReference(nativeDirectory, project, referenceId, parentGro
18778
19018
  return [resolved];
18779
19019
  }
18780
19020
  function isNativeEntry(directory, relative14) {
18781
- const file = path11.resolve(directory, relative14);
18782
- const within = path11.relative(directory, file);
18783
- if (within === "" || within.startsWith("..") || path11.isAbsolute(within)) {
19021
+ const file = path12.resolve(directory, relative14);
19022
+ const within = path12.relative(directory, file);
19023
+ if (within === "" || within.startsWith("..") || path12.isAbsolute(within)) {
18784
19024
  return false;
18785
19025
  }
18786
19026
  let current = directory;
18787
- for (const segment of within.split(path11.sep)) {
18788
- current = path11.join(current, segment);
18789
- if (!existsSync24(current) || lstatSync14(current).isSymbolicLink()) {
19027
+ for (const segment of within.split(path12.sep)) {
19028
+ current = path12.join(current, segment);
19029
+ if (!existsSync25(current) || lstatSync15(current).isSymbolicLink()) {
18790
19030
  return false;
18791
19031
  }
18792
19032
  }
18793
- return lstatSync14(file).isFile() || lstatSync14(file).isDirectory();
19033
+ return lstatSync15(file).isFile() || lstatSync15(file).isDirectory();
18794
19034
  }
18795
19035
  function assertSceneDelegateFiles(nativeDirectory, source, label, compiledSources) {
18796
19036
  const values = parsePlistDictionary(source, label);
@@ -18819,7 +19059,7 @@ function assertSceneDelegateFiles(nativeDirectory, source, label, compiledSource
18819
19059
  if (!compiledSources.has(relative14)) {
18820
19060
  return false;
18821
19061
  }
18822
- const text = stripSourceCommentsAndStrings(readFileSync24(path11.join(nativeDirectory, relative14), "utf8"));
19062
+ const text = stripSourceCommentsAndStrings(readFileSync24(path12.join(nativeDirectory, relative14), "utf8"));
18823
19063
  return hasUsableTopLevelSwiftSceneDelegate(text, className);
18824
19064
  })) {
18825
19065
  throw new Error(`Existing ios project ${label} scene delegate ${delegate} is missing from App Sources.`);
@@ -18844,8 +19084,8 @@ function hasUsableTopLevelSwiftSceneDelegate(source, className) {
18844
19084
  return false;
18845
19085
  }
18846
19086
  function assertAndroidManifestResources(nativeDirectory) {
18847
- const manifestFiles = ["main", "release"].map((sourceSet) => path11.join(nativeDirectory, `app/src/${sourceSet}/AndroidManifest.xml`)).filter((file) => existsSync24(file));
18848
- const resourceRoots = ["main", "release"].map((sourceSet) => path11.join(nativeDirectory, `app/src/${sourceSet}/res`));
19087
+ const manifestFiles = ["main", "release"].map((sourceSet) => path12.join(nativeDirectory, `app/src/${sourceSet}/AndroidManifest.xml`)).filter((file) => existsSync25(file));
19088
+ const resourceRoots = ["main", "release"].map((sourceSet) => path12.join(nativeDirectory, `app/src/${sourceSet}/res`));
18849
19089
  const references = manifestFiles.flatMap((file) => {
18850
19090
  const manifest = readFileSync24(file, "utf8").replace(/<!--[\s\S]*?-->/gu, "");
18851
19091
  return [...manifest.matchAll(/(?<![\w+])@([a-z]+)\/([A-Za-z_][A-Za-z0-9_.]*)/gu)];
@@ -18854,19 +19094,19 @@ function assertAndroidManifestResources(nativeDirectory) {
18854
19094
  const type = reference[1] ?? "";
18855
19095
  const name = reference[2] ?? "";
18856
19096
  const found = resourceRoots.some((resourceRoot) => {
18857
- if (!existsSync24(resourceRoot)) {
19097
+ if (!existsSync25(resourceRoot)) {
18858
19098
  return false;
18859
19099
  }
18860
- const folders = readdirSync7(resourceRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
19100
+ const folders = readdirSync8(resourceRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
18861
19101
  return folders.some((folder) => {
18862
19102
  const densityFallback = (type === "mipmap" || type === "drawable") && new RegExp(`^${type}-(?:ldpi|mdpi|hdpi|xhdpi|xxhdpi|xxxhdpi|nodpi|anydpi)$`, "u").test(folder);
18863
19103
  if (folder === type || densityFallback) {
18864
- return readdirSync7(path11.join(resourceRoot, folder)).some((file) => file === `${name}.xml` || file.startsWith(`${name}.`));
19104
+ return readdirSync8(path12.join(resourceRoot, folder)).some((file) => file === `${name}.xml` || file.startsWith(`${name}.`));
18865
19105
  }
18866
19106
  if (folder !== "values") {
18867
19107
  return false;
18868
19108
  }
18869
- return readdirSync7(path11.join(resourceRoot, folder)).some((file) => file.endsWith(".xml") && readAndroidValueResource(path11.join(resourceRoot, folder, file), type, name).length > 0);
19109
+ return readdirSync8(path12.join(resourceRoot, folder)).some((file) => file.endsWith(".xml") && readAndroidValueResource(path12.join(resourceRoot, folder, file), type, name).length > 0);
18870
19110
  });
18871
19111
  });
18872
19112
  if (!found) {
@@ -18879,13 +19119,13 @@ function assertNativeDisplayName(nativeDirectory, platform, expectedDisplayName,
18879
19119
  if (platform === "ios" && !isNativeFile(nativeDirectory, relative14)) {
18880
19120
  throw new Error(`Existing ${platform} project is incomplete; native display name resource is missing.`);
18881
19121
  }
18882
- const source = platform === "ios" ? readFileSync24(path11.join(nativeDirectory, relative14), "utf8") : "";
19122
+ const source = platform === "ios" ? readFileSync24(path12.join(nativeDirectory, relative14), "utf8") : "";
18883
19123
  const labels = platform === "ios" ? [parsePlistDictionary(source, "Release").get("CFBundleDisplayName")].filter((value) => value?.tagName === "string").map((value) => value?.textContent ?? "") : [];
18884
19124
  if (platform === "ios" && (labels.length !== 1 || labels[0] !== expectedDisplayName)) {
18885
19125
  throw new Error(`Existing ${platform} project display name differs or cannot be read safely.`);
18886
19126
  }
18887
19127
  if (platform === "android") {
18888
- const main = readAndroidApplication(path11.join(nativeDirectory, "app/src/main/AndroidManifest.xml"));
19128
+ const main = readAndroidApplication(path12.join(nativeDirectory, "app/src/main/AndroidManifest.xml"));
18889
19129
  if (main === void 0) {
18890
19130
  throw new Error("Existing android project application label is missing.");
18891
19131
  }
@@ -18904,8 +19144,8 @@ function assertNativeDisplayName(nativeDirectory, platform, expectedDisplayName,
18904
19144
  throw new Error("Existing android project launcher label differs from the requested name.");
18905
19145
  }
18906
19146
  }
18907
- const overlayFile = path11.join(nativeDirectory, "app/src/release/AndroidManifest.xml");
18908
- if (existsSync24(overlayFile)) {
19147
+ const overlayFile = path12.join(nativeDirectory, "app/src/release/AndroidManifest.xml");
19148
+ if (existsSync25(overlayFile)) {
18909
19149
  const release = readAndroidApplication(overlayFile, false);
18910
19150
  if (release !== void 0) {
18911
19151
  if (hasAndroidMergerDirective(release)) {
@@ -18915,7 +19155,7 @@ function assertNativeDisplayName(nativeDirectory, platform, expectedDisplayName,
18915
19155
  if (releaseLabel !== null && resolveAndroidLabel(nativeDirectory, releaseLabel) !== expectedDisplayName) {
18916
19156
  throw new Error("Existing android Release application label differs from the requested name.");
18917
19157
  }
18918
- const appBuildFile = ["app/build.gradle", "app/build.gradle.kts"].map((relative15) => path11.join(nativeDirectory, relative15)).find((file) => existsSync24(file));
19158
+ const appBuildFile = ["app/build.gradle", "app/build.gradle.kts"].map((relative15) => path12.join(nativeDirectory, relative15)).find((file) => existsSync25(file));
18919
19159
  const appGradle = appBuildFile === void 0 ? "" : readFileSync24(appBuildFile, "utf8");
18920
19160
  const manifestPackage = main.parentNode?.getAttribute("package");
18921
19161
  const namespace = /\bnamespace\s*(?:=\s*)?["']([A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)+)["']/u.exec(stripGradleComments(appGradle))?.[1] ?? (manifestPackage === null || manifestPackage === "" ? void 0 : manifestPackage);
@@ -18952,21 +19192,21 @@ function assertNativeDisplayName(nativeDirectory, platform, expectedDisplayName,
18952
19192
  }
18953
19193
  }
18954
19194
  function assertAndroidReleaseDisplayName(shellApp, expectedDisplayName) {
18955
- const nativeDirectory = path11.join(shellApp, "android");
19195
+ const nativeDirectory = path12.join(shellApp, "android");
18956
19196
  assertAndroidManifestResources(nativeDirectory);
18957
19197
  assertNativeDisplayName(nativeDirectory, "android", expectedDisplayName);
18958
19198
  }
18959
19199
  function assertAndroidReleaseLauncherIntegrity(shellApp) {
18960
- const nativeDirectory = path11.join(shellApp, "android");
19200
+ const nativeDirectory = path12.join(shellApp, "android");
18961
19201
  const gradleRelative = requireOneNativeFile(nativeDirectory, ["app/build.gradle", "app/build.gradle.kts"], "android");
18962
- const gradle = readFileSync24(path11.join(nativeDirectory, gradleRelative), "utf8");
19202
+ const gradle = readFileSync24(path12.join(nativeDirectory, gradleRelative), "utf8");
18963
19203
  assertAndroidLauncherClasses(nativeDirectory, gradle);
18964
19204
  }
18965
19205
  function assertIosReleaseDisplayName(shellApp, expectedDisplayName) {
18966
- const nativeDirectory = path11.join(shellApp, "ios");
18967
- const projectFile = path11.join(nativeDirectory, "App/App.xcodeproj/project.pbxproj");
19206
+ const nativeDirectory = path12.join(shellApp, "ios");
19207
+ const projectFile = path12.join(nativeDirectory, "App/App.xcodeproj/project.pbxproj");
18968
19208
  const project = readFileSync24(projectFile, "utf8");
18969
- const infoRelative = path11.join("App", readIosReleaseInfoPlist(project));
19209
+ const infoRelative = path12.join("App", readIosReleaseInfoPlist(project));
18970
19210
  if (!isNativeFile(nativeDirectory, infoRelative)) {
18971
19211
  throw new Error("Existing ios project Release Info.plist is missing or unsafe.");
18972
19212
  }
@@ -18976,20 +19216,20 @@ function assertIosReleaseDisplayName(shellApp, expectedDisplayName) {
18976
19216
  }
18977
19217
  function assertNoIosLocalizedDisplayNameOverride(nativeDirectory, project) {
18978
19218
  const files = listNativeFiles(nativeDirectory, "App/App", ".strings");
18979
- if (/\bInfoPlist\.strings\b/u.test(project) || isNativeFile(nativeDirectory, "App/InfoPlist.strings") || files.some((relative14) => path11.basename(relative14) === "InfoPlist.strings")) {
19219
+ if (/\bInfoPlist\.strings\b/u.test(project) || isNativeFile(nativeDirectory, "App/InfoPlist.strings") || files.some((relative14) => path12.basename(relative14) === "InfoPlist.strings")) {
18980
19220
  throw new Error("Existing ios project localized InfoPlist.strings overrides are unsupported.");
18981
19221
  }
18982
19222
  }
18983
19223
  function assertIosArchiveScheme(shellApp) {
18984
- const nativeDirectory = path11.join(shellApp, "ios");
19224
+ const nativeDirectory = path12.join(shellApp, "ios");
18985
19225
  const projectRelative = "App/App.xcodeproj/project.pbxproj";
18986
19226
  const schemeRelative = "App/App.xcodeproj/xcshareddata/xcschemes/App.xcscheme";
18987
19227
  if (!isNativeFile(nativeDirectory, projectRelative) || !isNativeFile(nativeDirectory, schemeRelative)) {
18988
19228
  throw new Error("Existing ios project shared App archive scheme is missing or unsafe.");
18989
19229
  }
18990
- const project = readFileSync24(path11.join(nativeDirectory, projectRelative), "utf8");
19230
+ const project = readFileSync24(path12.join(nativeDirectory, projectRelative), "utf8");
18991
19231
  const appTargetId = readIosAppTargetId(project);
18992
- const schemeSource = readFileSync24(path11.join(nativeDirectory, schemeRelative), "utf8");
19232
+ const schemeSource = readFileSync24(path12.join(nativeDirectory, schemeRelative), "utf8");
18993
19233
  const scheme = parseXml(schemeSource, "ios project App archive scheme").documentElement;
18994
19234
  if (scheme?.tagName !== "Scheme") {
18995
19235
  throw new Error("Existing ios project App archive scheme is malformed.");
@@ -19044,15 +19284,15 @@ function readAndroidString(nativeDirectory, key) {
19044
19284
  if (!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(key)) {
19045
19285
  throw new Error("Existing android project application label is unsupported.");
19046
19286
  }
19047
- const overlay = path11.join(nativeDirectory, "app/src/release/res/values");
19048
- const overlayValues = existsSync24(overlay) && lstatSync14(overlay).isDirectory() ? readdirSync7(overlay).filter((file) => file.endsWith(".xml")).flatMap((file) => readAndroidValueResource(path11.join(overlay, file), "string", key)) : [];
19049
- const main = path11.join(nativeDirectory, "app/src/main/res/values");
19050
- const mainValues = existsSync24(main) && lstatSync14(main).isDirectory() ? readdirSync7(main).filter((file) => file.endsWith(".xml")).flatMap((file) => readAndroidValueResource(path11.join(main, file), "string", key)) : [];
19287
+ const overlay = path12.join(nativeDirectory, "app/src/release/res/values");
19288
+ const overlayValues = existsSync25(overlay) && lstatSync15(overlay).isDirectory() ? readdirSync8(overlay).filter((file) => file.endsWith(".xml")).flatMap((file) => readAndroidValueResource(path12.join(overlay, file), "string", key)) : [];
19289
+ const main = path12.join(nativeDirectory, "app/src/main/res/values");
19290
+ const mainValues = existsSync25(main) && lstatSync15(main).isDirectory() ? readdirSync8(main).filter((file) => file.endsWith(".xml")).flatMap((file) => readAndroidValueResource(path12.join(main, file), "string", key)) : [];
19051
19291
  const values = overlayValues.length > 0 ? overlayValues : mainValues;
19052
19292
  if (values.length !== 1) {
19053
19293
  throw new Error("Existing android project application label resource is missing or ambiguous.");
19054
19294
  }
19055
- const qualified = ["main", "release"].flatMap((sourceSet) => listNativeFiles(nativeDirectory, `app/src/${sourceSet}/res`, ".xml").filter((relative14) => /^values-[^/]+$/u.test(path11.basename(path11.dirname(relative14)))).flatMap((relative14) => readAndroidValueResource(path11.join(nativeDirectory, relative14), "string", key)));
19295
+ const qualified = ["main", "release"].flatMap((sourceSet) => listNativeFiles(nativeDirectory, `app/src/${sourceSet}/res`, ".xml").filter((relative14) => /^values-[^/]+$/u.test(path12.basename(path12.dirname(relative14)))).flatMap((relative14) => readAndroidValueResource(path12.join(nativeDirectory, relative14), "string", key)));
19056
19296
  if (qualified.some((value) => value !== values[0])) {
19057
19297
  throw new Error("Existing android project configuration-qualified application label differs.");
19058
19298
  }
@@ -19119,19 +19359,19 @@ function requireOneNativeFile(directory, candidates, platform) {
19119
19359
  return present[0] ?? "";
19120
19360
  }
19121
19361
  function isNativeFile(directory, relative14) {
19122
- const file = path11.resolve(directory, relative14);
19123
- const within = path11.relative(directory, file);
19124
- if (within === "" || within.startsWith("..") || path11.isAbsolute(within)) {
19362
+ const file = path12.resolve(directory, relative14);
19363
+ const within = path12.relative(directory, file);
19364
+ if (within === "" || within.startsWith("..") || path12.isAbsolute(within)) {
19125
19365
  return false;
19126
19366
  }
19127
19367
  let current = directory;
19128
- for (const segment of within.split(path11.sep)) {
19129
- current = path11.join(current, segment);
19130
- if (!existsSync24(current) || lstatSync14(current).isSymbolicLink()) {
19368
+ for (const segment of within.split(path12.sep)) {
19369
+ current = path12.join(current, segment);
19370
+ if (!existsSync25(current) || lstatSync15(current).isSymbolicLink()) {
19131
19371
  return false;
19132
19372
  }
19133
19373
  }
19134
- return lstatSync14(file).isFile();
19374
+ return lstatSync15(file).isFile();
19135
19375
  }
19136
19376
  var androidAdvertisingRendererService = "dev.mpgd.capacitor.AdvertisingMessagingService";
19137
19377
  var androidMessagingPluginService = "io.capawesome.capacitorjs.plugins.firebase.messaging.MessagingService";
@@ -19176,7 +19416,7 @@ function assertNativeReleaseIdentity(input) {
19176
19416
  const candidates = [
19177
19417
  join14(input.shellApp, "android/app/build.gradle"),
19178
19418
  join14(input.shellApp, "android/app/build.gradle.kts")
19179
- ].filter((file) => existsSync25(file));
19419
+ ].filter((file) => existsSync26(file));
19180
19420
  if (candidates.length !== 1) {
19181
19421
  throw new Error("Android native release requires exactly one Gradle app build file.");
19182
19422
  }
@@ -19207,7 +19447,7 @@ function stampNativeReleaseVersions(input) {
19207
19447
  const candidates = [
19208
19448
  join14(input.stagedShellApp, "android/app/build.gradle"),
19209
19449
  join14(input.stagedShellApp, "android/app/build.gradle.kts")
19210
- ].filter((file3) => existsSync25(file3));
19450
+ ].filter((file3) => existsSync26(file3));
19211
19451
  if (candidates.length !== 1) {
19212
19452
  throw new Error("Android native release requires exactly one Gradle app build file.");
19213
19453
  }
@@ -19483,7 +19723,7 @@ function assertAndroidAppliedScripts(appBuild, androidRoot) {
19483
19723
  throw new Error("Native release preflight cannot resolve an applied Gradle script.");
19484
19724
  }
19485
19725
  };
19486
- const rootFiles = ["build.gradle", "build.gradle.kts"].map((name) => join14(androidRoot, name)).filter((file) => existsSync25(file));
19726
+ const rootFiles = ["build.gradle", "build.gradle.kts"].map((name) => join14(androidRoot, name)).filter((file) => existsSync26(file));
19487
19727
  if (rootFiles.length !== 1) {
19488
19728
  throw new Error("Native release preflight requires one Android root Gradle build file.");
19489
19729
  }
@@ -19493,7 +19733,7 @@ function assertAndroidAppliedScripts(appBuild, androidRoot) {
19493
19733
  if (/\b(?:afterEvaluate|projectsEvaluated)\b/u.test(rootCode) && /\b(?:project|subprojects|allprojects|android)\b/u.test(rootCode)) {
19494
19734
  throw new Error("Native release preflight cannot resolve root Gradle app callbacks.");
19495
19735
  }
19496
- const settingsFiles = ["settings.gradle", "settings.gradle.kts"].map((name) => join14(androidRoot, name)).filter((file) => existsSync25(file));
19736
+ const settingsFiles = ["settings.gradle", "settings.gradle.kts"].map((name) => join14(androidRoot, name)).filter((file) => existsSync26(file));
19497
19737
  if (settingsFiles.length !== 1) {
19498
19738
  throw new Error("Native release preflight requires one Android settings Gradle file.");
19499
19739
  }
@@ -19829,7 +20069,7 @@ function stripOptionalQuotes(value) {
19829
20069
  return value;
19830
20070
  }
19831
20071
  function readRequiredFile(file, label) {
19832
- if (!existsSync25(file)) {
20072
+ if (!existsSync26(file)) {
19833
20073
  throw new Error(`Missing ${label}: ${file}`);
19834
20074
  }
19835
20075
  return readFileSync25(file, "utf8");
@@ -19912,6 +20152,7 @@ function executeAndroidBuild(input, stagedShell) {
19912
20152
  const { plan, artifactRoot, environment, target: target2 } = input;
19913
20153
  const androidProject = `${stagedShell}/android`;
19914
20154
  let releaseArtifact;
20155
+ let symbols;
19915
20156
  if (plan.mode === "sync") {
19916
20157
  releaseArtifact = `${artifactRoot}/capacitor-sync`;
19917
20158
  input.replaceDirectory(androidProject, input.targetPath(releaseArtifact));
@@ -19923,6 +20164,12 @@ function executeAndroidBuild(input, stagedShell) {
19923
20164
  input.run("./gradlew", plan.mode === "signed-archive" ? androidSignedReleaseGradleArgs(environment) : ["bundleRelease", "--no-daemon"], environment, androidProject);
19924
20165
  releaseArtifact = `${artifactRoot}/app-release.aab`;
19925
20166
  input.copyFile(`${androidProject}/app/build/outputs/bundle/release/app-release.aab`, input.targetPath(releaseArtifact));
20167
+ const mapping = `${androidProject}/${androidReleaseMappingPath}`;
20168
+ if (existsSync27(mapping) && statSync7(mapping).isFile() && statSync7(mapping).size > 0) {
20169
+ const r8Mapping = `${artifactRoot}/symbols/${nativeSymbolFileNames.r8Mapping}`;
20170
+ input.copyFile(mapping, input.targetPath(r8Mapping));
20171
+ symbols = { r8Mapping };
20172
+ }
19926
20173
  if (plan.mode === "signed-archive") {
19927
20174
  inspectSignedAndroidBundle({
19928
20175
  bundle: input.targetPath(releaseArtifact),
@@ -19936,14 +20183,14 @@ function executeAndroidBuild(input, stagedShell) {
19936
20183
  } else {
19937
20184
  throw new Error(`Unsupported Android build mode: ${plan.mode}.`);
19938
20185
  }
19939
- return releaseArtifact;
20186
+ return { artifact: releaseArtifact, ...symbols === void 0 ? {} : { symbols } };
19940
20187
  }
19941
20188
  function androidSignedReleaseGradleArgs(environment) {
19942
20189
  const initScript = environment.MPGD_ANDROID_SIGNING_INIT_SCRIPT;
19943
20190
  if (initScript === void 0 || initScript === "") {
19944
20191
  return ["bundleRelease", "--no-daemon"];
19945
20192
  }
19946
- if (!isAbsolute12(initScript) || !existsSync26(initScript) || !statSync6(initScript).isFile()) {
20193
+ if (!isAbsolute12(initScript) || !existsSync27(initScript) || !statSync7(initScript).isFile()) {
19947
20194
  throw new Error("Android upload signing init script must be an existing absolute file.");
19948
20195
  }
19949
20196
  return ["bundleRelease", "--no-daemon", "--init-script", initScript];
@@ -19966,6 +20213,7 @@ async function executeIosBuild(input, stagedShell) {
19966
20213
  function executeIosBuildWithEnvironment(input, stagedShell, environment) {
19967
20214
  const { plan, artifactRoot, target: target2 } = input;
19968
20215
  let releaseArtifact;
20216
+ let symbols;
19969
20217
  if (plan.mode === "unsigned-archive") {
19970
20218
  releaseArtifact = `${artifactRoot}/App.xcarchive`;
19971
20219
  mkdirSync12(dirname11(input.targetPath(releaseArtifact)), { recursive: true });
@@ -19992,17 +20240,14 @@ function executeIosBuildWithEnvironment(input, stagedShell, environment) {
19992
20240
  "-project",
19993
20241
  "App/App.xcodeproj",
19994
20242
  "-target",
19995
- "App",
20243
+ iosSimulatorAppTarget,
19996
20244
  "-configuration",
19997
20245
  "Release",
19998
20246
  "-sdk",
19999
20247
  "iphonesimulator",
20000
20248
  `SYMROOT=${buildRoot}`,
20001
20249
  `OBJROOT=${join15(buildRoot, "Intermediates.noindex")}`,
20002
- "INFOPLIST_FILE=App/Info-Smoke.plist",
20003
- "EXCLUDED_SOURCE_FILE_NAMES=Main.storyboard LaunchScreen.storyboard Assets.xcassets",
20004
- "ASSETCATALOG_COMPILER_APPICON_NAME=",
20005
- "SWIFT_ACTIVE_COMPILATION_CONDITIONS=MPGD_SMOKE_NO_STORYBOARD",
20250
+ ...iosSimulatorSmokeBuildSettings(["MPGD_SMOKE_NO_STORYBOARD"]),
20006
20251
  "CODE_SIGNING_ALLOWED=NO"
20007
20252
  ], environment, `${stagedShell}/ios`);
20008
20253
  input.replaceDirectory(`${buildRoot}/Release-iphonesimulator/App.app`, input.targetPath(releaseArtifact));
@@ -20019,6 +20264,7 @@ function executeIosBuildWithEnvironment(input, stagedShell, environment) {
20019
20264
  const signing = resolveIosSigningPlan(environment, plan.mode);
20020
20265
  const archiveArtifact = `${artifactRoot}/App.xcarchive`;
20021
20266
  mkdirSync12(dirname11(input.targetPath(archiveArtifact)), { recursive: true });
20267
+ const sourcePackages = shellInstallsCrashlytics(stagedShell) ? join15(stagedShell, "ios", iosCrashlyticsSourcePackagesDirectory) : void 0;
20022
20268
  input.run("xcodebuild", [
20023
20269
  "archive",
20024
20270
  "-project",
@@ -20031,6 +20277,7 @@ function executeIosBuildWithEnvironment(input, stagedShell, environment) {
20031
20277
  "generic/platform=iOS",
20032
20278
  "-archivePath",
20033
20279
  input.targetPath(archiveArtifact),
20280
+ ...sourcePackages === void 0 ? [] : ["-clonedSourcePackagesDirPath", sourcePackages],
20034
20281
  ...signing.archiveBuildSettings
20035
20282
  ], environment, `${stagedShell}/ios`);
20036
20283
  const expectedIosIdentity = {
@@ -20040,6 +20287,30 @@ function executeIosBuildWithEnvironment(input, stagedShell, environment) {
20040
20287
  expectedTeamId: signing.teamId
20041
20288
  };
20042
20289
  inspectSignedIosArchive(input.targetPath(archiveArtifact), expectedIosIdentity);
20290
+ if (sourcePackages !== void 0) {
20291
+ const symbolRoot = `${artifactRoot}/symbols`;
20292
+ const collected = collectIosCrashlyticsSymbols({
20293
+ archive: input.targetPath(archiveArtifact),
20294
+ iosProject: `${stagedShell}/ios`,
20295
+ sourcePackages,
20296
+ outputDirectory: input.targetPath(symbolRoot),
20297
+ copyFile: input.copyFile,
20298
+ // Without --sequesterRsrc, ditto writes no __MACOSX AppleDouble
20299
+ // entries that upload-symbols could take for `._*.dSYM` bundles.
20300
+ zipDirectory: (source, destination) => {
20301
+ mkdirSync12(dirname11(destination), { recursive: true });
20302
+ input.run("ditto", ["-c", "-k", "--keepParent", source, destination], environment);
20303
+ }
20304
+ });
20305
+ symbols = {
20306
+ crashlytics: {
20307
+ dsymArchive: `${symbolRoot}/${nativeSymbolFileNames.dsymArchive}`,
20308
+ dsyms: collected.dsyms,
20309
+ uploadTool: `${symbolRoot}/${nativeSymbolFileNames.uploadTool}`,
20310
+ googleServiceInfo: `${symbolRoot}/${nativeSymbolFileNames.googleServiceInfo}`
20311
+ }
20312
+ };
20313
+ }
20043
20314
  releaseArtifact = archiveArtifact;
20044
20315
  if (plan.mode === "store-export") {
20045
20316
  const exportRoot = mkdtempSync4(join15(tmpdir4(), "mpgd-ios-export-"));
@@ -20053,7 +20324,7 @@ function executeIosBuildWithEnvironment(input, stagedShell, environment) {
20053
20324
  "-exportOptionsPlist",
20054
20325
  requireString(signing.exportOptionsPlist, "iOS export options plist")
20055
20326
  ], environment, `${stagedShell}/ios`);
20056
- const exportedIpas = readdirSync8(exportRoot).filter((name) => name.endsWith(".ipa"));
20327
+ const exportedIpas = readdirSync9(exportRoot).filter((name) => name.endsWith(".ipa"));
20057
20328
  if (exportedIpas.length !== 1) {
20058
20329
  throw new Error("iOS store export must produce exactly one IPA.");
20059
20330
  }
@@ -20070,7 +20341,7 @@ function executeIosBuildWithEnvironment(input, stagedShell, environment) {
20070
20341
  } else {
20071
20342
  throw new Error(`Unsupported iOS build mode: ${plan.mode}.`);
20072
20343
  }
20073
- return releaseArtifact;
20344
+ return { artifact: releaseArtifact, ...symbols === void 0 ? {} : { symbols } };
20074
20345
  }
20075
20346
  function requireString(value, label) {
20076
20347
  if (value === void 0 || value.length === 0) {
@@ -20174,7 +20445,7 @@ var releaseManifestEnvKeys = [
20174
20445
  var platformTargets = loadPlatformTargetsConfig();
20175
20446
  var configBaseDir = platformTargets.baseDir;
20176
20447
  var kitLinkCheck = resolve18("tools/workspace/relink-kit-workspace.mjs");
20177
- if (existsSync27(kitLinkCheck)) {
20448
+ if (existsSync28(kitLinkCheck)) {
20178
20449
  spawnSync5(process.execPath, [kitLinkCheck, "--warn-unless-owner", configBaseDir], {
20179
20450
  stdio: "inherit"
20180
20451
  });
@@ -20463,7 +20734,7 @@ try {
20463
20734
  if (nativePlan === void 0 || nativeArtifactRoot === void 0 || nativeAttempt === void 0 || nativeWebBundle === void 0) {
20464
20735
  throw new Error("Native build plan is missing.");
20465
20736
  }
20466
- const releaseArtifact = await executeNativeTargetBuild({
20737
+ const nativeOutput = await executeNativeTargetBuild({
20467
20738
  targetName,
20468
20739
  target,
20469
20740
  profile,
@@ -20479,12 +20750,13 @@ try {
20479
20750
  copyIosSyncSwiftPackage,
20480
20751
  run
20481
20752
  });
20753
+ const releaseArtifact = nativeOutput.artifact;
20482
20754
  if (assetTargetReport !== void 0) {
20483
20755
  await assertAssetPackNativeArtifact(assetTargetReport, targetPath(releaseArtifact));
20484
20756
  }
20485
20757
  await writeRemoteAssetPacks();
20486
20758
  writeManifest(targetName, profile, releaseArtifact, env);
20487
- nativeAttempt.complete(releaseArtifact);
20759
+ nativeAttempt.complete(releaseArtifact, nativeOutput.symbols);
20488
20760
  nativeCompleted = true;
20489
20761
  break;
20490
20762
  }
@@ -20524,7 +20796,7 @@ function replaceDirectory(source, destination) {
20524
20796
  function mirrorAitRuntimeAssets(gameApp2, wrapperApp) {
20525
20797
  const sourceAssets = `${gameApp2}/dist/assets`;
20526
20798
  const destinationAssets = `${wrapperApp}/public/assets`;
20527
- if (existsSync27(sourceAssets)) {
20799
+ if (existsSync28(sourceAssets)) {
20528
20800
  replaceDirectory(sourceAssets, destinationAssets);
20529
20801
  } else {
20530
20802
  rmSync12(destinationAssets, { recursive: true, force: true });
@@ -20535,7 +20807,7 @@ async function stageTargetAssetPacks(webOutput) {
20535
20807
  return;
20536
20808
  }
20537
20809
  const destination = join16(webOutput, assetPackTargetNamespace);
20538
- if (existsSync27(destination)) {
20810
+ if (existsSync28(destination)) {
20539
20811
  throw new Error("mpgd-asset-packs is owned by the target policy; remove source/public copies from the game");
20540
20812
  }
20541
20813
  cpSync4(assetTargetReport.packagedDir, destination, {
@@ -20666,12 +20938,12 @@ function copyFile2(source, destination) {
20666
20938
  cpSync4(source, destination);
20667
20939
  }
20668
20940
  function removeFilesByExtension(directory, extension) {
20669
- if (!existsSync27(directory)) {
20941
+ if (!existsSync28(directory)) {
20670
20942
  return;
20671
20943
  }
20672
- for (const file of readdirSync9(directory)) {
20944
+ for (const file of readdirSync10(directory)) {
20673
20945
  const target2 = `${directory}/${file}`;
20674
- if (file.endsWith(extension) && statSync7(target2).isFile()) {
20946
+ if (file.endsWith(extension) && statSync8(target2).isFile()) {
20675
20947
  rmSync12(target2, { force: true });
20676
20948
  }
20677
20949
  }
@@ -20681,7 +20953,7 @@ function safeArtifactFileStem(value) {
20681
20953
  return stem.length === 0 ? "mpgd-kit" : stem;
20682
20954
  }
20683
20955
  function ensureCapacitorPlatform(shellApp, platform, commandEnv) {
20684
- if (!existsSync27(`${shellApp}/${platform}`)) {
20956
+ if (!existsSync28(`${shellApp}/${platform}`)) {
20685
20957
  run("pnpm", ["--dir", shellApp, "cap", "add", platform], commandEnv);
20686
20958
  }
20687
20959
  }
@@ -20705,7 +20977,7 @@ function writeManifest(target2, releaseProfile, artifact, commandEnv) {
20705
20977
  function findEmbeddedIconManifestArtifactPath(artifact) {
20706
20978
  const artifactPath = targetPath(artifact);
20707
20979
  const fileName = "mpgd-icon-manifest.json";
20708
- const matches = statSync7(artifactPath).isDirectory() ? findNamedArtifactFiles(artifactPath, fileName).map((path12) => relative13(artifactPath, path12).replaceAll("\\", "/")) : listZipEntries(artifactPath).filter((entry) => basename5(entry) === fileName);
20980
+ const matches = statSync8(artifactPath).isDirectory() ? findNamedArtifactFiles(artifactPath, fileName).map((path13) => relative13(artifactPath, path13).replaceAll("\\", "/")) : listZipEntries(artifactPath).filter((entry) => basename5(entry) === fileName);
20709
20981
  if (matches.length !== 1) {
20710
20982
  throw new Error(`Expected exactly one ${fileName} in release artifact ${artifactPath}; found ${matches.length}.`);
20711
20983
  }
@@ -20717,22 +20989,22 @@ function findEmbeddedIconManifestArtifactPath(artifact) {
20717
20989
  }
20718
20990
  function findNamedArtifactFiles(root, fileName) {
20719
20991
  const matches = [];
20720
- for (const entry of readdirSync9(root)) {
20721
- const path12 = join16(root, entry);
20722
- const stat2 = lstatSync15(path12);
20992
+ for (const entry of readdirSync10(root)) {
20993
+ const path13 = join16(root, entry);
20994
+ const stat2 = lstatSync16(path13);
20723
20995
  if (stat2.isSymbolicLink()) {
20724
20996
  continue;
20725
20997
  }
20726
20998
  if (stat2.isDirectory()) {
20727
- matches.push(...findNamedArtifactFiles(path12, fileName));
20999
+ matches.push(...findNamedArtifactFiles(path13, fileName));
20728
21000
  } else if (stat2.isFile() && entry === fileName) {
20729
- matches.push(path12);
21001
+ matches.push(path13);
20730
21002
  }
20731
21003
  }
20732
21004
  return matches;
20733
21005
  }
20734
- function listZipEntries(path12) {
20735
- const result = spawnSync5("unzip", ["-Z1", path12], {
21006
+ function listZipEntries(path13) {
21007
+ const result = spawnSync5("unzip", ["-Z1", path13], {
20736
21008
  cwd: process.cwd(),
20737
21009
  env: nativeInspectionEnvironment(),
20738
21010
  encoding: "utf8"
@@ -20742,7 +21014,7 @@ function listZipEntries(path12) {
20742
21014
  }
20743
21015
  const toleratedPrefixWarning = result.status === 1 && result.stdout.trim().length > 0 && result.stderr.includes("extra bytes at beginning or within zipfile") && result.stderr.includes("(attempting to process anyway)");
20744
21016
  if (result.status !== 0 && !toleratedPrefixWarning) {
20745
- throw new Error(`Failed to list release artifact ${path12}: ${result.stderr.trim() || `exit ${String(result.status)}`}`);
21017
+ throw new Error(`Failed to list release artifact ${path13}: ${result.stderr.trim() || `exit ${String(result.status)}`}`);
20746
21018
  }
20747
21019
  return result.stdout.split("\n").filter((entry) => entry.length > 0);
20748
21020
  }
@@ -20769,7 +21041,7 @@ function isMiniGameTarget(target2) {
20769
21041
  }
20770
21042
  function buildMiniGameBundle(bundleKind, outputDir, stagingRoot, gameApp2, profile2, commandEnv) {
20771
21043
  const viteConfig = join16(gameApp2, "vite.minigame.config.ts");
20772
- if (!existsSync27(viteConfig)) {
21044
+ if (!existsSync28(viteConfig)) {
20773
21045
  throw new Error(`Mini-game target requires a game-owned vite.minigame.config.ts: ${viteConfig}`);
20774
21046
  }
20775
21047
  run("pnpm", ["exec", "vite", "build", "--config", "vite.minigame.config.ts", "--mode", profile2], {
@@ -20801,11 +21073,11 @@ function withProcessEnv(env2, keys, callback) {
20801
21073
  }
20802
21074
  }
20803
21075
  }
20804
- function targetPath(path12) {
20805
- return resolveFromPlatformTargetsBase(configBaseDir, path12);
21076
+ function targetPath(path13) {
21077
+ return resolveFromPlatformTargetsBase(configBaseDir, path13);
20806
21078
  }
20807
21079
  function findFileByExtension(directory, extension) {
20808
- const files = readdirSync9(directory).filter((file) => file.endsWith(extension)).sort();
21080
+ const files = readdirSync10(directory).filter((file) => file.endsWith(extension)).sort();
20809
21081
  if (files.length === 0) {
20810
21082
  throw new Error(`Missing ${extension} artifact in ${directory}.`);
20811
21083
  }