vxrn 2.14.2 → 2.15.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.
@@ -2221,7 +2221,31 @@ const generateForPlatform = async (root, platform, app, outDir = path.resolve(ro
2221
2221
  root,
2222
2222
  dest
2223
2223
  });
2224
+ applyAppPatches(dest, platform, app);
2224
2225
  };
2226
+ function listFiles(dir) {
2227
+ return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => entry.isDirectory() ? listFiles(path.join(dir, entry.name)) : [path.join(dir, entry.name)]);
2228
+ }
2229
+ function applyAppPatches(dest, platform, app) {
2230
+ const patches = (app.patches ?? []).filter((entry) => entry.platform === platform);
2231
+ if (patches.length === 0) return;
2232
+ const files = listFiles(dest);
2233
+ for (const { file, patch } of patches) {
2234
+ const matches = files.filter((candidate) => {
2235
+ const relative = path.relative(dest, candidate).split(path.sep).join("/");
2236
+ return relative === file || relative.endsWith("/" + file);
2237
+ });
2238
+ if (matches.length !== 1) {
2239
+ throw new Error(`[vxrn] native.app.patches: "${file}" matched ${matches.length} ${platform} files, expected exactly one`);
2240
+ }
2241
+ const before = readFileSync(matches[0], "utf8");
2242
+ const after = patch(before);
2243
+ if (patch(after) !== after) {
2244
+ throw new Error(`[vxrn] native.app.patches: patch for "${file}" is not idempotent`);
2245
+ }
2246
+ writeFileSync(matches[0], after);
2247
+ }
2248
+ }
2225
2249
  const KOTLIN_IMPORT_ARTIFACTS = [{
2226
2250
  importPrefix: "androidx.compose.material.icons",
2227
2251
  artifact: "androidx.compose.material:material-icons-core",