Skip to content

Commit 5bcce20

Browse files
committed
1 parent 8fcddc1 commit 5bcce20

6 files changed

Lines changed: 188 additions & 31 deletions

File tree

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
const path = require('path');
2-
const { getConfig } = require('react-native-builder-bob/babel-config');
3-
const pkg = require('../package.json');
4-
5-
const root = path.resolve(__dirname, '..');
6-
7-
module.exports = function (api) {
8-
api.cache(true);
9-
10-
return getConfig(
11-
{
12-
presets: ['babel-preset-expo'],
13-
},
14-
{ root, pkg }
15-
);
1+
module.exports = {
2+
presets: ['babel-preset-expo'],
163
};

packages/jsi/example/macos/NativescriptJsi-macOS/AppDelegate.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
2424
- (NSURL *)bundleURL
2525
{
2626
#if DEBUG
27-
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
27+
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@".expo/.virtual-metro-entry"];
2828
#else
2929
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
3030
#endif

packages/jsi/example/macos/NativescriptJsi.xcodeproj/project.pbxproj

Lines changed: 80 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 46;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
1010
3035FDBF9FDE37FE90F2C151 /* libPods-NativescriptJsi-macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 56ACB951E4DBD7FF2C4E44BD /* libPods-NativescriptJsi-macOS.a */; };
11+
5135111C7A48685CFF3273D3 /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5F477BB472D20434A8B470D /* ExpoModulesProvider.swift */; };
1112
5142014D2437B4B30078DB4F /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5142014C2437B4B30078DB4F /* AppDelegate.mm */; };
1213
514201522437B4B40078DB4F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 514201512437B4B40078DB4F /* Assets.xcassets */; };
1314
514201552437B4B40078DB4F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 514201532437B4B40078DB4F /* Main.storyboard */; };
@@ -29,6 +30,7 @@
2930
514201592437B4B40078DB4F /* NativescriptJsi.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NativescriptJsi.entitlements; sourceTree = "<group>"; };
3031
56ACB951E4DBD7FF2C4E44BD /* libPods-NativescriptJsi-macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-NativescriptJsi-macOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
3132
73F6ED21BE44D52AFD144A8A /* Pods-NativescriptJsi-macOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NativescriptJsi-macOS.debug.xcconfig"; path = "Target Support Files/Pods-NativescriptJsi-macOS/Pods-NativescriptJsi-macOS.debug.xcconfig"; sourceTree = "<group>"; };
33+
C5F477BB472D20434A8B470D /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-NativescriptJsi-macOS/ExpoModulesProvider.swift"; sourceTree = "<group>"; };
3234
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
3335
EFC31A54416DA5A3BCE77EAF /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3436
/* End PBXFileReference section */
@@ -70,6 +72,14 @@
7072
name = Frameworks;
7173
sourceTree = "<group>";
7274
};
75+
3D20270F6496E8A3E6E835C2 /* NativescriptJsi-macOS */ = {
76+
isa = PBXGroup;
77+
children = (
78+
C5F477BB472D20434A8B470D /* ExpoModulesProvider.swift */,
79+
);
80+
name = "NativescriptJsi-macOS";
81+
sourceTree = "<group>";
82+
};
7383
5142014A2437B4B30078DB4F /* NativescriptJsi-macOS */ = {
7484
isa = PBXGroup;
7585
children = (
@@ -100,6 +110,7 @@
100110
2D16E6871FA4F8E400B85C8A /* Frameworks */,
101111
EFC31A54416DA5A3BCE77EAF /* PrivacyInfo.xcprivacy */,
102112
036CDA5F0A72FE182000FCC6 /* Pods */,
113+
E08A1FAEC1E6553D61BB6A17 /* ExpoModulesProviders */,
103114
);
104115
indentWidth = 2;
105116
sourceTree = "<group>";
@@ -115,6 +126,14 @@
115126
name = Products;
116127
sourceTree = "<group>";
117128
};
129+
E08A1FAEC1E6553D61BB6A17 /* ExpoModulesProviders */ = {
130+
isa = PBXGroup;
131+
children = (
132+
3D20270F6496E8A3E6E835C2 /* NativescriptJsi-macOS */,
133+
);
134+
name = ExpoModulesProviders;
135+
sourceTree = "<group>";
136+
};
118137
/* End PBXGroup section */
119138

