vxrn 2.0.0-beta.113.1 → 2.0.0-beta.115.1

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.
@@ -5,7 +5,7 @@ import { pathToFileURL } from "node:url";
5
5
  import { validateNativeApp } from "@vxrn/utils/nativeAppManifest";
6
6
  import FSExtra from "fs-extra";
7
7
  import sharp from "sharp";
8
- import { swiftPackageId } from "../utils/swiftPackageId.mjs";
8
+ import { swiftPackageDirectories } from "../utils/swiftPackageId.mjs";
9
9
 
10
10
  const nativeProjectPatches = module.createRequire(import.meta.url)("../../native-project-patches.cjs");
11
11
  const notificationsHost = nativeProjectPatches.ONE_NOTIFICATIONS;
@@ -205,23 +205,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
205
205
  }
206
206
  }`);
207
207
  }
208
- const UPDATES_BRIDGING_HEADER_NAME = "OneUpdates-Bridging-Header.h";
209
- function renderUpdatesBridgingHeader() {
210
- return `// generated by one prebuild: exposes the updates launcher entry
211
- // point to AppDelegate without importing the One module.
212
- ${updatesHost.bridgingHeaderImport}
208
+ const ONE_BRIDGING_HEADER_NAME = "One-Bridging-Header.h";
209
+ function renderOneBridgingHeader(app) {
210
+ const imports = [nativeProjectPatches.ONE_LAUNCH_SCREEN.bridgingHeaderImport];
211
+ if (app.updates !== void 0) imports.push(updatesHost.bridgingHeaderImport);
212
+ return `// generated by one prebuild: exposes One's c entry points (the launch
213
+ // screen hold, the updates launcher) to AppDelegate without importing the
214
+ // One module.
215
+ ${imports.join("\n")}
213
216
  `;
214
217
  }
215
- function generateUpdatesBridgingHeader(dest, app) {
216
- if (app.updates === void 0) return;
217
- FSExtra.writeFileSync(path.join(dest, app.name, UPDATES_BRIDGING_HEADER_NAME), renderUpdatesBridgingHeader());
218
+ function generateOneBridgingHeader(dest, app) {
219
+ FSExtra.writeFileSync(path.join(dest, app.name, ONE_BRIDGING_HEADER_NAME), renderOneBridgingHeader(app));
218
220
  }
219
- function patchIosPbxprojUpdatesBridgingHeader(project, appName) {
221
+ function patchIosPbxprojOneBridgingHeader(project, appName) {
220
222
  const anchor = `INFOPLIST_FILE = ${appName}/Info.plist;`;
221
- const setting = `SWIFT_OBJC_BRIDGING_HEADER = "${appName}/${UPDATES_BRIDGING_HEADER_NAME}";`;
223
+ const setting = `SWIFT_OBJC_BRIDGING_HEADER = "${appName}/${ONE_BRIDGING_HEADER_NAME}";`;
222
224
  const occurrences = project.split(anchor).length - 1;
223
225
  if (occurrences !== 2) {
224
- throw new Error("[vxrn] prebuild template project.pbxproj changed shape: cannot point the app target at the One.Updates bridging header");
226
+ throw new Error("[vxrn] prebuild template project.pbxproj changed shape: cannot point the app target at the One bridging header");
225
227
  }
226
228
  return project.split(anchor).join(`${anchor}
227
229
  ${setting}`);
@@ -1312,6 +1314,7 @@ ${schemes.map((scheme) => ` <data android:scheme="${scheme}" />`).joi
1312
1314
  }
1313
1315
  if (platform === "ios" && relativePath.endsWith("/AppDelegate.swift")) {
1314
1316
  rendered = patchIosAppDelegateSceneLifecycle(rendered, appName);
1317
+ rendered = nativeProjectPatches.holdLaunchScreenOverRootView(rendered);
1315
1318
  if (app.updates !== void 0) {
1316
1319
  rendered = nativeProjectPatches.pointReleaseBundleURLAtOneUpdates(rendered);
1317
1320
  }
@@ -1333,9 +1336,7 @@ end`);
1333
1336
  if (platform === "ios" && relativePath.endsWith(".xcodeproj/project.pbxproj")) {
1334
1337
  rendered = patchIosBundlePhase(rendered, app.updates?.runtimeVersion);
1335
1338
  rendered = patchIosPbxprojSceneDelegate(rendered, appName);
1336
- if (app.updates !== void 0) {
1337
- rendered = patchIosPbxprojUpdatesBridgingHeader(rendered, appName);
1338
- }
1339
+ rendered = patchIosPbxprojOneBridgingHeader(rendered, appName);
1339
1340
  if (app.notifications?.push === true && !app.ios?.widgets) {
1340
1341
  rendered = patchIosPbxprojPushEntitlements(rendered, appName);
1341
1342
  }
@@ -1451,7 +1452,7 @@ const generateForPlatform = async (root, platform, app, outDir = path.resolve(ro
1451
1452
  platform,
1452
1453
  app
1453
1454
  });
1454
- if (platform === "ios") generateUpdatesBridgingHeader(dest, app);
1455
+ if (platform === "ios") generateOneBridgingHeader(dest, app);
1455
1456
  if (platform === "ios") generateIosWidgets(dest, app);
1456
1457
  if (platform === "ios") generateSwiftPackages({
1457
1458
  root,
@@ -1467,21 +1468,7 @@ function generateSwiftPackages({ root, dest }) {
1467
1468
  "types",
1468
1469
  "build"
1469
1470
  ]);
1470
- const packageDirs = [];
1471
- const walk = (dir) => {
1472
- const entries = FSExtra.readdirSync(dir, { withFileTypes: true });
1473
- if (entries.some((entry) => entry.isFile() && entry.name === "Package.swift")) {
1474
- packageDirs.push(dir);
1475
- return;
1476
- }
1477
- for (const entry of entries) {
1478
- if (!entry.isDirectory() || entry.name.startsWith(".") || skip.has(entry.name)) continue;
1479
- walk(path.join(dir, entry.name));
1480
- }
1481
- };
1482
- walk(root);
1483
- for (const packageDir of packageDirs) {
1484
- const id = swiftPackageId(packageDir);
1471
+ for (const [id, packageDir] of swiftPackageDirectories(root)) {
1485
1472
  const podDir = path.join(dest, "OneSwiftPackages", id);
1486
1473
  const sources = [];
1487
1474
  const collect = (dir) => {