vxrn 2.0.0-beta.114.1 → 2.0.0-beta.117.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.
- package/dist/exports/prebuildWithoutExpo.mjs +35 -19
- package/dist/exports/prebuildWithoutExpo.mjs.map +1 -1
- package/dist/exports/prebuildWithoutExpo.native.js +63 -27
- package/dist/exports/prebuildWithoutExpo.native.js.map +1 -1
- package/dist/native-source-contract.mjs +3 -0
- package/dist/native-source-contract.native.js +3 -0
- package/dist/utils/nativeSourceContract.mjs +323 -0
- package/dist/utils/nativeSourceContract.mjs.map +1 -0
- package/dist/utils/nativeSourceContract.native.js +386 -0
- package/dist/utils/nativeSourceContract.native.js.map +1 -0
- package/expo-plugin.cjs +77 -28
- package/native-project-patches.cjs +60 -0
- package/package.json +15 -10
- package/src/exports/prebuildWithoutExpo.test.ts +39 -26
- package/src/exports/prebuildWithoutExpo.ts +43 -21
- package/src/native-source-contract.ts +8 -0
- package/src/utils/nativeSourceContract.test.ts +124 -0
- package/src/utils/nativeSourceContract.ts +293 -0
- package/types/exports/prebuildWithoutExpo.d.ts.map +1 -1
- package/types/native-source-contract.d.ts +2 -0
- package/types/native-source-contract.d.ts.map +1 -0
- package/types/utils/nativeSourceContract.d.ts +28 -0
- package/types/utils/nativeSourceContract.d.ts.map +1 -0
|
@@ -205,23 +205,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
|
205
205
|
}
|
|
206
206
|
}`);
|
|
207
207
|
}
|
|
208
|
-
const
|
|
209
|
-
function
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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
|
|
216
|
-
|
|
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
|
|
221
|
+
function patchIosPbxprojOneBridgingHeader(project, appName) {
|
|
220
222
|
const anchor = `INFOPLIST_FILE = ${appName}/Info.plist;`;
|
|
221
|
-
const setting = `SWIFT_OBJC_BRIDGING_HEADER = "${appName}/${
|
|
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
|
|
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}`);
|
|
@@ -1296,15 +1298,30 @@ ${schemes.map((scheme) => ` <data android:scheme="${scheme}" />`).joi
|
|
|
1296
1298
|
if (app.imagePicker?.camera !== void 0) {
|
|
1297
1299
|
usage.push(["NSCameraUsageDescription", app.imagePicker.camera]);
|
|
1298
1300
|
}
|
|
1301
|
+
if (app.location !== void 0) {
|
|
1302
|
+
usage.push(["NSLocationWhenInUseUsageDescription", app.location.whenInUse]);
|
|
1303
|
+
}
|
|
1304
|
+
if (app.ios?.faceIdUsageDescription !== void 0) {
|
|
1305
|
+
usage.push(["NSFaceIDUsageDescription", app.ios.faceIdUsageDescription]);
|
|
1306
|
+
}
|
|
1299
1307
|
if (app.speech !== void 0) {
|
|
1300
1308
|
usage.push(["NSSpeechRecognitionUsageDescription", app.speech.recognition], ["NSMicrophoneUsageDescription", app.speech.microphone]);
|
|
1301
1309
|
}
|
|
1302
|
-
|
|
1310
|
+
const additions = [];
|
|
1311
|
+
for (const [key, text] of usage) {
|
|
1312
|
+
const existing = new RegExp(`(<key>${key}</key>\\s*<string>)[^<]*(</string>)`);
|
|
1313
|
+
if (existing.test(rendered)) {
|
|
1314
|
+
rendered = rendered.replace(existing, (_match, before, after) => `${before}${escapeXml(text)}${after}`);
|
|
1315
|
+
} else {
|
|
1316
|
+
additions.push([key, text]);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
if (additions.length) {
|
|
1303
1320
|
const anchor = " <key>LSRequiresIPhoneOS</key>";
|
|
1304
1321
|
if (!rendered.includes(anchor)) {
|
|
1305
|
-
throw new Error(`[vxrn] cannot stamp ${
|
|
1322
|
+
throw new Error(`[vxrn] cannot stamp ${additions[0][0]}: expected LSRequiresIPhoneOS in Info.plist`);
|
|
1306
1323
|
}
|
|
1307
|
-
rendered = rendered.replace(anchor, `${
|
|
1324
|
+
rendered = rendered.replace(anchor, `${additions.map(([key, text]) => ` <key>${key}</key>
|
|
1308
1325
|
<string>${escapeXml(text)}</string>
|
|
1309
1326
|
`).join("")}${anchor}`);
|
|
1310
1327
|
}
|
|
@@ -1312,6 +1329,7 @@ ${schemes.map((scheme) => ` <data android:scheme="${scheme}" />`).joi
|
|
|
1312
1329
|
}
|
|
1313
1330
|
if (platform === "ios" && relativePath.endsWith("/AppDelegate.swift")) {
|
|
1314
1331
|
rendered = patchIosAppDelegateSceneLifecycle(rendered, appName);
|
|
1332
|
+
rendered = nativeProjectPatches.holdLaunchScreenOverRootView(rendered);
|
|
1315
1333
|
if (app.updates !== void 0) {
|
|
1316
1334
|
rendered = nativeProjectPatches.pointReleaseBundleURLAtOneUpdates(rendered);
|
|
1317
1335
|
}
|
|
@@ -1333,9 +1351,7 @@ end`);
|
|
|
1333
1351
|
if (platform === "ios" && relativePath.endsWith(".xcodeproj/project.pbxproj")) {
|
|
1334
1352
|
rendered = patchIosBundlePhase(rendered, app.updates?.runtimeVersion);
|
|
1335
1353
|
rendered = patchIosPbxprojSceneDelegate(rendered, appName);
|
|
1336
|
-
|
|
1337
|
-
rendered = patchIosPbxprojUpdatesBridgingHeader(rendered, appName);
|
|
1338
|
-
}
|
|
1354
|
+
rendered = patchIosPbxprojOneBridgingHeader(rendered, appName);
|
|
1339
1355
|
if (app.notifications?.push === true && !app.ios?.widgets) {
|
|
1340
1356
|
rendered = patchIosPbxprojPushEntitlements(rendered, appName);
|
|
1341
1357
|
}
|
|
@@ -1451,7 +1467,7 @@ const generateForPlatform = async (root, platform, app, outDir = path.resolve(ro
|
|
|
1451
1467
|
platform,
|
|
1452
1468
|
app
|
|
1453
1469
|
});
|
|
1454
|
-
if (platform === "ios")
|
|
1470
|
+
if (platform === "ios") generateOneBridgingHeader(dest, app);
|
|
1455
1471
|
if (platform === "ios") generateIosWidgets(dest, app);
|
|
1456
1472
|
if (platform === "ios") generateSwiftPackages({
|
|
1457
1473
|
root,
|
|
@@ -1522,7 +1538,7 @@ function applyAndroidDependencyPatches(args) {
|
|
|
1522
1538
|
return;
|
|
1523
1539
|
}
|
|
1524
1540
|
const activityPath = path.join(root, "android", "app", "src", "main", "java", ...app.android.applicationId.split("."), "MainActivity.kt");
|
|
1525
|
-
const rendered = nativeProjectPatches.addReactNativeScreensFix(FSExtra.readFileSync(activityPath, "utf8"));
|
|
1541
|
+
const rendered = nativeProjectPatches.holdLaunchScreenInMainActivity(nativeProjectPatches.addReactNativeScreensFix(FSExtra.readFileSync(activityPath, "utf8")));
|
|
1526
1542
|
if (!rendered.includes("RNScreensFragmentFactory")) {
|
|
1527
1543
|
throw new Error("[vxrn] failed to apply the react-native-screens activity patch");
|
|
1528
1544
|
}
|