react-native-windows 0.69.6 → 0.70.0
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/.flowconfig +5 -1
- package/Chakra/ChakraHelpers.cpp +1 -1
- package/Chakra/ChakraPlatform.cpp +1 -1
- package/Chakra/ChakraValue.cpp +6 -3
- package/Chakra/ChakraValue.h +1 -1
- package/Directory.Build.props +7 -7
- package/Folly/Folly.vcxproj +20 -13
- package/Folly/cgmanifest.json +14 -0
- package/Libraries/Alert/Alert.js +18 -4
- package/Libraries/Alert/Alert.windows.js +4 -0
- package/Libraries/Alert/NativeAlertManager.js +1 -0
- package/Libraries/Animated/Animated.js +2 -2
- package/Libraries/Animated/AnimatedEvent.js +7 -4
- package/Libraries/Animated/AnimatedImplementation.js +17 -3
- package/Libraries/Animated/AnimatedMock.js +7 -2
- package/Libraries/Animated/NativeAnimatedHelper.js +220 -95
- package/Libraries/Animated/NativeAnimatedModule.js +3 -0
- package/Libraries/Animated/NativeAnimatedTurboModule.js +3 -0
- package/Libraries/Animated/animations/SpringAnimation.js +3 -3
- package/Libraries/Animated/animations/TimingAnimation.js +3 -3
- package/Libraries/Animated/createAnimatedComponent.js +8 -1
- package/Libraries/Animated/nodes/AnimatedAddition.js +3 -1
- package/Libraries/Animated/nodes/AnimatedColor.js +50 -29
- package/Libraries/Animated/nodes/AnimatedDiffClamp.js +3 -1
- package/Libraries/Animated/nodes/AnimatedDivision.js +3 -1
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +22 -21
- package/Libraries/Animated/nodes/AnimatedModulo.js +3 -1
- package/Libraries/Animated/nodes/AnimatedMultiplication.js +3 -2
- package/Libraries/Animated/nodes/AnimatedProps.js +20 -12
- package/Libraries/Animated/nodes/AnimatedStyle.js +19 -16
- package/Libraries/Animated/nodes/AnimatedSubtraction.js +3 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +5 -5
- package/Libraries/Animated/nodes/AnimatedValue.js +14 -5
- package/Libraries/Animated/nodes/AnimatedValueXY.js +28 -1
- package/Libraries/Animated/useAnimatedProps.js +1 -0
- package/Libraries/AppState/AppState.js +0 -32
- package/Libraries/AppTheme/AppTheme.js +14 -8
- package/Libraries/AppTheme/AppThemeTypes.d.ts +0 -3
- package/Libraries/BatchedBridge/MessageQueue.js +21 -15
- package/Libraries/BatchedBridge/NativeModules.js +3 -4
- package/Libraries/Blob/FileReader.js +0 -6
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +0 -20
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +0 -20
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -0
- package/Libraries/Components/Keyboard/Keyboard.js +0 -11
- package/Libraries/Components/Pressable/Pressable.js +2 -0
- package/Libraries/Components/Pressable/Pressable.windows.js +2 -0
- package/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +1 -3
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +3 -30
- package/Libraries/Components/SafeAreaView/SafeAreaView.windows.js +4 -30
- package/Libraries/Components/ScrollView/ScrollView.js +13 -11
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +5 -3
- package/Libraries/Components/StatusBar/StatusBar.js +10 -7
- package/Libraries/Components/TextInput/InputAccessoryView.js +14 -13
- package/Libraries/Components/TextInput/TextInput.js +12 -2
- package/Libraries/Components/TextInput/TextInput.windows.js +12 -2
- package/Libraries/Components/Touchable/PooledClass.js +16 -4
- package/Libraries/Components/Touchable/Touchable.js +50 -1
- package/Libraries/Components/Touchable/Touchable.windows.js +972 -0
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +6 -2
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +0 -7
- package/Libraries/Components/View/ViewPropTypes.js +3 -8
- package/Libraries/Components/View/ViewPropTypes.windows.js +3 -8
- package/Libraries/Core/ExceptionsManager.js +2 -0
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/Timers/JSTimers.js +2 -2
- package/Libraries/Core/polyfillPromise.js +0 -32
- package/Libraries/Core/setUpBatchedBridge.js +5 -1
- package/Libraries/Core/setUpPerformance.js +1 -1
- package/Libraries/EventEmitter/NativeEventEmitter.js +0 -13
- package/Libraries/Image/AssetSourceResolver.js +2 -2
- package/Libraries/Image/Image.android.js +5 -3
- package/Libraries/Image/Image.ios.js +6 -3
- package/Libraries/Image/Image.windows.js +6 -3
- package/Libraries/Image/ImageSource.js +7 -5
- package/Libraries/Inspector/ElementBox.js +2 -2
- package/Libraries/Inspector/NetworkOverlay.js +13 -8
- package/Libraries/Interaction/PanResponder.js +16 -14
- package/Libraries/Linking/Linking.js +0 -11
- package/Libraries/Lists/FlatList.js +3 -2
- package/Libraries/Lists/SectionList.js +2 -0
- package/Libraries/Lists/ViewabilityHelper.js +7 -3
- package/Libraries/Lists/VirtualizeUtils.js +33 -20
- package/Libraries/Lists/VirtualizedList.js +93 -47
- package/Libraries/Lists/VirtualizedListContext.js +1 -0
- package/Libraries/Lists/VirtualizedSectionList.js +14 -9
- package/Libraries/Lists/__tests__/VirtualizeUtils-test.js +19 -18
- package/Libraries/Lists/__tests__/VirtualizedList-test.js +10 -6
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
- package/Libraries/LogBox/LogBox.js +3 -1
- package/Libraries/LogBox/UI/AnsiHighlight.js +2 -0
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +3 -0
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +0 -3
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +8 -3
- package/Libraries/NativeComponent/BaseViewConfig.android.js +9 -18
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +26 -12
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +26 -12
- package/Libraries/Network/XMLHttpRequest.js +9 -11
- package/Libraries/Performance/PureComponentDebug.js +1 -0
- package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +9 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +16 -0
- package/Libraries/Pressability/Pressability.js +26 -16
- package/Libraries/Pressability/Pressability.windows.js +30 -17
- package/Libraries/Promise.js +0 -1
- package/Libraries/ReactNative/AppRegistry.js +16 -13
- package/Libraries/ReactNative/BridgelessUIManager.js +2 -0
- package/Libraries/ReactNative/PaperUIManager.js +9 -9
- package/Libraries/ReactNative/PaperUIManager.windows.js +7 -8
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +12 -0
- package/Libraries/ReactNative/ReactNativeRuntimeDiagnostics.js +68 -0
- package/Libraries/ReactNative/getNativeComponentAttributes.js +6 -7
- package/Libraries/ReactNative/renderApplication.js +1 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +4443 -3615
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +1496 -1170
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +1694 -1356
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +4439 -3588
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1583 -1249
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1719 -1372
- package/Libraries/Storage/AsyncStorage.js +7 -1
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +8 -0
- package/Libraries/StyleSheet/flattenStyle.js +1 -1
- package/Libraries/StyleSheet/processTransform.js +2 -0
- package/Libraries/StyleSheet/processTransform.windows.js +2 -0
- package/Libraries/StyleSheet/splitLayoutProps.js +2 -0
- package/Libraries/Text/Text.js +15 -7
- package/Libraries/Text/Text.windows.js +14 -7
- package/Libraries/Types/CoreEventTypes.js +137 -11
- package/Libraries/Types/CoreEventTypes.windows.js +147 -22
- package/Libraries/Utilities/Dimensions.js +0 -13
- package/Libraries/Utilities/HMRClient.js +3 -3
- package/Libraries/Utilities/Platform.ios.js +0 -7
- package/Libraries/Utilities/ReactNativeTestTools.js +3 -1
- package/Libraries/Utilities/codegenNativeCommands.js +11 -2
- package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
- package/Libraries/Utilities/stringifySafe.js +3 -1
- package/Libraries/Utilities/truncate.js +1 -1
- package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +2 -2
- package/Libraries/Vibration/Vibration.js +1 -1
- package/Libraries/WebSocket/WebSocket.js +1 -0
- package/Libraries/vendor/emitter/EventEmitter.js +105 -12
- package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +73 -117
- package/Microsoft.ReactNative/Base/CoreNativeModules.cpp +24 -12
- package/Microsoft.ReactNative/CoreApp.cpp +303 -0
- package/Microsoft.ReactNative/CoreAppPage.cpp +21 -0
- package/Microsoft.ReactNative/CoreAppPage.h +15 -0
- package/Microsoft.ReactNative/CoreAppPage.idl +12 -0
- package/Microsoft.ReactNative/CoreAppPage.xaml +14 -0
- package/Microsoft.ReactNative/Fabric/ActivityIndicatorComponentView.cpp +1 -2
- package/Microsoft.ReactNative/Fabric/ActivityIndicatorComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ImageComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ImageComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ParagraphComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ParagraphComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ScrollViewComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ScrollViewComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/SliderComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/SliderComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/SwitchComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/SwitchComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/TextComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/TextComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/TextInput/WindowsTextInputComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/TextInput/WindowsTextInputComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/ViewComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/ViewComponentView.h +1 -1
- package/Microsoft.ReactNative/GlyphViewManager.cpp +1 -0
- package/Microsoft.ReactNative/IReactDispatcher.cpp +18 -0
- package/Microsoft.ReactNative/IReactDispatcher.h +18 -3
- package/Microsoft.ReactNative/IReactDispatcher.idl +15 -0
- package/Microsoft.ReactNative/IReactPropertyBag.cpp +9 -0
- package/Microsoft.ReactNative/IReactPropertyBag.h +3 -0
- package/Microsoft.ReactNative/IReactPropertyBag.idl +3 -0
- package/Microsoft.ReactNative/JSDispatcherWriter.cpp +60 -22
- package/Microsoft.ReactNative/JSDispatcherWriter.h +5 -3
- package/Microsoft.ReactNative/JsiApi.cpp +41 -1
- package/Microsoft.ReactNative/JsiApi.h +3 -0
- package/Microsoft.ReactNative/JsiApi.idl +19 -1
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +18 -2
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +7 -7
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.h +1 -1
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +15 -12
- package/Microsoft.ReactNative/Modules/AlertModule.h +1 -1
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +45 -9
- package/Microsoft.ReactNative/Modules/AppStateModule.h +9 -3
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.h +1 -1
- package/Microsoft.ReactNative/Modules/ClipboardModule.h +1 -1
- package/Microsoft.ReactNative/Modules/DevSettingsModule.h +1 -1
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.h +1 -1
- package/Microsoft.ReactNative/Modules/I18nManagerModule.h +1 -1
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/ImageViewManagerModule.h +1 -1
- package/Microsoft.ReactNative/Modules/LinkingManagerModule.h +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +1 -1
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +66 -39
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +41 -11
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.h +1 -1
- package/Microsoft.ReactNative/QuirkSettings.cpp +22 -0
- package/Microsoft.ReactNative/QuirkSettings.h +10 -0
- package/Microsoft.ReactNative/QuirkSettings.idl +7 -0
- package/Microsoft.ReactNative/ReactApplication.cpp +44 -0
- package/Microsoft.ReactNative/ReactApplication.h +40 -5
- package/Microsoft.ReactNative/ReactHost/JSCallInvokerScheduler.cpp +5 -2
- package/Microsoft.ReactNative/ReactHost/JSCallInvokerScheduler.h +1 -0
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +24 -4
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
- package/Microsoft.ReactNative/ReactPointerEventArgs.cpp +12 -2
- package/Microsoft.ReactNative/TurboModulesProvider.cpp +146 -84
- package/Microsoft.ReactNative/TurboModulesProvider.h +5 -0
- package/Microsoft.ReactNative/Utils/BatchingEventEmitter.cpp +1 -0
- package/Microsoft.ReactNative/Utils/Helpers.cpp +1 -1
- package/Microsoft.ReactNative/Utils/Helpers.h +1 -1
- package/Microsoft.ReactNative/Utils/PropertyUtils.h +1 -1
- package/Microsoft.ReactNative/Utils/TransformableText.h +1 -1
- package/Microsoft.ReactNative/Utils/ValueUtils.cpp +0 -1
- package/Microsoft.ReactNative/Views/DynamicAutomationPeer.cpp +9 -7
- package/Microsoft.ReactNative/Views/DynamicAutomationProperties.cpp +3 -3
- package/Microsoft.ReactNative/Views/FlyoutViewManager.cpp +13 -1
- package/Microsoft.ReactNative/Views/FrameworkElementTransferProperties.cpp +1 -1
- package/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp +63 -13
- package/Microsoft.ReactNative/Views/Image/ImageViewManager.cpp +1 -1
- package/Microsoft.ReactNative/Views/Image/ReactImage.cpp +5 -6
- package/Microsoft.ReactNative/Views/Image/ReactImage.h +4 -4
- package/Microsoft.ReactNative/Views/Text/TextTransformParentVisitor.h +1 -1
- package/Microsoft.ReactNative/Views/TextInputViewManager.cpp +21 -2
- package/Microsoft.ReactNative/Views/TextViewManager.cpp +6 -3
- package/Microsoft.ReactNative/Views/TouchEventHandler.cpp +1 -1
- package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +7 -1
- package/Microsoft.ReactNative/Views/ViewPanel.cpp +4 -0
- package/Microsoft.ReactNative/Views/ViewViewManager.cpp +8 -3
- package/Microsoft.ReactNative/Views/cppwinrt/DynamicAutomationPeer.idl +2 -0
- package/Microsoft.ReactNative/microsoft.reactnative.def +4 -1
- package/Microsoft.ReactNative.Cxx/AppModelHelpers.h +17 -0
- package/Microsoft.ReactNative.Cxx/CoreApp.h +60 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +65 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +13 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiValueHelpers.cpp +53 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiValueHelpers.h +32 -0
- package/Microsoft.ReactNative.Cxx/JSI/LongLivedJsiValue.h +84 -0
- package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +14 -2
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +4 -0
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +10 -0
- package/Microsoft.ReactNative.Managed/packages.lock.json +1 -24
- package/Mso/dispatchQueue/dispatchQueue.h +12 -4
- package/Mso/src/dispatchQueue/looperScheduler.cpp +36 -9
- package/Mso/src/dispatchQueue/queueService.cpp +2 -2
- package/Mso/src/dispatchQueue/queueService.h +2 -2
- package/Mso/src/dispatchQueue/uiScheduler_winrt.cpp +6 -1
- package/Mso/src/memoryApi/memoryApi.cpp +3 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/Release.props +6 -0
- package/ReactCommon/ReactCommon.vcxproj +11 -21
- package/ReactCommon/ReactCommon.vcxproj.filters +64 -46
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.h +145 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +344 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/BaseTextProps.cpp +313 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/ViewProps.cpp +455 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/ConcreteComponentDescriptor.h +216 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/PropsMacros.h +91 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/graphics/RectangleEdges.h +100 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/CompactValue.h +3 -1
- package/Scripts/Microsoft.ReactNative.nuspec +6 -0
- package/Scripts/Microsoft.ReactNative.targets +7 -0
- package/Shared/DevSettings.h +4 -0
- package/Shared/InstanceManager.cpp +29 -0
- package/Shared/InstanceManager.h +14 -0
- package/Shared/JSI/ChakraRuntime.cpp +11 -2
- package/Shared/JSI/ChakraRuntime.h +2 -0
- package/Shared/Modules/BlobModule.cpp +4 -4
- package/Shared/Modules/BlobModule.h +1 -1
- package/Shared/Modules/FileReaderModule.cpp +3 -2
- package/Shared/Modules/IBlobPersistor.h +1 -1
- package/Shared/Networking/IHttpResource.h +1 -0
- package/Shared/Networking/OriginPolicyHttpFilter.cpp +16 -10
- package/Shared/Networking/WinRTHttpResource.cpp +34 -2
- package/Shared/OInstance.cpp +29 -6
- package/Shared/OInstance.h +4 -13
- package/Shared/Threading/BatchingQueueThread.cpp +23 -12
- package/Shared/Utils.cpp +2 -5
- package/codegen/NativeAlertManagerSpec.g.h +2 -0
- package/codegen/NativeAnimatedModuleSpec.g.h +6 -0
- package/codegen/NativeAnimatedTurboModuleSpec.g.h +6 -0
- package/codegen/react/components/rnwcore/Props.cpp +2 -2
- package/codegen/react/components/rnwcore/Props.h +1 -1
- package/fmt/cgmanifest.json +14 -0
- package/fmt/fmt.vcxproj +25 -11
- package/jest/assetFileTransformer.js +3 -2
- package/jest/setup.js +4 -0
- package/package.json +25 -26
- package/rntypes/index.d.ts +0 -1
- package/template/cs-app-WinAppSDK/proj/{NuGet.Config → NuGet_Config} +0 -0
- package/template/metro.devMode.config.js +49 -2
- package/template/shared-app/proj/{NuGet.Config → NuGet_Config} +0 -0
- package/template/shared-lib/proj/{NuGet.Config → NuGet_Config} +0 -0
- package/Libraries/vendor/emitter/EventSubscription.js +0 -19
- package/Libraries/vendor/emitter/_EmitterSubscription.js +0 -62
- package/Libraries/vendor/emitter/_EventEmitter.js +0 -184
- package/Libraries/vendor/emitter/_EventSubscription.js +0 -45
- package/Libraries/vendor/emitter/_EventSubscriptionVendor.js +0 -108
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +0 -87
- package/Scripts/copyRNLibraries.js +0 -99
- package/jest/preprocessor.js +0 -40
- package/jest/preprocessor_DO_NOT_USE.js +0 -122
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <react/renderer/core/RawPropsPrimitives.h>
|
|
11
|
+
|
|
12
|
+
// We need to use clang pragmas inside of a macro below,
|
|
13
|
+
// so we need to pull out the "if" statement here.
|
|
14
|
+
#if __clang__
|
|
15
|
+
#define CLANG_PRAGMA(s) _Pragma(s)
|
|
16
|
+
#else
|
|
17
|
+
#define CLANG_PRAGMA(s)
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
#define CONSTEXPR_RAW_PROPS_KEY_HASH(s) \
|
|
21
|
+
[]{ \
|
|
22
|
+
CLANG_PRAGMA("clang diagnostic push") \
|
|
23
|
+
CLANG_PRAGMA("clang diagnostic ignored \"-Wshadow\"") \
|
|
24
|
+
return folly::hash::fnv32_buf(s, sizeof(s) - 1); \
|
|
25
|
+
CLANG_PRAGMA("clang diagnostic pop") \
|
|
26
|
+
}()
|
|
27
|
+
|
|
28
|
+
#define RAW_PROPS_KEY_HASH(s) folly::hash::fnv32_buf(s, std::strlen(s))
|
|
29
|
+
|
|
30
|
+
// Convenience for building setProps switch statements.
|
|
31
|
+
// This injects `fromRawValue` into source; each file that uses
|
|
32
|
+
// this macro must import the proper, respective headers required.
|
|
33
|
+
#define RAW_SET_PROP_SWITCH_CASE(field, jsPropName, defaultValue) \
|
|
34
|
+
case CONSTEXPR_RAW_PROPS_KEY_HASH(jsPropName): \
|
|
35
|
+
fromRawValue(context, value, field, defaultValue); \
|
|
36
|
+
return;
|
|
37
|
+
|
|
38
|
+
// Convenience for building setProps switch statements where the field name is
|
|
39
|
+
// the same as the string identifier
|
|
40
|
+
#define RAW_SET_PROP_SWITCH_CASE_BASIC(field, defaultValue) \
|
|
41
|
+
RAW_SET_PROP_SWITCH_CASE(field, #field, defaultValue)
|
|
42
|
+
|
|
43
|
+
#define CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
44
|
+
struct, field, fieldNameString, value) \
|
|
45
|
+
case CONSTEXPR_RAW_PROPS_KEY_HASH(fieldNameString): { \
|
|
46
|
+
if (!value.hasValue()) { \
|
|
47
|
+
decltype(struct) defaultValues{}; \
|
|
48
|
+
struct.field = defaultValues.field; \
|
|
49
|
+
return; \
|
|
50
|
+
} \
|
|
51
|
+
fromRawValue(context, value, struct.field); \
|
|
52
|
+
return; \
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
#define SET_CASCADED_RECTANGLE_CORNERS(struct, prefix, suffix, rawValue) \
|
|
56
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
57
|
+
struct, topLeft, prefix "TopLeft" suffix, rawValue) \
|
|
58
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
59
|
+
struct, topRight, prefix "TopRight" suffix, rawValue) \
|
|
60
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
61
|
+
struct, bottomLeft, prefix "BottomLeft" suffix, rawValue) \
|
|
62
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
63
|
+
struct, bottomRight, prefix "BottomRight" suffix, rawValue) \
|
|
64
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
65
|
+
struct, topStart, prefix "TopStart" suffix, rawValue) \
|
|
66
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
67
|
+
struct, topEnd, prefix "TopEnd" suffix, rawValue) \
|
|
68
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
69
|
+
struct, bottomStart, prefix "BottomStart" suffix, rawValue) \
|
|
70
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
71
|
+
struct, bottomEnd, prefix "BottomEnd" suffix, rawValue)
|
|
72
|
+
|
|
73
|
+
#define SET_CASCADED_RECTANGLE_EDGES(struct, prefix, suffix, rawValue) \
|
|
74
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
75
|
+
struct, left, prefix "Left" suffix, rawValue) \
|
|
76
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
77
|
+
struct, right, prefix "Right" suffix, rawValue) \
|
|
78
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
79
|
+
struct, top, prefix "Top" suffix, rawValue) \
|
|
80
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
81
|
+
struct, bottom, prefix "Bottom" suffix, rawValue) \
|
|
82
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
83
|
+
struct, start, prefix "Start" suffix, rawValue) \
|
|
84
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
85
|
+
struct, end, prefix "End" suffix, rawValue) \
|
|
86
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
87
|
+
struct, horizontal, prefix "Horizontal" suffix, rawValue) \
|
|
88
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
89
|
+
struct, vertical, prefix "Vertical" suffix, rawValue) \
|
|
90
|
+
CASE_STATEMENT_SET_FIELD_VALUE_INDEXED( \
|
|
91
|
+
struct, all, prefix "" suffix, rawValue)
|
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <tuple>
|
|
11
|
+
|
|
12
|
+
#include <folly/Hash.h>
|
|
13
|
+
#include <react/renderer/graphics/Float.h>
|
|
14
|
+
#include <react/renderer/graphics/Rect.h>
|
|
15
|
+
|
|
16
|
+
namespace facebook {
|
|
17
|
+
namespace react {
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
* Generic data structure describes some values associated with *edges*
|
|
21
|
+
* of a rectangle.
|
|
22
|
+
*/
|
|
23
|
+
template <typename T>
|
|
24
|
+
struct RectangleEdges {
|
|
25
|
+
T left{};
|
|
26
|
+
T top{};
|
|
27
|
+
T right{};
|
|
28
|
+
T bottom{};
|
|
29
|
+
|
|
30
|
+
bool operator==(RectangleEdges<T> const &rhs) const noexcept {
|
|
31
|
+
return std::tie(this->left, this->top, this->right, this->bottom) ==
|
|
32
|
+
std::tie(rhs.left, rhs.top, rhs.right, rhs.bottom);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
bool operator!=(RectangleEdges<T> const &rhs) const noexcept {
|
|
36
|
+
return !(*this == rhs);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
bool isUniform() const noexcept {
|
|
40
|
+
return left == top && left == right && left == bottom;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static RectangleEdges<T> const ZERO;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
template <typename T>
|
|
47
|
+
RectangleEdges<T> const RectangleEdges<T>::ZERO = {};
|
|
48
|
+
|
|
49
|
+
template <typename T>
|
|
50
|
+
RectangleEdges<T> operator+(
|
|
51
|
+
RectangleEdges<T> const &lhs,
|
|
52
|
+
RectangleEdges<T> const &rhs) noexcept {
|
|
53
|
+
return RectangleEdges<T>{
|
|
54
|
+
lhs.left + rhs.left,
|
|
55
|
+
lhs.top + rhs.top,
|
|
56
|
+
lhs.right + rhs.right,
|
|
57
|
+
lhs.bottom + rhs.bottom};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
template <typename T>
|
|
61
|
+
RectangleEdges<T> operator-(
|
|
62
|
+
RectangleEdges<T> const &lhs,
|
|
63
|
+
RectangleEdges<T> const &rhs) noexcept {
|
|
64
|
+
return RectangleEdges<T>{
|
|
65
|
+
lhs.left - rhs.left,
|
|
66
|
+
lhs.top - rhs.top,
|
|
67
|
+
lhs.right - rhs.right,
|
|
68
|
+
lhs.bottom - rhs.bottom};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/*
|
|
72
|
+
* EdgeInsets
|
|
73
|
+
*/
|
|
74
|
+
using EdgeInsets = RectangleEdges<Float>;
|
|
75
|
+
|
|
76
|
+
/*
|
|
77
|
+
* Adjusts a rectangle by the given edge insets.
|
|
78
|
+
*/
|
|
79
|
+
inline Rect insetBy(Rect const &rect, EdgeInsets const &insets) noexcept {
|
|
80
|
+
return Rect{
|
|
81
|
+
{rect.origin.x + insets.left, rect.origin.y + insets.top},
|
|
82
|
+
{rect.size.width - insets.left - insets.right,
|
|
83
|
+
rect.size.height - insets.top - insets.bottom}};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
} // namespace react
|
|
87
|
+
} // namespace facebook
|
|
88
|
+
|
|
89
|
+
namespace std {
|
|
90
|
+
|
|
91
|
+
template <typename T>
|
|
92
|
+
struct hash<facebook::react::RectangleEdges<T>> {
|
|
93
|
+
size_t operator()(
|
|
94
|
+
facebook::react::RectangleEdges<T> const &edges) const noexcept {
|
|
95
|
+
return folly::hash::hash_combine(
|
|
96
|
+
0, edges.left, edges.right, edges.top, edges.bottom);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
} // namespace std
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
#ifdef __cpp_lib_bit_cast
|
|
13
13
|
#include <bit>
|
|
14
|
+
#else
|
|
15
|
+
#include <cstring>
|
|
14
16
|
#endif
|
|
15
17
|
#include "YGValue.h"
|
|
16
18
|
#include "YGMacros.h"
|
|
@@ -169,7 +171,7 @@ class YOGA_EXPORT CompactValue {
|
|
|
169
171
|
|
|
170
172
|
static float asFloat(uint32_t u) {
|
|
171
173
|
#ifdef __cpp_lib_bit_cast
|
|
172
|
-
return std::bit_cast<float>(
|
|
174
|
+
return std::bit_cast<float>(u);
|
|
173
175
|
#else
|
|
174
176
|
float f;
|
|
175
177
|
static_assert(sizeof(f) == sizeof(u));
|
|
@@ -29,27 +29,33 @@
|
|
|
29
29
|
<file src="$nugetroot$\ARM64\Release\Microsoft.ReactNative\Microsoft.ReactNative.dll" target="runtimes\win10-arm64\native" />
|
|
30
30
|
<file src="$nugetroot$\ARM64\Release\Microsoft.ReactNative\Microsoft.ReactNative.pdb" target="runtimes\win10-arm64\native" />
|
|
31
31
|
<file src="$nugetroot$\ARM64\Release\Microsoft.ReactNative\Microsoft.ReactNative.pri" target="runtimes\win10-arm64\native" />
|
|
32
|
+
<file src="$nugetroot$\ARM64\Release\Microsoft.ReactNative\Microsoft.ReactNative.lib" target="lib\arm64" />
|
|
32
33
|
|
|
33
34
|
<file src="$nugetroot$\x86\Release\Microsoft.ReactNative\Microsoft.ReactNative.dll" target="runtimes\win10-x86\native" />
|
|
34
35
|
<file src="$nugetroot$\x86\Release\Microsoft.ReactNative\Microsoft.ReactNative.pdb" target="runtimes\win10-x86\native" />
|
|
35
36
|
<file src="$nugetroot$\x86\Release\Microsoft.ReactNative\Microsoft.ReactNative.pri" target="runtimes\win10-x86\native" />
|
|
37
|
+
<file src="$nugetroot$\x86\Release\Microsoft.ReactNative\Microsoft.ReactNative.lib" target="lib\x86" />
|
|
36
38
|
|
|
37
39
|
<file src="$nugetroot$\x64\Release\Microsoft.ReactNative\Microsoft.ReactNative.dll" target="runtimes\win10-x64\native" />
|
|
38
40
|
<file src="$nugetroot$\x64\Release\Microsoft.ReactNative\Microsoft.ReactNative.pdb" target="runtimes\win10-x64\native" />
|
|
39
41
|
<file src="$nugetroot$\x64\Release\Microsoft.ReactNative\Microsoft.ReactNative.pri" target="runtimes\win10-x64\native" />
|
|
42
|
+
<file src="$nugetroot$\x64\Release\Microsoft.ReactNative\Microsoft.ReactNative.lib" target="lib\x64" />
|
|
40
43
|
|
|
41
44
|
<!-- Included in Microsoft.ReactNative.Debug -->
|
|
42
45
|
<file src="$nugetroot$\ARM64\Debug\Microsoft.ReactNative\Microsoft.ReactNative.dll" target="runtimes\win10-arm64\native" />
|
|
43
46
|
<file src="$nugetroot$\ARM64\Debug\Microsoft.ReactNative\Microsoft.ReactNative.pdb" target="runtimes\win10-arm64\native" />
|
|
44
47
|
<file src="$nugetroot$\ARM64\Debug\Microsoft.ReactNative\Microsoft.ReactNative.pri" target="runtimes\win10-arm64\native" />
|
|
48
|
+
<file src="$nugetroot$\ARM64\Debug\Microsoft.ReactNative\Microsoft.ReactNative.lib" target="lib\arm64" />
|
|
45
49
|
|
|
46
50
|
<file src="$nugetroot$\x86\Debug\Microsoft.ReactNative\Microsoft.ReactNative.dll" target="runtimes\win10-x86\native" />
|
|
47
51
|
<file src="$nugetroot$\x86\Debug\Microsoft.ReactNative\Microsoft.ReactNative.pdb" target="runtimes\win10-x86\native" />
|
|
48
52
|
<file src="$nugetroot$\x86\Debug\Microsoft.ReactNative\Microsoft.ReactNative.pri" target="runtimes\win10-x86\native" />
|
|
53
|
+
<file src="$nugetroot$\x86\Debug\Microsoft.ReactNative\Microsoft.ReactNative.lib" target="lib\x86" />
|
|
49
54
|
|
|
50
55
|
<file src="$nugetroot$\x64\Debug\Microsoft.ReactNative\Microsoft.ReactNative.dll" target="runtimes\win10-x64\native" />
|
|
51
56
|
<file src="$nugetroot$\x64\Debug\Microsoft.ReactNative\Microsoft.ReactNative.pdb" target="runtimes\win10-x64\native" />
|
|
52
57
|
<file src="$nugetroot$\x64\Debug\Microsoft.ReactNative\Microsoft.ReactNative.pri" target="runtimes\win10-x64\native" />
|
|
58
|
+
<file src="$nugetroot$\x64\Debug\Microsoft.ReactNative\Microsoft.ReactNative.lib" target="lib\x64" />
|
|
53
59
|
|
|
54
60
|
<!-- XBF files need to be included for Debug since they are not embedded in the PRI -->
|
|
55
61
|
<file src="$nugetroot$\ARM64\Debug\Microsoft.ReactNative\**\*.xbf" target="runtimes\win10-arm64\native" />
|
|
@@ -18,4 +18,11 @@
|
|
|
18
18
|
<ReferenceCopyLocalPaths Condition="$(Configuration) == 'Debug'" Include="$(_rnwFolder)**\*.xbf" />
|
|
19
19
|
|
|
20
20
|
</ItemGroup>
|
|
21
|
+
|
|
22
|
+
<ItemDefinitionGroup Condition="'$(UseRNCoreApp)'=='true'">
|
|
23
|
+
<Link>
|
|
24
|
+
<AdditionalDependencies>$(MSBuildThisFileDirectory)..\..\lib\$(Native-Platform)\Microsoft.ReactNative.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
25
|
+
</Link>
|
|
26
|
+
</ItemDefinitionGroup>
|
|
27
|
+
|
|
21
28
|
</Project>
|
package/Shared/DevSettings.h
CHANGED
|
@@ -24,7 +24,11 @@ namespace react {
|
|
|
24
24
|
enum class JSIEngineOverride : int32_t {
|
|
25
25
|
Default = 0, // No JSI, will use the legacy ExecutorFactory
|
|
26
26
|
Chakra = 1, // Use the JSIExecutorFactory with ChakraRuntime
|
|
27
|
+
|
|
28
|
+
#if 0 // Deprecated
|
|
27
29
|
ChakraCore = 2, // Use the JSIExecutorFactory with ChakraCoreRuntime
|
|
30
|
+
#endif
|
|
31
|
+
|
|
28
32
|
Hermes = 3, // Use the JSIExecutorFactory with Hermes
|
|
29
33
|
V8 = 4, // Use the JSIExecutorFactory with V8
|
|
30
34
|
V8Lite = 5, // Use the JSIExecutorFactory with V8Lite
|
|
@@ -41,6 +41,35 @@ std::shared_ptr<InstanceWrapper> CreateReactInstance(
|
|
|
41
41
|
std::move(jsBundleBasePath),
|
|
42
42
|
std::move(cxxModules),
|
|
43
43
|
std::move(turboModuleRegistry),
|
|
44
|
+
nullptr,
|
|
45
|
+
std::move(callback),
|
|
46
|
+
std::move(jsQueue),
|
|
47
|
+
std::move(nativeQueue),
|
|
48
|
+
std::move(devSettings),
|
|
49
|
+
GetSharedDevManager());
|
|
50
|
+
|
|
51
|
+
return inner;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
std::shared_ptr<InstanceWrapper> CreateReactInstance(
|
|
55
|
+
std::shared_ptr<Instance> &&instance,
|
|
56
|
+
std::string &&jsBundleBasePath,
|
|
57
|
+
std::vector<
|
|
58
|
+
std::tuple<std::string, facebook::xplat::module::CxxModule::Provider, std::shared_ptr<MessageQueueThread>>>
|
|
59
|
+
&&cxxModules,
|
|
60
|
+
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
|
|
61
|
+
std::shared_ptr<facebook::react::LongLivedObjectCollection> longLivedObjectCollection,
|
|
62
|
+
std::unique_ptr<InstanceCallback> &&callback,
|
|
63
|
+
std::shared_ptr<MessageQueueThread> jsQueue,
|
|
64
|
+
std::shared_ptr<MessageQueueThread> nativeQueue,
|
|
65
|
+
std::shared_ptr<DevSettings> devSettings) noexcept {
|
|
66
|
+
// Now create the instance
|
|
67
|
+
std::shared_ptr<InstanceWrapper> inner = InstanceImpl::MakeNoBundle(
|
|
68
|
+
std::move(instance),
|
|
69
|
+
std::move(jsBundleBasePath),
|
|
70
|
+
std::move(cxxModules),
|
|
71
|
+
std::move(turboModuleRegistry),
|
|
72
|
+
std::move(longLivedObjectCollection),
|
|
44
73
|
std::move(callback),
|
|
45
74
|
std::move(jsQueue),
|
|
46
75
|
std::move(nativeQueue),
|
package/Shared/InstanceManager.h
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
#pragma once
|
|
5
5
|
|
|
6
6
|
#include <Logging.h>
|
|
7
|
+
#include <ReactCommon/LongLivedObject.h>
|
|
7
8
|
#include <cxxreact/CxxModule.h>
|
|
8
9
|
#include <cxxreact/JSBigString.h>
|
|
9
10
|
#include <map>
|
|
@@ -51,6 +52,19 @@ std::shared_ptr<InstanceWrapper> CreateReactInstance(
|
|
|
51
52
|
std::shared_ptr<MessageQueueThread> nativeQueue,
|
|
52
53
|
std::shared_ptr<DevSettings> devSettings) noexcept;
|
|
53
54
|
|
|
55
|
+
std::shared_ptr<InstanceWrapper> CreateReactInstance(
|
|
56
|
+
std::shared_ptr<Instance> &&instance,
|
|
57
|
+
std::string &&jsBundleRelativePath,
|
|
58
|
+
std::vector<
|
|
59
|
+
std::tuple<std::string, facebook::xplat::module::CxxModule::Provider, std::shared_ptr<MessageQueueThread>>>
|
|
60
|
+
&&cxxModules,
|
|
61
|
+
std::shared_ptr<TurboModuleRegistry> turboModuleRegistry,
|
|
62
|
+
std::shared_ptr<facebook::react::LongLivedObjectCollection> longLivedObjectCollection,
|
|
63
|
+
std::unique_ptr<InstanceCallback> &&callback,
|
|
64
|
+
std::shared_ptr<MessageQueueThread> jsQueue,
|
|
65
|
+
std::shared_ptr<MessageQueueThread> nativeQueue,
|
|
66
|
+
std::shared_ptr<DevSettings> devSettings) noexcept;
|
|
67
|
+
|
|
54
68
|
std::shared_ptr<InstanceWrapper> CreateReactInstance(
|
|
55
69
|
std::shared_ptr<Instance> &&instance,
|
|
56
70
|
std::string &&jsBundleBasePath,
|
|
@@ -116,7 +116,7 @@ void ChakraRuntime::PromiseContinuation(JsValueRef funcRef) noexcept {
|
|
|
116
116
|
if (runtimeArgs().jsQueue) {
|
|
117
117
|
JsAddRef(funcRef, nullptr);
|
|
118
118
|
runtimeArgs().jsQueue->runOnQueue([this, funcRef]() {
|
|
119
|
-
JsValueRef undefinedValue;
|
|
119
|
+
JsValueRef undefinedValue = nullptr;
|
|
120
120
|
JsGetUndefinedValue(&undefinedValue);
|
|
121
121
|
ChakraVerifyJsErrorElseThrow(JsCallFunction(funcRef, &undefinedValue, 1, nullptr));
|
|
122
122
|
JsRelease(funcRef, nullptr);
|
|
@@ -280,6 +280,11 @@ facebook::jsi::Runtime::PointerValue *ChakraRuntime::cloneSymbol(
|
|
|
280
280
|
return CloneChakraPointerValue(pointerValue);
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
+
facebook::jsi::Runtime::PointerValue *ChakraRuntime::cloneBigInt(
|
|
284
|
+
const facebook::jsi::Runtime::PointerValue *pointerValue) {
|
|
285
|
+
return CloneChakraPointerValue(pointerValue);
|
|
286
|
+
}
|
|
287
|
+
|
|
283
288
|
facebook::jsi::Runtime::PointerValue *ChakraRuntime::cloneString(
|
|
284
289
|
const facebook::jsi::Runtime::PointerValue *pointerValue) {
|
|
285
290
|
return CloneChakraPointerValue(pointerValue);
|
|
@@ -591,6 +596,10 @@ bool ChakraRuntime::strictEquals(const facebook::jsi::Symbol &a, const facebook:
|
|
|
591
596
|
return StrictEquals(GetJsRef(a), GetJsRef(b));
|
|
592
597
|
}
|
|
593
598
|
|
|
599
|
+
bool ChakraRuntime::strictEquals(const facebook::jsi::BigInt &a, const facebook::jsi::BigInt &b) const {
|
|
600
|
+
return StrictEquals(GetJsRef(a), GetJsRef(b));
|
|
601
|
+
}
|
|
602
|
+
|
|
594
603
|
bool ChakraRuntime::strictEquals(const facebook::jsi::String &a, const facebook::jsi::String &b) const {
|
|
595
604
|
return StrictEquals(GetJsRef(a), GetJsRef(b));
|
|
596
605
|
}
|
|
@@ -976,7 +985,7 @@ ChakraRuntime::JsiValueViewArgs::JsiValueViewArgs(JsValueRef *args, size_t argCo
|
|
|
976
985
|
JsiValueView::StoreType *const pointerStore =
|
|
977
986
|
m_heapPointerStore ? m_heapPointerStore.get() : m_stackPointerStore.data();
|
|
978
987
|
facebook::jsi::Value *const jsiArgs = m_heapArgs ? m_heapArgs.get() : m_stackArgs.data();
|
|
979
|
-
for (
|
|
988
|
+
for (size_t i = 0; i < m_size; ++i) {
|
|
980
989
|
jsiArgs[i] = JsiValueView::InitValue(args[i], std::addressof(pointerStore[i]));
|
|
981
990
|
}
|
|
982
991
|
}
|
|
@@ -56,6 +56,7 @@ class ChakraRuntime : public facebook::jsi::Runtime, public ChakraApi, ChakraApi
|
|
|
56
56
|
// return value must only be used as an argument to the constructor of
|
|
57
57
|
// jsi::Pointer or one of its derived classes.
|
|
58
58
|
PointerValue *cloneSymbol(const PointerValue *pointerValue) override;
|
|
59
|
+
PointerValue *cloneBigInt(const PointerValue *pointerValue) override;
|
|
59
60
|
PointerValue *cloneString(const PointerValue *pointerValue) override;
|
|
60
61
|
PointerValue *cloneObject(const PointerValue *pointerValue) override;
|
|
61
62
|
PointerValue *clonePropNameID(const PointerValue *pointerValue) override;
|
|
@@ -133,6 +134,7 @@ class ChakraRuntime : public facebook::jsi::Runtime, public ChakraApi, ChakraApi
|
|
|
133
134
|
void popScope(ScopeState *) override;
|
|
134
135
|
|
|
135
136
|
bool strictEquals(const facebook::jsi::Symbol &a, const facebook::jsi::Symbol &b) const override;
|
|
137
|
+
bool strictEquals(const facebook::jsi::BigInt &a, const facebook::jsi::BigInt &b) const override;
|
|
136
138
|
bool strictEquals(const facebook::jsi::String &a, const facebook::jsi::String &b) const override;
|
|
137
139
|
bool strictEquals(const facebook::jsi::Object &a, const facebook::jsi::Object &b) const override;
|
|
138
140
|
|
|
@@ -139,7 +139,7 @@ vector<module::CxxModule::Method> BlobModule::getMethods() {
|
|
|
139
139
|
auto size = blob[sizeKey].getInt();
|
|
140
140
|
auto socketID = jsArgAsInt(args, 1);
|
|
141
141
|
|
|
142
|
-
winrt::array_view<uint8_t> data;
|
|
142
|
+
winrt::array_view<uint8_t const> data;
|
|
143
143
|
try {
|
|
144
144
|
data = persistor->ResolveMessage(std::move(blobId), offset, size);
|
|
145
145
|
} catch (const std::exception &e) {
|
|
@@ -169,7 +169,7 @@ vector<module::CxxModule::Method> BlobModule::getMethods() {
|
|
|
169
169
|
auto type = part[typeKey].asString();
|
|
170
170
|
if (blobKey == type) {
|
|
171
171
|
auto blob = part[dataKey];
|
|
172
|
-
winrt::array_view<uint8_t> bufferPart;
|
|
172
|
+
winrt::array_view<uint8_t const> bufferPart;
|
|
173
173
|
try {
|
|
174
174
|
bufferPart = persistor->ResolveMessage(
|
|
175
175
|
blob[blobIdKey].asString(), blob[offsetKey].asInt(), blob[sizeKey].asInt());
|
|
@@ -216,7 +216,7 @@ vector<module::CxxModule::Method> BlobModule::getMethods() {
|
|
|
216
216
|
|
|
217
217
|
#pragma region IBlobPersistor
|
|
218
218
|
|
|
219
|
-
winrt::array_view<uint8_t> MemoryBlobPersistor::ResolveMessage(string &&blobId, int64_t offset, int64_t size) {
|
|
219
|
+
winrt::array_view<uint8_t const> MemoryBlobPersistor::ResolveMessage(string &&blobId, int64_t offset, int64_t size) {
|
|
220
220
|
if (size < 1)
|
|
221
221
|
return {};
|
|
222
222
|
|
|
@@ -233,7 +233,7 @@ winrt::array_view<uint8_t> MemoryBlobPersistor::ResolveMessage(string &&blobId,
|
|
|
233
233
|
if (endBound > bytes.size() || offset >= static_cast<int64_t>(bytes.size()) || offset < 0)
|
|
234
234
|
throw std::out_of_range("Offset or size out of range");
|
|
235
235
|
|
|
236
|
-
return winrt::array_view<uint8_t>(bytes.data() + offset, bytes.data() + endBound);
|
|
236
|
+
return winrt::array_view<uint8_t const>(bytes.data() + offset, bytes.data() + endBound);
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
void MemoryBlobPersistor::RemoveMessage(string &&blobId) noexcept {
|
|
@@ -30,7 +30,7 @@ class MemoryBlobPersistor final : public IBlobPersistor {
|
|
|
30
30
|
public:
|
|
31
31
|
#pragma region IBlobPersistor
|
|
32
32
|
|
|
33
|
-
winrt::array_view<uint8_t> ResolveMessage(std::string &&blobId, int64_t offset, int64_t size) override;
|
|
33
|
+
winrt::array_view<uint8_t const> ResolveMessage(std::string &&blobId, int64_t offset, int64_t size) override;
|
|
34
34
|
|
|
35
35
|
void RemoveMessage(std::string &&blobId) noexcept override;
|
|
36
36
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
#include "FileReaderModule.h"
|
|
5
5
|
|
|
6
6
|
#include <ReactPropertyBag.h>
|
|
7
|
+
#include <sstream>
|
|
7
8
|
|
|
8
9
|
// Boost Library
|
|
9
10
|
#include <boost/archive/iterators/base64_from_binary.hpp>
|
|
@@ -71,7 +72,7 @@ std::vector<module::CxxModule::Method> FileReaderModule::getMethods() {
|
|
|
71
72
|
auto offset = blob["offset"].asInt();
|
|
72
73
|
auto size = blob["size"].asInt();
|
|
73
74
|
|
|
74
|
-
winrt::array_view<uint8_t> bytes;
|
|
75
|
+
winrt::array_view<uint8_t const> bytes;
|
|
75
76
|
try {
|
|
76
77
|
bytes = blobPersistor->ResolveMessage(std::move(blobId), offset, size);
|
|
77
78
|
} catch (const std::exception &e) {
|
|
@@ -116,7 +117,7 @@ std::vector<module::CxxModule::Method> FileReaderModule::getMethods() {
|
|
|
116
117
|
auto offset = blob["offset"].asInt();
|
|
117
118
|
auto size = blob["size"].asInt();
|
|
118
119
|
|
|
119
|
-
winrt::array_view<uint8_t> bytes;
|
|
120
|
+
winrt::array_view<uint8_t const> bytes;
|
|
120
121
|
try {
|
|
121
122
|
bytes = blobPersistor->ResolveMessage(std::move(blobId), offset, size);
|
|
122
123
|
} catch (const std::exception &e) {
|
|
@@ -18,7 +18,7 @@ struct IBlobPersistor {
|
|
|
18
18
|
/// When an entry for blobId cannot be found.
|
|
19
19
|
/// </exception>
|
|
20
20
|
///
|
|
21
|
-
virtual winrt::array_view<uint8_t> ResolveMessage(std::string &&blobId, int64_t offset, int64_t size) = 0;
|
|
21
|
+
virtual winrt::array_view<uint8_t const> ResolveMessage(std::string &&blobId, int64_t offset, int64_t size) = 0;
|
|
22
22
|
|
|
23
23
|
virtual void RemoveMessage(std::string &&blobId) noexcept = 0;
|
|
24
24
|
|
|
@@ -71,6 +71,7 @@ struct IHttpResource {
|
|
|
71
71
|
/// </param>
|
|
72
72
|
/// <param name="timeout">
|
|
73
73
|
/// Request timeout in miliseconds.
|
|
74
|
+
/// Note: A value of 0 means no timeout. The resource will await the response indefinitely.
|
|
74
75
|
/// </param>
|
|
75
76
|
/// <param name="withCredentials">
|
|
76
77
|
/// Allow including credentials in request.
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
#include <boost/lexical_cast/try_lexical_convert.hpp>
|
|
13
13
|
|
|
14
14
|
// Windows API
|
|
15
|
+
#include <winrt/Windows.Foundation.Collections.h>
|
|
15
16
|
#include <winrt/Windows.Web.Http.Headers.h>
|
|
16
17
|
|
|
17
18
|
// Standard Library
|
|
@@ -653,21 +654,26 @@ ResponseOperation OriginPolicyHttpFilter::SendPreflightAsync(HttpRequestMessage
|
|
|
653
654
|
preflightRequest.Headers().Insert(L"Access-Control-Request-Method", coRequest.Method().ToString());
|
|
654
655
|
|
|
655
656
|
auto headerNames = wstring{};
|
|
656
|
-
auto
|
|
657
|
-
|
|
658
|
-
|
|
657
|
+
auto writeSeparator = false;
|
|
658
|
+
for (const auto &header : coRequest.Headers()) {
|
|
659
|
+
if (writeSeparator) {
|
|
660
|
+
headerNames += L", ";
|
|
661
|
+
} else {
|
|
662
|
+
writeSeparator = true;
|
|
663
|
+
}
|
|
659
664
|
|
|
660
|
-
|
|
661
|
-
headerNames += L", " + (*headerItr).Key();
|
|
665
|
+
headerNames += header.Key();
|
|
662
666
|
}
|
|
663
667
|
|
|
664
668
|
if (coRequest.Content()) {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
669
|
+
for (const auto &header : coRequest.Content().Headers()) {
|
|
670
|
+
if (writeSeparator) {
|
|
671
|
+
headerNames += L", ";
|
|
672
|
+
} else {
|
|
673
|
+
writeSeparator = true;
|
|
674
|
+
}
|
|
668
675
|
|
|
669
|
-
|
|
670
|
-
headerNames += L", " + (*headerItr).Key();
|
|
676
|
+
headerNames += header.Key();
|
|
671
677
|
}
|
|
672
678
|
}
|
|
673
679
|
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
#include <boost/algorithm/string.hpp>
|
|
15
15
|
|
|
16
16
|
// Windows API
|
|
17
|
+
#include <winrt/Windows.Foundation.Collections.h>
|
|
17
18
|
#include <winrt/Windows.Security.Cryptography.h>
|
|
18
19
|
#include <winrt/Windows.Storage.Streams.h>
|
|
19
20
|
#include <winrt/Windows.Web.Http.Headers.h>
|
|
@@ -218,6 +219,12 @@ fire_and_forget WinRTHttpResource::PerformSendRequest(HttpRequestMessage &&reque
|
|
|
218
219
|
if (!success && m_onError) {
|
|
219
220
|
co_return m_onError(coReqArgs->RequestId, "Failed to append Authorization");
|
|
220
221
|
}
|
|
222
|
+
} else if (boost::iequals(header.first.c_str(), "User-Agent")) {
|
|
223
|
+
bool success =
|
|
224
|
+
coRequest.Headers().TryAppendWithoutValidation(to_hstring(header.first), to_hstring(header.second));
|
|
225
|
+
if (!success && m_onError) {
|
|
226
|
+
co_return m_onError(coReqArgs->RequestId, "Failed to append User-Agent");
|
|
227
|
+
}
|
|
221
228
|
} else {
|
|
222
229
|
try {
|
|
223
230
|
coRequest.Headers().Append(to_hstring(header.first), to_hstring(header.second));
|
|
@@ -249,7 +256,7 @@ fire_and_forget WinRTHttpResource::PerformSendRequest(HttpRequestMessage &&reque
|
|
|
249
256
|
for (auto &byte : bytes) {
|
|
250
257
|
byteVector.push_back(static_cast<uint8_t>(byte.asInt()));
|
|
251
258
|
}
|
|
252
|
-
auto view = winrt::array_view<uint8_t>{byteVector};
|
|
259
|
+
auto view = winrt::array_view<uint8_t const>{byteVector};
|
|
253
260
|
auto buffer = CryptographicBuffer::CreateFromByteArray(view);
|
|
254
261
|
content = HttpBufferContent{std::move(buffer)};
|
|
255
262
|
} else if (!data["string"].empty()) {
|
|
@@ -297,7 +304,32 @@ fire_and_forget WinRTHttpResource::PerformSendRequest(HttpRequestMessage &&reque
|
|
|
297
304
|
auto sendRequestOp = self->m_client.SendRequestAsync(coRequest);
|
|
298
305
|
self->TrackResponse(coReqArgs->RequestId, sendRequestOp);
|
|
299
306
|
|
|
300
|
-
|
|
307
|
+
if (coReqArgs->Timeout > 0) {
|
|
308
|
+
// See https://devblogs.microsoft.com/oldnewthing/20220415-00/?p=106486
|
|
309
|
+
auto timedOut = std::make_shared<bool>(false);
|
|
310
|
+
auto sendRequestTimeout = [](auto timedOut, auto milliseconds) -> ResponseOperation {
|
|
311
|
+
// Convert milliseconds to "ticks" (10^-7 seconds)
|
|
312
|
+
co_await winrt::resume_after(winrt::Windows::Foundation::TimeSpan{milliseconds * 10000});
|
|
313
|
+
*timedOut = true;
|
|
314
|
+
co_return nullptr;
|
|
315
|
+
}(timedOut, coReqArgs->Timeout);
|
|
316
|
+
|
|
317
|
+
co_await lessthrow_await_adapter<ResponseOperation>{winrt::when_any(sendRequestOp, sendRequestTimeout)};
|
|
318
|
+
|
|
319
|
+
// Cancel either still unfinished coroutine.
|
|
320
|
+
sendRequestTimeout.Cancel();
|
|
321
|
+
sendRequestOp.Cancel();
|
|
322
|
+
|
|
323
|
+
if (*timedOut) {
|
|
324
|
+
if (self->m_onError) {
|
|
325
|
+
self->m_onError(coReqArgs->RequestId, Utilities::HResultToString(HRESULT_FROM_WIN32(ERROR_TIMEOUT)));
|
|
326
|
+
}
|
|
327
|
+
co_return self->UntrackResponse(coReqArgs->RequestId);
|
|
328
|
+
}
|
|
329
|
+
} else {
|
|
330
|
+
co_await lessthrow_await_adapter<ResponseOperation>{sendRequestOp};
|
|
331
|
+
}
|
|
332
|
+
|
|
301
333
|
auto result = sendRequestOp.ErrorCode();
|
|
302
334
|
if (result < 0) {
|
|
303
335
|
if (self->m_onError) {
|