react-native-macos 0.76.11 → 0.76.12

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.
Files changed (53) hide show
  1. package/Libraries/Blob/RCTBlobManager.h +0 -0
  2. package/Libraries/Blob/RCTBlobManager.mm +0 -0
  3. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +0 -0
  4. package/Libraries/Core/ReactNativeVersion.js +1 -1
  5. package/Libraries/StyleSheet/normalizeColor.js +0 -0
  6. package/React/Base/RCTJavaScriptLoader.h +0 -0
  7. package/React/Base/RCTJavaScriptLoader.mm +0 -0
  8. package/React/Base/RCTVersion.m +1 -1
  9. package/ReactAndroid/gradle.properties +1 -1
  10. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  11. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  12. package/local-cli/cli.js +0 -0
  13. package/package.json +3 -3
  14. package/scripts/cocoapods/autolinking.rb +206 -0
  15. package/scripts/cocoapods/autolinking_utils.rb +25 -0
  16. package/scripts/cocoapods/codegen.rb +59 -0
  17. package/scripts/cocoapods/codegen_script_phase_extractor.rb +13 -0
  18. package/scripts/cocoapods/codegen_utils.rb +363 -0
  19. package/scripts/cocoapods/fabric.rb +18 -0
  20. package/scripts/cocoapods/helpers.rb +148 -0
  21. package/scripts/cocoapods/jsengine.rb +33 -0
  22. package/scripts/cocoapods/local_podspec_patch.rb +51 -0
  23. package/scripts/cocoapods/new_architecture.rb +193 -0
  24. package/scripts/cocoapods/privacy_manifest_utils.rb +194 -0
  25. package/scripts/cocoapods/runtime.rb +18 -0
  26. package/scripts/cocoapods/spm.rb +94 -0
  27. package/scripts/cocoapods/utils.rb +729 -0
  28. package/scripts/codegen/codegen-utils.js +51 -0
  29. package/scripts/codegen/generate-artifacts-executor.js +815 -0
  30. package/scripts/codegen/generate-specs-cli-executor.js +128 -0
  31. package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderH.template +18 -0
  32. package/scripts/codegen/templates/RCTModulesConformingToProtocolsProviderMM.template +33 -0
  33. package/scripts/compose-source-maps.js +0 -0
  34. package/scripts/ios-configure-glog.sh +0 -0
  35. package/scripts/node-binary.sh +0 -0
  36. package/scripts/packager.sh +0 -0
  37. package/scripts/react-native-xcode.sh +0 -0
  38. package/scripts/react_native_pods_utils/script_phases.sh +0 -0
  39. package/scripts/xcode/ccache-clang++.sh +0 -0
  40. package/scripts/xcode/ccache-clang.sh +0 -0
  41. package/scripts/xcode/with-environment.sh +0 -0
  42. package/sdks/hermes-engine/hermes-engine.podspec +160 -0
  43. package/sdks/hermes-engine/hermes-utils.rb +337 -0
  44. package/sdks/hermes-engine/utils/build-apple-framework.sh +225 -0
  45. package/sdks/hermes-engine/utils/build-hermes-xcode.sh +100 -0
  46. package/sdks/hermes-engine/utils/build-hermesc-xcode.sh +18 -0
  47. package/sdks/hermes-engine/utils/build-ios-framework.sh +85 -0
  48. package/sdks/hermes-engine/utils/build-mac-framework.sh +22 -0
  49. package/sdks/hermes-engine/utils/copy-hermes-xcode.sh +7 -0
  50. package/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh +32 -0
  51. package/sdks/hermes-engine/utils/replace_hermes_version.js +106 -0
  52. package/scripts/featureflags/README.md +0 -156
  53. package/scripts/featureflags/index.js +0 -14
