@callstack/react-native-brownfield 3.0.0-rc.1 → 3.0.0-rc.2
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/ReactBrownfield.podspec +4 -0
- package/ios/BrownfieldBundlePathResolver.swift +21 -0
- package/ios/ExpoHostRuntime.swift +140 -0
- package/ios/JSBundleLoadObserver.swift +38 -0
- package/ios/Notification+Brownfield.swift +12 -0
- package/ios/ReactNativeBrownfield.swift +78 -112
- package/ios/ReactNativeHostRuntime.swift +138 -0
- package/lib/commonjs/expo-config-plugin/android/constants.js +1 -1
- package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js +3 -26
- package/lib/commonjs/expo-config-plugin/ios/podfileHelpers.js.map +1 -1
- package/lib/commonjs/expo-config-plugin/ios/withBrownfieldIos.js +1 -1
- package/lib/commonjs/expo-config-plugin/ios/withBrownfieldIos.js.map +1 -1
- package/lib/commonjs/expo-config-plugin/ios/withIosFrameworkFiles.js +1 -1
- package/lib/commonjs/expo-config-plugin/ios/withIosFrameworkFiles.js.map +1 -1
- package/lib/commonjs/expo-config-plugin/ios/xcodeHelpers.js +1 -1
- package/lib/commonjs/expo-config-plugin/ios/xcodeHelpers.js.map +1 -1
- package/lib/commonjs/expo-config-plugin/template/ios/FrameworkInterface.swift +8 -3
- package/lib/commonjs/expo-config-plugin/template/ios/PodfileTargetBlock.rb +1 -0
- package/lib/commonjs/expo-config-plugin/template/ios/patchExpoPre55.sh +1 -1
- package/lib/commonjs/scripts/brownfield.js +0 -0
- package/lib/module/expo-config-plugin/android/constants.js +1 -1
- package/lib/module/expo-config-plugin/ios/podfileHelpers.js +3 -26
- package/lib/module/expo-config-plugin/ios/podfileHelpers.js.map +1 -1
- package/lib/module/expo-config-plugin/ios/withBrownfieldIos.js +1 -1
- package/lib/module/expo-config-plugin/ios/withBrownfieldIos.js.map +1 -1
- package/lib/module/expo-config-plugin/ios/withIosFrameworkFiles.js +1 -1
- package/lib/module/expo-config-plugin/ios/withIosFrameworkFiles.js.map +1 -1
- package/lib/module/expo-config-plugin/ios/xcodeHelpers.js +1 -1
- package/lib/module/expo-config-plugin/ios/xcodeHelpers.js.map +1 -1
- package/lib/module/expo-config-plugin/template/ios/FrameworkInterface.swift +8 -3
- package/lib/module/expo-config-plugin/template/ios/PodfileTargetBlock.rb +1 -0
- package/lib/module/expo-config-plugin/template/ios/patchExpoPre55.sh +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/android/constants.d.ts +2 -2
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/podfileHelpers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/withBrownfieldIos.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/xcodeHelpers.d.ts +2 -2
- package/lib/typescript/commonjs/src/expo-config-plugin/ios/xcodeHelpers.d.ts.map +1 -1
- package/lib/typescript/module/src/expo-config-plugin/android/constants.d.ts +2 -2
- package/lib/typescript/module/src/expo-config-plugin/ios/podfileHelpers.d.ts.map +1 -1
- package/lib/typescript/module/src/expo-config-plugin/ios/withBrownfieldIos.d.ts.map +1 -1
- package/lib/typescript/module/src/expo-config-plugin/ios/withIosFrameworkFiles.d.ts.map +1 -1
- package/lib/typescript/module/src/expo-config-plugin/ios/xcodeHelpers.d.ts +2 -2
- package/lib/typescript/module/src/expo-config-plugin/ios/xcodeHelpers.d.ts.map +1 -1
- package/package.json +7 -6
- package/scripts/react_native_brownfield_post_integrate.rb +22 -0
- package/src/expo-config-plugin/android/constants.ts +1 -1
- package/src/expo-config-plugin/ios/podfileHelpers.ts +30 -27
- package/src/expo-config-plugin/ios/withBrownfieldIos.ts +1 -2
- package/src/expo-config-plugin/ios/withIosFrameworkFiles.ts +0 -4
- package/src/expo-config-plugin/ios/xcodeHelpers.ts +75 -1
- package/src/expo-config-plugin/template/ios/FrameworkInterface.swift +8 -3
- package/src/expo-config-plugin/template/ios/PodfileTargetBlock.rb +1 -0
- package/src/expo-config-plugin/template/ios/patchExpoPre55.sh +1 -1
- package/CHANGELOG.md +0 -41
- package/lib/commonjs/expo-config-plugin/template/ios/ReactNativeHostManager.swift +0 -63
- package/lib/module/expo-config-plugin/template/ios/ReactNativeHostManager.swift +0 -63
- package/src/expo-config-plugin/template/ios/ReactNativeHostManager.swift +0 -63
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ModProps, type XcodeProject } from '@expo/config-plugins';
|
|
2
2
|
import type { ResolvedBrownfieldPluginIosConfig } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Adds a new Framework target to the Xcode project for Brownfield packaging
|
|
@@ -18,7 +18,7 @@ export declare function addSourceFilesBuildPhase(project: XcodeProject, framewor
|
|
|
18
18
|
* @param targetUuid The UUID of the framework target
|
|
19
19
|
*/
|
|
20
20
|
export declare function copyBundleReactNativePhase(project: XcodeProject, targetUuid: string): void;
|
|
21
|
-
export declare function addExpoPre55ShellPatchScriptPhase(project: XcodeProject, { frameworkName, frameworkTargetUUID, }: {
|
|
21
|
+
export declare function addExpoPre55ShellPatchScriptPhase(modRequest: ModProps<XcodeProject>, project: XcodeProject, { frameworkName, frameworkTargetUUID, }: {
|
|
22
22
|
frameworkName: string;
|
|
23
23
|
frameworkTargetUUID: string;
|
|
24
24
|
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xcodeHelpers.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/xcodeHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"xcodeHelpers.d.ts","sourceRoot":"","sources":["../../../../../../src/expo-config-plugin/ios/xcodeHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAKlE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,EAClC,OAAO,EAAE,iCAAiC,GACzC;IACD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAoIA;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,YAAY,EACrB,mBAAmB,EAAE,MAAM,EAC3B,OAAO,EAAE,iCAAiC,QAkB3C;AAgDD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,GACjB,IAAI,CAmDN;AA4DD,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,EAClC,OAAO,EAAE,YAAY,EACrB,EACE,aAAa,EACb,mBAAmB,GACpB,EAAE;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,QA2BF;AAED;;;;;;GAMG;AACH,wBAAgB,6CAA6C,CAC3D,OAAO,EAAE,YAAY,EACrB,mBAAmB,EAAE,MAAM,WAmC5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@callstack/react-native-brownfield",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Michal Chudziak <mike.chudziak@callstack.com>",
|
|
6
6
|
"bin": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"homepage": "https://github.com/callstack/react-native-brownfield",
|
|
13
13
|
"repository": {
|
|
14
|
-
"url": "https://github.com/callstack/react-native-brownfield"
|
|
14
|
+
"url": "git+https://github.com/callstack/react-native-brownfield.git"
|
|
15
15
|
},
|
|
16
16
|
"description": "Brownfield helpers for React Native",
|
|
17
17
|
"main": "lib/commonjs/index",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"files": [
|
|
62
62
|
"src",
|
|
63
63
|
"lib",
|
|
64
|
+
"scripts",
|
|
64
65
|
"android",
|
|
65
66
|
"ios",
|
|
66
67
|
"cpp",
|
|
@@ -81,16 +82,16 @@
|
|
|
81
82
|
"access": "public"
|
|
82
83
|
},
|
|
83
84
|
"peerDependencies": {
|
|
84
|
-
"
|
|
85
|
-
"react-native": "*"
|
|
85
|
+
"@expo/config-plugins": "^54.0.4"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@callstack/brownfield-cli": "
|
|
88
|
+
"@callstack/brownfield-cli": "workspace:^"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@babel/core": "^7.25.2",
|
|
92
92
|
"@babel/preset-env": "^7.25.3",
|
|
93
93
|
"@babel/runtime": "^7.25.0",
|
|
94
|
+
"@expo/config-plugins": "^54.0.4",
|
|
94
95
|
"@react-native/babel-preset": "0.82.1",
|
|
95
96
|
"@types/jest": "^30.0.0",
|
|
96
97
|
"@types/react": "^19.1.1",
|
|
@@ -114,4 +115,4 @@
|
|
|
114
115
|
"engines": {
|
|
115
116
|
"node": ">=20"
|
|
116
117
|
}
|
|
117
|
-
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
def react_native_brownfield_post_integrate(installer)
|
|
2
|
+
projects = installer.aggregate_targets.map(&:user_project).compact.uniq
|
|
3
|
+
projects.each do |project|
|
|
4
|
+
modified = false
|
|
5
|
+
|
|
6
|
+
project.native_targets.each do |target|
|
|
7
|
+
phases = target.build_phases
|
|
8
|
+
expo_idx = phases.index { |p| p.respond_to?(:name) && p.name == '[Expo] Configure project' }
|
|
9
|
+
patch_idx = phases.index { |p| p.respond_to?(:name) && p.name == 'Patch ExpoModulesProvider' }
|
|
10
|
+
|
|
11
|
+
next if expo_idx.nil? || patch_idx.nil?
|
|
12
|
+
next if patch_idx > expo_idx
|
|
13
|
+
|
|
14
|
+
patch = phases.delete_at(patch_idx)
|
|
15
|
+
expo_idx = phases.index { |p| p.respond_to?(:name) && p.name == '[Expo] Configure project' }
|
|
16
|
+
phases.insert(expo_idx + 1, patch)
|
|
17
|
+
modified = true
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
project.save if modified
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const BROWNFIELD_PLUGIN_VERSION = '0.
|
|
1
|
+
export const BROWNFIELD_PLUGIN_VERSION = '1.0.0';
|
|
2
2
|
export const brownfieldGradlePluginDependency = `classpath("com.callstack.react:brownfield-gradle-plugin:${BROWNFIELD_PLUGIN_VERSION}")`;
|
|
@@ -6,44 +6,47 @@ const BROWNFIELD_POD_HOOK_MARKER_START =
|
|
|
6
6
|
'# >>> react-native-brownfield expo phase ordering >>>';
|
|
7
7
|
const BROWNFIELD_POD_HOOK_MARKER_END =
|
|
8
8
|
'# <<< react-native-brownfield expo phase ordering <<<';
|
|
9
|
+
const BROWNFIELD_POST_INTEGRATE_REQUIRE = `require File.join(File.dirname(\`node --print "require.resolve('@callstack/react-native-brownfield/package.json')"\`), "scripts/react_native_brownfield_post_integrate")`;
|
|
10
|
+
const REACT_NATIVE_PODS_REQUIRE_REGEX =
|
|
11
|
+
/^require File\.join\(File\.dirname\(`node --print "require\.resolve\('react-native\/package\.json'\)"`\), "scripts\/react_native_pods"\)\s*$/m;
|
|
9
12
|
|
|
10
|
-
function
|
|
11
|
-
if (podfile.includes(
|
|
13
|
+
function ensureBrownfieldPostIntegrateRequire(podfile: string): string {
|
|
14
|
+
if (podfile.includes('scripts/react_native_brownfield_post_integrate')) {
|
|
12
15
|
return podfile;
|
|
13
16
|
}
|
|
14
17
|
|
|
18
|
+
const reactNativePodsRequireMatch = podfile.match(
|
|
19
|
+
REACT_NATIVE_PODS_REQUIRE_REGEX
|
|
20
|
+
);
|
|
21
|
+
if (reactNativePodsRequireMatch) {
|
|
22
|
+
const requireLine = reactNativePodsRequireMatch[0];
|
|
23
|
+
return podfile.replace(
|
|
24
|
+
requireLine,
|
|
25
|
+
`${requireLine}\n${BROWNFIELD_POST_INTEGRATE_REQUIRE}\n`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return `${BROWNFIELD_POST_INTEGRATE_REQUIRE}\n\n${podfile}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function ensureExpoPhaseOrderingHook(podfile: string): string {
|
|
33
|
+
let modifiedPodfile = ensureBrownfieldPostIntegrateRequire(podfile);
|
|
34
|
+
|
|
35
|
+
if (modifiedPodfile.includes(BROWNFIELD_POD_HOOK_MARKER_START)) {
|
|
36
|
+
return modifiedPodfile;
|
|
37
|
+
}
|
|
38
|
+
|
|
15
39
|
const hook = `
|
|
16
40
|
${BROWNFIELD_POD_HOOK_MARKER_START}
|
|
17
|
-
def reorder_brownfield_expo_patch_phase!(installer)
|
|
18
|
-
projects = installer.aggregate_targets.map(&:user_project).compact.uniq
|
|
19
|
-
projects.each do |project|
|
|
20
|
-
modified = false
|
|
21
|
-
|
|
22
|
-
project.native_targets.each do |target|
|
|
23
|
-
phases = target.build_phases
|
|
24
|
-
expo_idx = phases.index { |p| p.respond_to?(:name) && p.name == '[Expo] Configure project' }
|
|
25
|
-
patch_idx = phases.index { |p| p.respond_to?(:name) && p.name == 'Patch ExpoModulesProvider' }
|
|
26
|
-
|
|
27
|
-
next if expo_idx.nil? || patch_idx.nil?
|
|
28
|
-
next if patch_idx > expo_idx
|
|
29
|
-
|
|
30
|
-
patch = phases.delete_at(patch_idx)
|
|
31
|
-
expo_idx = phases.index { |p| p.respond_to?(:name) && p.name == '[Expo] Configure project' }
|
|
32
|
-
phases.insert(expo_idx + 1, patch)
|
|
33
|
-
modified = true
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
project.save if modified
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
41
|
post_integrate do |installer|
|
|
41
|
-
|
|
42
|
+
react_native_brownfield_post_integrate(installer)
|
|
42
43
|
end
|
|
43
44
|
${BROWNFIELD_POD_HOOK_MARKER_END}
|
|
44
45
|
`;
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
modifiedPodfile = `${modifiedPodfile.trimEnd()}\n\n${hook}\n`;
|
|
48
|
+
|
|
49
|
+
return modifiedPodfile;
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
/**
|
|
@@ -32,7 +32,6 @@ export const withBrownfieldIos: ConfigPlugin<
|
|
|
32
32
|
? parseInt(config.sdkVersion.split('.')[0], 10)
|
|
33
33
|
: -1;
|
|
34
34
|
const isExpoPre55 = expoMajor < 55;
|
|
35
|
-
|
|
36
35
|
// Step 1: modify the Xcode project to add framework target &
|
|
37
36
|
config = withXcodeProject(config, (xcodeConfig) => {
|
|
38
37
|
const { modResults: project, modRequest } = xcodeConfig;
|
|
@@ -60,7 +59,7 @@ export const withBrownfieldIos: ConfigPlugin<
|
|
|
60
59
|
`Adding ExpoModulesProvider patch phase for Expo SDK ${config.sdkVersion}`
|
|
61
60
|
);
|
|
62
61
|
|
|
63
|
-
addExpoPre55ShellPatchScriptPhase(project, {
|
|
62
|
+
addExpoPre55ShellPatchScriptPhase(modRequest, project, {
|
|
64
63
|
frameworkName: props.ios.frameworkName,
|
|
65
64
|
frameworkTargetUUID: frameworkTargetUUID,
|
|
66
65
|
});
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import {
|
|
4
|
+
type ModProps,
|
|
5
|
+
type XcodeProject,
|
|
6
|
+
IOSConfig,
|
|
7
|
+
} from '@expo/config-plugins';
|
|
4
8
|
|
|
5
9
|
import { Logger } from '../logging';
|
|
6
10
|
import type { ResolvedBrownfieldPluginIosConfig } from '../types';
|
|
@@ -286,7 +290,66 @@ export function copyBundleReactNativePhase(
|
|
|
286
290
|
}
|
|
287
291
|
}
|
|
288
292
|
|
|
293
|
+
function resolveAppTargetName(
|
|
294
|
+
project: XcodeProject,
|
|
295
|
+
modRequest: ModProps<XcodeProject>
|
|
296
|
+
): string | null {
|
|
297
|
+
const appTargets = IOSConfig.Target.getNativeTargets(project)
|
|
298
|
+
.map(([, target]) => {
|
|
299
|
+
if (
|
|
300
|
+
!IOSConfig.Target.isTargetOfType(
|
|
301
|
+
target,
|
|
302
|
+
IOSConfig.Target.TargetType.APPLICATION
|
|
303
|
+
)
|
|
304
|
+
) {
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const name = IOSConfig.XcodeUtils.unquote(target.name ?? '').trim();
|
|
309
|
+
|
|
310
|
+
return name ?? null;
|
|
311
|
+
})
|
|
312
|
+
.filter((name): name is string => !!name);
|
|
313
|
+
|
|
314
|
+
// 1) Unambiguous first application-type target
|
|
315
|
+
if (appTargets.length === 1) {
|
|
316
|
+
return appTargets[0];
|
|
317
|
+
} else {
|
|
318
|
+
Logger.logWarning(
|
|
319
|
+
'Multiple application targets found in the Xcode project. Falling back to the CNG-derived name from mod compiler.'
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// 2) CNG-derived name from mod compiler (`modRequest.projectName`) - only if it exists in the filtered application-type list of Xcode project targets
|
|
324
|
+
const cngDerivedProjectName = modRequest.projectName;
|
|
325
|
+
if (cngDerivedProjectName && appTargets.includes(cngDerivedProjectName)) {
|
|
326
|
+
return cngDerivedProjectName;
|
|
327
|
+
} else {
|
|
328
|
+
Logger.logWarning(
|
|
329
|
+
'CNG-derived name from mod compiler is not set or is not an application target. Falling back to the unfiltered-type target name.'
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// 3) PBX "first native target" fallback
|
|
334
|
+
try {
|
|
335
|
+
const [, firstAppTarget] = IOSConfig.Target.findFirstNativeTarget(project);
|
|
336
|
+
const name = IOSConfig.XcodeUtils.unquote(firstAppTarget.name ?? '').trim();
|
|
337
|
+
return name || null;
|
|
338
|
+
} catch {
|
|
339
|
+
Logger.logWarning(
|
|
340
|
+
'No first native target of any type found in the Xcode project. This was the last resort fallback.'
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
Logger.logError(
|
|
345
|
+
`Could not determine the iOS app target name from the Xcode project. Please adjust your Xcode project to have exactly one application target.`
|
|
346
|
+
);
|
|
347
|
+
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
|
|
289
351
|
export function addExpoPre55ShellPatchScriptPhase(
|
|
352
|
+
modRequest: ModProps<XcodeProject>,
|
|
290
353
|
project: XcodeProject,
|
|
291
354
|
{
|
|
292
355
|
frameworkName,
|
|
@@ -296,6 +359,16 @@ export function addExpoPre55ShellPatchScriptPhase(
|
|
|
296
359
|
frameworkTargetUUID: string;
|
|
297
360
|
}
|
|
298
361
|
) {
|
|
362
|
+
const resolvedAppTargetName = resolveAppTargetName(project, modRequest);
|
|
363
|
+
|
|
364
|
+
Logger.logInfo(`Resolved iOS app target name: ${resolvedAppTargetName}`);
|
|
365
|
+
|
|
366
|
+
if (!resolvedAppTargetName) {
|
|
367
|
+
throw new SourceModificationError(
|
|
368
|
+
`Could not determine the iOS app target name from the Xcode project.`
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
|
|
299
372
|
project.addBuildPhase(
|
|
300
373
|
[
|
|
301
374
|
// no associated files
|
|
@@ -306,6 +379,7 @@ export function addExpoPre55ShellPatchScriptPhase(
|
|
|
306
379
|
{
|
|
307
380
|
shellPath: '/bin/sh',
|
|
308
381
|
shellScript: renderTemplate('ios', 'patchExpoPre55.sh', {
|
|
382
|
+
'{{APP_TARGET_NAME}}': resolvedAppTargetName,
|
|
309
383
|
'{{FRAMEWORK_NAME}}': frameworkName,
|
|
310
384
|
}),
|
|
311
385
|
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
@_exported import Brownie
|
|
1
|
+
import Foundation
|
|
2
|
+
import ReactBrownfield
|
|
4
3
|
|
|
5
4
|
// Initializes a Bundle instance that points at the framework target.
|
|
6
5
|
public let ReactNativeBundle = Bundle(for: InternalClassForBundle.self)
|
|
7
6
|
|
|
8
7
|
class InternalClassForBundle {}
|
|
8
|
+
|
|
9
|
+
extension ReactNativeBrownfield {
|
|
10
|
+
public func ensureExpoModulesProvider() {
|
|
11
|
+
let _ = ExpoModulesProvider()
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Patch by @hurali97, source: https://github.com/callstackincubator/rock/issues/492#issuecomment-3225109837
|
|
2
2
|
# Applicable only to Expo SDK versions prior to 55, which made ExpoModulesProvider internal by default: https://github.com/expo/expo/pull/42317
|
|
3
3
|
# Path to ExpoModulesProvider.swift
|
|
4
|
-
FILE="${SRCROOT}/Pods/Target Support Files/Pods-
|
|
4
|
+
FILE="${SRCROOT}/Pods/Target Support Files/Pods-{{APP_TARGET_NAME}}-{{FRAMEWORK_NAME}}/ExpoModulesProvider.swift"
|
|
5
5
|
|
|
6
6
|
if [ -f "$FILE" ]; then
|
|
7
7
|
echo "Patching $FILE to hide Expo from public interface"
|
package/CHANGELOG.md
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# @callstack/react-native-brownfield
|
|
2
|
-
|
|
3
|
-
## 2.2.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- [#212](https://github.com/callstack/react-native-brownfield/pull/212) [`4728945`](https://github.com/callstack/react-native-brownfield/commit/47289457b9bdbe50cf3c65a78c7f1d9d555dca9c) Thanks [@gronxb](https://github.com/gronxb)! - feat(ios): add bundleURL provider for dynamic bundle loading
|
|
8
|
-
|
|
9
|
-
### Patch Changes
|
|
10
|
-
|
|
11
|
-
- [#216](https://github.com/callstack/react-native-brownfield/pull/216) [`8ce3ea1`](https://github.com/callstack/react-native-brownfield/commit/8ce3ea10e0719adac7396dea8f171753e901b31d) Thanks [@thymikee](https://github.com/thymikee)! - chore: remove release-it
|
|
12
|
-
|
|
13
|
-
- Updated dependencies [[`8ce3ea1`](https://github.com/callstack/react-native-brownfield/commit/8ce3ea10e0719adac7396dea8f171753e901b31d)]:
|
|
14
|
-
- @callstack/brownfield-cli@1.0.4
|
|
15
|
-
|
|
16
|
-
## 2.1.1
|
|
17
|
-
|
|
18
|
-
### Patch Changes
|
|
19
|
-
|
|
20
|
-
- Updated dependencies [[`2347775`](https://github.com/callstack/react-native-brownfield/commit/23477753b16ee189b82c1aee3eac98a56c79f52a)]:
|
|
21
|
-
- @callstack/brownfield-cli@1.0.3
|
|
22
|
-
|
|
23
|
-
## 2.1.0
|
|
24
|
-
|
|
25
|
-
### Minor Changes
|
|
26
|
-
|
|
27
|
-
- [#207](https://github.com/callstack/react-native-brownfield/pull/207) [`feb7ed2`](https://github.com/callstack/react-native-brownfield/commit/feb7ed2e821112576ec89d6eb17e8ea411aeaa02) Thanks [@artus9033](https://github.com/artus9033)! - feat(android): allow bundle file path
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- Updated dependencies [[`2a8563f`](https://github.com/callstack/react-native-brownfield/commit/2a8563f65ed152054ad1290caf963791a368ee9a)]:
|
|
32
|
-
- @callstack/brownfield-cli@1.0.2
|
|
33
|
-
|
|
34
|
-
## 2.0.2
|
|
35
|
-
|
|
36
|
-
### Patch Changes
|
|
37
|
-
|
|
38
|
-
- [#198](https://github.com/callstack/react-native-brownfield/pull/198) [`c8c903d`](https://github.com/callstack/react-native-brownfield/commit/c8c903d0d2b78a8c06a41213dfbe781a2daf3d25) Thanks [@artus9033](https://github.com/artus9033)! - docs: added README files to all packages
|
|
39
|
-
|
|
40
|
-
- Updated dependencies [[`c8c903d`](https://github.com/callstack/react-native-brownfield/commit/c8c903d0d2b78a8c06a41213dfbe781a2daf3d25)]:
|
|
41
|
-
- @callstack/brownfield-cli@1.0.1
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
internal import Expo
|
|
2
|
-
internal import React
|
|
3
|
-
internal import ReactAppDependencyProvider
|
|
4
|
-
internal import React_RCTAppDelegate
|
|
5
|
-
import UIKit
|
|
6
|
-
|
|
7
|
-
public class ReactNativeHostManager {
|
|
8
|
-
public static let shared = ReactNativeHostManager()
|
|
9
|
-
|
|
10
|
-
private var reactNativeDelegate: ExpoReactNativeFactoryDelegate?
|
|
11
|
-
private var reactNativeFactory: RCTReactNativeFactory?
|
|
12
|
-
private var expoDelegate: ExpoAppDelegate?
|
|
13
|
-
|
|
14
|
-
public func initialize() {
|
|
15
|
-
let delegate = ReactNativeDelegate()
|
|
16
|
-
let factory = ExpoReactNativeFactory(delegate: delegate)
|
|
17
|
-
delegate.dependencyProvider = RCTAppDependencyProvider()
|
|
18
|
-
|
|
19
|
-
reactNativeDelegate = delegate
|
|
20
|
-
reactNativeFactory = factory
|
|
21
|
-
|
|
22
|
-
expoDelegate = ExpoAppDelegate()
|
|
23
|
-
expoDelegate?.bindReactNativeFactory(factory)
|
|
24
|
-
|
|
25
|
-
// required to avoid this being file be stripped by the swift compiler
|
|
26
|
-
let _ = ExpoModulesProvider()
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// propagate delegate methods to ExpoAppDelegate
|
|
30
|
-
public func application(
|
|
31
|
-
_ application: UIApplication,
|
|
32
|
-
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
|
|
33
|
-
) -> Bool {
|
|
34
|
-
((expoDelegate?.application(application, didFinishLaunchingWithOptions: launchOptions)) != nil)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// load & present RN UI
|
|
38
|
-
public func loadView(
|
|
39
|
-
moduleName: String, initialProps: [AnyHashable: Any]?,
|
|
40
|
-
launchOptions: [AnyHashable: Any]?
|
|
41
|
-
) -> UIView {
|
|
42
|
-
let bundleURL = reactNativeDelegate?.bundleURL()
|
|
43
|
-
return (expoDelegate?.recreateRootView(
|
|
44
|
-
withBundleURL: bundleURL, moduleName: moduleName, initialProps: initialProps,
|
|
45
|
-
launchOptions: launchOptions))!
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
class ReactNativeDelegate: ExpoReactNativeFactoryDelegate {
|
|
50
|
-
override func sourceURL(for bridge: RCTBridge) -> URL? {
|
|
51
|
-
// needed to return the correct URL for expo-dev-client.
|
|
52
|
-
bridge.bundleURL ?? bundleURL()
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
override func bundleURL() -> URL? {
|
|
56
|
-
#if DEBUG
|
|
57
|
-
return RCTBundleURLProvider.sharedSettings().jsBundleURL(
|
|
58
|
-
forBundleRoot: ".expo/.virtual-metro-entry")
|
|
59
|
-
#else
|
|
60
|
-
return ReactNativeBundle.url(forResource: "main", withExtension: "jsbundle")
|
|
61
|
-
#endif
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
internal import Expo
|
|
2
|
-
internal import React
|
|
3
|
-
internal import ReactAppDependencyProvider
|
|
4
|
-
internal import React_RCTAppDelegate
|
|
5
|
-
import UIKit
|
|
6
|
-
|
|
7
|
-
public class ReactNativeHostManager {
|
|
8
|
-
public static let shared = ReactNativeHostManager()
|
|
9
|
-
|
|
10
|
-
private var reactNativeDelegate: ExpoReactNativeFactoryDelegate?
|
|
11
|
-
private var reactNativeFactory: RCTReactNativeFactory?
|
|
12
|
-
private var expoDelegate: ExpoAppDelegate?
|
|
13
|
-
|
|
14
|
-
public func initialize() {
|
|
15
|
-
let delegate = ReactNativeDelegate()
|
|
16
|
-
let factory = ExpoReactNativeFactory(delegate: delegate)
|
|
17
|
-
delegate.dependencyProvider = RCTAppDependencyProvider()
|
|
18
|
-
|
|
19
|
-
reactNativeDelegate = delegate
|
|
20
|
-
reactNativeFactory = factory
|
|
21
|
-
|
|
22
|
-
expoDelegate = ExpoAppDelegate()
|
|
23
|
-
expoDelegate?.bindReactNativeFactory(factory)
|
|
24
|
-
|
|
25
|
-
// required to avoid this being file be stripped by the swift compiler
|
|
26
|
-
let _ = ExpoModulesProvider()
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// propagate delegate methods to ExpoAppDelegate
|
|
30
|
-
public func application(
|
|
31
|
-
_ application: UIApplication,
|
|
32
|
-
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
|
|
33
|
-
) -> Bool {
|
|
34
|
-
((expoDelegate?.application(application, didFinishLaunchingWithOptions: launchOptions)) != nil)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// load & present RN UI
|
|
38
|
-
public func loadView(
|
|
39
|
-
moduleName: String, initialProps: [AnyHashable: Any]?,
|
|
40
|
-
launchOptions: [AnyHashable: Any]?
|
|
41
|
-
) -> UIView {
|
|
42
|
-
let bundleURL = reactNativeDelegate?.bundleURL()
|
|
43
|
-
return (expoDelegate?.recreateRootView(
|
|
44
|
-
withBundleURL: bundleURL, moduleName: moduleName, initialProps: initialProps,
|
|
45
|
-
launchOptions: launchOptions))!
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
class ReactNativeDelegate: ExpoReactNativeFactoryDelegate {
|
|
50
|
-
override func sourceURL(for bridge: RCTBridge) -> URL? {
|
|
51
|
-
// needed to return the correct URL for expo-dev-client.
|
|
52
|
-
bridge.bundleURL ?? bundleURL()
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
override func bundleURL() -> URL? {
|
|
56
|
-
#if DEBUG
|
|
57
|
-
return RCTBundleURLProvider.sharedSettings().jsBundleURL(
|
|
58
|
-
forBundleRoot: ".expo/.virtual-metro-entry")
|
|
59
|
-
#else
|
|
60
|
-
return ReactNativeBundle.url(forResource: "main", withExtension: "jsbundle")
|
|
61
|
-
#endif
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
internal import Expo
|
|
2
|
-
internal import React
|
|
3
|
-
internal import ReactAppDependencyProvider
|
|
4
|
-
internal import React_RCTAppDelegate
|
|
5
|
-
import UIKit
|
|
6
|
-
|
|
7
|
-
public class ReactNativeHostManager {
|
|
8
|
-
public static let shared = ReactNativeHostManager()
|
|
9
|
-
|
|
10
|
-
private var reactNativeDelegate: ExpoReactNativeFactoryDelegate?
|
|
11
|
-
private var reactNativeFactory: RCTReactNativeFactory?
|
|
12
|
-
private var expoDelegate: ExpoAppDelegate?
|
|
13
|
-
|
|
14
|
-
public func initialize() {
|
|
15
|
-
let delegate = ReactNativeDelegate()
|
|
16
|
-
let factory = ExpoReactNativeFactory(delegate: delegate)
|
|
17
|
-
delegate.dependencyProvider = RCTAppDependencyProvider()
|
|
18
|
-
|
|
19
|
-
reactNativeDelegate = delegate
|
|
20
|
-
reactNativeFactory = factory
|
|
21
|
-
|
|
22
|
-
expoDelegate = ExpoAppDelegate()
|
|
23
|
-
expoDelegate?.bindReactNativeFactory(factory)
|
|
24
|
-
|
|
25
|
-
// required to avoid this being file be stripped by the swift compiler
|
|
26
|
-
let _ = ExpoModulesProvider()
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// propagate delegate methods to ExpoAppDelegate
|
|
30
|
-
public func application(
|
|
31
|
-
_ application: UIApplication,
|
|
32
|
-
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
|
|
33
|
-
) -> Bool {
|
|
34
|
-
((expoDelegate?.application(application, didFinishLaunchingWithOptions: launchOptions)) != nil)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// load & present RN UI
|
|
38
|
-
public func loadView(
|
|
39
|
-
moduleName: String, initialProps: [AnyHashable: Any]?,
|
|
40
|
-
launchOptions: [AnyHashable: Any]?
|
|
41
|
-
) -> UIView {
|
|
42
|
-
let bundleURL = reactNativeDelegate?.bundleURL()
|
|
43
|
-
return (expoDelegate?.recreateRootView(
|
|
44
|
-
withBundleURL: bundleURL, moduleName: moduleName, initialProps: initialProps,
|
|
45
|
-
launchOptions: launchOptions))!
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
class ReactNativeDelegate: ExpoReactNativeFactoryDelegate {
|
|
50
|
-
override func sourceURL(for bridge: RCTBridge) -> URL? {
|
|
51
|
-
// needed to return the correct URL for expo-dev-client.
|
|
52
|
-
bridge.bundleURL ?? bundleURL()
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
override func bundleURL() -> URL? {
|
|
56
|
-
#if DEBUG
|
|
57
|
-
return RCTBundleURLProvider.sharedSettings().jsBundleURL(
|
|
58
|
-
forBundleRoot: ".expo/.virtual-metro-entry")
|
|
59
|
-
#else
|
|
60
|
-
return ReactNativeBundle.url(forResource: "main", withExtension: "jsbundle")
|
|
61
|
-
#endif
|
|
62
|
-
}
|
|
63
|
-
}
|