120139
/* Begin PBXNativeTarget section */
@@ -141,6 +160,7 @@
141160
buildConfigurationList = 5142015A2437B4B40078DB4F /* Build configuration list for PBXNativeTarget "NativescriptJsi-macOS" */;
142161
buildPhases = (
143162
1A938104A937498D81B3BD3B /* [CP] Check Pods Manifest.lock */,
163+
25A04C2B46D96419FA49837B /* [Expo] Configure project */,
144164
514201452437B4B30078DB4F /* Sources */,
145165
514201462437B4B30078DB4F /* Frameworks */,
146166
514201472437B4B30078DB4F /* Resources */,
@@ -251,6 +271,29 @@
251271
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
252272
showEnvVarsInLog = 0;
253273
};
274+
25A04C2B46D96419FA49837B /* [Expo] Configure project */ = {
275+
isa = PBXShellScriptBuildPhase;
276+
alwaysOutOfDate = 1;
277+
buildActionMask = 2147483647;
278+
files = (
279+
);
280+
inputFileListPaths = (
281+
);
282+
inputPaths = (
283+
"$(SRCROOT)/.xcode.env",
284+
"$(SRCROOT)/.xcode.env.local",
285+
"$(SRCROOT)/Pods/Target Support Files/Pods-NativescriptJsi-macOS/expo-configure-project.sh",
286+
);
287+
name = "[Expo] Configure project";
288+
outputFileListPaths = (
289+
);
290+
outputPaths = (
291+
"$(SRCROOT)/Pods/Target Support Files/Pods-NativescriptJsi-macOS/ExpoModulesProvider.swift",
292+
);
293+
runOnlyForDeploymentPostprocessing = 0;
294+
shellPath = /bin/sh;
295+
shellScript = "# This script configures Expo modules and generates the modules provider file.\nbash -l -c \"./Pods/Target\\ Support\\ Files/Pods-NativescriptJsi-macOS/expo-configure-project.sh\"\n";
296+
};
254297
381D8A6E24576A4E00465D17 /* Bundle React Native code and images */ = {
255298
isa = PBXShellScriptBuildPhase;
256299
buildActionMask = 2147483647;
@@ -267,7 +310,7 @@
267310
);
268311
runOnlyForDeploymentPostprocessing = 0;
269312
shellPath = /bin/sh;
270-
shellScript = "export NODE_BINARY=node\n../node_modules/react-native-macos/scripts/react-native-xcode.sh\n";
313+
shellScript = "if [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios relative | tail -n 1)\"\nfi\n\nif [[ -z \"$CLI_PATH\" ]]; then\n # Use Expo CLI\n export CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require.resolve('@expo/cli')\")\"\nfi\nif [[ -z \"$BUNDLE_COMMAND\" ]]; then\n # Default Expo CLI command for bundling\n export BUNDLE_COMMAND=\"export:embed\"\nfi\n\n`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"`\n";
271314
};
272315
A26DCE9D9C496513AAB7869B /* [CP] Copy Pods Resources */ = {
273316
isa = PBXShellScriptBuildPhase;
@@ -276,6 +319,9 @@
276319
);
277320
inputPaths = (
278321
"${PODS_ROOT}/Target Support Files/Pods-NativescriptJsi-macOS/Pods-NativescriptJsi-macOS-resources.sh",
322+
"${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/EXConstants.bundle",
323+
"${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/ExpoConstants_privacy.bundle",
324+
"${PODS_CONFIGURATION_BUILD_DIR}/ExpoFileSystem/ExpoFileSystem_privacy.bundle",
279325
"${PODS_CONFIGURATION_BUILD_DIR}/RCT-Folly/RCT-Folly_privacy.bundle",
280326
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/React-Core_privacy.bundle",
281327
"${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact/React-cxxreact_privacy.bundle",
@@ -284,6 +330,9 @@
284330
);
285331
name = "[CP] Copy Pods Resources";
286332
outputPaths = (
333+
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXConstants.bundle",
334+
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoConstants_privacy.bundle",
335+
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoFileSystem_privacy.bundle",
287336
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RCT-Folly_privacy.bundle",
288337
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-Core_privacy.bundle",
289338
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-cxxreact_privacy.bundle",
@@ -329,6 +378,7 @@
329378
files = (
330379
514201582437B4B40078DB4F /* main.m in Sources */,
331380
5142014D2437B4B30078DB4F /* AppDelegate.mm in Sources */,
381+
5135111C7A48685CFF3273D3 /* ExpoModulesProvider.swift in Sources */,
332382
);
333383
runOnlyForDeploymentPostprocessing = 0;
334384
};
@@ -354,12 +404,16 @@
354404
CURRENT_PROJECT_VERSION = 1;
355405
ENABLE_BITCODE = NO;
356406
INFOPLIST_FILE = "NativescriptJsi-iOS/Info.plist";
357-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
407+
LD_RUNPATH_SEARCH_PATHS = (
408+
"$(inherited)",
409+
"@executable_path/Frameworks",
410+
);
358411
OTHER_LDFLAGS = (
359412
"$(inherited)",
360413
"-ObjC",
361414
"-lc++",
362415
);
416+
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
363417
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.$(PRODUCT_NAME:rfc1034identifier)";
364418
PRODUCT_NAME = NativescriptJsi;
365419
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../../node_modules/react-native";
@@ -376,12 +430,16 @@
376430
CLANG_ENABLE_MODULES = YES;
377431
CURRENT_PROJECT_VERSION = 1;
378432
INFOPLIST_FILE = "NativescriptJsi-iOS/Info.plist";
379-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
433+
LD_RUNPATH_SEARCH_PATHS = (
434+
"$(inherited)",
435+
"@executable_path/Frameworks",
436+
);
380437
OTHER_LDFLAGS = (
381438
"$(inherited)",
382439
"-ObjC",
383440
"-lc++",
384441
);
442+
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
385443
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.$(PRODUCT_NAME:rfc1034identifier)";
386444
PRODUCT_NAME = NativescriptJsi;
387445
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../../node_modules/react-native";
@@ -399,13 +457,17 @@
399457
CURRENT_PROJECT_VERSION = 1;
400458
DEAD_CODE_STRIPPING = NO;
401459
INFOPLIST_FILE = "NativescriptJsi-macos/Info.plist";
402-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
460+
LD_RUNPATH_SEARCH_PATHS = (
461+
"$(inherited)",
462+
"@executable_path/Frameworks",
463+
);
403464
MACOSX_DEPLOYMENT_TARGET = 14.0;
404465
OTHER_LDFLAGS = (
405466
"$(inherited)",
406467
"-ObjC",
407468
"-lc++",
408469
);
470+
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
409471
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.$(PRODUCT_NAME:rfc1034identifier)";
410472
PRODUCT_NAME = NativescriptJsi;
411473
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../../node_modules/react-native-macos";
@@ -423,13 +485,17 @@
423485
CLANG_ENABLE_MODULES = YES;
424486
CURRENT_PROJECT_VERSION = 1;
425487
INFOPLIST_FILE = "NativescriptJsi-macos/Info.plist";
426-
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
488+
LD_RUNPATH_SEARCH_PATHS = (
489+
"$(inherited)",
490+
"@executable_path/Frameworks",
491+
);
427492
MACOSX_DEPLOYMENT_TARGET = 14.0;
428493
OTHER_LDFLAGS = (
429494
"$(inherited)",
430495
"-ObjC",
431496
"-lc++",
432497
);
498+
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
433499
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.$(PRODUCT_NAME:rfc1034identifier)";
434500
PRODUCT_NAME = NativescriptJsi;
435501
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../../node_modules/react-native-macos";
@@ -486,7 +552,10 @@
486552
GCC_WARN_UNUSED_FUNCTION = YES;
487553
GCC_WARN_UNUSED_VARIABLE = YES;
488554
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
489-
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
555+
LD_RUNPATH_SEARCH_PATHS = (
556+
/usr/lib/swift,
557+
"$(inherited)",
558+
);
490559
LIBRARY_SEARCH_PATHS = (
491560
"$(SDKROOT)/usr/lib/swift",
492561
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
@@ -542,7 +611,10 @@
542611
GCC_WARN_UNUSED_FUNCTION = YES;
543612
GCC_WARN_UNUSED_VARIABLE = YES;
544613
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
545-
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
614+
LD_RUNPATH_SEARCH_PATHS = (
615+
/usr/lib/swift,
616+
"$(inherited)",
617+
);
546618
LIBRARY_SEARCH_PATHS = (
547619
"$(SDKROOT)/usr/lib/swift",
548620
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",

packages/jsi/example/macos/Podfile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
12
require 'pathname'
23

34
ws_dir = Pathname.new(__dir__)
@@ -10,19 +11,29 @@ prepare_react_native_project!
1011

1112
target 'NativescriptJsi-macOS' do
1213
platform :macos, '14.0'
13-
use_native_modules!
14+
use_expo_modules!
15+
16+
config_command = [
17+
'npx',
18+
'expo-modules-autolinking',
19+
'react-native-config',
20+
'--json',
21+
'--platform',
22+
'ios'
23+
]
24+
config = use_native_modules!(config_command)
1425

1526
# Flags change depending on the env values.
1627
flags = get_default_flags()
1728

1829
use_react_native!(
19-
:path => '../../../../node_modules/react-native-macos',
30+
:path => "#{config[:reactNativePath]}-macos",
2031
:fabric_enabled => ENV['RCT_NEW_ARCH_ENABLED'] == '1',
2132
# An absolute path to your application root.
2233
:app_path => "#{Pod::Config.instance.installation_root}/.."
2334
)
2435

2536
post_install do |installer|
26-
react_native_post_install(installer, '../../../../node_modules/react-native-macos')
37+
react_native_post_install(installer, "#{config[:reactNativePath]}-macos")
2738
end
2839
end

0 commit comments

Comments
 (0)