|
1 | 1 | // @ts-check |
2 | | -import { createRequire } from "node:module"; |
3 | | -import * as path from "node:path"; |
| 2 | +import { createModFileProviders } from "./cocoaBaseMods.mjs"; |
4 | 3 | import { BaseMods } from "../ExpoConfigPlugins.mjs"; |
5 | | -import { makeFilePathModifier, makeNullProvider } from "../provider.mjs"; |
| 4 | +import { makeFilePathModifier } from "../provider.mjs"; |
6 | 5 |
|
7 | 6 | const modifyFilePath = makeFilePathModifier("node_modules/.generated/ios"); |
8 | | - |
9 | | -const require = createRequire(import.meta.url); |
10 | | -const modifyReactNativeHostFilePath = makeFilePathModifier( |
11 | | - path.dirname(require.resolve("@rnx-kit/react-native-host/package.json")) |
12 | | -); |
13 | | - |
14 | | -const nullProvider = makeNullProvider(); |
15 | | - |
16 | | -// https://github.com/expo/expo/blob/93cd0503117d5a25f8b80ed7b30ec5bed3a67c24/packages/@expo/config-plugins/src/plugins/withIosBaseMods.ts |
17 | | -const expoProviders = BaseMods.getIosModFileProviders(); |
18 | | - |
19 | | -/** @type {typeof expoProviders & Record<string, unknown>} */ |
20 | | -const defaultProviders = { |
21 | | - dangerous: expoProviders.dangerous, |
22 | | - finalized: expoProviders.finalized, |
23 | | - appDelegate: modifyFilePath( |
24 | | - expoProviders.appDelegate, |
25 | | - "ReactTestApp/AppDelegate.swift" |
26 | | - ), |
27 | | - expoPlist: nullProvider, |
28 | | - xcodeproj: modifyFilePath( |
29 | | - expoProviders.xcodeproj, |
30 | | - "ReactTestApp.xcodeproj/project.pbxproj" |
31 | | - ), |
32 | | - infoPlist: modifyFilePath(expoProviders.infoPlist, "Info.plist"), |
33 | | - entitlements: nullProvider, |
34 | | - podfile: makeNullProvider({ |
35 | | - path: "", |
36 | | - language: /** @type {const} */ ("rb"), |
37 | | - contents: "", |
38 | | - }), |
39 | | - podfileProperties: makeNullProvider(), |
40 | | -}; |
| 7 | +const defaultProviders = createModFileProviders(modifyFilePath); |
41 | 8 |
|
42 | 9 | // `react-native-test-app` files |
43 | 10 | defaultProviders["sceneDelegate"] = modifyFilePath( |
44 | | - expoProviders.appDelegate, |
| 11 | + BaseMods.getIosModFileProviders().appDelegate, |
45 | 12 | "ReactTestApp/SceneDelegate.swift" |
46 | 13 | ); |
47 | 14 |
|
48 | | -// `@rnx-kit/react-native-host` files |
49 | | -defaultProviders["reactNativeHost"] = modifyReactNativeHostFilePath( |
50 | | - expoProviders.appDelegate, |
51 | | - "cocoa/ReactNativeHost.mm" |
52 | | -); |
53 | | - |
54 | 15 | export function getIosModFileProviders() { |
55 | 16 | return defaultProviders; |
56 | 17 | } |
0 commit comments