@@ -0,0 +1,85 @@
1
+ #!/bin/bash
2
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ #
4
+ # This source code is licensed under the MIT license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ if [ "$CI" ]; then
8
+ set -x
9
+ fi
10
+ set -e
11
+
12
+ # Given a specific target, retrieve the right architecture for it
13
+ # $1 the target you want to build. Allowed values: iphoneos, iphonesimulator, catalyst, xros, xrsimulator
14
+ function get_architecture {
15
+ if [[ $1 == "iphoneos" || $1 == "xros" ]]; then
16
+ echo "arm64"
17
+ elif [[ $1 == "iphonesimulator" || $1 == "xrsimulator" ]]; then
18
+ echo "x86_64;arm64"
19
+ elif [[ $1 == "catalyst" ]]; then
20
+ echo "x86_64;arm64"
21
+ else
22
+ echo "Error: unknown architecture passed $1"
23
+ exit 1
24
+ fi
25
+ }
26
+
27
+ function get_deployment_target {
28
+ if [[ $1 == "xros" || $1 == "xrsimulator" ]]; then
29
+ echo "$(get_visionos_deployment_target)"
30
+ else
31
+ echo "$(get_ios_deployment_target)"
32
+ fi
33
+ }
34
+
35
+ # build a single framework
36
+ # $1 is the target to build
37
+ function build_framework {
38
+ if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
39
+ deployment_target=$(get_deployment_target "$1")
40
+
41
+ architecture=$(get_architecture "$1")
42
+
43
+ build_apple_framework "$1" "$architecture" "$deployment_target"
44
+ else
45
+ echo "Skipping; Clean \"destroot\" to rebuild".
46
+ fi
47
+ }
48
+
49
+ # group the frameworks together to create a universal framework
50
+ function build_universal_framework {
51
+ if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
52
+ create_universal_framework "iphoneos" "iphonesimulator" "catalyst" "xros" "xrsimulator"
53
+ else
54
+ echo "Skipping; Clean \"destroot\" to rebuild".
55
+ fi
56
+ }
57
+
58
+ # single function that builds sequentially iphoneos, iphonesimulator and catalyst
59
+ # this is used to preserve backward compatibility
60
+ function create_framework {
61
+ if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
62
+ build_framework "iphoneos"
63
+ build_framework "iphonesimulator"
64
+ build_framework "catalyst"
65
+ build_framework "xros"
66
+ build_framework "xrsimulator"
67
+
68
+ build_universal_framework
69
+ else
70
+ echo "Skipping; Clean \"destroot\" to rebuild".
71
+ fi
72
+ }
73
+
74
+
75
+ CURR_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
76
+ # shellcheck source=xplat/js/react-native-github/sdks/hermes-engine/utils/build-apple-framework.sh
77
+ . "${CURR_SCRIPT_DIR}/build-apple-framework.sh"
78
+
79
+ if [[ -z $1 ]]; then
80
+ create_framework
81
+ elif [[ $1 == "build_framework" ]]; then
82
+ build_universal_framework
83
+ else
84
+ build_framework "$1"
85
+ fi
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ #
4
+ # This source code is licensed under the MIT license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ if [ "$CI" ]; then
8
+ set -x
9
+ fi
10
+ set -e
11
+
12
+ # shellcheck source=xplat/js/react-native-github/sdks/hermes-engine/utils/build-apple-framework.sh
13
+ CURR_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
14
+ . "${CURR_SCRIPT_DIR}/build-apple-framework.sh"
15
+
16
+ if [ ! -d destroot/Library/Frameworks/macosx/hermes.framework ]; then
17
+ mac_deployment_target=$(get_mac_deployment_target)
18
+
19
+ build_apple_framework "macosx" "x86_64;arm64" "$mac_deployment_target"
20
+ else
21
+ echo "Skipping; Clean \"destroot\" to rebuild".
22
+ fi
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ #
4
+ # This source code is licensed under the MIT license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ echo "This file is no-op now. Remove \"[RN] Copy Hermes Framework\" script phase from your main target if you don't want to see this message."
@@ -0,0 +1,32 @@
1
+ #!/bin/bash
2
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ #
4
+ # This source code is licensed under the MIT license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ set -x
8
+
9
+ # CocoaPods requires vendored frameworks to exist before `pod install` is run,
10
+ # and to be proper Moch-O binaries in order to auto-link them to the user's Xcode project.
11
+ # This script creates dummy hermes.framework for macosx and ios.
12
+ # They are then get rewritten by `build-hermes-xcode.sh` during Xcode build.
13
+
14
+ rm -rf destroot
15
+
16
+ mkdir -p destroot/Library/Frameworks
17
+
18
+ pushd destroot/Library/Frameworks > /dev/null || exit 1
19
+
20
+ echo '' > dummy.c
21
+
22
+ platforms=( "macosx" "ios" "xros" ) # Add other platforms here if needed
23
+
24
+ for platform in "${platforms[@]}"
25
+ do
26
+ mkdir -p "${platform}/hermes.framework"
27
+ clang dummy.c -dynamiclib -o "${platform}/hermes.framework/hermes"
28
+ done
29
+
30
+ rm dummy.c
31
+
32
+ popd > /dev/null || exit 1
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const {execSync} = require('child_process');
13
+ const fs = require('fs');
14
+ const yargs = require('yargs');
15
+
16
+ const LAST_BUILD_FILENAME = '.last_build_configuration';
17
+
18
+ function validateBuildConfiguration(configuration) {
19
+ if (!['Debug', 'Release'].includes(configuration)) {
20
+ throw new Error(`Invalid configuration ${configuration}`);
21
+ }
22
+ }
23
+
24
+ function validateVersion(version) {
25
+ if (version == null || version === '') {
26
+ throw new Error('Version cannot be empty');
27
+ }
28
+ }
29
+
30
+ function shouldReplaceHermesConfiguration(configuration) {
31
+ const fileExists = fs.existsSync(LAST_BUILD_FILENAME);
32
+
33
+ if (fileExists) {
34
+ console.log(`Found ${LAST_BUILD_FILENAME} file`);
35
+ const oldConfiguration = fs.readFileSync(LAST_BUILD_FILENAME).toString();
36
+ if (oldConfiguration === configuration) {
37
+ console.log(
38
+ 'Same config of the previous build. No need to replace Hermes engine',
39
+ );
40
+ return false;
41
+ }
42
+ }
43
+
44
+ // Assumption: if there is no stored last build, we assume that it was build for debug.
45
+ if (!fileExists && configuration === 'Debug') {
46
+ console.log(
47
+ 'No previous build detected, but Debug Configuration. No need to replace Hermes engine',
48
+ );
49
+ return false;
50
+ }
51
+
52
+ return true;
53
+ }
54
+
55
+ function replaceHermesConfiguration(configuration, version, podsRoot) {
56
+ const tarballURLPath = `${podsRoot}/hermes-engine-artifacts/hermes-ios-${version.toLowerCase()}-${configuration.toLowerCase()}.tar.gz`;
57
+
58
+ const finalLocation = 'hermes-engine';
59
+ console.log('Preparing the final location');
60
+ fs.rmSync(finalLocation, {force: true, recursive: true});
61
+ fs.mkdirSync(finalLocation, {recursive: true});
62
+
63
+ console.log('Extracting the tarball');
64
+ execSync(`tar -xf ${tarballURLPath} -C ${finalLocation}`);
65
+ }
66
+
67
+ function updateLastBuildConfiguration(configuration) {
68
+ fs.writeFileSync(LAST_BUILD_FILENAME, configuration);
69
+ }
70
+
71
+ function main(configuration, version, podsRoot) {
72
+ validateBuildConfiguration(configuration);
73
+ validateVersion(version);
74
+
75
+ if (!shouldReplaceHermesConfiguration(configuration)) {
76
+ return;
77
+ }
78
+
79
+ replaceHermesConfiguration(configuration, version, podsRoot);
80
+ updateLastBuildConfiguration(configuration);
81
+ console.log('Done replacing hermes-engine');
82
+ }
83
+
84
+ // This script is executed in the Pods folder, which is usually not synched to Github, so it should be ok
85
+ const argv = yargs
86
+ .option('c', {
87
+ alias: 'configuration',
88
+ description:
89
+ 'Configuration to use to download the right Hermes version. Allowed values are "Debug" and "Release".',
90
+ })
91
+ .option('r', {
92
+ alias: 'reactNativeVersion',
93
+ description:
94
+ 'The Version of React Native associated with the Hermes tarball.',
95
+ })
96
+ .option('p', {
97
+ alias: 'podsRoot',
98
+ description: 'The path to the Pods root folder',
99
+ })
100
+ .usage('Usage: $0 -c Debug -r <version> -p <path/to/react-native>').argv;
101
+
102
+ const configuration = argv.configuration;
103
+ const version = argv.reactNativeVersion;
104
+ const podsRoot = argv.podsRoot;
105
+
106
+ main(configuration, version, podsRoot);
@@ -1,156 +0,0 @@
1
- # Feature Flags
2
-
3
- Feature flags are values that determine the behavior of specific parts of React
4
- Native. This directory contains the configuration for those values, and scripts
5
- to generate files for different languages to access and customize them.
6
-
7
- There are 2 types of feature flags:
8
- * Common: can be accessed from any language and they provide consistent values
9
- everywhere.
10
- * JS-only: they can only be accessed and customized from JavaScript.
11
-
12
- ## Definition
13
-
14
- The source of truth for the definition of the flags is the file
15
- `ReactNativeFeatureFlags.config.js` in this directory.
16
-
17
- Example contents:
18
- ```javascript
19
- module.exports = {
20
- common: {
21
- enableMicrotasks: {
22
- description: 'Enable the use of microtasks in the JS runtime.',
23
- defaultValue: false
24
- }
25
- },
26
- jsOnly: {
27
- enableAccessToHostTreeInFabric: {
28
- description: 'Enables access to the host tree in Fabric using DOM-compatible APIs.',
29
- defaultValue: false
30
- }
31
- }
32
- };
33
- ```
34
-
35
- **After any change to these definitions**, the code that provides access to them
36
- must be regenerated running this from the `react-native`
37
- repository:
38
-
39
- ```shell
40
- yarn featureflags-update
41
- ```
42
-
43
- ## Access
44
-
45
- You can access the common feature flags from anywhere in your application using
46
- the `ReactNativeFeatureFlags` interface (available in C++/Objective-C++,
47
- Kotlin/Java and JavaScript). JS-only feature flags can only be accessed from
48
- JavaScript.
49
-
50
- **Accessing feature flags should be considered fast for all use cases**.
51
- Feature flags are cached at every layer, which prevents having to go through JNI
52
- when accessing the values from Kotlin and through JSI when accessing the values
53
- from JavaScript.
54
-
55
- ### C++ / Objective-C
56
-
57
- ```c++
58
- #include <react/featureflags/ReactNativeFeatureFlags.h>
59
-
60
- if (ReactNativeFeatureFlags::enableMicrotasks()) {
61
- // do something
62
- }
63
- ```
64
-
65
- ### Kotlin
66
-
67
- ```kotlin
68
- import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
69
-
70
- fun someMethod() {
71
- if (ReactNativeFeatureFlags.enableMicrotasks()) {
72
- // do something
73
- }
74
- }
75
- ```
76
-
77
- ### JavaScript
78
-
79
- ```javascript
80
- import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags';
81
-
82
- if (ReactNativeFeatureFlags.enableMicrotasks()) {
83
- // Native flag
84
- }
85
-
86
- if (ReactNativeFeatureFlags.enableAccessToHostTreeInFabric()) {
87
- // JS-only flag
88
- }
89
- ```
90
-
91
- ## Customization
92
-
93
- Feature flags provide the default values defined in the configuration unless
94
- overrides are applied at the application level. Overrides for common feature
95
- flags can only be defined in native, while overrides for JS-ony flags can only
96
- be defined in JavaScript.
97
-
98
- Overrides must be applied before any of the available feature flags has been
99
- accessed. This prevents having inconsistent behavior during the lifecycle of the
100
- application.
101
-
102
- ### C++/Objective-C
103
-
104
- ```c++
105
- #include <react/featureflags/ReactNativeFeatureFlags.h>
106
- #include <react/featureflags/ReactNativeFeatureFlagsDefaults.h>
107
-
108
- class CustomReactNativeFeatureFlags : public ReactNativeFeatureFlagsDefaults {
109
- public:
110
- CustomReactNativeFeatureFlags();
111
-
112
- bool enableMicrotasks() override {
113
- return true;
114
- }
115
- }
116
-
117
- ReactNativeFeatureFlags::override(std::make_unique<CustomReactNativeFeatureFlags>());
118
- ```
119
-
120
- ### Kotlin
121
-
122
- ```kotlin
123
- import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
124
- import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsDefaults
125
-
126
- fun overrideFeatureFlags() {
127
- ReactNativeFeatureFlags.override(object : ReactNativeFeatureFlagsDefaults() {
128
- override fun useMicrotasks(): Boolean = true
129
- })
130
- }
131
- ```
132
-
133
- ### JavaScript
134
-
135
- ```javascript
136
- import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags';
137
-
138
- ReactNativeFeatureFlags.override({
139
- enableAccessToHostTreeInFabric: () => true,
140
- });
141
- ```
142
-
143
- ## Architecture
144
-
145
- The architecture of this feature flags system can be described as follows:
146
- * A shared C++ core, where we provide access to the flags and allow
147
- customizations.
148
- * A Kotlin/Java interface that allows accessing and customizing the values in
149
- the C++ core (via JNI).
150
- * A JavaScript interface that allows accessing the common values (via a native
151
- module) and accessing and customizing the JS-only values.
152
-
153
- ![Diagram of the architecture of feature flags in React Native](./assets/react-native-feature-flags-architecture.excalidraw-embedded.png)
154
-
155
- _This image has an embedded [Excalidraw](https://www.excalidraw.com) diagram,
156
- so you can upload it there if you need to make further modifications._
@@ -1,14 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @format
8
- */
9
-
10
- if (require.main === module) {
11
- require('../../../../scripts/build/babel-register').registerForMonorepo();
12
- const update = require('./update').default;
13
- update(process.argv.includes('--verify-unchanged'));
14
- }