From 12cd003c4a0779a29821ffa17e6c01c0530246a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Fri, 26 Jan 2024 11:35:54 -0300 Subject: [PATCH 01/47] refactor: feature toggle using hathor unleash client --- src/sagas/featureToggle.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/sagas/featureToggle.js b/src/sagas/featureToggle.js index 9300bf984..87bbfd36d 100644 --- a/src/sagas/featureToggle.js +++ b/src/sagas/featureToggle.js @@ -18,7 +18,6 @@ import { select, fork, spawn, - takeEvery, } from 'redux-saga/effects'; import { getUniqueId } from 'react-native-device-info'; import { @@ -78,18 +77,6 @@ export function* fetchTogglesRoutine() { } } -export function* handleToggleUpdate() { - console.log('Handling feature toggle update'); - const unleashClient = yield select((state) => state.unleashClient); - const networkSettings = yield select((state) => state.networkSettings); - - const toggles = unleashClient.getToggles(); - const featureToggles = disableFeaturesIfNeeded(networkSettings, mapFeatureToggles(toggles)); - - yield put(setFeatureToggles(featureToggles)); - yield put({ type: types.FEATURE_TOGGLE_UPDATED }); -} - export function* monitorFeatureFlags(currentRetry = 0) { const { appVersion } = VersionNumber; @@ -152,6 +139,5 @@ function mapFeatureToggles(toggles) { export function* saga() { yield all([ fork(monitorFeatureFlags), - takeEvery(types.FEATURE_TOGGLE_UPDATE, handleToggleUpdate), ]); } From 2321a4b26c8b2f5efece85e0f4bc65903c46f84b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 29 Jan 2024 13:07:25 -0300 Subject: [PATCH 02/47] feat: handling feature updates --- src/sagas/featureToggle.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/sagas/featureToggle.js b/src/sagas/featureToggle.js index 87bbfd36d..9300bf984 100644 --- a/src/sagas/featureToggle.js +++ b/src/sagas/featureToggle.js @@ -18,6 +18,7 @@ import { select, fork, spawn, + takeEvery, } from 'redux-saga/effects'; import { getUniqueId } from 'react-native-device-info'; import { @@ -77,6 +78,18 @@ export function* fetchTogglesRoutine() { } } +export function* handleToggleUpdate() { + console.log('Handling feature toggle update'); + const unleashClient = yield select((state) => state.unleashClient); + const networkSettings = yield select((state) => state.networkSettings); + + const toggles = unleashClient.getToggles(); + const featureToggles = disableFeaturesIfNeeded(networkSettings, mapFeatureToggles(toggles)); + + yield put(setFeatureToggles(featureToggles)); + yield put({ type: types.FEATURE_TOGGLE_UPDATED }); +} + export function* monitorFeatureFlags(currentRetry = 0) { const { appVersion } = VersionNumber; @@ -139,5 +152,6 @@ function mapFeatureToggles(toggles) { export function* saga() { yield all([ fork(monitorFeatureFlags), + takeEvery(types.FEATURE_TOGGLE_UPDATE, handleToggleUpdate), ]); } From 5b96742299c46b375cd40c611b4610f830e6ad41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 22 Jan 2024 14:19:21 -0300 Subject: [PATCH 03/47] feat: added SES to the project and enabled lockdown --- .babelignore | 1 + .prettierignore | 1 + index.js | 9 +- ios/HathorMobile.xcodeproj/project.pbxproj | 42 +- ios/Podfile | 2 +- ios/Podfile.lock | 130 +- lockdown.umd.js | 11243 +++++++++++++++++++ package-lock.json | 24 - package.json | 1 - 9 files changed, 11299 insertions(+), 154 deletions(-) create mode 100644 .babelignore create mode 100644 .prettierignore create mode 100644 lockdown.umd.js diff --git a/.babelignore b/.babelignore new file mode 100644 index 000000000..5f99a2d3a --- /dev/null +++ b/.babelignore @@ -0,0 +1 @@ +lockdown.umd.js diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..5f99a2d3a --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +lockdown.umd.js diff --git a/index.js b/index.js index 88ab3ec5c..9ed4c6830 100644 --- a/index.js +++ b/index.js @@ -5,17 +5,24 @@ * LICENSE file in the root directory of this source tree. */ +import './lockdown.umd'; import './i18nInit'; -import { AppRegistry } from 'react-native'; +import { AppRegistry, View, Text } from 'react-native'; import { setJSExceptionHandler } from 'react-native-exception-handler'; import App from './src/App'; import { name as appName } from './app.json'; import { errorHandler } from './src/errorHandler'; + import { setBackgroundMessageListener, setNotifeeBackgroundListener, } from './src/workers/backgroundListeners'; +lockdown({ + consoleTaming: 'unsafe', + errorTaming: 'unsafe', +}); + // Set the background listeners for push notifications setNotifeeBackgroundListener(); setBackgroundMessageListener(); diff --git a/ios/HathorMobile.xcodeproj/project.pbxproj b/ios/HathorMobile.xcodeproj/project.pbxproj index 2869af2a4..0369b1596 100644 --- a/ios/HathorMobile.xcodeproj/project.pbxproj +++ b/ios/HathorMobile.xcodeproj/project.pbxproj @@ -168,7 +168,6 @@ 00E356EB1AD99517003FC87E /* Frameworks */, 00E356EC1AD99517003FC87E /* Resources */, D6CF71901D46C404F80C1CBF /* [CP] Copy Pods Resources */, - 3E7666BE09278503C27A1C65 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -192,7 +191,6 @@ 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, E7A3890494F2D10544808206 /* [CP] Copy Pods Resources */, 98C5A10E99F2B977B3288BDB /* [CP-User] [RNFB] Core Configuration */, - 05236F6C0A91F8F7AC940133 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -275,23 +273,6 @@ shellPath = /bin/sh; shellScript = "set -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n"; }; - 05236F6C0A91F8F7AC940133 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-HathorMobile/Pods-HathorMobile-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-HathorMobile/Pods-HathorMobile-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-HathorMobile/Pods-HathorMobile-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 092A93BEE8FA44D1787A8BF9 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -314,23 +295,6 @@ 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"; showEnvVarsInLog = 0; }; - 3E7666BE09278503C27A1C65 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-HathorMobile-HathorMobileTests/Pods-HathorMobile-HathorMobileTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-HathorMobile-HathorMobileTests/Pods-HathorMobile-HathorMobileTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-HathorMobile-HathorMobileTests/Pods-HathorMobile-HathorMobileTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; 98C5A10E99F2B977B3288BDB /* [CP-User] [RNFB] Core Configuration */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -596,7 +560,7 @@ COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -639,6 +603,7 @@ OTHER_LDFLAGS = ( "$(inherited)", " ", + "-Wl -ld_classic ", ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; @@ -678,7 +643,7 @@ COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -717,6 +682,7 @@ OTHER_LDFLAGS = ( "$(inherited)", " ", + "-Wl -ld_classic ", ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; diff --git a/ios/Podfile b/ios/Podfile index 1f826adb3..8fca48250 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -43,7 +43,7 @@ target 'HathorMobile' do :path => config[:reactNativePath], # Hermes is now enabled by default. Disable by setting this flag to false. - :hermes_enabled => flags[:hermes_enabled], + :hermes_enabled => false, #flags[:hermes_enabled], :fabric_enabled => flags[:fabric_enabled], # Enables Flipper. # diff --git a/ios/Podfile.lock b/ios/Podfile.lock index a92cc1d68..244a13658 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -75,10 +75,6 @@ PODS: - GoogleUtilities/MethodSwizzler - GoogleUtilities/UserDefaults (7.12.0): - GoogleUtilities/Logger - - hermes-engine (0.72.5): - - hermes-engine/Pre-built (= 0.72.5) - - hermes-engine/Pre-built (0.72.5) - - libevent (2.1.12) - nanopb (2.30909.1): - nanopb/decode (= 2.30909.1) - nanopb/encode (= 2.30909.1) @@ -100,12 +96,6 @@ PODS: - DoubleConversion - fmt (~> 6.2.1) - glog - - RCT-Folly/Futures (2021.07.22.00): - - boost - - DoubleConversion - - fmt (~> 6.2.1) - - glog - - libevent - RCTRequired (0.72.5) - RCTTypeSafety (0.72.5): - FBLazyVector (= 0.72.5) @@ -129,11 +119,11 @@ PODS: - DoubleConversion - FBReactNativeSpec - glog - - hermes-engine - RCT-Folly - RCTRequired - RCTTypeSafety - React-Core + - React-jsc - React-jsi - React-jsiexecutor - React-NativeModulesApple @@ -142,11 +132,10 @@ PODS: - ReactCommon/turbomodule/core - React-Core (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default (= 0.72.5) - React-cxxreact - - React-hermes + - React-jsc - React-jsi - React-jsiexecutor - React-perflogger @@ -156,11 +145,10 @@ PODS: - Yoga - React-Core/CoreModulesHeaders (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - React-cxxreact - - React-hermes + - React-jsc - React-jsi - React-jsiexecutor - React-perflogger @@ -170,10 +158,9 @@ PODS: - Yoga - React-Core/Default (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-cxxreact - - React-hermes + - React-jsc - React-jsi - React-jsiexecutor - React-perflogger @@ -183,12 +170,11 @@ PODS: - Yoga - React-Core/DevSupport (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default (= 0.72.5) - React-Core/RCTWebSocket (= 0.72.5) - React-cxxreact - - React-hermes + - React-jsc - React-jsi - React-jsiexecutor - React-jsinspector (= 0.72.5) @@ -199,11 +185,10 @@ PODS: - Yoga - React-Core/RCTActionSheetHeaders (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - React-cxxreact - - React-hermes + - React-jsc - React-jsi - React-jsiexecutor - React-perflogger @@ -213,11 +198,10 @@ PODS: - Yoga - React-Core/RCTAnimationHeaders (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - React-cxxreact - - React-hermes + - React-jsc - React-jsi - React-jsiexecutor - React-perflogger @@ -227,11 +211,10 @@ PODS: - Yoga - React-Core/RCTBlobHeaders (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - React-cxxreact - - React-hermes + - React-jsc - React-jsi - React-jsiexecutor - React-perflogger @@ -241,11 +224,10 @@ PODS: - Yoga - React-Core/RCTImageHeaders (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - React-cxxreact - - React-hermes + - React-jsc - React-jsi - React-jsiexecutor - React-perflogger @@ -255,11 +237,10 @@ PODS: - Yoga - React-Core/RCTLinkingHeaders (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - React-cxxreact - - React-hermes + - React-jsc - React-jsi - React-jsiexecutor - React-perflogger @@ -269,11 +250,10 @@ PODS: - Yoga - React-Core/RCTNetworkHeaders (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - React-cxxreact - - React-hermes + - React-jsc - React-jsi - React-jsiexecutor - React-perflogger @@ -283,11 +263,10 @@ PODS: - Yoga - React-Core/RCTSettingsHeaders (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - React-cxxreact - - React-hermes + - React-jsc - React-jsi - React-jsiexecutor - React-perflogger @@ -297,11 +276,10 @@ PODS: - Yoga - React-Core/RCTTextHeaders (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - React-cxxreact - - React-hermes + - React-jsc - React-jsi - React-jsiexecutor - React-perflogger @@ -311,11 +289,10 @@ PODS: - Yoga - React-Core/RCTVibrationHeaders (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - React-cxxreact - - React-hermes + - React-jsc - React-jsi - React-jsiexecutor - React-perflogger @@ -325,11 +302,10 @@ PODS: - Yoga - React-Core/RCTWebSocket (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default (= 0.72.5) - React-cxxreact - - React-hermes + - React-jsc - React-jsi - React-jsiexecutor - React-perflogger @@ -351,7 +327,6 @@ PODS: - boost (= 1.76.0) - DoubleConversion - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-callinvoker (= 0.72.5) - React-debug (= 0.72.5) @@ -361,27 +336,19 @@ PODS: - React-perflogger (= 0.72.5) - React-runtimeexecutor (= 0.72.5) - React-debug (0.72.5) - - React-hermes (0.72.5): - - DoubleConversion - - glog - - hermes-engine - - RCT-Folly (= 2021.07.22.00) - - RCT-Folly/Futures (= 2021.07.22.00) - - React-cxxreact (= 0.72.5) - - React-jsi - - React-jsiexecutor (= 0.72.5) - - React-jsinspector (= 0.72.5) - - React-perflogger (= 0.72.5) + - React-jsc (0.72.5): + - React-jsc/Fabric (= 0.72.5) + - React-jsi (= 0.72.5) + - React-jsc/Fabric (0.72.5): + - React-jsi (= 0.72.5) - React-jsi (0.72.5): - boost (= 1.76.0) - DoubleConversion - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-jsiexecutor (0.72.5): - DoubleConversion - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-cxxreact (= 0.72.5) - React-jsi (= 0.72.5) @@ -402,7 +369,6 @@ PODS: - react-native-version-number (0.3.6): - React - React-NativeModulesApple (0.72.5): - - hermes-engine - React-callinvoker - React-Core - React-cxxreact @@ -426,14 +392,13 @@ PODS: - RCTTypeSafety - React-Core - React-CoreModules - - React-hermes + - React-jsc - React-NativeModulesApple - React-RCTImage - React-RCTNetwork - React-runtimescheduler - ReactCommon/turbomodule/core - React-RCTBlob (0.72.5): - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Codegen (= 0.72.5) - React-Core/RCTBlobHeaders (= 0.72.5) @@ -481,7 +446,6 @@ PODS: - React-jsi (= 0.72.5) - React-runtimescheduler (0.72.5): - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-callinvoker - React-debug @@ -494,7 +458,6 @@ PODS: - ReactCommon/turbomodule/bridging (0.72.5): - DoubleConversion - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-callinvoker (= 0.72.5) - React-cxxreact (= 0.72.5) @@ -504,7 +467,6 @@ PODS: - ReactCommon/turbomodule/core (0.72.5): - DoubleConversion - glog - - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-callinvoker (= 0.72.5) - React-cxxreact (= 0.72.5) @@ -544,7 +506,6 @@ PODS: - DoubleConversion - FBLazyVector - glog - - hermes-engine - RCT-Folly - RCTRequired - RCTTypeSafety @@ -554,7 +515,6 @@ PODS: - React-Core/RCTWebSocket - React-CoreModules - React-cxxreact - - React-hermes - React-jsi - React-jsiexecutor - React-jsinspector @@ -592,8 +552,6 @@ DEPENDENCIES: - FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`) - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) - GoogleUtilities - - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) - - libevent (~> 2.1.12) - Permission-Camera (from `../node_modules/react-native-permissions/ios/Camera`) - Permission-Notifications (from `../node_modules/react-native-permissions/ios/Notifications`) - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) @@ -607,7 +565,7 @@ DEPENDENCIES: - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) - React-debug (from `../node_modules/react-native/ReactCommon/react/debug`) - - React-hermes (from `../node_modules/react-native/ReactCommon/hermes`) + - React-jsc (from `../node_modules/react-native/ReactCommon/jsc`) - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) @@ -662,7 +620,6 @@ SPEC REPOS: - fmt - GoogleDataTransport - GoogleUtilities - - libevent - nanopb - PromisesObjC - Sentry @@ -680,9 +637,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/React/FBReactNativeSpec" glog: :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" - hermes-engine: - :podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec" - :tag: hermes-2023-08-07-RNv0.72.4-813b2def12bc9df02654b3e3653ae4a68d0572e0 Permission-Camera: :path: "../node_modules/react-native-permissions/ios/Camera" Permission-Notifications: @@ -707,8 +661,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/cxxreact" React-debug: :path: "../node_modules/react-native/ReactCommon/react/debug" - React-hermes: - :path: "../node_modules/react-native/ReactCommon/hermes" + React-jsc: + :path: "../node_modules/react-native/ReactCommon/jsc" React-jsi: :path: "../node_modules/react-native/ReactCommon/jsi" React-jsiexecutor: @@ -795,8 +749,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/yoga" SPEC CHECKSUMS: - boost: 57d2868c099736d80fcd648bf211b4431e51a558 - DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 + boost: a7c83b31436843459a1961bfd74b96033dc77234 + DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 FBLazyVector: 71803c074f6325f10b5ec891c443b6bbabef0ca7 FBReactNativeSpec: 448e08a759d29a96e15725ae532445bf4343567c Firebase: f92fc551ead69c94168d36c2b26188263860acd9 @@ -806,11 +760,9 @@ SPEC CHECKSUMS: FirebaseInstallations: e842042ec6ac1fd2e37d7706363ebe7f662afea4 FirebaseMessaging: e345b219fd15d325f0cf2fef28cb8ce00d851b3f fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 - glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b + glog: 85ecdd10ee8d8ec362ef519a6a45ff9aa27b2e85 GoogleDataTransport: 57c22343ab29bc686febbf7cbb13bad167c2d8fe GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34 - hermes-engine: f6cf92a471053245614d9d8097736f6337d5b86c - libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 nanopb: d4d75c12cd1316f4a64e3c6963f879ecd4b5e0d5 Permission-Camera: 9c8b1a826770a6feea747cc8a4a89d2b39df4273 Permission-Notifications: 05a9c72e2ae989d28eb1eecf3d6a12daba73d375 @@ -820,26 +772,26 @@ SPEC CHECKSUMS: RCTTypeSafety: 4636e4a36c7c2df332bda6d59b19b41c443d4287 React: e0cc5197a804031a6c53fb38483c3485fcb9d6f3 React-callinvoker: 1a635856fe0c3d8b13fccd4ed7e76283b99b0868 - React-Codegen: 8169df63a7d5731337aad8f3c911a349a55932d3 - React-Core: cb6fb2637b5828a0944d4afc1c8678ffff570dcc + React-Codegen: 9cf2110ff377a905cd84f291b31fee39caed81b4 + React-Core: c44c3146bfb7d122cbd2ad572d2403457244bed5 React-CoreModules: c39f9ef5cf812b2b266c63364a8969b29d30ba2a - React-cxxreact: 70284b32dcd367439d7dae84d9f72660544181b5 + React-cxxreact: 2fd17904f2d5ab7318e5432cf24de225cbf1768f React-debug: 93d183299eb4bd7b0bf8cb6e376f608e2a95b64f - React-hermes: 91f97ea2669dc5847e1f26c243aaad913319c570 - React-jsi: bd68b7779746014f01ea72d1b738809e132d7f1e - React-jsiexecutor: ff70a72027dea5cc7d71cfcc6fad7f599f63987a + React-jsc: f4a2687433840ec8c1be9d2f557fe71a7b5e66b5 + React-jsi: bd20f0acd279dee534d8b731b31131f443b00868 + React-jsiexecutor: f32f98d8ddbdfd97dea286af90381a731d68c505 React-jsinspector: aef73cbd43b70675f572214d10fa438c89bf11ba React-logger: 2e4aee3e11b3ec4fa6cfd8004610bbb3b8d6cca4 react-native-pager-view: da490aa1f902c9a5aeecf0909cc975ad0e92e53e react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846 react-native-safe-area-context: 68b07eabfb0d14547d36f6929c0e98d818064f02 react-native-version-number: b415bbec6a13f2df62bf978e85bc0d699462f37f - React-NativeModulesApple: 54adc761c7a6fa5f183ca62ad0cb94f4f1cdce4a + React-NativeModulesApple: 535e26db03f74ecc500748ce79fa349b2ee2ee21 React-perflogger: cd8886513f68e1c135a1e79d20575c6489641597 React-RCTActionSheet: 726d2615ca62a77ce3e2c13d87f65379cdc73498 React-RCTAnimation: 0dcffbaab5acd05334d1d3b157f9275291e3a15b - React-RCTAppDelegate: 48df00f9da9e3019fa0759d1ca900e9f586ef1b1 - React-RCTBlob: 5ccfb7a8353fad6edaf9a2456e184ceca8c77150 + React-RCTAppDelegate: 45099a63e41201a97ec9c2da0b818ec099b96658 + React-RCTBlob: 066b6f215e44a05f53f6c8da8f14d5a06d00eb54 React-RCTImage: a80cc7170c7cd07b7b109353c605930b24d14bcf React-RCTLinking: fb1add50b83dc4f3d39526d4ff5127f171cdad86 React-RCTNetwork: 6acdb13f8df6cff487f87ac799a3839ce1d45dac @@ -848,9 +800,9 @@ SPEC CHECKSUMS: React-RCTVibration: abb9c73984f4f0052cf50efe0ae6d6f877a74843 React-rncore: 3775c85216adc845837e5420c823a689aeaae630 React-runtimeexecutor: 7e31e2bc6d0ecc83d4ba05eadc98401007abc10c - React-runtimescheduler: f248b96bdf61c5e078d3fa689adce6894c900659 + React-runtimescheduler: cf556acfc14dd4322d3337c70dd44c2742850ca5 React-utils: 40cdd9acee23230df5b78bf78a64ce8a2084c2d0 - ReactCommon: 4ec7cc40d091eed0a510755619940b6a03cb507b + ReactCommon: c16d3a77f8fc5d3e0df30c2ac4eac82fbc9aeb8c ReactNativeCameraKit: 9d46a5d7dd544ca64aa9c03c150d2348faf437eb ReactNativeExceptionHandler: b11ff67c78802b2f62eed0e10e75cb1ef7947c60 RNCAsyncStorage: 4b98ac3c64efa4e35c1197cb0c5ca5e9f5d4c666 @@ -862,7 +814,7 @@ SPEC CHECKSUMS: RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81 RNNotifee: 5155e0a5e0a97d0c839030d8192783cd63053999 RNPermissions: d9db16f082ce2e09908e58c925189e2637d2786b - RNReanimated: ab2e96c6d5591c3dfbb38a464f54c8d17fb34a87 + RNReanimated: bdadbf5322d7894bb6016985d8ae5c9ed5fc83d0 RNScreens: 50ffe2fa2342eabb2d0afbe19f7c1af286bc7fb3 RNSentry: 9f0447b3ce13806f544903748de423259ead8552 RNSVG: 80584470ff1ffc7994923ea135a3e5ad825546b9 @@ -872,6 +824,6 @@ SPEC CHECKSUMS: SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Yoga: 86fed2e4d425ee4c6eab3813ba1791101ee153c6 -PODFILE CHECKSUM: c422aedd0c3b236578801088c8afef28030c3c83 +PODFILE CHECKSUM: 2332b5f23b4af59724282b2fb1d104e41fe0d7a7 -COCOAPODS: 1.13.0 +COCOAPODS: 1.14.3 diff --git a/lockdown.umd.js b/lockdown.umd.js new file mode 100644 index 000000000..8e4a7d1d1 --- /dev/null +++ b/lockdown.umd.js @@ -0,0 +1,11243 @@ +// ses@1.0.1 +'use strict'; +(() => { + const functors = [ +// === functors[0] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([]); /* global globalThis */ +/* eslint-disable no-restricted-globals */ + +/** + * commons.js + * Declare shorthand functions. Sharing these declarations across modules + * improves on consistency and minification. Unused declarations are + * dropped by the tree shaking process. + * + * We capture these, not just for brevity, but for security. If any code + * modifies Object to change what 'assign' points to, the Compartment shim + * would be corrupted. + */ + +// We cannot use globalThis as the local name since it would capture the +// lexical name. +const universalThis= globalThis;$h‍_once.universalThis(universalThis); + + +const { + Array, + Date, + FinalizationRegistry, + Float32Array, + JSON, + Map, + Math, + Number, + Object, + Promise, + Proxy, + Reflect, + RegExp: FERAL_REG_EXP, + Set, + String, + Symbol, + WeakMap, + WeakSet}= + globalThis;$h‍_once.Array(Array);$h‍_once.Date(Date);$h‍_once.FinalizationRegistry(FinalizationRegistry);$h‍_once.Float32Array(Float32Array);$h‍_once.JSON(JSON);$h‍_once.Map(Map);$h‍_once.Math(Math);$h‍_once.Number(Number);$h‍_once.Object(Object);$h‍_once.Promise(Promise);$h‍_once.Proxy(Proxy);$h‍_once.Reflect(Reflect);$h‍_once.FERAL_REG_EXP(FERAL_REG_EXP);$h‍_once.Set(Set);$h‍_once.String(String);$h‍_once.Symbol(Symbol);$h‍_once.WeakMap(WeakMap);$h‍_once.WeakSet(WeakSet); + +const { + // The feral Error constructor is safe for internal use, but must not be + // revealed to post-lockdown code in any compartment including the start + // compartment since in V8 at least it bears stack inspection capabilities. + Error: FERAL_ERROR, + RangeError, + ReferenceError, + SyntaxError, + TypeError}= + globalThis;$h‍_once.FERAL_ERROR(FERAL_ERROR);$h‍_once.RangeError(RangeError);$h‍_once.ReferenceError(ReferenceError);$h‍_once.SyntaxError(SyntaxError);$h‍_once.TypeError(TypeError); + +const { + assign, + create, + defineProperties, + entries, + freeze, + getOwnPropertyDescriptor, + getOwnPropertyDescriptors, + getOwnPropertyNames, + getPrototypeOf, + is, + isFrozen, + isSealed, + isExtensible, + keys, + prototype: objectPrototype, + seal, + preventExtensions, + setPrototypeOf, + values, + fromEntries}= + Object;$h‍_once.assign(assign);$h‍_once.create(create);$h‍_once.defineProperties(defineProperties);$h‍_once.entries(entries);$h‍_once.freeze(freeze);$h‍_once.getOwnPropertyDescriptor(getOwnPropertyDescriptor);$h‍_once.getOwnPropertyDescriptors(getOwnPropertyDescriptors);$h‍_once.getOwnPropertyNames(getOwnPropertyNames);$h‍_once.getPrototypeOf(getPrototypeOf);$h‍_once.is(is);$h‍_once.isFrozen(isFrozen);$h‍_once.isSealed(isSealed);$h‍_once.isExtensible(isExtensible);$h‍_once.keys(keys);$h‍_once.objectPrototype(objectPrototype);$h‍_once.seal(seal);$h‍_once.preventExtensions(preventExtensions);$h‍_once.setPrototypeOf(setPrototypeOf);$h‍_once.values(values);$h‍_once.fromEntries(fromEntries); + +const { + species: speciesSymbol, + toStringTag: toStringTagSymbol, + iterator: iteratorSymbol, + matchAll: matchAllSymbol, + unscopables: unscopablesSymbol, + keyFor: symbolKeyFor, + for: symbolFor}= + Symbol;$h‍_once.speciesSymbol(speciesSymbol);$h‍_once.toStringTagSymbol(toStringTagSymbol);$h‍_once.iteratorSymbol(iteratorSymbol);$h‍_once.matchAllSymbol(matchAllSymbol);$h‍_once.unscopablesSymbol(unscopablesSymbol);$h‍_once.symbolKeyFor(symbolKeyFor);$h‍_once.symbolFor(symbolFor); + +const { isInteger}= Number;$h‍_once.isInteger(isInteger); + +const { stringify: stringifyJson}= JSON; + +// Needed only for the Safari bug workaround below +$h‍_once.stringifyJson(stringifyJson);const{defineProperty:originalDefineProperty}=Object; + +const defineProperty= (object, prop, descriptor)=> { + // We used to do the following, until we had to reopen Safari bug + // https://bugs.webkit.org/show_bug.cgi?id=222538#c17 + // Once this is fixed, we may restore it. + // // Object.defineProperty is allowed to fail silently so we use + // // Object.defineProperties instead. + // return defineProperties(object, { [prop]: descriptor }); + + // Instead, to workaround the Safari bug + const result= originalDefineProperty(object, prop, descriptor); + if( result!== object) { + // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_DEFINE_PROPERTY_FAILED_SILENTLY.md + throw TypeError( + `Please report that the original defineProperty silently failed to set ${stringifyJson( + String(prop)) + }. (SES_DEFINE_PROPERTY_FAILED_SILENTLY)`); + + } + return result; + };$h‍_once.defineProperty(defineProperty); + +const { + apply, + construct, + get: reflectGet, + getOwnPropertyDescriptor: reflectGetOwnPropertyDescriptor, + has: reflectHas, + isExtensible: reflectIsExtensible, + ownKeys, + preventExtensions: reflectPreventExtensions, + set: reflectSet}= + Reflect;$h‍_once.apply(apply);$h‍_once.construct(construct);$h‍_once.reflectGet(reflectGet);$h‍_once.reflectGetOwnPropertyDescriptor(reflectGetOwnPropertyDescriptor);$h‍_once.reflectHas(reflectHas);$h‍_once.reflectIsExtensible(reflectIsExtensible);$h‍_once.ownKeys(ownKeys);$h‍_once.reflectPreventExtensions(reflectPreventExtensions);$h‍_once.reflectSet(reflectSet); + +const { isArray, prototype: arrayPrototype}= Array;$h‍_once.isArray(isArray);$h‍_once.arrayPrototype(arrayPrototype); +const { prototype: mapPrototype}= Map;$h‍_once.mapPrototype(mapPrototype); +const { revocable: proxyRevocable}= Proxy;$h‍_once.proxyRevocable(proxyRevocable); +const { prototype: regexpPrototype}= RegExp;$h‍_once.regexpPrototype(regexpPrototype); +const { prototype: setPrototype}= Set;$h‍_once.setPrototype(setPrototype); +const { prototype: stringPrototype}= String;$h‍_once.stringPrototype(stringPrototype); +const { prototype: weakmapPrototype}= WeakMap;$h‍_once.weakmapPrototype(weakmapPrototype); +const { prototype: weaksetPrototype}= WeakSet;$h‍_once.weaksetPrototype(weaksetPrototype); +const { prototype: functionPrototype}= Function;$h‍_once.functionPrototype(functionPrototype); +const { prototype: promisePrototype}= Promise;$h‍_once.promisePrototype(promisePrototype); + +const typedArrayPrototype= getPrototypeOf(Uint8Array.prototype);$h‍_once.typedArrayPrototype(typedArrayPrototype); + +const { bind}= functionPrototype; + +/** + * uncurryThis() + * Equivalent of: fn => (thisArg, ...args) => apply(fn, thisArg, args) + * + * See those reference for a complete explanation: + * http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming + * which only lives at + * http://web.archive.org/web/20160805225710/http://wiki.ecmascript.org/doku.php?id=conventions:safe_meta_programming + * + * @type { any>(fn: F) => ((thisArg: ThisParameterType, ...args: Parameters) => ReturnType)} + */ +const uncurryThis= bind.bind(bind.call); // eslint-disable-line @endo/no-polymorphic-call +$h‍_once.uncurryThis(uncurryThis); +const objectHasOwnProperty= uncurryThis(objectPrototype.hasOwnProperty); +// +$h‍_once.objectHasOwnProperty(objectHasOwnProperty);const arrayFilter=uncurryThis(arrayPrototype.filter);$h‍_once.arrayFilter(arrayFilter); +const arrayForEach= uncurryThis(arrayPrototype.forEach);$h‍_once.arrayForEach(arrayForEach); +const arrayIncludes= uncurryThis(arrayPrototype.includes);$h‍_once.arrayIncludes(arrayIncludes); +const arrayJoin= uncurryThis(arrayPrototype.join); +/** @type {(thisArg: readonly T[], callbackfn: (value: T, index: number, array: T[]) => U, cbThisArg?: any) => U[]} */$h‍_once.arrayJoin(arrayJoin); +const arrayMap= /** @type {any} */ uncurryThis(arrayPrototype.map);$h‍_once.arrayMap(arrayMap); +const arrayPop= uncurryThis(arrayPrototype.pop); +/** @type {(thisArg: T[], ...items: T[]) => number} */$h‍_once.arrayPop(arrayPop); +const arrayPush= uncurryThis(arrayPrototype.push);$h‍_once.arrayPush(arrayPush); +const arraySlice= uncurryThis(arrayPrototype.slice);$h‍_once.arraySlice(arraySlice); +const arraySome= uncurryThis(arrayPrototype.some);$h‍_once.arraySome(arraySome); +const arraySort= uncurryThis(arrayPrototype.sort);$h‍_once.arraySort(arraySort); +const iterateArray= uncurryThis(arrayPrototype[iteratorSymbol]); +// +$h‍_once.iterateArray(iterateArray);const mapSet=uncurryThis(mapPrototype.set);$h‍_once.mapSet(mapSet); +const mapGet= uncurryThis(mapPrototype.get);$h‍_once.mapGet(mapGet); +const mapHas= uncurryThis(mapPrototype.has);$h‍_once.mapHas(mapHas); +const mapDelete= uncurryThis(mapPrototype.delete);$h‍_once.mapDelete(mapDelete); +const mapEntries= uncurryThis(mapPrototype.entries);$h‍_once.mapEntries(mapEntries); +const iterateMap= uncurryThis(mapPrototype[iteratorSymbol]); +// +$h‍_once.iterateMap(iterateMap);const setAdd=uncurryThis(setPrototype.add);$h‍_once.setAdd(setAdd); +const setDelete= uncurryThis(setPrototype.delete);$h‍_once.setDelete(setDelete); +const setForEach= uncurryThis(setPrototype.forEach);$h‍_once.setForEach(setForEach); +const setHas= uncurryThis(setPrototype.has);$h‍_once.setHas(setHas); +const iterateSet= uncurryThis(setPrototype[iteratorSymbol]); +// +$h‍_once.iterateSet(iterateSet);const regexpTest=uncurryThis(regexpPrototype.test);$h‍_once.regexpTest(regexpTest); +const regexpExec= uncurryThis(regexpPrototype.exec);$h‍_once.regexpExec(regexpExec); +const matchAllRegExp= uncurryThis(regexpPrototype[matchAllSymbol]); +// +$h‍_once.matchAllRegExp(matchAllRegExp);const stringEndsWith=uncurryThis(stringPrototype.endsWith);$h‍_once.stringEndsWith(stringEndsWith); +const stringIncludes= uncurryThis(stringPrototype.includes);$h‍_once.stringIncludes(stringIncludes); +const stringIndexOf= uncurryThis(stringPrototype.indexOf);$h‍_once.stringIndexOf(stringIndexOf); +const stringMatch= uncurryThis(stringPrototype.match); +/** + * @type { & + * ((thisArg: string, searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string) => string) & + * ((thisArg: string, searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string) => string) + * } + */$h‍_once.stringMatch(stringMatch); +const stringReplace= /** @type {any} */ + uncurryThis(stringPrototype.replace);$h‍_once.stringReplace(stringReplace); + +const stringSearch= uncurryThis(stringPrototype.search);$h‍_once.stringSearch(stringSearch); +const stringSlice= uncurryThis(stringPrototype.slice); +/** @type {(thisArg: string, splitter: string | RegExp | { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number) => string[]} */$h‍_once.stringSlice(stringSlice); +const stringSplit= uncurryThis(stringPrototype.split);$h‍_once.stringSplit(stringSplit); +const stringStartsWith= uncurryThis(stringPrototype.startsWith);$h‍_once.stringStartsWith(stringStartsWith); +const iterateString= uncurryThis(stringPrototype[iteratorSymbol]); +// +$h‍_once.iterateString(iterateString);const weakmapDelete=uncurryThis(weakmapPrototype.delete); +/** @type {(thisArg: WeakMap, ...args: Parameters['get']>) => ReturnType['get']>} */$h‍_once.weakmapDelete(weakmapDelete); +const weakmapGet= uncurryThis(weakmapPrototype.get);$h‍_once.weakmapGet(weakmapGet); +const weakmapHas= uncurryThis(weakmapPrototype.has);$h‍_once.weakmapHas(weakmapHas); +const weakmapSet= uncurryThis(weakmapPrototype.set); +// +$h‍_once.weakmapSet(weakmapSet);const weaksetAdd=uncurryThis(weaksetPrototype.add);$h‍_once.weaksetAdd(weaksetAdd); +const weaksetHas= uncurryThis(weaksetPrototype.has); +// +$h‍_once.weaksetHas(weaksetHas);const functionToString=uncurryThis(functionPrototype.toString); +// +$h‍_once.functionToString(functionToString);const{all}=Promise; +const promiseAll= (promises)=>apply(all, Promise, [promises]);$h‍_once.promiseAll(promiseAll); +const promiseCatch= uncurryThis(promisePrototype.catch); +/** @type {(thisArg: T, onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null) => Promise} */$h‍_once.promiseCatch(promiseCatch); +const promiseThen= /** @type {any} */ + uncurryThis(promisePrototype.then); + +// +$h‍_once.promiseThen(promiseThen);const finalizationRegistryRegister= + FinalizationRegistry&& uncurryThis(FinalizationRegistry.prototype.register);$h‍_once.finalizationRegistryRegister(finalizationRegistryRegister); +const finalizationRegistryUnregister= + FinalizationRegistry&& + uncurryThis(FinalizationRegistry.prototype.unregister); + +/** + * getConstructorOf() + * Return the constructor from an instance. + * + * @param {Function} fn + */$h‍_once.finalizationRegistryUnregister(finalizationRegistryUnregister); +const getConstructorOf= (fn)=> + reflectGet(getPrototypeOf(fn), 'constructor'); + +/** + * immutableObject + * An immutable (frozen) empty object that is safe to share. + */$h‍_once.getConstructorOf(getConstructorOf); +const immutableObject= freeze(create(null)); + +/** + * isObject tests whether a value is an object. + * Today, this is equivalent to: + * + * const isObject = value => { + * if (value === null) return false; + * const type = typeof value; + * return type === 'object' || type === 'function'; + * }; + * + * But this is not safe in the face of possible evolution of the language, for + * example new types or semantics of records and tuples. + * We use this implementation despite the unnecessary allocation implied by + * attempting to box a primitive. + * + * @param {any} value + */$h‍_once.immutableObject(immutableObject); +const isObject= (value)=>Object(value)=== value; + +/** + * isError tests whether an object inherits from the intrinsic + * `Error.prototype`. + * We capture the original error constructor as FERAL_ERROR to provide a clear + * signal for reviewers that we are handling an object with excess authority, + * like stack trace inspection, that we are carefully hiding from client code. + * Checking instanceof happens to be safe, but to avoid uttering FERAL_ERROR + * for such a trivial case outside commons.js, we provide a utility function. + * + * @param {any} value + */$h‍_once.isObject(isObject); +const isError= (value)=>value instanceof FERAL_ERROR; + +// The original unsafe untamed eval function, which must not escape. +// Sample at module initialization time, which is before lockdown can +// repair it. Use it only to build powerless abstractions. +// eslint-disable-next-line no-eval +$h‍_once.isError(isError);const FERAL_EVAL=eval; + +// The original unsafe untamed Function constructor, which must not escape. +// Sample at module initialization time, which is before lockdown can +// repair it. Use it only to build powerless abstractions. +$h‍_once.FERAL_EVAL(FERAL_EVAL);const FERAL_FUNCTION=Function;$h‍_once.FERAL_FUNCTION(FERAL_FUNCTION); + +const noEvalEvaluate= ()=> { + // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_NO_EVAL.md + throw TypeError('Cannot eval with evalTaming set to "noEval" (SES_NO_EVAL)'); + };$h‍_once.noEvalEvaluate(noEvalEvaluate); +})() +, +// === functors[1] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let TypeError;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]]]]]); + +/** getThis returns globalThis in sloppy mode or undefined in strict mode. */ +function getThis() { + return this; + } + +if( getThis()) { + // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_NO_SLOPPY.md + throw TypeError( `SES failed to initialize, sloppy mode (SES_NO_SLOPPY)`); + } +})() +, +// === functors[2] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([]); // @ts-check + +// `@endo/env-options` needs to be imported quite early, and so should +// avoid importing from ses or anything that depends on ses. + +// ///////////////////////////////////////////////////////////////////////////// +// Prelude of cheap good - enough imitations of things we'd use or +// do differently if we could depend on ses + +const { freeze}= Object; +const { apply}= Reflect; + +// Should be equivalent to the one in ses' commons.js even though it +// uses the other technique. +const uncurryThis= + (fn)=> + (receiver, ...args)=> + apply(fn, receiver, args); +const arrayPush= uncurryThis(Array.prototype.push); + +const q= JSON.stringify; + +const Fail= (literals, ...args)=> { + let msg= literals[0]; + for( let i= 0; i< args.length; i+= 1) { + msg= `${msg}${args[i]}${literals[i+ 1] }`; + } + throw Error(msg); + }; + +// end prelude +// ///////////////////////////////////////////////////////////////////////////// + +/** + * `makeEnvironmentCaptor` provides a mechanism for getting environment + * variables, if they are needed, and a way to catalog the names of all + * the environment variables that were captured. + * + * @param {object} aGlobal + */ +const makeEnvironmentCaptor= (aGlobal)=>{ + const capturedEnvironmentOptionNames= []; + + /** + * Gets an environment option by name and returns the option value or the + * given default. + * + * @param {string} optionName + * @param {string} defaultSetting + * @returns {string} + */ + const getEnvironmentOption= (optionName, defaultSetting)=> { + // eslint-disable-next-line @endo/no-polymorphic-call + typeof optionName=== 'string'|| + Fail `Environment option name ${q(optionName)} must be a string.`; + // eslint-disable-next-line @endo/no-polymorphic-call + typeof defaultSetting=== 'string'|| + Fail `Environment option default setting ${q( + defaultSetting) + } must be a string.`; + + /** @type {string} */ + let setting= defaultSetting; + const globalProcess= aGlobal.process; + if( globalProcess&& typeof globalProcess=== 'object') { + const globalEnv= globalProcess.env; + if( globalEnv&& typeof globalEnv=== 'object') { + if( optionName in globalEnv) { + arrayPush(capturedEnvironmentOptionNames, optionName); + const optionValue= globalEnv[optionName]; + // eslint-disable-next-line @endo/no-polymorphic-call + typeof optionValue=== 'string'|| + Fail `Environment option named ${q( + optionName) + }, if present, must have a corresponding string value, got ${q( + optionValue) + }`; + setting= optionValue; + } + } + } + return setting; + }; + freeze(getEnvironmentOption); + + const getCapturedEnvironmentOptionNames= ()=> { + return freeze([...capturedEnvironmentOptionNames]); + }; + freeze(getCapturedEnvironmentOptionNames); + + return freeze({ getEnvironmentOption, getCapturedEnvironmentOptionNames}); + };$h‍_once.makeEnvironmentCaptor(makeEnvironmentCaptor); +freeze(makeEnvironmentCaptor); +})() +, +// === functors[3] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([["./src/env-options.js", []]]); +})() +, +// === functors[4] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Set,String,isArray,arrayJoin,arraySlice,arraySort,arrayMap,keys,fromEntries,freeze,is,isError,setAdd,setHas,stringIncludes,stringStartsWith,stringifyJson,toStringTagSymbol;$h‍_imports([["../commons.js", [["Set", [$h‍_a => (Set = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["isArray", [$h‍_a => (isArray = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arraySlice", [$h‍_a => (arraySlice = $h‍_a)]],["arraySort", [$h‍_a => (arraySort = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["keys", [$h‍_a => (keys = $h‍_a)]],["fromEntries", [$h‍_a => (fromEntries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["isError", [$h‍_a => (isError = $h‍_a)]],["setAdd", [$h‍_a => (setAdd = $h‍_a)]],["setHas", [$h‍_a => (setHas = $h‍_a)]],["stringIncludes", [$h‍_a => (stringIncludes = $h‍_a)]],["stringStartsWith", [$h‍_a => (stringStartsWith = $h‍_a)]],["stringifyJson", [$h‍_a => (stringifyJson = $h‍_a)]],["toStringTagSymbol", [$h‍_a => (toStringTagSymbol = $h‍_a)]]]]]); + + + + + + + + + + + + + + + + + + + + + + +/** + * Joins English terms with commas and an optional conjunction. + * + * @param {(string | StringablePayload)[]} terms + * @param {"and" | "or"} conjunction + */ +const enJoin= (terms, conjunction)=> { + if( terms.length=== 0) { + return '(none)'; + }else if( terms.length=== 1) { + return terms[0]; + }else if( terms.length=== 2) { + const [first, second]= terms; + return `${first} ${conjunction} ${second}`; + }else { + return `${arrayJoin(arraySlice(terms,0, -1), ', ') }, ${conjunction} ${ + terms[terms.length- 1] + }`; + } + }; + +/** + * Prepend the correct indefinite article onto a noun, typically a typeof + * result, e.g., "an object" vs. "a number" + * + * @param {string} str The noun to prepend + * @returns {string} The noun prepended with a/an + */$h‍_once.enJoin(enJoin); +const an= (str)=>{ + str= `${str}`; + if( str.length>= 1&& stringIncludes('aeiouAEIOU', str[0])) { + return `an ${str}`; + } + return `a ${str}`; + };$h‍_once.an(an); +freeze(an); + + +/** + * Like `JSON.stringify` but does not blow up if given a cycle or a bigint. + * This is not + * intended to be a serialization to support any useful unserialization, + * or any programmatic use of the resulting string. The string is intended + * *only* for showing a human under benign conditions, in order to be + * informative enough for some + * logging purposes. As such, this `bestEffortStringify` has an + * imprecise specification and may change over time. + * + * The current `bestEffortStringify` possibly emits too many "seen" + * markings: Not only for cycles, but also for repeated subtrees by + * object identity. + * + * As a best effort only for diagnostic interpretation by humans, + * `bestEffortStringify` also turns various cases that normal + * `JSON.stringify` skips or errors on, like `undefined` or bigints, + * into strings that convey their meaning. To distinguish this from + * strings in the input, these synthesized strings always begin and + * end with square brackets. To distinguish those strings from an + * input string with square brackets, and input string that starts + * with an open square bracket `[` is itself placed in square brackets. + * + * @param {any} payload + * @param {(string|number)=} spaces + * @returns {string} + */ +const bestEffortStringify= (payload, spaces= undefined)=> { + const seenSet= new Set(); + const replacer= (_, val)=> { + switch( typeof val){ + case 'object': { + if( val=== null) { + return null; + } + if( setHas(seenSet, val)) { + return '[Seen]'; + } + setAdd(seenSet, val); + if( isError(val)) { + return `[${val.name}: ${val.message}]`; + } + if( toStringTagSymbol in val) { + // For the built-ins that have or inherit a `Symbol.toStringTag`-named + // property, most of them inherit the default `toString` method, + // which will print in a similar manner: `"[object Foo]"` vs + // `"[Foo]"`. The exceptions are + // * `Symbol.prototype`, `BigInt.prototype`, `String.prototype` + // which don't matter to us since we handle primitives + // separately and we don't care about primitive wrapper objects. + // * TODO + // `Date.prototype`, `TypedArray.prototype`. + // Hmmm, we probably should make special cases for these. We're + // not using these yet, so it's not urgent. But others will run + // into these. + // + // Once #2018 is closed, the only objects in our code that have or + // inherit a `Symbol.toStringTag`-named property are remotables + // or their remote presences. + // This printing will do a good job for these without + // violating abstraction layering. This behavior makes sense + // purely in terms of JavaScript concepts. That's some of the + // motivation for choosing that representation of remotables + // and their remote presences in the first place. + return `[${val[toStringTagSymbol]}]`; + } + if( isArray(val)) { + return val; + } + const names= keys(val); + if( names.length< 2) { + return val; + } + let sorted= true; + for( let i= 1; i< names.length; i+= 1) { + if( names[i- 1]>= names[i]) { + sorted= false; + break; + } + } + if( sorted) { + return val; + } + arraySort(names); + const entries= arrayMap(names, (name)=>[name, val[name]]); + return fromEntries(entries); + } + case 'function': { + return `[Function ${val.name|| '' }]`; + } + case 'string': { + if( stringStartsWith(val, '[')) { + return `[${val}]`; + } + return val; + } + case 'undefined': + case 'symbol': { + return `[${String(val)}]`; + } + case 'bigint': { + return `[${val}n]`; + } + case 'number': { + if( is(val, NaN)) { + return '[NaN]'; + }else if( val=== Infinity) { + return '[Infinity]'; + }else if( val=== -Infinity) { + return '[-Infinity]'; + } + return val; + } + default: { + return val; + }} + + }; + try { + return stringifyJson(payload, replacer, spaces); + }catch( _err) { + // Don't do anything more fancy here if there is any + // chance that might throw, unless you surround that + // with another try-catch-recovery. For example, + // the caught thing might be a proxy or other exotic + // object rather than an error. The proxy might throw + // whenever it is possible for it to. + return '[Something that failed to stringify]'; + } + };$h‍_once.bestEffortStringify(bestEffortStringify); +freeze(bestEffortStringify); +})() +, +// === functors[5] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([]); // @ts-check + +/** + * @callback BaseAssert + * The `assert` function itself. + * + * @param {any} flag The truthy/falsy value + * @param {Details=} optDetails The details to throw + * @param {ErrorConstructor=} ErrorConstructor An optional alternate error + * constructor to use. + * @returns {asserts flag} + */ + +/** + * @typedef {object} AssertMakeErrorOptions + * @property {string=} errorName + */ + +/** + * @callback AssertMakeError + * + * The `assert.error` method, recording details for the console. + * + * The optional `optDetails` can be a string. + * @param {Details=} optDetails The details of what was asserted + * @param {ErrorConstructor=} ErrorConstructor An optional alternate error + * constructor to use. + * @param {AssertMakeErrorOptions=} options + * @returns {Error} + */ + +/** + * @callback AssertFail + * + * The `assert.fail` method. + * + * Fail an assertion, recording full details to the console and + * raising an exception with a message in which `details` substitution values + * have been redacted. + * + * The optional `optDetails` can be a string for backwards compatibility + * with the nodejs assertion library. + * @param {Details=} optDetails The details of what was asserted + * @param {ErrorConstructor=} ErrorConstructor An optional alternate error + * constructor to use. + * @returns {never} + */ + +/** + * @callback AssertEqual + * The `assert.equal` method + * + * Assert that two values must be `Object.is`. + * @param {any} actual The value we received + * @param {any} expected What we wanted + * @param {Details=} optDetails The details to throw + * @param {ErrorConstructor=} ErrorConstructor An optional alternate error + * constructor to use. + * @returns {void} + */ + +// Type all the overloads of the assertTypeof function. +// There may eventually be a better way to do this, but +// thems the breaks with Typescript 4.0. +/** + * @callback AssertTypeofBigint + * @param {any} specimen + * @param {'bigint'} typename + * @param {Details=} optDetails + * @returns {asserts specimen is bigint} + */ + +/** + * @callback AssertTypeofBoolean + * @param {any} specimen + * @param {'boolean'} typename + * @param {Details=} optDetails + * @returns {asserts specimen is boolean} + */ + +/** + * @callback AssertTypeofFunction + * @param {any} specimen + * @param {'function'} typename + * @param {Details=} optDetails + * @returns {asserts specimen is Function} + */ + +/** + * @callback AssertTypeofNumber + * @param {any} specimen + * @param {'number'} typename + * @param {Details=} optDetails + * @returns {asserts specimen is number} + */ + +/** + * @callback AssertTypeofObject + * @param {any} specimen + * @param {'object'} typename + * @param {Details=} optDetails + * @returns {asserts specimen is Record | null} + */ + +/** + * @callback AssertTypeofString + * @param {any} specimen + * @param {'string'} typename + * @param {Details=} optDetails + * @returns {asserts specimen is string} + */ + +/** + * @callback AssertTypeofSymbol + * @param {any} specimen + * @param {'symbol'} typename + * @param {Details=} optDetails + * @returns {asserts specimen is symbol} + */ + +/** + * @callback AssertTypeofUndefined + * @param {any} specimen + * @param {'undefined'} typename + * @param {Details=} optDetails + * @returns {asserts specimen is undefined} + */ + +/** + * The `assert.typeof` method + * + * @typedef {AssertTypeofBigint & AssertTypeofBoolean & AssertTypeofFunction & AssertTypeofNumber & AssertTypeofObject & AssertTypeofString & AssertTypeofSymbol & AssertTypeofUndefined} AssertTypeof + */ + +/** + * @callback AssertString + * The `assert.string` method. + * + * `assert.string(v)` is equivalent to `assert.typeof(v, 'string')`. We + * special case this one because it is the most frequently used. + * + * Assert an expected typeof result. + * @param {any} specimen The value to get the typeof + * @param {Details=} optDetails The details to throw + * @returns {asserts specimen is string} + */ + +/** + * @callback AssertNote + * The `assert.note` method. + * + * Annotate an error with details, potentially to be used by an + * augmented console such as the causal console of `console.js`, to + * provide extra information associated with logged errors. + * + * @param {Error} error + * @param {Details} detailsNote + * @returns {void} + */ + +// ///////////////////////////////////////////////////////////////////////////// + +/** + * @typedef {{}} DetailsToken + * A call to the `details` template literal makes and returns a fresh details + * token, which is a frozen empty object associated with the arguments of that + * `details` template literal expression. + */ + +/** + * @typedef {string | DetailsToken} Details + * Either a plain string, or made by the `details` template literal tag. + */ + +/** + * @typedef {object} StringablePayload + * Holds the payload passed to quote so that its printed form is visible. + * @property {() => string} toString How to print the payload + */ + +/** + * To "declassify" and quote a substitution value used in a + * ``` details`...` ``` template literal, enclose that substitution expression + * in a call to `quote`. This makes the value appear quoted + * (as if with `JSON.stringify`) in the message of the thrown error. The + * payload itself is still passed unquoted to the console as it would be + * without `quote`. + * + * For example, the following will reveal the expected sky color, but not the + * actual incorrect sky color, in the thrown error's message: + * ```js + * sky.color === expectedColor || Fail`${sky.color} should be ${quote(expectedColor)}`; + * ``` + * + * // TODO Update SES-shim to new convention, where `details` is + * // renamed to `X` rather than `d`. + * The normal convention is to locally rename `details` to `d` and `quote` to `q` + * like `const { details: d, quote: q } = assert;`, so the above example would then be + * ```js + * sky.color === expectedColor || Fail`${sky.color} should be ${q(expectedColor)}`; + * ``` + * + * @callback AssertQuote + * @param {any} payload What to declassify + * @param {(string|number)=} spaces + * @returns {StringablePayload} The declassified payload + */ + +/** + * @callback Raise + * + * To make an `assert` which terminates some larger unit of computation + * like a transaction, vat, or process, call `makeAssert` with a `Raise` + * callback, where that callback actually performs that larger termination. + * If possible, the callback should also report its `reason` parameter as + * the alleged reason for the termination. + * + * @param {Error} reason + */ + +/** + * @callback MakeAssert + * + * Makes and returns an `assert` function object that shares the bookkeeping + * state defined by this module with other `assert` function objects made by + * `makeAssert`. This state is per-module-instance and is exposed by the + * `loggedErrorHandler` above. We refer to `assert` as a "function object" + * because it can be called directly as a function, but also has methods that + * can be called. + * + * If `optRaise` is provided, the returned `assert` function object will call + * `optRaise(reason)` before throwing the error. This enables `optRaise` to + * engage in even more violent termination behavior, like terminating the vat, + * that prevents execution from reaching the following throw. However, if + * `optRaise` returns normally, which would be unusual, the throw following + * `optRaise(reason)` would still happen. + * + * @param {Raise=} optRaise + * @param {boolean=} unredacted + * @returns {Assert} + */ + +/** + * @typedef {(template: TemplateStringsArray | string[], ...args: any) => DetailsToken} DetailsTag + * + * Use the `details` function as a template literal tag to create + * informative error messages. The assertion functions take such messages + * as optional arguments: + * ```js + * assert(sky.isBlue(), details`${sky.color} should be "blue"`); + * ``` + * // TODO Update SES-shim to new convention, where `details` is + * // renamed to `X` rather than `d`. + * or following the normal convention to locally rename `details` to `d` + * and `quote` to `q` like `const { details: d, quote: q } = assert;`: + * ```js + * assert(sky.isBlue(), d`${sky.color} should be "blue"`); + * ``` + * However, note that in most cases it is preferable to instead use the `Fail` + * template literal tag (which has the same input signature as `details` + * but automatically creates and throws an error): + * ```js + * sky.isBlue() || Fail`${sky.color} should be "blue"`; + * ``` + * + * The details template tag returns a `DetailsToken` object that can print + * itself with the formatted message in two ways. + * It will report full details to the console, but + * mask embedded substitution values with their typeof information in the thrown error + * to prevent revealing secrets up the exceptional path. In the example + * above, the thrown error may reveal only that `sky.color` is a string, + * whereas the same diagnostic printed to the console reveals that the + * sky was green. This masking can be disabled for an individual substitution value + * using `quote`. + * + * The `raw` property of an input template array is ignored, so a simple + * array of strings may be provided directly. + */ + +/** + * @typedef {(template: TemplateStringsArray | string[], ...args: any) => never} FailTag + * + * Use the `Fail` function as a template literal tag to efficiently + * create and throw a `details`-style error only when a condition is not satisfied. + * ```js + * condition || Fail`...complaint...`; + * ``` + * This avoids the overhead of creating usually-unnecessary errors like + * ```js + * assert(condition, details`...complaint...`); + * ``` + * while improving readability over alternatives like + * ```js + * condition || assert.fail(details`...complaint...`); + * ``` + * + * However, due to current weakness in TypeScript, static reasoning + * is less powerful with the `||` patterns than with an `assert` call. + * Until/unless https://github.com/microsoft/TypeScript/issues/51426 is fixed, + * for `||`-style assertions where this loss of static reasoning is a problem, + * instead express the assertion as + * ```js + * if (!condition) { + * Fail`...complaint...`; + * } + * ``` + * or, if needed, + * ```js + * if (!condition) { + * // `throw` is noop since `Fail` throws, but it improves static analysis + * throw Fail`...complaint...`; + * } + * ``` + */ + +/** + * assert that expr is truthy, with an optional details to describe + * the assertion. It is a tagged template literal like + * ```js + * assert(expr, details`....`);` + * ``` + * + * The literal portions of the template are assumed non-sensitive, as + * are the `typeof` types of the substitution values. These are + * assembled into the thrown error message. The actual contents of the + * substitution values are assumed sensitive, to be revealed to + * the console only. We assume only the virtual platform's owner can read + * what is written to the console, where the owner is in a privileged + * position over computation running on that platform. + * + * The optional `optDetails` can be a string for backwards compatibility + * with the nodejs assertion library. + * + * @typedef { BaseAssert & { + * typeof: AssertTypeof, + * error: AssertMakeError, + * fail: AssertFail, + * equal: AssertEqual, + * string: AssertString, + * note: AssertNote, + * details: DetailsTag, + * Fail: FailTag, + * quote: AssertQuote, + * bare: AssertQuote, + * makeAssert: MakeAssert, + * } } Assert + */ + +// ///////////////////////////////////////////////////////////////////////////// + +/** + * @typedef {object} VirtualConsole + * @property {Console['debug']} debug + * @property {Console['log']} log + * @property {Console['info']} info + * @property {Console['warn']} warn + * @property {Console['error']} error + * + * @property {Console['trace']} trace + * @property {Console['dirxml']} dirxml + * @property {Console['group']} group + * @property {Console['groupCollapsed']} groupCollapsed + * + * @property {Console['assert']} assert + * @property {Console['timeLog']} timeLog + * + * @property {Console['clear']} clear + * @property {Console['count']} count + * @property {Console['countReset']} countReset + * @property {Console['dir']} dir + * @property {Console['groupEnd']} groupEnd + * + * @property {Console['table']} table + * @property {Console['time']} time + * @property {Console['timeEnd']} timeEnd + * @property {Console['timeStamp']} timeStamp + */ + +/* This is deliberately *not* JSDoc, it is a regular comment. + * + * TODO: We'd like to add the following properties to the above + * VirtualConsole, but they currently cause conflicts where + * some Typescript implementations don't have these properties + * on the Console type. + * + * @property {Console['profile']} profile + * @property {Console['profileEnd']} profileEnd + */ + +/** + * @typedef {'debug' | 'log' | 'info' | 'warn' | 'error'} LogSeverity + */ + +/** + * @typedef ConsoleFilter + * @property {(severity: LogSeverity) => boolean} canLog + */ + +/** + * @callback FilterConsole + * @param {VirtualConsole} baseConsole + * @param {ConsoleFilter} filter + * @param {string=} topic + * @returns {VirtualConsole} + */ +})() +, +// === functors[6] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([]); // @ts-check + +/** + * @typedef {readonly any[]} LogArgs + * + * This is an array suitable to be used as arguments of a console + * level message *after* the format string argument. It is the result of + * a `details` template string and consists of alternating literal strings + * and substitution values, starting with a literal string. At least that + * first literal string is always present. + */ + +/** + * @callback NoteCallback + * + * @param {Error} error + * @param {LogArgs} noteLogArgs + * @returns {void} + */ + +/** + * @callback GetStackString + * @param {Error} error + * @returns {string=} + */ + +/** + * @typedef {object} LoggedErrorHandler + * + * Used to parameterize `makeCausalConsole` to give it access to potentially + * hidden information to augment the logging of errors. + * + * @property {GetStackString} getStackString + * @property {(error: Error) => string} tagError + * @property {() => void} resetErrorTagNum for debugging purposes only + * @property {(error: Error) => (LogArgs | undefined)} getMessageLogArgs + * @property {(error: Error) => (LogArgs | undefined)} takeMessageLogArgs + * @property {(error: Error, callback?: NoteCallback) => LogArgs[] } takeNoteLogArgsArray + */ + +// ///////////////////////////////////////////////////////////////////////////// + +/** + * @typedef {readonly [string, ...any[]]} LogRecord + */ + +/** + * @typedef {object} LoggingConsoleKit + * @property {VirtualConsole} loggingConsole + * @property {() => readonly LogRecord[]} takeLog + */ + +/** + * @typedef {object} MakeLoggingConsoleKitOptions + * @property {boolean=} shouldResetForDebugging + */ + +/** + * @callback MakeLoggingConsoleKit + * + * A logging console just accumulates the contents of all whitelisted calls, + * making them available to callers of `takeLog()`. Calling `takeLog()` + * consumes these, so later calls to `takeLog()` will only provide a log of + * calls that have happened since then. + * + * @param {LoggedErrorHandler} loggedErrorHandler + * @param {MakeLoggingConsoleKitOptions=} options + * @returns {LoggingConsoleKit} + */ + +/** + * @typedef {{ NOTE: 'ERROR_NOTE:', MESSAGE: 'ERROR_MESSAGE:' }} ErrorInfo + */ + +/** + * @typedef {ErrorInfo[keyof ErrorInfo]} ErrorInfoKind + */ + +/** + * @callback MakeCausalConsole + * + * Makes a causal console wrapper of a `baseConsole`, where the causal console + * calls methods of the `loggedErrorHandler` to customize how it handles logged + * errors. + * + * @param {VirtualConsole | undefined} baseConsole + * @param {LoggedErrorHandler} loggedErrorHandler + * @returns {VirtualConsole | undefined} + */ +})() +, +// === functors[7] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([["./internal-types.js", []]]); + + + + + +const { freeze}= Object; +const { isSafeInteger}= Number; + +/** + * @template Data + * @typedef {object} DoublyLinkedCell + * A cell of a doubly-linked ring, i.e., a doubly-linked circular list. + * DoublyLinkedCells are not frozen, and so should be closely encapsulated by + * any abstraction that uses them. + * @property {DoublyLinkedCell} next + * @property {DoublyLinkedCell} prev + * @property {Data} data + */ + +/** + * Makes a new self-linked cell. There are two reasons to do so: + * * To make the head sigil of a new initially-empty doubly-linked ring. + * * To make a non-sigil cell to be `spliceAfter`ed. + * + * @template Data + * @param {Data} data + * @returns {DoublyLinkedCell} + */ +const makeSelfCell= (data)=>{ + /** @type {Partial>} */ + const incompleteCell= { + next: undefined, + prev: undefined, + data}; + + const selfCell= /** @type {DoublyLinkedCell} */ incompleteCell; + selfCell.next= selfCell; + selfCell.prev= selfCell; + // Not frozen! + return selfCell; + }; + +/** + * Splices a self-linked non-sigil cell into a ring after `prev`. + * `prev` could be the head sigil, or it could be some other non-sigil + * cell within a ring. + * + * @template Data + * @param {DoublyLinkedCell} prev + * @param {DoublyLinkedCell} selfCell + */ +const spliceAfter= (prev, selfCell)=> { + if( prev=== selfCell) { + throw TypeError('Cannot splice a cell into itself'); + } + if( selfCell.next!== selfCell|| selfCell.prev!== selfCell) { + throw TypeError('Expected self-linked cell'); + } + const cell= selfCell; + // rename variable cause it isn't self-linked after this point. + + const next= prev.next; + cell.prev= prev; + cell.next= next; + prev.next= cell; + next.prev= cell; + // Not frozen! + return cell; + }; + +/** + * @template Data + * @param {DoublyLinkedCell} cell + * No-op if the cell is self-linked. + */ +const spliceOut= (cell)=>{ + const { prev, next}= cell; + prev.next= next; + next.prev= prev; + cell.prev= cell; + cell.next= cell; + }; + +/** + * The LRUCacheMap is used within the implementation of `assert` and so + * at a layer below SES or harden. Thus, we give it a `WeakMap`-like interface + * rather than a `WeakMapStore`-like interface. To work before `lockdown`, + * the implementation must use `freeze` manually, but still exhaustively. + * + * It implements the WeakMap interface, and holds its keys weakly. Cached + * values are only held while the key is held by the user and the key/value + * bookkeeping cell has not been pushed off the end of the cache by `budget` + * number of more recently referenced cells. If the key is dropped by the user, + * the value will no longer be held by the cache, but the bookkeeping cell + * itself will stay in memory. + * + * @template {{}} K + * @template {unknown} V + * @param {number} keysBudget + * @returns {WeakMap} + */ +const makeLRUCacheMap= (keysBudget)=>{ + if( !isSafeInteger(keysBudget)|| keysBudget< 0) { + throw TypeError('keysBudget must be a safe non-negative integer number'); + } + /** @typedef {DoublyLinkedCell | undefined>} LRUCacheCell */ + /** @type {WeakMap} */ + const keyToCell= new WeakMap(); + let size= 0; // `size` must remain <= `keysBudget` + // As a sigil, `head` uniquely is not in the `keyToCell` map. + /** @type {LRUCacheCell} */ + const head= makeSelfCell(undefined); + + const touchCell= (key)=>{ + const cell= keyToCell.get(key); + if( cell=== undefined|| cell.data=== undefined) { + // Either the key was GCed, or the cell was condemned. + return undefined; + } + // Becomes most recently used + spliceOut(cell); + spliceAfter(head, cell); + return cell; + }; + + /** + * @param {K} key + */ + const has= (key)=>touchCell(key)!== undefined; + freeze(has); + + /** + * @param {K} key + */ + // UNTIL https://github.com/endojs/endo/issues/1514 + // Prefer: const get = key => touchCell(key)?.data?.get(key); + const get= (key)=>{ + const cell= touchCell(key); + return cell&& cell.data&& cell.data.get(key); + }; + freeze(get); + + /** + * @param {K} key + * @param {V} value + */ + const set= (key, value)=> { + if( keysBudget< 1) { + // eslint-disable-next-line no-use-before-define + return lruCacheMap; // Implements WeakMap.set + } + + let cell= touchCell(key); + if( cell=== undefined) { + cell= makeSelfCell(undefined); + spliceAfter(head, cell); // start most recently used + } + if( !cell.data) { + // Either a fresh cell or a reused condemned cell. + size+= 1; + // Add its data. + cell.data= new WeakMap(); + // Advertise the cell for this key. + keyToCell.set(key, cell); + while( size> keysBudget) { + const condemned= head.prev; + spliceOut(condemned); // Drop least recently used + condemned.data= undefined; + size-= 1; + } + } + + // Update the data. + cell.data.set(key, value); + + // eslint-disable-next-line no-use-before-define + return lruCacheMap; // Implements WeakMap.set + }; + freeze(set); + + // "delete" is a keyword. + /** + * @param {K} key + */ + const deleteIt= (key)=>{ + const cell= keyToCell.get(key); + if( cell=== undefined) { + return false; + } + spliceOut(cell); + keyToCell.delete(key); + if( cell.data=== undefined) { + // Already condemned. + return false; + } + + cell.data= undefined; + size-= 1; + return true; + }; + freeze(deleteIt); + + const lruCacheMap= freeze({ + has, + get, + set, + delete: deleteIt, + [Symbol.toStringTag]: 'LRUCacheMap'}); + + return lruCacheMap; + };$h‍_once.makeLRUCacheMap(makeLRUCacheMap); +freeze(makeLRUCacheMap); + +const defaultLoggedErrorsBudget= 1000; +const defaultArgsPerErrorBudget= 100; + +/** + * @param {number} [errorsBudget] + * @param {number} [argsPerErrorBudget] + */ +const makeNoteLogArgsArrayKit= ( + errorsBudget= defaultLoggedErrorsBudget, + argsPerErrorBudget= defaultArgsPerErrorBudget)=> + { + if( !isSafeInteger(argsPerErrorBudget)|| argsPerErrorBudget< 1) { + throw TypeError( + 'argsPerErrorBudget must be a safe positive integer number'); + + } + + /** + * @type {WeakMap} + * + * Maps from an error to an array of log args, where each log args is + * remembered as an annotation on that error. This can be used, for example, + * to keep track of additional causes of the error. The elements of any + * log args may include errors which are associated with further annotations. + * An augmented console, like the causal console of `console.js`, could + * then retrieve the graph of such annotations. + */ + const noteLogArgsArrayMap= makeLRUCacheMap(errorsBudget); + + /** + * @param {Error} error + * @param {LogArgs} logArgs + */ + const addLogArgs= (error, logArgs)=> { + const logArgsArray= noteLogArgsArrayMap.get(error); + if( logArgsArray!== undefined) { + if( logArgsArray.length>= argsPerErrorBudget) { + logArgsArray.shift(); + } + logArgsArray.push(logArgs); + }else { + noteLogArgsArrayMap.set(error, [logArgs]); + } + }; + freeze(addLogArgs); + + /** + * @param {Error} error + * @returns {LogArgs[] | undefined} + */ + const takeLogArgsArray= (error)=>{ + const result= noteLogArgsArrayMap.get(error); + noteLogArgsArrayMap.delete(error); + return result; + }; + freeze(takeLogArgsArray); + + return freeze({ + addLogArgs, + takeLogArgsArray}); + + };$h‍_once.makeNoteLogArgsArrayKit(makeNoteLogArgsArrayKit); +freeze(makeNoteLogArgsArrayKit); +})() +, +// === functors[8] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let RangeError,TypeError,WeakMap,arrayJoin,arrayMap,arrayPop,arrayPush,assign,freeze,globalThis,is,isError,regexpTest,stringIndexOf,stringReplace,stringSlice,stringStartsWith,weakmapDelete,weakmapGet,weakmapHas,weakmapSet,an,bestEffortStringify,makeNoteLogArgsArrayKit;$h‍_imports([["../commons.js", [["RangeError", [$h‍_a => (RangeError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arrayPop", [$h‍_a => (arrayPop = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["assign", [$h‍_a => (assign = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["isError", [$h‍_a => (isError = $h‍_a)]],["regexpTest", [$h‍_a => (regexpTest = $h‍_a)]],["stringIndexOf", [$h‍_a => (stringIndexOf = $h‍_a)]],["stringReplace", [$h‍_a => (stringReplace = $h‍_a)]],["stringSlice", [$h‍_a => (stringSlice = $h‍_a)]],["stringStartsWith", [$h‍_a => (stringStartsWith = $h‍_a)]],["weakmapDelete", [$h‍_a => (weakmapDelete = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapHas", [$h‍_a => (weakmapHas = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]]]],["./stringify-utils.js", [["an", [$h‍_a => (an = $h‍_a)]],["bestEffortStringify", [$h‍_a => (bestEffortStringify = $h‍_a)]]]],["./types.js", []],["./internal-types.js", []],["./note-log-args.js", [["makeNoteLogArgsArrayKit", [$h‍_a => (makeNoteLogArgsArrayKit = $h‍_a)]]]]]); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// For our internal debugging purposes, uncomment +// const internalDebugConsole = console; + +// ///////////////////////////////////////////////////////////////////////////// + +/** @type {WeakMap} */ +const declassifiers= new WeakMap(); + +/** @type {AssertQuote} */ +const quote= (payload, spaces= undefined)=> { + const result= freeze({ + toString: freeze(()=> bestEffortStringify(payload, spaces))}); + + weakmapSet(declassifiers, result, payload); + return result; + }; +freeze(quote); + +const canBeBare= freeze(/^[\w:-]( ?[\w:-])*$/); + +/** + * Embed a string directly into error details without wrapping punctuation. + * To avoid injection attacks that exploit quoting confusion, this must NEVER + * be used with data that is possibly attacker-controlled. + * As a further safeguard, we fall back to quoting any input that is not a + * string of sufficiently word-like parts separated by isolated spaces (rather + * than throwing an exception, which could hide the original problem for which + * explanatory details are being constructed---i.e., ``` assert.details`...` ``` + * should never be the source of a new exception, nor should an attempt to + * render its output, although we _could_ instead decide to handle the latter + * by inline replacement similar to that of `bestEffortStringify` for producing + * rendered messages like `(an object) was tagged "[Unsafe bare string]"`). + * + * @type {AssertQuote} + */ +const bare= (payload, spaces= undefined)=> { + if( typeof payload!== 'string'|| !regexpTest(canBeBare, payload)) { + return quote(payload, spaces); + } + const result= freeze({ + toString: freeze(()=> payload)}); + + weakmapSet(declassifiers, result, payload); + return result; + }; +freeze(bare); + +// ///////////////////////////////////////////////////////////////////////////// + +/** + * @typedef {object} HiddenDetails + * + * Captures the arguments passed to the `details` template string tag. + * + * @property {TemplateStringsArray | string[]} template + * @property {any[]} args + */ + +/** + * @type {WeakMap} + * + * Maps from a details token which a `details` template literal returned + * to a record of the contents of that template literal expression. + */ +const hiddenDetailsMap= new WeakMap(); + +/** + * @param {HiddenDetails} hiddenDetails + * @returns {string} + */ +const getMessageString= ({ template, args})=> { + const parts= [template[0]]; + for( let i= 0; i< args.length; i+= 1) { + const arg= args[i]; + let argStr; + if( weakmapHas(declassifiers, arg)) { + argStr= `${arg}`; + }else if( isError(arg)) { + argStr= `(${an(arg.name)})`; + }else { + argStr= `(${an(typeof arg)})`; + } + arrayPush(parts, argStr, template[i+ 1]); + } + return arrayJoin(parts, ''); + }; + +/** + * Give detailsTokens a toString behavior. To minimize the overhead of + * creating new detailsTokens, we do this with an + * inherited `this` sensitive `toString` method, even though we normally + * avoid `this` sensitivity. To protect the method from inappropriate + * `this` application, it does something interesting only for objects + * registered in `redactedDetails`, which should be exactly the detailsTokens. + * + * The printing behavior must not reveal anything redacted, so we just use + * the same `getMessageString` we use to construct the redacted message + * string for a thrown assertion error. + */ +const DetailsTokenProto= freeze({ + toString() { + const hiddenDetails= weakmapGet(hiddenDetailsMap, this); + if( hiddenDetails=== undefined) { + return '[Not a DetailsToken]'; + } + return getMessageString(hiddenDetails); + }}); + +freeze(DetailsTokenProto.toString); + +/** + * Normally this is the function exported as `assert.details` and often + * spelled `d`. However, if the `{errorTaming: 'unsafe'}` option is given to + * `lockdown`, then `unredactedDetails` is used instead. + * + * There are some unconditional uses of `redactedDetails` in this module. All + * of them should be uses where the template literal has no redacted + * substitution values. In those cases, the two are equivalent. + * + * @type {DetailsTag} + */ +const redactedDetails= (template, ...args)=> { + // Keep in mind that the vast majority of calls to `details` creates + // a details token that is never used, so this path must remain as fast as + // possible. Hence we store what we've got with little processing, postponing + // all the work to happen only if needed, for example, if an assertion fails. + const detailsToken= freeze({ __proto__: DetailsTokenProto}); + weakmapSet(hiddenDetailsMap, detailsToken, { template, args}); + return detailsToken; + }; +freeze(redactedDetails); + +/** + * `unredactedDetails` is like `details` except that it does not redact + * anything. It acts like `details` would act if all substitution values + * were wrapped with the `quote` function above (the function normally + * spelled `q`). If the `{errorTaming: 'unsafe'}` option is given to + * `lockdown`, then the lockdown-shim arranges for the global `assert` to be + * one whose `details` property is `unredactedDetails`. + * This setting optimizes the debugging and testing experience at the price + * of safety. `unredactedDetails` also sacrifices the speed of `details`, + * which is usually fine in debugging and testing. + * + * @type {DetailsTag} + */ +const unredactedDetails= (template, ...args)=> { + args= arrayMap(args, (arg)=> + weakmapHas(declassifiers, arg)? arg: quote(arg)); + + return redactedDetails(template, ...args); + };$h‍_once.unredactedDetails(unredactedDetails); +freeze(unredactedDetails); + + +/** + * @param {HiddenDetails} hiddenDetails + * @returns {LogArgs} + */ +const getLogArgs= ({ template, args})=> { + const logArgs= [template[0]]; + for( let i= 0; i< args.length; i+= 1) { + let arg= args[i]; + if( weakmapHas(declassifiers, arg)) { + arg= weakmapGet(declassifiers, arg); + } + // Remove the extra spaces (since console.error puts them + // between each cause). + const priorWithoutSpace= stringReplace(arrayPop(logArgs)|| '', / $/, ''); + if( priorWithoutSpace!== '') { + arrayPush(logArgs, priorWithoutSpace); + } + const nextWithoutSpace= stringReplace(template[i+ 1], /^ /, ''); + arrayPush(logArgs, arg, nextWithoutSpace); + } + if( logArgs[logArgs.length- 1]=== '') { + arrayPop(logArgs); + } + return logArgs; + }; + +/** + * @type {WeakMap} + * + * Maps from an error object to the log args that are a more informative + * alternative message for that error. When logging the error, these + * log args should be preferred to `error.message`. + */ +const hiddenMessageLogArgs= new WeakMap(); + +// So each error tag will be unique. +let errorTagNum= 0; + +/** + * @type {WeakMap} + */ +const errorTags= new WeakMap(); + +/** + * @param {Error} err + * @param {string=} optErrorName + * @returns {string} + */ +const tagError= (err, optErrorName= err.name)=> { + let errorTag= weakmapGet(errorTags, err); + if( errorTag!== undefined) { + return errorTag; + } + errorTagNum+= 1; + errorTag= `${optErrorName}#${errorTagNum}`; + weakmapSet(errorTags, err, errorTag); + return errorTag; + }; + +/** + * @type {AssertMakeError} + */ +const makeError= ( + optDetails= redactedDetails `Assert failed`, + ErrorConstructor= globalThis.Error, + { errorName= undefined}= {})=> + { + if( typeof optDetails=== 'string') { + // If it is a string, use it as the literal part of the template so + // it doesn't get quoted. + optDetails= redactedDetails([optDetails]); + } + const hiddenDetails= weakmapGet(hiddenDetailsMap, optDetails); + if( hiddenDetails=== undefined) { + throw TypeError( `unrecognized details ${quote(optDetails)}`); + } + const messageString= getMessageString(hiddenDetails); + const error= new ErrorConstructor(messageString); + weakmapSet(hiddenMessageLogArgs, error, getLogArgs(hiddenDetails)); + if( errorName!== undefined) { + tagError(error, errorName); + } + // The next line is a particularly fruitful place to put a breakpoint. + return error; + }; +freeze(makeError); + +// ///////////////////////////////////////////////////////////////////////////// + +const { addLogArgs, takeLogArgsArray}= makeNoteLogArgsArrayKit(); + +/** + * @type {WeakMap} + * + * An augmented console will normally only take the hidden noteArgs array once, + * when it logs the error being annotated. Once that happens, further + * annotations of that error should go to the console immediately. We arrange + * that by accepting a note-callback function from the console as an optional + * part of that taking operation. Normally there will only be at most one + * callback per error, but that depends on console behavior which we should not + * assume. We make this an array of callbacks so multiple registrations + * are independent. + */ +const hiddenNoteCallbackArrays= new WeakMap(); + +/** @type {AssertNote} */ +const note= (error, detailsNote)=> { + if( typeof detailsNote=== 'string') { + // If it is a string, use it as the literal part of the template so + // it doesn't get quoted. + detailsNote= redactedDetails([detailsNote]); + } + const hiddenDetails= weakmapGet(hiddenDetailsMap, detailsNote); + if( hiddenDetails=== undefined) { + throw TypeError( `unrecognized details ${quote(detailsNote)}`); + } + const logArgs= getLogArgs(hiddenDetails); + const callbacks= weakmapGet(hiddenNoteCallbackArrays, error); + if( callbacks!== undefined) { + for( const callback of callbacks) { + callback(error, logArgs); + } + }else { + addLogArgs(error, logArgs); + } + }; +freeze(note); + +/** + * The unprivileged form that just uses the de facto `error.stack` property. + * The start compartment normally has a privileged `globalThis.getStackString` + * which should be preferred if present. + * + * @param {Error} error + * @returns {string} + */ +const defaultGetStackString= (error)=>{ + if( !('stack'in error)) { + return ''; + } + const stackString= `${error.stack}`; + const pos= stringIndexOf(stackString, '\n'); + if( stringStartsWith(stackString, ' ')|| pos=== -1) { + return stackString; + } + return stringSlice(stackString, pos+ 1); // exclude the initial newline + }; + +/** @type {LoggedErrorHandler} */ +const loggedErrorHandler= { + getStackString: globalThis.getStackString|| defaultGetStackString, + tagError: (error)=>tagError(error), + resetErrorTagNum: ()=> { + errorTagNum= 0; + }, + getMessageLogArgs: (error)=>weakmapGet(hiddenMessageLogArgs, error), + takeMessageLogArgs: (error)=>{ + const result= weakmapGet(hiddenMessageLogArgs, error); + weakmapDelete(hiddenMessageLogArgs, error); + return result; + }, + takeNoteLogArgsArray: (error, callback)=> { + const result= takeLogArgsArray(error); + if( callback!== undefined) { + const callbacks= weakmapGet(hiddenNoteCallbackArrays, error); + if( callbacks) { + arrayPush(callbacks, callback); + }else { + weakmapSet(hiddenNoteCallbackArrays, error, [callback]); + } + } + return result|| []; + }};$h‍_once.loggedErrorHandler(loggedErrorHandler); + +freeze(loggedErrorHandler); + + +// ///////////////////////////////////////////////////////////////////////////// + +/** + * @type {MakeAssert} + */ +const makeAssert= (optRaise= undefined, unredacted= false)=> { + const details= unredacted? unredactedDetails: redactedDetails; + const assertFailedDetails= details `Check failed`; + + /** @type {AssertFail} */ + const fail= ( + optDetails= assertFailedDetails, + ErrorConstructor= globalThis.Error)=> + { + const reason= makeError(optDetails, ErrorConstructor); + if( optRaise!== undefined) { + optRaise(reason); + } + throw reason; + }; + freeze(fail); + + /** @type {FailTag} */ + const Fail= (template, ...args)=> fail(details(template, ...args)); + + // Don't freeze or export `baseAssert` until we add methods. + // TODO If I change this from a `function` function to an arrow + // function, I seem to get type errors from TypeScript. Why? + /** @type {BaseAssert} */ + function baseAssert( + flag, + optDetails= undefined, + ErrorConstructor= undefined) + { + flag|| fail(optDetails, ErrorConstructor); + } + + /** @type {AssertEqual} */ + const equal= ( + actual, + expected, + optDetails= undefined, + ErrorConstructor= undefined)=> + { + is(actual, expected)|| + fail( + optDetails|| details `Expected ${actual} is same as ${expected}`, + ErrorConstructor|| RangeError); + + }; + freeze(equal); + + /** @type {AssertTypeof} */ + const assertTypeof= (specimen, typename, optDetails)=> { + // This will safely fall through if typename is not a string, + // which is what we want. + // eslint-disable-next-line valid-typeof + if( typeof specimen=== typename) { + return; + } + typeof typename=== 'string'|| Fail `${quote(typename)} must be a string`; + + if( optDetails=== undefined) { + // Embed the type phrase without quotes. + const typeWithDeterminer= an(typename); + optDetails= details `${specimen} must be ${bare(typeWithDeterminer)}`; + } + fail(optDetails, TypeError); + }; + freeze(assertTypeof); + + /** @type {AssertString} */ + const assertString= (specimen, optDetails= undefined)=> + assertTypeof(specimen, 'string', optDetails); + + // Note that "assert === baseAssert" + /** @type {Assert} */ + const assert= assign(baseAssert, { + error: makeError, + fail, + equal, + typeof: assertTypeof, + string: assertString, + note, + details, + Fail, + quote, + bare, + makeAssert}); + + return freeze(assert); + };$h‍_once.makeAssert(makeAssert); +freeze(makeAssert); + + +/** @type {Assert} */ +const assert= makeAssert();$h‍_once.assert(assert); +})() +, +// === functors[9] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Set,String,TypeError,WeakMap,WeakSet,globalThis,apply,arrayForEach,defineProperty,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,getPrototypeOf,isInteger,isObject,objectHasOwnProperty,ownKeys,preventExtensions,setAdd,setForEach,setHas,toStringTagSymbol,typedArrayPrototype,weakmapGet,weakmapSet,weaksetAdd,weaksetHas,assert;$h‍_imports([["./commons.js", [["Set", [$h‍_a => (Set = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["arrayForEach", [$h‍_a => (arrayForEach = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["isInteger", [$h‍_a => (isInteger = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["preventExtensions", [$h‍_a => (preventExtensions = $h‍_a)]],["setAdd", [$h‍_a => (setAdd = $h‍_a)]],["setForEach", [$h‍_a => (setForEach = $h‍_a)]],["setHas", [$h‍_a => (setHas = $h‍_a)]],["toStringTagSymbol", [$h‍_a => (toStringTagSymbol = $h‍_a)]],["typedArrayPrototype", [$h‍_a => (typedArrayPrototype = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]],["weaksetAdd", [$h‍_a => (weaksetAdd = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + * @typedef {import('../types.js').Harden} Harden + */ + +// Obtain the string tag accessor of of TypedArray so we can indirectly use the +// TypedArray brand check it employs. +const typedArrayToStringTag= getOwnPropertyDescriptor( + typedArrayPrototype, + toStringTagSymbol); + +assert(typedArrayToStringTag); +const getTypedArrayToStringTag= typedArrayToStringTag.get; +assert(getTypedArrayToStringTag); + +// Exported for tests. +/** + * Duplicates packages/marshal/src/helpers/passStyle-helpers.js to avoid a dependency. + * + * @param {unknown} object + */ +const isTypedArray= (object)=>{ + // The object must pass a brand check or toStringTag will return undefined. + const tag= apply(getTypedArrayToStringTag, object, []); + return tag!== undefined; + }; + +/** + * Tests if a property key is an integer-valued canonical numeric index. + * https://tc39.es/ecma262/#sec-canonicalnumericindexstring + * + * @param {string | symbol} propertyKey + */$h‍_once.isTypedArray(isTypedArray); +const isCanonicalIntegerIndexString= (propertyKey)=>{ + const n= +String(propertyKey); + return isInteger(n)&& String(n)=== propertyKey; + }; + +/** + * @template T + * @param {ArrayLike} array + */ +const freezeTypedArray= (array)=>{ + preventExtensions(array); + + // Downgrade writable expandos to readonly, even if non-configurable. + // We get each descriptor individually rather than using + // getOwnPropertyDescriptors in order to fail safe when encountering + // an obscure GraalJS issue where getOwnPropertyDescriptor returns + // undefined for a property that does exist. + arrayForEach(ownKeys(array), (/** @type {string | symbol} */ name)=> { + const desc= getOwnPropertyDescriptor(array, name); + assert(desc); + // TypedArrays are integer-indexed exotic objects, which define special + // treatment for property names in canonical numeric form: + // integers in range are permanently writable and non-configurable. + // https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects + // + // This is analogous to the data of a hardened Map or Set, + // so we carve out this exceptional behavior but make all other + // properties non-configurable. + if( !isCanonicalIntegerIndexString(name)) { + defineProperty(array, name, { + ...desc, + writable: false, + configurable: false}); + + } + }); + }; + +/** + * Create a `harden` function. + * + * @returns {Harden} + */ +const makeHardener= ()=> { + // Use a native hardener if possible. + if( typeof globalThis.harden=== 'function') { + const safeHarden= globalThis.harden; + return safeHarden; + } + + const hardened= new WeakSet(); + + const { harden}= { + /** + * @template T + * @param {T} root + * @returns {T} + */ + harden(root) { + const toFreeze= new Set(); + const paths= new WeakMap(); + + // If val is something we should be freezing but aren't yet, + // add it to toFreeze. + /** + * @param {any} val + * @param {string} [path] + */ + function enqueue(val, path= undefined) { + if( !isObject(val)) { + // ignore primitives + return; + } + const type= typeof val; + if( type!== 'object'&& type!== 'function') { + // future proof: break until someone figures out what it should do + throw TypeError( `Unexpected typeof: ${type}`); + } + if( weaksetHas(hardened, val)|| setHas(toFreeze, val)) { + // Ignore if this is an exit, or we've already visited it + return; + } + // console.warn(`adding ${val} to toFreeze`, val); + setAdd(toFreeze, val); + weakmapSet(paths, val, path); + } + + /** + * @param {any} obj + */ + function freezeAndTraverse(obj) { + // Now freeze the object to ensure reactive + // objects such as proxies won't add properties + // during traversal, before they get frozen. + + // Object are verified before being enqueued, + // therefore this is a valid candidate. + // Throws if this fails (strict mode). + // Also throws if the object is an ArrayBuffer or any TypedArray. + if( isTypedArray(obj)) { + freezeTypedArray(obj); + }else { + freeze(obj); + } + + // we rely upon certain commitments of Object.freeze and proxies here + + // get stable/immutable outbound links before a Proxy has a chance to do + // something sneaky. + const path= weakmapGet(paths, obj)|| 'unknown'; + const descs= getOwnPropertyDescriptors(obj); + const proto= getPrototypeOf(obj); + enqueue(proto, `${path}.__proto__`); + + arrayForEach(ownKeys(descs), (/** @type {string | symbol} */ name)=> { + const pathname= `${path}.${String(name)}`; + // The 'name' may be a symbol, and TypeScript doesn't like us to + // index arbitrary symbols on objects, so we pretend they're just + // strings. + const desc= descs[/** @type {string} */ name]; + // getOwnPropertyDescriptors is guaranteed to return well-formed + // descriptors, but they still inherit from Object.prototype. If + // someone has poisoned Object.prototype to add 'value' or 'get' + // properties, then a simple 'if ("value" in desc)' or 'desc.value' + // test could be confused. We use hasOwnProperty to be sure about + // whether 'value' is present or not, which tells us for sure that + // this is a data property. + if( objectHasOwnProperty(desc, 'value')) { + enqueue(desc.value, `${pathname}`); + }else { + enqueue(desc.get, `${pathname}(get)`); + enqueue(desc.set, `${pathname}(set)`); + } + }); + } + + function dequeue() { + // New values added before forEach() has finished will be visited. + setForEach(toFreeze, freezeAndTraverse); + } + + /** @param {any} value */ + function markHardened(value) { + weaksetAdd(hardened, value); + } + + function commit() { + setForEach(toFreeze, markHardened); + } + + enqueue(root); + dequeue(); + // console.warn("toFreeze set:", toFreeze); + commit(); + + return root; + }}; + + + return harden; + };$h‍_once.makeHardener(makeHardener); +})() +, +// === functors[10] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([]); /* eslint-disable no-restricted-globals */ +/** + * @file Exports {@code whitelist}, a recursively defined + * JSON record enumerating all intrinsics and their properties + * according to ECMA specs. + * + * @author JF Paradis + * @author Mark S. Miller + */ + +/* eslint max-lines: 0 */ + +/** + * constantProperties + * non-configurable, non-writable data properties of all global objects. + * Must be powerless. + * Maps from property name to the actual value + */ +const constantProperties= { + // *** Value Properties of the Global Object + + Infinity, + NaN, + undefined}; + + +/** + * universalPropertyNames + * Properties of all global objects. + * Must be powerless. + * Maps from property name to the intrinsic name in the whitelist. + */$h‍_once.constantProperties(constantProperties); +const universalPropertyNames= { + // *** Function Properties of the Global Object + + isFinite: 'isFinite', + isNaN: 'isNaN', + parseFloat: 'parseFloat', + parseInt: 'parseInt', + + decodeURI: 'decodeURI', + decodeURIComponent: 'decodeURIComponent', + encodeURI: 'encodeURI', + encodeURIComponent: 'encodeURIComponent', + + // *** Constructor Properties of the Global Object + + Array: 'Array', + ArrayBuffer: 'ArrayBuffer', + BigInt: 'BigInt', + BigInt64Array: 'BigInt64Array', + BigUint64Array: 'BigUint64Array', + Boolean: 'Boolean', + DataView: 'DataView', + EvalError: 'EvalError', + Float32Array: 'Float32Array', + Float64Array: 'Float64Array', + Int8Array: 'Int8Array', + Int16Array: 'Int16Array', + Int32Array: 'Int32Array', + Map: 'Map', + Number: 'Number', + Object: 'Object', + Promise: 'Promise', + Proxy: 'Proxy', + RangeError: 'RangeError', + ReferenceError: 'ReferenceError', + Set: 'Set', + String: 'String', + SyntaxError: 'SyntaxError', + TypeError: 'TypeError', + Uint8Array: 'Uint8Array', + Uint8ClampedArray: 'Uint8ClampedArray', + Uint16Array: 'Uint16Array', + Uint32Array: 'Uint32Array', + URIError: 'URIError', + WeakMap: 'WeakMap', + WeakSet: 'WeakSet', + // https://github.com/tc39/proposal-iterator-helpers + Iterator: 'Iterator', + // https://github.com/tc39/proposal-async-iterator-helpers + AsyncIterator: 'AsyncIterator', + + // *** Other Properties of the Global Object + + JSON: 'JSON', + Reflect: 'Reflect', + + // *** Annex B + + escape: 'escape', + unescape: 'unescape', + + // ESNext + + lockdown: 'lockdown', + harden: 'harden', + HandledPromise: 'HandledPromise' // TODO: Until Promise.delegate (see below). +}; + +/** + * initialGlobalPropertyNames + * Those found only on the initial global, i.e., the global of the + * start compartment, as well as any compartments created before lockdown. + * These may provide much of the power provided by the original. + * Maps from property name to the intrinsic name in the whitelist. + */$h‍_once.universalPropertyNames(universalPropertyNames); +const initialGlobalPropertyNames= { + // *** Constructor Properties of the Global Object + + Date: '%InitialDate%', + Error: '%InitialError%', + RegExp: '%InitialRegExp%', + + // Omit `Symbol`, because we want the original to appear on the + // start compartment without passing through the whitelist mechanism, since + // we want to preserve all its properties, even if we never heard of them. + // Symbol: '%InitialSymbol%', + + // *** Other Properties of the Global Object + + Math: '%InitialMath%', + + // ESNext + + // From Error-stack proposal + // Only on initial global. No corresponding + // powerless form for other globals. + getStackString: '%InitialGetStackString%' + + // TODO https://github.com/Agoric/SES-shim/issues/551 + // Need initial WeakRef and FinalizationGroup in + // start compartment only. +}; + +/** + * sharedGlobalPropertyNames + * Those found only on the globals of new compartments created after lockdown, + * which must therefore be powerless. + * Maps from property name to the intrinsic name in the whitelist. + */$h‍_once.initialGlobalPropertyNames(initialGlobalPropertyNames); +const sharedGlobalPropertyNames= { + // *** Constructor Properties of the Global Object + + Date: '%SharedDate%', + Error: '%SharedError%', + RegExp: '%SharedRegExp%', + Symbol: '%SharedSymbol%', + + // *** Other Properties of the Global Object + + Math: '%SharedMath%'}; + + +/** + * uniqueGlobalPropertyNames + * Those made separately for each global, including the initial global + * of the start compartment. + * Maps from property name to the intrinsic name in the whitelist + * (which is currently always the same). + */$h‍_once.sharedGlobalPropertyNames(sharedGlobalPropertyNames); +const uniqueGlobalPropertyNames= { + // *** Value Properties of the Global Object + + globalThis: '%UniqueGlobalThis%', + + // *** Function Properties of the Global Object + + eval: '%UniqueEval%', + + // *** Constructor Properties of the Global Object + + Function: '%UniqueFunction%', + + // *** Other Properties of the Global Object + + // ESNext + + Compartment: '%UniqueCompartment%' + // According to current agreements, eventually the Realm constructor too. + // 'Realm', +}; + +// All the "subclasses" of Error. These are collectively represented in the +// ECMAScript spec by the meta variable NativeError. +// TODO Add AggregateError https://github.com/Agoric/SES-shim/issues/550 +$h‍_once.uniqueGlobalPropertyNames(uniqueGlobalPropertyNames);const NativeErrors=[ + EvalError, + RangeError, + ReferenceError, + SyntaxError, + TypeError, + URIError]; + + +/** + *

Each JSON record enumerates the disposition of the properties on + * some corresponding intrinsic object. + * + *

All records are made of key-value pairs where the key + * is the property to process, and the value is the associated + * dispositions a.k.a. the "permit". Those permits can be: + *

    + *
  • The boolean value "false", in which case this property is + * blacklisted and simply removed. Properties not mentioned + * are also considered blacklisted and are removed. + *
  • A string value equal to a primitive ("number", "string", etc), + * in which case the property is whitelisted if its value property + * is typeof the given type. For example, {@code "Infinity"} leads to + * "number" and property values that fail {@code typeof "number"}. + * are removed. + *
  • A string value equal to an intinsic name ("ObjectPrototype", + * "Array", etc), in which case the property whitelisted if its + * value property is equal to the value of the corresponfing + * intrinsics. For example, {@code Map.prototype} leads to + * "MapPrototype" and the property is removed if its value is + * not equal to %MapPrototype% + *
  • Another record, in which case this property is simply + * whitelisted and that next record represents the disposition of + * the object which is its value. For example, {@code "Object"} + * leads to another record explaining what properties {@code + * "Object"} may have and how each such property should be treated. + * + *

    Notes: + *

  • "[[Proto]]" is used to refer to the "[[Prototype]]" internal + * slot, which says which object this object inherits from. + *
  • "--proto--" is used to refer to the "__proto__" property name, + * which is the name of an accessor property on Object.prototype. + * In practice, it is used to access the [[Proto]] internal slot, + * but is distinct from the internal slot itself. We use + * "--proto--" rather than "__proto__" below because "__proto__" + * in an object literal is special syntax rather than a normal + * property definition. + *
  • "ObjectPrototype" is the default "[[Proto]]" (when not specified). + *
  • Constants "fn" and "getter" are used to keep the structure DRY. + *
  • Symbol properties are listed as follow: + *
  • Well-known symbols use the "@@name" form. + *
  • Registered symbols use the "RegisteredSymbol(key)" form. + *
  • Unique symbols use the "UniqueSymbol(description)" form. + */ + +// Function Instances +$h‍_once.NativeErrors(NativeErrors);const FunctionInstance={ + '[[Proto]]': '%FunctionPrototype%', + length: 'number', + name: 'string' + // Do not specify "prototype" here, since only Function instances that can + // be used as a constructor have a prototype property. For constructors, + // since prototype properties are instance-specific, we define it there. +}; + +// AsyncFunction Instances +$h‍_once.FunctionInstance(FunctionInstance);const AsyncFunctionInstance={ + // This property is not mentioned in ECMA 262, but is present in V8 and + // necessary for lockdown to succeed. + '[[Proto]]': '%AsyncFunctionPrototype%'}; + + +// Aliases +$h‍_once.AsyncFunctionInstance(AsyncFunctionInstance);const fn=FunctionInstance; +const asyncFn= AsyncFunctionInstance; + +const getter= { + get: fn, + set: 'undefined'}; + + +// Possible but not encountered in the specs +// export const setter = { +// get: 'undefined', +// set: fn, +// }; + +const accessor= { + get: fn, + set: fn}; + + +const isAccessorPermit= (permit)=>{ + return permit=== getter|| permit=== accessor; + }; + +// NativeError Object Structure +$h‍_once.isAccessorPermit(isAccessorPermit);function NativeError(prototype){ + return { + // Properties of the NativeError Constructors + '[[Proto]]': '%SharedError%', + + // NativeError.prototype + prototype}; + + } + +function NativeErrorPrototype(constructor) { + return { + // Properties of the NativeError Prototype Objects + '[[Proto]]': '%ErrorPrototype%', + constructor, + message: 'string', + name: 'string', + // Redundantly present only on v8. Safe to remove. + toString: false, + // Superfluously present in some versions of V8. + // https://github.com/tc39/notes/blob/master/meetings/2021-10/oct-26.md#:~:text=However%2C%20Chrome%2093,and%20node%2016.11. + cause: false}; + + } + +// The TypedArray Constructors +function TypedArray(prototype) { + return { + // Properties of the TypedArray Constructors + '[[Proto]]': '%TypedArray%', + BYTES_PER_ELEMENT: 'number', + prototype}; + + } + +function TypedArrayPrototype(constructor) { + return { + // Properties of the TypedArray Prototype Objects + '[[Proto]]': '%TypedArrayPrototype%', + BYTES_PER_ELEMENT: 'number', + constructor}; + + } + +// Without Math.random +const CommonMath= { + E: 'number', + LN10: 'number', + LN2: 'number', + LOG10E: 'number', + LOG2E: 'number', + PI: 'number', + SQRT1_2: 'number', + SQRT2: 'number', + '@@toStringTag': 'string', + abs: fn, + acos: fn, + acosh: fn, + asin: fn, + asinh: fn, + atan: fn, + atanh: fn, + atan2: fn, + cbrt: fn, + ceil: fn, + clz32: fn, + cos: fn, + cosh: fn, + exp: fn, + expm1: fn, + floor: fn, + fround: fn, + hypot: fn, + imul: fn, + log: fn, + log1p: fn, + log10: fn, + log2: fn, + max: fn, + min: fn, + pow: fn, + round: fn, + sign: fn, + sin: fn, + sinh: fn, + sqrt: fn, + tan: fn, + tanh: fn, + trunc: fn, + // See https://github.com/Moddable-OpenSource/moddable/issues/523 + idiv: false, + // See https://github.com/Moddable-OpenSource/moddable/issues/523 + idivmod: false, + // See https://github.com/Moddable-OpenSource/moddable/issues/523 + imod: false, + // See https://github.com/Moddable-OpenSource/moddable/issues/523 + imuldiv: false, + // See https://github.com/Moddable-OpenSource/moddable/issues/523 + irem: false, + // See https://github.com/Moddable-OpenSource/moddable/issues/523 + mod: false}; + + +const permitted= { + // ECMA https://tc39.es/ecma262 + + // The intrinsics object has no prototype to avoid conflicts. + '[[Proto]]': null, + + // %ThrowTypeError% + '%ThrowTypeError%': fn, + + // *** The Global Object + + // *** Value Properties of the Global Object + Infinity: 'number', + NaN: 'number', + undefined: 'undefined', + + // *** Function Properties of the Global Object + + // eval + '%UniqueEval%': fn, + isFinite: fn, + isNaN: fn, + parseFloat: fn, + parseInt: fn, + decodeURI: fn, + decodeURIComponent: fn, + encodeURI: fn, + encodeURIComponent: fn, + + // *** Fundamental Objects + + Object: { + // Properties of the Object Constructor + '[[Proto]]': '%FunctionPrototype%', + assign: fn, + create: fn, + defineProperties: fn, + defineProperty: fn, + entries: fn, + freeze: fn, + fromEntries: fn, + getOwnPropertyDescriptor: fn, + getOwnPropertyDescriptors: fn, + getOwnPropertyNames: fn, + getOwnPropertySymbols: fn, + getPrototypeOf: fn, + hasOwn: fn, + is: fn, + isExtensible: fn, + isFrozen: fn, + isSealed: fn, + keys: fn, + preventExtensions: fn, + prototype: '%ObjectPrototype%', + seal: fn, + setPrototypeOf: fn, + values: fn, + // https://github.com/tc39/proposal-array-grouping + groupBy: fn}, + + + '%ObjectPrototype%': { + // Properties of the Object Prototype Object + '[[Proto]]': null, + constructor: 'Object', + hasOwnProperty: fn, + isPrototypeOf: fn, + propertyIsEnumerable: fn, + toLocaleString: fn, + toString: fn, + valueOf: fn, + + // Annex B: Additional Properties of the Object.prototype Object + + // See note in header about the difference between [[Proto]] and --proto-- + // special notations. + '--proto--': accessor, + __defineGetter__: fn, + __defineSetter__: fn, + __lookupGetter__: fn, + __lookupSetter__: fn}, + + + '%UniqueFunction%': { + // Properties of the Function Constructor + '[[Proto]]': '%FunctionPrototype%', + prototype: '%FunctionPrototype%'}, + + + '%InertFunction%': { + '[[Proto]]': '%FunctionPrototype%', + prototype: '%FunctionPrototype%'}, + + + '%FunctionPrototype%': { + apply: fn, + bind: fn, + call: fn, + constructor: '%InertFunction%', + toString: fn, + '@@hasInstance': fn, + // proposed but not yet std. To be removed if there + caller: false, + // proposed but not yet std. To be removed if there + arguments: false}, + + + Boolean: { + // Properties of the Boolean Constructor + '[[Proto]]': '%FunctionPrototype%', + prototype: '%BooleanPrototype%'}, + + + '%BooleanPrototype%': { + constructor: 'Boolean', + toString: fn, + valueOf: fn}, + + + '%SharedSymbol%': { + // Properties of the Symbol Constructor + '[[Proto]]': '%FunctionPrototype%', + asyncDispose: 'symbol', + asyncIterator: 'symbol', + dispose: 'symbol', + for: fn, + hasInstance: 'symbol', + isConcatSpreadable: 'symbol', + iterator: 'symbol', + keyFor: fn, + match: 'symbol', + matchAll: 'symbol', + prototype: '%SymbolPrototype%', + replace: 'symbol', + search: 'symbol', + species: 'symbol', + split: 'symbol', + toPrimitive: 'symbol', + toStringTag: 'symbol', + unscopables: 'symbol', + // Seen at core-js https://github.com/zloirock/core-js#ecmascript-symbol + useSimple: false, + // Seen at core-js https://github.com/zloirock/core-js#ecmascript-symbol + useSetter: false}, + + + '%SymbolPrototype%': { + // Properties of the Symbol Prototype Object + constructor: '%SharedSymbol%', + description: getter, + toString: fn, + valueOf: fn, + '@@toPrimitive': fn, + '@@toStringTag': 'string'}, + + + '%InitialError%': { + // Properties of the Error Constructor + '[[Proto]]': '%FunctionPrototype%', + prototype: '%ErrorPrototype%', + // Non standard, v8 only, used by tap + captureStackTrace: fn, + // Non standard, v8 only, used by tap, tamed to accessor + stackTraceLimit: accessor, + // Non standard, v8 only, used by several, tamed to accessor + prepareStackTrace: accessor}, + + + '%SharedError%': { + // Properties of the Error Constructor + '[[Proto]]': '%FunctionPrototype%', + prototype: '%ErrorPrototype%', + // Non standard, v8 only, used by tap + captureStackTrace: fn, + // Non standard, v8 only, used by tap, tamed to accessor + stackTraceLimit: accessor, + // Non standard, v8 only, used by several, tamed to accessor + prepareStackTrace: accessor}, + + + '%ErrorPrototype%': { + constructor: '%SharedError%', + message: 'string', + name: 'string', + toString: fn, + // proposed de-facto, assumed TODO + // Seen on FF Nightly 88.0a1 + at: false, + // Seen on FF and XS + stack: accessor, + // Superfluously present in some versions of V8. + // https://github.com/tc39/notes/blob/master/meetings/2021-10/oct-26.md#:~:text=However%2C%20Chrome%2093,and%20node%2016.11. + cause: false}, + + + // NativeError + + EvalError: NativeError('%EvalErrorPrototype%'), + RangeError: NativeError('%RangeErrorPrototype%'), + ReferenceError: NativeError('%ReferenceErrorPrototype%'), + SyntaxError: NativeError('%SyntaxErrorPrototype%'), + TypeError: NativeError('%TypeErrorPrototype%'), + URIError: NativeError('%URIErrorPrototype%'), + + '%EvalErrorPrototype%': NativeErrorPrototype('EvalError'), + '%RangeErrorPrototype%': NativeErrorPrototype('RangeError'), + '%ReferenceErrorPrototype%': NativeErrorPrototype('ReferenceError'), + '%SyntaxErrorPrototype%': NativeErrorPrototype('SyntaxError'), + '%TypeErrorPrototype%': NativeErrorPrototype('TypeError'), + '%URIErrorPrototype%': NativeErrorPrototype('URIError'), + + // *** Numbers and Dates + + Number: { + // Properties of the Number Constructor + '[[Proto]]': '%FunctionPrototype%', + EPSILON: 'number', + isFinite: fn, + isInteger: fn, + isNaN: fn, + isSafeInteger: fn, + MAX_SAFE_INTEGER: 'number', + MAX_VALUE: 'number', + MIN_SAFE_INTEGER: 'number', + MIN_VALUE: 'number', + NaN: 'number', + NEGATIVE_INFINITY: 'number', + parseFloat: fn, + parseInt: fn, + POSITIVE_INFINITY: 'number', + prototype: '%NumberPrototype%'}, + + + '%NumberPrototype%': { + // Properties of the Number Prototype Object + constructor: 'Number', + toExponential: fn, + toFixed: fn, + toLocaleString: fn, + toPrecision: fn, + toString: fn, + valueOf: fn}, + + + BigInt: { + // Properties of the BigInt Constructor + '[[Proto]]': '%FunctionPrototype%', + asIntN: fn, + asUintN: fn, + prototype: '%BigIntPrototype%', + // See https://github.com/Moddable-OpenSource/moddable/issues/523 + bitLength: false, + // See https://github.com/Moddable-OpenSource/moddable/issues/523 + fromArrayBuffer: false}, + + + '%BigIntPrototype%': { + constructor: 'BigInt', + toLocaleString: fn, + toString: fn, + valueOf: fn, + '@@toStringTag': 'string'}, + + + '%InitialMath%': { + ...CommonMath, + // `%InitialMath%.random()` has the standard unsafe behavior + random: fn}, + + + '%SharedMath%': { + ...CommonMath, + // `%SharedMath%.random()` is tamed to always throw + random: fn}, + + + '%InitialDate%': { + // Properties of the Date Constructor + '[[Proto]]': '%FunctionPrototype%', + now: fn, + parse: fn, + prototype: '%DatePrototype%', + UTC: fn}, + + + '%SharedDate%': { + // Properties of the Date Constructor + '[[Proto]]': '%FunctionPrototype%', + // `%SharedDate%.now()` is tamed to always throw + now: fn, + parse: fn, + prototype: '%DatePrototype%', + UTC: fn}, + + + '%DatePrototype%': { + constructor: '%SharedDate%', + getDate: fn, + getDay: fn, + getFullYear: fn, + getHours: fn, + getMilliseconds: fn, + getMinutes: fn, + getMonth: fn, + getSeconds: fn, + getTime: fn, + getTimezoneOffset: fn, + getUTCDate: fn, + getUTCDay: fn, + getUTCFullYear: fn, + getUTCHours: fn, + getUTCMilliseconds: fn, + getUTCMinutes: fn, + getUTCMonth: fn, + getUTCSeconds: fn, + setDate: fn, + setFullYear: fn, + setHours: fn, + setMilliseconds: fn, + setMinutes: fn, + setMonth: fn, + setSeconds: fn, + setTime: fn, + setUTCDate: fn, + setUTCFullYear: fn, + setUTCHours: fn, + setUTCMilliseconds: fn, + setUTCMinutes: fn, + setUTCMonth: fn, + setUTCSeconds: fn, + toDateString: fn, + toISOString: fn, + toJSON: fn, + toLocaleDateString: fn, + toLocaleString: fn, + toLocaleTimeString: fn, + toString: fn, + toTimeString: fn, + toUTCString: fn, + valueOf: fn, + '@@toPrimitive': fn, + + // Annex B: Additional Properties of the Date.prototype Object + getYear: fn, + setYear: fn, + toGMTString: fn}, + + + // Text Processing + + String: { + // Properties of the String Constructor + '[[Proto]]': '%FunctionPrototype%', + fromCharCode: fn, + fromCodePoint: fn, + prototype: '%StringPrototype%', + raw: fn, + // See https://github.com/Moddable-OpenSource/moddable/issues/523 + fromArrayBuffer: false}, + + + '%StringPrototype%': { + // Properties of the String Prototype Object + length: 'number', + at: fn, + charAt: fn, + charCodeAt: fn, + codePointAt: fn, + concat: fn, + constructor: 'String', + endsWith: fn, + includes: fn, + indexOf: fn, + lastIndexOf: fn, + localeCompare: fn, + match: fn, + matchAll: fn, + normalize: fn, + padEnd: fn, + padStart: fn, + repeat: fn, + replace: fn, + replaceAll: fn, // ES2021 + search: fn, + slice: fn, + split: fn, + startsWith: fn, + substring: fn, + toLocaleLowerCase: fn, + toLocaleUpperCase: fn, + toLowerCase: fn, + toString: fn, + toUpperCase: fn, + trim: fn, + trimEnd: fn, + trimStart: fn, + valueOf: fn, + '@@iterator': fn, + + // Annex B: Additional Properties of the String.prototype Object + substr: fn, + anchor: fn, + big: fn, + blink: fn, + bold: fn, + fixed: fn, + fontcolor: fn, + fontsize: fn, + italics: fn, + link: fn, + small: fn, + strike: fn, + sub: fn, + sup: fn, + trimLeft: fn, + trimRight: fn, + // See https://github.com/Moddable-OpenSource/moddable/issues/523 + compare: false, + // https://github.com/tc39/proposal-is-usv-string + isWellFormed: fn, + toWellFormed: fn, + unicodeSets: fn}, + + + '%StringIteratorPrototype%': { + '[[Proto]]': '%IteratorPrototype%', + next: fn, + '@@toStringTag': 'string'}, + + + '%InitialRegExp%': { + // Properties of the RegExp Constructor + '[[Proto]]': '%FunctionPrototype%', + prototype: '%RegExpPrototype%', + '@@species': getter, + + // The https://github.com/tc39/proposal-regexp-legacy-features + // are all optional, unsafe, and omitted + input: false, + $_: false, + lastMatch: false, + '$&': false, + lastParen: false, + '$+': false, + leftContext: false, + '$`': false, + rightContext: false, + "$'": false, + $1: false, + $2: false, + $3: false, + $4: false, + $5: false, + $6: false, + $7: false, + $8: false, + $9: false}, + + + '%SharedRegExp%': { + // Properties of the RegExp Constructor + '[[Proto]]': '%FunctionPrototype%', + prototype: '%RegExpPrototype%', + '@@species': getter}, + + + '%RegExpPrototype%': { + // Properties of the RegExp Prototype Object + constructor: '%SharedRegExp%', + exec: fn, + dotAll: getter, + flags: getter, + global: getter, + hasIndices: getter, + ignoreCase: getter, + '@@match': fn, + '@@matchAll': fn, + multiline: getter, + '@@replace': fn, + '@@search': fn, + source: getter, + '@@split': fn, + sticky: getter, + test: fn, + toString: fn, + unicode: getter, + unicodeSets: getter, + + // Annex B: Additional Properties of the RegExp.prototype Object + compile: false // UNSAFE and suppressed. +}, + + '%RegExpStringIteratorPrototype%': { + // The %RegExpStringIteratorPrototype% Object + '[[Proto]]': '%IteratorPrototype%', + next: fn, + '@@toStringTag': 'string'}, + + + // Indexed Collections + + Array: { + // Properties of the Array Constructor + '[[Proto]]': '%FunctionPrototype%', + from: fn, + isArray: fn, + of: fn, + prototype: '%ArrayPrototype%', + '@@species': getter, + + // Stage 3: + // https://tc39.es/proposal-relative-indexing-method/ + at: fn, + // https://tc39.es/proposal-array-from-async/ + fromAsync: fn}, + + + '%ArrayPrototype%': { + // Properties of the Array Prototype Object + at: fn, + length: 'number', + concat: fn, + constructor: 'Array', + copyWithin: fn, + entries: fn, + every: fn, + fill: fn, + filter: fn, + find: fn, + findIndex: fn, + flat: fn, + flatMap: fn, + forEach: fn, + includes: fn, + indexOf: fn, + join: fn, + keys: fn, + lastIndexOf: fn, + map: fn, + pop: fn, + push: fn, + reduce: fn, + reduceRight: fn, + reverse: fn, + shift: fn, + slice: fn, + some: fn, + sort: fn, + splice: fn, + toLocaleString: fn, + toString: fn, + unshift: fn, + values: fn, + '@@iterator': fn, + '@@unscopables': { + '[[Proto]]': null, + copyWithin: 'boolean', + entries: 'boolean', + fill: 'boolean', + find: 'boolean', + findIndex: 'boolean', + flat: 'boolean', + flatMap: 'boolean', + includes: 'boolean', + keys: 'boolean', + values: 'boolean', + // Failed tc39 proposal + // Seen on FF Nightly 88.0a1 + at: 'boolean', + // See https://github.com/tc39/proposal-array-find-from-last + findLast: 'boolean', + findLastIndex: 'boolean', + // https://github.com/tc39/proposal-change-array-by-copy + toReversed: 'boolean', + toSorted: 'boolean', + toSpliced: 'boolean', + with: 'boolean', + // https://github.com/tc39/proposal-array-grouping + group: 'boolean', + groupToMap: 'boolean', + groupBy: 'boolean'}, + + // See https://github.com/tc39/proposal-array-find-from-last + findLast: fn, + findLastIndex: fn, + // https://github.com/tc39/proposal-change-array-by-copy + toReversed: fn, + toSorted: fn, + toSpliced: fn, + with: fn, + // https://github.com/tc39/proposal-array-grouping + group: fn, // Not in proposal? Where? + groupToMap: fn, // Not in proposal? Where? + groupBy: fn}, + + + '%ArrayIteratorPrototype%': { + // The %ArrayIteratorPrototype% Object + '[[Proto]]': '%IteratorPrototype%', + next: fn, + '@@toStringTag': 'string'}, + + + // *** TypedArray Objects + + '%TypedArray%': { + // Properties of the %TypedArray% Intrinsic Object + '[[Proto]]': '%FunctionPrototype%', + from: fn, + of: fn, + prototype: '%TypedArrayPrototype%', + '@@species': getter}, + + + '%TypedArrayPrototype%': { + at: fn, + buffer: getter, + byteLength: getter, + byteOffset: getter, + constructor: '%TypedArray%', + copyWithin: fn, + entries: fn, + every: fn, + fill: fn, + filter: fn, + find: fn, + findIndex: fn, + forEach: fn, + includes: fn, + indexOf: fn, + join: fn, + keys: fn, + lastIndexOf: fn, + length: getter, + map: fn, + reduce: fn, + reduceRight: fn, + reverse: fn, + set: fn, + slice: fn, + some: fn, + sort: fn, + subarray: fn, + toLocaleString: fn, + toString: fn, + values: fn, + '@@iterator': fn, + '@@toStringTag': getter, + // See https://github.com/tc39/proposal-array-find-from-last + findLast: fn, + findLastIndex: fn, + // https://github.com/tc39/proposal-change-array-by-copy + toReversed: fn, + toSorted: fn, + with: fn}, + + + // The TypedArray Constructors + + BigInt64Array: TypedArray('%BigInt64ArrayPrototype%'), + BigUint64Array: TypedArray('%BigUint64ArrayPrototype%'), + Float32Array: TypedArray('%Float32ArrayPrototype%'), + Float64Array: TypedArray('%Float64ArrayPrototype%'), + Int16Array: TypedArray('%Int16ArrayPrototype%'), + Int32Array: TypedArray('%Int32ArrayPrototype%'), + Int8Array: TypedArray('%Int8ArrayPrototype%'), + Uint16Array: TypedArray('%Uint16ArrayPrototype%'), + Uint32Array: TypedArray('%Uint32ArrayPrototype%'), + Uint8Array: TypedArray('%Uint8ArrayPrototype%'), + Uint8ClampedArray: TypedArray('%Uint8ClampedArrayPrototype%'), + + '%BigInt64ArrayPrototype%': TypedArrayPrototype('BigInt64Array'), + '%BigUint64ArrayPrototype%': TypedArrayPrototype('BigUint64Array'), + '%Float32ArrayPrototype%': TypedArrayPrototype('Float32Array'), + '%Float64ArrayPrototype%': TypedArrayPrototype('Float64Array'), + '%Int16ArrayPrototype%': TypedArrayPrototype('Int16Array'), + '%Int32ArrayPrototype%': TypedArrayPrototype('Int32Array'), + '%Int8ArrayPrototype%': TypedArrayPrototype('Int8Array'), + '%Uint16ArrayPrototype%': TypedArrayPrototype('Uint16Array'), + '%Uint32ArrayPrototype%': TypedArrayPrototype('Uint32Array'), + '%Uint8ArrayPrototype%': TypedArrayPrototype('Uint8Array'), + '%Uint8ClampedArrayPrototype%': TypedArrayPrototype('Uint8ClampedArray'), + + // *** Keyed Collections + + Map: { + // Properties of the Map Constructor + '[[Proto]]': '%FunctionPrototype%', + '@@species': getter, + prototype: '%MapPrototype%', + // https://github.com/tc39/proposal-array-grouping + groupBy: fn}, + + + '%MapPrototype%': { + clear: fn, + constructor: 'Map', + delete: fn, + entries: fn, + forEach: fn, + get: fn, + has: fn, + keys: fn, + set: fn, + size: getter, + values: fn, + '@@iterator': fn, + '@@toStringTag': 'string'}, + + + '%MapIteratorPrototype%': { + // The %MapIteratorPrototype% Object + '[[Proto]]': '%IteratorPrototype%', + next: fn, + '@@toStringTag': 'string'}, + + + Set: { + // Properties of the Set Constructor + '[[Proto]]': '%FunctionPrototype%', + prototype: '%SetPrototype%', + '@@species': getter}, + + + '%SetPrototype%': { + add: fn, + clear: fn, + constructor: 'Set', + delete: fn, + entries: fn, + forEach: fn, + has: fn, + keys: fn, + size: getter, + values: fn, + '@@iterator': fn, + '@@toStringTag': 'string'}, + + + '%SetIteratorPrototype%': { + // The %SetIteratorPrototype% Object + '[[Proto]]': '%IteratorPrototype%', + next: fn, + '@@toStringTag': 'string'}, + + + WeakMap: { + // Properties of the WeakMap Constructor + '[[Proto]]': '%FunctionPrototype%', + prototype: '%WeakMapPrototype%'}, + + + '%WeakMapPrototype%': { + constructor: 'WeakMap', + delete: fn, + get: fn, + has: fn, + set: fn, + '@@toStringTag': 'string'}, + + + WeakSet: { + // Properties of the WeakSet Constructor + '[[Proto]]': '%FunctionPrototype%', + prototype: '%WeakSetPrototype%'}, + + + '%WeakSetPrototype%': { + add: fn, + constructor: 'WeakSet', + delete: fn, + has: fn, + '@@toStringTag': 'string'}, + + + // *** Structured Data + + ArrayBuffer: { + // Properties of the ArrayBuffer Constructor + '[[Proto]]': '%FunctionPrototype%', + isView: fn, + prototype: '%ArrayBufferPrototype%', + '@@species': getter, + // See https://github.com/Moddable-OpenSource/moddable/issues/523 + fromString: false, + // See https://github.com/Moddable-OpenSource/moddable/issues/523 + fromBigInt: false}, + + + '%ArrayBufferPrototype%': { + byteLength: getter, + constructor: 'ArrayBuffer', + slice: fn, + '@@toStringTag': 'string', + // See https://github.com/Moddable-OpenSource/moddable/issues/523 + concat: false, + // See https://github.com/tc39/proposal-resizablearraybuffer + transfer: fn, + resize: fn, + resizable: getter, + maxByteLength: getter, + // https://github.com/tc39/proposal-arraybuffer-transfer + transferToFixedLength: fn, + detached: getter}, + + + // SharedArrayBuffer Objects + SharedArrayBuffer: false, // UNSAFE and purposely suppressed. + '%SharedArrayBufferPrototype%': false, // UNSAFE and purposely suppressed. + + DataView: { + // Properties of the DataView Constructor + '[[Proto]]': '%FunctionPrototype%', + BYTES_PER_ELEMENT: 'number', // Non std but undeletable on Safari. + prototype: '%DataViewPrototype%'}, + + + '%DataViewPrototype%': { + buffer: getter, + byteLength: getter, + byteOffset: getter, + constructor: 'DataView', + getBigInt64: fn, + getBigUint64: fn, + getFloat32: fn, + getFloat64: fn, + getInt8: fn, + getInt16: fn, + getInt32: fn, + getUint8: fn, + getUint16: fn, + getUint32: fn, + setBigInt64: fn, + setBigUint64: fn, + setFloat32: fn, + setFloat64: fn, + setInt8: fn, + setInt16: fn, + setInt32: fn, + setUint8: fn, + setUint16: fn, + setUint32: fn, + '@@toStringTag': 'string'}, + + + // Atomics + Atomics: false, // UNSAFE and suppressed. + + JSON: { + parse: fn, + stringify: fn, + '@@toStringTag': 'string', + // https://github.com/tc39/proposal-json-parse-with-source/ + rawJSON: fn, + isRawJSON: fn}, + + + // *** Control Abstraction Objects + + // https://github.com/tc39/proposal-iterator-helpers + Iterator: { + // Properties of the Iterator Constructor + '[[Proto]]': '%FunctionPrototype%', + prototype: '%IteratorPrototype%', + from: fn}, + + + '%IteratorPrototype%': { + // The %IteratorPrototype% Object + '@@iterator': fn, + // https://github.com/tc39/proposal-iterator-helpers + constructor: 'Iterator', + map: fn, + filter: fn, + take: fn, + drop: fn, + flatMap: fn, + reduce: fn, + toArray: fn, + forEach: fn, + some: fn, + every: fn, + find: fn, + '@@toStringTag': 'string', + // https://github.com/tc39/proposal-async-iterator-helpers + toAsync: fn}, + + + // https://github.com/tc39/proposal-iterator-helpers + '%WrapForValidIteratorPrototype%': { + '[[Proto]]': '%IteratorPrototype%', + next: fn, + return: fn}, + + + // https://github.com/tc39/proposal-iterator-helpers + '%IteratorHelperPrototype%': { + '[[Proto]]': '%IteratorPrototype%', + next: fn, + return: fn, + '@@toStringTag': 'string'}, + + + // https://github.com/tc39/proposal-async-iterator-helpers + AsyncIterator: { + // Properties of the Iterator Constructor + '[[Proto]]': '%FunctionPrototype%', + prototype: '%AsyncIteratorPrototype%', + from: fn}, + + + '%AsyncIteratorPrototype%': { + // The %AsyncIteratorPrototype% Object + '@@asyncIterator': fn, + // https://github.com/tc39/proposal-async-iterator-helpers + constructor: 'AsyncIterator', + map: fn, + filter: fn, + take: fn, + drop: fn, + flatMap: fn, + reduce: fn, + toArray: fn, + forEach: fn, + some: fn, + every: fn, + find: fn, + '@@toStringTag': 'string'}, + + + // https://github.com/tc39/proposal-async-iterator-helpers + '%WrapForValidAsyncIteratorPrototype%': { + '[[Proto]]': '%AsyncIteratorPrototype%', + next: fn, + return: fn}, + + + // https://github.com/tc39/proposal-async-iterator-helpers + '%AsyncIteratorHelperPrototype%': { + '[[Proto]]': '%AsyncIteratorPrototype%', + next: fn, + return: fn, + '@@toStringTag': 'string'}, + + + '%InertGeneratorFunction%': { + // Properties of the GeneratorFunction Constructor + '[[Proto]]': '%InertFunction%', + prototype: '%Generator%'}, + + + '%Generator%': { + // Properties of the GeneratorFunction Prototype Object + '[[Proto]]': '%FunctionPrototype%', + constructor: '%InertGeneratorFunction%', + prototype: '%GeneratorPrototype%', + '@@toStringTag': 'string'}, + + + '%InertAsyncGeneratorFunction%': { + // Properties of the AsyncGeneratorFunction Constructor + '[[Proto]]': '%InertFunction%', + prototype: '%AsyncGenerator%'}, + + + '%AsyncGenerator%': { + // Properties of the AsyncGeneratorFunction Prototype Object + '[[Proto]]': '%FunctionPrototype%', + constructor: '%InertAsyncGeneratorFunction%', + prototype: '%AsyncGeneratorPrototype%', + // length prop added here for React Native jsc-android + // https://github.com/endojs/endo/issues/660 + // https://github.com/react-native-community/jsc-android-buildscripts/issues/181 + length: 'number', + '@@toStringTag': 'string'}, + + + '%GeneratorPrototype%': { + // Properties of the Generator Prototype Object + '[[Proto]]': '%IteratorPrototype%', + constructor: '%Generator%', + next: fn, + return: fn, + throw: fn, + '@@toStringTag': 'string'}, + + + '%AsyncGeneratorPrototype%': { + // Properties of the AsyncGenerator Prototype Object + '[[Proto]]': '%AsyncIteratorPrototype%', + constructor: '%AsyncGenerator%', + next: fn, + return: fn, + throw: fn, + '@@toStringTag': 'string'}, + + + // TODO: To be replaced with Promise.delegate + // + // The HandledPromise global variable shimmed by `@agoric/eventual-send/shim` + // implements an initial version of the eventual send specification at: + // https://github.com/tc39/proposal-eventual-send + // + // We will likely change this to add a property to Promise called + // Promise.delegate and put static methods on it, which will necessitate + // another whitelist change to update to the current proposed standard. + HandledPromise: { + '[[Proto]]': 'Promise', + applyFunction: fn, + applyFunctionSendOnly: fn, + applyMethod: fn, + applyMethodSendOnly: fn, + get: fn, + getSendOnly: fn, + prototype: '%PromisePrototype%', + resolve: fn}, + + + Promise: { + // Properties of the Promise Constructor + '[[Proto]]': '%FunctionPrototype%', + all: fn, + allSettled: fn, + // To transition from `false` to `fn` once we also have `AggregateError` + // TODO https://github.com/Agoric/SES-shim/issues/550 + any: false, // ES2021 + prototype: '%PromisePrototype%', + race: fn, + reject: fn, + resolve: fn, + // https://github.com/tc39/proposal-promise-with-resolvers + withResolvers: fn, + '@@species': getter}, + + + '%PromisePrototype%': { + // Properties of the Promise Prototype Object + catch: fn, + constructor: 'Promise', + finally: fn, + then: fn, + '@@toStringTag': 'string', + // Non-standard, used in node to prevent async_hooks from breaking + 'UniqueSymbol(async_id_symbol)': accessor, + 'UniqueSymbol(trigger_async_id_symbol)': accessor, + 'UniqueSymbol(destroyed)': accessor}, + + + '%InertAsyncFunction%': { + // Properties of the AsyncFunction Constructor + '[[Proto]]': '%InertFunction%', + prototype: '%AsyncFunctionPrototype%'}, + + + '%AsyncFunctionPrototype%': { + // Properties of the AsyncFunction Prototype Object + '[[Proto]]': '%FunctionPrototype%', + constructor: '%InertAsyncFunction%', + // length prop added here for React Native jsc-android + // https://github.com/endojs/endo/issues/660 + // https://github.com/react-native-community/jsc-android-buildscripts/issues/181 + length: 'number', + '@@toStringTag': 'string'}, + + + // Reflection + + Reflect: { + // The Reflect Object + // Not a function object. + apply: fn, + construct: fn, + defineProperty: fn, + deleteProperty: fn, + get: fn, + getOwnPropertyDescriptor: fn, + getPrototypeOf: fn, + has: fn, + isExtensible: fn, + ownKeys: fn, + preventExtensions: fn, + set: fn, + setPrototypeOf: fn, + '@@toStringTag': 'string'}, + + + Proxy: { + // Properties of the Proxy Constructor + '[[Proto]]': '%FunctionPrototype%', + revocable: fn}, + + + // Appendix B + + // Annex B: Additional Properties of the Global Object + + escape: fn, + unescape: fn, + + // Proposed + + '%UniqueCompartment%': { + '[[Proto]]': '%FunctionPrototype%', + prototype: '%CompartmentPrototype%', + toString: fn}, + + + '%InertCompartment%': { + '[[Proto]]': '%FunctionPrototype%', + prototype: '%CompartmentPrototype%', + toString: fn}, + + + '%CompartmentPrototype%': { + constructor: '%InertCompartment%', + evaluate: fn, + globalThis: getter, + name: getter, + // Should this be proposed? + toString: fn, + import: asyncFn, + load: asyncFn, + importNow: fn, + module: fn}, + + + lockdown: fn, + harden: { ...fn, isFake: 'boolean'}, + + '%InitialGetStackString%': fn};$h‍_once.permitted(permitted); +})() +, +// === functors[11] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let TypeError,WeakSet,arrayFilter,create,defineProperty,entries,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,globalThis,is,isObject,objectHasOwnProperty,values,weaksetHas,constantProperties,sharedGlobalPropertyNames,universalPropertyNames,permitted;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["values", [$h‍_a => (values = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]],["./permits.js", [["constantProperties", [$h‍_a => (constantProperties = $h‍_a)]],["sharedGlobalPropertyNames", [$h‍_a => (sharedGlobalPropertyNames = $h‍_a)]],["universalPropertyNames", [$h‍_a => (universalPropertyNames = $h‍_a)]],["permitted", [$h‍_a => (permitted = $h‍_a)]]]]]); + + + + + + + + + + + + + + + + + + + + + + + + +const isFunction= (obj)=>typeof obj=== 'function'; + +// Like defineProperty, but throws if it would modify an existing property. +// We use this to ensure that two conflicting attempts to define the same +// property throws, causing SES initialization to fail. Otherwise, a +// conflict between, for example, two of SES's internal whitelists might +// get masked as one overwrites the other. Accordingly, the thrown error +// complains of a "Conflicting definition". +function initProperty(obj, name, desc) { + if( objectHasOwnProperty(obj, name)) { + const preDesc= getOwnPropertyDescriptor(obj, name); + if( + !preDesc|| + !is(preDesc.value, desc.value)|| + preDesc.get!== desc.get|| + preDesc.set!== desc.set|| + preDesc.writable!== desc.writable|| + preDesc.enumerable!== desc.enumerable|| + preDesc.configurable!== desc.configurable) + { + throw TypeError( `Conflicting definitions of ${name}`); + } + } + defineProperty(obj, name, desc); + } + +// Like defineProperties, but throws if it would modify an existing property. +// This ensures that the intrinsics added to the intrinsics collector object +// graph do not overlap. +function initProperties(obj, descs) { + for( const [name, desc]of entries(descs)) { + initProperty(obj, name, desc); + } + } + +// sampleGlobals creates an intrinsics object, suitable for +// interinsicsCollector.addIntrinsics, from the named properties of a global +// object. +function sampleGlobals(globalObject, newPropertyNames) { + const newIntrinsics= { __proto__: null}; + for( const [globalName, intrinsicName]of entries(newPropertyNames)) { + if( objectHasOwnProperty(globalObject, globalName)) { + newIntrinsics[intrinsicName]= globalObject[globalName]; + } + } + return newIntrinsics; + } + +const makeIntrinsicsCollector= ()=> { + /** @type {Record} */ + const intrinsics= create(null); + let pseudoNatives; + + const addIntrinsics= (newIntrinsics)=>{ + initProperties(intrinsics, getOwnPropertyDescriptors(newIntrinsics)); + }; + freeze(addIntrinsics); + + // For each intrinsic, if it has a `.prototype` property, use the + // whitelist to find out the intrinsic name for that prototype and add it + // to the intrinsics. + const completePrototypes= ()=> { + for( const [name, intrinsic]of entries(intrinsics)) { + if( !isObject(intrinsic)) { + // eslint-disable-next-line no-continue + continue; + } + if( !objectHasOwnProperty(intrinsic, 'prototype')) { + // eslint-disable-next-line no-continue + continue; + } + const permit= permitted[name]; + if( typeof permit!== 'object') { + throw TypeError( `Expected permit object at whitelist.${name}`); + } + const namePrototype= permit.prototype; + if( !namePrototype) { + throw TypeError( `${name}.prototype property not whitelisted`); + } + if( + typeof namePrototype!== 'string'|| + !objectHasOwnProperty(permitted, namePrototype)) + { + throw TypeError( `Unrecognized ${name}.prototype whitelist entry`); + } + const intrinsicPrototype= intrinsic.prototype; + if( objectHasOwnProperty(intrinsics, namePrototype)) { + if( intrinsics[namePrototype]!== intrinsicPrototype) { + throw TypeError( `Conflicting bindings of ${namePrototype}`); + } + // eslint-disable-next-line no-continue + continue; + } + intrinsics[namePrototype]= intrinsicPrototype; + } + }; + freeze(completePrototypes); + + const finalIntrinsics= ()=> { + freeze(intrinsics); + pseudoNatives= new WeakSet(arrayFilter(values(intrinsics), isFunction)); + return intrinsics; + }; + freeze(finalIntrinsics); + + const isPseudoNative= (obj)=>{ + if( !pseudoNatives) { + throw TypeError( + 'isPseudoNative can only be called after finalIntrinsics'); + + } + return weaksetHas(pseudoNatives, obj); + }; + freeze(isPseudoNative); + + const intrinsicsCollector= { + addIntrinsics, + completePrototypes, + finalIntrinsics, + isPseudoNative}; + + freeze(intrinsicsCollector); + + addIntrinsics(constantProperties); + addIntrinsics(sampleGlobals(globalThis, universalPropertyNames)); + + return intrinsicsCollector; + }; + +/** + * getGlobalIntrinsics() + * Doesn't tame, delete, or modify anything. Samples globalObject to create an + * intrinsics record containing only the whitelisted global variables, listed + * by the intrinsic names appropriate for new globals, i.e., the globals of + * newly constructed compartments. + * + * WARNING: + * If run before lockdown, the returned intrinsics record will carry the + * *original* unsafe (feral, untamed) bindings of these global variables. + * + * @param {object} globalObject + */$h‍_once.makeIntrinsicsCollector(makeIntrinsicsCollector); +const getGlobalIntrinsics= (globalObject)=>{ + const { addIntrinsics, finalIntrinsics}= makeIntrinsicsCollector(); + + addIntrinsics(sampleGlobals(globalObject, sharedGlobalPropertyNames)); + + return finalIntrinsics(); + };$h‍_once.getGlobalIntrinsics(getGlobalIntrinsics); +})() +, +// === functors[12] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let permitted,FunctionInstance,isAccessorPermit,Map,String,Symbol,TypeError,arrayFilter,arrayIncludes,arrayMap,entries,getOwnPropertyDescriptor,getPrototypeOf,isObject,mapGet,objectHasOwnProperty,ownKeys,symbolKeyFor;$h‍_imports([["./permits.js", [["permitted", [$h‍_a => (permitted = $h‍_a)]],["FunctionInstance", [$h‍_a => (FunctionInstance = $h‍_a)]],["isAccessorPermit", [$h‍_a => (isAccessorPermit = $h‍_a)]]]],["./commons.js", [["Map", [$h‍_a => (Map = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["Symbol", [$h‍_a => (Symbol = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["arrayIncludes", [$h‍_a => (arrayIncludes = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["symbolKeyFor", [$h‍_a => (symbolKeyFor = $h‍_a)]]]]]); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + * whitelistIntrinsics() + * Removes all non-allowed properties found by recursively and + * reflectively walking own property chains. + * + * @param {object} intrinsics + * @param {(object) => void} markVirtualizedNativeFunction + */ +function whitelistIntrinsics( + intrinsics, + markVirtualizedNativeFunction) + { + // These primitives are allowed allowed for permits. + const primitives= ['undefined', 'boolean', 'number', 'string', 'symbol']; + + // These symbols are allowed as well-known symbols + const wellKnownSymbolNames= new Map( + Symbol? + arrayMap( + arrayFilter( + entries(permitted['%SharedSymbol%']), + ([name, permit])=> + permit=== 'symbol'&& typeof Symbol[name]=== 'symbol'), + + ([name])=> [Symbol[name], `@@${name}`]): + + []); + + + /** + * asStringPropertyName() + * + * @param {string} path + * @param {string | symbol} prop + */ + function asStringPropertyName(path, prop) { + if( typeof prop=== 'string') { + return prop; + } + + const wellKnownSymbol= mapGet(wellKnownSymbolNames, prop); + + if( typeof prop=== 'symbol') { + if( wellKnownSymbol) { + return wellKnownSymbol; + }else { + const registeredKey= symbolKeyFor(prop); + if( registeredKey!== undefined) { + return `RegisteredSymbol(${registeredKey})`; + }else { + return `Unique${String(prop)}`; + } + } + } + + throw TypeError( `Unexpected property name type ${path} ${prop}`); + } + + /* + * visitPrototype() + * Validate the object's [[prototype]] against a permit. + */ + function visitPrototype(path, obj, protoName) { + if( !isObject(obj)) { + throw TypeError( `Object expected: ${path}, ${obj}, ${protoName}`); + } + const proto= getPrototypeOf(obj); + + // Null prototype. + if( proto=== null&& protoName=== null) { + return; + } + + // Assert: protoName, if provided, is a string. + if( protoName!== undefined&& typeof protoName!== 'string') { + throw TypeError( `Malformed whitelist permit ${path}.__proto__`); + } + + // If permit not specified, default to Object.prototype. + if( proto=== intrinsics[protoName|| '%ObjectPrototype%']) { + return; + } + + // We can't clean [[prototype]], therefore abort. + throw TypeError( `Unexpected intrinsic ${path}.__proto__ at ${protoName}`); + } + + /* + * isAllowedPropertyValue() + * Whitelist a single property value against a permit. + */ + function isAllowedPropertyValue(path, value, prop, permit) { + if( typeof permit=== 'object') { + // eslint-disable-next-line no-use-before-define + visitProperties(path, value, permit); + // The property is allowed. + return true; + } + + if( permit=== false) { + // A boolan 'false' permit specifies the removal of a property. + // We require a more specific permit instead of allowing 'true'. + return false; + } + + if( typeof permit=== 'string') { + // A string permit can have one of two meanings: + + if( prop=== 'prototype'|| prop=== 'constructor') { + // For prototype and constructor value properties, the permit + // is the name of an intrinsic. + // Assumption: prototype and constructor cannot be primitives. + // Assert: the permit is the name of an intrinsic. + // Assert: the property value is equal to that intrinsic. + + if( objectHasOwnProperty(intrinsics, permit)) { + if( value!== intrinsics[permit]) { + throw TypeError( `Does not match whitelist ${path}`); + } + return true; + } + }else { + // For all other properties, the permit is the name of a primitive. + // Assert: the permit is the name of a primitive. + // Assert: the property value type is equal to that primitive. + + // eslint-disable-next-line no-lonely-if + if( arrayIncludes(primitives, permit)) { + // eslint-disable-next-line valid-typeof + if( typeof value!== permit) { + throw TypeError( + `At ${path} expected ${permit} not ${typeof value}`); + + } + return true; + } + } + } + + throw TypeError( `Unexpected whitelist permit ${permit} at ${path}`); + } + + /* + * isAllowedProperty() + * Check whether a single property is allowed. + */ + function isAllowedProperty(path, obj, prop, permit) { + const desc= getOwnPropertyDescriptor(obj, prop); + if( !desc) { + throw TypeError( `Property ${prop} not found at ${path}`); + } + + // Is this a value property? + if( objectHasOwnProperty(desc, 'value')) { + if( isAccessorPermit(permit)) { + throw TypeError( `Accessor expected at ${path}`); + } + return isAllowedPropertyValue(path, desc.value, prop, permit); + } + if( !isAccessorPermit(permit)) { + throw TypeError( `Accessor not expected at ${path}`); + } + return( + isAllowedPropertyValue( `${path}`,desc.get, prop, permit.get)&& + isAllowedPropertyValue( `${path}`,desc.set, prop, permit.set)); + + } + + /* + * getSubPermit() + */ + function getSubPermit(obj, permit, prop) { + const permitProp= prop=== '__proto__'? '--proto--': prop; + if( objectHasOwnProperty(permit, permitProp)) { + return permit[permitProp]; + } + + if( typeof obj=== 'function') { + if( objectHasOwnProperty(FunctionInstance, permitProp)) { + return FunctionInstance[permitProp]; + } + } + + return undefined; + } + + /* + * visitProperties() + * Visit all properties for a permit. + */ + function visitProperties(path, obj, permit) { + if( obj=== undefined|| obj=== null) { + return; + } + + const protoName= permit['[[Proto]]']; + visitPrototype(path, obj, protoName); + + if( typeof obj=== 'function') { + markVirtualizedNativeFunction(obj); + } + + for( const prop of ownKeys(obj)) { + const propString= asStringPropertyName(path, prop); + const subPath= `${path}.${propString}`; + const subPermit= getSubPermit(obj, permit, propString); + + if( !subPermit|| !isAllowedProperty(subPath, obj, prop, subPermit)) { + // Either the object lacks a permit or the object doesn't match the + // permit. + // If the permit is specifically false, not merely undefined, + // this is a property we expect to see because we know it exists in + // some environments and we have expressly decided to exclude it. + // Any other disallowed property is one we have not audited and we log + // that we are removing it so we know to look into it, as happens when + // the language evolves new features to existing intrinsics. + if( subPermit!== false) { + // This call to `console.warn` is intentional. It is not a vestige of + // a debugging attempt. See the comment at top of file for an + // explanation. + // eslint-disable-next-line @endo/no-polymorphic-call + console.warn( `Removing ${subPath}`); + } + try { + delete obj[prop]; + }catch( err) { + if( prop in obj) { + if( typeof obj=== 'function'&& prop=== 'prototype') { + obj.prototype= undefined; + if( obj.prototype=== undefined) { + // eslint-disable-next-line @endo/no-polymorphic-call + console.warn( `Tolerating undeletable ${subPath} === undefined`); + // eslint-disable-next-line no-continue + continue; + } + } + // eslint-disable-next-line @endo/no-polymorphic-call + console.error( `failed to delete ${subPath}`,err); + }else { + // eslint-disable-next-line @endo/no-polymorphic-call + console.error( `deleting ${subPath} threw`,err); + } + throw err; + } + } + } + } + + // Start path with 'intrinsics' to clarify that properties are not + // removed from the global object by the whitelisting operation. + visitProperties('intrinsics', intrinsics, permitted); + }$h‍_once.default( whitelistIntrinsics); +})() +, +// === functors[13] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_FUNCTION,SyntaxError,TypeError,defineProperties,getPrototypeOf,setPrototypeOf,freeze;$h‍_imports([["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["SyntaxError", [$h‍_a => (SyntaxError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["setPrototypeOf", [$h‍_a => (setPrototypeOf = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]]]); + + + + + + + + + +// This module replaces the original `Function` constructor, and the original +// `%GeneratorFunction%`, `%AsyncFunction%` and `%AsyncGeneratorFunction%`, +// with safe replacements that throw if invoked. +// +// These are all reachable via syntax, so it isn't sufficient to just +// replace global properties with safe versions. Our main goal is to prevent +// access to the `Function` constructor through these starting points. +// +// After modules block is done, the originals must no longer be reachable, +// unless a copy has been made, and functions can only be created by syntax +// (using eval) or by invoking a previously saved reference to the originals. +// +// Typically, this module will not be used directly, but via the +// [lockdown - shim] which handles all necessary repairs and taming in SES. +// +// Relation to ECMA specifications +// +// The taming of constructors really wants to be part of the standard, because +// new constructors may be added in the future, reachable from syntax, and this +// list must be updated to match. +// +// In addition, the standard needs to define four new intrinsics for the safe +// replacement functions. See [./permits-intrinsics.js]. +// +// Adapted from SES/Caja +// Copyright (C) 2011 Google Inc. +// https://github.com/google/caja/blob/master/src/com/google/caja/ses/startSES.js +// https://github.com/google/caja/blob/master/src/com/google/caja/ses/repairES5.js + +/** + * tameFunctionConstructors() + * This block replaces the original Function constructor, and the original + * %GeneratorFunction% %AsyncFunction% and %AsyncGeneratorFunction%, with + * safe replacements that throw if invoked. + */ +function tameFunctionConstructors() { + try { + // Verify that the method is not callable. + // eslint-disable-next-line @endo/no-polymorphic-call + FERAL_FUNCTION.prototype.constructor('return 1'); + }catch( ignore) { + // Throws, no need to patch. + return freeze({}); + } + + const newIntrinsics= {}; + + /* + * The process to repair constructors: + * 1. Create an instance of the function by evaluating syntax + * 2. Obtain the prototype from the instance + * 3. Create a substitute tamed constructor + * 4. Replace the original constructor with the tamed constructor + * 5. Replace tamed constructor prototype property with the original one + * 6. Replace its [[Prototype]] slot with the tamed constructor of Function + */ + function repairFunction(name, intrinsicName, declaration) { + let FunctionInstance; + try { + // eslint-disable-next-line no-eval, no-restricted-globals + FunctionInstance= (0, eval)(declaration); + }catch( e) { + if( e instanceof SyntaxError) { + // Prevent failure on platforms where async and/or generators + // are not supported. + return; + } + // Re-throw + throw e; + } + const FunctionPrototype= getPrototypeOf(FunctionInstance); + + // Prevents the evaluation of source when calling constructor on the + // prototype of functions. + // eslint-disable-next-line func-names + const InertConstructor= function() { + throw TypeError( + 'Function.prototype.constructor is not a valid constructor.'); + + }; + defineProperties(InertConstructor, { + prototype: { value: FunctionPrototype}, + name: { + value: name, + writable: false, + enumerable: false, + configurable: true}}); + + + + defineProperties(FunctionPrototype, { + constructor: { value: InertConstructor}}); + + + // Reconstructs the inheritance among the new tamed constructors + // to mirror the original specified in normal JS. + if( InertConstructor!== FERAL_FUNCTION.prototype.constructor) { + setPrototypeOf(InertConstructor, FERAL_FUNCTION.prototype.constructor); + } + + newIntrinsics[intrinsicName]= InertConstructor; + } + + // Here, the order of operation is important: Function needs to be repaired + // first since the other repaired constructors need to inherit from the + // tamed Function function constructor. + + repairFunction('Function', '%InertFunction%', '(function(){})'); + repairFunction( + 'GeneratorFunction', + '%InertGeneratorFunction%', + '(function*(){})'); + + repairFunction( + 'AsyncFunction', + '%InertAsyncFunction%', + '(async function(){})'); + + repairFunction( + 'AsyncGeneratorFunction', + '%InertAsyncGeneratorFunction%', + '(async function*(){})'); + + + return newIntrinsics; + }$h‍_once.default( tameFunctionConstructors); +})() +, +// === functors[14] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Date,TypeError,apply,construct,defineProperties;$h‍_imports([["./commons.js", [["Date", [$h‍_a => (Date = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["construct", [$h‍_a => (construct = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]]]]]); + + + + + + + + + +function tameDateConstructor(dateTaming= 'safe') { + if( dateTaming!== 'safe'&& dateTaming!== 'unsafe') { + throw TypeError( `unrecognized dateTaming ${dateTaming}`); + } + const OriginalDate= Date; + const DatePrototype= OriginalDate.prototype; + + // Use concise methods to obtain named functions without constructors. + const tamedMethods= { + /** + * `%SharedDate%.now()` throw a `TypeError` starting with "secure mode". + * See https://github.com/endojs/endo/issues/910#issuecomment-1581855420 + */ + now() { + throw TypeError('secure mode Calling %SharedDate%.now() throws'); + }}; + + + /** + * Tame the Date constructor. + * See https://github.com/endojs/endo/issues/910#issuecomment-1581855420 + * + * Common behavior + * * `new Date(x)` coerces x into a number and then returns a Date + * for that number of millis since the epoch + * * `new Date(NaN)` returns a Date object which stringifies to + * 'Invalid Date' + * * `new Date(undefined)` returns a Date object which stringifies to + * 'Invalid Date' + * + * OriginalDate (normal standard) behavior preserved by + * `%InitialDate%`. + * * `Date(anything)` gives a string with the current time + * * `new Date()` returns the current time, as a Date object + * + * `%SharedDate%` behavior + * * `Date(anything)` throws a TypeError starting with "secure mode" + * * `new Date()` throws a TypeError starting with "secure mode" + * + * @param {{powers?: string}} [opts] + */ + const makeDateConstructor= ({ powers= 'none'}= {})=> { + let ResultDate; + if( powers=== 'original') { + // eslint-disable-next-line no-shadow + ResultDate= function Date(...rest) { + if( new.target=== undefined) { + return apply(OriginalDate, undefined, rest); + } + return construct(OriginalDate, rest, new.target); + }; + }else { + // eslint-disable-next-line no-shadow + ResultDate= function Date(...rest) { + if( new.target=== undefined) { + throw TypeError( + 'secure mode Calling %SharedDate% constructor as a function throws'); + + } + if( rest.length=== 0) { + throw TypeError( + 'secure mode Calling new %SharedDate%() with no arguments throws'); + + } + return construct(OriginalDate, rest, new.target); + }; + } + + defineProperties(ResultDate, { + length: { value: 7}, + prototype: { + value: DatePrototype, + writable: false, + enumerable: false, + configurable: false}, + + parse: { + value: OriginalDate.parse, + writable: true, + enumerable: false, + configurable: true}, + + UTC: { + value: OriginalDate.UTC, + writable: true, + enumerable: false, + configurable: true}}); + + + return ResultDate; + }; + const InitialDate= makeDateConstructor({ powers: 'original'}); + const SharedDate= makeDateConstructor({ powers: 'none'}); + + defineProperties(InitialDate, { + now: { + value: OriginalDate.now, + writable: true, + enumerable: false, + configurable: true}}); + + + defineProperties(SharedDate, { + now: { + value: tamedMethods.now, + writable: true, + enumerable: false, + configurable: true}}); + + + + defineProperties(DatePrototype, { + constructor: { value: SharedDate}}); + + + return { + '%InitialDate%': InitialDate, + '%SharedDate%': SharedDate}; + + }$h‍_once.default( tameDateConstructor); +})() +, +// === functors[15] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Math,TypeError,create,getOwnPropertyDescriptors,objectPrototype;$h‍_imports([["./commons.js", [["Math", [$h‍_a => (Math = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["objectPrototype", [$h‍_a => (objectPrototype = $h‍_a)]]]]]); + + + + + + + +function tameMathObject(mathTaming= 'safe') { + if( mathTaming!== 'safe'&& mathTaming!== 'unsafe') { + throw TypeError( `unrecognized mathTaming ${mathTaming}`); + } + const originalMath= Math; + const initialMath= originalMath; // to follow the naming pattern + + const { random: _, ...otherDescriptors}= + getOwnPropertyDescriptors(originalMath); + + // Use concise methods to obtain named functions without constructors. + const tamedMethods= { + /** + * `%SharedMath%.random()` throws a TypeError starting with "secure mode". + * See https://github.com/endojs/endo/issues/910#issuecomment-1581855420 + */ + random() { + throw TypeError('secure mode %SharedMath%.random() throws'); + }}; + + + const sharedMath= create(objectPrototype, { + ...otherDescriptors, + random: { + value: tamedMethods.random, + writable: true, + enumerable: false, + configurable: true}}); + + + + return { + '%InitialMath%': initialMath, + '%SharedMath%': sharedMath}; + + }$h‍_once.default( tameMathObject); +})() +, +// === functors[16] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_REG_EXP,TypeError,construct,defineProperties,getOwnPropertyDescriptor,speciesSymbol;$h‍_imports([["./commons.js", [["FERAL_REG_EXP", [$h‍_a => (FERAL_REG_EXP = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["construct", [$h‍_a => (construct = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["speciesSymbol", [$h‍_a => (speciesSymbol = $h‍_a)]]]]]); + + + + + + + + +function tameRegExpConstructor(regExpTaming= 'safe') { + if( regExpTaming!== 'safe'&& regExpTaming!== 'unsafe') { + throw TypeError( `unrecognized regExpTaming ${regExpTaming}`); + } + const RegExpPrototype= FERAL_REG_EXP.prototype; + + const makeRegExpConstructor= (_= {})=> { + // RegExp has non-writable static properties we need to omit. + /** + * @param {Parameters} rest + */ + const ResultRegExp= function RegExp(...rest) { + if( new.target=== undefined) { + return FERAL_REG_EXP(...rest); + } + return construct(FERAL_REG_EXP, rest, new.target); + }; + + const speciesDesc= getOwnPropertyDescriptor(FERAL_REG_EXP, speciesSymbol); + if( !speciesDesc) { + throw TypeError('no RegExp[Symbol.species] descriptor'); + } + + defineProperties(ResultRegExp, { + length: { value: 2}, + prototype: { + value: RegExpPrototype, + writable: false, + enumerable: false, + configurable: false}, + + [speciesSymbol]: speciesDesc}); + + return ResultRegExp; + }; + + const InitialRegExp= makeRegExpConstructor(); + const SharedRegExp= makeRegExpConstructor(); + + if( regExpTaming!== 'unsafe') { + // @ts-expect-error Deleted properties must be optional + delete RegExpPrototype.compile; + } + defineProperties(RegExpPrototype, { + constructor: { value: SharedRegExp}}); + + + return { + '%InitialRegExp%': InitialRegExp, + '%SharedRegExp%': SharedRegExp}; + + }$h‍_once.default( tameRegExpConstructor); +})() +, +// === functors[17] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([]); /** + * @file Exports {@code enablements}, a recursively defined + * JSON record defining the optimum set of intrinsics properties + * that need to be "repaired" before hardening is applied on + * enviromments subject to the override mistake. + * + * @author JF Paradis + * @author Mark S. Miller + */ + +/** + *

    Because "repairing" replaces data properties with accessors, every + * time a repaired property is accessed, the associated getter is invoked, + * which degrades the runtime performance of all code executing in the + * repaired enviromment, compared to the non-repaired case. In order + * to maintain performance, we only repair the properties of objects + * for which hardening causes a breakage of their normal intended usage. + * + * There are three unwanted cases: + *

      + *
    • Overriding properties on objects typically used as records, + * namely {@code "Object"} and {@code "Array"}. In the case of arrays, + * the situation is unintentional, a given program might not be aware + * that non-numerical properties are stored on the underlying object + * instance, not on the array. When an object is typically used as a + * map, we repair all of its prototype properties. + *
    • Overriding properties on objects that provide defaults on their + * prototype and that programs typically set using an assignment, such as + * {@code "Error.prototype.message"} and {@code "Function.prototype.name"} + * (both default to ""). + *
    • Setting-up a prototype chain, where a constructor is set to extend + * another one. This is typically set by assignment, for example + * {@code "Child.prototype.constructor = Child"}, instead of invoking + * Object.defineProperty(); + * + *

      Each JSON record enumerates the disposition of the properties on + * some corresponding intrinsic object. + * + *

      For each such record, the values associated with its property + * names can be: + *

        + *
      • true, in which case this property is simply repaired. The + * value associated with that property is not traversed. For + * example, {@code "Function.prototype.name"} leads to true, + * meaning that the {@code "name"} property of {@code + * "Function.prototype"} should be repaired (which is needed + * when inheriting from @code{Function} and setting the subclass's + * {@code "prototype.name"} property). If the property is + * already an accessor property, it is not repaired (because + * accessors are not subject to the override mistake). + *
      • "*", in which case this property is not repaired but the + * value associated with that property are traversed and repaired. + *
      • Another record, in which case this property is not repaired + * and that next record represents the disposition of the object + * which is its value. For example,{@code "FunctionPrototype"} + * leads to another record explaining which properties {@code + * Function.prototype} need to be repaired. + */ + +/** + * Minimal enablements when all the code is modern and known not to + * step into the override mistake, except for the following pervasive + * cases. + */ +const minEnablements= { + '%ObjectPrototype%': { + toString: true}, + + + '%FunctionPrototype%': { + toString: true // set by "rollup" +}, + + '%ErrorPrototype%': { + name: true // set by "precond", "ava", "node-fetch" +}}; + + +/** + * Moderate enablements are usually good enough for legacy compat. + */$h‍_once.minEnablements(minEnablements); +const moderateEnablements= { + '%ObjectPrototype%': { + toString: true, + valueOf: true}, + + + '%ArrayPrototype%': { + toString: true, + push: true // set by "Google Analytics" +}, + + // Function.prototype has no 'prototype' property to enable. + // Function instances have their own 'name' and 'length' properties + // which are configurable and non-writable. Thus, they are already + // non-assignable anyway. + '%FunctionPrototype%': { + constructor: true, // set by "regenerator-runtime" + bind: true, // set by "underscore", "express" + toString: true // set by "rollup" +}, + + '%ErrorPrototype%': { + constructor: true, // set by "fast-json-patch", "node-fetch" + message: true, + name: true, // set by "precond", "ava", "node-fetch", "node 14" + toString: true // set by "bluebird" +}, + + '%TypeErrorPrototype%': { + constructor: true, // set by "readable-stream" + message: true, // set by "tape" + name: true // set by "readable-stream", "node 14" +}, + + '%SyntaxErrorPrototype%': { + message: true, // to match TypeErrorPrototype.message + name: true // set by "node 14" +}, + + '%RangeErrorPrototype%': { + message: true, // to match TypeErrorPrototype.message + name: true // set by "node 14" +}, + + '%URIErrorPrototype%': { + message: true, // to match TypeErrorPrototype.message + name: true // set by "node 14" +}, + + '%EvalErrorPrototype%': { + message: true, // to match TypeErrorPrototype.message + name: true // set by "node 14" +}, + + '%ReferenceErrorPrototype%': { + message: true, // to match TypeErrorPrototype.message + name: true // set by "node 14" +}, + + '%PromisePrototype%': { + constructor: true // set by "core-js" +}, + + '%TypedArrayPrototype%': '*', // set by https://github.com/feross/buffer + + '%Generator%': { + constructor: true, + name: true, + toString: true}, + + + '%IteratorPrototype%': { + toString: true}}; + + + +/** + * The 'severe' enablement are needed because of issues tracked at + * https://github.com/endojs/endo/issues/576 + * + * They are like the `moderate` enablements except for the entries below. + */$h‍_once.moderateEnablements(moderateEnablements); +const severeEnablements= { + ...moderateEnablements, + + /** + * Rollup (as used at least by vega) and webpack + * (as used at least by regenerator) both turn exports into assignments + * to a big `exports` object that inherits directly from + * `Object.prototype`. Some of the exported names we've seen include + * `hasOwnProperty`, `constructor`, and `toString`. But the strategy used + * by rollup and webpack potentionally turns any exported name + * into an assignment rejected by the override mistake. That's why + * the `severe` enablements takes the extreme step of enabling + * everything on `Object.prototype`. + * + * In addition, code doing inheritance manually will often override + * the `constructor` property on the new prototype by assignment. We've + * seen this several times. + * + * The cost of enabling all these is that they create a miserable debugging + * experience specifically on Node. + * https://github.com/Agoric/agoric-sdk/issues/2324 + * explains how it confused the Node console. + * + * (TODO Reexamine the vscode situation. I think it may have improved + * since the following paragraph was written.) + * + * The vscode debugger's object inspector shows the own data properties of + * an object, which is typically what you want, but also shows both getter + * and setter for every accessor property whether inherited or own. + * With the `'*'` setting here, all the properties inherited from + * `Object.prototype` are accessors, creating an unusable display as seen + * at As explained at + * https://github.com/endojs/endo/blob/master/packages/ses/docs/lockdown.md#overridetaming-options + * Open the triangles at the bottom of that section. + */ + '%ObjectPrototype%': '*', + + /** + * The widely used Buffer defined at https://github.com/feross/buffer + * on initialization, manually creates the equivalent of a subclass of + * `TypedArray`, which it then initializes by assignment. These assignments + * include enough of the `TypeArray` methods that here, the `severe` + * enablements just enable them all. + */ + '%TypedArrayPrototype%': '*', + + /** + * Needed to work with Immer before https://github.com/immerjs/immer/pull/914 + * is accepted. + */ + '%MapPrototype%': '*', + + /** + * Needed to work with Immer before https://github.com/immerjs/immer/pull/914 + * is accepted. + */ + '%SetPrototype%': '*'};$h‍_once.severeEnablements(severeEnablements); +})() +, +// === functors[18] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Set,String,TypeError,arrayForEach,defineProperty,getOwnPropertyDescriptor,getOwnPropertyDescriptors,getOwnPropertyNames,isObject,objectHasOwnProperty,ownKeys,setHas,minEnablements,moderateEnablements,severeEnablements;$h‍_imports([["./commons.js", [["Set", [$h‍_a => (Set = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayForEach", [$h‍_a => (arrayForEach = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["getOwnPropertyNames", [$h‍_a => (getOwnPropertyNames = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["setHas", [$h‍_a => (setHas = $h‍_a)]]]],["./enablements.js", [["minEnablements", [$h‍_a => (minEnablements = $h‍_a)]],["moderateEnablements", [$h‍_a => (moderateEnablements = $h‍_a)]],["severeEnablements", [$h‍_a => (severeEnablements = $h‍_a)]]]]]); + + + + + + + + + + + + + + + + + + + + + + + + + +/** + * For a special set of properties defined in the `enablement` whitelist, + * `enablePropertyOverrides` ensures that the effect of freezing does not + * suppress the ability to override these properties on derived objects by + * simple assignment. + * + * Because of lack of sufficient foresight at the time, ES5 unfortunately + * specified that a simple assignment to a non-existent property must fail if + * it would override an non-writable data property of the same name in the + * shadow of the prototype chain. In retrospect, this was a mistake, the + * so-called "override mistake". But it is now too late and we must live with + * the consequences. + * + * As a result, simply freezing an object to make it tamper proof has the + * unfortunate side effect of breaking previously correct code that is + * considered to have followed JS best practices, if this previous code used + * assignment to override. + * + * For the enabled properties, `enablePropertyOverrides` effectively shims what + * the assignment behavior would have been in the absence of the override + * mistake. However, the shim produces an imperfect emulation. It shims the + * behavior by turning these data properties into accessor properties, where + * the accessor's getter and setter provide the desired behavior. For + * non-reflective operations, the illusion is perfect. However, reflective + * operations like `getOwnPropertyDescriptor` see the descriptor of an accessor + * property rather than the descriptor of a data property. At the time of this + * writing, this is the best we know how to do. + * + * To the getter of the accessor we add a property named + * `'originalValue'` whose value is, as it says, the value that the + * data property had before being converted to an accessor property. We add + * this extra property to the getter for two reason: + * + * The harden algorithm walks the own properties reflectively, i.e., with + * `getOwnPropertyDescriptor` semantics, rather than `[[Get]]` semantics. When + * it sees an accessor property, it does not invoke the getter. Rather, it + * proceeds to walk both the getter and setter as part of its transitive + * traversal. Without this extra property, `enablePropertyOverrides` would have + * hidden the original data property value from `harden`, which would be bad. + * Instead, by exposing that value in an own data property on the getter, + * `harden` finds and walks it anyway. + * + * We enable a form of cooperative emulation, giving reflective code an + * opportunity to cooperate in upholding the illusion. When such cooperative + * reflective code sees an accessor property, where the accessor's getter + * has an `originalValue` property, it knows that the getter is + * alleging that it is the result of the `enablePropertyOverrides` conversion + * pattern, so it can decide to cooperatively "pretend" that it sees a data + * property with that value. + * + * @param {Record} intrinsics + * @param {'min' | 'moderate' | 'severe'} overrideTaming + * @param {Iterable} [overrideDebug] + */ +function enablePropertyOverrides( + intrinsics, + overrideTaming, + overrideDebug= []) + { + const debugProperties= new Set(overrideDebug); + function enable(path, obj, prop, desc) { + if( 'value'in desc&& desc.configurable) { + const { value}= desc; + + function getter() { + return value; + } + defineProperty(getter, 'originalValue', { + value, + writable: false, + enumerable: false, + configurable: false}); + + + const isDebug= setHas(debugProperties, prop); + + function setter(newValue) { + if( obj=== this) { + throw TypeError( + `Cannot assign to read only property '${String( + prop) + }' of '${path}'`); + + } + if( objectHasOwnProperty(this, prop)) { + this[prop]= newValue; + }else { + if( isDebug) { + // eslint-disable-next-line @endo/no-polymorphic-call + console.error(TypeError( `Override property ${prop}`)); + } + defineProperty(this, prop, { + value: newValue, + writable: true, + enumerable: true, + configurable: true}); + + } + } + + defineProperty(obj, prop, { + get: getter, + set: setter, + enumerable: desc.enumerable, + configurable: desc.configurable}); + + } + } + + function enableProperty(path, obj, prop) { + const desc= getOwnPropertyDescriptor(obj, prop); + if( !desc) { + return; + } + enable(path, obj, prop, desc); + } + + function enableAllProperties(path, obj) { + const descs= getOwnPropertyDescriptors(obj); + if( !descs) { + return; + } + // TypeScript does not allow symbols to be used as indexes because it + // cannot recokon types of symbolized properties. + // @ts-ignore + arrayForEach(ownKeys(descs), (prop)=>enable(path, obj, prop, descs[prop])); + } + + function enableProperties(path, obj, plan) { + for( const prop of getOwnPropertyNames(plan)) { + const desc= getOwnPropertyDescriptor(obj, prop); + if( !desc|| desc.get|| desc.set) { + // No not a value property, nothing to do. + // eslint-disable-next-line no-continue + continue; + } + + // Plan has no symbol keys and we use getOwnPropertyNames() + // so `prop` cannot only be a string, not a symbol. We coerce it in place + // with `String(..)` anyway just as good hygiene, since these paths are just + // for diagnostic purposes. + const subPath= `${path}.${String(prop)}`; + const subPlan= plan[prop]; + + if( subPlan=== true) { + enableProperty(subPath, obj, prop); + }else if( subPlan=== '*') { + enableAllProperties(subPath, desc.value); + }else if( isObject(subPlan)) { + enableProperties(subPath, desc.value, subPlan); + }else { + throw TypeError( `Unexpected override enablement plan ${subPath}`); + } + } + } + + let plan; + switch( overrideTaming){ + case 'min': { + plan= minEnablements; + break; + } + case 'moderate': { + plan= moderateEnablements; + break; + } + case 'severe': { + plan= severeEnablements; + break; + } + default: { + throw TypeError( `unrecognized overrideTaming ${overrideTaming}`); + }} + + + // Do the repair. + enableProperties('root', intrinsics, plan); + }$h‍_once.default( enablePropertyOverrides); +})() +, +// === functors[19] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Number,String,TypeError,defineProperty,getOwnPropertyNames,isObject,regexpExec,assert;$h‍_imports([["./commons.js", [["Number", [$h‍_a => (Number = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["getOwnPropertyNames", [$h‍_a => (getOwnPropertyNames = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["regexpExec", [$h‍_a => (regexpExec = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); + + + + + + + + + + +const { Fail, quote: q}= assert; + +const localePattern= /^(\w*[a-z])Locale([A-Z]\w*)$/; + +// Use concise methods to obtain named functions without constructor +// behavior or `.prototype` property. +const tamedMethods= { + // See https://tc39.es/ecma262/#sec-string.prototype.localecompare + localeCompare(arg) { + if( this=== null|| this=== undefined) { + throw TypeError( + 'Cannot localeCompare with null or undefined "this" value'); + + } + const s= `${this}`; + const that= `${arg}`; + if( s< that) { + return -1; + } + if( s> that) { + return 1; + } + s=== that|| Fail `expected ${q(s)} and ${q(that)} to compare`; + return 0; + }, + + toString() { + return `${this}`; + }}; + + +const nonLocaleCompare= tamedMethods.localeCompare; +const numberToString= tamedMethods.toString; + +function tameLocaleMethods(intrinsics, localeTaming= 'safe') { + if( localeTaming!== 'safe'&& localeTaming!== 'unsafe') { + throw TypeError( `unrecognized localeTaming ${localeTaming}`); + } + if( localeTaming=== 'unsafe') { + return; + } + + defineProperty(String.prototype, 'localeCompare', { + value: nonLocaleCompare}); + + + for( const intrinsicName of getOwnPropertyNames(intrinsics)) { + const intrinsic= intrinsics[intrinsicName]; + if( isObject(intrinsic)) { + for( const methodName of getOwnPropertyNames(intrinsic)) { + const match= regexpExec(localePattern, methodName); + if( match) { + typeof intrinsic[methodName]=== 'function'|| + Fail `expected ${q(methodName)} to be a function`; + const nonLocaleMethodName= `${match[1]}${match[2]}`; + const method= intrinsic[nonLocaleMethodName]; + typeof method=== 'function'|| + Fail `function ${q(nonLocaleMethodName)} not found`; + defineProperty(intrinsic, methodName, { value: method}); + } + } + } + } + + // Numbers are special because toString accepts a radix instead of ignoring + // all of the arguments that we would otherwise forward. + defineProperty(Number.prototype, 'toLocaleString', { + value: numberToString}); + + }$h‍_once.default( tameLocaleMethods); +})() +, +// === functors[20] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([]); /** + * makeEvalFunction() + * A safe version of the native eval function which relies on + * the safety of safeEvaluate for confinement. + * + * @param {Function} safeEvaluate + */ +const makeEvalFunction= (safeEvaluate)=>{ + // We use the the concise method syntax to create an eval without a + // [[Construct]] behavior (such that the invocation "new eval()" throws + // TypeError: eval is not a constructor"), but which still accepts a + // 'this' binding. + const newEval= { + eval(source) { + if( typeof source!== 'string') { + // As per the runtime semantic of PerformEval [ECMAScript 18.2.1.1]: + // If Type(source) is not String, return source. + // TODO Recent proposals from Mike Samuel may change this non-string + // rule. Track. + return source; + } + return safeEvaluate(source); + }}. + eval; + + return newEval; + };$h‍_once.makeEvalFunction(makeEvalFunction); +})() +, +// === functors[21] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_FUNCTION,arrayJoin,arrayPop,defineProperties,getPrototypeOf,assert;$h‍_imports([["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayPop", [$h‍_a => (arrayPop = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); + + + + + + + + +const { Fail}= assert; + +/* + * makeFunctionConstructor() + * A safe version of the native Function which relies on + * the safety of safeEvaluate for confinement. + */ +const makeFunctionConstructor= (safeEvaluate)=>{ + // Define an unused parameter to ensure Function.length === 1 + const newFunction= function Function(_body) { + // Sanitize all parameters at the entry point. + // eslint-disable-next-line prefer-rest-params + const bodyText= `${arrayPop(arguments)|| '' }`; + // eslint-disable-next-line prefer-rest-params + const parameters= `${arrayJoin(arguments,',') }`; + + // Are parameters and bodyText valid code, or is someone + // attempting an injection attack? This will throw a SyntaxError if: + // - parameters doesn't parse as parameters + // - bodyText doesn't parse as a function body + // - either contain a call to super() or references a super property. + // + // It seems that XS may still be vulnerable to the attack explained at + // https://github.com/tc39/ecma262/pull/2374#issuecomment-813769710 + // where `new Function('/*', '*/ ) {')` would incorrectly validate. + // Before we worried about this, we check the parameters and bodyText + // together in one call + // ```js + // new FERAL_FUNCTION(parameters, bodyTest); + // ``` + // However, this check is vulnerable to that bug. Aside from that case, + // all engines do seem to validate the parameters, taken by themselves, + // correctly. And all engines do seem to validate the bodyText, taken + // by itself correctly. So with the following two checks, SES builds a + // correct safe `Function` constructor by composing two calls to an + // original unsafe `Function` constructor that may suffer from this bug + // but is otherwise correctly validating. + // + // eslint-disable-next-line no-new + new FERAL_FUNCTION(parameters, ''); + // eslint-disable-next-line no-new + new FERAL_FUNCTION(bodyText); + + // Safe to be combined. Defeat potential trailing comments. + // TODO: since we create an anonymous function, the 'this' value + // isn't bound to the global object as per specs, but set as undefined. + const src= `(function anonymous(${parameters}\n) {\n${bodyText}\n})`; + return safeEvaluate(src); + }; + + defineProperties(newFunction, { + // Ensure that any function created in any evaluator in a realm is an + // instance of Function in any evaluator of the same realm. + prototype: { + value: FERAL_FUNCTION.prototype, + writable: false, + enumerable: false, + configurable: false}}); + + + + // Assert identity of Function.__proto__ accross all compartments + getPrototypeOf(FERAL_FUNCTION)=== FERAL_FUNCTION.prototype|| + Fail `Function prototype is the same accross compartments`; + getPrototypeOf(newFunction)=== FERAL_FUNCTION.prototype|| + Fail `Function constructor prototype is the same accross compartments`; + + return newFunction; + };$h‍_once.makeFunctionConstructor(makeFunctionConstructor); +})() +, +// === functors[22] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let TypeError,assign,create,defineProperty,entries,freeze,objectHasOwnProperty,unscopablesSymbol,makeEvalFunction,makeFunctionConstructor,constantProperties,universalPropertyNames;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["assign", [$h‍_a => (assign = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["unscopablesSymbol", [$h‍_a => (unscopablesSymbol = $h‍_a)]]]],["./make-eval-function.js", [["makeEvalFunction", [$h‍_a => (makeEvalFunction = $h‍_a)]]]],["./make-function-constructor.js", [["makeFunctionConstructor", [$h‍_a => (makeFunctionConstructor = $h‍_a)]]]],["./permits.js", [["constantProperties", [$h‍_a => (constantProperties = $h‍_a)]],["universalPropertyNames", [$h‍_a => (universalPropertyNames = $h‍_a)]]]]]); + + + + + + + + + + + + + +/** + * The host's ordinary global object is not provided by a `with` block, so + * assigning to Symbol.unscopables has no effect. + * Since this shim uses `with` blocks to create a confined lexical scope for + * guest programs, we cannot emulate the proper behavior. + * With this shim, assigning Symbol.unscopables causes the given lexical + * names to fall through to the terminal scope proxy. + * But, we can install this setter to prevent a program from proceding on + * this false assumption. + * + * @param {object} globalObject + */ +const setGlobalObjectSymbolUnscopables= (globalObject)=>{ + defineProperty( + globalObject, + unscopablesSymbol, + freeze( + assign(create(null), { + set: freeze(()=> { + throw TypeError( + `Cannot set Symbol.unscopables of a Compartment's globalThis`); + + }), + enumerable: false, + configurable: false}))); + + + + }; + +/** + * setGlobalObjectConstantProperties() + * Initializes a new global object using a process similar to ECMA specifications + * (SetDefaultGlobalBindings). This process is split between this function and + * `setGlobalObjectMutableProperties`. + * + * @param {object} globalObject + */$h‍_once.setGlobalObjectSymbolUnscopables(setGlobalObjectSymbolUnscopables); +const setGlobalObjectConstantProperties= (globalObject)=>{ + for( const [name, constant]of entries(constantProperties)) { + defineProperty(globalObject, name, { + value: constant, + writable: false, + enumerable: false, + configurable: false}); + + } + }; + +/** + * setGlobalObjectMutableProperties() + * Create new global object using a process similar to ECMA specifications + * (portions of SetRealmGlobalObject and SetDefaultGlobalBindings). + * `newGlobalPropertyNames` should be either `initialGlobalPropertyNames` or + * `sharedGlobalPropertyNames`. + * + * @param {object} globalObject + * @param {object} param1 + * @param {object} param1.intrinsics + * @param {object} param1.newGlobalPropertyNames + * @param {Function} param1.makeCompartmentConstructor + * @param {(object) => void} param1.markVirtualizedNativeFunction + */$h‍_once.setGlobalObjectConstantProperties(setGlobalObjectConstantProperties); +const setGlobalObjectMutableProperties= ( + globalObject, + { + intrinsics, + newGlobalPropertyNames, + makeCompartmentConstructor, + markVirtualizedNativeFunction})=> + + { + for( const [name, intrinsicName]of entries(universalPropertyNames)) { + if( objectHasOwnProperty(intrinsics, intrinsicName)) { + defineProperty(globalObject, name, { + value: intrinsics[intrinsicName], + writable: true, + enumerable: false, + configurable: true}); + + } + } + + for( const [name, intrinsicName]of entries(newGlobalPropertyNames)) { + if( objectHasOwnProperty(intrinsics, intrinsicName)) { + defineProperty(globalObject, name, { + value: intrinsics[intrinsicName], + writable: true, + enumerable: false, + configurable: true}); + + } + } + + const perCompartmentGlobals= { + globalThis: globalObject}; + + + perCompartmentGlobals.Compartment= freeze( + makeCompartmentConstructor( + makeCompartmentConstructor, + intrinsics, + markVirtualizedNativeFunction)); + + + + // TODO These should still be tamed according to the whitelist before + // being made available. + for( const [name, value]of entries(perCompartmentGlobals)) { + defineProperty(globalObject, name, { + value, + writable: true, + enumerable: false, + configurable: true}); + + if( typeof value=== 'function') { + markVirtualizedNativeFunction(value); + } + } + }; + +/** + * setGlobalObjectEvaluators() + * Set the eval and the Function evaluator on the global object with given evalTaming policy. + * + * @param {object} globalObject + * @param {Function} evaluator + * @param {(object) => void} markVirtualizedNativeFunction + */$h‍_once.setGlobalObjectMutableProperties(setGlobalObjectMutableProperties); +const setGlobalObjectEvaluators= ( + globalObject, + evaluator, + markVirtualizedNativeFunction)=> + { + { + const f= freeze(makeEvalFunction(evaluator)); + markVirtualizedNativeFunction(f); + defineProperty(globalObject, 'eval', { + value: f, + writable: true, + enumerable: false, + configurable: true}); + + } + { + const f= freeze(makeFunctionConstructor(evaluator)); + markVirtualizedNativeFunction(f); + defineProperty(globalObject, 'Function', { + value: f, + writable: true, + enumerable: false, + configurable: true}); + + } + };$h‍_once.setGlobalObjectEvaluators(setGlobalObjectEvaluators); +})() +, +// === functors[23] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Proxy,String,TypeError,ReferenceError,create,freeze,getOwnPropertyDescriptors,globalThis,immutableObject,assert;$h‍_imports([["./commons.js", [["Proxy", [$h‍_a => (Proxy = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["immutableObject", [$h‍_a => (immutableObject = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); + + + + + + + + + + + + +const { Fail, quote: q}= assert; + +/** + * alwaysThrowHandler + * This is an object that throws if any property is called. It's used as + * a proxy handler which throws on any trap called. + * It's made from a proxy with a get trap that throws. It's safe to + * create one and share it between all Proxy handlers. + */ +const alwaysThrowHandler= new Proxy( + immutableObject, + freeze({ + get(_shadow, prop) { + Fail `Please report unexpected scope handler trap: ${q(String(prop))}`; + }})); + + + +/* + * scopeProxyHandlerProperties + * scopeTerminatorHandler manages a strictScopeTerminator Proxy which serves as + * the final scope boundary that will always return "undefined" in order + * to prevent access to "start compartment globals". + */$h‍_once.alwaysThrowHandler(alwaysThrowHandler); +const scopeProxyHandlerProperties= { + get(_shadow, _prop) { + return undefined; + }, + + set(_shadow, prop, _value) { + // We should only hit this if the has() hook returned true matches the v8 + // ReferenceError message "Uncaught ReferenceError: xyz is not defined" + throw ReferenceError( `${String(prop)} is not defined`); + }, + + has(_shadow, prop) { + // we must at least return true for all properties on the realm globalThis + return prop in globalThis; + }, + + // note: this is likely a bug of safari + // https://bugs.webkit.org/show_bug.cgi?id=195534 + getPrototypeOf(_shadow) { + return null; + }, + + // See https://github.com/endojs/endo/issues/1510 + // TODO: report as bug to v8 or Chrome, and record issue link here. + getOwnPropertyDescriptor(_shadow, prop) { + // Coerce with `String` in case prop is a symbol. + const quotedProp= q(String(prop)); + // eslint-disable-next-line @endo/no-polymorphic-call + console.warn( + `getOwnPropertyDescriptor trap on scopeTerminatorHandler for ${quotedProp}`, + TypeError().stack); + + return undefined; + }, + + // See https://github.com/endojs/endo/issues/1490 + // TODO Report bug to JSC or Safari + ownKeys(_shadow) { + return []; + }}; + + +// The scope handler's prototype is a proxy that throws if any trap other +// than get/set/has are run (like getOwnPropertyDescriptors, apply, +// getPrototypeOf). +const strictScopeTerminatorHandler= freeze( + create( + alwaysThrowHandler, + getOwnPropertyDescriptors(scopeProxyHandlerProperties)));$h‍_once.strictScopeTerminatorHandler(strictScopeTerminatorHandler); + + + +const strictScopeTerminator= new Proxy( + immutableObject, + strictScopeTerminatorHandler);$h‍_once.strictScopeTerminator(strictScopeTerminator); +})() +, +// === functors[24] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Proxy,create,freeze,getOwnPropertyDescriptors,immutableObject,reflectSet,strictScopeTerminatorHandler,alwaysThrowHandler;$h‍_imports([["./commons.js", [["Proxy", [$h‍_a => (Proxy = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["immutableObject", [$h‍_a => (immutableObject = $h‍_a)]],["reflectSet", [$h‍_a => (reflectSet = $h‍_a)]]]],["./strict-scope-terminator.js", [["strictScopeTerminatorHandler", [$h‍_a => (strictScopeTerminatorHandler = $h‍_a)]],["alwaysThrowHandler", [$h‍_a => (alwaysThrowHandler = $h‍_a)]]]]]); + + + + + + + + + + + + +/* + * createSloppyGlobalsScopeTerminator() + * strictScopeTerminatorHandler manages a scopeTerminator Proxy which serves as + * the final scope boundary that will always return "undefined" in order + * to prevent access to "start compartment globals". When "sloppyGlobalsMode" + * is true, the Proxy will perform sets on the "globalObject". + */ +const createSloppyGlobalsScopeTerminator= (globalObject)=>{ + const scopeProxyHandlerProperties= { + // inherit scopeTerminator behavior + ...strictScopeTerminatorHandler, + + // Redirect set properties to the globalObject. + set(_shadow, prop, value) { + return reflectSet(globalObject, prop, value); + }, + + // Always claim to have a potential property in order to be the recipient of a set + has(_shadow, _prop) { + return true; + }}; + + + // The scope handler's prototype is a proxy that throws if any trap other + // than get/set/has are run (like getOwnPropertyDescriptors, apply, + // getPrototypeOf). + const sloppyGlobalsScopeTerminatorHandler= freeze( + create( + alwaysThrowHandler, + getOwnPropertyDescriptors(scopeProxyHandlerProperties))); + + + + const sloppyGlobalsScopeTerminator= new Proxy( + immutableObject, + sloppyGlobalsScopeTerminatorHandler); + + + return sloppyGlobalsScopeTerminator; + };$h‍_once.createSloppyGlobalsScopeTerminator(createSloppyGlobalsScopeTerminator); +freeze(createSloppyGlobalsScopeTerminator); +})() +, +// === functors[25] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_EVAL,create,defineProperties,freeze,assert;$h‍_imports([["./commons.js", [["FERAL_EVAL", [$h‍_a => (FERAL_EVAL = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); + + + +const { Fail}= assert; + +// We attempt to frustrate stack bumping attacks on the safe evaluator +// (`make-safe-evaluator.js`). +// A stack bumping attack forces an API call to throw a stack overflow +// `RangeError` at an inopportune time. +// The attacker arranges for the stack to be sufficiently deep that the API +// consumes exactly enough stack frames to throw an exception. +// +// For the safe evaluator, an exception thrown between adding and then deleting +// `eval` on `evalScope` could leak the real `eval` to an attacker's lexical +// scope. +// This would be sufficiently disastrous that we guard against it twice. +// First, we delete `eval` from `evalScope` immediately before rendering it to +// the guest program's lexical scope. +// +// If the attacker manages to arrange for `eval` to throw an exception after we +// call `allowNextEvalToBeUnsafe` but before the guest program accesses `eval`, +// it would be able to access `eval` once more in its own code. +// Although they could do no harm with a direct `eval`, they would be able to +// escape to the true global scope with an indirect `eval`. +// +// prepareStack(depth, () => { +// (eval)(''); +// }); +// const unsafeEval = (eval); +// const safeEval = (eval); +// const realGlobal = unsafeEval('globalThis'); +// +// To protect against that case, we also delete `eval` from the `evalScope` in +// a `finally` block surrounding the call to the safe evaluator. +// The only way to reach this case is if `eval` remains on `evalScope` due to +// an attack, so we assume that attack would have have invalided our isolation +// and revoke all future access to the evaluator. +// +// To defeat a stack bumping attack, we must use fewer stack frames to recover +// in that `finally` block than we used in the `try` block. +// We have no reliable guarantees about how many stack frames a block of +// JavaScript will consume. +// Function inlining, tail-call optimization, variations in the size of a stack +// frame, and block scopes may affect the depth of the stack. +// The only number of acceptable stack frames to use in the finally block is +// zero. +// We only use property assignment and deletion in the safe evaluator's +// `finally` block. +// We use `delete evalScope.eval` to withhold the evaluator. +// We assign an envelope object over `evalScopeKit.revoked` to revoke the +// evaluator. +// +// This is why we supply a meaningfully named function for +// `allowNextEvalToBeUnsafe` but do not provide a corresponding +// `revokeAccessToUnsafeEval` or even simply `revoke`. +// These recovery routines are expressed inline in the safe evaluator. + +const makeEvalScopeKit= ()=> { + const evalScope= create(null); + const oneTimeEvalProperties= freeze({ + eval: { + get() { + delete evalScope.eval; + return FERAL_EVAL; + }, + enumerable: false, + configurable: true}}); + + + + const evalScopeKit= { + evalScope, + allowNextEvalToBeUnsafe() { + const { revoked}= evalScopeKit; + if( revoked!== null) { + Fail `a handler did not reset allowNextEvalToBeUnsafe ${revoked.err}`; + } + // Allow next reference to eval produce the unsafe FERAL_EVAL. + // We avoid defineProperty because it consumes an extra stack frame taming + // its return value. + defineProperties(evalScope, oneTimeEvalProperties); + }, + /** @type {null | { err: any }} */ + revoked: null}; + + + return evalScopeKit; + };$h‍_once.makeEvalScopeKit(makeEvalScopeKit); +})() +, +// === functors[26] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_REG_EXP,regexpExec,stringSlice;$h‍_imports([["./commons.js", [["FERAL_REG_EXP", [$h‍_a => (FERAL_REG_EXP = $h‍_a)]],["regexpExec", [$h‍_a => (regexpExec = $h‍_a)]],["stringSlice", [$h‍_a => (stringSlice = $h‍_a)]]]]]); + +// Captures a key and value of the form #key=value or @key=value +const sourceMetaEntryRegExp= + '\\s*[@#]\\s*([a-zA-Z][a-zA-Z0-9]*)\\s*=\\s*([^\\s\\*]*)'; +// Captures either a one-line or multi-line comment containing +// one #key=value or @key=value. +// Produces two pairs of capture groups, but the initial two may be undefined. +// On account of the mechanics of regular expressions, scanning from the end +// does not allow us to capture every pair, so getSourceURL must capture and +// trim until there are no matching comments. +const sourceMetaEntriesRegExp= new FERAL_REG_EXP( + `(?:\\s*//${sourceMetaEntryRegExp}|/\\*${sourceMetaEntryRegExp}\\s*\\*/)\\s*$`); + + +/** + * @param {string} src + */ +const getSourceURL= (src)=>{ + let sourceURL= ''; + + // Our regular expression matches the last one or two comments with key value + // pairs at the end of the source, avoiding a scan over the entire length of + // the string, but at the expense of being able to capture all the (key, + // value) pair meta comments at the end of the source, which may include + // sourceMapURL in addition to sourceURL. + // So, we sublimate the comments out of the source until no source or no + // comments remain. + while( src.length> 0) { + const match= regexpExec(sourceMetaEntriesRegExp, src); + if( match=== null) { + break; + } + src= stringSlice(src, 0, src.length- match[0].length); + + // We skip $0 since it contains the entire match. + // The match contains four capture groups, + // two (key, value) pairs, the first of which + // may be undefined. + // On the off-chance someone put two sourceURL comments in their code with + // different commenting conventions, the latter has precedence. + if( match[3]=== 'sourceURL') { + sourceURL= match[4]; + }else if( match[1]=== 'sourceURL') { + sourceURL= match[2]; + } + } + + return sourceURL; + };$h‍_once.getSourceURL(getSourceURL); +})() +, +// === functors[27] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_REG_EXP,SyntaxError,stringReplace,stringSearch,stringSlice,stringSplit,freeze,getSourceURL;$h‍_imports([["./commons.js", [["FERAL_REG_EXP", [$h‍_a => (FERAL_REG_EXP = $h‍_a)]],["SyntaxError", [$h‍_a => (SyntaxError = $h‍_a)]],["stringReplace", [$h‍_a => (stringReplace = $h‍_a)]],["stringSearch", [$h‍_a => (stringSearch = $h‍_a)]],["stringSlice", [$h‍_a => (stringSlice = $h‍_a)]],["stringSplit", [$h‍_a => (stringSplit = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]],["./get-source-url.js", [["getSourceURL", [$h‍_a => (getSourceURL = $h‍_a)]]]]]); + + + + + + + + + + + + +/** + * Find the first occurence of the given pattern and return + * the location as the approximate line number. + * + * @param {string} src + * @param {RegExp} pattern + * @returns {number} + */ +function getLineNumber(src, pattern) { + const index= stringSearch(src, pattern); + if( index< 0) { + return -1; + } + + // The importPattern incidentally captures an initial \n in + // an attempt to reject a . prefix, so we need to offset + // the line number in that case. + const adjustment= src[index]=== '\n'? 1: 0; + + return stringSplit(stringSlice(src, 0, index), '\n').length+ adjustment; + } + +// ///////////////////////////////////////////////////////////////////////////// + +const htmlCommentPattern= new FERAL_REG_EXP( `(?:${'<'}!--|--${'>'})`,'g'); + +/** + * Conservatively reject the source text if it may contain text that some + * JavaScript parsers may treat as an html-like comment. To reject without + * parsing, `rejectHtmlComments` will also reject some other text as well. + * + * https://www.ecma-international.org/ecma-262/9.0/index.html#sec-html-like-comments + * explains that JavaScript parsers may or may not recognize html + * comment tokens "<" immediately followed by "!--" and "--" + * immediately followed by ">" in non-module source text, and treat + * them as a kind of line comment. Since otherwise both of these can + * appear in normal JavaScript source code as a sequence of operators, + * we have the terrifying possibility of the same source code parsing + * one way on one correct JavaScript implementation, and another way + * on another. + * + * This shim takes the conservative strategy of just rejecting source + * text that contains these strings anywhere. Note that this very + * source file is written strangely to avoid mentioning these + * character strings explicitly. + * + * We do not write the regexp in a straightforward way, so that an + * apparennt html comment does not appear in this file. Thus, we avoid + * rejection by the overly eager rejectDangerousSources. + * + * @param {string} src + * @returns {string} + */ +const rejectHtmlComments= (src)=>{ + const lineNumber= getLineNumber(src, htmlCommentPattern); + if( lineNumber< 0) { + return src; + } + const name= getSourceURL(src); + // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_HTML_COMMENT_REJECTED.md + throw SyntaxError( + `Possible HTML comment rejected at ${name}:${lineNumber}. (SES_HTML_COMMENT_REJECTED)`); + + }; + +/** + * An optional transform to place ahead of `rejectHtmlComments` to evade *that* + * rejection. However, it may change the meaning of the program. + * + * This evasion replaces each alleged html comment with the space-separated + * JavaScript operator sequence that it may mean, assuming that it appears + * outside of a comment or literal string, in source code where the JS + * parser makes no special case for html comments (like module source code). + * In that case, this evasion preserves the meaning of the program, though it + * does change the souce column numbers on each effected line. + * + * If the html comment appeared in a literal (a string literal, regexp literal, + * or a template literal), then this evasion will change the meaning of the + * program by changing the text of that literal. + * + * If the html comment appeared in a JavaScript comment, then this evasion does + * not change the meaning of the program because it only changes the contents of + * those comments. + * + * @param {string} src + * @returns {string} + */$h‍_once.rejectHtmlComments(rejectHtmlComments); +const evadeHtmlCommentTest= (src)=>{ + const replaceFn= (match)=> match[0]=== '<'? '< ! --': '-- >'; + return stringReplace(src, htmlCommentPattern, replaceFn); + }; + +// ///////////////////////////////////////////////////////////////////////////// +$h‍_once.evadeHtmlCommentTest(evadeHtmlCommentTest); +const importPattern= new FERAL_REG_EXP( + '(^|[^.]|\\.\\.\\.)\\bimport(\\s*(?:\\(|/[/*]))', + 'g'); + + +/** + * Conservatively reject the source text if it may contain a dynamic + * import expression. To reject without parsing, `rejectImportExpressions` will + * also reject some other text as well. + * + * The proposed dynamic import expression is the only syntax currently + * proposed, that can appear in non-module JavaScript code, that + * enables direct access to the outside world that cannot be + * suppressed or intercepted without parsing and rewriting. Instead, + * this shim conservatively rejects any source text that seems to + * contain such an expression. To do this safely without parsing, we + * must also reject some valid programs, i.e., those containing + * apparent import expressions in literal strings or comments. + * + * The current conservative rule looks for the identifier "import" + * followed by either an open paren or something that looks like the + * beginning of a comment. We assume that we do not need to worry + * about html comment syntax because that was already rejected by + * rejectHtmlComments. + * + * this \s *must* match all kinds of syntax-defined whitespace. If e.g. + * U+2028 (LINE SEPARATOR) or U+2029 (PARAGRAPH SEPARATOR) is treated as + * whitespace by the parser, but not matched by /\s/, then this would admit + * an attack like: import\u2028('power.js') . We're trying to distinguish + * something like that from something like importnotreally('power.js') which + * is perfectly safe. + * + * @param {string} src + * @returns {string} + */ +const rejectImportExpressions= (src)=>{ + const lineNumber= getLineNumber(src, importPattern); + if( lineNumber< 0) { + return src; + } + const name= getSourceURL(src); + // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_IMPORT_REJECTED.md + throw SyntaxError( + `Possible import expression rejected at ${name}:${lineNumber}. (SES_IMPORT_REJECTED)`); + + }; + +/** + * An optional transform to place ahead of `rejectImportExpressions` to evade + * *that* rejection. However, it may change the meaning of the program. + * + * This evasion replaces each suspicious `import` identifier with `__import__`. + * If the alleged import expression appears in a JavaScript comment, this + * evasion will not change the meaning of the program. If it appears in a + * literal (string literal, regexp literal, or a template literal), then this + * evasion will change the contents of that literal. If it appears as code + * where it would be parsed as an expression, then it might or might not change + * the meaning of the program, depending on the binding, if any, of the lexical + * variable `__import__`. + * + * @param {string} src + * @returns {string} + */$h‍_once.rejectImportExpressions(rejectImportExpressions); +const evadeImportExpressionTest= (src)=>{ + const replaceFn= (_, p1, p2)=> `${p1}__import__${p2}`; + return stringReplace(src, importPattern, replaceFn); + }; + +// ///////////////////////////////////////////////////////////////////////////// +$h‍_once.evadeImportExpressionTest(evadeImportExpressionTest); +const someDirectEvalPattern= new FERAL_REG_EXP( + '(^|[^.])\\beval(\\s*\\()', + 'g'); + + +/** + * Heuristically reject some text that seems to contain a direct eval + * expression, with both false positives and false negavives. To reject without + * parsing, `rejectSomeDirectEvalExpressions` may will also reject some other + * text as well. It may also accept source text that contains a direct eval + * written oddly, such as `(eval)(src)`. This false negative is not a security + * vulnerability. Rather it is a compat hazard because it will execute as + * an indirect eval under the SES-shim but as a direct eval on platforms that + * support SES directly (like XS). + * + * The shim cannot correctly emulate a direct eval as explained at + * https://github.com/Agoric/realms-shim/issues/12 + * If we did not reject direct eval syntax, we would + * accidentally evaluate these with an emulation of indirect eval. To + * prevent future compatibility problems, in shifting from use of the + * shim to genuine platform support for the proposal, we should + * instead statically reject code that seems to contain a direct eval + * expression. + * + * As with the dynamic import expression, to avoid a full parse, we do + * this approximately with a regexp, that will also reject strings + * that appear safely in comments or strings. Unlike dynamic import, + * if we miss some, this only creates future compat problems, not + * security problems. Thus, we are only trying to catch innocent + * occurrences, not malicious one. In particular, `(eval)(...)` is + * direct eval syntax that would not be caught by the following regexp. + * + * Exported for unit tests. + * + * @param {string} src + * @returns {string} + */ +const rejectSomeDirectEvalExpressions= (src)=>{ + const lineNumber= getLineNumber(src, someDirectEvalPattern); + if( lineNumber< 0) { + return src; + } + const name= getSourceURL(src); + // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_EVAL_REJECTED.md + throw SyntaxError( + `Possible direct eval expression rejected at ${name}:${lineNumber}. (SES_EVAL_REJECTED)`); + + }; + +// ///////////////////////////////////////////////////////////////////////////// + +/** + * A transform that bundles together the transforms that must unconditionally + * happen last in order to ensure safe evaluation without parsing. + * + * @param {string} source + * @returns {string} + */$h‍_once.rejectSomeDirectEvalExpressions(rejectSomeDirectEvalExpressions); +const mandatoryTransforms= (source)=>{ + source= rejectHtmlComments(source); + source= rejectImportExpressions(source); + return source; + }; + +/** + * Starting with `source`, apply each transform to the result of the + * previous one, returning the result of the last transformation. + * + * @param {string} source + * @param {((str: string) => string)[]} transforms + * @returns {string} + */$h‍_once.mandatoryTransforms(mandatoryTransforms); +const applyTransforms= (source, transforms)=> { + for( const transform of transforms) { + source= transform(source); + } + return source; + }; + +// export all as a frozen object +$h‍_once.applyTransforms(applyTransforms);const transforms=freeze({ + rejectHtmlComments: freeze(rejectHtmlComments), + evadeHtmlCommentTest: freeze(evadeHtmlCommentTest), + rejectImportExpressions: freeze(rejectImportExpressions), + evadeImportExpressionTest: freeze(evadeImportExpressionTest), + rejectSomeDirectEvalExpressions: freeze(rejectSomeDirectEvalExpressions), + mandatoryTransforms: freeze(mandatoryTransforms), + applyTransforms: freeze(applyTransforms)});$h‍_once.transforms(transforms); +})() +, +// === functors[28] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let arrayFilter,arrayIncludes,getOwnPropertyDescriptor,getOwnPropertyNames,objectHasOwnProperty,regexpTest;$h‍_imports([["./commons.js", [["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["arrayIncludes", [$h‍_a => (arrayIncludes = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyNames", [$h‍_a => (getOwnPropertyNames = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["regexpTest", [$h‍_a => (regexpTest = $h‍_a)]]]]]); + + + + + + + + +/** + * keywords + * In JavaScript you cannot use these reserved words as variables. + * See 11.6.1 Identifier Names + */ +const keywords= [ + // 11.6.2.1 Keywords + 'await', + 'break', + 'case', + 'catch', + 'class', + 'const', + 'continue', + 'debugger', + 'default', + 'delete', + 'do', + 'else', + 'export', + 'extends', + 'finally', + 'for', + 'function', + 'if', + 'import', + 'in', + 'instanceof', + 'new', + 'return', + 'super', + 'switch', + 'this', + 'throw', + 'try', + 'typeof', + 'var', + 'void', + 'while', + 'with', + 'yield', + + // Also reserved when parsing strict mode code + 'let', + 'static', + + // 11.6.2.2 Future Reserved Words + 'enum', + + // Also reserved when parsing strict mode code + 'implements', + 'package', + 'protected', + 'interface', + 'private', + 'public', + + // Reserved but not mentioned in specs + 'await', + + 'null', + 'true', + 'false', + + 'this', + 'arguments']; + + +/** + * identifierPattern + * Simplified validation of identifier names: may only contain alphanumeric + * characters (or "$" or "_"), and may not start with a digit. This is safe + * and does not reduces the compatibility of the shim. The motivation for + * this limitation was to decrease the complexity of the implementation, + * and to maintain a resonable level of performance. + * Note: \w is equivalent [a-zA-Z_0-9] + * See 11.6.1 Identifier Names + */ +const identifierPattern= /^[a-zA-Z_$][\w$]*$/; + +/** + * isValidIdentifierName() + * What variable names might it bring into scope? These include all + * property names which can be variable names, including the names + * of inherited properties. It excludes symbols and names which are + * keywords. We drop symbols safely. Currently, this shim refuses + * service if any of the names are keywords or keyword-like. This is + * safe and only prevent performance optimization. + * + * @param {string} name + */ +const isValidIdentifierName= (name)=>{ + // Ensure we have a valid identifier. We use regexpTest rather than + // /../.test() to guard against the case where RegExp has been poisoned. + return( + name!== 'eval'&& + !arrayIncludes(keywords, name)&& + regexpTest(identifierPattern, name)); + + }; + +/* + * isImmutableDataProperty + */$h‍_once.isValidIdentifierName(isValidIdentifierName); + +function isImmutableDataProperty(obj, name) { + const desc= getOwnPropertyDescriptor(obj, name); + return( + desc&& + // + // The getters will not have .writable, don't let the falsyness of + // 'undefined' trick us: test with === false, not ! . However descriptors + // inherit from the (potentially poisoned) global object, so we might see + // extra properties which weren't really there. Accessor properties have + // 'get/set/enumerable/configurable', while data properties have + // 'value/writable/enumerable/configurable'. + desc.configurable=== false&& + desc.writable=== false&& + // + // Checks for data properties because they're the only ones we can + // optimize (accessors are most likely non-constant). Descriptors can't + // can't have accessors and value properties at the same time, therefore + // this check is sufficient. Using explicit own property deal with the + // case where Object.prototype has been poisoned. + objectHasOwnProperty(desc, 'value')); + + } + +/** + * getScopeConstants() + * What variable names might it bring into scope? These include all + * property names which can be variable names, including the names + * of inherited properties. It excludes symbols and names which are + * keywords. We drop symbols safely. Currently, this shim refuses + * service if any of the names are keywords or keyword-like. This is + * safe and only prevent performance optimization. + * + * @param {object} globalObject + * @param {object} moduleLexicals + */ +const getScopeConstants= (globalObject, moduleLexicals= {})=> { + // getOwnPropertyNames() does ignore Symbols so we don't need to + // filter them out. + const globalObjectNames= getOwnPropertyNames(globalObject); + const moduleLexicalNames= getOwnPropertyNames(moduleLexicals); + + // Collect all valid & immutable identifiers from the endowments. + const moduleLexicalConstants= arrayFilter( + moduleLexicalNames, + (name)=> + isValidIdentifierName(name)&& + isImmutableDataProperty(moduleLexicals, name)); + + + // Collect all valid & immutable identifiers from the global that + // are also not present in the endowments (immutable or not). + const globalObjectConstants= arrayFilter( + globalObjectNames, + (name)=> + // Can't define a constant: it would prevent a + // lookup on the endowments. + !arrayIncludes(moduleLexicalNames, name)&& + isValidIdentifierName(name)&& + isImmutableDataProperty(globalObject, name)); + + + return { + globalObjectConstants, + moduleLexicalConstants}; + + };$h‍_once.getScopeConstants(getScopeConstants); +})() +, +// === functors[29] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_FUNCTION,arrayJoin,apply,getScopeConstants;$h‍_imports([["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]]]],["./scope-constants.js", [["getScopeConstants", [$h‍_a => (getScopeConstants = $h‍_a)]]]]]); + + + + +/** + * buildOptimizer() + * Given an array of identifiers, the optimizer returns a `const` declaration + * destructuring `this.${name}`. + * + * @param {Array} constants + * @param {string} name + */ +function buildOptimizer(constants, name) { + // No need to build an optimizer when there are no constants. + if( constants.length=== 0) return ''; + // Use 'this' to avoid going through the scope proxy, which is unnecessary + // since the optimizer only needs references to the safe global. + // Destructure the constants from the target scope object. + return `const {${arrayJoin(constants,',') }} = this.${name};`; + } + +/** + * makeEvaluate() + * Create an 'evaluate' function with the correct optimizer inserted. + * + * @param {object} context + * @param {object} context.evalScope + * @param {object} context.moduleLexicals + * @param {object} context.globalObject + * @param {object} context.scopeTerminator + */ +const makeEvaluate= (context)=>{ + const { globalObjectConstants, moduleLexicalConstants}= getScopeConstants( + context.globalObject, + context.moduleLexicals); + + const globalObjectOptimizer= buildOptimizer( + globalObjectConstants, + 'globalObject'); + + const moduleLexicalOptimizer= buildOptimizer( + moduleLexicalConstants, + 'moduleLexicals'); + + + // Create a function in sloppy mode, so that we can use 'with'. It returns + // a function in strict mode that evaluates the provided code using direct + // eval, and thus in strict mode in the same scope. We must be very careful + // to not create new names in this scope + + // 1: we use multiple nested 'with' to catch all free variable names. The + // `this` value of the outer sloppy function holds the different scope + // layers, from inner to outer: + // a) `evalScope` which must release the `FERAL_EVAL` as 'eval' once for + // every invocation of the inner `evaluate` function in order to + // trigger direct eval. The direct eval semantics is what allows the + // evaluated code to lookup free variable names on the other scope + // objects and not in global scope. + // b) `moduleLexicals` which provide a way to introduce free variables + // that are not available on the globalObject. + // c) `globalObject` is the global scope object of the evaluator, aka the + // Compartment's `globalThis`. + // d) `scopeTerminator` is a proxy object which prevents free variable + // lookups to escape to the start compartment's global object. + // 2: `optimizer`s catch constant variable names for speed. + // 3: The inner strict `evaluate` function should be passed two parameters: + // a) its arguments[0] is the source to be directly evaluated. + // b) its 'this' is the this binding seen by the code being + // directly evaluated (the globalObject). + + // Notes: + // - The `optimizer` strings only lookup values on the `globalObject` and + // `moduleLexicals` objects by construct. Keywords like 'function' are + // reserved and cannot be used as a variable, so they are excluded from the + // optimizer. Furthermore to prevent shadowing 'eval', while a valid + // identifier, that name is also explicitly excluded. + // - when 'eval' is looked up in the `evalScope`, the powerful unsafe eval + // intrinsic is returned after automatically removing it from the + // `evalScope`. Any further reference to 'eval' in the evaluate string will + // get the tamed evaluator from the `globalObject`, if any. + + // TODO https://github.com/endojs/endo/issues/816 + // The optimizer currently runs under sloppy mode, and although we doubt that + // there is any vulnerability introduced just by running the optimizer + // sloppy, we are much more confident in the semantics of strict mode. + // The `evaluate` function can be and is reused across multiple evaluations. + // Since the optimizer should not be re-evaluated every time, it cannot be + // inside the `evaluate` closure. While we could potentially nest an + // intermediate layer of `() => {'use strict'; ${optimizers}; ...`, it + // doesn't seem worth the overhead and complexity. + const evaluateFactory= FERAL_FUNCTION( ` + with (this.scopeTerminator) { + with (this.globalObject) { + with (this.moduleLexicals) { + with (this.evalScope) { + ${globalObjectOptimizer } + ${moduleLexicalOptimizer } + return function() { + 'use strict'; + return eval(arguments[0]); + }; + } + } + } + } + `); + + return apply(evaluateFactory, context, []); + };$h‍_once.makeEvaluate(makeEvaluate); +})() +, +// === functors[30] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let apply,freeze,strictScopeTerminator,createSloppyGlobalsScopeTerminator,makeEvalScopeKit,applyTransforms,mandatoryTransforms,makeEvaluate,assert;$h‍_imports([["./commons.js", [["apply", [$h‍_a => (apply = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]],["./strict-scope-terminator.js", [["strictScopeTerminator", [$h‍_a => (strictScopeTerminator = $h‍_a)]]]],["./sloppy-globals-scope-terminator.js", [["createSloppyGlobalsScopeTerminator", [$h‍_a => (createSloppyGlobalsScopeTerminator = $h‍_a)]]]],["./eval-scope.js", [["makeEvalScopeKit", [$h‍_a => (makeEvalScopeKit = $h‍_a)]]]],["./transforms.js", [["applyTransforms", [$h‍_a => (applyTransforms = $h‍_a)]],["mandatoryTransforms", [$h‍_a => (mandatoryTransforms = $h‍_a)]]]],["./make-evaluate.js", [["makeEvaluate", [$h‍_a => (makeEvaluate = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); + + + + + + + + + + +const { Fail}= assert; + +/** + * makeSafeEvaluator() + * Build the low-level operation used by all evaluators: + * eval(), Function(), Compartment.prototype.evaluate(). + * + * @param {object} options + * @param {object} options.globalObject + * @param {object} [options.moduleLexicals] + * @param {Array} [options.globalTransforms] + * @param {boolean} [options.sloppyGlobalsMode] + */ +const makeSafeEvaluator= ({ + globalObject, + moduleLexicals= {}, + globalTransforms= [], + sloppyGlobalsMode= false})=> + { + const scopeTerminator= sloppyGlobalsMode? + createSloppyGlobalsScopeTerminator(globalObject): + strictScopeTerminator; + const evalScopeKit= makeEvalScopeKit(); + const { evalScope}= evalScopeKit; + + const evaluateContext= freeze({ + evalScope, + moduleLexicals, + globalObject, + scopeTerminator}); + + + // Defer creating the actual evaluator to first use. + // Creating a compartment should be possible in no-eval environments + // It also allows more global constants to be captured by the optimizer + let evaluate; + const provideEvaluate= ()=> { + if( !evaluate) { + evaluate= makeEvaluate(evaluateContext); + } + }; + + /** + * @param {string} source + * @param {object} [options] + * @param {Array} [options.localTransforms] + */ + const safeEvaluate= (source, options)=> { + const { localTransforms= []}= options|| {}; + provideEvaluate(); + + // Execute the mandatory transforms last to ensure that any rewritten code + // meets those mandatory requirements. + source= applyTransforms(source, [ + ...localTransforms, + ...globalTransforms, + mandatoryTransforms]); + + + let err; + try { + // Allow next reference to eval produce the unsafe FERAL_EVAL. + // eslint-disable-next-line @endo/no-polymorphic-call + evalScopeKit.allowNextEvalToBeUnsafe(); + + // Ensure that "this" resolves to the safe global. + return apply(evaluate, globalObject, [source]); + }catch( e) { + // stash the child-code error in hopes of debugging the internal failure + err= e; + throw e; + }finally { + const unsafeEvalWasStillExposed=( 'eval'in evalScope); + delete evalScope.eval; + if( unsafeEvalWasStillExposed) { + // Barring a defect in the SES shim, the evalScope should allow the + // powerful, unsafe `eval` to be used by `evaluate` exactly once, as the + // very first name that it attempts to access from the lexical scope. + // A defect in the SES shim could throw an exception after we set + // `evalScope.eval` and before `evaluate` calls `eval` internally. + // If we get here, SES is very broken. + // This condition is one where this vat is now hopelessly confused, and + // the vat as a whole should be aborted. + // No further code should run. + // All immediately reachable state should be abandoned. + // However, that is not yet possible, so we at least prevent further + // variable resolution via the scopeHandler, and throw an error with + // diagnostic info including the thrown error if any from evaluating the + // source code. + evalScopeKit.revoked= { err}; + // TODO A GOOD PLACE TO PANIC(), i.e., kill the vat incarnation. + // See https://github.com/Agoric/SES-shim/issues/490 + Fail `handler did not reset allowNextEvalToBeUnsafe ${err}`; + } + } + }; + + return { safeEvaluate}; + };$h‍_once.makeSafeEvaluator(makeSafeEvaluator); +})() +, +// === functors[31] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let WeakSet,defineProperty,freeze,functionPrototype,functionToString,stringEndsWith,weaksetAdd,weaksetHas;$h‍_imports([["./commons.js", [["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["functionPrototype", [$h‍_a => (functionPrototype = $h‍_a)]],["functionToString", [$h‍_a => (functionToString = $h‍_a)]],["stringEndsWith", [$h‍_a => (stringEndsWith = $h‍_a)]],["weaksetAdd", [$h‍_a => (weaksetAdd = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]]]); + + + + + + + + + + +const nativeSuffix= ') { [native code] }'; + +// Note: Top level mutable state. Does not make anything worse, since the +// patching of `Function.prototype.toString` is also globally stateful. We +// use this top level state so that multiple calls to `tameFunctionToString` are +// idempotent, rather than creating redundant indirections. +let markVirtualizedNativeFunction; + +/** + * Replace `Function.prototype.toString` with one that recognizes + * shimmed functions as honorary native functions. + */ +const tameFunctionToString= ()=> { + if( markVirtualizedNativeFunction=== undefined) { + const virtualizedNativeFunctions= new WeakSet(); + + const tamingMethods= { + toString() { + const str= functionToString(this); + if( + stringEndsWith(str, nativeSuffix)|| + !weaksetHas(virtualizedNativeFunctions, this)) + { + return str; + } + return `function ${this.name}() { [native code] }`; + }}; + + + defineProperty(functionPrototype, 'toString', { + value: tamingMethods.toString}); + + + markVirtualizedNativeFunction= freeze((func)=> + weaksetAdd(virtualizedNativeFunctions, func)); + + } + return markVirtualizedNativeFunction; + };$h‍_once.tameFunctionToString(tameFunctionToString); +})() +, +// === functors[32] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let TypeError,globalThis,getOwnPropertyDescriptor,defineProperty;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]]]]]);Object.defineProperty(tameDomains, 'name', {value: "tameDomains"});$h‍_once.tameDomains(tameDomains); + + + + + + + + +function tameDomains(domainTaming= 'safe') { + if( domainTaming!== 'safe'&& domainTaming!== 'unsafe') { + throw TypeError( `unrecognized domainTaming ${domainTaming}`); + } + + if( domainTaming=== 'unsafe') { + return; + } + + // Protect against the hazard presented by Node.js domains. + if( typeof globalThis.process=== 'object'&& globalThis.process!== null) { + // Check whether domains were initialized. + const domainDescriptor= getOwnPropertyDescriptor( + globalThis.process, + 'domain'); + + if( domainDescriptor!== undefined&& domainDescriptor.get!== undefined) { + // The domain descriptor on Node.js initially has value: null, which + // becomes a get, set pair after domains initialize. + // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_NO_DOMAINS.md + throw TypeError( + `SES failed to lockdown, Node.js domains have been initialized (SES_NO_DOMAINS)`); + + } + // Prevent domains from initializing. + // This is clunky because the exception thrown from the domains package does + // not direct the user's gaze toward a knowledge base about the problem. + // The domain module merely throws an exception when it attempts to define + // the domain property of the process global during its initialization. + // We have no better recourse because Node.js uses defineProperty too. + defineProperty(globalThis.process, 'domain', { + value: null, + configurable: false, + writable: false, + enumerable: false}); + + } + } +})() +, +// === functors[33] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let WeakSet,arrayFilter,arrayMap,arrayPush,defineProperty,freeze,fromEntries,isError,stringEndsWith,weaksetAdd,weaksetHas;$h‍_imports([["../commons.js", [["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["fromEntries", [$h‍_a => (fromEntries = $h‍_a)]],["isError", [$h‍_a => (isError = $h‍_a)]],["stringEndsWith", [$h‍_a => (stringEndsWith = $h‍_a)]],["weaksetAdd", [$h‍_a => (weaksetAdd = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]],["./types.js", []],["./internal-types.js", []]]); + + + + + + + + + + + + + + + + + + + + + + +// For our internal debugging purposes, uncomment +// const internalDebugConsole = console; + +// The whitelists of console methods, from: +// Whatwg "living standard" https://console.spec.whatwg.org/ +// Node https://nodejs.org/dist/latest-v14.x/docs/api/console.html +// MDN https://developer.mozilla.org/en-US/docs/Web/API/Console_API +// TypeScript https://openstapps.gitlab.io/projectmanagement/interfaces/_node_modules__types_node_globals_d_.console.html +// Chrome https://developers.google.com/web/tools/chrome-devtools/console/api + +// All console level methods have parameters (fmt?, ...args) +// where the argument sequence `fmt?, ...args` formats args according to +// fmt if fmt is a format string. Otherwise, it just renders them all as values +// separated by spaces. +// https://console.spec.whatwg.org/#formatter +// https://nodejs.org/docs/latest/api/util.html#util_util_format_format_args + +// For the causal console, all occurrences of `fmt, ...args` or `...args` by +// itself must check for the presence of an error to ask the +// `loggedErrorHandler` to handle. +// In theory we should do a deep inspection to detect for example an array +// containing an error. We currently do not detect these and may never. + +/** @typedef {keyof VirtualConsole | 'profile' | 'profileEnd'} ConsoleProps */ + +/** @type {readonly [ConsoleProps, LogSeverity | undefined][]} */ +const consoleLevelMethods= freeze([ + ['debug', 'debug'], // (fmt?, ...args) verbose level on Chrome + ['log', 'log'], // (fmt?, ...args) info level on Chrome + ['info', 'info'], // (fmt?, ...args) + ['warn', 'warn'], // (fmt?, ...args) + ['error', 'error'], // (fmt?, ...args) + + ['trace', 'log'], // (fmt?, ...args) + ['dirxml', 'log'], // (fmt?, ...args) + ['group', 'log'], // (fmt?, ...args) + ['groupCollapsed', 'log'] // (fmt?, ...args) +]); + +/** @type {readonly [ConsoleProps, LogSeverity | undefined][]} */ +const consoleOtherMethods= freeze([ + ['assert', 'error'], // (value, fmt?, ...args) + ['timeLog', 'log'], // (label?, ...args) no fmt string + + // Insensitive to whether any argument is an error. All arguments can pass + // thru to baseConsole as is. + ['clear', undefined], // () + ['count', 'info'], // (label?) + ['countReset', undefined], // (label?) + ['dir', 'log'], // (item, options?) + ['groupEnd', 'log'], // () + // In theory tabular data may be or contain an error. However, we currently + // do not detect these and may never. + ['table', 'log'], // (tabularData, properties?) + ['time', 'info'], // (label?) + ['timeEnd', 'info'], // (label?) + + // Node Inspector only, MDN, and TypeScript, but not whatwg + ['profile', undefined], // (label?) + ['profileEnd', undefined], // (label?) + ['timeStamp', undefined] // (label?) +]); + +/** @type {readonly [ConsoleProps, LogSeverity | undefined][]} */ +const consoleWhitelist= freeze([ + ...consoleLevelMethods, + ...consoleOtherMethods]); + + +/** + * consoleOmittedProperties is currently unused. I record and maintain it here + * with the intention that it be treated like the `false` entries in the main + * SES whitelist: that seeing these on the original console is expected, but + * seeing anything else that's outside the whitelist is surprising and should + * provide a diagnostic. + * + * const consoleOmittedProperties = freeze([ + * 'memory', // Chrome + * 'exception', // FF, MDN + * '_ignoreErrors', // Node + * '_stderr', // Node + * '_stderrErrorHandler', // Node + * '_stdout', // Node + * '_stdoutErrorHandler', // Node + * '_times', // Node + * 'context', // Chrome, Node + * 'record', // Safari + * 'recordEnd', // Safari + * + * 'screenshot', // Safari + * // Symbols + * '@@toStringTag', // Chrome: "Object", Safari: "Console" + * // A variety of other symbols also seen on Node + * ]); + */ + +// ///////////////////////////////////////////////////////////////////////////// + +/** @type {MakeLoggingConsoleKit} */$h‍_once.consoleWhitelist(consoleWhitelist); +const makeLoggingConsoleKit= ( + loggedErrorHandler, + { shouldResetForDebugging= false}= {})=> + { + if( shouldResetForDebugging) { + // eslint-disable-next-line @endo/no-polymorphic-call + loggedErrorHandler.resetErrorTagNum(); + } + + // Not frozen! + let logArray= []; + + const loggingConsole= fromEntries( + arrayMap(consoleWhitelist, ([name, _])=> { + // Use an arrow function so that it doesn't come with its own name in + // its printed form. Instead, we're hoping that tooling uses only + // the `.name` property set below. + /** + * @param {...any} args + */ + const method= (...args)=> { + arrayPush(logArray, [name, ...args]); + }; + defineProperty(method, 'name', { value: name}); + return [name, freeze(method)]; + })); + + freeze(loggingConsole); + + const takeLog= ()=> { + const result= freeze(logArray); + logArray= []; + return result; + }; + freeze(takeLog); + + const typedLoggingConsole= /** @type {VirtualConsole} */ loggingConsole; + + return freeze({ loggingConsole: typedLoggingConsole, takeLog}); + };$h‍_once.makeLoggingConsoleKit(makeLoggingConsoleKit); +freeze(makeLoggingConsoleKit); + + +// ///////////////////////////////////////////////////////////////////////////// + +/** @type {ErrorInfo} */ +const ErrorInfo= { + NOTE: 'ERROR_NOTE:', + MESSAGE: 'ERROR_MESSAGE:'}; + +freeze(ErrorInfo); + +/** @type {MakeCausalConsole} */ +const makeCausalConsole= (baseConsole, loggedErrorHandler)=> { + if( !baseConsole) { + return undefined; + } + + const { getStackString, tagError, takeMessageLogArgs, takeNoteLogArgsArray}= + loggedErrorHandler; + + /** + * @param {ReadonlyArray} logArgs + * @param {Array} subErrorsSink + * @returns {any} + */ + const extractErrorArgs= (logArgs, subErrorsSink)=> { + const argTags= arrayMap(logArgs, (arg)=>{ + if( isError(arg)) { + arrayPush(subErrorsSink, arg); + return `(${tagError(arg)})`; + } + return arg; + }); + return argTags; + }; + + /** + * @param {LogSeverity} severity + * @param {Error} error + * @param {ErrorInfoKind} kind + * @param {readonly any[]} logArgs + * @param {Array} subErrorsSink + */ + const logErrorInfo= (severity, error, kind, logArgs, subErrorsSink)=> { + const errorTag= tagError(error); + const errorName= + kind=== ErrorInfo.MESSAGE? `${errorTag}:`: `${errorTag} ${kind}`; + const argTags= extractErrorArgs(logArgs, subErrorsSink); + // eslint-disable-next-line @endo/no-polymorphic-call + baseConsole[severity](errorName, ...argTags); + }; + + /** + * Logs the `subErrors` within a group name mentioning `optTag`. + * + * @param {LogSeverity} severity + * @param {Error[]} subErrors + * @param {string | undefined} optTag + * @returns {void} + */ + const logSubErrors= (severity, subErrors, optTag= undefined)=> { + if( subErrors.length=== 0) { + return; + } + if( subErrors.length=== 1&& optTag=== undefined) { + // eslint-disable-next-line no-use-before-define + logError(severity, subErrors[0]); + return; + } + let label; + if( subErrors.length=== 1) { + label= `Nested error`; + }else { + label= `Nested ${subErrors.length} errors`; + } + if( optTag!== undefined) { + label= `${label} under ${optTag}`; + } + // eslint-disable-next-line @endo/no-polymorphic-call + baseConsole.group(label); + try { + for( const subError of subErrors) { + // eslint-disable-next-line no-use-before-define + logError(severity, subError); + } + }finally { + // eslint-disable-next-line @endo/no-polymorphic-call + baseConsole.groupEnd(); + } + }; + + const errorsLogged= new WeakSet(); + + /** @type {(severity: LogSeverity) => NoteCallback} */ + const makeNoteCallback= (severity)=>(error, noteLogArgs)=> { + const subErrors= []; + // Annotation arrived after the error has already been logged, + // so just log the annotation immediately, rather than remembering it. + logErrorInfo(severity, error, ErrorInfo.NOTE, noteLogArgs, subErrors); + logSubErrors(severity, subErrors, tagError(error)); + }; + + /** + * @param {LogSeverity} severity + * @param {Error} error + */ + const logError= (severity, error)=> { + if( weaksetHas(errorsLogged, error)) { + return; + } + const errorTag= tagError(error); + weaksetAdd(errorsLogged, error); + const subErrors= []; + const messageLogArgs= takeMessageLogArgs(error); + const noteLogArgsArray= takeNoteLogArgsArray( + error, + makeNoteCallback(severity)); + + // Show the error's most informative error message + if( messageLogArgs=== undefined) { + // If there is no message log args, then just show the message that + // the error itself carries. + // eslint-disable-next-line @endo/no-polymorphic-call + baseConsole[severity]( `${errorTag}:`,error.message); + }else { + // If there is one, we take it to be strictly more informative than the + // message string carried by the error, so show it *instead*. + logErrorInfo( + severity, + error, + ErrorInfo.MESSAGE, + messageLogArgs, + subErrors); + + } + // After the message but before any other annotations, show the stack. + let stackString= getStackString(error); + if( + typeof stackString=== 'string'&& + stackString.length>= 1&& + !stringEndsWith(stackString, '\n')) + { + stackString+= '\n'; + } + // eslint-disable-next-line @endo/no-polymorphic-call + baseConsole[severity](stackString); + // Show the other annotations on error + for( const noteLogArgs of noteLogArgsArray) { + logErrorInfo(severity, error, ErrorInfo.NOTE, noteLogArgs, subErrors); + } + // explain all the errors seen in the messages already emitted. + logSubErrors(severity, subErrors, errorTag); + }; + + const levelMethods= arrayMap(consoleLevelMethods, ([level, _])=> { + /** + * @param {...any} logArgs + */ + const levelMethod= (...logArgs)=> { + const subErrors= []; + const argTags= extractErrorArgs(logArgs, subErrors); + // eslint-disable-next-line @endo/no-polymorphic-call + baseConsole[level](...argTags); + // @ts-expect-error ConsoleProp vs LogSeverity mismatch + logSubErrors(level, subErrors); + }; + defineProperty(levelMethod, 'name', { value: level}); + return [level, freeze(levelMethod)]; + }); + const otherMethodNames= arrayFilter( + consoleOtherMethods, + ([name, _])=> name in baseConsole); + + const otherMethods= arrayMap(otherMethodNames, ([name, _])=> { + /** + * @param {...any} args + */ + const otherMethod= (...args)=> { + // @ts-ignore + // eslint-disable-next-line @endo/no-polymorphic-call + baseConsole[name](...args); + return undefined; + }; + defineProperty(otherMethod, 'name', { value: name}); + return [name, freeze(otherMethod)]; + }); + + const causalConsole= fromEntries([...levelMethods, ...otherMethods]); + return (/** @type {VirtualConsole} */ freeze(causalConsole)); + };$h‍_once.makeCausalConsole(makeCausalConsole); +freeze(makeCausalConsole); + + +// ///////////////////////////////////////////////////////////////////////////// + +/** @type {FilterConsole} */ +const filterConsole= (baseConsole, filter, _topic= undefined)=> { + // TODO do something with optional topic string + const whitelist= arrayFilter( + consoleWhitelist, + ([name, _])=> name in baseConsole); + + const methods= arrayMap(whitelist, ([name, severity])=> { + /** + * @param {...any} args + */ + const method= (...args)=> { + // eslint-disable-next-line @endo/no-polymorphic-call + if( severity=== undefined|| filter.canLog(severity)) { + // @ts-ignore + // eslint-disable-next-line @endo/no-polymorphic-call + baseConsole[name](...args); + } + }; + return [name, freeze(method)]; + }); + const filteringConsole= fromEntries(methods); + return (/** @type {VirtualConsole} */ freeze(filteringConsole)); + };$h‍_once.filterConsole(filterConsole); +freeze(filterConsole); +})() +, +// === functors[34] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FinalizationRegistry,Map,mapGet,mapDelete,WeakMap,mapSet,finalizationRegistryRegister,weakmapSet,weakmapGet,mapEntries,mapHas;$h‍_imports([["../commons.js", [["FinalizationRegistry", [$h‍_a => (FinalizationRegistry = $h‍_a)]],["Map", [$h‍_a => (Map = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["mapDelete", [$h‍_a => (mapDelete = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["mapSet", [$h‍_a => (mapSet = $h‍_a)]],["finalizationRegistryRegister", [$h‍_a => (finalizationRegistryRegister = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["mapEntries", [$h‍_a => (mapEntries = $h‍_a)]],["mapHas", [$h‍_a => (mapHas = $h‍_a)]]]]]); + + + + + + + + + + + + + + +/** + * Create rejection-tracking machinery compatible with Node.js and browsers. + * + * Note that modern browsers *prevent* access to the 'unhandledrejection' and + * 'rejectionhandled' events needed: + * - in cross-origin mode, like when served from file:// + * - in the browser console (interactively typed-in code) + * - in the debugger + * + * Then, they just look like: `Uncaught (in promise) Error: ...` and don't + * implement the machinery. + * + * The solution is to serve your web page from an http:// or https:// web server + * and execute actual code. + * + * @param {(reason: unknown) => void} reportReason report the reason for an + * unhandled rejection. + */ +const makeRejectionHandlers= (reportReason)=>{ + if( FinalizationRegistry=== undefined) { + return undefined; + } + + /** @typedef {number} ReasonId */ + let lastReasonId= 0; + + /** @type {Map} */ + const idToReason= new Map(); + + /** @type {(() => void) | undefined} */ + let cancelChecking; + + const removeReasonId= (reasonId)=>{ + mapDelete(idToReason, reasonId); + if( cancelChecking&& idToReason.size=== 0) { + // No more unhandled rejections to check, just cancel the check. + cancelChecking(); + cancelChecking= undefined; + } + }; + + /** @type {WeakMap} */ + const promiseToReasonId= new WeakMap(); + + /** + * Clean up and report the reason for a GCed unhandled rejection. + * + * @param {ReasonId} heldReasonId + */ + const finalizeDroppedPromise= (heldReasonId)=>{ + if( mapHas(idToReason, heldReasonId)) { + const reason= mapGet(idToReason, heldReasonId); + removeReasonId(heldReasonId); + reportReason(reason); + } + }; + + /** @type {FinalizationRegistry} */ + const promiseToReason= new FinalizationRegistry(finalizeDroppedPromise); + + /** + * Track a rejected promise and its corresponding reason if there is no + * rejection handler synchronously attached. + * + * @param {unknown} reason + * @param {Promise} pr + */ + const unhandledRejectionHandler= (reason, pr)=> { + lastReasonId+= 1; + const reasonId= lastReasonId; + + // Update bookkeeping. + mapSet(idToReason, reasonId, reason); + weakmapSet(promiseToReasonId, pr, reasonId); + finalizationRegistryRegister(promiseToReason, pr, reasonId, pr); + }; + + /** + * Deal with the addition of a handler to a previously rejected promise. + * + * Just remove it from our list. Let the FinalizationRegistry or + * processTermination report any GCed unhandled rejected promises. + * + * @param {Promise} pr + */ + const rejectionHandledHandler= (pr)=>{ + const reasonId= weakmapGet(promiseToReasonId, pr); + removeReasonId(reasonId); + }; + + /** + * Report all the unhandled rejections, now that we are abruptly terminating + * the agent cluster. + */ + const processTerminationHandler= ()=> { + for( const [reasonId, reason]of mapEntries(idToReason)) { + removeReasonId(reasonId); + reportReason(reason); + } + }; + + return { + rejectionHandledHandler, + unhandledRejectionHandler, + processTerminationHandler}; + + };$h‍_once.makeRejectionHandlers(makeRejectionHandlers); +})() +, +// === functors[35] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let TypeError,apply,defineProperty,freeze,globalThis,defaultHandler,makeCausalConsole,makeRejectionHandlers;$h‍_imports([["../commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./assert.js", [["loggedErrorHandler", [$h‍_a => (defaultHandler = $h‍_a)]]]],["./console.js", [["makeCausalConsole", [$h‍_a => (makeCausalConsole = $h‍_a)]]]],["./unhandled-rejection.js", [["makeRejectionHandlers", [$h‍_a => (makeRejectionHandlers = $h‍_a)]]]],["./types.js", []],["./internal-types.js", []]]); + + + + + + + + + + + + + + +const wrapLogger= (logger, thisArg)=> + freeze((...args)=> apply(logger, thisArg, args)); + +// eslint-disable-next-line no-restricted-globals +const originalConsole= /** @type {VirtualConsole} */ + // eslint-disable-next-line no-nested-ternary + typeof console!== 'undefined'? + console: + typeof print=== 'function'? + // Make a good-enough console for eshost (including only functions that + // log at a specific level with no special argument interpretation). + // https://console.spec.whatwg.org/#logging + ((p)=>freeze({ debug: p, log: p, info: p, warn: p, error: p}))( + // eslint-disable-next-line no-undef + wrapLogger(print)): + + undefined; + + +// Upgrade a log-only console (as in `eshost -h SpiderMonkey`). +if( originalConsole&& originalConsole.log) { + for( const methodName of ['warn', 'error']) { + if( !originalConsole[methodName]) { + defineProperty(originalConsole, methodName, { + value: wrapLogger(originalConsole.log, originalConsole)}); + + } + } + } + +/** + * Wrap console unless suppressed. + * At the moment, the console is considered a host power in the start + * compartment, and not a primordial. Hence it is absent from the whilelist + * and bypasses the intrinsicsCollector. + * + * @param {"safe" | "unsafe"} consoleTaming + * @param {"platform" | "exit" | "abort" | "report" | "none"} [errorTrapping] + * @param {"report" | "none"} [unhandledRejectionTrapping] + * @param {GetStackString=} optGetStackString + */ +const tameConsole= ( + consoleTaming= 'safe', + errorTrapping= 'platform', + unhandledRejectionTrapping= 'report', + optGetStackString= undefined)=> + { + if( consoleTaming!== 'safe'&& consoleTaming!== 'unsafe') { + throw TypeError( `unrecognized consoleTaming ${consoleTaming}`); + } + + let loggedErrorHandler; + if( optGetStackString=== undefined) { + loggedErrorHandler= defaultHandler; + }else { + loggedErrorHandler= { + ...defaultHandler, + getStackString: optGetStackString}; + + } + const ourConsole= /** @type {VirtualConsole} */ + consoleTaming=== 'unsafe'? + originalConsole: + makeCausalConsole(originalConsole, loggedErrorHandler); + + + // Attach platform-specific error traps such that any error that gets thrown + // at top-of-turn (the bottom of stack) will get logged by our causal + // console, revealing the diagnostic information associated with the error, + // including the stack from when the error was created. + + // In the following Node.js and web browser cases, `process` and `window` are + // spelled as `globalThis` properties to avoid the overweaning gaze of + // Parcel, which dutifully installs an unnecessary `process` shim if we ever + // utter that. That unnecessary shim forces the whole bundle into sloppy mode, + // which in turn breaks SES's strict mode invariant. + + // Disable the polymorphic check for the rest of this file. It's too noisy + // when dealing with platform APIs. + /* eslint-disable @endo/no-polymorphic-call */ + + // Node.js + if( errorTrapping!== 'none'&& globalThis.process!== undefined) { + globalThis.process.on('uncaughtException', (error)=>{ + // causalConsole is born frozen so not vulnerable to method tampering. + ourConsole.error(error); + if( errorTrapping=== 'platform'|| errorTrapping=== 'exit') { + globalThis.process.exit(globalThis.process.exitCode|| -1); + }else if( errorTrapping=== 'abort') { + globalThis.process.abort(); + } + }); + } + + if( + unhandledRejectionTrapping!== 'none'&& + globalThis.process!== undefined) + { + const handleRejection= (reason)=>{ + // 'platform' and 'report' just log the reason. + ourConsole.error('SES_UNHANDLED_REJECTION:', reason); + }; + // Maybe track unhandled promise rejections. + const h= makeRejectionHandlers(handleRejection); + if( h) { + // Rejection handlers are supported. + globalThis.process.on('unhandledRejection', h.unhandledRejectionHandler); + globalThis.process.on('rejectionHandled', h.rejectionHandledHandler); + globalThis.process.on('exit', h.processTerminationHandler); + } + } + + // Browser + if( + errorTrapping!== 'none'&& + globalThis.window!== undefined&& + globalThis.window.addEventListener!== undefined) + { + globalThis.window.addEventListener('error', (event)=>{ + event.preventDefault(); + // 'platform' and 'report' just log the reason. + ourConsole.error(event.error); + if( errorTrapping=== 'exit'|| errorTrapping=== 'abort') { + globalThis.window.location.href= `about:blank`; + } + }); + } + + if( + unhandledRejectionTrapping!== 'none'&& + globalThis.window!== undefined&& + globalThis.window.addEventListener!== undefined) + { + const handleRejection= (reason)=>{ + ourConsole.error('SES_UNHANDLED_REJECTION:', reason); + }; + + const h= makeRejectionHandlers(handleRejection); + if( h) { + // Rejection handlers are supported. + globalThis.window.addEventListener('unhandledrejection', (event)=>{ + event.preventDefault(); + h.unhandledRejectionHandler(event.reason, event.promise); + }); + + globalThis.window.addEventListener('rejectionhandled', (event)=>{ + event.preventDefault(); + h.rejectionHandledHandler(event.promise); + }); + + globalThis.window.addEventListener('beforeunload', (_event)=>{ + h.processTerminationHandler(); + }); + } + } + /* eslint-enable @endo/no-polymorphic-call */ + + return { console: ourConsole}; + };$h‍_once.tameConsole(tameConsole); +})() +, +// === functors[36] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let WeakMap,WeakSet,apply,arrayFilter,arrayJoin,arrayMap,arraySlice,create,defineProperties,fromEntries,reflectSet,regexpExec,regexpTest,weakmapGet,weakmapSet,weaksetAdd,weaksetHas;$h‍_imports([["../commons.js", [["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arraySlice", [$h‍_a => (arraySlice = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["fromEntries", [$h‍_a => (fromEntries = $h‍_a)]],["reflectSet", [$h‍_a => (reflectSet = $h‍_a)]],["regexpExec", [$h‍_a => (regexpExec = $h‍_a)]],["regexpTest", [$h‍_a => (regexpTest = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]],["weaksetAdd", [$h‍_a => (weaksetAdd = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]]]); + + + + + + + + + + + + + + + + + + + +// Whitelist names from https://v8.dev/docs/stack-trace-api +// Whitelisting only the names used by error-stack-shim/src/v8StackFrames +// callSiteToFrame to shim the error stack proposal. +const safeV8CallSiteMethodNames= [ + // suppress 'getThis' definitely + 'getTypeName', + // suppress 'getFunction' definitely + 'getFunctionName', + 'getMethodName', + 'getFileName', + 'getLineNumber', + 'getColumnNumber', + 'getEvalOrigin', + 'isToplevel', + 'isEval', + 'isNative', + 'isConstructor', + 'isAsync', + // suppress 'isPromiseAll' for now + // suppress 'getPromiseIndex' for now + + // Additional names found by experiment, absent from + // https://v8.dev/docs/stack-trace-api + 'getPosition', + 'getScriptNameOrSourceURL', + + 'toString' // TODO replace to use only whitelisted info +]; + +// TODO this is a ridiculously expensive way to attenuate callsites. +// Before that matters, we should switch to a reasonable representation. +const safeV8CallSiteFacet= (callSite)=>{ + const methodEntry= (name)=>{ + const method= callSite[name]; + return [name, ()=> apply(method, callSite, [])]; + }; + const o= fromEntries(arrayMap(safeV8CallSiteMethodNames, methodEntry)); + return create(o, {}); + }; + +const safeV8SST= (sst)=>arrayMap(sst, safeV8CallSiteFacet); + +// If it has `/node_modules/` anywhere in it, on Node it is likely +// to be a dependent package of the current package, and so to +// be an infrastructure frame to be dropped from concise stack traces. +const FILENAME_NODE_DEPENDENTS_CENSOR= /\/node_modules\//; + +// If it begins with `internal/` or `node:internal` then it is likely +// part of the node infrustructre itself, to be dropped from concise +// stack traces. +const FILENAME_NODE_INTERNALS_CENSOR= /^(?:node:)?internal\//; + +// Frames within the `assert.js` package should be dropped from +// concise stack traces, as these are just steps towards creating the +// error object in question. +const FILENAME_ASSERT_CENSOR= /\/packages\/ses\/src\/error\/assert.js$/; + +// Frames within the `eventual-send` shim should be dropped so that concise +// deep stacks omit the internals of the eventual-sending mechanism causing +// asynchronous messages to be sent. +// Note that the eventual-send package will move from agoric-sdk to +// Endo, so this rule will be of general interest. +const FILENAME_EVENTUAL_SEND_CENSOR= /\/packages\/eventual-send\/src\//; + +// Any stack frame whose `fileName` matches any of these censor patterns +// will be omitted from concise stacks. +// TODO Enable users to configure FILENAME_CENSORS via `lockdown` options. +const FILENAME_CENSORS= [ + FILENAME_NODE_DEPENDENTS_CENSOR, + FILENAME_NODE_INTERNALS_CENSOR, + FILENAME_ASSERT_CENSOR, + FILENAME_EVENTUAL_SEND_CENSOR]; + + +// Should a stack frame with this as its fileName be included in a concise +// stack trace? +// Exported only so it can be unit tested. +// TODO Move so that it applies not just to v8. +const filterFileName= (fileName)=>{ + if( !fileName) { + // Stack frames with no fileName should appear in concise stack traces. + return true; + } + for( const filter of FILENAME_CENSORS) { + if( regexpTest(filter, fileName)) { + return false; + } + } + return true; + }; + +// The ad-hoc rule of the current pattern is that any likely-file-path or +// likely url-path prefix, ending in a `/.../` should get dropped. +// Anything to the left of the likely path text is kept. +// Everything to the right of `/.../` is kept. Thus +// `'Object.bar (/vat-v1/.../eventual-send/test/test-deep-send.js:13:21)'` +// simplifies to +// `'Object.bar (eventual-send/test/test-deep-send.js:13:21)'`. +// +// See thread starting at +// https://github.com/Agoric/agoric-sdk/issues/2326#issuecomment-773020389 +$h‍_once.filterFileName(filterFileName);const CALLSITE_ELLIPSES_PATTERN=/^((?:.*[( ])?)[:/\w_-]*\/\.\.\.\/(.+)$/; + +// The ad-hoc rule of the current pattern is that any likely-file-path or +// likely url-path prefix, ending in a `/` and prior to `package/` should get +// dropped. +// Anything to the left of the likely path prefix text is kept. `package/` and +// everything to its right is kept. Thus +// `'Object.bar (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/test/test-deep-send.js:13:21)'` +// simplifies to +// `'Object.bar (packages/eventual-send/test/test-deep-send.js:13:21)'`. +// Note that `/packages/` is a convention for monorepos encouraged by +// lerna. +const CALLSITE_PACKAGES_PATTERN= /^((?:.*[( ])?)[:/\w_-]*\/(packages\/.+)$/; + +// The use of these callSite patterns below assumes that any match will bind +// capture groups containing the parts of the original string we want +// to keep. The parts outside those capture groups will be dropped from concise +// stacks. +// TODO Enable users to configure CALLSITE_PATTERNS via `lockdown` options. +const CALLSITE_PATTERNS= [ + CALLSITE_ELLIPSES_PATTERN, + CALLSITE_PACKAGES_PATTERN]; + + +// For a stack frame that should be included in a concise stack trace, if +// `callSiteString` is the original stringified stack frame, return the +// possibly-shorter stringified stack frame that should be shown instead. +// Exported only so it can be unit tested. +// TODO Move so that it applies not just to v8. +const shortenCallSiteString= (callSiteString)=>{ + for( const filter of CALLSITE_PATTERNS) { + const match= regexpExec(filter, callSiteString); + if( match) { + return arrayJoin(arraySlice(match, 1), ''); + } + } + return callSiteString; + };$h‍_once.shortenCallSiteString(shortenCallSiteString); + +const tameV8ErrorConstructor= ( + OriginalError, + InitialError, + errorTaming, + stackFiltering)=> + { + // TODO: Proper CallSite types + /** @typedef {{}} CallSite */ + + const originalCaptureStackTrace= OriginalError.captureStackTrace; + + // const callSiteFilter = _callSite => true; + const callSiteFilter= (callSite)=>{ + if( stackFiltering=== 'verbose') { + return true; + } + // eslint-disable-next-line @endo/no-polymorphic-call + return filterFileName(callSite.getFileName()); + }; + + const callSiteStringifier= (callSite)=>{ + let callSiteString= `${callSite}`; + if( stackFiltering=== 'concise') { + callSiteString= shortenCallSiteString(callSiteString); + } + return `\n at ${callSiteString}`; + }; + + const stackStringFromSST= (_error, sst)=> + arrayJoin( + arrayMap(arrayFilter(sst, callSiteFilter), callSiteStringifier), + ''); + + + /** + * @typedef {object} StructuredStackInfo + * @property {CallSite[]} callSites + * @property {undefined} [stackString] + */ + + /** + * @typedef {object} ParsedStackInfo + * @property {undefined} [callSites] + * @property {string} stackString + */ + + // Mapping from error instance to the stack for that instance. + // The stack info is either the structured stack trace + // or the generated tamed stack string + /** @type {WeakMap} */ + const stackInfos= new WeakMap(); + + // Use concise methods to obtain named functions without constructors. + const tamedMethods= { + // The optional `optFn` argument is for cutting off the bottom of + // the stack --- for capturing the stack only above the topmost + // call to that function. Since this isn't the "real" captureStackTrace + // but instead calls the real one, if no other cutoff is provided, + // we cut this one off. + captureStackTrace(error, optFn= tamedMethods.captureStackTrace) { + if( typeof originalCaptureStackTrace=== 'function') { + // OriginalError.captureStackTrace is only on v8 + apply(originalCaptureStackTrace, OriginalError, [error, optFn]); + return; + } + reflectSet(error, 'stack', ''); + }, + // Shim of proposed special power, to reside by default only + // in the start compartment, for getting the stack traceback + // string associated with an error. + // See https://tc39.es/proposal-error-stacks/ + getStackString(error) { + let stackInfo= weakmapGet(stackInfos, error); + + if( stackInfo=== undefined) { + // The following will call `prepareStackTrace()` synchronously + // which will populate stackInfos + // eslint-disable-next-line no-void + void error.stack; + stackInfo= weakmapGet(stackInfos, error); + if( !stackInfo) { + stackInfo= { stackString: ''}; + weakmapSet(stackInfos, error, stackInfo); + } + } + + // prepareStackTrace() may generate the stackString + // if errorTaming === 'unsafe' + + if( stackInfo.stackString!== undefined) { + return stackInfo.stackString; + } + + const stackString= stackStringFromSST(error, stackInfo.callSites); + weakmapSet(stackInfos, error, { stackString}); + + return stackString; + }, + prepareStackTrace(error, sst) { + if( errorTaming=== 'unsafe') { + const stackString= stackStringFromSST(error, sst); + weakmapSet(stackInfos, error, { stackString}); + return `${error}${stackString}`; + }else { + weakmapSet(stackInfos, error, { callSites: sst}); + return ''; + } + }}; + + + // A prepareFn is a prepareStackTrace function. + // An sst is a `structuredStackTrace`, which is an array of + // callsites. + // A user prepareFn is a prepareFn defined by a client of this API, + // and provided by assigning to `Error.prepareStackTrace`. + // A user prepareFn should only receive an attenuated sst, which + // is an array of attenuated callsites. + // A system prepareFn is the prepareFn created by this module to + // be installed on the real `Error` constructor, to receive + // an original sst, i.e., an array of unattenuated callsites. + // An input prepareFn is a function the user assigns to + // `Error.prepareStackTrace`, which might be a user prepareFn or + // a system prepareFn previously obtained by reading + // `Error.prepareStackTrace`. + + const defaultPrepareFn= tamedMethods.prepareStackTrace; + + OriginalError.prepareStackTrace= defaultPrepareFn; + + // A weakset branding some functions as system prepareFns, all of which + // must be defined by this module, since they can receive an + // unattenuated sst. + const systemPrepareFnSet= new WeakSet([defaultPrepareFn]); + + const systemPrepareFnFor= (inputPrepareFn)=>{ + if( weaksetHas(systemPrepareFnSet, inputPrepareFn)) { + return inputPrepareFn; + } + // Use concise methods to obtain named functions without constructors. + const systemMethods= { + prepareStackTrace(error, sst) { + weakmapSet(stackInfos, error, { callSites: sst}); + return inputPrepareFn(error, safeV8SST(sst)); + }}; + + weaksetAdd(systemPrepareFnSet, systemMethods.prepareStackTrace); + return systemMethods.prepareStackTrace; + }; + + // Note `stackTraceLimit` accessor already defined by + // tame-error-constructor.js + defineProperties(InitialError, { + captureStackTrace: { + value: tamedMethods.captureStackTrace, + writable: true, + enumerable: false, + configurable: true}, + + prepareStackTrace: { + get() { + return OriginalError.prepareStackTrace; + }, + set(inputPrepareStackTraceFn) { + if( typeof inputPrepareStackTraceFn=== 'function') { + const systemPrepareFn= systemPrepareFnFor(inputPrepareStackTraceFn); + OriginalError.prepareStackTrace= systemPrepareFn; + }else { + OriginalError.prepareStackTrace= defaultPrepareFn; + } + }, + enumerable: false, + configurable: true}}); + + + + return tamedMethods.getStackString; + };$h‍_once.tameV8ErrorConstructor(tameV8ErrorConstructor); +})() +, +// === functors[37] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_ERROR,TypeError,apply,construct,defineProperties,setPrototypeOf,getOwnPropertyDescriptor,defineProperty,NativeErrors,tameV8ErrorConstructor;$h‍_imports([["../commons.js", [["FERAL_ERROR", [$h‍_a => (FERAL_ERROR = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["construct", [$h‍_a => (construct = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["setPrototypeOf", [$h‍_a => (setPrototypeOf = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]]]],["../permits.js", [["NativeErrors", [$h‍_a => (NativeErrors = $h‍_a)]]]],["./tame-v8-error-constructor.js", [["tameV8ErrorConstructor", [$h‍_a => (tameV8ErrorConstructor = $h‍_a)]]]]]); + + + + + + + + + + + + +// Present on at least FF and XS. Proposed by Error-proposal. The original +// is dangerous, so tameErrorConstructor replaces it with a safe one. +// We grab the original here before it gets replaced. +const stackDesc= getOwnPropertyDescriptor(FERAL_ERROR.prototype, 'stack'); +const stackGetter= stackDesc&& stackDesc.get; + +// Use concise methods to obtain named functions without constructors. +const tamedMethods= { + getStackString(error) { + if( typeof stackGetter=== 'function') { + return apply(stackGetter, error, []); + }else if( 'stack'in error) { + // The fallback is to just use the de facto `error.stack` if present + return `${error.stack}`; + } + return ''; + }}; + + +function tameErrorConstructor( + errorTaming= 'safe', + stackFiltering= 'concise') + { + if( errorTaming!== 'safe'&& errorTaming!== 'unsafe') { + throw TypeError( `unrecognized errorTaming ${errorTaming}`); + } + if( stackFiltering!== 'concise'&& stackFiltering!== 'verbose') { + throw TypeError( `unrecognized stackFiltering ${stackFiltering}`); + } + const ErrorPrototype= FERAL_ERROR.prototype; + + const platform= + typeof FERAL_ERROR.captureStackTrace=== 'function'? 'v8': 'unknown'; + const { captureStackTrace: originalCaptureStackTrace}= FERAL_ERROR; + + const makeErrorConstructor= (_= {})=> { + // eslint-disable-next-line no-shadow + const ResultError= function Error(...rest) { + let error; + if( new.target=== undefined) { + error= apply(FERAL_ERROR, this, rest); + }else { + error= construct(FERAL_ERROR, rest, new.target); + } + if( platform=== 'v8') { + // TODO Likely expensive! + apply(originalCaptureStackTrace, FERAL_ERROR, [error, ResultError]); + } + return error; + }; + defineProperties(ResultError, { + length: { value: 1}, + prototype: { + value: ErrorPrototype, + writable: false, + enumerable: false, + configurable: false}}); + + + return ResultError; + }; + const InitialError= makeErrorConstructor({ powers: 'original'}); + const SharedError= makeErrorConstructor({ powers: 'none'}); + defineProperties(ErrorPrototype, { + constructor: { value: SharedError}}); + + + for( const NativeError of NativeErrors) { + setPrototypeOf(NativeError, SharedError); + } + + // https://v8.dev/docs/stack-trace-api#compatibility advises that + // programmers can "always" set `Error.stackTraceLimit` + // even on non-v8 platforms. On non-v8 + // it will have no effect, but this advice only makes sense + // if the assignment itself does not fail, which it would + // if `Error` were naively frozen. Hence, we add setters that + // accept but ignore the assignment on non-v8 platforms. + defineProperties(InitialError, { + stackTraceLimit: { + get() { + if( typeof FERAL_ERROR.stackTraceLimit=== 'number') { + // FERAL_ERROR.stackTraceLimit is only on v8 + return FERAL_ERROR.stackTraceLimit; + } + return undefined; + }, + set(newLimit) { + if( typeof newLimit!== 'number') { + // silently do nothing. This behavior doesn't precisely + // emulate v8 edge-case behavior. But given the purpose + // of this emulation, having edge cases err towards + // harmless seems the safer option. + return; + } + if( typeof FERAL_ERROR.stackTraceLimit=== 'number') { + // FERAL_ERROR.stackTraceLimit is only on v8 + FERAL_ERROR.stackTraceLimit= newLimit; + // We place the useless return on the next line to ensure + // that anything we place after the if in the future only + // happens if the then-case does not. + // eslint-disable-next-line no-useless-return + return; + } + }, + // WTF on v8 stackTraceLimit is enumerable + enumerable: false, + configurable: true}}); + + + + // The default SharedError much be completely powerless even on v8, + // so the lenient `stackTraceLimit` accessor does nothing on all + // platforms. + defineProperties(SharedError, { + stackTraceLimit: { + get() { + return undefined; + }, + set(_newLimit) { + // do nothing + }, + enumerable: false, + configurable: true}}); + + + + if( platform=== 'v8') { + // `SharedError.prepareStackTrace`, if it exists, must also be + // powerless. However, from what we've heard, depd expects to be able to + // assign to it without the assignment throwing. It is normally a function + // that returns a stack string to be magically added to error objects. + // However, as long as we're adding a lenient standin, we may as well + // accommodate any who expect to get a function they can call and get + // a string back. This prepareStackTrace is a do-nothing function that + // always returns the empty string. + defineProperties(SharedError, { + prepareStackTrace: { + get() { + return ()=> ''; + }, + set(_prepareFn) { + // do nothing + }, + enumerable: false, + configurable: true}, + + captureStackTrace: { + value: (errorish, _constructorOpt)=> { + defineProperty(errorish, 'stack', { + value: ''}); + + }, + writable: false, + enumerable: false, + configurable: true}}); + + + } + + let initialGetStackString= tamedMethods.getStackString; + if( platform=== 'v8') { + initialGetStackString= tameV8ErrorConstructor( + FERAL_ERROR, + InitialError, + errorTaming, + stackFiltering); + + }else if( errorTaming=== 'unsafe') { + // v8 has too much magic around their 'stack' own property for it to + // coexist cleanly with this accessor. So only install it on non-v8 + + // Error.prototype.stack property as proposed at + // https://tc39.es/proposal-error-stacks/ + // with the fix proposed at + // https://github.com/tc39/proposal-error-stacks/issues/46 + // On others, this still protects from the override mistake, + // essentially like enable-property-overrides.js would + // once this accessor property itself is frozen, as will happen + // later during lockdown. + // + // However, there is here a change from the intent in the current + // state of the proposal. If experience tells us whether this change + // is a good idea, we should modify the proposal accordingly. There is + // much code in the world that assumes `error.stack` is a string. So + // where the proposal accommodates secure operation by making the + // property optional, we instead accommodate secure operation by + // having the secure form always return only the stable part, the + // stringified error instance, and omitting all the frame information + // rather than omitting the property. + defineProperties(ErrorPrototype, { + stack: { + get() { + return initialGetStackString(this); + }, + set(newValue) { + defineProperties(this, { + stack: { + value: newValue, + writable: true, + enumerable: true, + configurable: true}}); + + + }}}); + + + }else { + // v8 has too much magic around their 'stack' own property for it to + // coexist cleanly with this accessor. So only install it on non-v8 + defineProperties(ErrorPrototype, { + stack: { + get() { + // https://github.com/tc39/proposal-error-stacks/issues/46 + // allows this to not add an unpleasant newline. Otherwise + // we should fix this. + return `${this}`; + }, + set(newValue) { + defineProperties(this, { + stack: { + value: newValue, + writable: true, + enumerable: true, + configurable: true}}); + + + }}}); + + + } + + return { + '%InitialGetStackString%': initialGetStackString, + '%InitialError%': InitialError, + '%SharedError%': SharedError}; + + }$h‍_once.default( tameErrorConstructor); +})() +, +// === functors[38] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let ReferenceError,TypeError,Map,Set,arrayJoin,arrayMap,arrayPush,create,freeze,mapGet,mapHas,mapSet,setAdd,promiseCatch,promiseThen,values,weakmapGet,assert;$h‍_imports([["./commons.js", [["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["Map", [$h‍_a => (Map = $h‍_a)]],["Set", [$h‍_a => (Set = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["mapHas", [$h‍_a => (mapHas = $h‍_a)]],["mapSet", [$h‍_a => (mapSet = $h‍_a)]],["setAdd", [$h‍_a => (setAdd = $h‍_a)]],["promiseCatch", [$h‍_a => (promiseCatch = $h‍_a)]],["promiseThen", [$h‍_a => (promiseThen = $h‍_a)]],["values", [$h‍_a => (values = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); + + + + + + + + + + + + + + + + + + + + + + + + + + + + +const { Fail, details: d, quote: q}= assert; + +const noop= ()=> { }; + +// `makeAlias` constructs compartment specifier tuples for the `aliases` +// private field of compartments. +// These aliases allow a compartment to alias an internal module specifier to a +// module specifier in an external compartment, and also to create internal +// aliases. +// Both are facilitated by the moduleMap Compartment constructor option. +const makeAlias= (compartment, specifier)=> + freeze({ + compartment, + specifier}); + + +// `resolveAll` pre-computes resolutions of all imports within the compartment +// in which a module was loaded. +$h‍_once.makeAlias(makeAlias);const resolveAll=(imports,resolveHook,fullReferrerSpecifier)=>{ + const resolvedImports= create(null); + for( const importSpecifier of imports) { + const fullSpecifier= resolveHook(importSpecifier, fullReferrerSpecifier); + resolvedImports[importSpecifier]= fullSpecifier; + } + return freeze(resolvedImports); + }; + +const loadRecord= ( + compartmentPrivateFields, + moduleAliases, + compartment, + moduleSpecifier, + staticModuleRecord, + pendingJobs, + moduleLoads, + errors, + importMeta)=> + { + const { resolveHook, moduleRecords}= weakmapGet( + compartmentPrivateFields, + compartment); + + + // resolve all imports relative to this referrer module. + const resolvedImports= resolveAll( + staticModuleRecord.imports, + resolveHook, + moduleSpecifier); + + const moduleRecord= freeze({ + compartment, + staticModuleRecord, + moduleSpecifier, + resolvedImports, + importMeta}); + + + // Enqueue jobs to load this module's shallow dependencies. + for( const fullSpecifier of values(resolvedImports)) { + // Behold: recursion. + // eslint-disable-next-line no-use-before-define + const dependencyLoaded= memoizedLoadWithErrorAnnotation( + compartmentPrivateFields, + moduleAliases, + compartment, + fullSpecifier, + pendingJobs, + moduleLoads, + errors); + + setAdd( + pendingJobs, + promiseThen(dependencyLoaded, noop, (error)=>{ + arrayPush(errors, error); + })); + + } + + // Memoize. + mapSet(moduleRecords, moduleSpecifier, moduleRecord); + return moduleRecord; + }; + +const loadWithoutErrorAnnotation= async( + compartmentPrivateFields, + moduleAliases, + compartment, + moduleSpecifier, + pendingJobs, + moduleLoads, + errors)=> + { + const { importHook, moduleMap, moduleMapHook, moduleRecords}= weakmapGet( + compartmentPrivateFields, + compartment); + + + // Follow moduleMap, or moduleMapHook if present. + let aliasNamespace= moduleMap[moduleSpecifier]; + if( aliasNamespace=== undefined&& moduleMapHook!== undefined) { + aliasNamespace= moduleMapHook(moduleSpecifier); + } + if( typeof aliasNamespace=== 'string') { + // eslint-disable-next-line @endo/no-polymorphic-call + assert.fail( + d `Cannot map module ${q(moduleSpecifier)} to ${q( + aliasNamespace) + } in parent compartment, not yet implemented`, + TypeError); + + }else if( aliasNamespace!== undefined) { + const alias= weakmapGet(moduleAliases, aliasNamespace); + if( alias=== undefined) { + // eslint-disable-next-line @endo/no-polymorphic-call + assert.fail( + d `Cannot map module ${q( + moduleSpecifier) + } because the value is not a module exports namespace, or is from another realm`, + ReferenceError); + + } + // Behold: recursion. + // eslint-disable-next-line no-use-before-define + const aliasRecord= await memoizedLoadWithErrorAnnotation( + compartmentPrivateFields, + moduleAliases, + alias.compartment, + alias.specifier, + pendingJobs, + moduleLoads, + errors); + + mapSet(moduleRecords, moduleSpecifier, aliasRecord); + return aliasRecord; + } + + if( mapHas(moduleRecords, moduleSpecifier)) { + return mapGet(moduleRecords, moduleSpecifier); + } + + const staticModuleRecord= await importHook(moduleSpecifier); + + if( staticModuleRecord=== null|| typeof staticModuleRecord!== 'object') { + Fail `importHook must return a promise for an object, for module ${q( + moduleSpecifier) + } in compartment ${q(compartment.name)}`; + } + + // check if record is a RedirectStaticModuleInterface + if( staticModuleRecord.specifier!== undefined) { + // check if this redirect with an explicit record + if( staticModuleRecord.record!== undefined) { + // ensure expected record shape + if( staticModuleRecord.compartment!== undefined) { + throw TypeError( + 'Cannot redirect to an explicit record with a specified compartment'); + + } + const { + compartment: aliasCompartment= compartment, + specifier: aliasSpecifier= moduleSpecifier, + record: aliasModuleRecord, + importMeta}= + staticModuleRecord; + + const aliasRecord= loadRecord( + compartmentPrivateFields, + moduleAliases, + aliasCompartment, + aliasSpecifier, + aliasModuleRecord, + pendingJobs, + moduleLoads, + errors, + importMeta); + + mapSet(moduleRecords, moduleSpecifier, aliasRecord); + return aliasRecord; + } + + // check if this redirect with an explicit compartment + if( staticModuleRecord.compartment!== undefined) { + // ensure expected record shape + if( staticModuleRecord.importMeta!== undefined) { + throw TypeError( + 'Cannot redirect to an implicit record with a specified importMeta'); + + } + // Behold: recursion. + // eslint-disable-next-line no-use-before-define + const aliasRecord= await memoizedLoadWithErrorAnnotation( + compartmentPrivateFields, + moduleAliases, + staticModuleRecord.compartment, + staticModuleRecord.specifier, + pendingJobs, + moduleLoads, + errors); + + mapSet(moduleRecords, moduleSpecifier, aliasRecord); + return aliasRecord; + } + + throw TypeError('Unnexpected RedirectStaticModuleInterface record shape'); + } + + return loadRecord( + compartmentPrivateFields, + moduleAliases, + compartment, + moduleSpecifier, + staticModuleRecord, + pendingJobs, + moduleLoads, + errors); + + }; + +const memoizedLoadWithErrorAnnotation= async( + compartmentPrivateFields, + moduleAliases, + compartment, + moduleSpecifier, + pendingJobs, + moduleLoads, + errors)=> + { + const { name: compartmentName}= weakmapGet( + compartmentPrivateFields, + compartment); + + + // Prevent data-lock from recursion into branches visited in dependent loads. + let compartmentLoading= mapGet(moduleLoads, compartment); + if( compartmentLoading=== undefined) { + compartmentLoading= new Map(); + mapSet(moduleLoads, compartment, compartmentLoading); + } + let moduleLoading= mapGet(compartmentLoading, moduleSpecifier); + if( moduleLoading!== undefined) { + return moduleLoading; + } + + moduleLoading= promiseCatch( + loadWithoutErrorAnnotation( + compartmentPrivateFields, + moduleAliases, + compartment, + moduleSpecifier, + pendingJobs, + moduleLoads, + errors), + + (error)=>{ + // eslint-disable-next-line @endo/no-polymorphic-call + assert.note( + error, + d `${error.message}, loading ${q(moduleSpecifier)} in compartment ${q( + compartmentName) + }`); + + throw error; + }); + + + mapSet(compartmentLoading, moduleSpecifier, moduleLoading); + + return moduleLoading; + }; + +/* + * `load` asynchronously gathers the `StaticModuleRecord`s for a module and its + * transitive dependencies. + * The module records refer to each other by a reference to the dependency's + * compartment and the specifier of the module within its own compartment. + * This graph is then ready to be synchronously linked and executed. + */ +const load= async( + compartmentPrivateFields, + moduleAliases, + compartment, + moduleSpecifier)=> + { + const { name: compartmentName}= weakmapGet( + compartmentPrivateFields, + compartment); + + + /** @type {Set>} */ + const pendingJobs= new Set(); + /** @type {Map>>>} */ + const moduleLoads= new Map(); + /** @type {Array} */ + const errors= []; + + const dependencyLoaded= memoizedLoadWithErrorAnnotation( + compartmentPrivateFields, + moduleAliases, + compartment, + moduleSpecifier, + pendingJobs, + moduleLoads, + errors); + + setAdd( + pendingJobs, + promiseThen(dependencyLoaded, noop, (error)=>{ + arrayPush(errors, error); + })); + + + // Drain pending jobs queue. + // Each job is a promise for undefined, regardless of success or failure. + // Before we add a job to the queue, we catch any error and push it into the + // `errors` accumulator. + for( const job of pendingJobs) { + // eslint-disable-next-line no-await-in-loop + await job; + } + + // Throw an aggregate error if there were any errors. + if( errors.length> 0) { + throw TypeError( + `Failed to load module ${q(moduleSpecifier)} in package ${q( + compartmentName) + } (${errors.length} underlying failures: ${arrayJoin( + arrayMap(errors, (error)=>error.message), + ', ') + }`); + + } + };$h‍_once.load(load); +})() +, +// === functors[39] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let makeAlias,Proxy,TypeError,create,freeze,mapGet,mapHas,mapSet,ownKeys,reflectGet,reflectGetOwnPropertyDescriptor,reflectHas,reflectIsExtensible,reflectPreventExtensions,weakmapSet,assert;$h‍_imports([["./module-load.js", [["makeAlias", [$h‍_a => (makeAlias = $h‍_a)]]]],["./commons.js", [["Proxy", [$h‍_a => (Proxy = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["mapHas", [$h‍_a => (mapHas = $h‍_a)]],["mapSet", [$h‍_a => (mapSet = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["reflectGet", [$h‍_a => (reflectGet = $h‍_a)]],["reflectGetOwnPropertyDescriptor", [$h‍_a => (reflectGetOwnPropertyDescriptor = $h‍_a)]],["reflectHas", [$h‍_a => (reflectHas = $h‍_a)]],["reflectIsExtensible", [$h‍_a => (reflectIsExtensible = $h‍_a)]],["reflectPreventExtensions", [$h‍_a => (reflectPreventExtensions = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +const { quote: q}= assert; + +// `deferExports` creates a module's exports proxy, proxied exports, and +// activator. +// A `Compartment` can create a module for any module specifier, regardless of +// whether it is loadable or executable, and use that object as a token that +// can be fed into another compartment's module map. +// Only after the specified module has been analyzed is it possible for the +// module namespace proxy to behave properly, so it throws exceptions until +// after the compartment has begun executing the module. +// The module instance must freeze the proxied exports and activate the exports +// proxy before executing the module. +// +// The module exports proxy's behavior differs from the ECMAScript 262 +// specification for "module namespace exotic objects" only in that according +// to the specification value property descriptors have a non-writable "value" +// and this implementation models all properties with accessors. +// +// https://tc39.es/ecma262/#sec-module-namespace-exotic-objects +// +const deferExports= ()=> { + let active= false; + const proxiedExports= create(null); + return freeze({ + activate() { + active= true; + }, + proxiedExports, + exportsProxy: new Proxy(proxiedExports, { + get(_target, name, receiver) { + if( !active) { + throw TypeError( + `Cannot get property ${q( + name) + } of module exports namespace, the module has not yet begun to execute`); + + } + return reflectGet(proxiedExports, name, receiver); + }, + set(_target, name, _value) { + throw TypeError( + `Cannot set property ${q(name)} of module exports namespace`); + + }, + has(_target, name) { + if( !active) { + throw TypeError( + `Cannot check property ${q( + name) + }, the module has not yet begun to execute`); + + } + return reflectHas(proxiedExports, name); + }, + deleteProperty(_target, name) { + throw TypeError( + `Cannot delete property ${q(name)}s of module exports namespace`); + + }, + ownKeys(_target) { + if( !active) { + throw TypeError( + 'Cannot enumerate keys, the module has not yet begun to execute'); + + } + return ownKeys(proxiedExports); + }, + getOwnPropertyDescriptor(_target, name) { + if( !active) { + throw TypeError( + `Cannot get own property descriptor ${q( + name) + }, the module has not yet begun to execute`); + + } + return reflectGetOwnPropertyDescriptor(proxiedExports, name); + }, + preventExtensions(_target) { + if( !active) { + throw TypeError( + 'Cannot prevent extensions of module exports namespace, the module has not yet begun to execute'); + + } + return reflectPreventExtensions(proxiedExports); + }, + isExtensible() { + if( !active) { + throw TypeError( + 'Cannot check extensibility of module exports namespace, the module has not yet begun to execute'); + + } + return reflectIsExtensible(proxiedExports); + }, + getPrototypeOf(_target) { + return null; + }, + setPrototypeOf(_target, _proto) { + throw TypeError('Cannot set prototype of module exports namespace'); + }, + defineProperty(_target, name, _descriptor) { + throw TypeError( + `Cannot define property ${q(name)} of module exports namespace`); + + }, + apply(_target, _thisArg, _args) { + throw TypeError( + 'Cannot call module exports namespace, it is not a function'); + + }, + construct(_target, _args) { + throw TypeError( + 'Cannot construct module exports namespace, it is not a constructor'); + + }})}); + + + }; + +// `getDeferredExports` memoizes the creation of a deferred module exports +// namespace proxy for any abritrary full specifier in a compartment. +// It also records the compartment and specifier affiliated with that module +// exports namespace proxy so it can be used as an alias into another +// compartment when threaded through a compartment's `moduleMap` argument. +$h‍_once.deferExports(deferExports);const getDeferredExports=( + compartment, + compartmentPrivateFields, + moduleAliases, + specifier)=> + { + const { deferredExports}= compartmentPrivateFields; + if( !mapHas(deferredExports, specifier)) { + const deferred= deferExports(); + weakmapSet( + moduleAliases, + deferred.exportsProxy, + makeAlias(compartment, specifier)); + + mapSet(deferredExports, specifier, deferred); + } + return mapGet(deferredExports, specifier); + };$h‍_once.getDeferredExports(getDeferredExports); +})() +, +// === functors[40] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let TypeError,arrayPush,create,getOwnPropertyDescriptors,evadeHtmlCommentTest,evadeImportExpressionTest,rejectSomeDirectEvalExpressions,makeSafeEvaluator;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]]]],["./transforms.js", [["evadeHtmlCommentTest", [$h‍_a => (evadeHtmlCommentTest = $h‍_a)]],["evadeImportExpressionTest", [$h‍_a => (evadeImportExpressionTest = $h‍_a)]],["rejectSomeDirectEvalExpressions", [$h‍_a => (rejectSomeDirectEvalExpressions = $h‍_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator", [$h‍_a => (makeSafeEvaluator = $h‍_a)]]]]]); + + + + + + + + + + + + + +const provideCompartmentEvaluator= (compartmentFields, options)=> { + const { sloppyGlobalsMode= false, __moduleShimLexicals__= undefined}= + options; + + let safeEvaluate; + + if( __moduleShimLexicals__=== undefined&& !sloppyGlobalsMode) { + ({ safeEvaluate}= compartmentFields); + }else { + // The scope proxy or global lexicals are different from the + // shared evaluator so we need to build a new one + + let { globalTransforms}= compartmentFields; + const { globalObject}= compartmentFields; + + let moduleLexicals; + if( __moduleShimLexicals__!== undefined) { + // When using `evaluate` for ESM modules, as should only occur from the + // module-shim's module-instance.js, we do not reveal the SES-shim's + // module-to-program translation, as this is not standardizable behavior. + // However, the `localTransforms` will come from the `__shimTransforms__` + // Compartment option in this case, which is a non-standardizable escape + // hatch so programs designed specifically for the SES-shim + // implementation may opt-in to use the same transforms for `evaluate` + // and `import`, at the expense of being tightly coupled to SES-shim. + globalTransforms= undefined; + + moduleLexicals= create( + null, + getOwnPropertyDescriptors(__moduleShimLexicals__)); + + } + + ({ safeEvaluate}= makeSafeEvaluator({ + globalObject, + moduleLexicals, + globalTransforms, + sloppyGlobalsMode})); + + } + + return { safeEvaluate}; + };$h‍_once.provideCompartmentEvaluator(provideCompartmentEvaluator); + +const compartmentEvaluate= (compartmentFields, source, options)=> { + // Perform this check first to avoid unnecessary sanitizing. + // TODO Maybe relax string check and coerce instead: + // https://github.com/tc39/proposal-dynamic-code-brand-checks + if( typeof source!== 'string') { + throw TypeError('first argument of evaluate() must be a string'); + } + + // Extract options, and shallow-clone transforms. + const { + transforms= [], + __evadeHtmlCommentTest__= false, + __evadeImportExpressionTest__= false, + __rejectSomeDirectEvalExpressions__= true // Note default on +}= options; + const localTransforms= [...transforms]; + if( __evadeHtmlCommentTest__=== true) { + arrayPush(localTransforms, evadeHtmlCommentTest); + } + if( __evadeImportExpressionTest__=== true) { + arrayPush(localTransforms, evadeImportExpressionTest); + } + if( __rejectSomeDirectEvalExpressions__=== true) { + arrayPush(localTransforms, rejectSomeDirectEvalExpressions); + } + + const { safeEvaluate}= provideCompartmentEvaluator( + compartmentFields, + options); + + + return safeEvaluate(source, { + localTransforms}); + + };$h‍_once.compartmentEvaluate(compartmentEvaluate); +})() +, +// === functors[41] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let assert,getDeferredExports,ReferenceError,SyntaxError,TypeError,arrayForEach,arrayIncludes,arrayPush,arraySome,arraySort,create,defineProperty,entries,freeze,isArray,keys,mapGet,weakmapGet,reflectHas,assign,compartmentEvaluate;$h‍_imports([["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]],["./module-proxy.js", [["getDeferredExports", [$h‍_a => (getDeferredExports = $h‍_a)]]]],["./commons.js", [["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["SyntaxError", [$h‍_a => (SyntaxError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayForEach", [$h‍_a => (arrayForEach = $h‍_a)]],["arrayIncludes", [$h‍_a => (arrayIncludes = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["arraySome", [$h‍_a => (arraySome = $h‍_a)]],["arraySort", [$h‍_a => (arraySort = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["isArray", [$h‍_a => (isArray = $h‍_a)]],["keys", [$h‍_a => (keys = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["reflectHas", [$h‍_a => (reflectHas = $h‍_a)]],["assign", [$h‍_a => (assign = $h‍_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate", [$h‍_a => (compartmentEvaluate = $h‍_a)]]]]]); + + + + + + + + + + + + + + + + + + + + + + + +const { quote: q}= assert; + +const makeThirdPartyModuleInstance= ( + compartmentPrivateFields, + staticModuleRecord, + compartment, + moduleAliases, + moduleSpecifier, + resolvedImports)=> + { + const { exportsProxy, proxiedExports, activate}= getDeferredExports( + compartment, + weakmapGet(compartmentPrivateFields, compartment), + moduleAliases, + moduleSpecifier); + + + const notifiers= create(null); + + if( staticModuleRecord.exports) { + if( + !isArray(staticModuleRecord.exports)|| + arraySome(staticModuleRecord.exports, (name)=>typeof name!== 'string')) + { + throw TypeError( + `SES third-party static module record "exports" property must be an array of strings for module ${moduleSpecifier}`); + + } + arrayForEach(staticModuleRecord.exports, (name)=>{ + let value= proxiedExports[name]; + const updaters= []; + + const get= ()=> value; + + const set= (newValue)=>{ + value= newValue; + for( const updater of updaters) { + updater(newValue); + } + }; + + defineProperty(proxiedExports, name, { + get, + set, + enumerable: true, + configurable: false}); + + + notifiers[name]= (update)=>{ + arrayPush(updaters, update); + update(value); + }; + }); + // This is enough to support import * from cjs - the '*' field doesn't need to be in exports nor proxiedExports because import will only ever access it via notifiers + notifiers['*']= (update)=>{ + update(proxiedExports); + }; + } + + const localState= { + activated: false}; + + return freeze({ + notifiers, + exportsProxy, + execute() { + if( reflectHas(localState, 'errorFromExecute')) { + throw localState.errorFromExecute; + } + if( !localState.activated) { + activate(); + localState.activated= true; + try { + // eslint-disable-next-line @endo/no-polymorphic-call + staticModuleRecord.execute( + proxiedExports, + compartment, + resolvedImports); + + }catch( err) { + localState.errorFromExecute= err; + throw err; + } + } + }}); + + }; + +// `makeModuleInstance` takes a module's compartment record, the live import +// namespace, and a global object; and produces a module instance. +// The module instance carries the proxied module exports namespace (the +// "exports"), notifiers to update the module's internal import namespace, and +// an idempotent execute function. +// The module exports namespace is a proxy to the proxied exports namespace +// that the execution of the module instance populates. +$h‍_once.makeThirdPartyModuleInstance(makeThirdPartyModuleInstance);const makeModuleInstance=( + privateFields, + moduleAliases, + moduleRecord, + importedInstances)=> + { + const { + compartment, + moduleSpecifier, + staticModuleRecord, + importMeta: moduleRecordMeta}= + moduleRecord; + const { + reexports: exportAlls= [], + __syncModuleProgram__: functorSource, + __fixedExportMap__: fixedExportMap= {}, + __liveExportMap__: liveExportMap= {}, + __reexportMap__: reexportMap= {}, + __needsImportMeta__: needsImportMeta= false, + __syncModuleFunctor__}= + staticModuleRecord; + + const compartmentFields= weakmapGet(privateFields, compartment); + + const { __shimTransforms__, importMetaHook}= compartmentFields; + + const { exportsProxy, proxiedExports, activate}= getDeferredExports( + compartment, + compartmentFields, + moduleAliases, + moduleSpecifier); + + + // {_exportName_: getter} module exports namespace + // object (eventually proxied). + const exportsProps= create(null); + + // {_localName_: accessor} proxy traps for moduleLexicals and live bindings. + // The moduleLexicals object is frozen and the corresponding properties of + // moduleLexicals must be immutable, so we copy the descriptors. + const moduleLexicals= create(null); + + // {_localName_: init(initValue) -> initValue} used by the + // rewritten code to initialize exported fixed bindings. + const onceVar= create(null); + + // {_localName_: update(newValue)} used by the rewritten code to + // both initialize and update live bindings. + const liveVar= create(null); + + const importMeta= create(null); + if( moduleRecordMeta) { + assign(importMeta, moduleRecordMeta); + } + if( needsImportMeta&& importMetaHook) { + importMetaHook(moduleSpecifier, importMeta); + } + + // {_localName_: [{get, set, notify}]} used to merge all the export updaters. + const localGetNotify= create(null); + + // {[importName: string]: notify(update(newValue))} Used by code that imports + // one of this module's exports, so that their update function will + // be notified when this binding is initialized or updated. + const notifiers= create(null); + + arrayForEach(entries(fixedExportMap), ([fixedExportName, [localName]])=> { + let fixedGetNotify= localGetNotify[localName]; + if( !fixedGetNotify) { + // fixed binding state + let value; + let tdz= true; + /** @type {null | Array<(value: any) => void>} */ + let optUpdaters= []; + + // tdz sensitive getter + const get= ()=> { + if( tdz) { + throw ReferenceError( `binding ${q(localName)} not yet initialized`); + } + return value; + }; + + // leave tdz once + const init= freeze((initValue)=>{ + // init with initValue of a declared const binding, and return + // it. + if( !tdz) { + throw TypeError( + `Internal: binding ${q(localName)} already initialized`); + + } + value= initValue; + const updaters= optUpdaters; + optUpdaters= null; + tdz= false; + for( const updater of updaters|| []) { + updater(initValue); + } + return initValue; + }); + + // If still tdz, register update for notification later. + // Otherwise, update now. + const notify= (updater)=>{ + if( updater=== init) { + // Prevent recursion. + return; + } + if( tdz) { + arrayPush(optUpdaters|| [], updater); + }else { + updater(value); + } + }; + + // Need these for additional exports of the local variable. + fixedGetNotify= { + get, + notify}; + + localGetNotify[localName]= fixedGetNotify; + onceVar[localName]= init; + } + + exportsProps[fixedExportName]= { + get: fixedGetNotify.get, + set: undefined, + enumerable: true, + configurable: false}; + + + notifiers[fixedExportName]= fixedGetNotify.notify; + }); + + arrayForEach( + entries(liveExportMap), + ([liveExportName, [localName, setProxyTrap]])=> { + let liveGetNotify= localGetNotify[localName]; + if( !liveGetNotify) { + // live binding state + let value; + let tdz= true; + const updaters= []; + + // tdz sensitive getter + const get= ()=> { + if( tdz) { + throw ReferenceError( + `binding ${q(liveExportName)} not yet initialized`); + + } + return value; + }; + + // This must be usable locally for the translation of initializing + // a declared local live binding variable. + // + // For reexported variable, this is also an update function to + // register for notification with the downstream import, which we + // must assume to be live. Thus, it can be called independent of + // tdz but always leaves tdz. Such reexporting creates a tree of + // bindings. This lets the tree be hooked up even if the imported + // module instance isn't initialized yet, as may happen in cycles. + const update= freeze((newValue)=>{ + value= newValue; + tdz= false; + for( const updater of updaters) { + updater(newValue); + } + }); + + // tdz sensitive setter + const set= (newValue)=>{ + if( tdz) { + throw ReferenceError( `binding ${q(localName)} not yet initialized`); + } + value= newValue; + for( const updater of updaters) { + updater(newValue); + } + }; + + // Always register the updater function. + // If not in tdz, also update now. + const notify= (updater)=>{ + if( updater=== update) { + // Prevent recursion. + return; + } + arrayPush(updaters, updater); + if( !tdz) { + updater(value); + } + }; + + liveGetNotify= { + get, + notify}; + + + localGetNotify[localName]= liveGetNotify; + if( setProxyTrap) { + defineProperty(moduleLexicals, localName, { + get, + set, + enumerable: true, + configurable: false}); + + } + liveVar[localName]= update; + } + + exportsProps[liveExportName]= { + get: liveGetNotify.get, + set: undefined, + enumerable: true, + configurable: false}; + + + notifiers[liveExportName]= liveGetNotify.notify; + }); + + + const notifyStar= (update)=>{ + update(proxiedExports); + }; + notifiers['*']= notifyStar; + + // Per the calling convention for the moduleFunctor generated from + // an ESM, the `imports` function gets called once up front + // to populate or arrange the population of imports and reexports. + // The generated code produces an `updateRecord`: the means for + // the linker to update the imports and exports of the module. + // The updateRecord must conform to moduleAnalysis.imports + // updateRecord = Map + // importUpdaters = Map + function imports(updateRecord) { + // By the time imports is called, the importedInstances should already be + // initialized with module instances that satisfy + // imports. + // importedInstances = Map[_specifier_, { notifiers, module, execute }] + // notifiers = { [importName: string]: notify(update(newValue))} + + // export * cannot export default. + const candidateAll= create(null); + candidateAll.default= false; + for( const [specifier, importUpdaters]of updateRecord) { + const instance= mapGet(importedInstances, specifier); + // The module instance object is an internal literal, does not bind this, + // and never revealed outside the SES shim. + // There are two instantiation sites for instances and they are both in + // this module. + // eslint-disable-next-line @endo/no-polymorphic-call + instance.execute(); // bottom up cycle tolerant + const { notifiers: importNotifiers}= instance; + for( const [importName, updaters]of importUpdaters) { + const importNotify= importNotifiers[importName]; + if( !importNotify) { + throw SyntaxError( + `The requested module '${specifier}' does not provide an export named '${importName}'`); + + } + for( const updater of updaters) { + importNotify(updater); + } + } + if( arrayIncludes(exportAlls, specifier)) { + // Make all these imports candidates. + // Note names don't change in reexporting all + for( const [importAndExportName, importNotify]of entries( + importNotifiers)) + { + if( candidateAll[importAndExportName]=== undefined) { + candidateAll[importAndExportName]= importNotify; + }else { + // Already a candidate: remove ambiguity. + candidateAll[importAndExportName]= false; + } + } + } + if( reexportMap[specifier]) { + // Make named reexports candidates too. + for( const [localName, exportedName]of reexportMap[specifier]) { + candidateAll[exportedName]= importNotifiers[localName]; + } + } + } + + for( const [exportName, notify]of entries(candidateAll)) { + if( !notifiers[exportName]&& notify!== false) { + notifiers[exportName]= notify; + + // exported live binding state + let value; + const update= (newValue)=> value= newValue; + notify(update); + exportsProps[exportName]= { + get() { + return value; + }, + set: undefined, + enumerable: true, + configurable: false}; + + } + } + + // Sort the module exports namespace as per spec. + // The module exports namespace will be wrapped in a module namespace + // exports proxy which will serve as a "module exports namespace exotic + // object". + // Sorting properties is not generally reliable because some properties may + // be symbols, and symbols do not have an inherent relative order, but + // since all properties of the exports namespace must be keyed by a string + // and the string must correspond to a valid identifier, sorting these + // properties works for this specific case. + arrayForEach(arraySort(keys(exportsProps)), (k)=> + defineProperty(proxiedExports, k, exportsProps[k])); + + + freeze(proxiedExports); + activate(); + } + + let optFunctor; + if( __syncModuleFunctor__!== undefined) { + optFunctor= __syncModuleFunctor__; + }else { + optFunctor= compartmentEvaluate(compartmentFields, functorSource, { + globalObject: compartment.globalThis, + transforms: __shimTransforms__, + __moduleShimLexicals__: moduleLexicals}); + + } + let didThrow= false; + let thrownError; + function execute() { + if( optFunctor) { + // uninitialized + const functor= optFunctor; + optFunctor= null; + // initializing - call with `this` of `undefined`. + try { + functor( + freeze({ + imports: freeze(imports), + onceVar: freeze(onceVar), + liveVar: freeze(liveVar), + importMeta})); + + + }catch( e) { + didThrow= true; + thrownError= e; + } + // initialized + } + if( didThrow) { + throw thrownError; + } + } + + return freeze({ + notifiers, + exportsProxy, + execute}); + + };$h‍_once.makeModuleInstance(makeModuleInstance); +})() +, +// === functors[42] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let assert,makeModuleInstance,makeThirdPartyModuleInstance,Map,ReferenceError,TypeError,entries,isArray,isObject,mapGet,mapHas,mapSet,weakmapGet;$h‍_imports([["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]],["./module-instance.js", [["makeModuleInstance", [$h‍_a => (makeModuleInstance = $h‍_a)]],["makeThirdPartyModuleInstance", [$h‍_a => (makeThirdPartyModuleInstance = $h‍_a)]]]],["./commons.js", [["Map", [$h‍_a => (Map = $h‍_a)]],["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["isArray", [$h‍_a => (isArray = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["mapHas", [$h‍_a => (mapHas = $h‍_a)]],["mapSet", [$h‍_a => (mapSet = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]]]]]); + + + + + + + + + + + + + + + + + + + + + + + + + + + +const { Fail, quote: q}= assert; + +// `link` creates `ModuleInstances` and `ModuleNamespaces` for a module and its +// transitive dependencies and connects their imports and exports. +// After linking, the resulting working set is ready to be executed. +// The linker only concerns itself with module namespaces that are objects with +// property descriptors for their exports, which the Compartment proxies with +// the actual `ModuleNamespace`. +const link= ( + compartmentPrivateFields, + moduleAliases, + compartment, + moduleSpecifier)=> + { + const { name: compartmentName, moduleRecords}= weakmapGet( + compartmentPrivateFields, + compartment); + + + const moduleRecord= mapGet(moduleRecords, moduleSpecifier); + if( moduleRecord=== undefined) { + throw ReferenceError( + `Missing link to module ${q(moduleSpecifier)} from compartment ${q( + compartmentName) + }`); + + } + + // Mutual recursion so there's no confusion about which + // compartment is in context: the module record may be in another + // compartment, denoted by moduleRecord.compartment. + // eslint-disable-next-line no-use-before-define + return instantiate(compartmentPrivateFields, moduleAliases, moduleRecord); + };$h‍_once.link(link); + +function isPrecompiled(staticModuleRecord) { + return typeof staticModuleRecord.__syncModuleProgram__=== 'string'; + } + +function validatePrecompiledStaticModuleRecord( + staticModuleRecord, + moduleSpecifier) + { + const { __fixedExportMap__, __liveExportMap__}= staticModuleRecord; + isObject(__fixedExportMap__)|| + Fail `Property '__fixedExportMap__' of a precompiled module record must be an object, got ${q( + __fixedExportMap__) + }, for module ${q(moduleSpecifier)}`; + isObject(__liveExportMap__)|| + Fail `Property '__liveExportMap__' of a precompiled module record must be an object, got ${q( + __liveExportMap__) + }, for module ${q(moduleSpecifier)}`; + } + +function isThirdParty(staticModuleRecord) { + return typeof staticModuleRecord.execute=== 'function'; + } + +function validateThirdPartyStaticModuleRecord( + staticModuleRecord, + moduleSpecifier) + { + const { exports}= staticModuleRecord; + isArray(exports)|| + Fail `Property 'exports' of a third-party static module record must be an array, got ${q( + exports) + }, for module ${q(moduleSpecifier)}`; + } + +function validateStaticModuleRecord(staticModuleRecord, moduleSpecifier) { + isObject(staticModuleRecord)|| + Fail `Static module records must be of type object, got ${q( + staticModuleRecord) + }, for module ${q(moduleSpecifier)}`; + const { imports, exports, reexports= []}= staticModuleRecord; + isArray(imports)|| + Fail `Property 'imports' of a static module record must be an array, got ${q( + imports) + }, for module ${q(moduleSpecifier)}`; + isArray(exports)|| + Fail `Property 'exports' of a precompiled module record must be an array, got ${q( + exports) + }, for module ${q(moduleSpecifier)}`; + isArray(reexports)|| + Fail `Property 'reexports' of a precompiled module record must be an array if present, got ${q( + reexports) + }, for module ${q(moduleSpecifier)}`; + } + +const instantiate= ( + compartmentPrivateFields, + moduleAliases, + moduleRecord)=> + { + const { compartment, moduleSpecifier, resolvedImports, staticModuleRecord}= + moduleRecord; + const { instances}= weakmapGet(compartmentPrivateFields, compartment); + + // Memoize. + if( mapHas(instances, moduleSpecifier)) { + return mapGet(instances, moduleSpecifier); + } + + validateStaticModuleRecord(staticModuleRecord, moduleSpecifier); + + const importedInstances= new Map(); + let moduleInstance; + if( isPrecompiled(staticModuleRecord)) { + validatePrecompiledStaticModuleRecord(staticModuleRecord, moduleSpecifier); + moduleInstance= makeModuleInstance( + compartmentPrivateFields, + moduleAliases, + moduleRecord, + importedInstances); + + }else if( isThirdParty(staticModuleRecord)) { + validateThirdPartyStaticModuleRecord(staticModuleRecord, moduleSpecifier); + moduleInstance= makeThirdPartyModuleInstance( + compartmentPrivateFields, + staticModuleRecord, + compartment, + moduleAliases, + moduleSpecifier, + resolvedImports); + + }else { + throw TypeError( + `importHook must return a static module record, got ${q( + staticModuleRecord) + }`); + + } + + // Memoize. + mapSet(instances, moduleSpecifier, moduleInstance); + + // Link dependency modules. + for( const [importSpecifier, resolvedSpecifier]of entries(resolvedImports)) { + const importedInstance= link( + compartmentPrivateFields, + moduleAliases, + compartment, + resolvedSpecifier); + + mapSet(importedInstances, importSpecifier, importedInstance); + } + + return moduleInstance; + };$h‍_once.instantiate(instantiate); +})() +, +// === functors[43] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Map,ReferenceError,TypeError,WeakMap,assign,defineProperties,entries,promiseThen,weakmapGet,weakmapSet,setGlobalObjectSymbolUnscopables,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,setGlobalObjectEvaluators,sharedGlobalPropertyNames,load,link,getDeferredExports,assert,compartmentEvaluate,makeSafeEvaluator;$h‍_imports([["./commons.js", [["Map", [$h‍_a => (Map = $h‍_a)]],["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["assign", [$h‍_a => (assign = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["promiseThen", [$h‍_a => (promiseThen = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]]]],["./global-object.js", [["setGlobalObjectSymbolUnscopables", [$h‍_a => (setGlobalObjectSymbolUnscopables = $h‍_a)]],["setGlobalObjectConstantProperties", [$h‍_a => (setGlobalObjectConstantProperties = $h‍_a)]],["setGlobalObjectMutableProperties", [$h‍_a => (setGlobalObjectMutableProperties = $h‍_a)]],["setGlobalObjectEvaluators", [$h‍_a => (setGlobalObjectEvaluators = $h‍_a)]]]],["./permits.js", [["sharedGlobalPropertyNames", [$h‍_a => (sharedGlobalPropertyNames = $h‍_a)]]]],["./module-load.js", [["load", [$h‍_a => (load = $h‍_a)]]]],["./module-link.js", [["link", [$h‍_a => (link = $h‍_a)]]]],["./module-proxy.js", [["getDeferredExports", [$h‍_a => (getDeferredExports = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate", [$h‍_a => (compartmentEvaluate = $h‍_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator", [$h‍_a => (makeSafeEvaluator = $h‍_a)]]]]]); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +const { quote: q}= assert; + +// moduleAliases associates every public module exports namespace with its +// corresponding compartment and specifier so they can be used to link modules +// across compartments. +// The mechanism to thread an alias is to use the compartment.module function +// to obtain the exports namespace of a foreign module and pass it into another +// compartment's moduleMap constructor option. +const moduleAliases= new WeakMap(); + +// privateFields captures the private state for each compartment. +const privateFields= new WeakMap(); + +// Compartments do not need an importHook or resolveHook to be useful +// as a vessel for evaluating programs. +// However, any method that operates the module system will throw an exception +// if these hooks are not available. +const assertModuleHooks= (compartment)=>{ + const { importHook, resolveHook}= weakmapGet(privateFields, compartment); + if( typeof importHook!== 'function'|| typeof resolveHook!== 'function') { + throw TypeError( + 'Compartment must be constructed with an importHook and a resolveHook for it to be able to load modules'); + + } + }; + +const InertCompartment= function Compartment( + _endowments= {}, + _modules= {}, + _options= {}) + { + throw TypeError( + 'Compartment.prototype.constructor is not a valid constructor.'); + + }; + +/** + * @param {Compartment} compartment + * @param {string} specifier + */$h‍_once.InertCompartment(InertCompartment); +const compartmentImportNow= (compartment, specifier)=> { + const { execute, exportsProxy}= link( + privateFields, + moduleAliases, + compartment, + specifier); + + execute(); + return exportsProxy; + }; + +const CompartmentPrototype= { + constructor: InertCompartment, + + get globalThis() { + return weakmapGet(privateFields, this).globalObject; + }, + + get name() { + return weakmapGet(privateFields, this).name; + }, + + /** + * @param {string} source is a JavaScript program grammar construction. + * @param {object} [options] + * @param {Array} [options.transforms] + * @param {boolean} [options.sloppyGlobalsMode] + * @param {object} [options.__moduleShimLexicals__] + * @param {boolean} [options.__evadeHtmlCommentTest__] + * @param {boolean} [options.__evadeImportExpressionTest__] + * @param {boolean} [options.__rejectSomeDirectEvalExpressions__] + */ + evaluate(source, options= {}) { + const compartmentFields= weakmapGet(privateFields, this); + return compartmentEvaluate(compartmentFields, source, options); + }, + + toString() { + return '[object Compartment]'; + }, + + module(specifier) { + if( typeof specifier!== 'string') { + throw TypeError('first argument of module() must be a string'); + } + + assertModuleHooks(this); + + const { exportsProxy}= getDeferredExports( + this, + weakmapGet(privateFields, this), + moduleAliases, + specifier); + + + return exportsProxy; + }, + + async import(specifier){ + if( typeof specifier!== 'string') { + throw TypeError('first argument of import() must be a string'); + } + + assertModuleHooks(this); + + return promiseThen( + load(privateFields, moduleAliases, this, specifier), + ()=> { + // The namespace box is a contentious design and likely to be a breaking + // change in an appropriately numbered future version. + const namespace= compartmentImportNow( + /** @type {Compartment} */ this, + specifier); + + return { namespace}; + }); + + }, + + async load(specifier){ + if( typeof specifier!== 'string') { + throw TypeError('first argument of load() must be a string'); + } + + assertModuleHooks(this); + + return load(privateFields, moduleAliases, this, specifier); + }, + + importNow(specifier) { + if( typeof specifier!== 'string') { + throw TypeError('first argument of importNow() must be a string'); + } + + assertModuleHooks(this); + + return compartmentImportNow(/** @type {Compartment} */ this, specifier); + }};$h‍_once.CompartmentPrototype(CompartmentPrototype); + + +defineProperties(InertCompartment, { + prototype: { value: CompartmentPrototype}}); + + +/** + * @callback MakeCompartmentConstructor + * @param {MakeCompartmentConstructor} targetMakeCompartmentConstructor + * @param {Record} intrinsics + * @param {(object: object) => void} markVirtualizedNativeFunction + * @returns {Compartment['constructor']} + */ + +/** @type {MakeCompartmentConstructor} */ +const makeCompartmentConstructor= ( + targetMakeCompartmentConstructor, + intrinsics, + markVirtualizedNativeFunction)=> + { + function Compartment(endowments= {}, moduleMap= {}, options= {}) { + if( new.target=== undefined) { + throw TypeError( + "Class constructor Compartment cannot be invoked without 'new'"); + + } + + // Extract options, and shallow-clone transforms. + const { + name= '', + transforms= [], + __shimTransforms__= [], + resolveHook, + importHook, + moduleMapHook, + importMetaHook}= + options; + const globalTransforms= [...transforms, ...__shimTransforms__]; + + // Map + const moduleRecords= new Map(); + // Map + const instances= new Map(); + // Map + const deferredExports= new Map(); + + // Validate given moduleMap. + // The module map gets translated on-demand in module-load.js and the + // moduleMap can be invalid in ways that cannot be detected in the + // constructor, but these checks allow us to throw early for a better + // developer experience. + for( const [specifier, aliasNamespace]of entries(moduleMap|| {})) { + if( typeof aliasNamespace=== 'string') { + // TODO implement parent module record retrieval. + throw TypeError( + `Cannot map module ${q(specifier)} to ${q( + aliasNamespace) + } in parent compartment`); + + }else if( weakmapGet(moduleAliases, aliasNamespace)=== undefined) { + // TODO create and link a synthetic module instance from the given + // namespace object. + throw ReferenceError( + `Cannot map module ${q( + specifier) + } because it has no known compartment in this realm`); + + } + } + + const globalObject= {}; + + setGlobalObjectSymbolUnscopables(globalObject); + + // We must initialize all constant properties first because + // `makeSafeEvaluator` may use them to create optimized bindings + // in the evaluator. + // TODO: consider merging into a single initialization if internal + // evaluator is no longer eagerly created + setGlobalObjectConstantProperties(globalObject); + + const { safeEvaluate}= makeSafeEvaluator({ + globalObject, + globalTransforms, + sloppyGlobalsMode: false}); + + + setGlobalObjectMutableProperties(globalObject, { + intrinsics, + newGlobalPropertyNames: sharedGlobalPropertyNames, + makeCompartmentConstructor: targetMakeCompartmentConstructor, + markVirtualizedNativeFunction}); + + + // TODO: maybe add evalTaming to the Compartment constructor 3rd options? + setGlobalObjectEvaluators( + globalObject, + safeEvaluate, + markVirtualizedNativeFunction); + + + assign(globalObject, endowments); + + weakmapSet(privateFields, this, { + name: `${name}`, + globalTransforms, + globalObject, + safeEvaluate, + resolveHook, + importHook, + moduleMap, + moduleMapHook, + importMetaHook, + moduleRecords, + __shimTransforms__, + deferredExports, + instances}); + + } + + Compartment.prototype= CompartmentPrototype; + + return Compartment; + };$h‍_once.makeCompartmentConstructor(makeCompartmentConstructor); +})() +, +// === functors[44] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_FUNCTION,Float32Array,Map,Set,String,getOwnPropertyDescriptor,getPrototypeOf,iterateArray,iterateMap,iterateSet,iterateString,matchAllRegExp,matchAllSymbol,regexpPrototype,globalThis,InertCompartment;$h‍_imports([["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["Float32Array", [$h‍_a => (Float32Array = $h‍_a)]],["Map", [$h‍_a => (Map = $h‍_a)]],["Set", [$h‍_a => (Set = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["iterateArray", [$h‍_a => (iterateArray = $h‍_a)]],["iterateMap", [$h‍_a => (iterateMap = $h‍_a)]],["iterateSet", [$h‍_a => (iterateSet = $h‍_a)]],["iterateString", [$h‍_a => (iterateString = $h‍_a)]],["matchAllRegExp", [$h‍_a => (matchAllRegExp = $h‍_a)]],["matchAllSymbol", [$h‍_a => (matchAllSymbol = $h‍_a)]],["regexpPrototype", [$h‍_a => (regexpPrototype = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./compartment.js", [["InertCompartment", [$h‍_a => (InertCompartment = $h‍_a)]]]]]); + + + + + + + + + + + + + + + + + + +/** + * Object.getConstructorOf() + * Helper function to improve readability, similar to Object.getPrototypeOf(). + * + * @param {object} obj + */ +function getConstructorOf(obj) { + return getPrototypeOf(obj).constructor; + } + +// getAnonymousIntrinsics uses a utility function to construct an arguments +// object, since it cannot have one of its own and also be a const export. +function makeArguments() { + // eslint-disable-next-line prefer-rest-params + return arguments; + } + +/** + * getAnonymousIntrinsics() + * Get the intrinsics not otherwise reachable by named own property + * traversal from the global object. + * + * @returns {object} + */ +const getAnonymousIntrinsics= ()=> { + const InertFunction= FERAL_FUNCTION.prototype.constructor; + + // 9.2.4.1 %ThrowTypeError% + + const argsCalleeDesc= getOwnPropertyDescriptor(makeArguments(), 'callee'); + const ThrowTypeError= argsCalleeDesc&& argsCalleeDesc.get; + + // 21.1.5.2 The %StringIteratorPrototype% Object + + // eslint-disable-next-line no-new-wrappers + const StringIteratorObject= iterateString(new String()); + const StringIteratorPrototype= getPrototypeOf(StringIteratorObject); + + // 21.2.7.1 The %RegExpStringIteratorPrototype% Object + const RegExpStringIterator= + regexpPrototype[matchAllSymbol]&& matchAllRegExp(/./); + const RegExpStringIteratorPrototype= + RegExpStringIterator&& getPrototypeOf(RegExpStringIterator); + + // 22.1.5.2 The %ArrayIteratorPrototype% Object + + // eslint-disable-next-line no-array-constructor + const ArrayIteratorObject= iterateArray([]); + const ArrayIteratorPrototype= getPrototypeOf(ArrayIteratorObject); + + // 22.2.1 The %TypedArray% Intrinsic Object + + const TypedArray= getPrototypeOf(Float32Array); + + // 23.1.5.2 The %MapIteratorPrototype% Object + + const MapIteratorObject= iterateMap(new Map()); + const MapIteratorPrototype= getPrototypeOf(MapIteratorObject); + + // 23.2.5.2 The %SetIteratorPrototype% Object + + const SetIteratorObject= iterateSet(new Set()); + const SetIteratorPrototype= getPrototypeOf(SetIteratorObject); + + // 25.1.2 The %IteratorPrototype% Object + + const IteratorPrototype= getPrototypeOf(ArrayIteratorPrototype); + + // 25.2.1 The GeneratorFunction Constructor + + // eslint-disable-next-line no-empty-function + function* GeneratorFunctionInstance() { } + const GeneratorFunction= getConstructorOf(GeneratorFunctionInstance); + + // 25.2.3 Properties of the GeneratorFunction Prototype Object + + const Generator= GeneratorFunction.prototype; + + // 25.3.1 The AsyncGeneratorFunction Constructor + + // eslint-disable-next-line no-empty-function + async function* AsyncGeneratorFunctionInstance() { } + const AsyncGeneratorFunction= getConstructorOf( + AsyncGeneratorFunctionInstance); + + + // 25.3.2.2 AsyncGeneratorFunction.prototype + const AsyncGenerator= AsyncGeneratorFunction.prototype; + // 25.5.1 Properties of the AsyncGenerator Prototype Object + const AsyncGeneratorPrototype= AsyncGenerator.prototype; + const AsyncIteratorPrototype= getPrototypeOf(AsyncGeneratorPrototype); + + // 25.7.1 The AsyncFunction Constructor + + // eslint-disable-next-line no-empty-function + async function AsyncFunctionInstance() { } + const AsyncFunction= getConstructorOf(AsyncFunctionInstance); + + const intrinsics= { + '%InertFunction%': InertFunction, + '%ArrayIteratorPrototype%': ArrayIteratorPrototype, + '%InertAsyncFunction%': AsyncFunction, + '%AsyncGenerator%': AsyncGenerator, + '%InertAsyncGeneratorFunction%': AsyncGeneratorFunction, + '%AsyncGeneratorPrototype%': AsyncGeneratorPrototype, + '%AsyncIteratorPrototype%': AsyncIteratorPrototype, + '%Generator%': Generator, + '%InertGeneratorFunction%': GeneratorFunction, + '%IteratorPrototype%': IteratorPrototype, + '%MapIteratorPrototype%': MapIteratorPrototype, + '%RegExpStringIteratorPrototype%': RegExpStringIteratorPrototype, + '%SetIteratorPrototype%': SetIteratorPrototype, + '%StringIteratorPrototype%': StringIteratorPrototype, + '%ThrowTypeError%': ThrowTypeError, + '%TypedArray%': TypedArray, + '%InertCompartment%': InertCompartment}; + + + if( globalThis.Iterator) { + intrinsics['%IteratorHelperPrototype%']= getPrototypeOf( + // eslint-disable-next-line @endo/no-polymorphic-call + globalThis.Iterator.from([]).take(0)); + + intrinsics['%WrapForValidIteratorPrototype%']= getPrototypeOf( + // eslint-disable-next-line @endo/no-polymorphic-call + globalThis.Iterator.from({ next() { }})); + + } + + if( globalThis.AsyncIterator) { + intrinsics['%AsyncIteratorHelperPrototype%']= getPrototypeOf( + // eslint-disable-next-line @endo/no-polymorphic-call + globalThis.AsyncIterator.from([]).take(0)); + + intrinsics['%WrapForValidAsyncIteratorPrototype%']= getPrototypeOf( + // eslint-disable-next-line @endo/no-polymorphic-call + globalThis.AsyncIterator.from({ next() { }})); + + } + + return intrinsics; + };$h‍_once.getAnonymousIntrinsics(getAnonymousIntrinsics); +})() +, +// === functors[45] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let TypeError,freeze;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]]]); + + +const tameHarden= (safeHarden, hardenTaming)=> { + if( hardenTaming!== 'safe'&& hardenTaming!== 'unsafe') { + throw TypeError( `unrecognized fakeHardenOption ${hardenTaming}`); + } + + if( hardenTaming=== 'safe') { + return safeHarden; + } + + // In on the joke + Object.isExtensible= ()=> false; + Object.isFrozen= ()=> true; + Object.isSealed= ()=> true; + Reflect.isExtensible= ()=> false; + + if( safeHarden.isFake) { + // The "safe" hardener is already a fake hardener. + // Just use it. + return safeHarden; + } + + const fakeHarden= (arg)=>arg; + fakeHarden.isFake= true; + return freeze(fakeHarden); + };$h‍_once.tameHarden(tameHarden); +freeze(tameHarden); +})() +, +// === functors[46] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Symbol,entries,fromEntries,getOwnPropertyDescriptors,defineProperties,arrayMap;$h‍_imports([["./commons.js", [["Symbol", [$h‍_a => (Symbol = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["fromEntries", [$h‍_a => (fromEntries = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]]]]]); + + + + + + + + +/** + * This taming provides a tamed alternative to the original `Symbol` constructor + * that starts off identical, except that all its properties are "temporarily" + * configurable. The original `Symbol` constructor remains unmodified on + * the start compartment's global. The tamed alternative is used as the shared + * `Symbol` constructor on constructed compartments. + * + * Starting these properties as configurable assumes two succeeding phases of + * processing: A whitelisting phase, that + * removes all properties not on the whitelist (which requires them to be + * configurable) and a global hardening step that freezes all primordials, + * returning these properties to their expected non-configurable status. + * + * The ses shim is constructed to eventually enable vetted shims to run between + * repair and global hardening. However, such vetted shims would normally + * run in the start compartment, which continues to use the original unmodified + * `Symbol`, so they should not normally be affected by the temporary + * configurability of these properties. + * + * Note that the spec refers to the global `Symbol` function as the + * ["Symbol Constructor"](https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-symbol-constructor) + * even though it has a call behavior (can be called as a function) and does not + * not have a construct behavior (cannot be called with `new`). Accordingly, + * to tame it, we must replace it with a function without a construct + * behavior. + */ +const tameSymbolConstructor= ()=> { + const OriginalSymbol= Symbol; + const SymbolPrototype= OriginalSymbol.prototype; + + const SharedSymbol= { + Symbol(description) { + return OriginalSymbol(description); + }}. + Symbol; + + defineProperties(SymbolPrototype, { + constructor: { + value: SharedSymbol + // leave other `constructor` attributes as is +}}); + + + const originalDescsEntries= entries( + getOwnPropertyDescriptors(OriginalSymbol)); + + const descs= fromEntries( + arrayMap(originalDescsEntries, ([name, desc])=> [ + name, + { ...desc, configurable: true}])); + + + defineProperties(SharedSymbol, descs); + + return { '%SharedSymbol%': SharedSymbol}; + };$h‍_once.tameSymbolConstructor(tameSymbolConstructor); +})() +, +// === functors[47] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let makeEnvironmentCaptor,FERAL_FUNCTION,FERAL_EVAL,TypeError,arrayFilter,globalThis,is,ownKeys,stringSplit,noEvalEvaluate,getOwnPropertyNames,makeHardener,makeIntrinsicsCollector,whitelistIntrinsics,tameFunctionConstructors,tameDateConstructor,tameMathObject,tameRegExpConstructor,enablePropertyOverrides,tameLocaleMethods,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,setGlobalObjectEvaluators,makeSafeEvaluator,initialGlobalPropertyNames,tameFunctionToString,tameDomains,tameConsole,tameErrorConstructor,assert,makeAssert,getAnonymousIntrinsics,makeCompartmentConstructor,tameHarden,tameSymbolConstructor;$h‍_imports([["@endo/env-options", [["makeEnvironmentCaptor", [$h‍_a => (makeEnvironmentCaptor = $h‍_a)]]]],["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["FERAL_EVAL", [$h‍_a => (FERAL_EVAL = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["stringSplit", [$h‍_a => (stringSplit = $h‍_a)]],["noEvalEvaluate", [$h‍_a => (noEvalEvaluate = $h‍_a)]],["getOwnPropertyNames", [$h‍_a => (getOwnPropertyNames = $h‍_a)]]]],["./make-hardener.js", [["makeHardener", [$h‍_a => (makeHardener = $h‍_a)]]]],["./intrinsics.js", [["makeIntrinsicsCollector", [$h‍_a => (makeIntrinsicsCollector = $h‍_a)]]]],["./permits-intrinsics.js", [["default", [$h‍_a => (whitelistIntrinsics = $h‍_a)]]]],["./tame-function-constructors.js", [["default", [$h‍_a => (tameFunctionConstructors = $h‍_a)]]]],["./tame-date-constructor.js", [["default", [$h‍_a => (tameDateConstructor = $h‍_a)]]]],["./tame-math-object.js", [["default", [$h‍_a => (tameMathObject = $h‍_a)]]]],["./tame-regexp-constructor.js", [["default", [$h‍_a => (tameRegExpConstructor = $h‍_a)]]]],["./enable-property-overrides.js", [["default", [$h‍_a => (enablePropertyOverrides = $h‍_a)]]]],["./tame-locale-methods.js", [["default", [$h‍_a => (tameLocaleMethods = $h‍_a)]]]],["./global-object.js", [["setGlobalObjectConstantProperties", [$h‍_a => (setGlobalObjectConstantProperties = $h‍_a)]],["setGlobalObjectMutableProperties", [$h‍_a => (setGlobalObjectMutableProperties = $h‍_a)]],["setGlobalObjectEvaluators", [$h‍_a => (setGlobalObjectEvaluators = $h‍_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator", [$h‍_a => (makeSafeEvaluator = $h‍_a)]]]],["./permits.js", [["initialGlobalPropertyNames", [$h‍_a => (initialGlobalPropertyNames = $h‍_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString", [$h‍_a => (tameFunctionToString = $h‍_a)]]]],["./tame-domains.js", [["tameDomains", [$h‍_a => (tameDomains = $h‍_a)]]]],["./error/tame-console.js", [["tameConsole", [$h‍_a => (tameConsole = $h‍_a)]]]],["./error/tame-error-constructor.js", [["default", [$h‍_a => (tameErrorConstructor = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]],["makeAssert", [$h‍_a => (makeAssert = $h‍_a)]]]],["./get-anonymous-intrinsics.js", [["getAnonymousIntrinsics", [$h‍_a => (getAnonymousIntrinsics = $h‍_a)]]]],["./compartment.js", [["makeCompartmentConstructor", [$h‍_a => (makeCompartmentConstructor = $h‍_a)]]]],["./tame-harden.js", [["tameHarden", [$h‍_a => (tameHarden = $h‍_a)]]]],["./tame-symbol-constructor.js", [["tameSymbolConstructor", [$h‍_a => (tameSymbolConstructor = $h‍_a)]]]]]); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** @typedef {import('../types.js').LockdownOptions} LockdownOptions */ + +const { Fail, details: d, quote: q}= assert; + +/** @type {Error=} */ +let priorRepairIntrinsics; + +/** @type {Error=} */ +let priorHardenIntrinsics; + +// Build a harden() with an empty fringe. +// Gate it on lockdown. +/** + * @template T + * @param {T} ref + * @returns {T} + */ +const safeHarden= makeHardener(); + +/** + * @callback Transform + * @param {string} source + * @returns {string} + */ + +/** + * @callback CompartmentConstructor + * @param {object} endowments + * @param {object} moduleMap + * @param {object} [options] + * @param {Array} [options.transforms] + * @param {Array} [options.__shimTransforms__] + */ + +// TODO https://github.com/endojs/endo/issues/814 +// Lockdown currently allows multiple calls provided that the specified options +// of every call agree. With experience, we have observed that lockdown should +// only ever need to be called once and that simplifying lockdown will improve +// the quality of audits. + +const assertDirectEvalAvailable= ()=> { + let allowed= false; + try { + allowed= FERAL_FUNCTION( + 'eval', + 'SES_changed', + `\ + eval("SES_changed = true"); + return SES_changed; + `)( + FERAL_EVAL, false); + // If we get here and SES_changed stayed false, that means the eval was sloppy + // and indirect, which generally creates a new global. + // We are going to throw an exception for failing to initialize SES, but + // good neighbors clean up. + if( !allowed) { + delete globalThis.SES_changed; + } + }catch( _error) { + // We reach here if eval is outright forbidden by a Content Security Policy. + // We allow this for SES usage that delegates the responsibility to isolate + // guest code to production code generation. + allowed= true; + } + if( !allowed) { + // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_DIRECT_EVAL.md + throw TypeError( + `SES cannot initialize unless 'eval' is the original intrinsic 'eval', suitable for direct-eval (dynamically scoped eval) (SES_DIRECT_EVAL)`); + + } + }; + +/** + * @param {LockdownOptions} [options] + */ +const repairIntrinsics= (options= {})=> { + // First time, absent options default to 'safe'. + // Subsequent times, absent options default to first options. + // Thus, all present options must agree with first options. + // Reconstructing `option` here also ensures that it is a well + // behaved record, with only own data properties. + // + // The `overrideTaming` is not a safety issue. Rather it is a tradeoff + // between code compatibility, which is better with the `'moderate'` + // setting, and tool compatibility, which is better with the `'min'` + // setting. See + // https://github.com/Agoric/SES-shim/blob/master/packages/ses/README.md#enabling-override-by-assignment) + // for an explanation of when to use which. + // + // The `stackFiltering` is not a safety issue. Rather it is a tradeoff + // between relevance and completeness of the stack frames shown on the + // console. Setting`stackFiltering` to `'verbose'` applies no filters, providing + // the raw stack frames that can be quite versbose. Setting + // `stackFrameFiltering` to`'concise'` limits the display to the stack frame + // information most likely to be relevant, eliminating distracting frames + // such as those from the infrastructure. However, the bug you're trying to + // track down might be in the infrastrure, in which case the `'verbose'` setting + // is useful. See + // [`stackFiltering` options](https://github.com/Agoric/SES-shim/blob/master/packages/ses/docs/lockdown.md#stackfiltering-options) + // for an explanation. + + const { getEnvironmentOption: getenv}= makeEnvironmentCaptor(globalThis); + + const { + errorTaming= getenv('LOCKDOWN_ERROR_TAMING', 'safe'), + errorTrapping= /** @type {"platform" | "none" | "report" | "abort" | "exit" | undefined} */ + getenv('LOCKDOWN_ERROR_TRAPPING', 'platform'), + + unhandledRejectionTrapping= /** @type {"none" | "report" | undefined} */ + getenv('LOCKDOWN_UNHANDLED_REJECTION_TRAPPING', 'report'), + + regExpTaming= getenv('LOCKDOWN_REGEXP_TAMING', 'safe'), + localeTaming= getenv('LOCKDOWN_LOCALE_TAMING', 'safe'), + + consoleTaming= /** @type {'unsafe' | 'safe' | undefined} */ + getenv('LOCKDOWN_CONSOLE_TAMING', 'safe'), + + overrideTaming= getenv('LOCKDOWN_OVERRIDE_TAMING', 'moderate'), + stackFiltering= getenv('LOCKDOWN_STACK_FILTERING', 'concise'), + domainTaming= getenv('LOCKDOWN_DOMAIN_TAMING', 'safe'), + evalTaming= getenv('LOCKDOWN_EVAL_TAMING', 'safeEval'), + overrideDebug= arrayFilter( + stringSplit(getenv('LOCKDOWN_OVERRIDE_DEBUG', ''), ','), + /** @param {string} debugName */ + (debugName)=>debugName!== ''), + + __hardenTaming__= getenv('LOCKDOWN_HARDEN_TAMING', 'safe'), + dateTaming= 'safe', // deprecated + mathTaming= 'safe', // deprecated + ...extraOptions}= + options; + + evalTaming=== 'unsafeEval'|| + evalTaming=== 'safeEval'|| + evalTaming=== 'noEval'|| + Fail `lockdown(): non supported option evalTaming: ${q(evalTaming)}`; + + // Assert that only supported options were passed. + // Use Reflect.ownKeys to reject symbol-named properties as well. + const extraOptionsNames= ownKeys(extraOptions); + extraOptionsNames.length=== 0|| + Fail `lockdown(): non supported option ${q(extraOptionsNames)}`; + + priorRepairIntrinsics=== undefined|| + // eslint-disable-next-line @endo/no-polymorphic-call + assert.fail( + d `Already locked down at ${priorRepairIntrinsics} (SES_ALREADY_LOCKED_DOWN)`, + TypeError); + + // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_ALREADY_LOCKED_DOWN.md + priorRepairIntrinsics= TypeError('Prior lockdown (SES_ALREADY_LOCKED_DOWN)'); + // Tease V8 to generate the stack string and release the closures the stack + // trace retained: + priorRepairIntrinsics.stack; + + assertDirectEvalAvailable(); + + /** + * Because of packagers and bundlers, etc, multiple invocations of lockdown + * might happen in separate instantiations of the source of this module. + * In that case, each one sees its own `firstOptions` variable, so the test + * above will not detect that lockdown has already happened. We + * unreliably test some telltale signs that lockdown has run, to avoid + * trying to lock down a locked down environment. Although the test is + * unreliable, this is consistent with the SES threat model. SES provides + * security only if it runs first in a given realm, or if everything that + * runs before it is SES-aware and cooperative. Neither SES nor anything + * can protect itself from corrupting code that runs first. For these + * purposes, code that turns a realm into something that passes these + * tests without actually locking down counts as corrupting code. + * + * The specifics of what this tests for may change over time, but it + * should be consistent with any setting of the lockdown options. + */ + const seemsToBeLockedDown= ()=> { + return( + globalThis.Function.prototype.constructor!== globalThis.Function&& + // @ts-ignore harden is absent on globalThis type def. + typeof globalThis.harden=== 'function'&& + // @ts-ignore lockdown is absent on globalThis type def. + typeof globalThis.lockdown=== 'function'&& + globalThis.Date.prototype.constructor!== globalThis.Date&& + typeof globalThis.Date.now=== 'function'&& + // @ts-ignore does not recognize that Date constructor is a special + // Function. + // eslint-disable-next-line @endo/no-polymorphic-call + is(globalThis.Date.prototype.constructor.now(), NaN)); + + }; + + if( seemsToBeLockedDown()) { + // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_MULTIPLE_INSTANCES.md + throw TypeError( + `Already locked down but not by this SES instance (SES_MULTIPLE_INSTANCES)`); + + } + + /** + * 1. TAME powers & gather intrinsics first. + */ + + tameDomains(domainTaming); + + // Replace Function.prototype.toString with one that recognizes + // shimmed functions as honorary native functions. + const markVirtualizedNativeFunction= tameFunctionToString(); + + const { addIntrinsics, completePrototypes, finalIntrinsics}= + makeIntrinsicsCollector(); + + const tamedHarden= tameHarden(safeHarden, __hardenTaming__); + addIntrinsics({ harden: tamedHarden}); + + addIntrinsics(tameFunctionConstructors()); + + addIntrinsics(tameDateConstructor(dateTaming)); + addIntrinsics(tameErrorConstructor(errorTaming, stackFiltering)); + addIntrinsics(tameMathObject(mathTaming)); + addIntrinsics(tameRegExpConstructor(regExpTaming)); + addIntrinsics(tameSymbolConstructor()); + + addIntrinsics(getAnonymousIntrinsics()); + + completePrototypes(); + + const intrinsics= finalIntrinsics(); + + /** + * Wrap console unless suppressed. + * At the moment, the console is considered a host power in the start + * compartment, and not a primordial. Hence it is absent from the whilelist + * and bypasses the intrinsicsCollector. + * + * @type {((error: any) => string | undefined) | undefined} + */ + let optGetStackString; + if( errorTaming!== 'unsafe') { + optGetStackString= intrinsics['%InitialGetStackString%']; + } + const consoleRecord= tameConsole( + consoleTaming, + errorTrapping, + unhandledRejectionTrapping, + optGetStackString); + + globalThis.console= /** @type {Console} */ consoleRecord.console; + + // @ts-ignore assert is absent on globalThis type def. + if( errorTaming=== 'unsafe'&& globalThis.assert=== assert) { + // If errorTaming is 'unsafe' we replace the global assert with + // one whose `details` template literal tag does not redact + // unmarked substitution values. IOW, it blabs information that + // was supposed to be secret from callers, as an aid to debugging + // at a further cost in safety. + // @ts-ignore assert is absent on globalThis type def. + globalThis.assert= makeAssert(undefined, true); + } + + // Replace *Locale* methods with their non-locale equivalents + tameLocaleMethods(intrinsics, localeTaming); + + /** + * 2. WHITELIST to standardize the environment. + */ + + // Remove non-standard properties. + // All remaining function encountered during whitelisting are + // branded as honorary native functions. + whitelistIntrinsics(intrinsics, markVirtualizedNativeFunction); + + // Initialize the powerful initial global, i.e., the global of the + // start compartment, from the intrinsics. + + setGlobalObjectConstantProperties(globalThis); + + setGlobalObjectMutableProperties(globalThis, { + intrinsics, + newGlobalPropertyNames: initialGlobalPropertyNames, + makeCompartmentConstructor, + markVirtualizedNativeFunction}); + + + if( evalTaming=== 'noEval') { + setGlobalObjectEvaluators( + globalThis, + noEvalEvaluate, + markVirtualizedNativeFunction); + + }else if( evalTaming=== 'safeEval') { + const { safeEvaluate}= makeSafeEvaluator({ globalObject: globalThis}); + setGlobalObjectEvaluators( + globalThis, + safeEvaluate, + markVirtualizedNativeFunction); + + }else if( evalTaming=== 'unsafeEval') { + // Leave eval function and Function constructor of the initial compartment in-tact. + // Other compartments will not have access to these evaluators unless a guest program + // escapes containment. + } + + /** + * 3. HARDEN to share the intrinsics. + * + * We define hardenIntrinsics here so that options are in scope, but return + * it to the caller because we intend to eventually allow vetted shims to run + * between repairs and the hardening of intrinsics and so we can benchmark + * repair separately from hardening. + */ + + const hardenIntrinsics= ()=> { + priorHardenIntrinsics=== undefined|| + // eslint-disable-next-line @endo/no-polymorphic-call + assert.fail( + d `Already locked down at ${priorHardenIntrinsics} (SES_ALREADY_LOCKED_DOWN)`, + TypeError); + + // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_ALREADY_LOCKED_DOWN.md + priorHardenIntrinsics= TypeError( + 'Prior lockdown (SES_ALREADY_LOCKED_DOWN)'); + + // Tease V8 to generate the stack string and release the closures the stack + // trace retained: + priorHardenIntrinsics.stack; + + // Circumvent the override mistake. + // TODO consider moving this to the end of the repair phase, and + // therefore before vetted shims rather than afterwards. It is not + // clear yet which is better. + // @ts-ignore enablePropertyOverrides does its own input validation + enablePropertyOverrides(intrinsics, overrideTaming, overrideDebug); + + // Finally register and optionally freeze all the intrinsics. This + // must be the operation that modifies the intrinsics. + tamedHarden(intrinsics); + + // Harden evaluators + tamedHarden(globalThis.Function); + tamedHarden(globalThis.eval); + // @ts-ignore Compartment does exist on globalThis + tamedHarden(globalThis.Compartment); + + // Harden Symbol and properties for initialGlobalPropertyNames in the host realm + tamedHarden(globalThis.Symbol); + for( const prop of getOwnPropertyNames(initialGlobalPropertyNames)) { + tamedHarden(globalThis[prop]); + } + + return tamedHarden; + }; + + return hardenIntrinsics; + };$h‍_once.repairIntrinsics(repairIntrinsics); +})() +, +// === functors[48] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let globalThis,repairIntrinsics;$h‍_imports([["./assert-sloppy-mode.js", []],["./commons.js", [["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./lockdown.js", [["repairIntrinsics", [$h‍_a => (repairIntrinsics = $h‍_a)]]]]]); + + + + + + + + +/** + * @param {import('./lockdown.js').LockdownOptions} options + */ +globalThis.lockdown= (options)=>{ + const hardenIntrinsics= repairIntrinsics(options); + globalThis.harden= hardenIntrinsics(); + }; + +/** + * @param {import('./lockdown.js').LockdownOptions} options + */ +globalThis.repairIntrinsics= (options)=>{ + const hardenIntrinsics= repairIntrinsics(options); + // Reveal hardenIntrinsics after repairs. + globalThis.hardenIntrinsics= ()=> { + // Reveal harden after hardenIntrinsics. + // Harden is dangerous before hardenIntrinsics because hardening just + // about anything will inadvertently render intrinsics irreparable. + // Also, for modules that must work both before or after lockdown (code + // that is portable between JS and SES), the existence of harden in global + // scope signals whether such code should attempt to use harden in the + // defense of its own API. + // @ts-ignore harden not yet recognized on globalThis. + globalThis.harden= hardenIntrinsics(); + }; + }; +})() +, +// === functors[49] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let globalThis,makeCompartmentConstructor,tameFunctionToString,getGlobalIntrinsics;$h‍_imports([["./commons.js", [["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./compartment.js", [["makeCompartmentConstructor", [$h‍_a => (makeCompartmentConstructor = $h‍_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString", [$h‍_a => (tameFunctionToString = $h‍_a)]]]],["./intrinsics.js", [["getGlobalIntrinsics", [$h‍_a => (getGlobalIntrinsics = $h‍_a)]]]]]); + + + + + + +const markVirtualizedNativeFunction= tameFunctionToString(); + +// @ts-ignore Compartment is definitely on globalThis. +globalThis.Compartment= makeCompartmentConstructor( + makeCompartmentConstructor, + getGlobalIntrinsics(globalThis), + markVirtualizedNativeFunction); +})() +, +// === functors[50] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let globalThis,assert;$h‍_imports([["./commons.js", [["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); + + +globalThis.assert= assert; +})() +, +// === functors[51] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([["./src/lockdown-shim.js", []],["./src/compartment-shim.js", []],["./src/assert-shim.js", []]]); +})() +, +]; // functors end + + const cell = (name, value = undefined) => { + const observers = []; + return Object.freeze({ + get: Object.freeze(() => { + return value; + }), + set: Object.freeze((newValue) => { + value = newValue; + for (const observe of observers) { + observe(value); + } + }), + observe: Object.freeze((observe) => { + observers.push(observe); + observe(value); + }), + enumerable: true, + }); + }; + + const cells = [ + { + globalThis: cell("globalThis"), + Array: cell("Array"), + Date: cell("Date"), + FinalizationRegistry: cell("FinalizationRegistry"), + Float32Array: cell("Float32Array"), + JSON: cell("JSON"), + Map: cell("Map"), + Math: cell("Math"), + Number: cell("Number"), + Object: cell("Object"), + Promise: cell("Promise"), + Proxy: cell("Proxy"), + Reflect: cell("Reflect"), + FERAL_REG_EXP: cell("FERAL_REG_EXP"), + Set: cell("Set"), + String: cell("String"), + Symbol: cell("Symbol"), + WeakMap: cell("WeakMap"), + WeakSet: cell("WeakSet"), + FERAL_ERROR: cell("FERAL_ERROR"), + RangeError: cell("RangeError"), + ReferenceError: cell("ReferenceError"), + SyntaxError: cell("SyntaxError"), + TypeError: cell("TypeError"), + assign: cell("assign"), + create: cell("create"), + defineProperties: cell("defineProperties"), + entries: cell("entries"), + freeze: cell("freeze"), + getOwnPropertyDescriptor: cell("getOwnPropertyDescriptor"), + getOwnPropertyDescriptors: cell("getOwnPropertyDescriptors"), + getOwnPropertyNames: cell("getOwnPropertyNames"), + getPrototypeOf: cell("getPrototypeOf"), + is: cell("is"), + isFrozen: cell("isFrozen"), + isSealed: cell("isSealed"), + isExtensible: cell("isExtensible"), + keys: cell("keys"), + objectPrototype: cell("objectPrototype"), + seal: cell("seal"), + preventExtensions: cell("preventExtensions"), + setPrototypeOf: cell("setPrototypeOf"), + values: cell("values"), + fromEntries: cell("fromEntries"), + speciesSymbol: cell("speciesSymbol"), + toStringTagSymbol: cell("toStringTagSymbol"), + iteratorSymbol: cell("iteratorSymbol"), + matchAllSymbol: cell("matchAllSymbol"), + unscopablesSymbol: cell("unscopablesSymbol"), + symbolKeyFor: cell("symbolKeyFor"), + symbolFor: cell("symbolFor"), + isInteger: cell("isInteger"), + stringifyJson: cell("stringifyJson"), + defineProperty: cell("defineProperty"), + apply: cell("apply"), + construct: cell("construct"), + reflectGet: cell("reflectGet"), + reflectGetOwnPropertyDescriptor: cell("reflectGetOwnPropertyDescriptor"), + reflectHas: cell("reflectHas"), + reflectIsExtensible: cell("reflectIsExtensible"), + ownKeys: cell("ownKeys"), + reflectPreventExtensions: cell("reflectPreventExtensions"), + reflectSet: cell("reflectSet"), + isArray: cell("isArray"), + arrayPrototype: cell("arrayPrototype"), + mapPrototype: cell("mapPrototype"), + proxyRevocable: cell("proxyRevocable"), + regexpPrototype: cell("regexpPrototype"), + setPrototype: cell("setPrototype"), + stringPrototype: cell("stringPrototype"), + weakmapPrototype: cell("weakmapPrototype"), + weaksetPrototype: cell("weaksetPrototype"), + functionPrototype: cell("functionPrototype"), + promisePrototype: cell("promisePrototype"), + typedArrayPrototype: cell("typedArrayPrototype"), + uncurryThis: cell("uncurryThis"), + objectHasOwnProperty: cell("objectHasOwnProperty"), + arrayFilter: cell("arrayFilter"), + arrayForEach: cell("arrayForEach"), + arrayIncludes: cell("arrayIncludes"), + arrayJoin: cell("arrayJoin"), + arrayMap: cell("arrayMap"), + arrayPop: cell("arrayPop"), + arrayPush: cell("arrayPush"), + arraySlice: cell("arraySlice"), + arraySome: cell("arraySome"), + arraySort: cell("arraySort"), + iterateArray: cell("iterateArray"), + mapSet: cell("mapSet"), + mapGet: cell("mapGet"), + mapHas: cell("mapHas"), + mapDelete: cell("mapDelete"), + mapEntries: cell("mapEntries"), + iterateMap: cell("iterateMap"), + setAdd: cell("setAdd"), + setDelete: cell("setDelete"), + setForEach: cell("setForEach"), + setHas: cell("setHas"), + iterateSet: cell("iterateSet"), + regexpTest: cell("regexpTest"), + regexpExec: cell("regexpExec"), + matchAllRegExp: cell("matchAllRegExp"), + stringEndsWith: cell("stringEndsWith"), + stringIncludes: cell("stringIncludes"), + stringIndexOf: cell("stringIndexOf"), + stringMatch: cell("stringMatch"), + stringReplace: cell("stringReplace"), + stringSearch: cell("stringSearch"), + stringSlice: cell("stringSlice"), + stringSplit: cell("stringSplit"), + stringStartsWith: cell("stringStartsWith"), + iterateString: cell("iterateString"), + weakmapDelete: cell("weakmapDelete"), + weakmapGet: cell("weakmapGet"), + weakmapHas: cell("weakmapHas"), + weakmapSet: cell("weakmapSet"), + weaksetAdd: cell("weaksetAdd"), + weaksetHas: cell("weaksetHas"), + functionToString: cell("functionToString"), + promiseAll: cell("promiseAll"), + promiseCatch: cell("promiseCatch"), + promiseThen: cell("promiseThen"), + finalizationRegistryRegister: cell("finalizationRegistryRegister"), + finalizationRegistryUnregister: cell("finalizationRegistryUnregister"), + getConstructorOf: cell("getConstructorOf"), + immutableObject: cell("immutableObject"), + isObject: cell("isObject"), + isError: cell("isError"), + FERAL_EVAL: cell("FERAL_EVAL"), + FERAL_FUNCTION: cell("FERAL_FUNCTION"), + noEvalEvaluate: cell("noEvalEvaluate"), + }, + { + }, + { + makeEnvironmentCaptor: cell("makeEnvironmentCaptor"), + }, + { + }, + { + an: cell("an"), + bestEffortStringify: cell("bestEffortStringify"), + enJoin: cell("enJoin"), + }, + { + }, + { + }, + { + makeLRUCacheMap: cell("makeLRUCacheMap"), + makeNoteLogArgsArrayKit: cell("makeNoteLogArgsArrayKit"), + }, + { + unredactedDetails: cell("unredactedDetails"), + loggedErrorHandler: cell("loggedErrorHandler"), + makeAssert: cell("makeAssert"), + assert: cell("assert"), + }, + { + isTypedArray: cell("isTypedArray"), + makeHardener: cell("makeHardener"), + }, + { + constantProperties: cell("constantProperties"), + universalPropertyNames: cell("universalPropertyNames"), + initialGlobalPropertyNames: cell("initialGlobalPropertyNames"), + sharedGlobalPropertyNames: cell("sharedGlobalPropertyNames"), + uniqueGlobalPropertyNames: cell("uniqueGlobalPropertyNames"), + NativeErrors: cell("NativeErrors"), + FunctionInstance: cell("FunctionInstance"), + AsyncFunctionInstance: cell("AsyncFunctionInstance"), + isAccessorPermit: cell("isAccessorPermit"), + permitted: cell("permitted"), + }, + { + makeIntrinsicsCollector: cell("makeIntrinsicsCollector"), + getGlobalIntrinsics: cell("getGlobalIntrinsics"), + }, + { + default: cell("default"), + }, + { + default: cell("default"), + }, + { + default: cell("default"), + }, + { + default: cell("default"), + }, + { + default: cell("default"), + }, + { + minEnablements: cell("minEnablements"), + moderateEnablements: cell("moderateEnablements"), + severeEnablements: cell("severeEnablements"), + }, + { + default: cell("default"), + }, + { + default: cell("default"), + }, + { + makeEvalFunction: cell("makeEvalFunction"), + }, + { + makeFunctionConstructor: cell("makeFunctionConstructor"), + }, + { + setGlobalObjectSymbolUnscopables: cell("setGlobalObjectSymbolUnscopables"), + setGlobalObjectConstantProperties: cell("setGlobalObjectConstantProperties"), + setGlobalObjectMutableProperties: cell("setGlobalObjectMutableProperties"), + setGlobalObjectEvaluators: cell("setGlobalObjectEvaluators"), + }, + { + alwaysThrowHandler: cell("alwaysThrowHandler"), + strictScopeTerminatorHandler: cell("strictScopeTerminatorHandler"), + strictScopeTerminator: cell("strictScopeTerminator"), + }, + { + createSloppyGlobalsScopeTerminator: cell("createSloppyGlobalsScopeTerminator"), + }, + { + makeEvalScopeKit: cell("makeEvalScopeKit"), + }, + { + getSourceURL: cell("getSourceURL"), + }, + { + rejectHtmlComments: cell("rejectHtmlComments"), + evadeHtmlCommentTest: cell("evadeHtmlCommentTest"), + rejectImportExpressions: cell("rejectImportExpressions"), + evadeImportExpressionTest: cell("evadeImportExpressionTest"), + rejectSomeDirectEvalExpressions: cell("rejectSomeDirectEvalExpressions"), + mandatoryTransforms: cell("mandatoryTransforms"), + applyTransforms: cell("applyTransforms"), + transforms: cell("transforms"), + }, + { + isValidIdentifierName: cell("isValidIdentifierName"), + getScopeConstants: cell("getScopeConstants"), + }, + { + makeEvaluate: cell("makeEvaluate"), + }, + { + makeSafeEvaluator: cell("makeSafeEvaluator"), + }, + { + tameFunctionToString: cell("tameFunctionToString"), + }, + { + tameDomains: cell("tameDomains"), + }, + { + makeLoggingConsoleKit: cell("makeLoggingConsoleKit"), + makeCausalConsole: cell("makeCausalConsole"), + filterConsole: cell("filterConsole"), + consoleWhitelist: cell("consoleWhitelist"), + }, + { + makeRejectionHandlers: cell("makeRejectionHandlers"), + }, + { + tameConsole: cell("tameConsole"), + }, + { + filterFileName: cell("filterFileName"), + shortenCallSiteString: cell("shortenCallSiteString"), + tameV8ErrorConstructor: cell("tameV8ErrorConstructor"), + }, + { + default: cell("default"), + }, + { + makeAlias: cell("makeAlias"), + load: cell("load"), + }, + { + deferExports: cell("deferExports"), + getDeferredExports: cell("getDeferredExports"), + }, + { + provideCompartmentEvaluator: cell("provideCompartmentEvaluator"), + compartmentEvaluate: cell("compartmentEvaluate"), + }, + { + makeThirdPartyModuleInstance: cell("makeThirdPartyModuleInstance"), + makeModuleInstance: cell("makeModuleInstance"), + }, + { + link: cell("link"), + instantiate: cell("instantiate"), + }, + { + InertCompartment: cell("InertCompartment"), + CompartmentPrototype: cell("CompartmentPrototype"), + makeCompartmentConstructor: cell("makeCompartmentConstructor"), + }, + { + getAnonymousIntrinsics: cell("getAnonymousIntrinsics"), + }, + { + tameHarden: cell("tameHarden"), + }, + { + tameSymbolConstructor: cell("tameSymbolConstructor"), + }, + { + repairIntrinsics: cell("repairIntrinsics"), + }, + { + }, + { + }, + { + }, + { + }, + ]; + + Object.defineProperties(cells[3], Object.getOwnPropertyDescriptors(cells[2])); + + const namespaces = cells.map(cells => Object.freeze(Object.create(null, cells))); + + for (let index = 0; index < namespaces.length; index += 1) { + cells[index]['*'] = cell('*', namespaces[index]); + } + +function observeImports(map, importName, importIndex) { + for (const [name, observers] of map.get(importName)) { + const cell = cells[importIndex][name]; + if (cell === undefined) { + throw new ReferenceError(`Cannot import name ${name}`); + } + for (const observer of observers) { + cell.observe(observer); + } + } +} + + + functors[0]({ + imports(entries) { + const map = new Map(entries); + }, + liveVar: { + }, + onceVar: { + universalThis: cells[0].globalThis.set, + Array: cells[0].Array.set, + Date: cells[0].Date.set, + FinalizationRegistry: cells[0].FinalizationRegistry.set, + Float32Array: cells[0].Float32Array.set, + JSON: cells[0].JSON.set, + Map: cells[0].Map.set, + Math: cells[0].Math.set, + Number: cells[0].Number.set, + Object: cells[0].Object.set, + Promise: cells[0].Promise.set, + Proxy: cells[0].Proxy.set, + Reflect: cells[0].Reflect.set, + FERAL_REG_EXP: cells[0].FERAL_REG_EXP.set, + Set: cells[0].Set.set, + String: cells[0].String.set, + Symbol: cells[0].Symbol.set, + WeakMap: cells[0].WeakMap.set, + WeakSet: cells[0].WeakSet.set, + FERAL_ERROR: cells[0].FERAL_ERROR.set, + RangeError: cells[0].RangeError.set, + ReferenceError: cells[0].ReferenceError.set, + SyntaxError: cells[0].SyntaxError.set, + TypeError: cells[0].TypeError.set, + assign: cells[0].assign.set, + create: cells[0].create.set, + defineProperties: cells[0].defineProperties.set, + entries: cells[0].entries.set, + freeze: cells[0].freeze.set, + getOwnPropertyDescriptor: cells[0].getOwnPropertyDescriptor.set, + getOwnPropertyDescriptors: cells[0].getOwnPropertyDescriptors.set, + getOwnPropertyNames: cells[0].getOwnPropertyNames.set, + getPrototypeOf: cells[0].getPrototypeOf.set, + is: cells[0].is.set, + isFrozen: cells[0].isFrozen.set, + isSealed: cells[0].isSealed.set, + isExtensible: cells[0].isExtensible.set, + keys: cells[0].keys.set, + objectPrototype: cells[0].objectPrototype.set, + seal: cells[0].seal.set, + preventExtensions: cells[0].preventExtensions.set, + setPrototypeOf: cells[0].setPrototypeOf.set, + values: cells[0].values.set, + fromEntries: cells[0].fromEntries.set, + speciesSymbol: cells[0].speciesSymbol.set, + toStringTagSymbol: cells[0].toStringTagSymbol.set, + iteratorSymbol: cells[0].iteratorSymbol.set, + matchAllSymbol: cells[0].matchAllSymbol.set, + unscopablesSymbol: cells[0].unscopablesSymbol.set, + symbolKeyFor: cells[0].symbolKeyFor.set, + symbolFor: cells[0].symbolFor.set, + isInteger: cells[0].isInteger.set, + stringifyJson: cells[0].stringifyJson.set, + defineProperty: cells[0].defineProperty.set, + apply: cells[0].apply.set, + construct: cells[0].construct.set, + reflectGet: cells[0].reflectGet.set, + reflectGetOwnPropertyDescriptor: cells[0].reflectGetOwnPropertyDescriptor.set, + reflectHas: cells[0].reflectHas.set, + reflectIsExtensible: cells[0].reflectIsExtensible.set, + ownKeys: cells[0].ownKeys.set, + reflectPreventExtensions: cells[0].reflectPreventExtensions.set, + reflectSet: cells[0].reflectSet.set, + isArray: cells[0].isArray.set, + arrayPrototype: cells[0].arrayPrototype.set, + mapPrototype: cells[0].mapPrototype.set, + proxyRevocable: cells[0].proxyRevocable.set, + regexpPrototype: cells[0].regexpPrototype.set, + setPrototype: cells[0].setPrototype.set, + stringPrototype: cells[0].stringPrototype.set, + weakmapPrototype: cells[0].weakmapPrototype.set, + weaksetPrototype: cells[0].weaksetPrototype.set, + functionPrototype: cells[0].functionPrototype.set, + promisePrototype: cells[0].promisePrototype.set, + typedArrayPrototype: cells[0].typedArrayPrototype.set, + uncurryThis: cells[0].uncurryThis.set, + objectHasOwnProperty: cells[0].objectHasOwnProperty.set, + arrayFilter: cells[0].arrayFilter.set, + arrayForEach: cells[0].arrayForEach.set, + arrayIncludes: cells[0].arrayIncludes.set, + arrayJoin: cells[0].arrayJoin.set, + arrayMap: cells[0].arrayMap.set, + arrayPop: cells[0].arrayPop.set, + arrayPush: cells[0].arrayPush.set, + arraySlice: cells[0].arraySlice.set, + arraySome: cells[0].arraySome.set, + arraySort: cells[0].arraySort.set, + iterateArray: cells[0].iterateArray.set, + mapSet: cells[0].mapSet.set, + mapGet: cells[0].mapGet.set, + mapHas: cells[0].mapHas.set, + mapDelete: cells[0].mapDelete.set, + mapEntries: cells[0].mapEntries.set, + iterateMap: cells[0].iterateMap.set, + setAdd: cells[0].setAdd.set, + setDelete: cells[0].setDelete.set, + setForEach: cells[0].setForEach.set, + setHas: cells[0].setHas.set, + iterateSet: cells[0].iterateSet.set, + regexpTest: cells[0].regexpTest.set, + regexpExec: cells[0].regexpExec.set, + matchAllRegExp: cells[0].matchAllRegExp.set, + stringEndsWith: cells[0].stringEndsWith.set, + stringIncludes: cells[0].stringIncludes.set, + stringIndexOf: cells[0].stringIndexOf.set, + stringMatch: cells[0].stringMatch.set, + stringReplace: cells[0].stringReplace.set, + stringSearch: cells[0].stringSearch.set, + stringSlice: cells[0].stringSlice.set, + stringSplit: cells[0].stringSplit.set, + stringStartsWith: cells[0].stringStartsWith.set, + iterateString: cells[0].iterateString.set, + weakmapDelete: cells[0].weakmapDelete.set, + weakmapGet: cells[0].weakmapGet.set, + weakmapHas: cells[0].weakmapHas.set, + weakmapSet: cells[0].weakmapSet.set, + weaksetAdd: cells[0].weaksetAdd.set, + weaksetHas: cells[0].weaksetHas.set, + functionToString: cells[0].functionToString.set, + promiseAll: cells[0].promiseAll.set, + promiseCatch: cells[0].promiseCatch.set, + promiseThen: cells[0].promiseThen.set, + finalizationRegistryRegister: cells[0].finalizationRegistryRegister.set, + finalizationRegistryUnregister: cells[0].finalizationRegistryUnregister.set, + getConstructorOf: cells[0].getConstructorOf.set, + immutableObject: cells[0].immutableObject.set, + isObject: cells[0].isObject.set, + isError: cells[0].isError.set, + FERAL_EVAL: cells[0].FERAL_EVAL.set, + FERAL_FUNCTION: cells[0].FERAL_FUNCTION.set, + noEvalEvaluate: cells[0].noEvalEvaluate.set, + }, + importMeta: {}, + }); + functors[1]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + }, + liveVar: { + }, + onceVar: { + }, + importMeta: {}, + }); + functors[2]({ + imports(entries) { + const map = new Map(entries); + }, + liveVar: { + }, + onceVar: { + makeEnvironmentCaptor: cells[2].makeEnvironmentCaptor.set, + }, + importMeta: {}, + }); + functors[3]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./src/env-options.js", 2); + }, + liveVar: { + }, + onceVar: { + }, + importMeta: {}, + }); + functors[4]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "../commons.js", 0); + }, + liveVar: { + }, + onceVar: { + an: cells[4].an.set, + bestEffortStringify: cells[4].bestEffortStringify.set, + enJoin: cells[4].enJoin.set, + }, + importMeta: {}, + }); + functors[5]({ + imports(entries) { + const map = new Map(entries); + }, + liveVar: { + }, + onceVar: { + }, + importMeta: {}, + }); + functors[6]({ + imports(entries) { + const map = new Map(entries); + }, + liveVar: { + }, + onceVar: { + }, + importMeta: {}, + }); + functors[7]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./internal-types.js", 6); + }, + liveVar: { + }, + onceVar: { + makeLRUCacheMap: cells[7].makeLRUCacheMap.set, + makeNoteLogArgsArrayKit: cells[7].makeNoteLogArgsArrayKit.set, + }, + importMeta: {}, + }); + functors[8]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "../commons.js", 0); + observeImports(map, "./stringify-utils.js", 4); + observeImports(map, "./types.js", 5); + observeImports(map, "./internal-types.js", 6); + observeImports(map, "./note-log-args.js", 7); + }, + liveVar: { + }, + onceVar: { + unredactedDetails: cells[8].unredactedDetails.set, + loggedErrorHandler: cells[8].loggedErrorHandler.set, + makeAssert: cells[8].makeAssert.set, + assert: cells[8].assert.set, + }, + importMeta: {}, + }); + functors[9]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./error/assert.js", 8); + }, + liveVar: { + }, + onceVar: { + isTypedArray: cells[9].isTypedArray.set, + makeHardener: cells[9].makeHardener.set, + }, + importMeta: {}, + }); + functors[10]({ + imports(entries) { + const map = new Map(entries); + }, + liveVar: { + }, + onceVar: { + constantProperties: cells[10].constantProperties.set, + universalPropertyNames: cells[10].universalPropertyNames.set, + initialGlobalPropertyNames: cells[10].initialGlobalPropertyNames.set, + sharedGlobalPropertyNames: cells[10].sharedGlobalPropertyNames.set, + uniqueGlobalPropertyNames: cells[10].uniqueGlobalPropertyNames.set, + NativeErrors: cells[10].NativeErrors.set, + FunctionInstance: cells[10].FunctionInstance.set, + AsyncFunctionInstance: cells[10].AsyncFunctionInstance.set, + isAccessorPermit: cells[10].isAccessorPermit.set, + permitted: cells[10].permitted.set, + }, + importMeta: {}, + }); + functors[11]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./permits.js", 10); + }, + liveVar: { + }, + onceVar: { + makeIntrinsicsCollector: cells[11].makeIntrinsicsCollector.set, + getGlobalIntrinsics: cells[11].getGlobalIntrinsics.set, + }, + importMeta: {}, + }); + functors[12]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./permits.js", 10); + observeImports(map, "./commons.js", 0); + }, + liveVar: { + }, + onceVar: { + default: cells[12].default.set, + }, + importMeta: {}, + }); + functors[13]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + }, + liveVar: { + }, + onceVar: { + default: cells[13].default.set, + }, + importMeta: {}, + }); + functors[14]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + }, + liveVar: { + }, + onceVar: { + default: cells[14].default.set, + }, + importMeta: {}, + }); + functors[15]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + }, + liveVar: { + }, + onceVar: { + default: cells[15].default.set, + }, + importMeta: {}, + }); + functors[16]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + }, + liveVar: { + }, + onceVar: { + default: cells[16].default.set, + }, + importMeta: {}, + }); + functors[17]({ + imports(entries) { + const map = new Map(entries); + }, + liveVar: { + }, + onceVar: { + minEnablements: cells[17].minEnablements.set, + moderateEnablements: cells[17].moderateEnablements.set, + severeEnablements: cells[17].severeEnablements.set, + }, + importMeta: {}, + }); + functors[18]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./enablements.js", 17); + }, + liveVar: { + }, + onceVar: { + default: cells[18].default.set, + }, + importMeta: {}, + }); + functors[19]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./error/assert.js", 8); + }, + liveVar: { + }, + onceVar: { + default: cells[19].default.set, + }, + importMeta: {}, + }); + functors[20]({ + imports(entries) { + const map = new Map(entries); + }, + liveVar: { + }, + onceVar: { + makeEvalFunction: cells[20].makeEvalFunction.set, + }, + importMeta: {}, + }); + functors[21]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./error/assert.js", 8); + }, + liveVar: { + }, + onceVar: { + makeFunctionConstructor: cells[21].makeFunctionConstructor.set, + }, + importMeta: {}, + }); + functors[22]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./make-eval-function.js", 20); + observeImports(map, "./make-function-constructor.js", 21); + observeImports(map, "./permits.js", 10); + }, + liveVar: { + }, + onceVar: { + setGlobalObjectSymbolUnscopables: cells[22].setGlobalObjectSymbolUnscopables.set, + setGlobalObjectConstantProperties: cells[22].setGlobalObjectConstantProperties.set, + setGlobalObjectMutableProperties: cells[22].setGlobalObjectMutableProperties.set, + setGlobalObjectEvaluators: cells[22].setGlobalObjectEvaluators.set, + }, + importMeta: {}, + }); + functors[23]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./error/assert.js", 8); + }, + liveVar: { + }, + onceVar: { + alwaysThrowHandler: cells[23].alwaysThrowHandler.set, + strictScopeTerminatorHandler: cells[23].strictScopeTerminatorHandler.set, + strictScopeTerminator: cells[23].strictScopeTerminator.set, + }, + importMeta: {}, + }); + functors[24]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./strict-scope-terminator.js", 23); + }, + liveVar: { + }, + onceVar: { + createSloppyGlobalsScopeTerminator: cells[24].createSloppyGlobalsScopeTerminator.set, + }, + importMeta: {}, + }); + functors[25]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./error/assert.js", 8); + }, + liveVar: { + }, + onceVar: { + makeEvalScopeKit: cells[25].makeEvalScopeKit.set, + }, + importMeta: {}, + }); + functors[26]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + }, + liveVar: { + }, + onceVar: { + getSourceURL: cells[26].getSourceURL.set, + }, + importMeta: {}, + }); + functors[27]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./get-source-url.js", 26); + }, + liveVar: { + }, + onceVar: { + rejectHtmlComments: cells[27].rejectHtmlComments.set, + evadeHtmlCommentTest: cells[27].evadeHtmlCommentTest.set, + rejectImportExpressions: cells[27].rejectImportExpressions.set, + evadeImportExpressionTest: cells[27].evadeImportExpressionTest.set, + rejectSomeDirectEvalExpressions: cells[27].rejectSomeDirectEvalExpressions.set, + mandatoryTransforms: cells[27].mandatoryTransforms.set, + applyTransforms: cells[27].applyTransforms.set, + transforms: cells[27].transforms.set, + }, + importMeta: {}, + }); + functors[28]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + }, + liveVar: { + }, + onceVar: { + isValidIdentifierName: cells[28].isValidIdentifierName.set, + getScopeConstants: cells[28].getScopeConstants.set, + }, + importMeta: {}, + }); + functors[29]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./scope-constants.js", 28); + }, + liveVar: { + }, + onceVar: { + makeEvaluate: cells[29].makeEvaluate.set, + }, + importMeta: {}, + }); + functors[30]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./strict-scope-terminator.js", 23); + observeImports(map, "./sloppy-globals-scope-terminator.js", 24); + observeImports(map, "./eval-scope.js", 25); + observeImports(map, "./transforms.js", 27); + observeImports(map, "./make-evaluate.js", 29); + observeImports(map, "./error/assert.js", 8); + }, + liveVar: { + }, + onceVar: { + makeSafeEvaluator: cells[30].makeSafeEvaluator.set, + }, + importMeta: {}, + }); + functors[31]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + }, + liveVar: { + }, + onceVar: { + tameFunctionToString: cells[31].tameFunctionToString.set, + }, + importMeta: {}, + }); + functors[32]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + }, + liveVar: { + }, + onceVar: { + tameDomains: cells[32].tameDomains.set, + }, + importMeta: {}, + }); + functors[33]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "../commons.js", 0); + observeImports(map, "./types.js", 5); + observeImports(map, "./internal-types.js", 6); + }, + liveVar: { + }, + onceVar: { + makeLoggingConsoleKit: cells[33].makeLoggingConsoleKit.set, + makeCausalConsole: cells[33].makeCausalConsole.set, + filterConsole: cells[33].filterConsole.set, + consoleWhitelist: cells[33].consoleWhitelist.set, + }, + importMeta: {}, + }); + functors[34]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "../commons.js", 0); + }, + liveVar: { + }, + onceVar: { + makeRejectionHandlers: cells[34].makeRejectionHandlers.set, + }, + importMeta: {}, + }); + functors[35]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "../commons.js", 0); + observeImports(map, "./assert.js", 8); + observeImports(map, "./console.js", 33); + observeImports(map, "./unhandled-rejection.js", 34); + observeImports(map, "./types.js", 5); + observeImports(map, "./internal-types.js", 6); + }, + liveVar: { + }, + onceVar: { + tameConsole: cells[35].tameConsole.set, + }, + importMeta: {}, + }); + functors[36]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "../commons.js", 0); + }, + liveVar: { + }, + onceVar: { + filterFileName: cells[36].filterFileName.set, + shortenCallSiteString: cells[36].shortenCallSiteString.set, + tameV8ErrorConstructor: cells[36].tameV8ErrorConstructor.set, + }, + importMeta: {}, + }); + functors[37]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "../commons.js", 0); + observeImports(map, "../permits.js", 10); + observeImports(map, "./tame-v8-error-constructor.js", 36); + }, + liveVar: { + }, + onceVar: { + default: cells[37].default.set, + }, + importMeta: {}, + }); + functors[38]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./error/assert.js", 8); + }, + liveVar: { + }, + onceVar: { + makeAlias: cells[38].makeAlias.set, + load: cells[38].load.set, + }, + importMeta: {}, + }); + functors[39]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./module-load.js", 38); + observeImports(map, "./commons.js", 0); + observeImports(map, "./error/assert.js", 8); + }, + liveVar: { + }, + onceVar: { + deferExports: cells[39].deferExports.set, + getDeferredExports: cells[39].getDeferredExports.set, + }, + importMeta: {}, + }); + functors[40]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./transforms.js", 27); + observeImports(map, "./make-safe-evaluator.js", 30); + }, + liveVar: { + }, + onceVar: { + provideCompartmentEvaluator: cells[40].provideCompartmentEvaluator.set, + compartmentEvaluate: cells[40].compartmentEvaluate.set, + }, + importMeta: {}, + }); + functors[41]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./error/assert.js", 8); + observeImports(map, "./module-proxy.js", 39); + observeImports(map, "./commons.js", 0); + observeImports(map, "./compartment-evaluate.js", 40); + }, + liveVar: { + }, + onceVar: { + makeThirdPartyModuleInstance: cells[41].makeThirdPartyModuleInstance.set, + makeModuleInstance: cells[41].makeModuleInstance.set, + }, + importMeta: {}, + }); + functors[42]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./error/assert.js", 8); + observeImports(map, "./module-instance.js", 41); + observeImports(map, "./commons.js", 0); + }, + liveVar: { + }, + onceVar: { + link: cells[42].link.set, + instantiate: cells[42].instantiate.set, + }, + importMeta: {}, + }); + functors[43]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./global-object.js", 22); + observeImports(map, "./permits.js", 10); + observeImports(map, "./module-load.js", 38); + observeImports(map, "./module-link.js", 42); + observeImports(map, "./module-proxy.js", 39); + observeImports(map, "./error/assert.js", 8); + observeImports(map, "./compartment-evaluate.js", 40); + observeImports(map, "./make-safe-evaluator.js", 30); + }, + liveVar: { + }, + onceVar: { + InertCompartment: cells[43].InertCompartment.set, + CompartmentPrototype: cells[43].CompartmentPrototype.set, + makeCompartmentConstructor: cells[43].makeCompartmentConstructor.set, + }, + importMeta: {}, + }); + functors[44]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./compartment.js", 43); + }, + liveVar: { + }, + onceVar: { + getAnonymousIntrinsics: cells[44].getAnonymousIntrinsics.set, + }, + importMeta: {}, + }); + functors[45]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + }, + liveVar: { + }, + onceVar: { + tameHarden: cells[45].tameHarden.set, + }, + importMeta: {}, + }); + functors[46]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + }, + liveVar: { + }, + onceVar: { + tameSymbolConstructor: cells[46].tameSymbolConstructor.set, + }, + importMeta: {}, + }); + functors[47]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "@endo/env-options", 3); + observeImports(map, "./commons.js", 0); + observeImports(map, "./make-hardener.js", 9); + observeImports(map, "./intrinsics.js", 11); + observeImports(map, "./permits-intrinsics.js", 12); + observeImports(map, "./tame-function-constructors.js", 13); + observeImports(map, "./tame-date-constructor.js", 14); + observeImports(map, "./tame-math-object.js", 15); + observeImports(map, "./tame-regexp-constructor.js", 16); + observeImports(map, "./enable-property-overrides.js", 18); + observeImports(map, "./tame-locale-methods.js", 19); + observeImports(map, "./global-object.js", 22); + observeImports(map, "./make-safe-evaluator.js", 30); + observeImports(map, "./permits.js", 10); + observeImports(map, "./tame-function-tostring.js", 31); + observeImports(map, "./tame-domains.js", 32); + observeImports(map, "./error/tame-console.js", 35); + observeImports(map, "./error/tame-error-constructor.js", 37); + observeImports(map, "./error/assert.js", 8); + observeImports(map, "./get-anonymous-intrinsics.js", 44); + observeImports(map, "./compartment.js", 43); + observeImports(map, "./tame-harden.js", 45); + observeImports(map, "./tame-symbol-constructor.js", 46); + }, + liveVar: { + }, + onceVar: { + repairIntrinsics: cells[47].repairIntrinsics.set, + }, + importMeta: {}, + }); + functors[48]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./assert-sloppy-mode.js", 1); + observeImports(map, "./commons.js", 0); + observeImports(map, "./lockdown.js", 47); + }, + liveVar: { + }, + onceVar: { + }, + importMeta: {}, + }); + functors[49]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./compartment.js", 43); + observeImports(map, "./tame-function-tostring.js", 31); + observeImports(map, "./intrinsics.js", 11); + }, + liveVar: { + }, + onceVar: { + }, + importMeta: {}, + }); + functors[50]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./error/assert.js", 8); + }, + liveVar: { + }, + onceVar: { + }, + importMeta: {}, + }); + functors[51]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./src/lockdown-shim.js", 48); + observeImports(map, "./src/compartment-shim.js", 49); + observeImports(map, "./src/assert-shim.js", 50); + }, + liveVar: { + }, + onceVar: { + }, + importMeta: {}, + }); + + return cells[cells.length - 1]['*'].get(); +})(); diff --git a/package-lock.json b/package-lock.json index c78b02124..19e6b6273 100644 --- a/package-lock.json +++ b/package-lock.json @@ -65,7 +65,6 @@ "redux-thunk": "2.4.2", "stream-browserify": "1.0.0", "ttag": "1.7.24", - "unleash-proxy-client": "1.11.0", "url": "0.11.1" }, "devDependencies": { @@ -19509,11 +19508,6 @@ "safe-buffer": "~5.1.0" } }, - "node_modules/tiny-emitter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", - "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==" - }, "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -20110,16 +20104,6 @@ "node": ">= 4.0.0" } }, - "node_modules/unleash-proxy-client": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/unleash-proxy-client/-/unleash-proxy-client-1.11.0.tgz", - "integrity": "sha512-z5qwSo0i2G+nKS3WeKhfVxDAED8CmlrfoXtUz1AOsCmhZ81GvkHFvvhMAWKdqGKyk86qojcEeA5c5adWX2HYjg==", - "dependencies": { - "@react-native-async-storage/async-storage": "^1.15.17", - "tiny-emitter": "^2.1.0", - "uuid": "^8.3.2" - } - }, "node_modules/unorm": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/unorm/-/unorm-1.6.0.tgz", @@ -20234,14 +20218,6 @@ "node": ">= 0.4.0" } }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/v8-to-istanbul": { "version": "9.1.2", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.2.tgz", diff --git a/package.json b/package.json index a68ad985e..9dc6ed23b 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,6 @@ "redux-thunk": "2.4.2", "stream-browserify": "1.0.0", "ttag": "1.7.24", - "unleash-proxy-client": "1.11.0", "url": "0.11.1" }, "devDependencies": { From dc8b07019d9d3cf2577f8ce4c88f41d6a81d37a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Fri, 26 Jan 2024 13:11:40 -0300 Subject: [PATCH 04/47] chore: added patch-package and patch to react-native --- package-lock.json | 364 +++++- package.json | 1 + patches/react-native+0.72.5.patch | 1783 +++++++++++++++++++++++++++++ 3 files changed, 2130 insertions(+), 18 deletions(-) create mode 100644 patches/react-native+0.72.5.patch diff --git a/package-lock.json b/package-lock.json index 19e6b6273..f0b8c167f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -87,6 +87,7 @@ "eslint-plugin-react": "7.32.2", "jest": "29.7.0", "metro-react-native-babel-preset": "0.76.8", + "patch-package": "^8.0.0", "react-test-renderer": "18.1.0", "rn-nodeify": "10.3.0", "ttag-cli": "1.10.5", @@ -7339,6 +7340,15 @@ "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" }, + "node_modules/at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/available-typed-arrays": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", @@ -8214,12 +8224,13 @@ } }, "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", + "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.1", + "set-function-length": "^1.1.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -9000,6 +9011,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/define-data-property": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", + "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "dependencies": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/define-properties": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", @@ -10482,6 +10506,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/find-yarn-workspace-root": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz", + "integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==", + "dev": true, + "dependencies": { + "micromatch": "^4.0.2" + } + }, "node_modules/findit": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/findit/-/findit-2.0.0.tgz", @@ -10619,9 +10652,12 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/function.prototype.name": { "version": "1.1.5", @@ -10667,14 +10703,14 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", - "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", + "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", + "function-bind": "^1.1.2", "has-proto": "^1.0.1", - "has-symbols": "^1.0.3" + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -10940,11 +10976,11 @@ } }, "node_modules/has-property-descriptors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", - "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", + "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", "dependencies": { - "get-intrinsic": "^1.1.1" + "get-intrinsic": "^1.2.2" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -11039,6 +11075,17 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/hermes-estree": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.6.0.tgz", @@ -11499,6 +11546,21 @@ "node": ">=0.10.0" } }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -11747,6 +11809,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -14842,12 +14916,36 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, + "node_modules/json-stable-stringify": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz", + "integrity": "sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, + "node_modules/json-stable-stringify/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -14867,6 +14965,15 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/jsx-ast-utils": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.4.tgz", @@ -14910,6 +15017,15 @@ "graceful-fs": "^4.1.9" } }, + "node_modules/klaw-sync": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", + "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.11" + } + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -17148,6 +17264,203 @@ "node": ">= 0.8" } }, + "node_modules/patch-package": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/patch-package/-/patch-package-8.0.0.tgz", + "integrity": "sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA==", + "dev": true, + "dependencies": { + "@yarnpkg/lockfile": "^1.1.0", + "chalk": "^4.1.2", + "ci-info": "^3.7.0", + "cross-spawn": "^7.0.3", + "find-yarn-workspace-root": "^2.0.0", + "fs-extra": "^9.0.0", + "json-stable-stringify": "^1.0.2", + "klaw-sync": "^6.0.0", + "minimist": "^1.2.6", + "open": "^7.4.2", + "rimraf": "^2.6.3", + "semver": "^7.5.3", + "slash": "^2.0.0", + "tmp": "^0.0.33", + "yaml": "^2.2.2" + }, + "bin": { + "patch-package": "index.js" + }, + "engines": { + "node": ">=14", + "npm": ">5" + } + }, + "node_modules/patch-package/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/patch-package/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/patch-package/node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, + "node_modules/patch-package/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/patch-package/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/patch-package/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/patch-package/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/patch-package/node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/patch-package/node_modules/open": { + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", + "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0", + "is-wsl": "^2.1.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/patch-package/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/patch-package/node_modules/slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/patch-package/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/patch-package/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/patch-package/node_modules/yaml": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", + "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, "node_modules/path-browserify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", @@ -18917,6 +19230,21 @@ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" }, + "node_modules/set-function-length": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz", + "integrity": "sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==", + "dependencies": { + "define-data-property": "^1.1.1", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.2", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", diff --git a/package.json b/package.json index 9dc6ed23b..e25e5590c 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,7 @@ "eslint-plugin-react": "7.32.2", "jest": "29.7.0", "metro-react-native-babel-preset": "0.76.8", + "patch-package": "^8.0.0", "react-test-renderer": "18.1.0", "rn-nodeify": "10.3.0", "ttag-cli": "1.10.5", diff --git a/patches/react-native+0.72.5.patch b/patches/react-native+0.72.5.patch new file mode 100644 index 000000000..c79cd9fcf --- /dev/null +++ b/patches/react-native+0.72.5.patch @@ -0,0 +1,1783 @@ +diff --git a/node_modules/react-native/Libraries/Core/InitializeCore.js b/node_modules/react-native/Libraries/Core/InitializeCore.js +index 25377f6..4f902d9 100644 +--- a/node_modules/react-native/Libraries/Core/InitializeCore.js ++++ b/node_modules/react-native/Libraries/Core/InitializeCore.js +@@ -30,7 +30,7 @@ require('./setUpGlobals'); + require('./setUpDOM'); + require('./setUpPerformance'); + require('./setUpErrorHandling'); +-require('./polyfillPromise'); ++// require('./polyfillPromise'); + require('./setUpRegeneratorRuntime'); + require('./setUpTimers'); + require('./setUpXHR'); +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h +new file mode 100644 +index 0000000..37b7d8d +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h +@@ -0,0 +1,29 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateComponentDescriptorH.js ++ */ ++ ++#pragma once ++ ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++using AndroidHorizontalScrollContentViewComponentDescriptor = ConcreteComponentDescriptor; ++using AndroidSwipeRefreshLayoutComponentDescriptor = ConcreteComponentDescriptor; ++using PullToRefreshViewComponentDescriptor = ConcreteComponentDescriptor; ++using AndroidDrawerLayoutComponentDescriptor = ConcreteComponentDescriptor; ++using ActivityIndicatorViewComponentDescriptor = ConcreteComponentDescriptor; ++using UnimplementedNativeViewComponentDescriptor = ConcreteComponentDescriptor; ++using SwitchComponentDescriptor = ConcreteComponentDescriptor; ++using TraceUpdateOverlayComponentDescriptor = ConcreteComponentDescriptor; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp +new file mode 100644 +index 0000000..229fadc +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp +@@ -0,0 +1,111 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateEventEmitterCpp.js ++ */ ++ ++#include ++ ++namespace facebook { ++namespace react { ++ ++ ++ ++ ++void AndroidSwipeRefreshLayoutEventEmitter::onRefresh(OnRefresh event) const { ++ dispatchEvent("refresh", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void PullToRefreshViewEventEmitter::onRefresh(OnRefresh event) const { ++ dispatchEvent("refresh", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++ ++void AndroidDrawerLayoutEventEmitter::onDrawerSlide(OnDrawerSlide event) const { ++ dispatchEvent("drawerSlide", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "offset", event.offset); ++ return payload; ++ }); ++} ++void AndroidDrawerLayoutEventEmitter::onDrawerStateChanged(OnDrawerStateChanged event) const { ++ dispatchEvent("drawerStateChanged", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "drawerState", event.drawerState); ++ return payload; ++ }); ++} ++void AndroidDrawerLayoutEventEmitter::onDrawerOpen(OnDrawerOpen event) const { ++ dispatchEvent("drawerOpen", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void AndroidDrawerLayoutEventEmitter::onDrawerClose(OnDrawerClose event) const { ++ dispatchEvent("drawerClose", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++ ++ ++void SwitchEventEmitter::onChange(OnChange event) const { ++ dispatchEvent("change", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "value", event.value); ++payload.setProperty(runtime, "target", event.target); ++ return payload; ++ }); ++} ++void AndroidSwitchEventEmitter::onChange(OnChange event) const { ++ dispatchEvent("change", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "value", event.value); ++payload.setProperty(runtime, "target", event.target); ++ return payload; ++ }); ++} ++ ++void ModalHostViewEventEmitter::onRequestClose(OnRequestClose event) const { ++ dispatchEvent("requestClose", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void ModalHostViewEventEmitter::onShow(OnShow event) const { ++ dispatchEvent("show", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void ModalHostViewEventEmitter::onDismiss(OnDismiss event) const { ++ dispatchEvent("dismiss", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void ModalHostViewEventEmitter::onOrientationChange(OnOrientationChange event) const { ++ dispatchEvent("orientationChange", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "orientation", toString(event.orientation)); ++ return payload; ++ }); ++} ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h +new file mode 100644 +index 0000000..1897be1 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h +@@ -0,0 +1,186 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateEventEmitterH.js ++ */ ++#pragma once ++ ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++class JSI_EXPORT SafeAreaViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT AndroidHorizontalScrollContentViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT AndroidProgressBarEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT AndroidSwipeRefreshLayoutEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnRefresh { ++ ++ }; ++ ++ void onRefresh(OnRefresh value) const; ++}; ++class JSI_EXPORT PullToRefreshViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnRefresh { ++ ++ }; ++ ++ void onRefresh(OnRefresh value) const; ++}; ++class JSI_EXPORT InputAccessoryEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT AndroidDrawerLayoutEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnDrawerSlide { ++ Float offset; ++ }; ++ ++ struct OnDrawerStateChanged { ++ int drawerState; ++ }; ++ ++ struct OnDrawerOpen { ++ ++ }; ++ ++ struct OnDrawerClose { ++ ++ }; ++ ++ void onDrawerSlide(OnDrawerSlide value) const; ++ ++ void onDrawerStateChanged(OnDrawerStateChanged value) const; ++ ++ void onDrawerOpen(OnDrawerOpen value) const; ++ ++ void onDrawerClose(OnDrawerClose value) const; ++}; ++class JSI_EXPORT ActivityIndicatorViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT UnimplementedNativeViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT SwitchEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnChange { ++ bool value; ++ int target; ++ }; ++ ++ void onChange(OnChange value) const; ++}; ++class JSI_EXPORT AndroidSwitchEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnChange { ++ bool value; ++ int target; ++ }; ++ ++ void onChange(OnChange value) const; ++}; ++class JSI_EXPORT TraceUpdateOverlayEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT ModalHostViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnRequestClose { ++ ++ }; ++ ++ struct OnShow { ++ ++ }; ++ ++ struct OnDismiss { ++ ++ }; ++ ++ enum class OnOrientationChangeOrientation { ++ Portrait, ++ Landscape ++ }; ++ ++ static char const *toString(const OnOrientationChangeOrientation value) { ++ switch (value) { ++ case OnOrientationChangeOrientation::Portrait: return "portrait"; ++ case OnOrientationChangeOrientation::Landscape: return "landscape"; ++ } ++ } ++ ++ struct OnOrientationChange { ++ OnOrientationChangeOrientation orientation; ++ }; ++ ++ void onRequestClose(OnRequestClose value) const; ++ ++ void onShow(OnShow value) const; ++ ++ void onDismiss(OnDismiss value) const; ++ ++ void onOrientationChange(OnOrientationChange value) const; ++}; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp +new file mode 100644 +index 0000000..59f24e5 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp +@@ -0,0 +1,157 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GeneratePropsCpp.js ++ */ ++ ++#include ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++SafeAreaViewProps::SafeAreaViewProps( ++ const PropsParserContext &context, ++ const SafeAreaViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) ++ ++ ++ {} ++AndroidHorizontalScrollContentViewProps::AndroidHorizontalScrollContentViewProps( ++ const PropsParserContext &context, ++ const AndroidHorizontalScrollContentViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ removeClippedSubviews(convertRawProp(context, rawProps, "removeClippedSubviews", sourceProps.removeClippedSubviews, {false})) ++ {} ++AndroidProgressBarProps::AndroidProgressBarProps( ++ const PropsParserContext &context, ++ const AndroidProgressBarProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ styleAttr(convertRawProp(context, rawProps, "styleAttr", sourceProps.styleAttr, {})), ++ typeAttr(convertRawProp(context, rawProps, "typeAttr", sourceProps.typeAttr, {})), ++ indeterminate(convertRawProp(context, rawProps, "indeterminate", sourceProps.indeterminate, {false})), ++ progress(convertRawProp(context, rawProps, "progress", sourceProps.progress, {0.0})), ++ animating(convertRawProp(context, rawProps, "animating", sourceProps.animating, {true})), ++ color(convertRawProp(context, rawProps, "color", sourceProps.color, {})), ++ testID(convertRawProp(context, rawProps, "testID", sourceProps.testID, {""})) ++ {} ++AndroidSwipeRefreshLayoutProps::AndroidSwipeRefreshLayoutProps( ++ const PropsParserContext &context, ++ const AndroidSwipeRefreshLayoutProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ enabled(convertRawProp(context, rawProps, "enabled", sourceProps.enabled, {true})), ++ colors(convertRawProp(context, rawProps, "colors", sourceProps.colors, {})), ++ progressBackgroundColor(convertRawProp(context, rawProps, "progressBackgroundColor", sourceProps.progressBackgroundColor, {})), ++ size(convertRawProp(context, rawProps, "size", sourceProps.size, {AndroidSwipeRefreshLayoutSize::Default})), ++ progressViewOffset(convertRawProp(context, rawProps, "progressViewOffset", sourceProps.progressViewOffset, {0.0})), ++ refreshing(convertRawProp(context, rawProps, "refreshing", sourceProps.refreshing, {false})) ++ {} ++PullToRefreshViewProps::PullToRefreshViewProps( ++ const PropsParserContext &context, ++ const PullToRefreshViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ tintColor(convertRawProp(context, rawProps, "tintColor", sourceProps.tintColor, {})), ++ titleColor(convertRawProp(context, rawProps, "titleColor", sourceProps.titleColor, {})), ++ title(convertRawProp(context, rawProps, "title", sourceProps.title, {})), ++ progressViewOffset(convertRawProp(context, rawProps, "progressViewOffset", sourceProps.progressViewOffset, {0.0})), ++ refreshing(convertRawProp(context, rawProps, "refreshing", sourceProps.refreshing, {false})) ++ {} ++InputAccessoryProps::InputAccessoryProps( ++ const PropsParserContext &context, ++ const InputAccessoryProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ backgroundColor(convertRawProp(context, rawProps, "backgroundColor", sourceProps.backgroundColor, {})) ++ {} ++AndroidDrawerLayoutProps::AndroidDrawerLayoutProps( ++ const PropsParserContext &context, ++ const AndroidDrawerLayoutProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ keyboardDismissMode(convertRawProp(context, rawProps, "keyboardDismissMode", sourceProps.keyboardDismissMode, {AndroidDrawerLayoutKeyboardDismissMode::None})), ++ drawerBackgroundColor(convertRawProp(context, rawProps, "drawerBackgroundColor", sourceProps.drawerBackgroundColor, {})), ++ drawerPosition(convertRawProp(context, rawProps, "drawerPosition", sourceProps.drawerPosition, {AndroidDrawerLayoutDrawerPosition::Left})), ++ drawerWidth(convertRawProp(context, rawProps, "drawerWidth", sourceProps.drawerWidth, {})), ++ drawerLockMode(convertRawProp(context, rawProps, "drawerLockMode", sourceProps.drawerLockMode, {AndroidDrawerLayoutDrawerLockMode::Unlocked})), ++ statusBarBackgroundColor(convertRawProp(context, rawProps, "statusBarBackgroundColor", sourceProps.statusBarBackgroundColor, {})) ++ {} ++ActivityIndicatorViewProps::ActivityIndicatorViewProps( ++ const PropsParserContext &context, ++ const ActivityIndicatorViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ hidesWhenStopped(convertRawProp(context, rawProps, "hidesWhenStopped", sourceProps.hidesWhenStopped, {false})), ++ animating(convertRawProp(context, rawProps, "animating", sourceProps.animating, {false})), ++ color(convertRawProp(context, rawProps, "color", sourceProps.color, {})), ++ size(convertRawProp(context, rawProps, "size", sourceProps.size, {ActivityIndicatorViewSize::Small})) ++ {} ++UnimplementedNativeViewProps::UnimplementedNativeViewProps( ++ const PropsParserContext &context, ++ const UnimplementedNativeViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ name(convertRawProp(context, rawProps, "name", sourceProps.name, {""})) ++ {} ++SwitchProps::SwitchProps( ++ const PropsParserContext &context, ++ const SwitchProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ disabled(convertRawProp(context, rawProps, "disabled", sourceProps.disabled, {false})), ++ value(convertRawProp(context, rawProps, "value", sourceProps.value, {false})), ++ tintColor(convertRawProp(context, rawProps, "tintColor", sourceProps.tintColor, {})), ++ onTintColor(convertRawProp(context, rawProps, "onTintColor", sourceProps.onTintColor, {})), ++ thumbTintColor(convertRawProp(context, rawProps, "thumbTintColor", sourceProps.thumbTintColor, {})), ++ thumbColor(convertRawProp(context, rawProps, "thumbColor", sourceProps.thumbColor, {})), ++ trackColorForFalse(convertRawProp(context, rawProps, "trackColorForFalse", sourceProps.trackColorForFalse, {})), ++ trackColorForTrue(convertRawProp(context, rawProps, "trackColorForTrue", sourceProps.trackColorForTrue, {})) ++ {} ++AndroidSwitchProps::AndroidSwitchProps( ++ const PropsParserContext &context, ++ const AndroidSwitchProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ disabled(convertRawProp(context, rawProps, "disabled", sourceProps.disabled, {false})), ++ enabled(convertRawProp(context, rawProps, "enabled", sourceProps.enabled, {true})), ++ thumbColor(convertRawProp(context, rawProps, "thumbColor", sourceProps.thumbColor, {})), ++ trackColorForFalse(convertRawProp(context, rawProps, "trackColorForFalse", sourceProps.trackColorForFalse, {})), ++ trackColorForTrue(convertRawProp(context, rawProps, "trackColorForTrue", sourceProps.trackColorForTrue, {})), ++ value(convertRawProp(context, rawProps, "value", sourceProps.value, {false})), ++ on(convertRawProp(context, rawProps, "on", sourceProps.on, {false})), ++ thumbTintColor(convertRawProp(context, rawProps, "thumbTintColor", sourceProps.thumbTintColor, {})), ++ trackTintColor(convertRawProp(context, rawProps, "trackTintColor", sourceProps.trackTintColor, {})) ++ {} ++TraceUpdateOverlayProps::TraceUpdateOverlayProps( ++ const PropsParserContext &context, ++ const TraceUpdateOverlayProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) ++ ++ ++ {} ++ModalHostViewProps::ModalHostViewProps( ++ const PropsParserContext &context, ++ const ModalHostViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ animationType(convertRawProp(context, rawProps, "animationType", sourceProps.animationType, {ModalHostViewAnimationType::None})), ++ presentationStyle(convertRawProp(context, rawProps, "presentationStyle", sourceProps.presentationStyle, {ModalHostViewPresentationStyle::FullScreen})), ++ transparent(convertRawProp(context, rawProps, "transparent", sourceProps.transparent, {false})), ++ statusBarTranslucent(convertRawProp(context, rawProps, "statusBarTranslucent", sourceProps.statusBarTranslucent, {false})), ++ hardwareAccelerated(convertRawProp(context, rawProps, "hardwareAccelerated", sourceProps.hardwareAccelerated, {false})), ++ visible(convertRawProp(context, rawProps, "visible", sourceProps.visible, {false})), ++ animated(convertRawProp(context, rawProps, "animated", sourceProps.animated, {false})), ++ supportedOrientations(convertRawProp(context, rawProps, "supportedOrientations", sourceProps.supportedOrientations, {static_cast(ModalHostViewSupportedOrientations::Portrait)})), ++ identifier(convertRawProp(context, rawProps, "identifier", sourceProps.identifier, {0})) ++ {} ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h +new file mode 100644 +index 0000000..f402340 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h +@@ -0,0 +1,395 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GeneratePropsH.js ++ */ ++#pragma once ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++class JSI_EXPORT SafeAreaViewProps final : public ViewProps { ++ public: ++ SafeAreaViewProps() = default; ++ SafeAreaViewProps(const PropsParserContext& context, const SafeAreaViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ ++}; ++ ++class JSI_EXPORT AndroidHorizontalScrollContentViewProps final : public ViewProps { ++ public: ++ AndroidHorizontalScrollContentViewProps() = default; ++ AndroidHorizontalScrollContentViewProps(const PropsParserContext& context, const AndroidHorizontalScrollContentViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool removeClippedSubviews{false}; ++}; ++ ++class JSI_EXPORT AndroidProgressBarProps final : public ViewProps { ++ public: ++ AndroidProgressBarProps() = default; ++ AndroidProgressBarProps(const PropsParserContext& context, const AndroidProgressBarProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ std::string styleAttr{}; ++ std::string typeAttr{}; ++ bool indeterminate{false}; ++ double progress{0.0}; ++ bool animating{true}; ++ SharedColor color{}; ++ std::string testID{""}; ++}; ++ ++enum class AndroidSwipeRefreshLayoutSize { Default, Large }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidSwipeRefreshLayoutSize &result) { ++ auto string = (std::string)value; ++ if (string == "default") { result = AndroidSwipeRefreshLayoutSize::Default; return; } ++ if (string == "large") { result = AndroidSwipeRefreshLayoutSize::Large; return; } ++ abort(); ++} ++ ++static inline std::string toString(const AndroidSwipeRefreshLayoutSize &value) { ++ switch (value) { ++ case AndroidSwipeRefreshLayoutSize::Default: return "default"; ++ case AndroidSwipeRefreshLayoutSize::Large: return "large"; ++ } ++} ++ ++class JSI_EXPORT AndroidSwipeRefreshLayoutProps final : public ViewProps { ++ public: ++ AndroidSwipeRefreshLayoutProps() = default; ++ AndroidSwipeRefreshLayoutProps(const PropsParserContext& context, const AndroidSwipeRefreshLayoutProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool enabled{true}; ++ std::vector colors{}; ++ SharedColor progressBackgroundColor{}; ++ AndroidSwipeRefreshLayoutSize size{AndroidSwipeRefreshLayoutSize::Default}; ++ Float progressViewOffset{0.0}; ++ bool refreshing{false}; ++}; ++ ++class JSI_EXPORT PullToRefreshViewProps final : public ViewProps { ++ public: ++ PullToRefreshViewProps() = default; ++ PullToRefreshViewProps(const PropsParserContext& context, const PullToRefreshViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ SharedColor tintColor{}; ++ SharedColor titleColor{}; ++ std::string title{}; ++ Float progressViewOffset{0.0}; ++ bool refreshing{false}; ++}; ++ ++class JSI_EXPORT InputAccessoryProps final : public ViewProps { ++ public: ++ InputAccessoryProps() = default; ++ InputAccessoryProps(const PropsParserContext& context, const InputAccessoryProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ SharedColor backgroundColor{}; ++}; ++ ++enum class AndroidDrawerLayoutKeyboardDismissMode { None, OnDrag }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutKeyboardDismissMode &result) { ++ auto string = (std::string)value; ++ if (string == "none") { result = AndroidDrawerLayoutKeyboardDismissMode::None; return; } ++ if (string == "on-drag") { result = AndroidDrawerLayoutKeyboardDismissMode::OnDrag; return; } ++ abort(); ++} ++ ++static inline std::string toString(const AndroidDrawerLayoutKeyboardDismissMode &value) { ++ switch (value) { ++ case AndroidDrawerLayoutKeyboardDismissMode::None: return "none"; ++ case AndroidDrawerLayoutKeyboardDismissMode::OnDrag: return "on-drag"; ++ } ++} ++enum class AndroidDrawerLayoutDrawerPosition { Left, Right }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutDrawerPosition &result) { ++ auto string = (std::string)value; ++ if (string == "left") { result = AndroidDrawerLayoutDrawerPosition::Left; return; } ++ if (string == "right") { result = AndroidDrawerLayoutDrawerPosition::Right; return; } ++ abort(); ++} ++ ++static inline std::string toString(const AndroidDrawerLayoutDrawerPosition &value) { ++ switch (value) { ++ case AndroidDrawerLayoutDrawerPosition::Left: return "left"; ++ case AndroidDrawerLayoutDrawerPosition::Right: return "right"; ++ } ++} ++enum class AndroidDrawerLayoutDrawerLockMode { Unlocked, LockedClosed, LockedOpen }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutDrawerLockMode &result) { ++ auto string = (std::string)value; ++ if (string == "unlocked") { result = AndroidDrawerLayoutDrawerLockMode::Unlocked; return; } ++ if (string == "locked-closed") { result = AndroidDrawerLayoutDrawerLockMode::LockedClosed; return; } ++ if (string == "locked-open") { result = AndroidDrawerLayoutDrawerLockMode::LockedOpen; return; } ++ abort(); ++} ++ ++static inline std::string toString(const AndroidDrawerLayoutDrawerLockMode &value) { ++ switch (value) { ++ case AndroidDrawerLayoutDrawerLockMode::Unlocked: return "unlocked"; ++ case AndroidDrawerLayoutDrawerLockMode::LockedClosed: return "locked-closed"; ++ case AndroidDrawerLayoutDrawerLockMode::LockedOpen: return "locked-open"; ++ } ++} ++ ++class JSI_EXPORT AndroidDrawerLayoutProps final : public ViewProps { ++ public: ++ AndroidDrawerLayoutProps() = default; ++ AndroidDrawerLayoutProps(const PropsParserContext& context, const AndroidDrawerLayoutProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ AndroidDrawerLayoutKeyboardDismissMode keyboardDismissMode{AndroidDrawerLayoutKeyboardDismissMode::None}; ++ SharedColor drawerBackgroundColor{}; ++ AndroidDrawerLayoutDrawerPosition drawerPosition{AndroidDrawerLayoutDrawerPosition::Left}; ++ Float drawerWidth{}; ++ AndroidDrawerLayoutDrawerLockMode drawerLockMode{AndroidDrawerLayoutDrawerLockMode::Unlocked}; ++ SharedColor statusBarBackgroundColor{}; ++}; ++ ++enum class ActivityIndicatorViewSize { Small, Large }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ActivityIndicatorViewSize &result) { ++ auto string = (std::string)value; ++ if (string == "small") { result = ActivityIndicatorViewSize::Small; return; } ++ if (string == "large") { result = ActivityIndicatorViewSize::Large; return; } ++ abort(); ++} ++ ++static inline std::string toString(const ActivityIndicatorViewSize &value) { ++ switch (value) { ++ case ActivityIndicatorViewSize::Small: return "small"; ++ case ActivityIndicatorViewSize::Large: return "large"; ++ } ++} ++ ++class JSI_EXPORT ActivityIndicatorViewProps final : public ViewProps { ++ public: ++ ActivityIndicatorViewProps() = default; ++ ActivityIndicatorViewProps(const PropsParserContext& context, const ActivityIndicatorViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool hidesWhenStopped{false}; ++ bool animating{false}; ++ SharedColor color{}; ++ ActivityIndicatorViewSize size{ActivityIndicatorViewSize::Small}; ++}; ++ ++class JSI_EXPORT UnimplementedNativeViewProps final : public ViewProps { ++ public: ++ UnimplementedNativeViewProps() = default; ++ UnimplementedNativeViewProps(const PropsParserContext& context, const UnimplementedNativeViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ std::string name{""}; ++}; ++ ++class JSI_EXPORT SwitchProps final : public ViewProps { ++ public: ++ SwitchProps() = default; ++ SwitchProps(const PropsParserContext& context, const SwitchProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool disabled{false}; ++ bool value{false}; ++ SharedColor tintColor{}; ++ SharedColor onTintColor{}; ++ SharedColor thumbTintColor{}; ++ SharedColor thumbColor{}; ++ SharedColor trackColorForFalse{}; ++ SharedColor trackColorForTrue{}; ++}; ++ ++class JSI_EXPORT AndroidSwitchProps final : public ViewProps { ++ public: ++ AndroidSwitchProps() = default; ++ AndroidSwitchProps(const PropsParserContext& context, const AndroidSwitchProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool disabled{false}; ++ bool enabled{true}; ++ SharedColor thumbColor{}; ++ SharedColor trackColorForFalse{}; ++ SharedColor trackColorForTrue{}; ++ bool value{false}; ++ bool on{false}; ++ SharedColor thumbTintColor{}; ++ SharedColor trackTintColor{}; ++}; ++ ++class JSI_EXPORT TraceUpdateOverlayProps final : public ViewProps { ++ public: ++ TraceUpdateOverlayProps() = default; ++ TraceUpdateOverlayProps(const PropsParserContext& context, const TraceUpdateOverlayProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ ++}; ++ ++enum class ModalHostViewAnimationType { None, Slide, Fade }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewAnimationType &result) { ++ auto string = (std::string)value; ++ if (string == "none") { result = ModalHostViewAnimationType::None; return; } ++ if (string == "slide") { result = ModalHostViewAnimationType::Slide; return; } ++ if (string == "fade") { result = ModalHostViewAnimationType::Fade; return; } ++ abort(); ++} ++ ++static inline std::string toString(const ModalHostViewAnimationType &value) { ++ switch (value) { ++ case ModalHostViewAnimationType::None: return "none"; ++ case ModalHostViewAnimationType::Slide: return "slide"; ++ case ModalHostViewAnimationType::Fade: return "fade"; ++ } ++} ++enum class ModalHostViewPresentationStyle { FullScreen, PageSheet, FormSheet, OverFullScreen }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewPresentationStyle &result) { ++ auto string = (std::string)value; ++ if (string == "fullScreen") { result = ModalHostViewPresentationStyle::FullScreen; return; } ++ if (string == "pageSheet") { result = ModalHostViewPresentationStyle::PageSheet; return; } ++ if (string == "formSheet") { result = ModalHostViewPresentationStyle::FormSheet; return; } ++ if (string == "overFullScreen") { result = ModalHostViewPresentationStyle::OverFullScreen; return; } ++ abort(); ++} ++ ++static inline std::string toString(const ModalHostViewPresentationStyle &value) { ++ switch (value) { ++ case ModalHostViewPresentationStyle::FullScreen: return "fullScreen"; ++ case ModalHostViewPresentationStyle::PageSheet: return "pageSheet"; ++ case ModalHostViewPresentationStyle::FormSheet: return "formSheet"; ++ case ModalHostViewPresentationStyle::OverFullScreen: return "overFullScreen"; ++ } ++} ++using ModalHostViewSupportedOrientationsMask = uint32_t; ++ ++enum class ModalHostViewSupportedOrientations: ModalHostViewSupportedOrientationsMask { ++ Portrait = 1 << 0, ++ PortraitUpsideDown = 1 << 1, ++ Landscape = 1 << 2, ++ LandscapeLeft = 1 << 3, ++ LandscapeRight = 1 << 4 ++}; ++ ++constexpr bool operator&( ++ ModalHostViewSupportedOrientationsMask const lhs, ++ enum ModalHostViewSupportedOrientations const rhs) { ++ return lhs & static_cast(rhs); ++} ++ ++constexpr ModalHostViewSupportedOrientationsMask operator|( ++ ModalHostViewSupportedOrientationsMask const lhs, ++ enum ModalHostViewSupportedOrientations const rhs) { ++ return lhs | static_cast(rhs); ++} ++ ++constexpr void operator|=( ++ ModalHostViewSupportedOrientationsMask &lhs, ++ enum ModalHostViewSupportedOrientations const rhs) { ++ lhs = lhs | static_cast(rhs); ++} ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewSupportedOrientationsMask &result) { ++ auto items = std::vector{value}; ++ for (const auto &item : items) { ++ if (item == "portrait") { ++ result |= ModalHostViewSupportedOrientations::Portrait; ++ continue; ++ } ++ if (item == "portrait-upside-down") { ++ result |= ModalHostViewSupportedOrientations::PortraitUpsideDown; ++ continue; ++ } ++ if (item == "landscape") { ++ result |= ModalHostViewSupportedOrientations::Landscape; ++ continue; ++ } ++ if (item == "landscape-left") { ++ result |= ModalHostViewSupportedOrientations::LandscapeLeft; ++ continue; ++ } ++ if (item == "landscape-right") { ++ result |= ModalHostViewSupportedOrientations::LandscapeRight; ++ continue; ++ } ++ abort(); ++ } ++} ++ ++static inline std::string toString(const ModalHostViewSupportedOrientationsMask &value) { ++ auto result = std::string{}; ++ auto separator = std::string{", "}; ++ ++ if (value & ModalHostViewSupportedOrientations::Portrait) { ++ result += "portrait" + separator; ++ } ++ if (value & ModalHostViewSupportedOrientations::PortraitUpsideDown) { ++ result += "portrait-upside-down" + separator; ++ } ++ if (value & ModalHostViewSupportedOrientations::Landscape) { ++ result += "landscape" + separator; ++ } ++ if (value & ModalHostViewSupportedOrientations::LandscapeLeft) { ++ result += "landscape-left" + separator; ++ } ++ if (value & ModalHostViewSupportedOrientations::LandscapeRight) { ++ result += "landscape-right" + separator; ++ } ++ if (!result.empty()) { ++ result.erase(result.length() - separator.length()); ++ } ++ return result; ++} ++ ++class JSI_EXPORT ModalHostViewProps final : public ViewProps { ++ public: ++ ModalHostViewProps() = default; ++ ModalHostViewProps(const PropsParserContext& context, const ModalHostViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ ModalHostViewAnimationType animationType{ModalHostViewAnimationType::None}; ++ ModalHostViewPresentationStyle presentationStyle{ModalHostViewPresentationStyle::FullScreen}; ++ bool transparent{false}; ++ bool statusBarTranslucent{false}; ++ bool hardwareAccelerated{false}; ++ bool visible{false}; ++ bool animated{false}; ++ ModalHostViewSupportedOrientationsMask supportedOrientations{static_cast(ModalHostViewSupportedOrientations::Portrait)}; ++ int identifier{0}; ++}; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h +new file mode 100644 +index 0000000..e08f2ae +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h +@@ -0,0 +1,257 @@ ++/** ++* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++* ++* Do not edit this file as changes may cause incorrect behavior and will be lost ++* once the code is regenerated. ++* ++* @generated by codegen project: GenerateComponentHObjCpp.js ++*/ ++ ++#import ++#import ++#import ++ ++NS_ASSUME_NONNULL_BEGIN ++ ++@protocol RCTSafeAreaViewViewProtocol ++ ++@end ++ ++@protocol RCTAndroidHorizontalScrollContentViewViewProtocol ++ ++@end ++ ++@protocol RCTAndroidProgressBarViewProtocol ++ ++@end ++ ++@protocol RCTAndroidSwipeRefreshLayoutViewProtocol ++- (void)setNativeRefreshing:(BOOL)value; ++@end ++ ++RCT_EXTERN inline void RCTAndroidSwipeRefreshLayoutHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"setNativeRefreshing"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidSwipeRefreshLayout", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"AndroidSwipeRefreshLayout", commandName, @"1st")) { ++ return; ++ } ++#endif ++ BOOL value = [(NSNumber *)arg0 boolValue]; ++ ++ [componentView setNativeRefreshing:value]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidSwipeRefreshLayout", commandName); ++#endif ++} ++ ++@protocol RCTPullToRefreshViewViewProtocol ++- (void)setNativeRefreshing:(BOOL)refreshing; ++@end ++ ++RCT_EXTERN inline void RCTPullToRefreshViewHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"setNativeRefreshing"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"PullToRefreshView", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"PullToRefreshView", commandName, @"1st")) { ++ return; ++ } ++#endif ++ BOOL refreshing = [(NSNumber *)arg0 boolValue]; ++ ++ [componentView setNativeRefreshing:refreshing]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"PullToRefreshView", commandName); ++#endif ++} ++ ++@protocol RCTInputAccessoryViewProtocol ++ ++@end ++ ++@protocol RCTAndroidDrawerLayoutViewProtocol ++- (void)openDrawer; ++- (void)closeDrawer; ++@end ++ ++RCT_EXTERN inline void RCTAndroidDrawerLayoutHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"openDrawer"]) { ++#if RCT_DEBUG ++ if ([args count] != 0) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidDrawerLayout", commandName, (int)[args count], 0); ++ return; ++ } ++#endif ++ ++ ++ ++ [componentView openDrawer]; ++ return; ++} ++ ++if ([commandName isEqualToString:@"closeDrawer"]) { ++#if RCT_DEBUG ++ if ([args count] != 0) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidDrawerLayout", commandName, (int)[args count], 0); ++ return; ++ } ++#endif ++ ++ ++ ++ [componentView closeDrawer]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidDrawerLayout", commandName); ++#endif ++} ++ ++@protocol RCTActivityIndicatorViewViewProtocol ++ ++@end ++ ++@protocol RCTUnimplementedNativeViewViewProtocol ++ ++@end ++ ++@protocol RCTSwitchViewProtocol ++- (void)setValue:(BOOL)value; ++@end ++ ++RCT_EXTERN inline void RCTSwitchHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"setValue"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"Switch", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"Switch", commandName, @"1st")) { ++ return; ++ } ++#endif ++ BOOL value = [(NSNumber *)arg0 boolValue]; ++ ++ [componentView setValue:value]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"Switch", commandName); ++#endif ++} ++ ++@protocol RCTAndroidSwitchViewProtocol ++- (void)setNativeValue:(BOOL)value; ++@end ++ ++RCT_EXTERN inline void RCTAndroidSwitchHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"setNativeValue"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidSwitch", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"AndroidSwitch", commandName, @"1st")) { ++ return; ++ } ++#endif ++ BOOL value = [(NSNumber *)arg0 boolValue]; ++ ++ [componentView setNativeValue:value]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidSwitch", commandName); ++#endif ++} ++ ++@protocol RCTTraceUpdateOverlayViewProtocol ++- (void)draw:(NSString *)overlays; ++@end ++ ++RCT_EXTERN inline void RCTTraceUpdateOverlayHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"draw"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"TraceUpdateOverlay", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSString class], @"string", @"TraceUpdateOverlay", commandName, @"1st")) { ++ return; ++ } ++#endif ++ NSString * overlays = (NSString *)arg0; ++ ++ [componentView draw:overlays]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"TraceUpdateOverlay", commandName); ++#endif ++} ++ ++@protocol RCTModalHostViewViewProtocol ++ ++@end ++ ++NS_ASSUME_NONNULL_END +\ No newline at end of file +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp +new file mode 100644 +index 0000000..d9a2760 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp +@@ -0,0 +1,26 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateShadowNodeCpp.js ++ */ ++ ++#include ++ ++namespace facebook { ++namespace react { ++ ++extern const char AndroidHorizontalScrollContentViewComponentName[] = "AndroidHorizontalScrollContentView"; ++extern const char AndroidSwipeRefreshLayoutComponentName[] = "AndroidSwipeRefreshLayout"; ++extern const char PullToRefreshViewComponentName[] = "PullToRefreshView"; ++extern const char AndroidDrawerLayoutComponentName[] = "AndroidDrawerLayout"; ++extern const char ActivityIndicatorViewComponentName[] = "ActivityIndicatorView"; ++extern const char UnimplementedNativeViewComponentName[] = "UnimplementedNativeView"; ++extern const char SwitchComponentName[] = "Switch"; ++extern const char TraceUpdateOverlayComponentName[] = "TraceUpdateOverlay"; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h +new file mode 100644 +index 0000000..a5874dc +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h +@@ -0,0 +1,111 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateShadowNodeH.js ++ */ ++ ++#pragma once ++ ++#include ++#include ++#include ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++JSI_EXPORT extern const char AndroidHorizontalScrollContentViewComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using AndroidHorizontalScrollContentViewShadowNode = ConcreteViewShadowNode< ++ AndroidHorizontalScrollContentViewComponentName, ++ AndroidHorizontalScrollContentViewProps, ++ AndroidHorizontalScrollContentViewEventEmitter, ++ AndroidHorizontalScrollContentViewState>; ++ ++JSI_EXPORT extern const char AndroidSwipeRefreshLayoutComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using AndroidSwipeRefreshLayoutShadowNode = ConcreteViewShadowNode< ++ AndroidSwipeRefreshLayoutComponentName, ++ AndroidSwipeRefreshLayoutProps, ++ AndroidSwipeRefreshLayoutEventEmitter, ++ AndroidSwipeRefreshLayoutState>; ++ ++JSI_EXPORT extern const char PullToRefreshViewComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using PullToRefreshViewShadowNode = ConcreteViewShadowNode< ++ PullToRefreshViewComponentName, ++ PullToRefreshViewProps, ++ PullToRefreshViewEventEmitter, ++ PullToRefreshViewState>; ++ ++JSI_EXPORT extern const char AndroidDrawerLayoutComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using AndroidDrawerLayoutShadowNode = ConcreteViewShadowNode< ++ AndroidDrawerLayoutComponentName, ++ AndroidDrawerLayoutProps, ++ AndroidDrawerLayoutEventEmitter, ++ AndroidDrawerLayoutState>; ++ ++JSI_EXPORT extern const char ActivityIndicatorViewComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using ActivityIndicatorViewShadowNode = ConcreteViewShadowNode< ++ ActivityIndicatorViewComponentName, ++ ActivityIndicatorViewProps, ++ ActivityIndicatorViewEventEmitter, ++ ActivityIndicatorViewState>; ++ ++JSI_EXPORT extern const char UnimplementedNativeViewComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using UnimplementedNativeViewShadowNode = ConcreteViewShadowNode< ++ UnimplementedNativeViewComponentName, ++ UnimplementedNativeViewProps, ++ UnimplementedNativeViewEventEmitter, ++ UnimplementedNativeViewState>; ++ ++JSI_EXPORT extern const char SwitchComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using SwitchShadowNode = ConcreteViewShadowNode< ++ SwitchComponentName, ++ SwitchProps, ++ SwitchEventEmitter, ++ SwitchState>; ++ ++JSI_EXPORT extern const char TraceUpdateOverlayComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using TraceUpdateOverlayShadowNode = ConcreteViewShadowNode< ++ TraceUpdateOverlayComponentName, ++ TraceUpdateOverlayProps, ++ TraceUpdateOverlayEventEmitter, ++ TraceUpdateOverlayState>; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp +new file mode 100644 +index 0000000..3b5a0f5 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp +@@ -0,0 +1,18 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateStateCpp.js ++ */ ++#include ++ ++namespace facebook { ++namespace react { ++ ++ ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h +new file mode 100644 +index 0000000..29ac2df +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h +@@ -0,0 +1,141 @@ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateStateH.js ++ */ ++#pragma once ++ ++#ifdef ANDROID ++#include ++#include ++#include ++#endif ++ ++namespace facebook { ++namespace react { ++ ++class AndroidHorizontalScrollContentViewState { ++public: ++ AndroidHorizontalScrollContentViewState() = default; ++ ++#ifdef ANDROID ++ AndroidHorizontalScrollContentViewState(AndroidHorizontalScrollContentViewState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class AndroidSwipeRefreshLayoutState { ++public: ++ AndroidSwipeRefreshLayoutState() = default; ++ ++#ifdef ANDROID ++ AndroidSwipeRefreshLayoutState(AndroidSwipeRefreshLayoutState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class PullToRefreshViewState { ++public: ++ PullToRefreshViewState() = default; ++ ++#ifdef ANDROID ++ PullToRefreshViewState(PullToRefreshViewState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class AndroidDrawerLayoutState { ++public: ++ AndroidDrawerLayoutState() = default; ++ ++#ifdef ANDROID ++ AndroidDrawerLayoutState(AndroidDrawerLayoutState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class ActivityIndicatorViewState { ++public: ++ ActivityIndicatorViewState() = default; ++ ++#ifdef ANDROID ++ ActivityIndicatorViewState(ActivityIndicatorViewState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class UnimplementedNativeViewState { ++public: ++ UnimplementedNativeViewState() = default; ++ ++#ifdef ANDROID ++ UnimplementedNativeViewState(UnimplementedNativeViewState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class SwitchState { ++public: ++ SwitchState() = default; ++ ++#ifdef ANDROID ++ SwitchState(SwitchState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class TraceUpdateOverlayState { ++public: ++ TraceUpdateOverlayState() = default; ++ ++#ifdef ANDROID ++ TraceUpdateOverlayState(TraceUpdateOverlayState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++} // namespace react ++} // namespace facebook +\ No newline at end of file +diff --git a/node_modules/react-native/scripts/.packager.env b/node_modules/react-native/scripts/.packager.env +new file mode 100644 +index 0000000..361f5fb +--- /dev/null ++++ b/node_modules/react-native/scripts/.packager.env +@@ -0,0 +1 @@ ++export RCT_METRO_PORT=8081 +diff --git a/node_modules/react-native/sdks/hermes/hermes-engine.podspec b/node_modules/react-native/sdks/hermes/hermes-engine.podspec +new file mode 100644 +index 0000000..87d0710 +--- /dev/null ++++ b/node_modules/react-native/sdks/hermes/hermes-engine.podspec +@@ -0,0 +1,114 @@ ++# Copyright (c) Meta Platforms, Inc. and affiliates. ++# ++# This source code is licensed under the MIT license found in the ++# LICENSE file in the root directory of this source tree. ++ ++require "json" ++require_relative "./hermes-utils.rb" ++ ++react_native_path = File.join(__dir__, "..", "..") ++ ++# Whether Hermes is built for Release or Debug is determined by the PRODUCTION envvar. ++build_type = ENV['PRODUCTION'] == "1" ? :release : :debug ++ ++# package.json ++package = JSON.parse(File.read(File.join(react_native_path, "package.json"))) ++version = package['version'] ++ ++# sdks/.hermesversion ++hermestag_file = File.join(react_native_path, "sdks", ".hermesversion") ++build_from_source = ENV['BUILD_FROM_SOURCE'] === 'true' ++ ++git = "https://github.com/facebook/hermes.git" ++ ++abort_if_invalid_tarball_provided! ++ ++source = compute_hermes_source(build_from_source, hermestag_file, git, version, build_type, react_native_path) ++ ++Pod::Spec.new do |spec| ++ spec.name = "hermes-engine" ++ spec.version = version ++ spec.summary = "Hermes is a small and lightweight JavaScript engine optimized for running React Native." ++ spec.description = "Hermes is a JavaScript engine optimized for fast start-up of React Native apps. It features ahead-of-time static optimization and compact bytecode." ++ spec.homepage = "https://hermesengine.dev" ++ spec.license = package['license'] ++ spec.author = "Facebook" ++ spec.source = source ++ spec.platforms = { :osx => "10.13", :ios => "12.4" } ++ ++ spec.preserve_paths = '**/*.*' ++ spec.source_files = '' ++ ++ spec.pod_target_xcconfig = { ++ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", ++ "CLANG_CXX_LIBRARY" => "compiler-default" ++ }.merge!(build_type == :debug ? { "GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=1" } : {}) ++ ++ spec.ios.vendored_frameworks = "destroot/Library/Frameworks/ios/hermes.framework" ++ spec.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework" ++ ++ if source[:http] then ++ ++ spec.subspec 'Pre-built' do |ss| ++ ss.preserve_paths = ["destroot/bin/*"].concat(build_type == :debug ? ["**/*.{h,c,cpp}"] : []) ++ ss.source_files = "destroot/include/**/*.h" ++ ss.exclude_files = ["destroot/include/jsi/jsi/JSIDynamic.{h,cpp}", "destroot/include/jsi/jsi/jsilib-*.{h,cpp}"] ++ ss.header_mappings_dir = "destroot/include" ++ ss.ios.vendored_frameworks = "destroot/Library/Frameworks/universal/hermes.xcframework" ++ ss.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework" ++ end ++ ++ elsif source[:git] then ++ ++ spec.subspec 'Hermes' do |ss| ++ ss.source_files = '' ++ ss.public_header_files = 'API/hermes/*.h' ++ ss.header_dir = 'hermes' ++ end ++ ++ spec.subspec 'JSI' do |ss| ++ ss.source_files = '' ++ ss.public_header_files = 'API/jsi/jsi/*.h' ++ ss.header_dir = 'jsi' ++ end ++ ++ spec.subspec 'Public' do |ss| ++ ss.source_files = '' ++ ss.public_header_files = 'public/hermes/Public/*.h' ++ ss.header_dir = 'hermes/Public' ++ end ++ ++ hermesc_path = "${PODS_ROOT}/hermes-engine/build_host_hermesc" ++ ++ if ENV.has_key?('HERMES_OVERRIDE_HERMESC_PATH') && File.exist?(ENV['HERMES_OVERRIDE_HERMESC_PATH']) then ++ hermesc_path = ENV['HERMES_OVERRIDE_HERMESC_PATH'] ++ end ++ ++ spec.user_target_xcconfig = { ++ 'HERMES_CLI_PATH' => "#{hermesc_path}/bin/hermesc" ++ } ++ ++ spec.prepare_command = ". #{react_native_path}/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh" ++ ++ CMAKE_BINARY = %x(command -v cmake | tr -d '\n') ++ # NOTE: Script phases are sorted alphabetically inside Xcode project ++ spec.script_phases = [ ++ { ++ :name => '[RN] [1] Build Hermesc', ++ :script => <<-EOS ++ . ${PODS_ROOT}/../.xcode.env ++ export CMAKE_BINARY=${CMAKE_BINARY:-#{CMAKE_BINARY}} ++ . ${REACT_NATIVE_PATH}/sdks/hermes-engine/utils/build-hermesc-xcode.sh #{hermesc_path} ++ EOS ++ }, ++ { ++ :name => '[RN] [2] Build Hermes', ++ :script => <<-EOS ++ . ${PODS_ROOT}/../.xcode.env ++ export CMAKE_BINARY=${CMAKE_BINARY:-#{CMAKE_BINARY}} ++ . ${REACT_NATIVE_PATH}/sdks/hermes-engine/utils/build-hermes-xcode.sh #{version} #{hermesc_path}/ImportHermesc.cmake ++ EOS ++ } ++ ] ++ end ++end +diff --git a/node_modules/react-native/sdks/hermes/hermes-utils.rb b/node_modules/react-native/sdks/hermes/hermes-utils.rb +new file mode 100644 +index 0000000..06f3644 +--- /dev/null ++++ b/node_modules/react-native/sdks/hermes/hermes-utils.rb +@@ -0,0 +1,144 @@ ++# Copyright (c) Meta Platforms, Inc. and affiliates. ++# ++# This source code is licensed under the MIT license found in the ++# LICENSE file in the root directory of this source tree. ++ ++require 'net/http' ++require 'rexml/document' ++ ++# This function abort the build if the `HERMES_ENGINE_TARBALL_PATH` ENV variable is set with an invalid path ++def abort_if_invalid_tarball_provided!() ++ if ENV.has_key?('HERMES_ENGINE_TARBALL_PATH') && !File.exist?(ENV['HERMES_ENGINE_TARBALL_PATH']) ++ abort "[Hermes] HERMES_ENGINE_TARBALL_PATH is set, but points to a non-existing file: \"#{ENV['HERMES_ENGINE_TARBALL_PATH']}\"\nIf you don't want to use tarball, run `unset HERMES_ENGINE_TARBALL_PATH`" ++ end ++end ++ ++# It computes the right value for the hermes-engine.podspec's source. ++# - To use a specific tarball, install the dependencies with: ++# `HERMES_ENGINE_TARBALL_PATH= bundle exec pod install` ++# - To force a build from source, install the dependencies with: ++# `BUILD_FROM_SOURCE=true bundle exec pod install` ++# If none of the two are provided, Cocoapods will check whether there is a tarball for the current version ++# (either release or nightly). If not, it will fall back building from source (the latest commit on main). ++# ++# Parameters: ++# - build_from_source: boolean to force a build from source. ++# - hermestag_file: path to the hermes tag file. ++# - git: uri to the hermes repository ++# - version: current version of the pod ++# - build_type: build type of the hermes engine. It can be `:release` or `:debug` ++# - react_native_path: path to react native ++# ++# Returns: a properly configured source object ++def compute_hermes_source(build_from_source, hermestag_file, git, version, build_type, react_native_path) ++ source = {} ++ ++ if ENV.has_key?('HERMES_ENGINE_TARBALL_PATH') ++ use_tarball(source) ++ elsif build_from_source ++ if File.exist?(hermestag_file) ++ build_from_tagfile(source, git, hermestag_file) ++ else ++ build_hermes_from_source(source, git) ++ end ++ elsif hermes_artifact_exists(release_tarball_url(version, build_type)) ++ use_release_tarball(source, version, build_type) ++ elsif hermes_artifact_exists(nightly_tarball_url(version).gsub("\\", "")) ++ use_nightly_tarball(source, react_native_path, version) ++ else ++ build_hermes_from_source(source, git) ++ end ++ ++ return source ++end ++ ++def use_tarball(source) ++ tarball_path = ENV['HERMES_ENGINE_TARBALL_PATH'] ++ putsIfPodPresent("[Hermes] Using pre-built Hermes binaries from local path: #{tarball_path}") ++ source[:http] = "file://#{tarball_path}" ++end ++ ++def build_from_tagfile(source, git, hermestag_file) ++ hermestag = File.read(hermestag_file).strip ++ putsIfPodPresent("[Hermes] Building Hermes from source from tag #{hermestag}...") ++ source[:git] = git ++ source[:tag] = hermestag ++end ++ ++def use_release_tarball(source, version, build_type) ++ # Sample url from Maven: ++ # https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.71.0/react-native-artifacts-0.71.0-hermes-ios-debug.tar.gz ++ putsIfPodPresent('[Hermes] Using the release tarball from Maven Central', 'info') ++ source[:http] = release_tarball_url(version, build_type) ++end ++ ++def release_tarball_url(version, build_type) ++ return "https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/#{version}/react-native-artifacts-#{version}-hermes-ios-#{build_type.to_s}.tar.gz" ++end ++ ++def use_nightly_tarball(source, react_native_path, version) ++ putsIfPodPresent('[Hermes] Nightly version, download pre-built for Hermes') ++ destination_path = download_nightly_hermes(react_native_path, version) ++ # set tarball as hermes engine ++ source[:http] = "file://#{destination_path}" ++end ++ ++def putsIfPodPresent(message, level = 'warning') ++ unless Object.const_defined?("Pod::UI") ++ return ++ end ++ ++ case level ++ when 'info' ++ Pod::UI.puts message.green ++ when 'error' ++ Pod::UI.puts message.red ++ else ++ Pod::UI.puts message.yellow ++ end ++end ++ ++# This function downloads the nightly prebuilt version of Hermes based on the passed version ++# and save it in the node_module/react_native/sdks/downloads folder ++# It then returns the path to the hermes tarball ++# ++# Parameters ++# - react_native_path: the path to the React Native folder in node modules. It is used as root path to store the Hermes tarball ++# - version: the version of React Native that requires the Hermes tarball ++# Returns: the path to the downloaded Hermes tarball ++def download_nightly_hermes(react_native_path, version) ++ tarball_url = nightly_tarball_url(version) ++ ++ destination_folder = "#{react_native_path}/sdks/downloads" ++ destination_path = "#{destination_folder}/hermes-ios-#{version}.tar.gz" ++ ++ unless File.exist?(destination_path) ++ # Download to a temporary file first so we don't cache incomplete downloads. ++ tmp_file = "#{destination_folder}/hermes-ios.download" ++ `mkdir -p "#{destination_folder}" && curl "#{tarball_url}" -Lo "#{tmp_file}" && mv "#{tmp_file}" "#{destination_path}"` ++ end ++ return destination_path ++end ++ ++def nightly_tarball_url(version) ++ params = "r=snapshots\&g=com.facebook.react\&a=react-native-artifacts\&c=hermes-ios-debug\&e=tar.gz\&v=#{version}-SNAPSHOT" ++ return "http://oss.sonatype.org/service/local/artifact/maven/redirect\?#{params}" ++end ++ ++def build_hermes_from_source(source, git) ++ putsIfPodPresent('[Hermes] Installing hermes-engine may take slightly longer, building Hermes compiler from source...') ++ source[:git] = git ++ source[:commit] = `git ls-remote https://github.com/facebook/hermes main | cut -f 1`.strip ++end ++ ++# This function checks that Hermes artifact exists. ++# As of now it should check it on the Maven repo. ++# ++# Parameters ++# - version: the version of React Native ++# - build_type: debug or release ++def hermes_artifact_exists(tarball_url) ++ # -L is used to follow redirects, useful for the nightlies ++ # I also needed to wrap the url in quotes to avoid escaping & and ?. ++ return (`curl -o /dev/null --silent -Iw '%{http_code}' -L "#{tarball_url}"` == "200") ++end From d64cf5be74d682ffadb30fffc4238aef5873a300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 29 Jan 2024 11:44:27 -0300 Subject: [PATCH 05/47] chore: removed unused diff from react-native patch --- patches/react-native+0.72.5.patch | 1770 ----------------------------- 1 file changed, 1770 deletions(-) diff --git a/patches/react-native+0.72.5.patch b/patches/react-native+0.72.5.patch index c79cd9fcf..621552792 100644 --- a/patches/react-native+0.72.5.patch +++ b/patches/react-native+0.72.5.patch @@ -11,1773 +11,3 @@ index 25377f6..4f902d9 100644 require('./setUpRegeneratorRuntime'); require('./setUpTimers'); require('./setUpXHR'); -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h -new file mode 100644 -index 0000000..37b7d8d ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h -@@ -0,0 +1,29 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateComponentDescriptorH.js -+ */ -+ -+#pragma once -+ -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+using AndroidHorizontalScrollContentViewComponentDescriptor = ConcreteComponentDescriptor; -+using AndroidSwipeRefreshLayoutComponentDescriptor = ConcreteComponentDescriptor; -+using PullToRefreshViewComponentDescriptor = ConcreteComponentDescriptor; -+using AndroidDrawerLayoutComponentDescriptor = ConcreteComponentDescriptor; -+using ActivityIndicatorViewComponentDescriptor = ConcreteComponentDescriptor; -+using UnimplementedNativeViewComponentDescriptor = ConcreteComponentDescriptor; -+using SwitchComponentDescriptor = ConcreteComponentDescriptor; -+using TraceUpdateOverlayComponentDescriptor = ConcreteComponentDescriptor; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp -new file mode 100644 -index 0000000..229fadc ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp -@@ -0,0 +1,111 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateEventEmitterCpp.js -+ */ -+ -+#include -+ -+namespace facebook { -+namespace react { -+ -+ -+ -+ -+void AndroidSwipeRefreshLayoutEventEmitter::onRefresh(OnRefresh event) const { -+ dispatchEvent("refresh", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void PullToRefreshViewEventEmitter::onRefresh(OnRefresh event) const { -+ dispatchEvent("refresh", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+ -+void AndroidDrawerLayoutEventEmitter::onDrawerSlide(OnDrawerSlide event) const { -+ dispatchEvent("drawerSlide", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "offset", event.offset); -+ return payload; -+ }); -+} -+void AndroidDrawerLayoutEventEmitter::onDrawerStateChanged(OnDrawerStateChanged event) const { -+ dispatchEvent("drawerStateChanged", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "drawerState", event.drawerState); -+ return payload; -+ }); -+} -+void AndroidDrawerLayoutEventEmitter::onDrawerOpen(OnDrawerOpen event) const { -+ dispatchEvent("drawerOpen", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void AndroidDrawerLayoutEventEmitter::onDrawerClose(OnDrawerClose event) const { -+ dispatchEvent("drawerClose", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+ -+ -+void SwitchEventEmitter::onChange(OnChange event) const { -+ dispatchEvent("change", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "value", event.value); -+payload.setProperty(runtime, "target", event.target); -+ return payload; -+ }); -+} -+void AndroidSwitchEventEmitter::onChange(OnChange event) const { -+ dispatchEvent("change", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "value", event.value); -+payload.setProperty(runtime, "target", event.target); -+ return payload; -+ }); -+} -+ -+void ModalHostViewEventEmitter::onRequestClose(OnRequestClose event) const { -+ dispatchEvent("requestClose", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void ModalHostViewEventEmitter::onShow(OnShow event) const { -+ dispatchEvent("show", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void ModalHostViewEventEmitter::onDismiss(OnDismiss event) const { -+ dispatchEvent("dismiss", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void ModalHostViewEventEmitter::onOrientationChange(OnOrientationChange event) const { -+ dispatchEvent("orientationChange", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "orientation", toString(event.orientation)); -+ return payload; -+ }); -+} -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h -new file mode 100644 -index 0000000..1897be1 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h -@@ -0,0 +1,186 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateEventEmitterH.js -+ */ -+#pragma once -+ -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+class JSI_EXPORT SafeAreaViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT AndroidHorizontalScrollContentViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT AndroidProgressBarEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT AndroidSwipeRefreshLayoutEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnRefresh { -+ -+ }; -+ -+ void onRefresh(OnRefresh value) const; -+}; -+class JSI_EXPORT PullToRefreshViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnRefresh { -+ -+ }; -+ -+ void onRefresh(OnRefresh value) const; -+}; -+class JSI_EXPORT InputAccessoryEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT AndroidDrawerLayoutEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnDrawerSlide { -+ Float offset; -+ }; -+ -+ struct OnDrawerStateChanged { -+ int drawerState; -+ }; -+ -+ struct OnDrawerOpen { -+ -+ }; -+ -+ struct OnDrawerClose { -+ -+ }; -+ -+ void onDrawerSlide(OnDrawerSlide value) const; -+ -+ void onDrawerStateChanged(OnDrawerStateChanged value) const; -+ -+ void onDrawerOpen(OnDrawerOpen value) const; -+ -+ void onDrawerClose(OnDrawerClose value) const; -+}; -+class JSI_EXPORT ActivityIndicatorViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT UnimplementedNativeViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT SwitchEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnChange { -+ bool value; -+ int target; -+ }; -+ -+ void onChange(OnChange value) const; -+}; -+class JSI_EXPORT AndroidSwitchEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnChange { -+ bool value; -+ int target; -+ }; -+ -+ void onChange(OnChange value) const; -+}; -+class JSI_EXPORT TraceUpdateOverlayEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT ModalHostViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnRequestClose { -+ -+ }; -+ -+ struct OnShow { -+ -+ }; -+ -+ struct OnDismiss { -+ -+ }; -+ -+ enum class OnOrientationChangeOrientation { -+ Portrait, -+ Landscape -+ }; -+ -+ static char const *toString(const OnOrientationChangeOrientation value) { -+ switch (value) { -+ case OnOrientationChangeOrientation::Portrait: return "portrait"; -+ case OnOrientationChangeOrientation::Landscape: return "landscape"; -+ } -+ } -+ -+ struct OnOrientationChange { -+ OnOrientationChangeOrientation orientation; -+ }; -+ -+ void onRequestClose(OnRequestClose value) const; -+ -+ void onShow(OnShow value) const; -+ -+ void onDismiss(OnDismiss value) const; -+ -+ void onOrientationChange(OnOrientationChange value) const; -+}; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp -new file mode 100644 -index 0000000..59f24e5 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp -@@ -0,0 +1,157 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GeneratePropsCpp.js -+ */ -+ -+#include -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+SafeAreaViewProps::SafeAreaViewProps( -+ const PropsParserContext &context, -+ const SafeAreaViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) -+ -+ -+ {} -+AndroidHorizontalScrollContentViewProps::AndroidHorizontalScrollContentViewProps( -+ const PropsParserContext &context, -+ const AndroidHorizontalScrollContentViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ removeClippedSubviews(convertRawProp(context, rawProps, "removeClippedSubviews", sourceProps.removeClippedSubviews, {false})) -+ {} -+AndroidProgressBarProps::AndroidProgressBarProps( -+ const PropsParserContext &context, -+ const AndroidProgressBarProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ styleAttr(convertRawProp(context, rawProps, "styleAttr", sourceProps.styleAttr, {})), -+ typeAttr(convertRawProp(context, rawProps, "typeAttr", sourceProps.typeAttr, {})), -+ indeterminate(convertRawProp(context, rawProps, "indeterminate", sourceProps.indeterminate, {false})), -+ progress(convertRawProp(context, rawProps, "progress", sourceProps.progress, {0.0})), -+ animating(convertRawProp(context, rawProps, "animating", sourceProps.animating, {true})), -+ color(convertRawProp(context, rawProps, "color", sourceProps.color, {})), -+ testID(convertRawProp(context, rawProps, "testID", sourceProps.testID, {""})) -+ {} -+AndroidSwipeRefreshLayoutProps::AndroidSwipeRefreshLayoutProps( -+ const PropsParserContext &context, -+ const AndroidSwipeRefreshLayoutProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ enabled(convertRawProp(context, rawProps, "enabled", sourceProps.enabled, {true})), -+ colors(convertRawProp(context, rawProps, "colors", sourceProps.colors, {})), -+ progressBackgroundColor(convertRawProp(context, rawProps, "progressBackgroundColor", sourceProps.progressBackgroundColor, {})), -+ size(convertRawProp(context, rawProps, "size", sourceProps.size, {AndroidSwipeRefreshLayoutSize::Default})), -+ progressViewOffset(convertRawProp(context, rawProps, "progressViewOffset", sourceProps.progressViewOffset, {0.0})), -+ refreshing(convertRawProp(context, rawProps, "refreshing", sourceProps.refreshing, {false})) -+ {} -+PullToRefreshViewProps::PullToRefreshViewProps( -+ const PropsParserContext &context, -+ const PullToRefreshViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ tintColor(convertRawProp(context, rawProps, "tintColor", sourceProps.tintColor, {})), -+ titleColor(convertRawProp(context, rawProps, "titleColor", sourceProps.titleColor, {})), -+ title(convertRawProp(context, rawProps, "title", sourceProps.title, {})), -+ progressViewOffset(convertRawProp(context, rawProps, "progressViewOffset", sourceProps.progressViewOffset, {0.0})), -+ refreshing(convertRawProp(context, rawProps, "refreshing", sourceProps.refreshing, {false})) -+ {} -+InputAccessoryProps::InputAccessoryProps( -+ const PropsParserContext &context, -+ const InputAccessoryProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ backgroundColor(convertRawProp(context, rawProps, "backgroundColor", sourceProps.backgroundColor, {})) -+ {} -+AndroidDrawerLayoutProps::AndroidDrawerLayoutProps( -+ const PropsParserContext &context, -+ const AndroidDrawerLayoutProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ keyboardDismissMode(convertRawProp(context, rawProps, "keyboardDismissMode", sourceProps.keyboardDismissMode, {AndroidDrawerLayoutKeyboardDismissMode::None})), -+ drawerBackgroundColor(convertRawProp(context, rawProps, "drawerBackgroundColor", sourceProps.drawerBackgroundColor, {})), -+ drawerPosition(convertRawProp(context, rawProps, "drawerPosition", sourceProps.drawerPosition, {AndroidDrawerLayoutDrawerPosition::Left})), -+ drawerWidth(convertRawProp(context, rawProps, "drawerWidth", sourceProps.drawerWidth, {})), -+ drawerLockMode(convertRawProp(context, rawProps, "drawerLockMode", sourceProps.drawerLockMode, {AndroidDrawerLayoutDrawerLockMode::Unlocked})), -+ statusBarBackgroundColor(convertRawProp(context, rawProps, "statusBarBackgroundColor", sourceProps.statusBarBackgroundColor, {})) -+ {} -+ActivityIndicatorViewProps::ActivityIndicatorViewProps( -+ const PropsParserContext &context, -+ const ActivityIndicatorViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ hidesWhenStopped(convertRawProp(context, rawProps, "hidesWhenStopped", sourceProps.hidesWhenStopped, {false})), -+ animating(convertRawProp(context, rawProps, "animating", sourceProps.animating, {false})), -+ color(convertRawProp(context, rawProps, "color", sourceProps.color, {})), -+ size(convertRawProp(context, rawProps, "size", sourceProps.size, {ActivityIndicatorViewSize::Small})) -+ {} -+UnimplementedNativeViewProps::UnimplementedNativeViewProps( -+ const PropsParserContext &context, -+ const UnimplementedNativeViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ name(convertRawProp(context, rawProps, "name", sourceProps.name, {""})) -+ {} -+SwitchProps::SwitchProps( -+ const PropsParserContext &context, -+ const SwitchProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ disabled(convertRawProp(context, rawProps, "disabled", sourceProps.disabled, {false})), -+ value(convertRawProp(context, rawProps, "value", sourceProps.value, {false})), -+ tintColor(convertRawProp(context, rawProps, "tintColor", sourceProps.tintColor, {})), -+ onTintColor(convertRawProp(context, rawProps, "onTintColor", sourceProps.onTintColor, {})), -+ thumbTintColor(convertRawProp(context, rawProps, "thumbTintColor", sourceProps.thumbTintColor, {})), -+ thumbColor(convertRawProp(context, rawProps, "thumbColor", sourceProps.thumbColor, {})), -+ trackColorForFalse(convertRawProp(context, rawProps, "trackColorForFalse", sourceProps.trackColorForFalse, {})), -+ trackColorForTrue(convertRawProp(context, rawProps, "trackColorForTrue", sourceProps.trackColorForTrue, {})) -+ {} -+AndroidSwitchProps::AndroidSwitchProps( -+ const PropsParserContext &context, -+ const AndroidSwitchProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ disabled(convertRawProp(context, rawProps, "disabled", sourceProps.disabled, {false})), -+ enabled(convertRawProp(context, rawProps, "enabled", sourceProps.enabled, {true})), -+ thumbColor(convertRawProp(context, rawProps, "thumbColor", sourceProps.thumbColor, {})), -+ trackColorForFalse(convertRawProp(context, rawProps, "trackColorForFalse", sourceProps.trackColorForFalse, {})), -+ trackColorForTrue(convertRawProp(context, rawProps, "trackColorForTrue", sourceProps.trackColorForTrue, {})), -+ value(convertRawProp(context, rawProps, "value", sourceProps.value, {false})), -+ on(convertRawProp(context, rawProps, "on", sourceProps.on, {false})), -+ thumbTintColor(convertRawProp(context, rawProps, "thumbTintColor", sourceProps.thumbTintColor, {})), -+ trackTintColor(convertRawProp(context, rawProps, "trackTintColor", sourceProps.trackTintColor, {})) -+ {} -+TraceUpdateOverlayProps::TraceUpdateOverlayProps( -+ const PropsParserContext &context, -+ const TraceUpdateOverlayProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) -+ -+ -+ {} -+ModalHostViewProps::ModalHostViewProps( -+ const PropsParserContext &context, -+ const ModalHostViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ animationType(convertRawProp(context, rawProps, "animationType", sourceProps.animationType, {ModalHostViewAnimationType::None})), -+ presentationStyle(convertRawProp(context, rawProps, "presentationStyle", sourceProps.presentationStyle, {ModalHostViewPresentationStyle::FullScreen})), -+ transparent(convertRawProp(context, rawProps, "transparent", sourceProps.transparent, {false})), -+ statusBarTranslucent(convertRawProp(context, rawProps, "statusBarTranslucent", sourceProps.statusBarTranslucent, {false})), -+ hardwareAccelerated(convertRawProp(context, rawProps, "hardwareAccelerated", sourceProps.hardwareAccelerated, {false})), -+ visible(convertRawProp(context, rawProps, "visible", sourceProps.visible, {false})), -+ animated(convertRawProp(context, rawProps, "animated", sourceProps.animated, {false})), -+ supportedOrientations(convertRawProp(context, rawProps, "supportedOrientations", sourceProps.supportedOrientations, {static_cast(ModalHostViewSupportedOrientations::Portrait)})), -+ identifier(convertRawProp(context, rawProps, "identifier", sourceProps.identifier, {0})) -+ {} -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h -new file mode 100644 -index 0000000..f402340 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h -@@ -0,0 +1,395 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GeneratePropsH.js -+ */ -+#pragma once -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+class JSI_EXPORT SafeAreaViewProps final : public ViewProps { -+ public: -+ SafeAreaViewProps() = default; -+ SafeAreaViewProps(const PropsParserContext& context, const SafeAreaViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ -+}; -+ -+class JSI_EXPORT AndroidHorizontalScrollContentViewProps final : public ViewProps { -+ public: -+ AndroidHorizontalScrollContentViewProps() = default; -+ AndroidHorizontalScrollContentViewProps(const PropsParserContext& context, const AndroidHorizontalScrollContentViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool removeClippedSubviews{false}; -+}; -+ -+class JSI_EXPORT AndroidProgressBarProps final : public ViewProps { -+ public: -+ AndroidProgressBarProps() = default; -+ AndroidProgressBarProps(const PropsParserContext& context, const AndroidProgressBarProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ std::string styleAttr{}; -+ std::string typeAttr{}; -+ bool indeterminate{false}; -+ double progress{0.0}; -+ bool animating{true}; -+ SharedColor color{}; -+ std::string testID{""}; -+}; -+ -+enum class AndroidSwipeRefreshLayoutSize { Default, Large }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidSwipeRefreshLayoutSize &result) { -+ auto string = (std::string)value; -+ if (string == "default") { result = AndroidSwipeRefreshLayoutSize::Default; return; } -+ if (string == "large") { result = AndroidSwipeRefreshLayoutSize::Large; return; } -+ abort(); -+} -+ -+static inline std::string toString(const AndroidSwipeRefreshLayoutSize &value) { -+ switch (value) { -+ case AndroidSwipeRefreshLayoutSize::Default: return "default"; -+ case AndroidSwipeRefreshLayoutSize::Large: return "large"; -+ } -+} -+ -+class JSI_EXPORT AndroidSwipeRefreshLayoutProps final : public ViewProps { -+ public: -+ AndroidSwipeRefreshLayoutProps() = default; -+ AndroidSwipeRefreshLayoutProps(const PropsParserContext& context, const AndroidSwipeRefreshLayoutProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool enabled{true}; -+ std::vector colors{}; -+ SharedColor progressBackgroundColor{}; -+ AndroidSwipeRefreshLayoutSize size{AndroidSwipeRefreshLayoutSize::Default}; -+ Float progressViewOffset{0.0}; -+ bool refreshing{false}; -+}; -+ -+class JSI_EXPORT PullToRefreshViewProps final : public ViewProps { -+ public: -+ PullToRefreshViewProps() = default; -+ PullToRefreshViewProps(const PropsParserContext& context, const PullToRefreshViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ SharedColor tintColor{}; -+ SharedColor titleColor{}; -+ std::string title{}; -+ Float progressViewOffset{0.0}; -+ bool refreshing{false}; -+}; -+ -+class JSI_EXPORT InputAccessoryProps final : public ViewProps { -+ public: -+ InputAccessoryProps() = default; -+ InputAccessoryProps(const PropsParserContext& context, const InputAccessoryProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ SharedColor backgroundColor{}; -+}; -+ -+enum class AndroidDrawerLayoutKeyboardDismissMode { None, OnDrag }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutKeyboardDismissMode &result) { -+ auto string = (std::string)value; -+ if (string == "none") { result = AndroidDrawerLayoutKeyboardDismissMode::None; return; } -+ if (string == "on-drag") { result = AndroidDrawerLayoutKeyboardDismissMode::OnDrag; return; } -+ abort(); -+} -+ -+static inline std::string toString(const AndroidDrawerLayoutKeyboardDismissMode &value) { -+ switch (value) { -+ case AndroidDrawerLayoutKeyboardDismissMode::None: return "none"; -+ case AndroidDrawerLayoutKeyboardDismissMode::OnDrag: return "on-drag"; -+ } -+} -+enum class AndroidDrawerLayoutDrawerPosition { Left, Right }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutDrawerPosition &result) { -+ auto string = (std::string)value; -+ if (string == "left") { result = AndroidDrawerLayoutDrawerPosition::Left; return; } -+ if (string == "right") { result = AndroidDrawerLayoutDrawerPosition::Right; return; } -+ abort(); -+} -+ -+static inline std::string toString(const AndroidDrawerLayoutDrawerPosition &value) { -+ switch (value) { -+ case AndroidDrawerLayoutDrawerPosition::Left: return "left"; -+ case AndroidDrawerLayoutDrawerPosition::Right: return "right"; -+ } -+} -+enum class AndroidDrawerLayoutDrawerLockMode { Unlocked, LockedClosed, LockedOpen }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutDrawerLockMode &result) { -+ auto string = (std::string)value; -+ if (string == "unlocked") { result = AndroidDrawerLayoutDrawerLockMode::Unlocked; return; } -+ if (string == "locked-closed") { result = AndroidDrawerLayoutDrawerLockMode::LockedClosed; return; } -+ if (string == "locked-open") { result = AndroidDrawerLayoutDrawerLockMode::LockedOpen; return; } -+ abort(); -+} -+ -+static inline std::string toString(const AndroidDrawerLayoutDrawerLockMode &value) { -+ switch (value) { -+ case AndroidDrawerLayoutDrawerLockMode::Unlocked: return "unlocked"; -+ case AndroidDrawerLayoutDrawerLockMode::LockedClosed: return "locked-closed"; -+ case AndroidDrawerLayoutDrawerLockMode::LockedOpen: return "locked-open"; -+ } -+} -+ -+class JSI_EXPORT AndroidDrawerLayoutProps final : public ViewProps { -+ public: -+ AndroidDrawerLayoutProps() = default; -+ AndroidDrawerLayoutProps(const PropsParserContext& context, const AndroidDrawerLayoutProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ AndroidDrawerLayoutKeyboardDismissMode keyboardDismissMode{AndroidDrawerLayoutKeyboardDismissMode::None}; -+ SharedColor drawerBackgroundColor{}; -+ AndroidDrawerLayoutDrawerPosition drawerPosition{AndroidDrawerLayoutDrawerPosition::Left}; -+ Float drawerWidth{}; -+ AndroidDrawerLayoutDrawerLockMode drawerLockMode{AndroidDrawerLayoutDrawerLockMode::Unlocked}; -+ SharedColor statusBarBackgroundColor{}; -+}; -+ -+enum class ActivityIndicatorViewSize { Small, Large }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ActivityIndicatorViewSize &result) { -+ auto string = (std::string)value; -+ if (string == "small") { result = ActivityIndicatorViewSize::Small; return; } -+ if (string == "large") { result = ActivityIndicatorViewSize::Large; return; } -+ abort(); -+} -+ -+static inline std::string toString(const ActivityIndicatorViewSize &value) { -+ switch (value) { -+ case ActivityIndicatorViewSize::Small: return "small"; -+ case ActivityIndicatorViewSize::Large: return "large"; -+ } -+} -+ -+class JSI_EXPORT ActivityIndicatorViewProps final : public ViewProps { -+ public: -+ ActivityIndicatorViewProps() = default; -+ ActivityIndicatorViewProps(const PropsParserContext& context, const ActivityIndicatorViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool hidesWhenStopped{false}; -+ bool animating{false}; -+ SharedColor color{}; -+ ActivityIndicatorViewSize size{ActivityIndicatorViewSize::Small}; -+}; -+ -+class JSI_EXPORT UnimplementedNativeViewProps final : public ViewProps { -+ public: -+ UnimplementedNativeViewProps() = default; -+ UnimplementedNativeViewProps(const PropsParserContext& context, const UnimplementedNativeViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ std::string name{""}; -+}; -+ -+class JSI_EXPORT SwitchProps final : public ViewProps { -+ public: -+ SwitchProps() = default; -+ SwitchProps(const PropsParserContext& context, const SwitchProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool disabled{false}; -+ bool value{false}; -+ SharedColor tintColor{}; -+ SharedColor onTintColor{}; -+ SharedColor thumbTintColor{}; -+ SharedColor thumbColor{}; -+ SharedColor trackColorForFalse{}; -+ SharedColor trackColorForTrue{}; -+}; -+ -+class JSI_EXPORT AndroidSwitchProps final : public ViewProps { -+ public: -+ AndroidSwitchProps() = default; -+ AndroidSwitchProps(const PropsParserContext& context, const AndroidSwitchProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool disabled{false}; -+ bool enabled{true}; -+ SharedColor thumbColor{}; -+ SharedColor trackColorForFalse{}; -+ SharedColor trackColorForTrue{}; -+ bool value{false}; -+ bool on{false}; -+ SharedColor thumbTintColor{}; -+ SharedColor trackTintColor{}; -+}; -+ -+class JSI_EXPORT TraceUpdateOverlayProps final : public ViewProps { -+ public: -+ TraceUpdateOverlayProps() = default; -+ TraceUpdateOverlayProps(const PropsParserContext& context, const TraceUpdateOverlayProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ -+}; -+ -+enum class ModalHostViewAnimationType { None, Slide, Fade }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewAnimationType &result) { -+ auto string = (std::string)value; -+ if (string == "none") { result = ModalHostViewAnimationType::None; return; } -+ if (string == "slide") { result = ModalHostViewAnimationType::Slide; return; } -+ if (string == "fade") { result = ModalHostViewAnimationType::Fade; return; } -+ abort(); -+} -+ -+static inline std::string toString(const ModalHostViewAnimationType &value) { -+ switch (value) { -+ case ModalHostViewAnimationType::None: return "none"; -+ case ModalHostViewAnimationType::Slide: return "slide"; -+ case ModalHostViewAnimationType::Fade: return "fade"; -+ } -+} -+enum class ModalHostViewPresentationStyle { FullScreen, PageSheet, FormSheet, OverFullScreen }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewPresentationStyle &result) { -+ auto string = (std::string)value; -+ if (string == "fullScreen") { result = ModalHostViewPresentationStyle::FullScreen; return; } -+ if (string == "pageSheet") { result = ModalHostViewPresentationStyle::PageSheet; return; } -+ if (string == "formSheet") { result = ModalHostViewPresentationStyle::FormSheet; return; } -+ if (string == "overFullScreen") { result = ModalHostViewPresentationStyle::OverFullScreen; return; } -+ abort(); -+} -+ -+static inline std::string toString(const ModalHostViewPresentationStyle &value) { -+ switch (value) { -+ case ModalHostViewPresentationStyle::FullScreen: return "fullScreen"; -+ case ModalHostViewPresentationStyle::PageSheet: return "pageSheet"; -+ case ModalHostViewPresentationStyle::FormSheet: return "formSheet"; -+ case ModalHostViewPresentationStyle::OverFullScreen: return "overFullScreen"; -+ } -+} -+using ModalHostViewSupportedOrientationsMask = uint32_t; -+ -+enum class ModalHostViewSupportedOrientations: ModalHostViewSupportedOrientationsMask { -+ Portrait = 1 << 0, -+ PortraitUpsideDown = 1 << 1, -+ Landscape = 1 << 2, -+ LandscapeLeft = 1 << 3, -+ LandscapeRight = 1 << 4 -+}; -+ -+constexpr bool operator&( -+ ModalHostViewSupportedOrientationsMask const lhs, -+ enum ModalHostViewSupportedOrientations const rhs) { -+ return lhs & static_cast(rhs); -+} -+ -+constexpr ModalHostViewSupportedOrientationsMask operator|( -+ ModalHostViewSupportedOrientationsMask const lhs, -+ enum ModalHostViewSupportedOrientations const rhs) { -+ return lhs | static_cast(rhs); -+} -+ -+constexpr void operator|=( -+ ModalHostViewSupportedOrientationsMask &lhs, -+ enum ModalHostViewSupportedOrientations const rhs) { -+ lhs = lhs | static_cast(rhs); -+} -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewSupportedOrientationsMask &result) { -+ auto items = std::vector{value}; -+ for (const auto &item : items) { -+ if (item == "portrait") { -+ result |= ModalHostViewSupportedOrientations::Portrait; -+ continue; -+ } -+ if (item == "portrait-upside-down") { -+ result |= ModalHostViewSupportedOrientations::PortraitUpsideDown; -+ continue; -+ } -+ if (item == "landscape") { -+ result |= ModalHostViewSupportedOrientations::Landscape; -+ continue; -+ } -+ if (item == "landscape-left") { -+ result |= ModalHostViewSupportedOrientations::LandscapeLeft; -+ continue; -+ } -+ if (item == "landscape-right") { -+ result |= ModalHostViewSupportedOrientations::LandscapeRight; -+ continue; -+ } -+ abort(); -+ } -+} -+ -+static inline std::string toString(const ModalHostViewSupportedOrientationsMask &value) { -+ auto result = std::string{}; -+ auto separator = std::string{", "}; -+ -+ if (value & ModalHostViewSupportedOrientations::Portrait) { -+ result += "portrait" + separator; -+ } -+ if (value & ModalHostViewSupportedOrientations::PortraitUpsideDown) { -+ result += "portrait-upside-down" + separator; -+ } -+ if (value & ModalHostViewSupportedOrientations::Landscape) { -+ result += "landscape" + separator; -+ } -+ if (value & ModalHostViewSupportedOrientations::LandscapeLeft) { -+ result += "landscape-left" + separator; -+ } -+ if (value & ModalHostViewSupportedOrientations::LandscapeRight) { -+ result += "landscape-right" + separator; -+ } -+ if (!result.empty()) { -+ result.erase(result.length() - separator.length()); -+ } -+ return result; -+} -+ -+class JSI_EXPORT ModalHostViewProps final : public ViewProps { -+ public: -+ ModalHostViewProps() = default; -+ ModalHostViewProps(const PropsParserContext& context, const ModalHostViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ ModalHostViewAnimationType animationType{ModalHostViewAnimationType::None}; -+ ModalHostViewPresentationStyle presentationStyle{ModalHostViewPresentationStyle::FullScreen}; -+ bool transparent{false}; -+ bool statusBarTranslucent{false}; -+ bool hardwareAccelerated{false}; -+ bool visible{false}; -+ bool animated{false}; -+ ModalHostViewSupportedOrientationsMask supportedOrientations{static_cast(ModalHostViewSupportedOrientations::Portrait)}; -+ int identifier{0}; -+}; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h -new file mode 100644 -index 0000000..e08f2ae ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h -@@ -0,0 +1,257 @@ -+/** -+* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+* -+* Do not edit this file as changes may cause incorrect behavior and will be lost -+* once the code is regenerated. -+* -+* @generated by codegen project: GenerateComponentHObjCpp.js -+*/ -+ -+#import -+#import -+#import -+ -+NS_ASSUME_NONNULL_BEGIN -+ -+@protocol RCTSafeAreaViewViewProtocol -+ -+@end -+ -+@protocol RCTAndroidHorizontalScrollContentViewViewProtocol -+ -+@end -+ -+@protocol RCTAndroidProgressBarViewProtocol -+ -+@end -+ -+@protocol RCTAndroidSwipeRefreshLayoutViewProtocol -+- (void)setNativeRefreshing:(BOOL)value; -+@end -+ -+RCT_EXTERN inline void RCTAndroidSwipeRefreshLayoutHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"setNativeRefreshing"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidSwipeRefreshLayout", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"AndroidSwipeRefreshLayout", commandName, @"1st")) { -+ return; -+ } -+#endif -+ BOOL value = [(NSNumber *)arg0 boolValue]; -+ -+ [componentView setNativeRefreshing:value]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidSwipeRefreshLayout", commandName); -+#endif -+} -+ -+@protocol RCTPullToRefreshViewViewProtocol -+- (void)setNativeRefreshing:(BOOL)refreshing; -+@end -+ -+RCT_EXTERN inline void RCTPullToRefreshViewHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"setNativeRefreshing"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"PullToRefreshView", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"PullToRefreshView", commandName, @"1st")) { -+ return; -+ } -+#endif -+ BOOL refreshing = [(NSNumber *)arg0 boolValue]; -+ -+ [componentView setNativeRefreshing:refreshing]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"PullToRefreshView", commandName); -+#endif -+} -+ -+@protocol RCTInputAccessoryViewProtocol -+ -+@end -+ -+@protocol RCTAndroidDrawerLayoutViewProtocol -+- (void)openDrawer; -+- (void)closeDrawer; -+@end -+ -+RCT_EXTERN inline void RCTAndroidDrawerLayoutHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"openDrawer"]) { -+#if RCT_DEBUG -+ if ([args count] != 0) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidDrawerLayout", commandName, (int)[args count], 0); -+ return; -+ } -+#endif -+ -+ -+ -+ [componentView openDrawer]; -+ return; -+} -+ -+if ([commandName isEqualToString:@"closeDrawer"]) { -+#if RCT_DEBUG -+ if ([args count] != 0) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidDrawerLayout", commandName, (int)[args count], 0); -+ return; -+ } -+#endif -+ -+ -+ -+ [componentView closeDrawer]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidDrawerLayout", commandName); -+#endif -+} -+ -+@protocol RCTActivityIndicatorViewViewProtocol -+ -+@end -+ -+@protocol RCTUnimplementedNativeViewViewProtocol -+ -+@end -+ -+@protocol RCTSwitchViewProtocol -+- (void)setValue:(BOOL)value; -+@end -+ -+RCT_EXTERN inline void RCTSwitchHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"setValue"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"Switch", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"Switch", commandName, @"1st")) { -+ return; -+ } -+#endif -+ BOOL value = [(NSNumber *)arg0 boolValue]; -+ -+ [componentView setValue:value]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"Switch", commandName); -+#endif -+} -+ -+@protocol RCTAndroidSwitchViewProtocol -+- (void)setNativeValue:(BOOL)value; -+@end -+ -+RCT_EXTERN inline void RCTAndroidSwitchHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"setNativeValue"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidSwitch", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"AndroidSwitch", commandName, @"1st")) { -+ return; -+ } -+#endif -+ BOOL value = [(NSNumber *)arg0 boolValue]; -+ -+ [componentView setNativeValue:value]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidSwitch", commandName); -+#endif -+} -+ -+@protocol RCTTraceUpdateOverlayViewProtocol -+- (void)draw:(NSString *)overlays; -+@end -+ -+RCT_EXTERN inline void RCTTraceUpdateOverlayHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"draw"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"TraceUpdateOverlay", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSString class], @"string", @"TraceUpdateOverlay", commandName, @"1st")) { -+ return; -+ } -+#endif -+ NSString * overlays = (NSString *)arg0; -+ -+ [componentView draw:overlays]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"TraceUpdateOverlay", commandName); -+#endif -+} -+ -+@protocol RCTModalHostViewViewProtocol -+ -+@end -+ -+NS_ASSUME_NONNULL_END -\ No newline at end of file -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp -new file mode 100644 -index 0000000..d9a2760 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp -@@ -0,0 +1,26 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateShadowNodeCpp.js -+ */ -+ -+#include -+ -+namespace facebook { -+namespace react { -+ -+extern const char AndroidHorizontalScrollContentViewComponentName[] = "AndroidHorizontalScrollContentView"; -+extern const char AndroidSwipeRefreshLayoutComponentName[] = "AndroidSwipeRefreshLayout"; -+extern const char PullToRefreshViewComponentName[] = "PullToRefreshView"; -+extern const char AndroidDrawerLayoutComponentName[] = "AndroidDrawerLayout"; -+extern const char ActivityIndicatorViewComponentName[] = "ActivityIndicatorView"; -+extern const char UnimplementedNativeViewComponentName[] = "UnimplementedNativeView"; -+extern const char SwitchComponentName[] = "Switch"; -+extern const char TraceUpdateOverlayComponentName[] = "TraceUpdateOverlay"; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h -new file mode 100644 -index 0000000..a5874dc ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h -@@ -0,0 +1,111 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateShadowNodeH.js -+ */ -+ -+#pragma once -+ -+#include -+#include -+#include -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+JSI_EXPORT extern const char AndroidHorizontalScrollContentViewComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using AndroidHorizontalScrollContentViewShadowNode = ConcreteViewShadowNode< -+ AndroidHorizontalScrollContentViewComponentName, -+ AndroidHorizontalScrollContentViewProps, -+ AndroidHorizontalScrollContentViewEventEmitter, -+ AndroidHorizontalScrollContentViewState>; -+ -+JSI_EXPORT extern const char AndroidSwipeRefreshLayoutComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using AndroidSwipeRefreshLayoutShadowNode = ConcreteViewShadowNode< -+ AndroidSwipeRefreshLayoutComponentName, -+ AndroidSwipeRefreshLayoutProps, -+ AndroidSwipeRefreshLayoutEventEmitter, -+ AndroidSwipeRefreshLayoutState>; -+ -+JSI_EXPORT extern const char PullToRefreshViewComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using PullToRefreshViewShadowNode = ConcreteViewShadowNode< -+ PullToRefreshViewComponentName, -+ PullToRefreshViewProps, -+ PullToRefreshViewEventEmitter, -+ PullToRefreshViewState>; -+ -+JSI_EXPORT extern const char AndroidDrawerLayoutComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using AndroidDrawerLayoutShadowNode = ConcreteViewShadowNode< -+ AndroidDrawerLayoutComponentName, -+ AndroidDrawerLayoutProps, -+ AndroidDrawerLayoutEventEmitter, -+ AndroidDrawerLayoutState>; -+ -+JSI_EXPORT extern const char ActivityIndicatorViewComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using ActivityIndicatorViewShadowNode = ConcreteViewShadowNode< -+ ActivityIndicatorViewComponentName, -+ ActivityIndicatorViewProps, -+ ActivityIndicatorViewEventEmitter, -+ ActivityIndicatorViewState>; -+ -+JSI_EXPORT extern const char UnimplementedNativeViewComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using UnimplementedNativeViewShadowNode = ConcreteViewShadowNode< -+ UnimplementedNativeViewComponentName, -+ UnimplementedNativeViewProps, -+ UnimplementedNativeViewEventEmitter, -+ UnimplementedNativeViewState>; -+ -+JSI_EXPORT extern const char SwitchComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using SwitchShadowNode = ConcreteViewShadowNode< -+ SwitchComponentName, -+ SwitchProps, -+ SwitchEventEmitter, -+ SwitchState>; -+ -+JSI_EXPORT extern const char TraceUpdateOverlayComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using TraceUpdateOverlayShadowNode = ConcreteViewShadowNode< -+ TraceUpdateOverlayComponentName, -+ TraceUpdateOverlayProps, -+ TraceUpdateOverlayEventEmitter, -+ TraceUpdateOverlayState>; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp -new file mode 100644 -index 0000000..3b5a0f5 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp -@@ -0,0 +1,18 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateStateCpp.js -+ */ -+#include -+ -+namespace facebook { -+namespace react { -+ -+ -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h -new file mode 100644 -index 0000000..29ac2df ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h -@@ -0,0 +1,141 @@ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateStateH.js -+ */ -+#pragma once -+ -+#ifdef ANDROID -+#include -+#include -+#include -+#endif -+ -+namespace facebook { -+namespace react { -+ -+class AndroidHorizontalScrollContentViewState { -+public: -+ AndroidHorizontalScrollContentViewState() = default; -+ -+#ifdef ANDROID -+ AndroidHorizontalScrollContentViewState(AndroidHorizontalScrollContentViewState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class AndroidSwipeRefreshLayoutState { -+public: -+ AndroidSwipeRefreshLayoutState() = default; -+ -+#ifdef ANDROID -+ AndroidSwipeRefreshLayoutState(AndroidSwipeRefreshLayoutState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class PullToRefreshViewState { -+public: -+ PullToRefreshViewState() = default; -+ -+#ifdef ANDROID -+ PullToRefreshViewState(PullToRefreshViewState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class AndroidDrawerLayoutState { -+public: -+ AndroidDrawerLayoutState() = default; -+ -+#ifdef ANDROID -+ AndroidDrawerLayoutState(AndroidDrawerLayoutState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class ActivityIndicatorViewState { -+public: -+ ActivityIndicatorViewState() = default; -+ -+#ifdef ANDROID -+ ActivityIndicatorViewState(ActivityIndicatorViewState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class UnimplementedNativeViewState { -+public: -+ UnimplementedNativeViewState() = default; -+ -+#ifdef ANDROID -+ UnimplementedNativeViewState(UnimplementedNativeViewState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class SwitchState { -+public: -+ SwitchState() = default; -+ -+#ifdef ANDROID -+ SwitchState(SwitchState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class TraceUpdateOverlayState { -+public: -+ TraceUpdateOverlayState() = default; -+ -+#ifdef ANDROID -+ TraceUpdateOverlayState(TraceUpdateOverlayState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+} // namespace react -+} // namespace facebook -\ No newline at end of file -diff --git a/node_modules/react-native/scripts/.packager.env b/node_modules/react-native/scripts/.packager.env -new file mode 100644 -index 0000000..361f5fb ---- /dev/null -+++ b/node_modules/react-native/scripts/.packager.env -@@ -0,0 +1 @@ -+export RCT_METRO_PORT=8081 -diff --git a/node_modules/react-native/sdks/hermes/hermes-engine.podspec b/node_modules/react-native/sdks/hermes/hermes-engine.podspec -new file mode 100644 -index 0000000..87d0710 ---- /dev/null -+++ b/node_modules/react-native/sdks/hermes/hermes-engine.podspec -@@ -0,0 +1,114 @@ -+# Copyright (c) Meta Platforms, Inc. and affiliates. -+# -+# This source code is licensed under the MIT license found in the -+# LICENSE file in the root directory of this source tree. -+ -+require "json" -+require_relative "./hermes-utils.rb" -+ -+react_native_path = File.join(__dir__, "..", "..") -+ -+# Whether Hermes is built for Release or Debug is determined by the PRODUCTION envvar. -+build_type = ENV['PRODUCTION'] == "1" ? :release : :debug -+ -+# package.json -+package = JSON.parse(File.read(File.join(react_native_path, "package.json"))) -+version = package['version'] -+ -+# sdks/.hermesversion -+hermestag_file = File.join(react_native_path, "sdks", ".hermesversion") -+build_from_source = ENV['BUILD_FROM_SOURCE'] === 'true' -+ -+git = "https://github.com/facebook/hermes.git" -+ -+abort_if_invalid_tarball_provided! -+ -+source = compute_hermes_source(build_from_source, hermestag_file, git, version, build_type, react_native_path) -+ -+Pod::Spec.new do |spec| -+ spec.name = "hermes-engine" -+ spec.version = version -+ spec.summary = "Hermes is a small and lightweight JavaScript engine optimized for running React Native." -+ spec.description = "Hermes is a JavaScript engine optimized for fast start-up of React Native apps. It features ahead-of-time static optimization and compact bytecode." -+ spec.homepage = "https://hermesengine.dev" -+ spec.license = package['license'] -+ spec.author = "Facebook" -+ spec.source = source -+ spec.platforms = { :osx => "10.13", :ios => "12.4" } -+ -+ spec.preserve_paths = '**/*.*' -+ spec.source_files = '' -+ -+ spec.pod_target_xcconfig = { -+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", -+ "CLANG_CXX_LIBRARY" => "compiler-default" -+ }.merge!(build_type == :debug ? { "GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=1" } : {}) -+ -+ spec.ios.vendored_frameworks = "destroot/Library/Frameworks/ios/hermes.framework" -+ spec.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework" -+ -+ if source[:http] then -+ -+ spec.subspec 'Pre-built' do |ss| -+ ss.preserve_paths = ["destroot/bin/*"].concat(build_type == :debug ? ["**/*.{h,c,cpp}"] : []) -+ ss.source_files = "destroot/include/**/*.h" -+ ss.exclude_files = ["destroot/include/jsi/jsi/JSIDynamic.{h,cpp}", "destroot/include/jsi/jsi/jsilib-*.{h,cpp}"] -+ ss.header_mappings_dir = "destroot/include" -+ ss.ios.vendored_frameworks = "destroot/Library/Frameworks/universal/hermes.xcframework" -+ ss.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework" -+ end -+ -+ elsif source[:git] then -+ -+ spec.subspec 'Hermes' do |ss| -+ ss.source_files = '' -+ ss.public_header_files = 'API/hermes/*.h' -+ ss.header_dir = 'hermes' -+ end -+ -+ spec.subspec 'JSI' do |ss| -+ ss.source_files = '' -+ ss.public_header_files = 'API/jsi/jsi/*.h' -+ ss.header_dir = 'jsi' -+ end -+ -+ spec.subspec 'Public' do |ss| -+ ss.source_files = '' -+ ss.public_header_files = 'public/hermes/Public/*.h' -+ ss.header_dir = 'hermes/Public' -+ end -+ -+ hermesc_path = "${PODS_ROOT}/hermes-engine/build_host_hermesc" -+ -+ if ENV.has_key?('HERMES_OVERRIDE_HERMESC_PATH') && File.exist?(ENV['HERMES_OVERRIDE_HERMESC_PATH']) then -+ hermesc_path = ENV['HERMES_OVERRIDE_HERMESC_PATH'] -+ end -+ -+ spec.user_target_xcconfig = { -+ 'HERMES_CLI_PATH' => "#{hermesc_path}/bin/hermesc" -+ } -+ -+ spec.prepare_command = ". #{react_native_path}/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh" -+ -+ CMAKE_BINARY = %x(command -v cmake | tr -d '\n') -+ # NOTE: Script phases are sorted alphabetically inside Xcode project -+ spec.script_phases = [ -+ { -+ :name => '[RN] [1] Build Hermesc', -+ :script => <<-EOS -+ . ${PODS_ROOT}/../.xcode.env -+ export CMAKE_BINARY=${CMAKE_BINARY:-#{CMAKE_BINARY}} -+ . ${REACT_NATIVE_PATH}/sdks/hermes-engine/utils/build-hermesc-xcode.sh #{hermesc_path} -+ EOS -+ }, -+ { -+ :name => '[RN] [2] Build Hermes', -+ :script => <<-EOS -+ . ${PODS_ROOT}/../.xcode.env -+ export CMAKE_BINARY=${CMAKE_BINARY:-#{CMAKE_BINARY}} -+ . ${REACT_NATIVE_PATH}/sdks/hermes-engine/utils/build-hermes-xcode.sh #{version} #{hermesc_path}/ImportHermesc.cmake -+ EOS -+ } -+ ] -+ end -+end -diff --git a/node_modules/react-native/sdks/hermes/hermes-utils.rb b/node_modules/react-native/sdks/hermes/hermes-utils.rb -new file mode 100644 -index 0000000..06f3644 ---- /dev/null -+++ b/node_modules/react-native/sdks/hermes/hermes-utils.rb -@@ -0,0 +1,144 @@ -+# Copyright (c) Meta Platforms, Inc. and affiliates. -+# -+# This source code is licensed under the MIT license found in the -+# LICENSE file in the root directory of this source tree. -+ -+require 'net/http' -+require 'rexml/document' -+ -+# This function abort the build if the `HERMES_ENGINE_TARBALL_PATH` ENV variable is set with an invalid path -+def abort_if_invalid_tarball_provided!() -+ if ENV.has_key?('HERMES_ENGINE_TARBALL_PATH') && !File.exist?(ENV['HERMES_ENGINE_TARBALL_PATH']) -+ abort "[Hermes] HERMES_ENGINE_TARBALL_PATH is set, but points to a non-existing file: \"#{ENV['HERMES_ENGINE_TARBALL_PATH']}\"\nIf you don't want to use tarball, run `unset HERMES_ENGINE_TARBALL_PATH`" -+ end -+end -+ -+# It computes the right value for the hermes-engine.podspec's source. -+# - To use a specific tarball, install the dependencies with: -+# `HERMES_ENGINE_TARBALL_PATH= bundle exec pod install` -+# - To force a build from source, install the dependencies with: -+# `BUILD_FROM_SOURCE=true bundle exec pod install` -+# If none of the two are provided, Cocoapods will check whether there is a tarball for the current version -+# (either release or nightly). If not, it will fall back building from source (the latest commit on main). -+# -+# Parameters: -+# - build_from_source: boolean to force a build from source. -+# - hermestag_file: path to the hermes tag file. -+# - git: uri to the hermes repository -+# - version: current version of the pod -+# - build_type: build type of the hermes engine. It can be `:release` or `:debug` -+# - react_native_path: path to react native -+# -+# Returns: a properly configured source object -+def compute_hermes_source(build_from_source, hermestag_file, git, version, build_type, react_native_path) -+ source = {} -+ -+ if ENV.has_key?('HERMES_ENGINE_TARBALL_PATH') -+ use_tarball(source) -+ elsif build_from_source -+ if File.exist?(hermestag_file) -+ build_from_tagfile(source, git, hermestag_file) -+ else -+ build_hermes_from_source(source, git) -+ end -+ elsif hermes_artifact_exists(release_tarball_url(version, build_type)) -+ use_release_tarball(source, version, build_type) -+ elsif hermes_artifact_exists(nightly_tarball_url(version).gsub("\\", "")) -+ use_nightly_tarball(source, react_native_path, version) -+ else -+ build_hermes_from_source(source, git) -+ end -+ -+ return source -+end -+ -+def use_tarball(source) -+ tarball_path = ENV['HERMES_ENGINE_TARBALL_PATH'] -+ putsIfPodPresent("[Hermes] Using pre-built Hermes binaries from local path: #{tarball_path}") -+ source[:http] = "file://#{tarball_path}" -+end -+ -+def build_from_tagfile(source, git, hermestag_file) -+ hermestag = File.read(hermestag_file).strip -+ putsIfPodPresent("[Hermes] Building Hermes from source from tag #{hermestag}...") -+ source[:git] = git -+ source[:tag] = hermestag -+end -+ -+def use_release_tarball(source, version, build_type) -+ # Sample url from Maven: -+ # https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.71.0/react-native-artifacts-0.71.0-hermes-ios-debug.tar.gz -+ putsIfPodPresent('[Hermes] Using the release tarball from Maven Central', 'info') -+ source[:http] = release_tarball_url(version, build_type) -+end -+ -+def release_tarball_url(version, build_type) -+ return "https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/#{version}/react-native-artifacts-#{version}-hermes-ios-#{build_type.to_s}.tar.gz" -+end -+ -+def use_nightly_tarball(source, react_native_path, version) -+ putsIfPodPresent('[Hermes] Nightly version, download pre-built for Hermes') -+ destination_path = download_nightly_hermes(react_native_path, version) -+ # set tarball as hermes engine -+ source[:http] = "file://#{destination_path}" -+end -+ -+def putsIfPodPresent(message, level = 'warning') -+ unless Object.const_defined?("Pod::UI") -+ return -+ end -+ -+ case level -+ when 'info' -+ Pod::UI.puts message.green -+ when 'error' -+ Pod::UI.puts message.red -+ else -+ Pod::UI.puts message.yellow -+ end -+end -+ -+# This function downloads the nightly prebuilt version of Hermes based on the passed version -+# and save it in the node_module/react_native/sdks/downloads folder -+# It then returns the path to the hermes tarball -+# -+# Parameters -+# - react_native_path: the path to the React Native folder in node modules. It is used as root path to store the Hermes tarball -+# - version: the version of React Native that requires the Hermes tarball -+# Returns: the path to the downloaded Hermes tarball -+def download_nightly_hermes(react_native_path, version) -+ tarball_url = nightly_tarball_url(version) -+ -+ destination_folder = "#{react_native_path}/sdks/downloads" -+ destination_path = "#{destination_folder}/hermes-ios-#{version}.tar.gz" -+ -+ unless File.exist?(destination_path) -+ # Download to a temporary file first so we don't cache incomplete downloads. -+ tmp_file = "#{destination_folder}/hermes-ios.download" -+ `mkdir -p "#{destination_folder}" && curl "#{tarball_url}" -Lo "#{tmp_file}" && mv "#{tmp_file}" "#{destination_path}"` -+ end -+ return destination_path -+end -+ -+def nightly_tarball_url(version) -+ params = "r=snapshots\&g=com.facebook.react\&a=react-native-artifacts\&c=hermes-ios-debug\&e=tar.gz\&v=#{version}-SNAPSHOT" -+ return "http://oss.sonatype.org/service/local/artifact/maven/redirect\?#{params}" -+end -+ -+def build_hermes_from_source(source, git) -+ putsIfPodPresent('[Hermes] Installing hermes-engine may take slightly longer, building Hermes compiler from source...') -+ source[:git] = git -+ source[:commit] = `git ls-remote https://github.com/facebook/hermes main | cut -f 1`.strip -+end -+ -+# This function checks that Hermes artifact exists. -+# As of now it should check it on the Maven repo. -+# -+# Parameters -+# - version: the version of React Native -+# - build_type: debug or release -+def hermes_artifact_exists(tarball_url) -+ # -L is used to follow redirects, useful for the nightlies -+ # I also needed to wrap the url in quotes to avoid escaping & and ?. -+ return (`curl -o /dev/null --silent -Iw '%{http_code}' -L "#{tarball_url}"` == "200") -+end From d79c37e606fc2e5eba91ee2777606e291e7785ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 29 Jan 2024 13:24:42 -0300 Subject: [PATCH 06/47] chore: added allow-scripts --- .npmrc | 1 + package-lock.json | 1053 ++++++++++++++++++++++++++++++++++++++++++++- package.json | 2 + 3 files changed, 1047 insertions(+), 9 deletions(-) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 000000000..97b895e2f --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +ignore-scripts=true diff --git a/package-lock.json b/package-lock.json index f0b8c167f..1dd2df784 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@fortawesome/react-native-fontawesome": "0.2.7", "@hathor/unleash-client": "0.1.0", "@hathor/wallet-lib": "1.0.1", + "@lavamoat/preinstall-always-fail": "^2.0.0", "@notifee/react-native": "5.7.0", "@react-native-async-storage/async-storage": "1.19.0", "@react-native-firebase/app": "16.7.0", @@ -73,6 +74,7 @@ "@babel/preset-env": "7.22.7", "@babel/runtime": "7.22.6", "@jest/globals": "29.7.0", + "@lavamoat/allow-scripts": "^3.0.1", "@react-native/eslint-config": "0.72.2", "@react-native/metro-config": "0.72.11", "@tsconfig/react-native": "3.0.2", @@ -2528,6 +2530,12 @@ "react-native-svg": "> 7.0" } }, + "node_modules/@gar/promisify": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", + "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", + "dev": true + }, "node_modules/@hapi/hoek": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", @@ -4078,6 +4086,149 @@ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" }, + "node_modules/@lavamoat/aa": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@lavamoat/aa/-/aa-4.0.1.tgz", + "integrity": "sha512-OB9ckERyYRctJ61jWV6DiKZcgsBCngGyLwxToqn9tar7UHvnTYCT6E/uuBE1qnjBDfje6aQCMqS+/QZ9DuoGcw==", + "dev": true, + "dependencies": { + "resolve": "1.22.8" + }, + "bin": { + "lavamoat-ls": "src/cli.js" + }, + "engines": { + "node": "^16.20.0 || ^18.0.0 || ^20.0.0" + } + }, + "node_modules/@lavamoat/allow-scripts": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@lavamoat/allow-scripts/-/allow-scripts-3.0.1.tgz", + "integrity": "sha512-Y+aGBwX2fUcUyqvv4n4GW0JlMRH68r9h+zk42dTRb0hAQktz1kz/y1Bw0K5TAGAGRc0ecvE0jRJ7CXO3MeTqbQ==", + "dev": true, + "dependencies": { + "@lavamoat/aa": "^4.0.1", + "@npmcli/run-script": "6.0.2", + "bin-links": "4.0.3", + "npm-normalize-package-bin": "3.0.1", + "yargs": "17.7.2" + }, + "bin": { + "allow-scripts": "src/cli.js" + }, + "engines": { + "node": "^16.20.0 || ^18.0.0 || ^20.0.0" + } + }, + "node_modules/@lavamoat/allow-scripts/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@lavamoat/allow-scripts/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@lavamoat/allow-scripts/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@lavamoat/allow-scripts/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/@lavamoat/allow-scripts/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/@lavamoat/allow-scripts/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@lavamoat/allow-scripts/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@lavamoat/allow-scripts/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/@lavamoat/preinstall-always-fail": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@lavamoat/preinstall-always-fail/-/preinstall-always-fail-2.0.0.tgz", + "integrity": "sha512-7sgV9DtAD7z7nhxLb2vSjEqgjd3xVk2CbZKwBDVFXkZk1L6xrOIaJTNv5rgNy801/Rjc54KyJ48fHR3djwU35A==", + "hasInstallScript": true, + "engines": { + "node": "^16.20.0 || ^18.0.0 || ^20.0.0" + } + }, "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { "version": "5.1.1-v1", "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz", @@ -4138,6 +4289,112 @@ "react-native": "*" } }, + "node_modules/@npmcli/fs": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-2.1.2.tgz", + "integrity": "sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ==", + "dev": true, + "dependencies": { + "@gar/promisify": "^1.1.3", + "semver": "^7.3.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/@npmcli/move-file": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-2.0.1.tgz", + "integrity": "sha512-mJd2Z5TjYWq/ttPLLGqArdtnC74J6bOzg4rMDnN+p1xTacZ2yPRCk2y0oSWQtygLR9YVQXgOcONrwtnk3JupxQ==", + "deprecated": "This functionality has been moved to @npmcli/fs", + "dev": true, + "dependencies": { + "mkdirp": "^1.0.4", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/@npmcli/move-file/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@npmcli/node-gyp": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-3.0.0.tgz", + "integrity": "sha512-gp8pRXC2oOxu0DUE1/M3bYtb1b3/DbJ5aM113+XJBgfXdussRAsX0YOrOhdd8WvnAR6auDBvJomGAkLKA5ydxA==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/promise-spawn": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-6.0.2.tgz", + "integrity": "sha512-gGq0NJkIGSwdbUt4yhdF8ZrmkGKVz9vAdVzpOfnom+V8PLSmSOVhZwbNvZZS1EYcJN5hzzKBxmmVVAInM6HQLg==", + "dev": true, + "dependencies": { + "which": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/promise-spawn/node_modules/which": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/which/-/which-3.0.1.tgz", + "integrity": "sha512-XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/run-script": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-6.0.2.tgz", + "integrity": "sha512-NCcr1uQo1k5U+SYlnIrbAh3cxy+OQT1VtqiAbxdymSlptbzBb62AjH2xXgjNCoP073hoa1CfCAcwoZ8k96C4nA==", + "dev": true, + "dependencies": { + "@npmcli/node-gyp": "^3.0.0", + "@npmcli/promise-spawn": "^6.0.0", + "node-gyp": "^9.0.0", + "read-package-json-fast": "^3.0.0", + "which": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/run-script/node_modules/which": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/which/-/which-3.0.1.tgz", + "integrity": "sha512-XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/@react-native-async-storage/async-storage": { "version": "1.19.0", "resolved": "https://registry.npmjs.org/@react-native-async-storage/async-storage/-/async-storage-1.19.0.tgz", @@ -6518,6 +6775,15 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@tootallnate/once": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", + "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, "node_modules/@tsconfig/react-native": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@tsconfig/react-native/-/react-native-3.0.2.tgz", @@ -6960,6 +7226,12 @@ "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", "dev": true }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, "node_modules/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -7059,6 +7331,31 @@ "node": ">= 6.0.0" } }, + "node_modules/agentkeepalive": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", + "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", + "dev": true, + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -7166,6 +7463,54 @@ "resolved": "https://registry.npmjs.org/appdirsjs/-/appdirsjs-1.2.7.tgz", "integrity": "sha512-Quji6+8kLBC3NnBeo14nPDq0+2jUs5s3/xEye+udFHumHhRk4M7aAMXp/PBJqkKYGuuyR9M/6Dq7d2AViiGmhw==" }, + "node_modules/aproba": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", + "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", + "dev": true + }, + "node_modules/are-we-there-yet": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz", + "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==", + "dev": true, + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/are-we-there-yet/node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/are-we-there-yet/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/are-we-there-yet/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -7869,6 +8214,46 @@ "resolved": "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz", "integrity": "sha512-ddkU+dFIuEIW8lE7ZwdIAf2UPoM90eaprg5m3YXAVVTmKlqV/9BX4A2M8BOK2yOq6/VgZFVhK6QAxJebhlbhzw==" }, + "node_modules/bin-links": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-4.0.3.tgz", + "integrity": "sha512-obsRaULtJurnfox/MDwgq6Yo9kzbv1CPTk/1/s7Z/61Lezc8IKkFCOXNeVLXz0456WRzBQmSsDWlai2tIhBsfA==", + "dev": true, + "dependencies": { + "cmd-shim": "^6.0.0", + "npm-normalize-package-bin": "^3.0.0", + "read-cmd-shim": "^4.0.0", + "write-file-atomic": "^5.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/bin-links/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/bin-links/node_modules/write-file-atomic": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.1.tgz", + "integrity": "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/bip-schnorr": { "version": "0.6.4", "resolved": "https://registry.npmjs.org/bip-schnorr/-/bip-schnorr-0.6.4.tgz", @@ -8210,6 +8595,96 @@ "node": ">= 0.8" } }, + "node_modules/cacache": { + "version": "16.1.3", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-16.1.3.tgz", + "integrity": "sha512-/+Emcj9DAXxX4cwlLmRI9c166RuL3w30zp4R7Joiv2cQTtTtA+jeuCAjH3ZlGnYS3tKENSrKhAzVVP9GVyzeYQ==", + "dev": true, + "dependencies": { + "@npmcli/fs": "^2.1.0", + "@npmcli/move-file": "^2.0.0", + "chownr": "^2.0.0", + "fs-minipass": "^2.1.0", + "glob": "^8.0.1", + "infer-owner": "^1.0.4", + "lru-cache": "^7.7.1", + "minipass": "^3.1.6", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "mkdirp": "^1.0.4", + "p-map": "^4.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^3.0.2", + "ssri": "^9.0.0", + "tar": "^6.1.11", + "unique-filename": "^2.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/cacache/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/cacache/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/cacache/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/cacache/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cacache/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/cache-content-type": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-content-type/-/cache-content-type-1.0.1.tgz", @@ -8340,6 +8815,15 @@ "node": ">=10" } }, + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/ci-info": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", @@ -8376,6 +8860,15 @@ "node": ">=12" } }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", @@ -8429,6 +8922,15 @@ "node": ">=6" } }, + "node_modules/cmd-shim": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-6.0.2.tgz", + "integrity": "sha512-+FFYbB0YLaAkhkcrjkyNLYDiOsFSfRjwjY19LXk/psmMx1z00xlCv7hhQoTGXXIKi+YXHL/iiFo8NqMVQX9nOw==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -8491,6 +8993,15 @@ "simple-swizzle": "^0.2.2" } }, + "node_modules/color-support": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "dev": true, + "bin": { + "color-support": "bin.js" + } + }, "node_modules/color/node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -8619,6 +9130,12 @@ "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==" }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", + "dev": true + }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -9297,6 +9814,15 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/envinfo": { "version": "7.10.0", "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.10.0.tgz", @@ -9308,6 +9834,12 @@ "node": ">=4" } }, + "node_modules/err-code": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", + "dev": true + }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -10241,6 +10773,12 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/exponential-backoff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.1.tgz", + "integrity": "sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==", + "dev": true + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -10633,6 +11171,18 @@ "klaw": "^1.0.0" } }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -10686,6 +11236,25 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gauge": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz", + "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==", + "dev": true, + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.3", + "console-control-strings": "^1.1.0", + "has-unicode": "^2.0.1", + "signal-exit": "^3.0.7", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -10930,6 +11499,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, "dependencies": { "function-bind": "^1.1.1" }, @@ -11022,6 +11592,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", + "dev": true + }, "node_modules/hash-base": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", @@ -11192,6 +11768,12 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "node_modules/http-cache-semantics": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", + "dev": true + }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -11220,6 +11802,20 @@ "node": ">= 0.8" } }, + "node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/https-proxy-agent": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", @@ -11240,6 +11836,15 @@ "node": ">=10.17.0" } }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "dev": true, + "dependencies": { + "ms": "^2.0.0" + } + }, "node_modules/humps": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/humps/-/humps-2.0.1.tgz", @@ -11359,9 +11964,24 @@ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "engines": { - "node": ">=0.8.19" + "node": ">=0.8.19" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "engines": { + "node": ">=8" } }, + "node_modules/infer-owner": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", + "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", + "dev": true + }, "node_modules/inflation": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/inflation/-/inflation-2.0.0.tgz", @@ -11513,11 +12133,11 @@ } }, "node_modules/is-core-module": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", - "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -11621,6 +12241,12 @@ "node": ">=8" } }, + "node_modules/is-lambda": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", + "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", + "dev": true + }, "node_modules/is-nan": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", @@ -15465,6 +16091,42 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/make-fetch-happen": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz", + "integrity": "sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w==", + "dev": true, + "dependencies": { + "agentkeepalive": "^4.2.1", + "cacache": "^16.1.0", + "http-cache-semantics": "^4.1.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "is-lambda": "^1.0.1", + "lru-cache": "^7.7.1", + "minipass": "^3.1.6", + "minipass-collect": "^1.0.2", + "minipass-fetch": "^2.0.3", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.3", + "promise-retry": "^2.0.1", + "socks-proxy-agent": "^7.0.0", + "ssri": "^9.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/make-fetch-happen/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/makeerror": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", @@ -16628,6 +17290,108 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-collect": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", + "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minipass-fetch": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.1.2.tgz", + "integrity": "sha512-LT49Zi2/WMROHYoqGgdlQIZh8mLPZmOrN2NdJjMXxYe4nkN6FUyuPuOAOedNJDrx0IRGg9+4guZewtp8hE6TxA==", + "dev": true, + "dependencies": { + "minipass": "^3.1.6", + "minipass-sized": "^1.0.3", + "minizlib": "^2.1.2" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "optionalDependencies": { + "encoding": "^0.1.13" + } + }, + "node_modules/minipass-flush": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", + "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minipass-pipeline": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", + "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-sized": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", + "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/mixin-object": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/mixin-object/-/mixin-object-2.0.1.tgz", @@ -16797,6 +17561,31 @@ "webidl-conversions": "^3.0.0" } }, + "node_modules/node-gyp": { + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.1.tgz", + "integrity": "sha512-OQkWKbjQKbGkMf/xqI1jjy3oCTgMKJac58G2+bjZb3fza6gW2YrCSdMQYaoTb70crvE//Gngr4f0AgVHmqHvBQ==", + "dev": true, + "dependencies": { + "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", + "glob": "^7.1.4", + "graceful-fs": "^4.2.6", + "make-fetch-happen": "^10.0.3", + "nopt": "^6.0.0", + "npmlog": "^6.0.0", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.2", + "which": "^2.0.2" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": "^12.13 || ^14.13 || >=16" + } + }, "node_modules/node-gyp-build": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", @@ -16829,6 +17618,21 @@ "url": "https://github.com/sponsors/antelle" } }, + "node_modules/nopt": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz", + "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==", + "dev": true, + "dependencies": { + "abbrev": "^1.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -16837,6 +17641,15 @@ "node": ">=0.10.0" } }, + "node_modules/npm-normalize-package-bin": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-3.0.1.tgz", + "integrity": "sha512-dMxCf+zZ+3zeQZXKxmyuCKlIDPGuv8EF940xbkC4kQVDTtqoh6rJFO+JTKSA6/Rwi0getWmtuy4Itup0AMcaDQ==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -16848,6 +17661,21 @@ "node": ">=8" } }, + "node_modules/npmlog": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz", + "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==", + "dev": true, + "dependencies": { + "are-we-there-yet": "^3.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^4.0.3", + "set-blocking": "^2.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, "node_modules/nth-check": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", @@ -17212,6 +18040,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -17774,6 +18617,25 @@ "asap": "~2.0.6" } }, + "node_modules/promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==", + "dev": true + }, + "node_modules/promise-retry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", + "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "dev": true, + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -18687,6 +19549,37 @@ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", "dev": true }, + "node_modules/read-cmd-shim": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/read-cmd-shim/-/read-cmd-shim-4.0.0.tgz", + "integrity": "sha512-yILWifhaSEEytfXI76kB9xEEiG1AiozaCJZ83A87ytjRiN+jVibXjedjCRNjoZviinhG+4UkalO3mWTd8u5O0Q==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/read-package-json-fast": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-3.0.2.tgz", + "integrity": "sha512-0J+Msgym3vrLOUB3hzQCuZHII0xkNGCtz/HJH9xZshwv9DbDwkw1KaE3gx/e2J5rpEY5rtOy6cyhKOPrkP7FZw==", + "dev": true, + "dependencies": { + "json-parse-even-better-errors": "^3.0.0", + "npm-normalize-package-bin": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/read-package-json-fast/node_modules/json-parse-even-better-errors": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.1.tgz", + "integrity": "sha512-aatBvbL26wVUCLmbWdCpeu9iF5wOyWpagiKkInA+kfws3sWdBrTnsvN2CKcyCYyUrc7rebNBlK6+kteg7ksecg==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/readable-stream": { "version": "1.1.14", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", @@ -18855,11 +19748,11 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" }, "node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dependencies": { - "is-core-module": "^2.11.0", + "is-core-module": "^2.13.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -18911,6 +19804,15 @@ "node": ">=8" } }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -19375,6 +20277,50 @@ "node": ">=6" } }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true, + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", + "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", + "dev": true, + "dependencies": { + "ip": "^2.0.0", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.13.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz", + "integrity": "sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==", + "dev": true, + "dependencies": { + "agent-base": "^6.0.2", + "debug": "^4.3.3", + "socks": "^2.6.2" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/socks/node_modules/ip": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", + "dev": true + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -19405,6 +20351,18 @@ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" }, + "node_modules/ssri": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.1.tgz", + "integrity": "sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q==", + "dev": true, + "dependencies": { + "minipass": "^3.1.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, "node_modules/stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", @@ -19728,6 +20686,50 @@ "node": ">= 8" } }, + "node_modules/tar": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", + "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", + "dev": true, + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/tar/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/tar/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/temp": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.3.tgz", @@ -20424,6 +21426,30 @@ "node": ">=4" } }, + "node_modules/unique-filename": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-2.0.1.tgz", + "integrity": "sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==", + "dev": true, + "dependencies": { + "unique-slug": "^3.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/unique-slug": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-3.0.0.tgz", + "integrity": "sha512-8EyMynh679x/0gqE9fT9oilG+qEt+ibFyqjuVTsZn1+CMxH+XLlpvr2UZx4nVcCwTpx81nICr2JQFkM+HPLq4w==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, "node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -20677,6 +21703,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "dev": true, + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, "node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", diff --git a/package.json b/package.json index e25e5590c..e7cdceae4 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "@fortawesome/react-native-fontawesome": "0.2.7", "@hathor/unleash-client": "0.1.0", "@hathor/wallet-lib": "1.0.1", + "@lavamoat/preinstall-always-fail": "^2.0.0", "@notifee/react-native": "5.7.0", "@react-native-async-storage/async-storage": "1.19.0", "@react-native-firebase/app": "16.7.0", @@ -81,6 +82,7 @@ "@babel/preset-env": "7.22.7", "@babel/runtime": "7.22.6", "@jest/globals": "29.7.0", + "@lavamoat/allow-scripts": "^3.0.1", "@react-native/eslint-config": "0.72.2", "@react-native/metro-config": "0.72.11", "@tsconfig/react-native": "3.0.2", From 599365fbdd75c2a702e502092981da03926d3bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 29 Jan 2024 13:52:52 -0300 Subject: [PATCH 07/47] chore: added updated allowScript config --- package.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/package.json b/package.json index e7cdceae4..da6baef50 100644 --- a/package.json +++ b/package.json @@ -134,5 +134,20 @@ "/jestMockSetup.js" ], "cacheDirectory": ".jest/cache" + }, + "lavamoat": { + "allowScripts": { + "$root$": false, + "@fortawesome/fontawesome-svg-core": false, + "@fortawesome/fontawesome-svg-core>@fortawesome/fontawesome-common-types": false, + "@fortawesome/free-regular-svg-icons": false, + "@fortawesome/free-regular-svg-icons>@fortawesome/fontawesome-common-types": false, + "@fortawesome/free-solid-svg-icons": false, + "@fortawesome/free-solid-svg-icons>@fortawesome/fontawesome-common-types": false, + "@hathor/wallet-lib>level>classic-level": false, + "@lavamoat/preinstall-always-fail": false, + "@sentry/react-native>@sentry/cli": false, + "ttag-cli": false + } } } From d176271183dc2675df3900502e80b86d6c300e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 29 Jan 2024 14:35:09 -0300 Subject: [PATCH 08/47] chore: added sha256sum of lockdown file --- SHA256SUMS | 1 + patches/react-native+0.72.5.patch | 1538 ++++++++++++++++++++++++++++- 2 files changed, 1537 insertions(+), 2 deletions(-) create mode 100644 SHA256SUMS diff --git a/SHA256SUMS b/SHA256SUMS new file mode 100644 index 000000000..484309b74 --- /dev/null +++ b/SHA256SUMS @@ -0,0 +1 @@ +f6220be2d2bad5babb5b8e50ecca6b7b2bb6751eb6548ca65f44e30e29abb93c lockdown.umd.js diff --git a/patches/react-native+0.72.5.patch b/patches/react-native+0.72.5.patch index 621552792..4c52ce9cf 100644 --- a/patches/react-native+0.72.5.patch +++ b/patches/react-native+0.72.5.patch @@ -1,8 +1,42 @@ diff --git a/node_modules/react-native/Libraries/Core/InitializeCore.js b/node_modules/react-native/Libraries/Core/InitializeCore.js -index 25377f6..4f902d9 100644 +index 25377f6..d36223d 100644 --- a/node_modules/react-native/Libraries/Core/InitializeCore.js +++ b/node_modules/react-native/Libraries/Core/InitializeCore.js -@@ -30,7 +30,7 @@ require('./setUpGlobals'); +@@ -24,13 +24,41 @@ + + 'use strict'; + ++const Platform = require('../Utilities/Platform'); ++ ++const IS_LOCKDOWN_ENABLED = true; ++ ++if (IS_LOCKDOWN_ENABLED && Platform.OS === 'ios' && !global?.HermesInternal) { ++ require('../../../../lockdown.umd.js'); ++ ++ /** ++ * Without consoleTaming: 'unsafe' causes: ++ * - Attempting to define property on object that is not extensible. ++ * Without errorTrapping 'none' causes: ++ * - TypeError: undefined is not a function (near '...globalThis.process.on...') ++ * Without unhandledRejectionTrapping 'none' causes: ++ * - TypeError: globalThis.process.on is not a function. (In 'globalThis.process.on('unhandledRejection', h.unhandledRejectionHandler)', 'globalThis.process.on' is undefined) ++ * overrideTaming 'severe' is ideal (default override?) ++ * Nb: global.process is only partially shimmed, which confuses SES ++ * Nb: All are Unhandled JS Exceptions, since we call lockdown before setUpErrorHandling ++ */ ++ repairIntrinsics({ ++ consoleTaming: 'unsafe', ++ errorTrapping: 'none', ++ unhandledRejectionTrapping: 'none', ++ overrideTaming: 'severe', ++ }); ++ ++ hardenIntrinsics(); ++} ++ + const start = Date.now(); + + require('./setUpGlobals'); require('./setUpDOM'); require('./setUpPerformance'); require('./setUpErrorHandling'); @@ -11,3 +45,1503 @@ index 25377f6..4f902d9 100644 require('./setUpRegeneratorRuntime'); require('./setUpTimers'); require('./setUpXHR'); +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h +new file mode 100644 +index 0000000..37b7d8d +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h +@@ -0,0 +1,29 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateComponentDescriptorH.js ++ */ ++ ++#pragma once ++ ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++using AndroidHorizontalScrollContentViewComponentDescriptor = ConcreteComponentDescriptor; ++using AndroidSwipeRefreshLayoutComponentDescriptor = ConcreteComponentDescriptor; ++using PullToRefreshViewComponentDescriptor = ConcreteComponentDescriptor; ++using AndroidDrawerLayoutComponentDescriptor = ConcreteComponentDescriptor; ++using ActivityIndicatorViewComponentDescriptor = ConcreteComponentDescriptor; ++using UnimplementedNativeViewComponentDescriptor = ConcreteComponentDescriptor; ++using SwitchComponentDescriptor = ConcreteComponentDescriptor; ++using TraceUpdateOverlayComponentDescriptor = ConcreteComponentDescriptor; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp +new file mode 100644 +index 0000000..229fadc +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp +@@ -0,0 +1,111 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateEventEmitterCpp.js ++ */ ++ ++#include ++ ++namespace facebook { ++namespace react { ++ ++ ++ ++ ++void AndroidSwipeRefreshLayoutEventEmitter::onRefresh(OnRefresh event) const { ++ dispatchEvent("refresh", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void PullToRefreshViewEventEmitter::onRefresh(OnRefresh event) const { ++ dispatchEvent("refresh", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++ ++void AndroidDrawerLayoutEventEmitter::onDrawerSlide(OnDrawerSlide event) const { ++ dispatchEvent("drawerSlide", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "offset", event.offset); ++ return payload; ++ }); ++} ++void AndroidDrawerLayoutEventEmitter::onDrawerStateChanged(OnDrawerStateChanged event) const { ++ dispatchEvent("drawerStateChanged", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "drawerState", event.drawerState); ++ return payload; ++ }); ++} ++void AndroidDrawerLayoutEventEmitter::onDrawerOpen(OnDrawerOpen event) const { ++ dispatchEvent("drawerOpen", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void AndroidDrawerLayoutEventEmitter::onDrawerClose(OnDrawerClose event) const { ++ dispatchEvent("drawerClose", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++ ++ ++void SwitchEventEmitter::onChange(OnChange event) const { ++ dispatchEvent("change", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "value", event.value); ++payload.setProperty(runtime, "target", event.target); ++ return payload; ++ }); ++} ++void AndroidSwitchEventEmitter::onChange(OnChange event) const { ++ dispatchEvent("change", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "value", event.value); ++payload.setProperty(runtime, "target", event.target); ++ return payload; ++ }); ++} ++ ++void ModalHostViewEventEmitter::onRequestClose(OnRequestClose event) const { ++ dispatchEvent("requestClose", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void ModalHostViewEventEmitter::onShow(OnShow event) const { ++ dispatchEvent("show", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void ModalHostViewEventEmitter::onDismiss(OnDismiss event) const { ++ dispatchEvent("dismiss", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void ModalHostViewEventEmitter::onOrientationChange(OnOrientationChange event) const { ++ dispatchEvent("orientationChange", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "orientation", toString(event.orientation)); ++ return payload; ++ }); ++} ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h +new file mode 100644 +index 0000000..1897be1 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h +@@ -0,0 +1,186 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateEventEmitterH.js ++ */ ++#pragma once ++ ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++class JSI_EXPORT SafeAreaViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT AndroidHorizontalScrollContentViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT AndroidProgressBarEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT AndroidSwipeRefreshLayoutEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnRefresh { ++ ++ }; ++ ++ void onRefresh(OnRefresh value) const; ++}; ++class JSI_EXPORT PullToRefreshViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnRefresh { ++ ++ }; ++ ++ void onRefresh(OnRefresh value) const; ++}; ++class JSI_EXPORT InputAccessoryEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT AndroidDrawerLayoutEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnDrawerSlide { ++ Float offset; ++ }; ++ ++ struct OnDrawerStateChanged { ++ int drawerState; ++ }; ++ ++ struct OnDrawerOpen { ++ ++ }; ++ ++ struct OnDrawerClose { ++ ++ }; ++ ++ void onDrawerSlide(OnDrawerSlide value) const; ++ ++ void onDrawerStateChanged(OnDrawerStateChanged value) const; ++ ++ void onDrawerOpen(OnDrawerOpen value) const; ++ ++ void onDrawerClose(OnDrawerClose value) const; ++}; ++class JSI_EXPORT ActivityIndicatorViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT UnimplementedNativeViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT SwitchEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnChange { ++ bool value; ++ int target; ++ }; ++ ++ void onChange(OnChange value) const; ++}; ++class JSI_EXPORT AndroidSwitchEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnChange { ++ bool value; ++ int target; ++ }; ++ ++ void onChange(OnChange value) const; ++}; ++class JSI_EXPORT TraceUpdateOverlayEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT ModalHostViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnRequestClose { ++ ++ }; ++ ++ struct OnShow { ++ ++ }; ++ ++ struct OnDismiss { ++ ++ }; ++ ++ enum class OnOrientationChangeOrientation { ++ Portrait, ++ Landscape ++ }; ++ ++ static char const *toString(const OnOrientationChangeOrientation value) { ++ switch (value) { ++ case OnOrientationChangeOrientation::Portrait: return "portrait"; ++ case OnOrientationChangeOrientation::Landscape: return "landscape"; ++ } ++ } ++ ++ struct OnOrientationChange { ++ OnOrientationChangeOrientation orientation; ++ }; ++ ++ void onRequestClose(OnRequestClose value) const; ++ ++ void onShow(OnShow value) const; ++ ++ void onDismiss(OnDismiss value) const; ++ ++ void onOrientationChange(OnOrientationChange value) const; ++}; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp +new file mode 100644 +index 0000000..59f24e5 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp +@@ -0,0 +1,157 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GeneratePropsCpp.js ++ */ ++ ++#include ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++SafeAreaViewProps::SafeAreaViewProps( ++ const PropsParserContext &context, ++ const SafeAreaViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) ++ ++ ++ {} ++AndroidHorizontalScrollContentViewProps::AndroidHorizontalScrollContentViewProps( ++ const PropsParserContext &context, ++ const AndroidHorizontalScrollContentViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ removeClippedSubviews(convertRawProp(context, rawProps, "removeClippedSubviews", sourceProps.removeClippedSubviews, {false})) ++ {} ++AndroidProgressBarProps::AndroidProgressBarProps( ++ const PropsParserContext &context, ++ const AndroidProgressBarProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ styleAttr(convertRawProp(context, rawProps, "styleAttr", sourceProps.styleAttr, {})), ++ typeAttr(convertRawProp(context, rawProps, "typeAttr", sourceProps.typeAttr, {})), ++ indeterminate(convertRawProp(context, rawProps, "indeterminate", sourceProps.indeterminate, {false})), ++ progress(convertRawProp(context, rawProps, "progress", sourceProps.progress, {0.0})), ++ animating(convertRawProp(context, rawProps, "animating", sourceProps.animating, {true})), ++ color(convertRawProp(context, rawProps, "color", sourceProps.color, {})), ++ testID(convertRawProp(context, rawProps, "testID", sourceProps.testID, {""})) ++ {} ++AndroidSwipeRefreshLayoutProps::AndroidSwipeRefreshLayoutProps( ++ const PropsParserContext &context, ++ const AndroidSwipeRefreshLayoutProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ enabled(convertRawProp(context, rawProps, "enabled", sourceProps.enabled, {true})), ++ colors(convertRawProp(context, rawProps, "colors", sourceProps.colors, {})), ++ progressBackgroundColor(convertRawProp(context, rawProps, "progressBackgroundColor", sourceProps.progressBackgroundColor, {})), ++ size(convertRawProp(context, rawProps, "size", sourceProps.size, {AndroidSwipeRefreshLayoutSize::Default})), ++ progressViewOffset(convertRawProp(context, rawProps, "progressViewOffset", sourceProps.progressViewOffset, {0.0})), ++ refreshing(convertRawProp(context, rawProps, "refreshing", sourceProps.refreshing, {false})) ++ {} ++PullToRefreshViewProps::PullToRefreshViewProps( ++ const PropsParserContext &context, ++ const PullToRefreshViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ tintColor(convertRawProp(context, rawProps, "tintColor", sourceProps.tintColor, {})), ++ titleColor(convertRawProp(context, rawProps, "titleColor", sourceProps.titleColor, {})), ++ title(convertRawProp(context, rawProps, "title", sourceProps.title, {})), ++ progressViewOffset(convertRawProp(context, rawProps, "progressViewOffset", sourceProps.progressViewOffset, {0.0})), ++ refreshing(convertRawProp(context, rawProps, "refreshing", sourceProps.refreshing, {false})) ++ {} ++InputAccessoryProps::InputAccessoryProps( ++ const PropsParserContext &context, ++ const InputAccessoryProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ backgroundColor(convertRawProp(context, rawProps, "backgroundColor", sourceProps.backgroundColor, {})) ++ {} ++AndroidDrawerLayoutProps::AndroidDrawerLayoutProps( ++ const PropsParserContext &context, ++ const AndroidDrawerLayoutProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ keyboardDismissMode(convertRawProp(context, rawProps, "keyboardDismissMode", sourceProps.keyboardDismissMode, {AndroidDrawerLayoutKeyboardDismissMode::None})), ++ drawerBackgroundColor(convertRawProp(context, rawProps, "drawerBackgroundColor", sourceProps.drawerBackgroundColor, {})), ++ drawerPosition(convertRawProp(context, rawProps, "drawerPosition", sourceProps.drawerPosition, {AndroidDrawerLayoutDrawerPosition::Left})), ++ drawerWidth(convertRawProp(context, rawProps, "drawerWidth", sourceProps.drawerWidth, {})), ++ drawerLockMode(convertRawProp(context, rawProps, "drawerLockMode", sourceProps.drawerLockMode, {AndroidDrawerLayoutDrawerLockMode::Unlocked})), ++ statusBarBackgroundColor(convertRawProp(context, rawProps, "statusBarBackgroundColor", sourceProps.statusBarBackgroundColor, {})) ++ {} ++ActivityIndicatorViewProps::ActivityIndicatorViewProps( ++ const PropsParserContext &context, ++ const ActivityIndicatorViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ hidesWhenStopped(convertRawProp(context, rawProps, "hidesWhenStopped", sourceProps.hidesWhenStopped, {false})), ++ animating(convertRawProp(context, rawProps, "animating", sourceProps.animating, {false})), ++ color(convertRawProp(context, rawProps, "color", sourceProps.color, {})), ++ size(convertRawProp(context, rawProps, "size", sourceProps.size, {ActivityIndicatorViewSize::Small})) ++ {} ++UnimplementedNativeViewProps::UnimplementedNativeViewProps( ++ const PropsParserContext &context, ++ const UnimplementedNativeViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ name(convertRawProp(context, rawProps, "name", sourceProps.name, {""})) ++ {} ++SwitchProps::SwitchProps( ++ const PropsParserContext &context, ++ const SwitchProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ disabled(convertRawProp(context, rawProps, "disabled", sourceProps.disabled, {false})), ++ value(convertRawProp(context, rawProps, "value", sourceProps.value, {false})), ++ tintColor(convertRawProp(context, rawProps, "tintColor", sourceProps.tintColor, {})), ++ onTintColor(convertRawProp(context, rawProps, "onTintColor", sourceProps.onTintColor, {})), ++ thumbTintColor(convertRawProp(context, rawProps, "thumbTintColor", sourceProps.thumbTintColor, {})), ++ thumbColor(convertRawProp(context, rawProps, "thumbColor", sourceProps.thumbColor, {})), ++ trackColorForFalse(convertRawProp(context, rawProps, "trackColorForFalse", sourceProps.trackColorForFalse, {})), ++ trackColorForTrue(convertRawProp(context, rawProps, "trackColorForTrue", sourceProps.trackColorForTrue, {})) ++ {} ++AndroidSwitchProps::AndroidSwitchProps( ++ const PropsParserContext &context, ++ const AndroidSwitchProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ disabled(convertRawProp(context, rawProps, "disabled", sourceProps.disabled, {false})), ++ enabled(convertRawProp(context, rawProps, "enabled", sourceProps.enabled, {true})), ++ thumbColor(convertRawProp(context, rawProps, "thumbColor", sourceProps.thumbColor, {})), ++ trackColorForFalse(convertRawProp(context, rawProps, "trackColorForFalse", sourceProps.trackColorForFalse, {})), ++ trackColorForTrue(convertRawProp(context, rawProps, "trackColorForTrue", sourceProps.trackColorForTrue, {})), ++ value(convertRawProp(context, rawProps, "value", sourceProps.value, {false})), ++ on(convertRawProp(context, rawProps, "on", sourceProps.on, {false})), ++ thumbTintColor(convertRawProp(context, rawProps, "thumbTintColor", sourceProps.thumbTintColor, {})), ++ trackTintColor(convertRawProp(context, rawProps, "trackTintColor", sourceProps.trackTintColor, {})) ++ {} ++TraceUpdateOverlayProps::TraceUpdateOverlayProps( ++ const PropsParserContext &context, ++ const TraceUpdateOverlayProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) ++ ++ ++ {} ++ModalHostViewProps::ModalHostViewProps( ++ const PropsParserContext &context, ++ const ModalHostViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ animationType(convertRawProp(context, rawProps, "animationType", sourceProps.animationType, {ModalHostViewAnimationType::None})), ++ presentationStyle(convertRawProp(context, rawProps, "presentationStyle", sourceProps.presentationStyle, {ModalHostViewPresentationStyle::FullScreen})), ++ transparent(convertRawProp(context, rawProps, "transparent", sourceProps.transparent, {false})), ++ statusBarTranslucent(convertRawProp(context, rawProps, "statusBarTranslucent", sourceProps.statusBarTranslucent, {false})), ++ hardwareAccelerated(convertRawProp(context, rawProps, "hardwareAccelerated", sourceProps.hardwareAccelerated, {false})), ++ visible(convertRawProp(context, rawProps, "visible", sourceProps.visible, {false})), ++ animated(convertRawProp(context, rawProps, "animated", sourceProps.animated, {false})), ++ supportedOrientations(convertRawProp(context, rawProps, "supportedOrientations", sourceProps.supportedOrientations, {static_cast(ModalHostViewSupportedOrientations::Portrait)})), ++ identifier(convertRawProp(context, rawProps, "identifier", sourceProps.identifier, {0})) ++ {} ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h +new file mode 100644 +index 0000000..f402340 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h +@@ -0,0 +1,395 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GeneratePropsH.js ++ */ ++#pragma once ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++class JSI_EXPORT SafeAreaViewProps final : public ViewProps { ++ public: ++ SafeAreaViewProps() = default; ++ SafeAreaViewProps(const PropsParserContext& context, const SafeAreaViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ ++}; ++ ++class JSI_EXPORT AndroidHorizontalScrollContentViewProps final : public ViewProps { ++ public: ++ AndroidHorizontalScrollContentViewProps() = default; ++ AndroidHorizontalScrollContentViewProps(const PropsParserContext& context, const AndroidHorizontalScrollContentViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool removeClippedSubviews{false}; ++}; ++ ++class JSI_EXPORT AndroidProgressBarProps final : public ViewProps { ++ public: ++ AndroidProgressBarProps() = default; ++ AndroidProgressBarProps(const PropsParserContext& context, const AndroidProgressBarProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ std::string styleAttr{}; ++ std::string typeAttr{}; ++ bool indeterminate{false}; ++ double progress{0.0}; ++ bool animating{true}; ++ SharedColor color{}; ++ std::string testID{""}; ++}; ++ ++enum class AndroidSwipeRefreshLayoutSize { Default, Large }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidSwipeRefreshLayoutSize &result) { ++ auto string = (std::string)value; ++ if (string == "default") { result = AndroidSwipeRefreshLayoutSize::Default; return; } ++ if (string == "large") { result = AndroidSwipeRefreshLayoutSize::Large; return; } ++ abort(); ++} ++ ++static inline std::string toString(const AndroidSwipeRefreshLayoutSize &value) { ++ switch (value) { ++ case AndroidSwipeRefreshLayoutSize::Default: return "default"; ++ case AndroidSwipeRefreshLayoutSize::Large: return "large"; ++ } ++} ++ ++class JSI_EXPORT AndroidSwipeRefreshLayoutProps final : public ViewProps { ++ public: ++ AndroidSwipeRefreshLayoutProps() = default; ++ AndroidSwipeRefreshLayoutProps(const PropsParserContext& context, const AndroidSwipeRefreshLayoutProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool enabled{true}; ++ std::vector colors{}; ++ SharedColor progressBackgroundColor{}; ++ AndroidSwipeRefreshLayoutSize size{AndroidSwipeRefreshLayoutSize::Default}; ++ Float progressViewOffset{0.0}; ++ bool refreshing{false}; ++}; ++ ++class JSI_EXPORT PullToRefreshViewProps final : public ViewProps { ++ public: ++ PullToRefreshViewProps() = default; ++ PullToRefreshViewProps(const PropsParserContext& context, const PullToRefreshViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ SharedColor tintColor{}; ++ SharedColor titleColor{}; ++ std::string title{}; ++ Float progressViewOffset{0.0}; ++ bool refreshing{false}; ++}; ++ ++class JSI_EXPORT InputAccessoryProps final : public ViewProps { ++ public: ++ InputAccessoryProps() = default; ++ InputAccessoryProps(const PropsParserContext& context, const InputAccessoryProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ SharedColor backgroundColor{}; ++}; ++ ++enum class AndroidDrawerLayoutKeyboardDismissMode { None, OnDrag }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutKeyboardDismissMode &result) { ++ auto string = (std::string)value; ++ if (string == "none") { result = AndroidDrawerLayoutKeyboardDismissMode::None; return; } ++ if (string == "on-drag") { result = AndroidDrawerLayoutKeyboardDismissMode::OnDrag; return; } ++ abort(); ++} ++ ++static inline std::string toString(const AndroidDrawerLayoutKeyboardDismissMode &value) { ++ switch (value) { ++ case AndroidDrawerLayoutKeyboardDismissMode::None: return "none"; ++ case AndroidDrawerLayoutKeyboardDismissMode::OnDrag: return "on-drag"; ++ } ++} ++enum class AndroidDrawerLayoutDrawerPosition { Left, Right }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutDrawerPosition &result) { ++ auto string = (std::string)value; ++ if (string == "left") { result = AndroidDrawerLayoutDrawerPosition::Left; return; } ++ if (string == "right") { result = AndroidDrawerLayoutDrawerPosition::Right; return; } ++ abort(); ++} ++ ++static inline std::string toString(const AndroidDrawerLayoutDrawerPosition &value) { ++ switch (value) { ++ case AndroidDrawerLayoutDrawerPosition::Left: return "left"; ++ case AndroidDrawerLayoutDrawerPosition::Right: return "right"; ++ } ++} ++enum class AndroidDrawerLayoutDrawerLockMode { Unlocked, LockedClosed, LockedOpen }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutDrawerLockMode &result) { ++ auto string = (std::string)value; ++ if (string == "unlocked") { result = AndroidDrawerLayoutDrawerLockMode::Unlocked; return; } ++ if (string == "locked-closed") { result = AndroidDrawerLayoutDrawerLockMode::LockedClosed; return; } ++ if (string == "locked-open") { result = AndroidDrawerLayoutDrawerLockMode::LockedOpen; return; } ++ abort(); ++} ++ ++static inline std::string toString(const AndroidDrawerLayoutDrawerLockMode &value) { ++ switch (value) { ++ case AndroidDrawerLayoutDrawerLockMode::Unlocked: return "unlocked"; ++ case AndroidDrawerLayoutDrawerLockMode::LockedClosed: return "locked-closed"; ++ case AndroidDrawerLayoutDrawerLockMode::LockedOpen: return "locked-open"; ++ } ++} ++ ++class JSI_EXPORT AndroidDrawerLayoutProps final : public ViewProps { ++ public: ++ AndroidDrawerLayoutProps() = default; ++ AndroidDrawerLayoutProps(const PropsParserContext& context, const AndroidDrawerLayoutProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ AndroidDrawerLayoutKeyboardDismissMode keyboardDismissMode{AndroidDrawerLayoutKeyboardDismissMode::None}; ++ SharedColor drawerBackgroundColor{}; ++ AndroidDrawerLayoutDrawerPosition drawerPosition{AndroidDrawerLayoutDrawerPosition::Left}; ++ Float drawerWidth{}; ++ AndroidDrawerLayoutDrawerLockMode drawerLockMode{AndroidDrawerLayoutDrawerLockMode::Unlocked}; ++ SharedColor statusBarBackgroundColor{}; ++}; ++ ++enum class ActivityIndicatorViewSize { Small, Large }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ActivityIndicatorViewSize &result) { ++ auto string = (std::string)value; ++ if (string == "small") { result = ActivityIndicatorViewSize::Small; return; } ++ if (string == "large") { result = ActivityIndicatorViewSize::Large; return; } ++ abort(); ++} ++ ++static inline std::string toString(const ActivityIndicatorViewSize &value) { ++ switch (value) { ++ case ActivityIndicatorViewSize::Small: return "small"; ++ case ActivityIndicatorViewSize::Large: return "large"; ++ } ++} ++ ++class JSI_EXPORT ActivityIndicatorViewProps final : public ViewProps { ++ public: ++ ActivityIndicatorViewProps() = default; ++ ActivityIndicatorViewProps(const PropsParserContext& context, const ActivityIndicatorViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool hidesWhenStopped{false}; ++ bool animating{false}; ++ SharedColor color{}; ++ ActivityIndicatorViewSize size{ActivityIndicatorViewSize::Small}; ++}; ++ ++class JSI_EXPORT UnimplementedNativeViewProps final : public ViewProps { ++ public: ++ UnimplementedNativeViewProps() = default; ++ UnimplementedNativeViewProps(const PropsParserContext& context, const UnimplementedNativeViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ std::string name{""}; ++}; ++ ++class JSI_EXPORT SwitchProps final : public ViewProps { ++ public: ++ SwitchProps() = default; ++ SwitchProps(const PropsParserContext& context, const SwitchProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool disabled{false}; ++ bool value{false}; ++ SharedColor tintColor{}; ++ SharedColor onTintColor{}; ++ SharedColor thumbTintColor{}; ++ SharedColor thumbColor{}; ++ SharedColor trackColorForFalse{}; ++ SharedColor trackColorForTrue{}; ++}; ++ ++class JSI_EXPORT AndroidSwitchProps final : public ViewProps { ++ public: ++ AndroidSwitchProps() = default; ++ AndroidSwitchProps(const PropsParserContext& context, const AndroidSwitchProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool disabled{false}; ++ bool enabled{true}; ++ SharedColor thumbColor{}; ++ SharedColor trackColorForFalse{}; ++ SharedColor trackColorForTrue{}; ++ bool value{false}; ++ bool on{false}; ++ SharedColor thumbTintColor{}; ++ SharedColor trackTintColor{}; ++}; ++ ++class JSI_EXPORT TraceUpdateOverlayProps final : public ViewProps { ++ public: ++ TraceUpdateOverlayProps() = default; ++ TraceUpdateOverlayProps(const PropsParserContext& context, const TraceUpdateOverlayProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ ++}; ++ ++enum class ModalHostViewAnimationType { None, Slide, Fade }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewAnimationType &result) { ++ auto string = (std::string)value; ++ if (string == "none") { result = ModalHostViewAnimationType::None; return; } ++ if (string == "slide") { result = ModalHostViewAnimationType::Slide; return; } ++ if (string == "fade") { result = ModalHostViewAnimationType::Fade; return; } ++ abort(); ++} ++ ++static inline std::string toString(const ModalHostViewAnimationType &value) { ++ switch (value) { ++ case ModalHostViewAnimationType::None: return "none"; ++ case ModalHostViewAnimationType::Slide: return "slide"; ++ case ModalHostViewAnimationType::Fade: return "fade"; ++ } ++} ++enum class ModalHostViewPresentationStyle { FullScreen, PageSheet, FormSheet, OverFullScreen }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewPresentationStyle &result) { ++ auto string = (std::string)value; ++ if (string == "fullScreen") { result = ModalHostViewPresentationStyle::FullScreen; return; } ++ if (string == "pageSheet") { result = ModalHostViewPresentationStyle::PageSheet; return; } ++ if (string == "formSheet") { result = ModalHostViewPresentationStyle::FormSheet; return; } ++ if (string == "overFullScreen") { result = ModalHostViewPresentationStyle::OverFullScreen; return; } ++ abort(); ++} ++ ++static inline std::string toString(const ModalHostViewPresentationStyle &value) { ++ switch (value) { ++ case ModalHostViewPresentationStyle::FullScreen: return "fullScreen"; ++ case ModalHostViewPresentationStyle::PageSheet: return "pageSheet"; ++ case ModalHostViewPresentationStyle::FormSheet: return "formSheet"; ++ case ModalHostViewPresentationStyle::OverFullScreen: return "overFullScreen"; ++ } ++} ++using ModalHostViewSupportedOrientationsMask = uint32_t; ++ ++enum class ModalHostViewSupportedOrientations: ModalHostViewSupportedOrientationsMask { ++ Portrait = 1 << 0, ++ PortraitUpsideDown = 1 << 1, ++ Landscape = 1 << 2, ++ LandscapeLeft = 1 << 3, ++ LandscapeRight = 1 << 4 ++}; ++ ++constexpr bool operator&( ++ ModalHostViewSupportedOrientationsMask const lhs, ++ enum ModalHostViewSupportedOrientations const rhs) { ++ return lhs & static_cast(rhs); ++} ++ ++constexpr ModalHostViewSupportedOrientationsMask operator|( ++ ModalHostViewSupportedOrientationsMask const lhs, ++ enum ModalHostViewSupportedOrientations const rhs) { ++ return lhs | static_cast(rhs); ++} ++ ++constexpr void operator|=( ++ ModalHostViewSupportedOrientationsMask &lhs, ++ enum ModalHostViewSupportedOrientations const rhs) { ++ lhs = lhs | static_cast(rhs); ++} ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewSupportedOrientationsMask &result) { ++ auto items = std::vector{value}; ++ for (const auto &item : items) { ++ if (item == "portrait") { ++ result |= ModalHostViewSupportedOrientations::Portrait; ++ continue; ++ } ++ if (item == "portrait-upside-down") { ++ result |= ModalHostViewSupportedOrientations::PortraitUpsideDown; ++ continue; ++ } ++ if (item == "landscape") { ++ result |= ModalHostViewSupportedOrientations::Landscape; ++ continue; ++ } ++ if (item == "landscape-left") { ++ result |= ModalHostViewSupportedOrientations::LandscapeLeft; ++ continue; ++ } ++ if (item == "landscape-right") { ++ result |= ModalHostViewSupportedOrientations::LandscapeRight; ++ continue; ++ } ++ abort(); ++ } ++} ++ ++static inline std::string toString(const ModalHostViewSupportedOrientationsMask &value) { ++ auto result = std::string{}; ++ auto separator = std::string{", "}; ++ ++ if (value & ModalHostViewSupportedOrientations::Portrait) { ++ result += "portrait" + separator; ++ } ++ if (value & ModalHostViewSupportedOrientations::PortraitUpsideDown) { ++ result += "portrait-upside-down" + separator; ++ } ++ if (value & ModalHostViewSupportedOrientations::Landscape) { ++ result += "landscape" + separator; ++ } ++ if (value & ModalHostViewSupportedOrientations::LandscapeLeft) { ++ result += "landscape-left" + separator; ++ } ++ if (value & ModalHostViewSupportedOrientations::LandscapeRight) { ++ result += "landscape-right" + separator; ++ } ++ if (!result.empty()) { ++ result.erase(result.length() - separator.length()); ++ } ++ return result; ++} ++ ++class JSI_EXPORT ModalHostViewProps final : public ViewProps { ++ public: ++ ModalHostViewProps() = default; ++ ModalHostViewProps(const PropsParserContext& context, const ModalHostViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ ModalHostViewAnimationType animationType{ModalHostViewAnimationType::None}; ++ ModalHostViewPresentationStyle presentationStyle{ModalHostViewPresentationStyle::FullScreen}; ++ bool transparent{false}; ++ bool statusBarTranslucent{false}; ++ bool hardwareAccelerated{false}; ++ bool visible{false}; ++ bool animated{false}; ++ ModalHostViewSupportedOrientationsMask supportedOrientations{static_cast(ModalHostViewSupportedOrientations::Portrait)}; ++ int identifier{0}; ++}; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h +new file mode 100644 +index 0000000..e08f2ae +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h +@@ -0,0 +1,257 @@ ++/** ++* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++* ++* Do not edit this file as changes may cause incorrect behavior and will be lost ++* once the code is regenerated. ++* ++* @generated by codegen project: GenerateComponentHObjCpp.js ++*/ ++ ++#import ++#import ++#import ++ ++NS_ASSUME_NONNULL_BEGIN ++ ++@protocol RCTSafeAreaViewViewProtocol ++ ++@end ++ ++@protocol RCTAndroidHorizontalScrollContentViewViewProtocol ++ ++@end ++ ++@protocol RCTAndroidProgressBarViewProtocol ++ ++@end ++ ++@protocol RCTAndroidSwipeRefreshLayoutViewProtocol ++- (void)setNativeRefreshing:(BOOL)value; ++@end ++ ++RCT_EXTERN inline void RCTAndroidSwipeRefreshLayoutHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"setNativeRefreshing"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidSwipeRefreshLayout", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"AndroidSwipeRefreshLayout", commandName, @"1st")) { ++ return; ++ } ++#endif ++ BOOL value = [(NSNumber *)arg0 boolValue]; ++ ++ [componentView setNativeRefreshing:value]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidSwipeRefreshLayout", commandName); ++#endif ++} ++ ++@protocol RCTPullToRefreshViewViewProtocol ++- (void)setNativeRefreshing:(BOOL)refreshing; ++@end ++ ++RCT_EXTERN inline void RCTPullToRefreshViewHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"setNativeRefreshing"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"PullToRefreshView", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"PullToRefreshView", commandName, @"1st")) { ++ return; ++ } ++#endif ++ BOOL refreshing = [(NSNumber *)arg0 boolValue]; ++ ++ [componentView setNativeRefreshing:refreshing]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"PullToRefreshView", commandName); ++#endif ++} ++ ++@protocol RCTInputAccessoryViewProtocol ++ ++@end ++ ++@protocol RCTAndroidDrawerLayoutViewProtocol ++- (void)openDrawer; ++- (void)closeDrawer; ++@end ++ ++RCT_EXTERN inline void RCTAndroidDrawerLayoutHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"openDrawer"]) { ++#if RCT_DEBUG ++ if ([args count] != 0) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidDrawerLayout", commandName, (int)[args count], 0); ++ return; ++ } ++#endif ++ ++ ++ ++ [componentView openDrawer]; ++ return; ++} ++ ++if ([commandName isEqualToString:@"closeDrawer"]) { ++#if RCT_DEBUG ++ if ([args count] != 0) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidDrawerLayout", commandName, (int)[args count], 0); ++ return; ++ } ++#endif ++ ++ ++ ++ [componentView closeDrawer]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidDrawerLayout", commandName); ++#endif ++} ++ ++@protocol RCTActivityIndicatorViewViewProtocol ++ ++@end ++ ++@protocol RCTUnimplementedNativeViewViewProtocol ++ ++@end ++ ++@protocol RCTSwitchViewProtocol ++- (void)setValue:(BOOL)value; ++@end ++ ++RCT_EXTERN inline void RCTSwitchHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"setValue"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"Switch", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"Switch", commandName, @"1st")) { ++ return; ++ } ++#endif ++ BOOL value = [(NSNumber *)arg0 boolValue]; ++ ++ [componentView setValue:value]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"Switch", commandName); ++#endif ++} ++ ++@protocol RCTAndroidSwitchViewProtocol ++- (void)setNativeValue:(BOOL)value; ++@end ++ ++RCT_EXTERN inline void RCTAndroidSwitchHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"setNativeValue"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidSwitch", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"AndroidSwitch", commandName, @"1st")) { ++ return; ++ } ++#endif ++ BOOL value = [(NSNumber *)arg0 boolValue]; ++ ++ [componentView setNativeValue:value]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidSwitch", commandName); ++#endif ++} ++ ++@protocol RCTTraceUpdateOverlayViewProtocol ++- (void)draw:(NSString *)overlays; ++@end ++ ++RCT_EXTERN inline void RCTTraceUpdateOverlayHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"draw"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"TraceUpdateOverlay", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSString class], @"string", @"TraceUpdateOverlay", commandName, @"1st")) { ++ return; ++ } ++#endif ++ NSString * overlays = (NSString *)arg0; ++ ++ [componentView draw:overlays]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"TraceUpdateOverlay", commandName); ++#endif ++} ++ ++@protocol RCTModalHostViewViewProtocol ++ ++@end ++ ++NS_ASSUME_NONNULL_END +\ No newline at end of file +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp +new file mode 100644 +index 0000000..d9a2760 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp +@@ -0,0 +1,26 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateShadowNodeCpp.js ++ */ ++ ++#include ++ ++namespace facebook { ++namespace react { ++ ++extern const char AndroidHorizontalScrollContentViewComponentName[] = "AndroidHorizontalScrollContentView"; ++extern const char AndroidSwipeRefreshLayoutComponentName[] = "AndroidSwipeRefreshLayout"; ++extern const char PullToRefreshViewComponentName[] = "PullToRefreshView"; ++extern const char AndroidDrawerLayoutComponentName[] = "AndroidDrawerLayout"; ++extern const char ActivityIndicatorViewComponentName[] = "ActivityIndicatorView"; ++extern const char UnimplementedNativeViewComponentName[] = "UnimplementedNativeView"; ++extern const char SwitchComponentName[] = "Switch"; ++extern const char TraceUpdateOverlayComponentName[] = "TraceUpdateOverlay"; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h +new file mode 100644 +index 0000000..a5874dc +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h +@@ -0,0 +1,111 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateShadowNodeH.js ++ */ ++ ++#pragma once ++ ++#include ++#include ++#include ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++JSI_EXPORT extern const char AndroidHorizontalScrollContentViewComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using AndroidHorizontalScrollContentViewShadowNode = ConcreteViewShadowNode< ++ AndroidHorizontalScrollContentViewComponentName, ++ AndroidHorizontalScrollContentViewProps, ++ AndroidHorizontalScrollContentViewEventEmitter, ++ AndroidHorizontalScrollContentViewState>; ++ ++JSI_EXPORT extern const char AndroidSwipeRefreshLayoutComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using AndroidSwipeRefreshLayoutShadowNode = ConcreteViewShadowNode< ++ AndroidSwipeRefreshLayoutComponentName, ++ AndroidSwipeRefreshLayoutProps, ++ AndroidSwipeRefreshLayoutEventEmitter, ++ AndroidSwipeRefreshLayoutState>; ++ ++JSI_EXPORT extern const char PullToRefreshViewComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using PullToRefreshViewShadowNode = ConcreteViewShadowNode< ++ PullToRefreshViewComponentName, ++ PullToRefreshViewProps, ++ PullToRefreshViewEventEmitter, ++ PullToRefreshViewState>; ++ ++JSI_EXPORT extern const char AndroidDrawerLayoutComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using AndroidDrawerLayoutShadowNode = ConcreteViewShadowNode< ++ AndroidDrawerLayoutComponentName, ++ AndroidDrawerLayoutProps, ++ AndroidDrawerLayoutEventEmitter, ++ AndroidDrawerLayoutState>; ++ ++JSI_EXPORT extern const char ActivityIndicatorViewComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using ActivityIndicatorViewShadowNode = ConcreteViewShadowNode< ++ ActivityIndicatorViewComponentName, ++ ActivityIndicatorViewProps, ++ ActivityIndicatorViewEventEmitter, ++ ActivityIndicatorViewState>; ++ ++JSI_EXPORT extern const char UnimplementedNativeViewComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using UnimplementedNativeViewShadowNode = ConcreteViewShadowNode< ++ UnimplementedNativeViewComponentName, ++ UnimplementedNativeViewProps, ++ UnimplementedNativeViewEventEmitter, ++ UnimplementedNativeViewState>; ++ ++JSI_EXPORT extern const char SwitchComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using SwitchShadowNode = ConcreteViewShadowNode< ++ SwitchComponentName, ++ SwitchProps, ++ SwitchEventEmitter, ++ SwitchState>; ++ ++JSI_EXPORT extern const char TraceUpdateOverlayComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using TraceUpdateOverlayShadowNode = ConcreteViewShadowNode< ++ TraceUpdateOverlayComponentName, ++ TraceUpdateOverlayProps, ++ TraceUpdateOverlayEventEmitter, ++ TraceUpdateOverlayState>; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp +new file mode 100644 +index 0000000..3b5a0f5 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp +@@ -0,0 +1,18 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateStateCpp.js ++ */ ++#include ++ ++namespace facebook { ++namespace react { ++ ++ ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h +new file mode 100644 +index 0000000..29ac2df +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h +@@ -0,0 +1,141 @@ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateStateH.js ++ */ ++#pragma once ++ ++#ifdef ANDROID ++#include ++#include ++#include ++#endif ++ ++namespace facebook { ++namespace react { ++ ++class AndroidHorizontalScrollContentViewState { ++public: ++ AndroidHorizontalScrollContentViewState() = default; ++ ++#ifdef ANDROID ++ AndroidHorizontalScrollContentViewState(AndroidHorizontalScrollContentViewState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class AndroidSwipeRefreshLayoutState { ++public: ++ AndroidSwipeRefreshLayoutState() = default; ++ ++#ifdef ANDROID ++ AndroidSwipeRefreshLayoutState(AndroidSwipeRefreshLayoutState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class PullToRefreshViewState { ++public: ++ PullToRefreshViewState() = default; ++ ++#ifdef ANDROID ++ PullToRefreshViewState(PullToRefreshViewState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class AndroidDrawerLayoutState { ++public: ++ AndroidDrawerLayoutState() = default; ++ ++#ifdef ANDROID ++ AndroidDrawerLayoutState(AndroidDrawerLayoutState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class ActivityIndicatorViewState { ++public: ++ ActivityIndicatorViewState() = default; ++ ++#ifdef ANDROID ++ ActivityIndicatorViewState(ActivityIndicatorViewState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class UnimplementedNativeViewState { ++public: ++ UnimplementedNativeViewState() = default; ++ ++#ifdef ANDROID ++ UnimplementedNativeViewState(UnimplementedNativeViewState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class SwitchState { ++public: ++ SwitchState() = default; ++ ++#ifdef ANDROID ++ SwitchState(SwitchState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class TraceUpdateOverlayState { ++public: ++ TraceUpdateOverlayState() = default; ++ ++#ifdef ANDROID ++ TraceUpdateOverlayState(TraceUpdateOverlayState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++} // namespace react ++} // namespace facebook +\ No newline at end of file +diff --git a/node_modules/react-native/scripts/.packager.env b/node_modules/react-native/scripts/.packager.env +new file mode 100644 +index 0000000..361f5fb +--- /dev/null ++++ b/node_modules/react-native/scripts/.packager.env +@@ -0,0 +1 @@ ++export RCT_METRO_PORT=8081 From b79ad5a2974deab5e8482975d95a8b5047f6083f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 29 Jan 2024 14:35:39 -0300 Subject: [PATCH 09/47] refactor: moved lavamoat lockdown to a patch instead of entrypoint --- index.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/index.js b/index.js index 9ed4c6830..6f09ddade 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import './lockdown.umd'; import './i18nInit'; import { AppRegistry, View, Text } from 'react-native'; import { setJSExceptionHandler } from 'react-native-exception-handler'; @@ -18,11 +17,6 @@ import { setNotifeeBackgroundListener, } from './src/workers/backgroundListeners'; -lockdown({ - consoleTaming: 'unsafe', - errorTaming: 'unsafe', -}); - // Set the background listeners for push notifications setNotifeeBackgroundListener(); setBackgroundMessageListener(); From 7cfdc4458adcb647e0e7947699c8c203c9cabaab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 29 Jan 2024 14:35:58 -0300 Subject: [PATCH 10/47] refactor: removed ses from package.json, reading from file --- package-lock.json | 14 ++++++++++++++ package.json | 1 + 2 files changed, 15 insertions(+) diff --git a/package-lock.json b/package-lock.json index 1dd2df784..1b4cf8c0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -64,6 +64,7 @@ "redux": "4.2.1", "redux-saga": "1.2.3", "redux-thunk": "2.4.2", + "ses": "^1.0.1", "stream-browserify": "1.0.0", "ttag": "1.7.24", "url": "0.11.1" @@ -2204,6 +2205,11 @@ "node": ">=0.8.0" } }, + "node_modules/@endo/env-options": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@endo/env-options/-/env-options-1.1.0.tgz", + "integrity": "sha512-5D1AcZnoeaymT0yzccceyu1fbMJ7vqyrOluFC+ebVh7pDLcF5EqP27lyBdw1/GKSM60u1MOn9h9YVxmNC/Gi4A==" + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -20127,6 +20133,14 @@ "node": ">= 0.8.0" } }, + "node_modules/ses": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ses/-/ses-1.0.1.tgz", + "integrity": "sha512-iuqGQ1dsktipGgmC/FLL2agq88WcarXxbFDKMEPVyRUxhAhReKpBIO63uDK4IvYYofFJ6FpfhNn/mVTNZpPOCg==", + "dependencies": { + "@endo/env-options": "^1.0.1" + } + }, "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", diff --git a/package.json b/package.json index da6baef50..e1e25d8bc 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "redux": "4.2.1", "redux-saga": "1.2.3", "redux-thunk": "2.4.2", + "ses": "^1.0.1", "stream-browserify": "1.0.0", "ttag": "1.7.24", "url": "0.11.1" From f5b5aa3cd42590a19482d0e1aa65b481b17b8b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 29 Jan 2024 14:46:21 -0300 Subject: [PATCH 11/47] chore: fix lint by ignoring lockdown --- .eslintrc | 1 + index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index b54ef6ba2..b6c6a6e2c 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,7 @@ { "extends": "airbnb", "parser": "@babel/eslint-parser", + "ignorePatterns": ["lockdown.umd.js"], "plugins": [ "react" ], diff --git a/index.js b/index.js index 6f09ddade..2276e0829 100644 --- a/index.js +++ b/index.js @@ -6,7 +6,7 @@ */ import './i18nInit'; -import { AppRegistry, View, Text } from 'react-native'; +import { AppRegistry } from 'react-native'; import { setJSExceptionHandler } from 'react-native-exception-handler'; import App from './src/App'; import { name as appName } from './app.json'; From ca46bdbfb7bf07b68c72d06258fb79bb8c9c582b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Tue, 30 Jan 2024 11:50:05 -0300 Subject: [PATCH 12/47] chore: allowing root postinstall and running allow-scripts on npm run setup --- README.md | 8 +++++++- package.json | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7496a6a0e..30d5c4a58 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,13 @@ See the instructions to run on (Windows)[./WINDOWS.md]. ## Install -`npm install` +`npm run setup` + +### Check SES integrity + +The SES lockdown file should match the commited sha256 sum + +`sha256sum -c SHA256SUMS` ### Podfile install for iOS diff --git a/package.json b/package.json index e1e25d8bc..1bdb23e11 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "start:clean": "react-native start --reset-cache", "lint": "eslint .", "test": "jest", + "setup": "npm install && ./node_modules/.bin/allow-scripts", "locale-update-pot": "ttag extract -o ./locale/texts.pot ./src/", "postinstall": "rn-nodeify --install stream,process,path,events,crypto,console,buffer --hack" }, @@ -138,7 +139,7 @@ }, "lavamoat": { "allowScripts": { - "$root$": false, + "$root$": true, "@fortawesome/fontawesome-svg-core": false, "@fortawesome/fontawesome-svg-core>@fortawesome/fontawesome-common-types": false, "@fortawesome/free-regular-svg-icons": false, From 2821355fc4f180512b986ffd571cc0b05b60eafa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Tue, 30 Jan 2024 12:45:29 -0300 Subject: [PATCH 13/47] chore: added comment explaining why we can't use hermes --- ios/Podfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ios/Podfile b/ios/Podfile index 8fca48250..60f9e1ee6 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -43,7 +43,8 @@ target 'HathorMobile' do :path => config[:reactNativePath], # Hermes is now enabled by default. Disable by setting this flag to false. - :hermes_enabled => false, #flags[:hermes_enabled], + # We can't use Hermes with SES (https://github.com/facebook/hermes/issues/957) + :hermes_enabled => false, :fabric_enabled => flags[:fabric_enabled], # Enables Flipper. # From e46a8b781a327d391c7eba50bc76779bc4010837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Tue, 30 Jan 2024 12:47:39 -0300 Subject: [PATCH 14/47] chore: uninstall ses as we're using a downloaded file --- package-lock.json | 14 -------------- package.json | 1 - 2 files changed, 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1b4cf8c0b..1dd2df784 100644 --- a/package-lock.json +++ b/package-lock.json @@ -64,7 +64,6 @@ "redux": "4.2.1", "redux-saga": "1.2.3", "redux-thunk": "2.4.2", - "ses": "^1.0.1", "stream-browserify": "1.0.0", "ttag": "1.7.24", "url": "0.11.1" @@ -2205,11 +2204,6 @@ "node": ">=0.8.0" } }, - "node_modules/@endo/env-options": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@endo/env-options/-/env-options-1.1.0.tgz", - "integrity": "sha512-5D1AcZnoeaymT0yzccceyu1fbMJ7vqyrOluFC+ebVh7pDLcF5EqP27lyBdw1/GKSM60u1MOn9h9YVxmNC/Gi4A==" - }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -20133,14 +20127,6 @@ "node": ">= 0.8.0" } }, - "node_modules/ses": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ses/-/ses-1.0.1.tgz", - "integrity": "sha512-iuqGQ1dsktipGgmC/FLL2agq88WcarXxbFDKMEPVyRUxhAhReKpBIO63uDK4IvYYofFJ6FpfhNn/mVTNZpPOCg==", - "dependencies": { - "@endo/env-options": "^1.0.1" - } - }, "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", diff --git a/package.json b/package.json index 1bdb23e11..6c884f59b 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,6 @@ "redux": "4.2.1", "redux-saga": "1.2.3", "redux-thunk": "2.4.2", - "ses": "^1.0.1", "stream-browserify": "1.0.0", "ttag": "1.7.24", "url": "0.11.1" From 126ec6009b4e88344b13c8db6b13beca235debc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Tue, 30 Jan 2024 12:54:08 -0300 Subject: [PATCH 15/47] chore: removed unused diff from react-native patch --- patches/react-native+0.72.5.patch | 1507 +---------------------------- 1 file changed, 5 insertions(+), 1502 deletions(-) diff --git a/patches/react-native+0.72.5.patch b/patches/react-native+0.72.5.patch index 4c52ce9cf..c5b7b7208 100644 --- a/patches/react-native+0.72.5.patch +++ b/patches/react-native+0.72.5.patch @@ -1,8 +1,8 @@ diff --git a/node_modules/react-native/Libraries/Core/InitializeCore.js b/node_modules/react-native/Libraries/Core/InitializeCore.js -index 25377f6..d36223d 100644 +index 25377f6..7ab3637 100644 --- a/node_modules/react-native/Libraries/Core/InitializeCore.js +++ b/node_modules/react-native/Libraries/Core/InitializeCore.js -@@ -24,13 +24,41 @@ +@@ -24,13 +24,44 @@ 'use strict'; @@ -10,6 +10,8 @@ index 25377f6..d36223d 100644 + +const IS_LOCKDOWN_ENABLED = true; + ++// This piece of code was taken from this PR: https://github.com/MetaMask/metamask-mobile/pull/6586/files ++// which is the reference implementation of SES On react-native +if (IS_LOCKDOWN_ENABLED && Platform.OS === 'ios' && !global?.HermesInternal) { + require('../../../../lockdown.umd.js'); + @@ -33,6 +35,7 @@ index 25377f6..d36223d 100644 + + hardenIntrinsics(); +} ++ + const start = Date.now(); @@ -45,1503 +48,3 @@ index 25377f6..d36223d 100644 require('./setUpRegeneratorRuntime'); require('./setUpTimers'); require('./setUpXHR'); -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h -new file mode 100644 -index 0000000..37b7d8d ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h -@@ -0,0 +1,29 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateComponentDescriptorH.js -+ */ -+ -+#pragma once -+ -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+using AndroidHorizontalScrollContentViewComponentDescriptor = ConcreteComponentDescriptor; -+using AndroidSwipeRefreshLayoutComponentDescriptor = ConcreteComponentDescriptor; -+using PullToRefreshViewComponentDescriptor = ConcreteComponentDescriptor; -+using AndroidDrawerLayoutComponentDescriptor = ConcreteComponentDescriptor; -+using ActivityIndicatorViewComponentDescriptor = ConcreteComponentDescriptor; -+using UnimplementedNativeViewComponentDescriptor = ConcreteComponentDescriptor; -+using SwitchComponentDescriptor = ConcreteComponentDescriptor; -+using TraceUpdateOverlayComponentDescriptor = ConcreteComponentDescriptor; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp -new file mode 100644 -index 0000000..229fadc ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp -@@ -0,0 +1,111 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateEventEmitterCpp.js -+ */ -+ -+#include -+ -+namespace facebook { -+namespace react { -+ -+ -+ -+ -+void AndroidSwipeRefreshLayoutEventEmitter::onRefresh(OnRefresh event) const { -+ dispatchEvent("refresh", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void PullToRefreshViewEventEmitter::onRefresh(OnRefresh event) const { -+ dispatchEvent("refresh", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+ -+void AndroidDrawerLayoutEventEmitter::onDrawerSlide(OnDrawerSlide event) const { -+ dispatchEvent("drawerSlide", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "offset", event.offset); -+ return payload; -+ }); -+} -+void AndroidDrawerLayoutEventEmitter::onDrawerStateChanged(OnDrawerStateChanged event) const { -+ dispatchEvent("drawerStateChanged", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "drawerState", event.drawerState); -+ return payload; -+ }); -+} -+void AndroidDrawerLayoutEventEmitter::onDrawerOpen(OnDrawerOpen event) const { -+ dispatchEvent("drawerOpen", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void AndroidDrawerLayoutEventEmitter::onDrawerClose(OnDrawerClose event) const { -+ dispatchEvent("drawerClose", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+ -+ -+void SwitchEventEmitter::onChange(OnChange event) const { -+ dispatchEvent("change", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "value", event.value); -+payload.setProperty(runtime, "target", event.target); -+ return payload; -+ }); -+} -+void AndroidSwitchEventEmitter::onChange(OnChange event) const { -+ dispatchEvent("change", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "value", event.value); -+payload.setProperty(runtime, "target", event.target); -+ return payload; -+ }); -+} -+ -+void ModalHostViewEventEmitter::onRequestClose(OnRequestClose event) const { -+ dispatchEvent("requestClose", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void ModalHostViewEventEmitter::onShow(OnShow event) const { -+ dispatchEvent("show", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void ModalHostViewEventEmitter::onDismiss(OnDismiss event) const { -+ dispatchEvent("dismiss", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void ModalHostViewEventEmitter::onOrientationChange(OnOrientationChange event) const { -+ dispatchEvent("orientationChange", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "orientation", toString(event.orientation)); -+ return payload; -+ }); -+} -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h -new file mode 100644 -index 0000000..1897be1 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h -@@ -0,0 +1,186 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateEventEmitterH.js -+ */ -+#pragma once -+ -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+class JSI_EXPORT SafeAreaViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT AndroidHorizontalScrollContentViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT AndroidProgressBarEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT AndroidSwipeRefreshLayoutEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnRefresh { -+ -+ }; -+ -+ void onRefresh(OnRefresh value) const; -+}; -+class JSI_EXPORT PullToRefreshViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnRefresh { -+ -+ }; -+ -+ void onRefresh(OnRefresh value) const; -+}; -+class JSI_EXPORT InputAccessoryEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT AndroidDrawerLayoutEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnDrawerSlide { -+ Float offset; -+ }; -+ -+ struct OnDrawerStateChanged { -+ int drawerState; -+ }; -+ -+ struct OnDrawerOpen { -+ -+ }; -+ -+ struct OnDrawerClose { -+ -+ }; -+ -+ void onDrawerSlide(OnDrawerSlide value) const; -+ -+ void onDrawerStateChanged(OnDrawerStateChanged value) const; -+ -+ void onDrawerOpen(OnDrawerOpen value) const; -+ -+ void onDrawerClose(OnDrawerClose value) const; -+}; -+class JSI_EXPORT ActivityIndicatorViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT UnimplementedNativeViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT SwitchEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnChange { -+ bool value; -+ int target; -+ }; -+ -+ void onChange(OnChange value) const; -+}; -+class JSI_EXPORT AndroidSwitchEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnChange { -+ bool value; -+ int target; -+ }; -+ -+ void onChange(OnChange value) const; -+}; -+class JSI_EXPORT TraceUpdateOverlayEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT ModalHostViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnRequestClose { -+ -+ }; -+ -+ struct OnShow { -+ -+ }; -+ -+ struct OnDismiss { -+ -+ }; -+ -+ enum class OnOrientationChangeOrientation { -+ Portrait, -+ Landscape -+ }; -+ -+ static char const *toString(const OnOrientationChangeOrientation value) { -+ switch (value) { -+ case OnOrientationChangeOrientation::Portrait: return "portrait"; -+ case OnOrientationChangeOrientation::Landscape: return "landscape"; -+ } -+ } -+ -+ struct OnOrientationChange { -+ OnOrientationChangeOrientation orientation; -+ }; -+ -+ void onRequestClose(OnRequestClose value) const; -+ -+ void onShow(OnShow value) const; -+ -+ void onDismiss(OnDismiss value) const; -+ -+ void onOrientationChange(OnOrientationChange value) const; -+}; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp -new file mode 100644 -index 0000000..59f24e5 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp -@@ -0,0 +1,157 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GeneratePropsCpp.js -+ */ -+ -+#include -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+SafeAreaViewProps::SafeAreaViewProps( -+ const PropsParserContext &context, -+ const SafeAreaViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) -+ -+ -+ {} -+AndroidHorizontalScrollContentViewProps::AndroidHorizontalScrollContentViewProps( -+ const PropsParserContext &context, -+ const AndroidHorizontalScrollContentViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ removeClippedSubviews(convertRawProp(context, rawProps, "removeClippedSubviews", sourceProps.removeClippedSubviews, {false})) -+ {} -+AndroidProgressBarProps::AndroidProgressBarProps( -+ const PropsParserContext &context, -+ const AndroidProgressBarProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ styleAttr(convertRawProp(context, rawProps, "styleAttr", sourceProps.styleAttr, {})), -+ typeAttr(convertRawProp(context, rawProps, "typeAttr", sourceProps.typeAttr, {})), -+ indeterminate(convertRawProp(context, rawProps, "indeterminate", sourceProps.indeterminate, {false})), -+ progress(convertRawProp(context, rawProps, "progress", sourceProps.progress, {0.0})), -+ animating(convertRawProp(context, rawProps, "animating", sourceProps.animating, {true})), -+ color(convertRawProp(context, rawProps, "color", sourceProps.color, {})), -+ testID(convertRawProp(context, rawProps, "testID", sourceProps.testID, {""})) -+ {} -+AndroidSwipeRefreshLayoutProps::AndroidSwipeRefreshLayoutProps( -+ const PropsParserContext &context, -+ const AndroidSwipeRefreshLayoutProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ enabled(convertRawProp(context, rawProps, "enabled", sourceProps.enabled, {true})), -+ colors(convertRawProp(context, rawProps, "colors", sourceProps.colors, {})), -+ progressBackgroundColor(convertRawProp(context, rawProps, "progressBackgroundColor", sourceProps.progressBackgroundColor, {})), -+ size(convertRawProp(context, rawProps, "size", sourceProps.size, {AndroidSwipeRefreshLayoutSize::Default})), -+ progressViewOffset(convertRawProp(context, rawProps, "progressViewOffset", sourceProps.progressViewOffset, {0.0})), -+ refreshing(convertRawProp(context, rawProps, "refreshing", sourceProps.refreshing, {false})) -+ {} -+PullToRefreshViewProps::PullToRefreshViewProps( -+ const PropsParserContext &context, -+ const PullToRefreshViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ tintColor(convertRawProp(context, rawProps, "tintColor", sourceProps.tintColor, {})), -+ titleColor(convertRawProp(context, rawProps, "titleColor", sourceProps.titleColor, {})), -+ title(convertRawProp(context, rawProps, "title", sourceProps.title, {})), -+ progressViewOffset(convertRawProp(context, rawProps, "progressViewOffset", sourceProps.progressViewOffset, {0.0})), -+ refreshing(convertRawProp(context, rawProps, "refreshing", sourceProps.refreshing, {false})) -+ {} -+InputAccessoryProps::InputAccessoryProps( -+ const PropsParserContext &context, -+ const InputAccessoryProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ backgroundColor(convertRawProp(context, rawProps, "backgroundColor", sourceProps.backgroundColor, {})) -+ {} -+AndroidDrawerLayoutProps::AndroidDrawerLayoutProps( -+ const PropsParserContext &context, -+ const AndroidDrawerLayoutProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ keyboardDismissMode(convertRawProp(context, rawProps, "keyboardDismissMode", sourceProps.keyboardDismissMode, {AndroidDrawerLayoutKeyboardDismissMode::None})), -+ drawerBackgroundColor(convertRawProp(context, rawProps, "drawerBackgroundColor", sourceProps.drawerBackgroundColor, {})), -+ drawerPosition(convertRawProp(context, rawProps, "drawerPosition", sourceProps.drawerPosition, {AndroidDrawerLayoutDrawerPosition::Left})), -+ drawerWidth(convertRawProp(context, rawProps, "drawerWidth", sourceProps.drawerWidth, {})), -+ drawerLockMode(convertRawProp(context, rawProps, "drawerLockMode", sourceProps.drawerLockMode, {AndroidDrawerLayoutDrawerLockMode::Unlocked})), -+ statusBarBackgroundColor(convertRawProp(context, rawProps, "statusBarBackgroundColor", sourceProps.statusBarBackgroundColor, {})) -+ {} -+ActivityIndicatorViewProps::ActivityIndicatorViewProps( -+ const PropsParserContext &context, -+ const ActivityIndicatorViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ hidesWhenStopped(convertRawProp(context, rawProps, "hidesWhenStopped", sourceProps.hidesWhenStopped, {false})), -+ animating(convertRawProp(context, rawProps, "animating", sourceProps.animating, {false})), -+ color(convertRawProp(context, rawProps, "color", sourceProps.color, {})), -+ size(convertRawProp(context, rawProps, "size", sourceProps.size, {ActivityIndicatorViewSize::Small})) -+ {} -+UnimplementedNativeViewProps::UnimplementedNativeViewProps( -+ const PropsParserContext &context, -+ const UnimplementedNativeViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ name(convertRawProp(context, rawProps, "name", sourceProps.name, {""})) -+ {} -+SwitchProps::SwitchProps( -+ const PropsParserContext &context, -+ const SwitchProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ disabled(convertRawProp(context, rawProps, "disabled", sourceProps.disabled, {false})), -+ value(convertRawProp(context, rawProps, "value", sourceProps.value, {false})), -+ tintColor(convertRawProp(context, rawProps, "tintColor", sourceProps.tintColor, {})), -+ onTintColor(convertRawProp(context, rawProps, "onTintColor", sourceProps.onTintColor, {})), -+ thumbTintColor(convertRawProp(context, rawProps, "thumbTintColor", sourceProps.thumbTintColor, {})), -+ thumbColor(convertRawProp(context, rawProps, "thumbColor", sourceProps.thumbColor, {})), -+ trackColorForFalse(convertRawProp(context, rawProps, "trackColorForFalse", sourceProps.trackColorForFalse, {})), -+ trackColorForTrue(convertRawProp(context, rawProps, "trackColorForTrue", sourceProps.trackColorForTrue, {})) -+ {} -+AndroidSwitchProps::AndroidSwitchProps( -+ const PropsParserContext &context, -+ const AndroidSwitchProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ disabled(convertRawProp(context, rawProps, "disabled", sourceProps.disabled, {false})), -+ enabled(convertRawProp(context, rawProps, "enabled", sourceProps.enabled, {true})), -+ thumbColor(convertRawProp(context, rawProps, "thumbColor", sourceProps.thumbColor, {})), -+ trackColorForFalse(convertRawProp(context, rawProps, "trackColorForFalse", sourceProps.trackColorForFalse, {})), -+ trackColorForTrue(convertRawProp(context, rawProps, "trackColorForTrue", sourceProps.trackColorForTrue, {})), -+ value(convertRawProp(context, rawProps, "value", sourceProps.value, {false})), -+ on(convertRawProp(context, rawProps, "on", sourceProps.on, {false})), -+ thumbTintColor(convertRawProp(context, rawProps, "thumbTintColor", sourceProps.thumbTintColor, {})), -+ trackTintColor(convertRawProp(context, rawProps, "trackTintColor", sourceProps.trackTintColor, {})) -+ {} -+TraceUpdateOverlayProps::TraceUpdateOverlayProps( -+ const PropsParserContext &context, -+ const TraceUpdateOverlayProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) -+ -+ -+ {} -+ModalHostViewProps::ModalHostViewProps( -+ const PropsParserContext &context, -+ const ModalHostViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ animationType(convertRawProp(context, rawProps, "animationType", sourceProps.animationType, {ModalHostViewAnimationType::None})), -+ presentationStyle(convertRawProp(context, rawProps, "presentationStyle", sourceProps.presentationStyle, {ModalHostViewPresentationStyle::FullScreen})), -+ transparent(convertRawProp(context, rawProps, "transparent", sourceProps.transparent, {false})), -+ statusBarTranslucent(convertRawProp(context, rawProps, "statusBarTranslucent", sourceProps.statusBarTranslucent, {false})), -+ hardwareAccelerated(convertRawProp(context, rawProps, "hardwareAccelerated", sourceProps.hardwareAccelerated, {false})), -+ visible(convertRawProp(context, rawProps, "visible", sourceProps.visible, {false})), -+ animated(convertRawProp(context, rawProps, "animated", sourceProps.animated, {false})), -+ supportedOrientations(convertRawProp(context, rawProps, "supportedOrientations", sourceProps.supportedOrientations, {static_cast(ModalHostViewSupportedOrientations::Portrait)})), -+ identifier(convertRawProp(context, rawProps, "identifier", sourceProps.identifier, {0})) -+ {} -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h -new file mode 100644 -index 0000000..f402340 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h -@@ -0,0 +1,395 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GeneratePropsH.js -+ */ -+#pragma once -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+class JSI_EXPORT SafeAreaViewProps final : public ViewProps { -+ public: -+ SafeAreaViewProps() = default; -+ SafeAreaViewProps(const PropsParserContext& context, const SafeAreaViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ -+}; -+ -+class JSI_EXPORT AndroidHorizontalScrollContentViewProps final : public ViewProps { -+ public: -+ AndroidHorizontalScrollContentViewProps() = default; -+ AndroidHorizontalScrollContentViewProps(const PropsParserContext& context, const AndroidHorizontalScrollContentViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool removeClippedSubviews{false}; -+}; -+ -+class JSI_EXPORT AndroidProgressBarProps final : public ViewProps { -+ public: -+ AndroidProgressBarProps() = default; -+ AndroidProgressBarProps(const PropsParserContext& context, const AndroidProgressBarProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ std::string styleAttr{}; -+ std::string typeAttr{}; -+ bool indeterminate{false}; -+ double progress{0.0}; -+ bool animating{true}; -+ SharedColor color{}; -+ std::string testID{""}; -+}; -+ -+enum class AndroidSwipeRefreshLayoutSize { Default, Large }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidSwipeRefreshLayoutSize &result) { -+ auto string = (std::string)value; -+ if (string == "default") { result = AndroidSwipeRefreshLayoutSize::Default; return; } -+ if (string == "large") { result = AndroidSwipeRefreshLayoutSize::Large; return; } -+ abort(); -+} -+ -+static inline std::string toString(const AndroidSwipeRefreshLayoutSize &value) { -+ switch (value) { -+ case AndroidSwipeRefreshLayoutSize::Default: return "default"; -+ case AndroidSwipeRefreshLayoutSize::Large: return "large"; -+ } -+} -+ -+class JSI_EXPORT AndroidSwipeRefreshLayoutProps final : public ViewProps { -+ public: -+ AndroidSwipeRefreshLayoutProps() = default; -+ AndroidSwipeRefreshLayoutProps(const PropsParserContext& context, const AndroidSwipeRefreshLayoutProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool enabled{true}; -+ std::vector colors{}; -+ SharedColor progressBackgroundColor{}; -+ AndroidSwipeRefreshLayoutSize size{AndroidSwipeRefreshLayoutSize::Default}; -+ Float progressViewOffset{0.0}; -+ bool refreshing{false}; -+}; -+ -+class JSI_EXPORT PullToRefreshViewProps final : public ViewProps { -+ public: -+ PullToRefreshViewProps() = default; -+ PullToRefreshViewProps(const PropsParserContext& context, const PullToRefreshViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ SharedColor tintColor{}; -+ SharedColor titleColor{}; -+ std::string title{}; -+ Float progressViewOffset{0.0}; -+ bool refreshing{false}; -+}; -+ -+class JSI_EXPORT InputAccessoryProps final : public ViewProps { -+ public: -+ InputAccessoryProps() = default; -+ InputAccessoryProps(const PropsParserContext& context, const InputAccessoryProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ SharedColor backgroundColor{}; -+}; -+ -+enum class AndroidDrawerLayoutKeyboardDismissMode { None, OnDrag }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutKeyboardDismissMode &result) { -+ auto string = (std::string)value; -+ if (string == "none") { result = AndroidDrawerLayoutKeyboardDismissMode::None; return; } -+ if (string == "on-drag") { result = AndroidDrawerLayoutKeyboardDismissMode::OnDrag; return; } -+ abort(); -+} -+ -+static inline std::string toString(const AndroidDrawerLayoutKeyboardDismissMode &value) { -+ switch (value) { -+ case AndroidDrawerLayoutKeyboardDismissMode::None: return "none"; -+ case AndroidDrawerLayoutKeyboardDismissMode::OnDrag: return "on-drag"; -+ } -+} -+enum class AndroidDrawerLayoutDrawerPosition { Left, Right }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutDrawerPosition &result) { -+ auto string = (std::string)value; -+ if (string == "left") { result = AndroidDrawerLayoutDrawerPosition::Left; return; } -+ if (string == "right") { result = AndroidDrawerLayoutDrawerPosition::Right; return; } -+ abort(); -+} -+ -+static inline std::string toString(const AndroidDrawerLayoutDrawerPosition &value) { -+ switch (value) { -+ case AndroidDrawerLayoutDrawerPosition::Left: return "left"; -+ case AndroidDrawerLayoutDrawerPosition::Right: return "right"; -+ } -+} -+enum class AndroidDrawerLayoutDrawerLockMode { Unlocked, LockedClosed, LockedOpen }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutDrawerLockMode &result) { -+ auto string = (std::string)value; -+ if (string == "unlocked") { result = AndroidDrawerLayoutDrawerLockMode::Unlocked; return; } -+ if (string == "locked-closed") { result = AndroidDrawerLayoutDrawerLockMode::LockedClosed; return; } -+ if (string == "locked-open") { result = AndroidDrawerLayoutDrawerLockMode::LockedOpen; return; } -+ abort(); -+} -+ -+static inline std::string toString(const AndroidDrawerLayoutDrawerLockMode &value) { -+ switch (value) { -+ case AndroidDrawerLayoutDrawerLockMode::Unlocked: return "unlocked"; -+ case AndroidDrawerLayoutDrawerLockMode::LockedClosed: return "locked-closed"; -+ case AndroidDrawerLayoutDrawerLockMode::LockedOpen: return "locked-open"; -+ } -+} -+ -+class JSI_EXPORT AndroidDrawerLayoutProps final : public ViewProps { -+ public: -+ AndroidDrawerLayoutProps() = default; -+ AndroidDrawerLayoutProps(const PropsParserContext& context, const AndroidDrawerLayoutProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ AndroidDrawerLayoutKeyboardDismissMode keyboardDismissMode{AndroidDrawerLayoutKeyboardDismissMode::None}; -+ SharedColor drawerBackgroundColor{}; -+ AndroidDrawerLayoutDrawerPosition drawerPosition{AndroidDrawerLayoutDrawerPosition::Left}; -+ Float drawerWidth{}; -+ AndroidDrawerLayoutDrawerLockMode drawerLockMode{AndroidDrawerLayoutDrawerLockMode::Unlocked}; -+ SharedColor statusBarBackgroundColor{}; -+}; -+ -+enum class ActivityIndicatorViewSize { Small, Large }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ActivityIndicatorViewSize &result) { -+ auto string = (std::string)value; -+ if (string == "small") { result = ActivityIndicatorViewSize::Small; return; } -+ if (string == "large") { result = ActivityIndicatorViewSize::Large; return; } -+ abort(); -+} -+ -+static inline std::string toString(const ActivityIndicatorViewSize &value) { -+ switch (value) { -+ case ActivityIndicatorViewSize::Small: return "small"; -+ case ActivityIndicatorViewSize::Large: return "large"; -+ } -+} -+ -+class JSI_EXPORT ActivityIndicatorViewProps final : public ViewProps { -+ public: -+ ActivityIndicatorViewProps() = default; -+ ActivityIndicatorViewProps(const PropsParserContext& context, const ActivityIndicatorViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool hidesWhenStopped{false}; -+ bool animating{false}; -+ SharedColor color{}; -+ ActivityIndicatorViewSize size{ActivityIndicatorViewSize::Small}; -+}; -+ -+class JSI_EXPORT UnimplementedNativeViewProps final : public ViewProps { -+ public: -+ UnimplementedNativeViewProps() = default; -+ UnimplementedNativeViewProps(const PropsParserContext& context, const UnimplementedNativeViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ std::string name{""}; -+}; -+ -+class JSI_EXPORT SwitchProps final : public ViewProps { -+ public: -+ SwitchProps() = default; -+ SwitchProps(const PropsParserContext& context, const SwitchProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool disabled{false}; -+ bool value{false}; -+ SharedColor tintColor{}; -+ SharedColor onTintColor{}; -+ SharedColor thumbTintColor{}; -+ SharedColor thumbColor{}; -+ SharedColor trackColorForFalse{}; -+ SharedColor trackColorForTrue{}; -+}; -+ -+class JSI_EXPORT AndroidSwitchProps final : public ViewProps { -+ public: -+ AndroidSwitchProps() = default; -+ AndroidSwitchProps(const PropsParserContext& context, const AndroidSwitchProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool disabled{false}; -+ bool enabled{true}; -+ SharedColor thumbColor{}; -+ SharedColor trackColorForFalse{}; -+ SharedColor trackColorForTrue{}; -+ bool value{false}; -+ bool on{false}; -+ SharedColor thumbTintColor{}; -+ SharedColor trackTintColor{}; -+}; -+ -+class JSI_EXPORT TraceUpdateOverlayProps final : public ViewProps { -+ public: -+ TraceUpdateOverlayProps() = default; -+ TraceUpdateOverlayProps(const PropsParserContext& context, const TraceUpdateOverlayProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ -+}; -+ -+enum class ModalHostViewAnimationType { None, Slide, Fade }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewAnimationType &result) { -+ auto string = (std::string)value; -+ if (string == "none") { result = ModalHostViewAnimationType::None; return; } -+ if (string == "slide") { result = ModalHostViewAnimationType::Slide; return; } -+ if (string == "fade") { result = ModalHostViewAnimationType::Fade; return; } -+ abort(); -+} -+ -+static inline std::string toString(const ModalHostViewAnimationType &value) { -+ switch (value) { -+ case ModalHostViewAnimationType::None: return "none"; -+ case ModalHostViewAnimationType::Slide: return "slide"; -+ case ModalHostViewAnimationType::Fade: return "fade"; -+ } -+} -+enum class ModalHostViewPresentationStyle { FullScreen, PageSheet, FormSheet, OverFullScreen }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewPresentationStyle &result) { -+ auto string = (std::string)value; -+ if (string == "fullScreen") { result = ModalHostViewPresentationStyle::FullScreen; return; } -+ if (string == "pageSheet") { result = ModalHostViewPresentationStyle::PageSheet; return; } -+ if (string == "formSheet") { result = ModalHostViewPresentationStyle::FormSheet; return; } -+ if (string == "overFullScreen") { result = ModalHostViewPresentationStyle::OverFullScreen; return; } -+ abort(); -+} -+ -+static inline std::string toString(const ModalHostViewPresentationStyle &value) { -+ switch (value) { -+ case ModalHostViewPresentationStyle::FullScreen: return "fullScreen"; -+ case ModalHostViewPresentationStyle::PageSheet: return "pageSheet"; -+ case ModalHostViewPresentationStyle::FormSheet: return "formSheet"; -+ case ModalHostViewPresentationStyle::OverFullScreen: return "overFullScreen"; -+ } -+} -+using ModalHostViewSupportedOrientationsMask = uint32_t; -+ -+enum class ModalHostViewSupportedOrientations: ModalHostViewSupportedOrientationsMask { -+ Portrait = 1 << 0, -+ PortraitUpsideDown = 1 << 1, -+ Landscape = 1 << 2, -+ LandscapeLeft = 1 << 3, -+ LandscapeRight = 1 << 4 -+}; -+ -+constexpr bool operator&( -+ ModalHostViewSupportedOrientationsMask const lhs, -+ enum ModalHostViewSupportedOrientations const rhs) { -+ return lhs & static_cast(rhs); -+} -+ -+constexpr ModalHostViewSupportedOrientationsMask operator|( -+ ModalHostViewSupportedOrientationsMask const lhs, -+ enum ModalHostViewSupportedOrientations const rhs) { -+ return lhs | static_cast(rhs); -+} -+ -+constexpr void operator|=( -+ ModalHostViewSupportedOrientationsMask &lhs, -+ enum ModalHostViewSupportedOrientations const rhs) { -+ lhs = lhs | static_cast(rhs); -+} -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewSupportedOrientationsMask &result) { -+ auto items = std::vector{value}; -+ for (const auto &item : items) { -+ if (item == "portrait") { -+ result |= ModalHostViewSupportedOrientations::Portrait; -+ continue; -+ } -+ if (item == "portrait-upside-down") { -+ result |= ModalHostViewSupportedOrientations::PortraitUpsideDown; -+ continue; -+ } -+ if (item == "landscape") { -+ result |= ModalHostViewSupportedOrientations::Landscape; -+ continue; -+ } -+ if (item == "landscape-left") { -+ result |= ModalHostViewSupportedOrientations::LandscapeLeft; -+ continue; -+ } -+ if (item == "landscape-right") { -+ result |= ModalHostViewSupportedOrientations::LandscapeRight; -+ continue; -+ } -+ abort(); -+ } -+} -+ -+static inline std::string toString(const ModalHostViewSupportedOrientationsMask &value) { -+ auto result = std::string{}; -+ auto separator = std::string{", "}; -+ -+ if (value & ModalHostViewSupportedOrientations::Portrait) { -+ result += "portrait" + separator; -+ } -+ if (value & ModalHostViewSupportedOrientations::PortraitUpsideDown) { -+ result += "portrait-upside-down" + separator; -+ } -+ if (value & ModalHostViewSupportedOrientations::Landscape) { -+ result += "landscape" + separator; -+ } -+ if (value & ModalHostViewSupportedOrientations::LandscapeLeft) { -+ result += "landscape-left" + separator; -+ } -+ if (value & ModalHostViewSupportedOrientations::LandscapeRight) { -+ result += "landscape-right" + separator; -+ } -+ if (!result.empty()) { -+ result.erase(result.length() - separator.length()); -+ } -+ return result; -+} -+ -+class JSI_EXPORT ModalHostViewProps final : public ViewProps { -+ public: -+ ModalHostViewProps() = default; -+ ModalHostViewProps(const PropsParserContext& context, const ModalHostViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ ModalHostViewAnimationType animationType{ModalHostViewAnimationType::None}; -+ ModalHostViewPresentationStyle presentationStyle{ModalHostViewPresentationStyle::FullScreen}; -+ bool transparent{false}; -+ bool statusBarTranslucent{false}; -+ bool hardwareAccelerated{false}; -+ bool visible{false}; -+ bool animated{false}; -+ ModalHostViewSupportedOrientationsMask supportedOrientations{static_cast(ModalHostViewSupportedOrientations::Portrait)}; -+ int identifier{0}; -+}; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h -new file mode 100644 -index 0000000..e08f2ae ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h -@@ -0,0 +1,257 @@ -+/** -+* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+* -+* Do not edit this file as changes may cause incorrect behavior and will be lost -+* once the code is regenerated. -+* -+* @generated by codegen project: GenerateComponentHObjCpp.js -+*/ -+ -+#import -+#import -+#import -+ -+NS_ASSUME_NONNULL_BEGIN -+ -+@protocol RCTSafeAreaViewViewProtocol -+ -+@end -+ -+@protocol RCTAndroidHorizontalScrollContentViewViewProtocol -+ -+@end -+ -+@protocol RCTAndroidProgressBarViewProtocol -+ -+@end -+ -+@protocol RCTAndroidSwipeRefreshLayoutViewProtocol -+- (void)setNativeRefreshing:(BOOL)value; -+@end -+ -+RCT_EXTERN inline void RCTAndroidSwipeRefreshLayoutHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"setNativeRefreshing"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidSwipeRefreshLayout", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"AndroidSwipeRefreshLayout", commandName, @"1st")) { -+ return; -+ } -+#endif -+ BOOL value = [(NSNumber *)arg0 boolValue]; -+ -+ [componentView setNativeRefreshing:value]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidSwipeRefreshLayout", commandName); -+#endif -+} -+ -+@protocol RCTPullToRefreshViewViewProtocol -+- (void)setNativeRefreshing:(BOOL)refreshing; -+@end -+ -+RCT_EXTERN inline void RCTPullToRefreshViewHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"setNativeRefreshing"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"PullToRefreshView", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"PullToRefreshView", commandName, @"1st")) { -+ return; -+ } -+#endif -+ BOOL refreshing = [(NSNumber *)arg0 boolValue]; -+ -+ [componentView setNativeRefreshing:refreshing]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"PullToRefreshView", commandName); -+#endif -+} -+ -+@protocol RCTInputAccessoryViewProtocol -+ -+@end -+ -+@protocol RCTAndroidDrawerLayoutViewProtocol -+- (void)openDrawer; -+- (void)closeDrawer; -+@end -+ -+RCT_EXTERN inline void RCTAndroidDrawerLayoutHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"openDrawer"]) { -+#if RCT_DEBUG -+ if ([args count] != 0) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidDrawerLayout", commandName, (int)[args count], 0); -+ return; -+ } -+#endif -+ -+ -+ -+ [componentView openDrawer]; -+ return; -+} -+ -+if ([commandName isEqualToString:@"closeDrawer"]) { -+#if RCT_DEBUG -+ if ([args count] != 0) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidDrawerLayout", commandName, (int)[args count], 0); -+ return; -+ } -+#endif -+ -+ -+ -+ [componentView closeDrawer]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidDrawerLayout", commandName); -+#endif -+} -+ -+@protocol RCTActivityIndicatorViewViewProtocol -+ -+@end -+ -+@protocol RCTUnimplementedNativeViewViewProtocol -+ -+@end -+ -+@protocol RCTSwitchViewProtocol -+- (void)setValue:(BOOL)value; -+@end -+ -+RCT_EXTERN inline void RCTSwitchHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"setValue"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"Switch", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"Switch", commandName, @"1st")) { -+ return; -+ } -+#endif -+ BOOL value = [(NSNumber *)arg0 boolValue]; -+ -+ [componentView setValue:value]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"Switch", commandName); -+#endif -+} -+ -+@protocol RCTAndroidSwitchViewProtocol -+- (void)setNativeValue:(BOOL)value; -+@end -+ -+RCT_EXTERN inline void RCTAndroidSwitchHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"setNativeValue"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidSwitch", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"AndroidSwitch", commandName, @"1st")) { -+ return; -+ } -+#endif -+ BOOL value = [(NSNumber *)arg0 boolValue]; -+ -+ [componentView setNativeValue:value]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidSwitch", commandName); -+#endif -+} -+ -+@protocol RCTTraceUpdateOverlayViewProtocol -+- (void)draw:(NSString *)overlays; -+@end -+ -+RCT_EXTERN inline void RCTTraceUpdateOverlayHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"draw"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"TraceUpdateOverlay", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSString class], @"string", @"TraceUpdateOverlay", commandName, @"1st")) { -+ return; -+ } -+#endif -+ NSString * overlays = (NSString *)arg0; -+ -+ [componentView draw:overlays]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"TraceUpdateOverlay", commandName); -+#endif -+} -+ -+@protocol RCTModalHostViewViewProtocol -+ -+@end -+ -+NS_ASSUME_NONNULL_END -\ No newline at end of file -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp -new file mode 100644 -index 0000000..d9a2760 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp -@@ -0,0 +1,26 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateShadowNodeCpp.js -+ */ -+ -+#include -+ -+namespace facebook { -+namespace react { -+ -+extern const char AndroidHorizontalScrollContentViewComponentName[] = "AndroidHorizontalScrollContentView"; -+extern const char AndroidSwipeRefreshLayoutComponentName[] = "AndroidSwipeRefreshLayout"; -+extern const char PullToRefreshViewComponentName[] = "PullToRefreshView"; -+extern const char AndroidDrawerLayoutComponentName[] = "AndroidDrawerLayout"; -+extern const char ActivityIndicatorViewComponentName[] = "ActivityIndicatorView"; -+extern const char UnimplementedNativeViewComponentName[] = "UnimplementedNativeView"; -+extern const char SwitchComponentName[] = "Switch"; -+extern const char TraceUpdateOverlayComponentName[] = "TraceUpdateOverlay"; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h -new file mode 100644 -index 0000000..a5874dc ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h -@@ -0,0 +1,111 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateShadowNodeH.js -+ */ -+ -+#pragma once -+ -+#include -+#include -+#include -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+JSI_EXPORT extern const char AndroidHorizontalScrollContentViewComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using AndroidHorizontalScrollContentViewShadowNode = ConcreteViewShadowNode< -+ AndroidHorizontalScrollContentViewComponentName, -+ AndroidHorizontalScrollContentViewProps, -+ AndroidHorizontalScrollContentViewEventEmitter, -+ AndroidHorizontalScrollContentViewState>; -+ -+JSI_EXPORT extern const char AndroidSwipeRefreshLayoutComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using AndroidSwipeRefreshLayoutShadowNode = ConcreteViewShadowNode< -+ AndroidSwipeRefreshLayoutComponentName, -+ AndroidSwipeRefreshLayoutProps, -+ AndroidSwipeRefreshLayoutEventEmitter, -+ AndroidSwipeRefreshLayoutState>; -+ -+JSI_EXPORT extern const char PullToRefreshViewComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using PullToRefreshViewShadowNode = ConcreteViewShadowNode< -+ PullToRefreshViewComponentName, -+ PullToRefreshViewProps, -+ PullToRefreshViewEventEmitter, -+ PullToRefreshViewState>; -+ -+JSI_EXPORT extern const char AndroidDrawerLayoutComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using AndroidDrawerLayoutShadowNode = ConcreteViewShadowNode< -+ AndroidDrawerLayoutComponentName, -+ AndroidDrawerLayoutProps, -+ AndroidDrawerLayoutEventEmitter, -+ AndroidDrawerLayoutState>; -+ -+JSI_EXPORT extern const char ActivityIndicatorViewComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using ActivityIndicatorViewShadowNode = ConcreteViewShadowNode< -+ ActivityIndicatorViewComponentName, -+ ActivityIndicatorViewProps, -+ ActivityIndicatorViewEventEmitter, -+ ActivityIndicatorViewState>; -+ -+JSI_EXPORT extern const char UnimplementedNativeViewComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using UnimplementedNativeViewShadowNode = ConcreteViewShadowNode< -+ UnimplementedNativeViewComponentName, -+ UnimplementedNativeViewProps, -+ UnimplementedNativeViewEventEmitter, -+ UnimplementedNativeViewState>; -+ -+JSI_EXPORT extern const char SwitchComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using SwitchShadowNode = ConcreteViewShadowNode< -+ SwitchComponentName, -+ SwitchProps, -+ SwitchEventEmitter, -+ SwitchState>; -+ -+JSI_EXPORT extern const char TraceUpdateOverlayComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using TraceUpdateOverlayShadowNode = ConcreteViewShadowNode< -+ TraceUpdateOverlayComponentName, -+ TraceUpdateOverlayProps, -+ TraceUpdateOverlayEventEmitter, -+ TraceUpdateOverlayState>; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp -new file mode 100644 -index 0000000..3b5a0f5 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp -@@ -0,0 +1,18 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateStateCpp.js -+ */ -+#include -+ -+namespace facebook { -+namespace react { -+ -+ -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h -new file mode 100644 -index 0000000..29ac2df ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h -@@ -0,0 +1,141 @@ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateStateH.js -+ */ -+#pragma once -+ -+#ifdef ANDROID -+#include -+#include -+#include -+#endif -+ -+namespace facebook { -+namespace react { -+ -+class AndroidHorizontalScrollContentViewState { -+public: -+ AndroidHorizontalScrollContentViewState() = default; -+ -+#ifdef ANDROID -+ AndroidHorizontalScrollContentViewState(AndroidHorizontalScrollContentViewState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class AndroidSwipeRefreshLayoutState { -+public: -+ AndroidSwipeRefreshLayoutState() = default; -+ -+#ifdef ANDROID -+ AndroidSwipeRefreshLayoutState(AndroidSwipeRefreshLayoutState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class PullToRefreshViewState { -+public: -+ PullToRefreshViewState() = default; -+ -+#ifdef ANDROID -+ PullToRefreshViewState(PullToRefreshViewState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class AndroidDrawerLayoutState { -+public: -+ AndroidDrawerLayoutState() = default; -+ -+#ifdef ANDROID -+ AndroidDrawerLayoutState(AndroidDrawerLayoutState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class ActivityIndicatorViewState { -+public: -+ ActivityIndicatorViewState() = default; -+ -+#ifdef ANDROID -+ ActivityIndicatorViewState(ActivityIndicatorViewState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class UnimplementedNativeViewState { -+public: -+ UnimplementedNativeViewState() = default; -+ -+#ifdef ANDROID -+ UnimplementedNativeViewState(UnimplementedNativeViewState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class SwitchState { -+public: -+ SwitchState() = default; -+ -+#ifdef ANDROID -+ SwitchState(SwitchState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class TraceUpdateOverlayState { -+public: -+ TraceUpdateOverlayState() = default; -+ -+#ifdef ANDROID -+ TraceUpdateOverlayState(TraceUpdateOverlayState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+} // namespace react -+} // namespace facebook -\ No newline at end of file -diff --git a/node_modules/react-native/scripts/.packager.env b/node_modules/react-native/scripts/.packager.env -new file mode 100644 -index 0000000..361f5fb ---- /dev/null -+++ b/node_modules/react-native/scripts/.packager.env -@@ -0,0 +1 @@ -+export RCT_METRO_PORT=8081 From c7d3c228acd467fbd47e2194f5e3c296f1339a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Tue, 30 Jan 2024 13:02:52 -0300 Subject: [PATCH 16/47] chore: no need to remove polyfill promise as injecting it on initializeCore fixes the issue --- patches/react-native+0.72.5.patch | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/patches/react-native+0.72.5.patch b/patches/react-native+0.72.5.patch index c5b7b7208..6d472e07f 100644 --- a/patches/react-native+0.72.5.patch +++ b/patches/react-native+0.72.5.patch @@ -1,8 +1,8 @@ diff --git a/node_modules/react-native/Libraries/Core/InitializeCore.js b/node_modules/react-native/Libraries/Core/InitializeCore.js -index 25377f6..7ab3637 100644 +index 25377f6..b0dd11d 100644 --- a/node_modules/react-native/Libraries/Core/InitializeCore.js +++ b/node_modules/react-native/Libraries/Core/InitializeCore.js -@@ -24,13 +24,44 @@ +@@ -24,6 +24,37 @@ 'use strict'; @@ -40,11 +40,3 @@ index 25377f6..7ab3637 100644 const start = Date.now(); require('./setUpGlobals'); - require('./setUpDOM'); - require('./setUpPerformance'); - require('./setUpErrorHandling'); --require('./polyfillPromise'); -+// require('./polyfillPromise'); - require('./setUpRegeneratorRuntime'); - require('./setUpTimers'); - require('./setUpXHR'); From 9848a0cb75787c1eaaf25f9f8dccee3fef31c9d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Thu, 11 Apr 2024 11:32:57 -0300 Subject: [PATCH 17/47] chore: updated react-native patch to include react-native-mmkv and use it --- patches/react-native+0.72.5.patch | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/patches/react-native+0.72.5.patch b/patches/react-native+0.72.5.patch index 6d472e07f..e9f64482d 100644 --- a/patches/react-native+0.72.5.patch +++ b/patches/react-native+0.72.5.patch @@ -1,18 +1,27 @@ diff --git a/node_modules/react-native/Libraries/Core/InitializeCore.js b/node_modules/react-native/Libraries/Core/InitializeCore.js -index 25377f6..b0dd11d 100644 +index 25377f6..ae30ee4 100644 --- a/node_modules/react-native/Libraries/Core/InitializeCore.js +++ b/node_modules/react-native/Libraries/Core/InitializeCore.js -@@ -24,6 +24,37 @@ +@@ -24,6 +24,45 @@ 'use strict'; -+const Platform = require('../Utilities/Platform'); ++import { MMKV } from 'react-native-mmkv'; ++ ++const storage = new MMKV(); ++let isSesEnabled = storage.getBoolean('should-enable-ses'); ++ ++// Enable SES by default ++if (isSesEnabled === undefined) { ++ isSesEnabled = true; ++ storage.set('should-enable-ses', true); ++} + -+const IS_LOCKDOWN_ENABLED = true; ++const Platform = require('../Utilities/Platform'); + +// This piece of code was taken from this PR: https://github.com/MetaMask/metamask-mobile/pull/6586/files +// which is the reference implementation of SES On react-native -+if (IS_LOCKDOWN_ENABLED && Platform.OS === 'ios' && !global?.HermesInternal) { ++if (isSesEnabled && Platform.OS === 'ios' && !global?.HermesInternal) { + require('../../../../lockdown.umd.js'); + + /** @@ -35,7 +44,6 @@ index 25377f6..b0dd11d 100644 + + hardenIntrinsics(); +} -+ + const start = Date.now(); From ae2af0f7f1729bf5bd9bd681b922cb548ed145eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Fri, 12 Apr 2024 12:47:04 -0300 Subject: [PATCH 18/47] feat: added ses saga and restarting bundle when ses is disabled --- ios/Podfile.lock | 6 +++ package-lock.json | 10 +++++ package.json | 8 ++-- src/constants.js | 6 +++ src/sagas/index.js | 2 + src/sagas/ses.js | 102 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 131 insertions(+), 3 deletions(-) create mode 100644 src/sagas/ses.js diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 244a13658..4ef37f146 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -360,6 +360,8 @@ PODS: - React-Core - react-native-randombytes (3.6.1): - React-Core + - react-native-restart (0.0.27): + - React-Core - react-native-safe-area-context (4.6.4): - RCT-Folly - RCTRequired @@ -572,6 +574,7 @@ DEPENDENCIES: - React-logger (from `../node_modules/react-native/ReactCommon/logger`) - react-native-pager-view (from `../node_modules/react-native-pager-view`) - react-native-randombytes (from `../node_modules/react-native-randombytes`) + - react-native-restart (from `../node_modules/react-native-restart`) - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) - react-native-version-number (from `../node_modules/react-native-version-number`) - React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`) @@ -675,6 +678,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-pager-view" react-native-randombytes: :path: "../node_modules/react-native-randombytes" + react-native-restart: + :path: "../node_modules/react-native-restart" react-native-safe-area-context: :path: "../node_modules/react-native-safe-area-context" react-native-version-number: @@ -784,6 +789,7 @@ SPEC CHECKSUMS: React-logger: 2e4aee3e11b3ec4fa6cfd8004610bbb3b8d6cca4 react-native-pager-view: da490aa1f902c9a5aeecf0909cc975ad0e92e53e react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846 + react-native-restart: 7595693413fe3ca15893702f2c8306c62a708162 react-native-safe-area-context: 68b07eabfb0d14547d36f6929c0e98d818064f02 react-native-version-number: b415bbec6a13f2df62bf978e85bc0d699462f37f React-NativeModulesApple: 535e26db03f74ecc500748ce79fa349b2ee2ee21 diff --git a/package-lock.json b/package-lock.json index 1dd2df784..6854cd820 100644 --- a/package-lock.json +++ b/package-lock.json @@ -52,6 +52,7 @@ "react-native-qrcode-svg": "6.2.0", "react-native-randombytes": "3.6.1", "react-native-reanimated": "3.5.4", + "react-native-restart": "0.0.27", "react-native-safe-area-context": "4.6.4", "react-native-screens": "3.22.1", "react-native-status-bar-height": "2.6.0", @@ -19137,6 +19138,15 @@ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" }, + "node_modules/react-native-restart": { + "version": "0.0.27", + "resolved": "https://registry.npmjs.org/react-native-restart/-/react-native-restart-0.0.27.tgz", + "integrity": "sha512-8KScVICrXwcTSJ1rjWkqVTHyEKQIttm5AIMGSK1QG1+RS5owYlE4z/1DykOTdWfVl9l16FIk0w9Xzk9ZO6jxlA==", + "peerDependencies": { + "react": "*", + "react-native": "*" + } + }, "node_modules/react-native-safe-area-context": { "version": "4.6.4", "resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-4.6.4.tgz", diff --git a/package.json b/package.json index 6c884f59b..cc2fb400d 100644 --- a/package.json +++ b/package.json @@ -55,12 +55,14 @@ "react-native-gesture-handler": "2.13.1", "react-native-keychain": "8.1.1", "react-native-localize": "2.2.6", + "react-native-mmkv": "2.12.2", "react-native-modal": "13.0.1", "react-native-pager-view": "5.4.25", "react-native-permissions": "3.8.3", "react-native-qrcode-svg": "6.2.0", "react-native-randombytes": "3.6.1", "react-native-reanimated": "3.5.4", + "react-native-restart": "0.0.27", "react-native-safe-area-context": "4.6.4", "react-native-screens": "3.22.1", "react-native-status-bar-height": "2.6.0", @@ -83,7 +85,7 @@ "@babel/preset-env": "7.22.7", "@babel/runtime": "7.22.6", "@jest/globals": "29.7.0", - "@lavamoat/allow-scripts": "^3.0.1", + "@lavamoat/allow-scripts": "3.0.1", "@react-native/eslint-config": "0.72.2", "@react-native/metro-config": "0.72.11", "@tsconfig/react-native": "3.0.2", @@ -98,7 +100,7 @@ "eslint-plugin-react": "7.32.2", "jest": "29.7.0", "metro-react-native-babel-preset": "0.76.8", - "patch-package": "^8.0.0", + "patch-package": "8.0.0", "react-test-renderer": "18.1.0", "rn-nodeify": "10.3.0", "ttag-cli": "1.10.5", @@ -138,7 +140,7 @@ }, "lavamoat": { "allowScripts": { - "$root$": true, + "$root$": false, "@fortawesome/fontawesome-svg-core": false, "@fortawesome/fontawesome-svg-core>@fortawesome/fontawesome-common-types": false, "@fortawesome/free-regular-svg-icons": false, diff --git a/src/constants.js b/src/constants.js index 7bf220241..1bc209996 100644 --- a/src/constants.js +++ b/src/constants.js @@ -160,6 +160,7 @@ export const PUSH_NOTIFICATION_FEATURE_TOGGLE = 'push-notification.rollout'; export const WALLET_CONNECT_FEATURE_TOGGLE = 'wallet-connect-mobile.rollout'; export const NETWORK_SETTINGS_FEATURE_TOGGLE = 'network-settings.rollout'; export const NANO_CONTRACT_FEATURE_TOGGLE = 'nano-contract.rollout'; +export const SES_FEATURE_TOGGLE = 'ses-mobile.rollout'; /** * Default feature toggle values. @@ -255,3 +256,8 @@ export const NETWORK_PRIVATENET = 'privatenet'; export const MAX_RETRIES = 8; export const INITIAL_RETRY_LATENCY = 300; // ms export const LATENCY_MULTIPLIER = 30; // multiplier per iteration + +// This key is read during the react-native initialization (read the patch in +// patches/react-native+0.72.5.patch), to decide whether to activate SES (secure +// ecmascript) +export const SHOULD_ENABLE_SES_STORAGE_KEY = 'should-enable-ses'; diff --git a/src/sagas/index.js b/src/sagas/index.js index fbcebea0f..b3ad33582 100644 --- a/src/sagas/index.js +++ b/src/sagas/index.js @@ -14,6 +14,7 @@ import { saga as featureToggleSagas } from './featureToggle'; import { saga as permissionsSagas } from './permissions'; import { saga as walletConnectSagas } from './walletConnect'; import { saga as networkSettingsSagas } from './networkSettings'; +import { saga as sesSagas } from './ses'; const sagas = [ walletSagas, @@ -24,6 +25,7 @@ const sagas = [ featureToggleSagas, permissionsSagas, walletConnectSagas, + sesSagas, ]; function* defaultSaga() { diff --git a/src/sagas/ses.js b/src/sagas/ses.js new file mode 100644 index 000000000..a87b1ff75 --- /dev/null +++ b/src/sagas/ses.js @@ -0,0 +1,102 @@ +/** + * Copyright (c) Hathor Labs and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import { MMKV } from 'react-native-mmkv'; +import RNRestart from 'react-native-restart'; +import { + call, + fork, + take, + all, +} from 'redux-saga/effects'; +import { checkForFeatureFlag } from './helpers'; +import { SES_FEATURE_TOGGLE, SHOULD_ENABLE_SES_STORAGE_KEY } from '../constants'; + +const storage = new MMKV(); + +function verifySesEnabled() { + return Object.isFrozen([].prototype); +} + +function disableSes(restart = true) { + console.log('disabling SES!!'); + storage.set(SHOULD_ENABLE_SES_STORAGE_KEY, false); + + if (restart) { + RNRestart.restart(); + } +} + +function enableSes(restart = true) { + storage.set(SHOULD_ENABLE_SES_STORAGE_KEY, true); + + if (restart) { + RNRestart.restart(); + } +} + +/** + * `init` will run on the app initialization. + * + */ +function* init() { + const storageEnabled = storage.getBoolean('should-enable-ses'); + const unleashEnabled = yield call(checkForFeatureFlag, SES_FEATURE_TOGGLE); + const sesEnabled = verifySesEnabled(); + + if (unleashEnabled && storageEnabled && !sesEnabled) { + // This is an issue, the environment is not secure, we should issue a fatal + // error. + } + + if (!unleashEnabled && storageEnabled) { + // SES was enabled, we should disable it in storage which gets read in the + // react-native initialization (more on this in patches/react-native+0.72.5.patch) + // and restart the react-native bundle. + disableSes(); + } + + if (unleashEnabled && !storageEnabled) { + enableSes(); + } +} + +export function* isSESEnabled() { + const sesEnabled = yield call(checkForFeatureFlag, SES_FEATURE_TOGGLE); + + return sesEnabled; +} + +/** + * This saga listens for the feature toggles provider and disables SES by restarting + * the react-native bundle if the feature was enabled and is now disabled. + */ +export function* featureToggleUpdateListener() { + while (true) { + const oldSesEnabled = yield call(isSESEnabled); + yield take('FEATURE_TOGGLE_UPDATED'); + const newSesEnabled = yield call(isSESEnabled); + + if (oldSesEnabled && !newSesEnabled) { + // SES was disabled on the feature toggle provider + disableSes(); + } + + if (newSesEnabled && !oldSesEnabled) { + // SES was enabled on the feature-toggle provider, enable it without + // restarting the bundle + enableSes(false); + } + } +} + +export function* saga() { + yield all([ + fork(init), + fork(featureToggleUpdateListener), + ]); +} From ffff5b3b1d3ca36a52a2422da0350d4efc421096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Thu, 11 Apr 2024 11:32:57 -0300 Subject: [PATCH 19/47] chore: added a document explaining how to update SES --- SES_AND_LAVAMOAT.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 SES_AND_LAVAMOAT.md diff --git a/SES_AND_LAVAMOAT.md b/SES_AND_LAVAMOAT.md new file mode 100644 index 000000000..76dcaea05 --- /dev/null +++ b/SES_AND_LAVAMOAT.md @@ -0,0 +1,21 @@ +# LavaMoat and SES (Secure Ecmascript) maintenance + +### Hermes + +SES does not yet work with Hermes, so we had to disable it on both platforms https://github.com/facebook/hermes/issues/957 + +### SES injection + +LavaMoat does not yet fully support react-native, there is a compatibility tracker [here](https://github.com/LavaMoat/docs/issues/12). Until then, we're using [SES](https://github.com/endojs/endo/tree/master/packages/ses) directly, injecting it directly into the InitializeCore which is the entrypoint for the react-native's bundle so it hardens our app as soon as possible in the process. + +This is done through a patch on the react-native package, using `patch-package`. + +We are currently using version `1.0.1` of SES, which is the latest version that works with react-native, it is loaded from the project root, `lockdown.umd.js`. + + +### Updating SES + +As soon as react-native is fully supported by LavaMoat, we will replace the current patch with its official package and install it using npm, but until then, in order to update SES we should do the following steps: + +1. Update the `lockdown.umd.js` file to the latest supported SES lockdown file +2. Update the sha256sum of the lockdown library in the SHA256SUMS file From 4929736602253ed66743f2aab1ce9647f32f327a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Fri, 12 Apr 2024 13:20:45 -0300 Subject: [PATCH 20/47] chore: added postinstall to setup script and updated packages --- package-lock.json | 14 ++++++++++++-- package.json | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6854cd820..145d50688 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,6 +46,7 @@ "react-native-gesture-handler": "2.13.1", "react-native-keychain": "8.1.1", "react-native-localize": "2.2.6", + "react-native-mmkv": "2.12.2", "react-native-modal": "13.0.1", "react-native-pager-view": "5.4.25", "react-native-permissions": "3.8.3", @@ -75,7 +76,7 @@ "@babel/preset-env": "7.22.7", "@babel/runtime": "7.22.6", "@jest/globals": "29.7.0", - "@lavamoat/allow-scripts": "^3.0.1", + "@lavamoat/allow-scripts": "3.0.1", "@react-native/eslint-config": "0.72.2", "@react-native/metro-config": "0.72.11", "@tsconfig/react-native": "3.0.2", @@ -90,7 +91,7 @@ "eslint-plugin-react": "7.32.2", "jest": "29.7.0", "metro-react-native-babel-preset": "0.76.8", - "patch-package": "^8.0.0", + "patch-package": "8.0.0", "react-test-renderer": "18.1.0", "rn-nodeify": "10.3.0", "ttag-cli": "1.10.5", @@ -19037,6 +19038,15 @@ } } }, + "node_modules/react-native-mmkv": { + "version": "2.12.2", + "resolved": "https://registry.npmjs.org/react-native-mmkv/-/react-native-mmkv-2.12.2.tgz", + "integrity": "sha512-6058Aq0p57chPrUutLGe9fYoiDVDNMU2PKV+lLFUJ3GhoHvUrLdsS1PDSCLr00yqzL4WJQ7TTzH+V8cpyrNcfg==", + "peerDependencies": { + "react": "*", + "react-native": ">=0.71.0" + } + }, "node_modules/react-native-modal": { "version": "13.0.1", "resolved": "https://registry.npmjs.org/react-native-modal/-/react-native-modal-13.0.1.tgz", diff --git a/package.json b/package.json index cc2fb400d..51efdf05d 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "start:clean": "react-native start --reset-cache", "lint": "eslint .", "test": "jest", - "setup": "npm install && ./node_modules/.bin/allow-scripts", + "setup": "npm install && ./node_modules/.bin/allow-scripts && npm run postinstall", "locale-update-pot": "ttag extract -o ./locale/texts.pot ./src/", "postinstall": "rn-nodeify --install stream,process,path,events,crypto,console,buffer --hack" }, From 7f75836c28b0256ac29c0da7b94b3ec6c6976c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 15 Apr 2024 11:59:00 -0300 Subject: [PATCH 21/47] chore: fixed allow-scripts version --- package-lock.json | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 145d50688..c00c495da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@fortawesome/react-native-fontawesome": "0.2.7", "@hathor/unleash-client": "0.1.0", "@hathor/wallet-lib": "1.0.1", - "@lavamoat/preinstall-always-fail": "^2.0.0", + "@lavamoat/preinstall-always-fail": "2.0.0", "@notifee/react-native": "5.7.0", "@react-native-async-storage/async-storage": "1.19.0", "@react-native-firebase/app": "16.7.0", diff --git a/package.json b/package.json index 51efdf05d..9b1557f73 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "test": "jest", "setup": "npm install && ./node_modules/.bin/allow-scripts && npm run postinstall", "locale-update-pot": "ttag extract -o ./locale/texts.pot ./src/", + "preinstall": "exit 1", "postinstall": "rn-nodeify --install stream,process,path,events,crypto,console,buffer --hack" }, "dependencies": { @@ -24,7 +25,7 @@ "@fortawesome/react-native-fontawesome": "0.2.7", "@hathor/unleash-client": "0.1.0", "@hathor/wallet-lib": "1.0.1", - "@lavamoat/preinstall-always-fail": "^2.0.0", + "@lavamoat/preinstall-always-fail": "2.0.0", "@notifee/react-native": "5.7.0", "@react-native-async-storage/async-storage": "1.19.0", "@react-native-firebase/app": "16.7.0", From fcbc5f00b55814860be08a6a61bdaa49b802d9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 15 Apr 2024 13:17:22 -0300 Subject: [PATCH 22/47] chore: added patch-package to postinstall --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9b1557f73..ec76dfe56 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "setup": "npm install && ./node_modules/.bin/allow-scripts && npm run postinstall", "locale-update-pot": "ttag extract -o ./locale/texts.pot ./src/", "preinstall": "exit 1", - "postinstall": "rn-nodeify --install stream,process,path,events,crypto,console,buffer --hack" + "postinstall": "rn-nodeify --install stream,process,path,events,crypto,console,buffer --hack && npx patch-package" }, "dependencies": { "@fortawesome/fontawesome-svg-core": "1.2.36", From 98b3ac17a9c46d1c810c982f97b1d8f1c87143f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 15 Apr 2024 13:17:50 -0300 Subject: [PATCH 23/47] chore: added MKMV to podfile.lock --- ios/Podfile.lock | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 4ef37f146..bdbe448e5 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -75,6 +75,9 @@ PODS: - GoogleUtilities/MethodSwizzler - GoogleUtilities/UserDefaults (7.12.0): - GoogleUtilities/Logger + - MMKV (1.3.4): + - MMKVCore (~> 1.3.4) + - MMKVCore (1.3.4) - nanopb (2.30909.1): - nanopb/decode (= 2.30909.1) - nanopb/encode (= 2.30909.1) @@ -356,6 +359,10 @@ PODS: - React-jsinspector (0.72.5) - React-logger (0.72.5): - glog + - react-native-mmkv (2.12.2): + - MMKV (>= 1.3.3) + - RCT-Folly (= 2021.07.22.00) + - React-Core - react-native-pager-view (5.4.25): - React-Core - react-native-randombytes (3.6.1): @@ -572,6 +579,7 @@ DEPENDENCIES: - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) - React-logger (from `../node_modules/react-native/ReactCommon/logger`) + - react-native-mmkv (from `../node_modules/react-native-mmkv`) - react-native-pager-view (from `../node_modules/react-native-pager-view`) - react-native-randombytes (from `../node_modules/react-native-randombytes`) - react-native-restart (from `../node_modules/react-native-restart`) @@ -623,6 +631,8 @@ SPEC REPOS: - fmt - GoogleDataTransport - GoogleUtilities + - MMKV + - MMKVCore - nanopb - PromisesObjC - Sentry @@ -674,6 +684,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/jsinspector" React-logger: :path: "../node_modules/react-native/ReactCommon/logger" + react-native-mmkv: + :path: "../node_modules/react-native-mmkv" react-native-pager-view: :path: "../node_modules/react-native-pager-view" react-native-randombytes: @@ -754,8 +766,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/yoga" SPEC CHECKSUMS: - boost: a7c83b31436843459a1961bfd74b96033dc77234 - DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 + boost: 57d2868c099736d80fcd648bf211b4431e51a558 + DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 FBLazyVector: 71803c074f6325f10b5ec891c443b6bbabef0ca7 FBReactNativeSpec: 448e08a759d29a96e15725ae532445bf4343567c Firebase: f92fc551ead69c94168d36c2b26188263860acd9 @@ -765,9 +777,11 @@ SPEC CHECKSUMS: FirebaseInstallations: e842042ec6ac1fd2e37d7706363ebe7f662afea4 FirebaseMessaging: e345b219fd15d325f0cf2fef28cb8ce00d851b3f fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 - glog: 85ecdd10ee8d8ec362ef519a6a45ff9aa27b2e85 + glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b GoogleDataTransport: 57c22343ab29bc686febbf7cbb13bad167c2d8fe GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34 + MMKV: ed58ad794b3f88c24d604a5b74f3fba17fcbaf74 + MMKVCore: a67a1cede26175c413176f404a7cedec43f96a0b nanopb: d4d75c12cd1316f4a64e3c6963f879ecd4b5e0d5 Permission-Camera: 9c8b1a826770a6feea747cc8a4a89d2b39df4273 Permission-Notifications: 05a9c72e2ae989d28eb1eecf3d6a12daba73d375 @@ -787,6 +801,7 @@ SPEC CHECKSUMS: React-jsiexecutor: f32f98d8ddbdfd97dea286af90381a731d68c505 React-jsinspector: aef73cbd43b70675f572214d10fa438c89bf11ba React-logger: 2e4aee3e11b3ec4fa6cfd8004610bbb3b8d6cca4 + react-native-mmkv: b738e135cc27fc8ed25b39ec451b2e3e0ae9ce1b react-native-pager-view: da490aa1f902c9a5aeecf0909cc975ad0e92e53e react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846 react-native-restart: 7595693413fe3ca15893702f2c8306c62a708162 @@ -830,6 +845,6 @@ SPEC CHECKSUMS: SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Yoga: 86fed2e4d425ee4c6eab3813ba1791101ee153c6 -PODFILE CHECKSUM: 2332b5f23b4af59724282b2fb1d104e41fe0d7a7 +PODFILE CHECKSUM: c379b49373eebf615f8a8be068f2e216952ce46c COCOAPODS: 1.14.3 From caa22959d8cb2e444a07cfce1d13e630cb5b443a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 15 Apr 2024 14:52:56 -0300 Subject: [PATCH 24/47] chore: reading ses enabled from constant --- patches/react-native+0.72.5.patch | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/patches/react-native+0.72.5.patch b/patches/react-native+0.72.5.patch index e9f64482d..deeebffa8 100644 --- a/patches/react-native+0.72.5.patch +++ b/patches/react-native+0.72.5.patch @@ -1,20 +1,22 @@ diff --git a/node_modules/react-native/Libraries/Core/InitializeCore.js b/node_modules/react-native/Libraries/Core/InitializeCore.js -index 25377f6..ae30ee4 100644 +index 25377f6..cd98bb5 100644 --- a/node_modules/react-native/Libraries/Core/InitializeCore.js +++ b/node_modules/react-native/Libraries/Core/InitializeCore.js -@@ -24,6 +24,45 @@ +@@ -24,6 +24,47 @@ 'use strict'; +import { MMKV } from 'react-native-mmkv'; ++import { SHOULD_ENABLE_SES_STORAGE_KEY } from '../../../../src/constants'; + +const storage = new MMKV(); -+let isSesEnabled = storage.getBoolean('should-enable-ses'); ++ ++let isSesEnabled = storage.getBoolean(SHOULD_ENABLE_SES_STORAGE_KEY); + +// Enable SES by default +if (isSesEnabled === undefined) { + isSesEnabled = true; -+ storage.set('should-enable-ses', true); ++ storage.set(SHOULD_ENABLE_SES_STORAGE_KEY, true); +} + +const Platform = require('../Utilities/Platform'); From 3c7a1286436cbea8a5e1ed5fde1ced0c0a6740c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Wed, 24 Apr 2024 11:47:38 -0300 Subject: [PATCH 25/47] feat: yield fatal error when SES should be enabled but is not --- src/sagas/ses.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sagas/ses.js b/src/sagas/ses.js index a87b1ff75..0a0026337 100644 --- a/src/sagas/ses.js +++ b/src/sagas/ses.js @@ -12,9 +12,12 @@ import { fork, take, all, + put, } from 'redux-saga/effects'; import { checkForFeatureFlag } from './helpers'; import { SES_FEATURE_TOGGLE, SHOULD_ENABLE_SES_STORAGE_KEY } from '../constants'; +import { logger } from '../logger'; +import { onExceptionCaptured } from '../actions'; const storage = new MMKV(); @@ -23,7 +26,7 @@ function verifySesEnabled() { } function disableSes(restart = true) { - console.log('disabling SES!!'); + logger.debug('Disabling SAS'); storage.set(SHOULD_ENABLE_SES_STORAGE_KEY, false); if (restart) { @@ -51,6 +54,7 @@ function* init() { if (unleashEnabled && storageEnabled && !sesEnabled) { // This is an issue, the environment is not secure, we should issue a fatal // error. + yield put(onExceptionCaptured(new Error('SES should be enabled but environment is not secure, failing!'), true)); } if (!unleashEnabled && storageEnabled) { From ea15c73ebde51c0a19ec914d2b9519f581086820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Wed, 24 Apr 2024 12:01:19 -0300 Subject: [PATCH 26/47] refactor: improved verifySesEnabled method --- src/sagas/ses.js | 5 +---- src/utils.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/sagas/ses.js b/src/sagas/ses.js index 0a0026337..a679ae741 100644 --- a/src/sagas/ses.js +++ b/src/sagas/ses.js @@ -18,13 +18,10 @@ import { checkForFeatureFlag } from './helpers'; import { SES_FEATURE_TOGGLE, SHOULD_ENABLE_SES_STORAGE_KEY } from '../constants'; import { logger } from '../logger'; import { onExceptionCaptured } from '../actions'; +import { verifySesEnabled } from '../utils'; const storage = new MMKV(); -function verifySesEnabled() { - return Object.isFrozen([].prototype); -} - function disableSes(restart = true) { logger.debug('Disabling SAS'); storage.set(SHOULD_ENABLE_SES_STORAGE_KEY, false); diff --git a/src/utils.js b/src/utils.js index d595649c0..e576f117a 100644 --- a/src/utils.js +++ b/src/utils.js @@ -385,3 +385,47 @@ export function combineURLs(baseURL, relativeURL) { export const isPushNotificationAvailableForUser = (state) => ( state.pushNotification.available && state.pushNotification.deviceRegistered ); + +/** + * Verifies if all critical built-in object prototypes are frozen, indicating a secure + * ECMAScript (SES) environment. This check ensures that the execution context remains + * immutable by preventing modifications to built-in prototypes, a common target for + * tampering in JavaScript environments. + * + * By freezing prototypes, SES aims to prevent malicious or accidental interference + * that could compromise application integrity or lead to security vulnerabilities. + * + * @returns {boolean} Returns true if all specified built-in prototypes are frozen + * indicating a secure and immutable execution environment. Returns false if any + * prototype is not frozen, suggesting potential security risks. + */ +export const verifySesEnabled = () => { + const prototypes = [ + Array.prototype, + ArrayBuffer.prototype, + Boolean.prototype, + Date.prototype, + Error.prototype, + Function.prototype, + Map.prototype, + Number.prototype, + Object.prototype, + RegExp.prototype, + Set.prototype, + String.prototype, + Symbol.prototype, + WeakMap.prototype, + WeakSet.prototype, + Float32Array.prototype, + Float64Array.prototype, + Int8Array.prototype, + Int16Array.prototype, + Int32Array.prototype, + Uint8Array.prototype, + Uint8ClampedArray.prototype, + Uint16Array.prototype, + Uint32Array.prototype, + ]; + + return prototypes.every(Object.isFrozen); +}; From 2ee7006d5004915e33fec284d4f985d68e41aaf5 Mon Sep 17 00:00:00 2001 From: Alex Ruzenhack Date: Fri, 11 Oct 2024 16:47:29 +0100 Subject: [PATCH 27/47] chore: update sentry version (#578) --- package-lock.json | 341 +++++++++++++++++++++++++++++++++++----------- package.json | 2 +- 2 files changed, 266 insertions(+), 77 deletions(-) diff --git a/package-lock.json b/package-lock.json index e5a1749b7..0383f9f32 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "@react-navigation/bottom-tabs": "6.5.8", "@react-navigation/native": "6.1.7", "@react-navigation/stack": "6.3.17", - "@sentry/react-native": "5.6.0", + "@sentry/react-native": "5.31.0", "assert": "2.0.0", "buffer": "4.9.2", "console-browserify": "1.2.0", @@ -6686,41 +6686,83 @@ "resolved": "https://registry.npmjs.org/@redux-saga/types/-/types-1.2.1.tgz", "integrity": "sha512-1dgmkh+3so0+LlBWRhGA33ua4MYr7tUOj+a9Si28vUi0IUFNbff1T3sgpeDJI/LaC75bBYnQ0A3wXjn0OrRNBA==" }, + "node_modules/@sentry-internal/feedback": { + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-7.119.0.tgz", + "integrity": "sha512-om8TkAU5CQGO8nkmr7qsSBVkP+/vfeS4JgtW3sjoTK0fhj26+DljR6RlfCGWtYQdPSP6XV7atcPTjbSnsmG9FQ==", + "license": "MIT", + "dependencies": { + "@sentry/core": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@sentry-internal/replay-canvas": { + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-7.119.0.tgz", + "integrity": "sha512-NL02VQx6ekPxtVRcsdp1bp5Tb5w6vnfBKSIfMKuDRBy5A10Uc3GSoy/c3mPyHjOxB84452A+xZSx6bliEzAnuA==", + "license": "MIT", + "dependencies": { + "@sentry/core": "7.119.0", + "@sentry/replay": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@sentry-internal/tracing": { - "version": "7.54.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.54.0.tgz", - "integrity": "sha512-JsyhZ0wWZ+VqbHJg+azqRGdYJDkcI5R9+pnkO6SzbzxrRewqMAIwzkpPee3oI7vG99uhMEkOkMjHu0nQGwkOQw==", + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.119.0.tgz", + "integrity": "sha512-oKdFJnn+56f0DHUADlL8o9l8jTib3VDLbWQBVkjD9EprxfaCwt2m8L5ACRBdQ8hmpxCEo4I8/6traZ7qAdBUqA==", + "license": "MIT", "dependencies": { - "@sentry/core": "7.54.0", - "@sentry/types": "7.54.0", - "@sentry/utils": "7.54.0", - "tslib": "^1.9.3" + "@sentry/core": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0" }, "engines": { "node": ">=8" } }, + "node_modules/@sentry/babel-plugin-component-annotate": { + "version": "2.20.1", + "resolved": "https://registry.npmjs.org/@sentry/babel-plugin-component-annotate/-/babel-plugin-component-annotate-2.20.1.tgz", + "integrity": "sha512-4mhEwYTK00bIb5Y9UWIELVUfru587Vaeg0DQGswv4aIRHIiMKLyNqCEejaaybQ/fNChIZOKmvyqXk430YVd7Qg==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, "node_modules/@sentry/browser": { - "version": "7.54.0", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.54.0.tgz", - "integrity": "sha512-EvLAw03N9WE2m1CMl2/1YMeIs1icw9IEOVJhWmf3uJEysNJOFWXu6ZzdtHEz1E6DiJYhc1HzDya0ExZeJxNARA==", + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.119.0.tgz", + "integrity": "sha512-WwmW1Y4D764kVGeKmdsNvQESZiAn9t8LmCWO0ucBksrjL2zw9gBPtOpRcO6l064sCLeSxxzCN+kIxhRm1gDFEA==", + "license": "MIT", "dependencies": { - "@sentry-internal/tracing": "7.54.0", - "@sentry/core": "7.54.0", - "@sentry/replay": "7.54.0", - "@sentry/types": "7.54.0", - "@sentry/utils": "7.54.0", - "tslib": "^1.9.3" + "@sentry-internal/feedback": "7.119.0", + "@sentry-internal/replay-canvas": "7.119.0", + "@sentry-internal/tracing": "7.119.0", + "@sentry/core": "7.119.0", + "@sentry/integrations": "7.119.0", + "@sentry/replay": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0" }, "engines": { "node": ">=8" } }, "node_modules/@sentry/cli": { - "version": "2.18.1", - "resolved": "https://registry.npmjs.org/@sentry/cli/-/cli-2.18.1.tgz", - "integrity": "sha512-lc/dX/cvcmznWNbLzDbzxn224vwY5zLIDBe3yOO6Usg3CDgkZZ3xfjN4AIUZwkiTEPIOELodrOfdoMxqpXyYDw==", + "version": "2.31.2", + "resolved": "https://registry.npmjs.org/@sentry/cli/-/cli-2.31.2.tgz", + "integrity": "sha512-2aKyUx6La2P+pplL8+2vO67qJ+c1C79KYWAyQBE0JIT5kvKK9JpwtdNoK1F0/2mRpwhhYPADCz3sVIRqmL8cQQ==", "hasInstallScript": true, + "license": "BSD-3-Clause", "dependencies": { "https-proxy-agent": "^5.0.0", "node-fetch": "^2.6.7", @@ -6733,59 +6775,185 @@ }, "engines": { "node": ">= 10" + }, + "optionalDependencies": { + "@sentry/cli-darwin": "2.31.2", + "@sentry/cli-linux-arm": "2.31.2", + "@sentry/cli-linux-arm64": "2.31.2", + "@sentry/cli-linux-i686": "2.31.2", + "@sentry/cli-linux-x64": "2.31.2", + "@sentry/cli-win32-i686": "2.31.2", + "@sentry/cli-win32-x64": "2.31.2" + } + }, + "node_modules/@sentry/cli-darwin": { + "version": "2.31.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-darwin/-/cli-darwin-2.31.2.tgz", + "integrity": "sha512-BHA/JJXj1dlnoZQdK4efRCtHRnbBfzbIZUKAze7oRR1RfNqERI84BVUQeKateD3jWSJXQfEuclIShc61KOpbKw==", + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-arm": { + "version": "2.31.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm/-/cli-linux-arm-2.31.2.tgz", + "integrity": "sha512-W8k5mGYYZz/I/OxZH65YAK7dCkQAl+wbuoASGOQjUy5VDgqH0QJ8kGJufXvFPM+f3ZQGcKAnVsZ6tFqZXETBAw==", + "cpu": [ + "arm" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-arm64": { + "version": "2.31.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-arm64/-/cli-linux-arm64-2.31.2.tgz", + "integrity": "sha512-FLVKkJ/rWvPy/ka7OrUdRW63a/z8HYI1Gt8Pr6rWs50hb7YJja8lM8IO10tYmcFE/tODICsnHO9HTeUg2g2d1w==", + "cpu": [ + "arm64" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-i686": { + "version": "2.31.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-i686/-/cli-linux-i686-2.31.2.tgz", + "integrity": "sha512-A64QtzaPi3MYFpZ+Fwmi0mrSyXgeLJ0cWr4jdeTGrzNpeowSteKgd6tRKU+LVq0k5shKE7wdnHk+jXnoajulMA==", + "cpu": [ + "x86", + "ia32" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-linux-x64": { + "version": "2.31.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-linux-x64/-/cli-linux-x64-2.31.2.tgz", + "integrity": "sha512-YL/r+15R4mOEiU3mzn7iFQOeFEUB6KxeKGTTrtpeOGynVUGIdq4nV5rHow5JDbIzOuBS3SpOmcIMluvo1NCh0g==", + "cpu": [ + "x64" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "linux", + "freebsd" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-win32-i686": { + "version": "2.31.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-win32-i686/-/cli-win32-i686-2.31.2.tgz", + "integrity": "sha512-Az/2bmW+TFI059RE0mSBIxTBcoShIclz7BDebmIoCkZ+retrwAzpmBnBCDAHow+Yi43utOow+3/4idGa2OxcLw==", + "cpu": [ + "x86", + "ia32" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@sentry/cli-win32-x64": { + "version": "2.31.2", + "resolved": "https://registry.npmjs.org/@sentry/cli-win32-x64/-/cli-win32-x64-2.31.2.tgz", + "integrity": "sha512-XIzyRnJu539NhpFa+JYkotzVwv3NrZ/4GfHB/JWA2zReRvsk39jJG8D5HOmm0B9JA63QQT7Dt39RW8g3lkmb6w==", + "cpu": [ + "x64" + ], + "license": "BSD-3-Clause", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" } }, "node_modules/@sentry/core": { - "version": "7.54.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.54.0.tgz", - "integrity": "sha512-MAn0E2EwgNn1pFQn4qxhU+1kz6edullWg6VE5wCmtpXWOVw6sILBUsQpeIG5djBKMcneJCdOlz5jeqcKPrLvZQ==", + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.119.0.tgz", + "integrity": "sha512-CS2kUv9rAJJEjiRat6wle3JATHypB0SyD7pt4cpX5y0dN5dZ1JrF57oLHRMnga9fxRivydHz7tMTuBhSSwhzjw==", + "license": "MIT", "dependencies": { - "@sentry/types": "7.54.0", - "@sentry/utils": "7.54.0", - "tslib": "^1.9.3" + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0" }, "engines": { "node": ">=8" } }, "node_modules/@sentry/hub": { - "version": "7.54.0", - "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-7.54.0.tgz", - "integrity": "sha512-GePswxz0rzSaCGB0QR2FgH7Hht9SfxsVyX271FtPH3V5hUIZOHlftXggqmNy5XyyiGf27zsWM+DYgQUFJwMcjQ==", + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-7.119.0.tgz", + "integrity": "sha512-183h5B/rZosLxpB+ZYOvFdHk0rwZbKskxqKFtcyPbDAfpCUgCass41UTqyxF6aH1qLgCRxX8GcLRF7frIa/SOg==", + "license": "MIT", "dependencies": { - "@sentry/core": "7.54.0", - "@sentry/types": "7.54.0", - "@sentry/utils": "7.54.0", - "tslib": "^1.9.3" + "@sentry/core": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0" }, "engines": { "node": ">=8" } }, "node_modules/@sentry/integrations": { - "version": "7.54.0", - "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.54.0.tgz", - "integrity": "sha512-RolGsQzJChJzjHTJcCKSZ1HanmY33floc5o13WgU9NoDqJbLGLNcOIrAu+WynqPe8P5VTVrVb8NiwhLqWrKp4g==", + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.119.0.tgz", + "integrity": "sha512-OHShvtsRW0A+ZL/ZbMnMqDEtJddPasndjq+1aQXw40mN+zeP7At/V1yPZyFaURy86iX7Ucxw5BtmzuNy7hLyTA==", + "license": "MIT", "dependencies": { - "@sentry/types": "7.54.0", - "@sentry/utils": "7.54.0", - "localforage": "^1.8.1", - "tslib": "^1.9.3" + "@sentry/core": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0", + "localforage": "^1.8.1" }, "engines": { "node": ">=8" } }, "node_modules/@sentry/react": { - "version": "7.54.0", - "resolved": "https://registry.npmjs.org/@sentry/react/-/react-7.54.0.tgz", - "integrity": "sha512-qUbwmRRpTh05m2rbC8A2zAFQYsoHhwIpxT5UXxh0P64ZlA3cSg1/DmTTgwnd1l+7gzKrc31UikXQ4y0YDbMNKg==", + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/react/-/react-7.119.0.tgz", + "integrity": "sha512-cf8Cei+qdSA26gx+IMAuc/k44PeBImNzIpXi3930SLhUe44ypT5OZ/44L6xTODHZzTIyMSJPduf59vT2+eW9yg==", + "license": "MIT", "dependencies": { - "@sentry/browser": "7.54.0", - "@sentry/types": "7.54.0", - "@sentry/utils": "7.54.0", - "hoist-non-react-statics": "^3.3.2", - "tslib": "^1.9.3" + "@sentry/browser": "7.119.0", + "@sentry/core": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0", + "hoist-non-react-statics": "^3.3.2" }, "engines": { "node": ">=8" @@ -6795,52 +6963,66 @@ } }, "node_modules/@sentry/react-native": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@sentry/react-native/-/react-native-5.6.0.tgz", - "integrity": "sha512-qmu1WzgairYNE/dlGQrjWAZA0OcTv/31yaPUDhX0Yrf1GT+KSerSlimiHGqvle81NJcpSi/K1+7EBfPiK57GmA==", - "dependencies": { - "@sentry/browser": "7.54.0", - "@sentry/cli": "2.18.1", - "@sentry/core": "7.54.0", - "@sentry/hub": "7.54.0", - "@sentry/integrations": "7.54.0", - "@sentry/react": "7.54.0", - "@sentry/types": "7.54.0", - "@sentry/utils": "7.54.0" + "version": "5.31.0", + "resolved": "https://registry.npmjs.org/@sentry/react-native/-/react-native-5.31.0.tgz", + "integrity": "sha512-iflj+SfH2k/vSybC5APTjwdBuW53rQtitD99vRbsMgMTnhcvWMy+ASTf6Shr9czv9uzlYrS83iF/COSyDNwiPQ==", + "license": "MIT", + "dependencies": { + "@sentry/babel-plugin-component-annotate": "2.20.1", + "@sentry/browser": "7.119.0", + "@sentry/cli": "2.31.2", + "@sentry/core": "7.119.0", + "@sentry/hub": "7.119.0", + "@sentry/integrations": "7.119.0", + "@sentry/react": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0" + }, + "bin": { + "sentry-expo-upload-sourcemaps": "scripts/expo-upload-sourcemaps.js" }, "peerDependencies": { + "expo": ">=49.0.0", "react": ">=17.0.0", "react-native": ">=0.65.0" + }, + "peerDependenciesMeta": { + "expo": { + "optional": true + } } }, "node_modules/@sentry/replay": { - "version": "7.54.0", - "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.54.0.tgz", - "integrity": "sha512-C0F0568ybphzGmKGe23duB6n5wJcgM7WLYhoeqW3o2bHeqpj1dGPSka/K3s9KzGaAgzn1zeOUYXJsOs+T/XdsA==", + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.119.0.tgz", + "integrity": "sha512-BnNsYL+X5I4WCH6wOpY6HQtp4MgVt0NVlhLUsEyrvMUiTs0bPkDBrulsgZQBUKJsbOr3l9nHrFoNVB/0i6WNLA==", + "license": "MIT", "dependencies": { - "@sentry/core": "7.54.0", - "@sentry/types": "7.54.0", - "@sentry/utils": "7.54.0" + "@sentry-internal/tracing": "7.119.0", + "@sentry/core": "7.119.0", + "@sentry/types": "7.119.0", + "@sentry/utils": "7.119.0" }, "engines": { "node": ">=12" } }, "node_modules/@sentry/types": { - "version": "7.54.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.54.0.tgz", - "integrity": "sha512-D+i9xogBeawvQi2r0NOrM7zYcUaPuijeME4O9eOTrDF20tj71hWtJLilK+KTGLYFtpGg1h+9bPaz7OHEIyVopg==", + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.119.0.tgz", + "integrity": "sha512-27qQbutDBPKGbuJHROxhIWc1i0HJaGLA90tjMu11wt0E4UNxXRX+UQl4Twu68v4EV3CPvQcEpQfgsViYcXmq+w==", + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/@sentry/utils": { - "version": "7.54.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.54.0.tgz", - "integrity": "sha512-3Yf5KlKjIcYLddOexSt2ovu2TWlR4Fi7M+aCK8yUTzwNzf/xwFSWOstHlD/WiDy9HvfhWAOB/ukNTuAeJmtasw==", + "version": "7.119.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.119.0.tgz", + "integrity": "sha512-ZwyXexWn2ZIe2bBoYnXJVPc2esCSbKpdc6+0WJa8eutXfHq3FRKg4ohkfCBpfxljQGEfP1+kfin945lA21Ka+A==", + "license": "MIT", "dependencies": { - "@sentry/types": "7.54.0", - "tslib": "^1.9.3" + "@sentry/types": "7.119.0" }, "engines": { "node": ">=8" @@ -7434,6 +7616,7 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "license": "MIT", "dependencies": { "debug": "4" }, @@ -11939,6 +12122,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "license": "MIT", "dependencies": { "agent-base": "6", "debug": "4" @@ -12032,7 +12216,8 @@ "node_modules/immediate": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", + "license": "MIT" }, "node_modules/import-fresh": { "version": "3.3.0", @@ -16016,6 +16201,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==", + "license": "MIT", "dependencies": { "immediate": "~3.0.5" } @@ -16030,6 +16216,7 @@ "version": "1.10.0", "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", + "license": "Apache-2.0", "dependencies": { "lie": "3.1.1" } @@ -18720,6 +18907,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "license": "MIT", "engines": { "node": ">=0.4.0" } @@ -21051,7 +21239,8 @@ "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true }, "node_modules/tsscmp": { "version": "1.0.6", diff --git a/package.json b/package.json index ef03cd887..80f6e9f91 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@react-navigation/bottom-tabs": "6.5.8", "@react-navigation/native": "6.1.7", "@react-navigation/stack": "6.3.17", - "@sentry/react-native": "5.6.0", + "@sentry/react-native": "5.31.0", "assert": "2.0.0", "buffer": "4.9.2", "console-browserify": "1.2.0", From 3b61dc1161c17e607ebc42b1023c65322cd0f112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Thu, 31 Oct 2024 10:55:10 -0300 Subject: [PATCH 28/47] feat: update SES to 1.5.0 --- lockdown.umd.js | 2717 ++++++++++++++++++++++++++++++----------------- 1 file changed, 1734 insertions(+), 983 deletions(-) diff --git a/lockdown.umd.js b/lockdown.umd.js index 8e4a7d1d1..5f911b4b0 100644 --- a/lockdown.umd.js +++ b/lockdown.umd.js @@ -1,9 +1,9 @@ -// ses@1.0.1 +// ses@1.5.0 'use strict'; (() => { const functors = [ // === functors[0] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([]); /* global globalThis */ +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; $h‍_imports([]); /* global globalThis */ /* eslint-disable no-restricted-globals */ /** @@ -51,8 +51,9 @@ const { RangeError, ReferenceError, SyntaxError, - TypeError}= - globalThis;$h‍_once.FERAL_ERROR(FERAL_ERROR);$h‍_once.RangeError(RangeError);$h‍_once.ReferenceError(ReferenceError);$h‍_once.SyntaxError(SyntaxError);$h‍_once.TypeError(TypeError); + TypeError, + AggregateError}= + globalThis;$h‍_once.FERAL_ERROR(FERAL_ERROR);$h‍_once.RangeError(RangeError);$h‍_once.ReferenceError(ReferenceError);$h‍_once.SyntaxError(SyntaxError);$h‍_once.TypeError(TypeError);$h‍_once.AggregateError(AggregateError); const { assign, @@ -137,6 +138,10 @@ const { prototype: weakmapPrototype}= WeakMap;$h‍_once.weakmapPrototy const { prototype: weaksetPrototype}= WeakSet;$h‍_once.weaksetPrototype(weaksetPrototype); const { prototype: functionPrototype}= Function;$h‍_once.functionPrototype(functionPrototype); const { prototype: promisePrototype}= Promise;$h‍_once.promisePrototype(promisePrototype); +const { prototype: generatorPrototype}= getPrototypeOf( + // eslint-disable-next-line no-empty-function, func-names + function*() { });$h‍_once.generatorPrototype(generatorPrototype); + const typedArrayPrototype= getPrototypeOf(Uint8Array.prototype);$h‍_once.typedArrayPrototype(typedArrayPrototype); @@ -163,6 +168,9 @@ const arrayIncludes= uncurryThis(arrayPrototype.includes);$h‍_once.arr const arrayJoin= uncurryThis(arrayPrototype.join); /** @type {(thisArg: readonly T[], callbackfn: (value: T, index: number, array: T[]) => U, cbThisArg?: any) => U[]} */$h‍_once.arrayJoin(arrayJoin); const arrayMap= /** @type {any} */ uncurryThis(arrayPrototype.map);$h‍_once.arrayMap(arrayMap); +const arrayFlatMap= /** @type {any} */ + uncurryThis(arrayPrototype.flatMap);$h‍_once.arrayFlatMap(arrayFlatMap); + const arrayPop= uncurryThis(arrayPrototype.pop); /** @type {(thisArg: T[], ...items: T[]) => number} */$h‍_once.arrayPop(arrayPop); const arrayPush= uncurryThis(arrayPrototype.push);$h‍_once.arrayPush(arrayPush); @@ -191,13 +199,16 @@ const matchAllRegExp= uncurryThis(regexpPrototype[matchAllSymbol]); $h‍_once.matchAllRegExp(matchAllRegExp);const stringEndsWith=uncurryThis(stringPrototype.endsWith);$h‍_once.stringEndsWith(stringEndsWith); const stringIncludes= uncurryThis(stringPrototype.includes);$h‍_once.stringIncludes(stringIncludes); const stringIndexOf= uncurryThis(stringPrototype.indexOf);$h‍_once.stringIndexOf(stringIndexOf); -const stringMatch= uncurryThis(stringPrototype.match); +const stringMatch= uncurryThis(stringPrototype.match);$h‍_once.stringMatch(stringMatch); +const generatorNext= uncurryThis(generatorPrototype.next);$h‍_once.generatorNext(generatorNext); +const generatorThrow= uncurryThis(generatorPrototype.throw); + /** * @type { & * ((thisArg: string, searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string) => string) & * ((thisArg: string, searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string) => string) * } - */$h‍_once.stringMatch(stringMatch); + */$h‍_once.generatorThrow(generatorThrow); const stringReplace= /** @type {any} */ uncurryThis(stringPrototype.replace);$h‍_once.stringReplace(stringReplace); @@ -217,9 +228,10 @@ const weakmapSet= uncurryThis(weakmapPrototype.set); $h‍_once.weakmapSet(weakmapSet);const weaksetAdd=uncurryThis(weaksetPrototype.add);$h‍_once.weaksetAdd(weaksetAdd); const weaksetHas= uncurryThis(weaksetPrototype.has); // -$h‍_once.weaksetHas(weaksetHas);const functionToString=uncurryThis(functionPrototype.toString); +$h‍_once.weaksetHas(weaksetHas);const functionToString=uncurryThis(functionPrototype.toString);$h‍_once.functionToString(functionToString); +const functionBind= uncurryThis(bind); // -$h‍_once.functionToString(functionToString);const{all}=Promise; +$h‍_once.functionBind(functionBind);const{all}=Promise; const promiseAll= (promises)=>apply(all, Promise, [promises]);$h‍_once.promiseAll(promiseAll); const promiseCatch= uncurryThis(promisePrototype.catch); /** @type {(thisArg: T, onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null) => Promise} */$h‍_once.promiseCatch(promiseCatch); @@ -294,11 +306,69 @@ $h‍_once.FERAL_EVAL(FERAL_EVAL);const FERAL_FUNCTION=Function;$h‍_once.FERAL const noEvalEvaluate= ()=> { // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_NO_EVAL.md throw TypeError('Cannot eval with evalTaming set to "noEval" (SES_NO_EVAL)'); - };$h‍_once.noEvalEvaluate(noEvalEvaluate); + }; + +// ////////////////// FERAL_STACK_GETTER FERAL_STACK_SETTER //////////////////// +$h‍_once.noEvalEvaluate(noEvalEvaluate); +const er1StackDesc= getOwnPropertyDescriptor(Error('er1'), 'stack'); +const er2StackDesc= getOwnPropertyDescriptor(TypeError('er2'), 'stack'); + +let feralStackGetter; +let feralStackSetter; +if( er1StackDesc&& er2StackDesc&& er1StackDesc.get) { + // We should only encounter this case on v8 because of its problematic + // error own stack accessor behavior. + // Note that FF/SpiderMonkey, Moddable/XS, and the error stack proposal + // all inherit a stack accessor property from Error.prototype, which is + // great. That case needs no heroics to secure. + if( + // In the v8 case as we understand it, all errors have an own stack + // accessor property, but within the same realm, all these accessor + // properties have the same getter and have the same setter. + // This is therefore the case that we repair. + typeof er1StackDesc.get=== 'function'&& + er1StackDesc.get=== er2StackDesc.get&& + typeof er1StackDesc.set=== 'function'&& + er1StackDesc.set=== er2StackDesc.set) + { + // Otherwise, we have own stack accessor properties that are outside + // our expectations, that therefore need to be understood better + // before we know how to repair them. + feralStackGetter= freeze(er1StackDesc.get); + feralStackSetter= freeze(er1StackDesc.set); + }else { + // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_UNEXPECTED_ERROR_OWN_STACK_ACCESSOR.md + throw TypeError( + 'Unexpected Error own stack accessor functions (SES_UNEXPECTED_ERROR_OWN_STACK_ACCESSOR)'); + + } + } + +/** + * If on a v8 with the problematic error own stack accessor behavior, + * `FERAL_STACK_GETTER` will be the shared getter of all those accessors + * and `FERAL_STACK_SETTER` will be the shared setter. On any platform + * without this problem, `FERAL_STACK_GETTER` and `FERAL_STACK_SETTER` are + * both `undefined`. + * + * @type {(() => any) | undefined} + */ +const FERAL_STACK_GETTER= feralStackGetter; + +/** + * If on a v8 with the problematic error own stack accessor behavior, + * `FERAL_STACK_GETTER` will be the shared getter of all those accessors + * and `FERAL_STACK_SETTER` will be the shared setter. On any platform + * without this problem, `FERAL_STACK_GETTER` and `FERAL_STACK_SETTER` are + * both `undefined`. + * + * @type {((newValue: any) => void) | undefined} + */$h‍_once.FERAL_STACK_GETTER(FERAL_STACK_GETTER); +const FERAL_STACK_SETTER= feralStackSetter;$h‍_once.FERAL_STACK_SETTER(FERAL_STACK_SETTER); })() , // === functors[1] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let TypeError;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]]]]]); +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let TypeError;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]]]]]); /** getThis returns globalThis in sloppy mode or undefined in strict mode. */ function getThis() { @@ -312,7 +382,8 @@ if( getThis()) { })() , // === functors[2] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([]); // @ts-check +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; $h‍_imports([]); /* global globalThis */ +// @ts-check // `@endo/env-options` needs to be imported quite early, and so should // avoid importing from ses or anything that depends on ses. @@ -331,6 +402,8 @@ const uncurryThis= (receiver, ...args)=> apply(fn, receiver, args); const arrayPush= uncurryThis(Array.prototype.push); +const arrayIncludes= uncurryThis(Array.prototype.includes); +const stringSplit= uncurryThis(String.prototype.split); const q= JSON.stringify; @@ -351,8 +424,10 @@ const Fail= (literals, ...args)=> { * the environment variables that were captured. * * @param {object} aGlobal + * @param {boolean} [dropNames] Defaults to false. If true, don't track + * names used. */ -const makeEnvironmentCaptor= (aGlobal)=>{ +const makeEnvironmentCaptor= (aGlobal, dropNames= false)=> { const capturedEnvironmentOptionNames= []; /** @@ -361,13 +436,17 @@ const makeEnvironmentCaptor= (aGlobal)=>{ * * @param {string} optionName * @param {string} defaultSetting + * @param {string[]} [optOtherValues] + * If provided, the option value must be included or match `defaultSetting`. * @returns {string} */ - const getEnvironmentOption= (optionName, defaultSetting)=> { - // eslint-disable-next-line @endo/no-polymorphic-call + const getEnvironmentOption= ( + optionName, + defaultSetting, + optOtherValues= undefined)=> + { typeof optionName=== 'string'|| Fail `Environment option name ${q(optionName)} must be a string.`; - // eslint-disable-next-line @endo/no-polymorphic-call typeof defaultSetting=== 'string'|| Fail `Environment option default setting ${q( defaultSetting) @@ -375,44 +454,80 @@ const makeEnvironmentCaptor= (aGlobal)=>{ /** @type {string} */ let setting= defaultSetting; - const globalProcess= aGlobal.process; - if( globalProcess&& typeof globalProcess=== 'object') { - const globalEnv= globalProcess.env; - if( globalEnv&& typeof globalEnv=== 'object') { - if( optionName in globalEnv) { + const globalProcess= aGlobal.process|| undefined; + const globalEnv= + typeof globalProcess=== 'object'&& globalProcess.env|| undefined; + if( typeof globalEnv=== 'object') { + if( optionName in globalEnv) { + if( !dropNames) { arrayPush(capturedEnvironmentOptionNames, optionName); - const optionValue= globalEnv[optionName]; - // eslint-disable-next-line @endo/no-polymorphic-call - typeof optionValue=== 'string'|| - Fail `Environment option named ${q( - optionName) - }, if present, must have a corresponding string value, got ${q( - optionValue) - }`; - setting= optionValue; } + const optionValue= globalEnv[optionName]; + // eslint-disable-next-line @endo/no-polymorphic-call + typeof optionValue=== 'string'|| + Fail `Environment option named ${q( + optionName) + }, if present, must have a corresponding string value, got ${q( + optionValue) + }`; + setting= optionValue; } } + optOtherValues=== undefined|| + setting=== defaultSetting|| + arrayIncludes(optOtherValues, setting)|| + Fail `Unrecognized ${q(optionName)} value ${q( + setting) + }. Expected one of ${q([defaultSetting,...optOtherValues]) }`; return setting; }; freeze(getEnvironmentOption); + /** + * @param {string} optionName + * @returns {string[]} + */ + const getEnvironmentOptionsList= (optionName)=>{ + const option= getEnvironmentOption(optionName, ''); + return freeze(option=== ''? []: stringSplit(option, ',')); + }; + freeze(getEnvironmentOptionsList); + + const environmentOptionsListHas= (optionName, element)=> + arrayIncludes(getEnvironmentOptionsList(optionName), element); + const getCapturedEnvironmentOptionNames= ()=> { return freeze([...capturedEnvironmentOptionNames]); }; freeze(getCapturedEnvironmentOptionNames); - return freeze({ getEnvironmentOption, getCapturedEnvironmentOptionNames}); + return freeze({ + getEnvironmentOption, + getEnvironmentOptionsList, + environmentOptionsListHas, + getCapturedEnvironmentOptionNames}); + };$h‍_once.makeEnvironmentCaptor(makeEnvironmentCaptor); freeze(makeEnvironmentCaptor); + +/** + * For the simple case, where the global in question is `globalThis` and no + * reporting of option names is desired. + */ +const { + getEnvironmentOption, + getEnvironmentOptionsList, + environmentOptionsListHas}= + makeEnvironmentCaptor(globalThis, true);$h‍_once.getEnvironmentOption(getEnvironmentOption);$h‍_once.getEnvironmentOptionsList(getEnvironmentOptionsList);$h‍_once.environmentOptionsListHas(environmentOptionsListHas); })() , // === functors[3] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([["./src/env-options.js", []]]); +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; $h‍_imports([["./src/env-options.js", []]]); })() , // === functors[4] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Set,String,isArray,arrayJoin,arraySlice,arraySort,arrayMap,keys,fromEntries,freeze,is,isError,setAdd,setHas,stringIncludes,stringStartsWith,stringifyJson,toStringTagSymbol;$h‍_imports([["../commons.js", [["Set", [$h‍_a => (Set = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["isArray", [$h‍_a => (isArray = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arraySlice", [$h‍_a => (arraySlice = $h‍_a)]],["arraySort", [$h‍_a => (arraySort = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["keys", [$h‍_a => (keys = $h‍_a)]],["fromEntries", [$h‍_a => (fromEntries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["isError", [$h‍_a => (isError = $h‍_a)]],["setAdd", [$h‍_a => (setAdd = $h‍_a)]],["setHas", [$h‍_a => (setHas = $h‍_a)]],["stringIncludes", [$h‍_a => (stringIncludes = $h‍_a)]],["stringStartsWith", [$h‍_a => (stringStartsWith = $h‍_a)]],["stringifyJson", [$h‍_a => (stringifyJson = $h‍_a)]],["toStringTagSymbol", [$h‍_a => (toStringTagSymbol = $h‍_a)]]]]]); +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let Set,String,isArray,arrayJoin,arraySlice,arraySort,arrayMap,keys,fromEntries,freeze,is,isError,setAdd,setHas,stringIncludes,stringStartsWith,stringifyJson,toStringTagSymbol;$h‍_imports([["../commons.js", [["Set", [$h‍_a => (Set = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["isArray", [$h‍_a => (isArray = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arraySlice", [$h‍_a => (arraySlice = $h‍_a)]],["arraySort", [$h‍_a => (arraySort = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["keys", [$h‍_a => (keys = $h‍_a)]],["fromEntries", [$h‍_a => (fromEntries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["isError", [$h‍_a => (isError = $h‍_a)]],["setAdd", [$h‍_a => (setAdd = $h‍_a)]],["setHas", [$h‍_a => (setHas = $h‍_a)]],["stringIncludes", [$h‍_a => (stringIncludes = $h‍_a)]],["stringStartsWith", [$h‍_a => (stringStartsWith = $h‍_a)]],["stringifyJson", [$h‍_a => (stringifyJson = $h‍_a)]],["toStringTagSymbol", [$h‍_a => (toStringTagSymbol = $h‍_a)]]]]]); + @@ -434,6 +549,7 @@ freeze(makeEnvironmentCaptor); +/** @import {StringablePayload} from '../../types.js' */ /** * Joins English terms with commas and an optional conjunction. @@ -607,355 +723,9 @@ freeze(bestEffortStringify); })() , // === functors[5] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([]); // @ts-check - -/** - * @callback BaseAssert - * The `assert` function itself. - * - * @param {any} flag The truthy/falsy value - * @param {Details=} optDetails The details to throw - * @param {ErrorConstructor=} ErrorConstructor An optional alternate error - * constructor to use. - * @returns {asserts flag} - */ - -/** - * @typedef {object} AssertMakeErrorOptions - * @property {string=} errorName - */ - -/** - * @callback AssertMakeError - * - * The `assert.error` method, recording details for the console. - * - * The optional `optDetails` can be a string. - * @param {Details=} optDetails The details of what was asserted - * @param {ErrorConstructor=} ErrorConstructor An optional alternate error - * constructor to use. - * @param {AssertMakeErrorOptions=} options - * @returns {Error} - */ - -/** - * @callback AssertFail - * - * The `assert.fail` method. - * - * Fail an assertion, recording full details to the console and - * raising an exception with a message in which `details` substitution values - * have been redacted. - * - * The optional `optDetails` can be a string for backwards compatibility - * with the nodejs assertion library. - * @param {Details=} optDetails The details of what was asserted - * @param {ErrorConstructor=} ErrorConstructor An optional alternate error - * constructor to use. - * @returns {never} - */ - -/** - * @callback AssertEqual - * The `assert.equal` method - * - * Assert that two values must be `Object.is`. - * @param {any} actual The value we received - * @param {any} expected What we wanted - * @param {Details=} optDetails The details to throw - * @param {ErrorConstructor=} ErrorConstructor An optional alternate error - * constructor to use. - * @returns {void} - */ - -// Type all the overloads of the assertTypeof function. -// There may eventually be a better way to do this, but -// thems the breaks with Typescript 4.0. -/** - * @callback AssertTypeofBigint - * @param {any} specimen - * @param {'bigint'} typename - * @param {Details=} optDetails - * @returns {asserts specimen is bigint} - */ - -/** - * @callback AssertTypeofBoolean - * @param {any} specimen - * @param {'boolean'} typename - * @param {Details=} optDetails - * @returns {asserts specimen is boolean} - */ - -/** - * @callback AssertTypeofFunction - * @param {any} specimen - * @param {'function'} typename - * @param {Details=} optDetails - * @returns {asserts specimen is Function} - */ - -/** - * @callback AssertTypeofNumber - * @param {any} specimen - * @param {'number'} typename - * @param {Details=} optDetails - * @returns {asserts specimen is number} - */ - -/** - * @callback AssertTypeofObject - * @param {any} specimen - * @param {'object'} typename - * @param {Details=} optDetails - * @returns {asserts specimen is Record | null} - */ - -/** - * @callback AssertTypeofString - * @param {any} specimen - * @param {'string'} typename - * @param {Details=} optDetails - * @returns {asserts specimen is string} - */ - -/** - * @callback AssertTypeofSymbol - * @param {any} specimen - * @param {'symbol'} typename - * @param {Details=} optDetails - * @returns {asserts specimen is symbol} - */ - -/** - * @callback AssertTypeofUndefined - * @param {any} specimen - * @param {'undefined'} typename - * @param {Details=} optDetails - * @returns {asserts specimen is undefined} - */ - -/** - * The `assert.typeof` method - * - * @typedef {AssertTypeofBigint & AssertTypeofBoolean & AssertTypeofFunction & AssertTypeofNumber & AssertTypeofObject & AssertTypeofString & AssertTypeofSymbol & AssertTypeofUndefined} AssertTypeof - */ - -/** - * @callback AssertString - * The `assert.string` method. - * - * `assert.string(v)` is equivalent to `assert.typeof(v, 'string')`. We - * special case this one because it is the most frequently used. - * - * Assert an expected typeof result. - * @param {any} specimen The value to get the typeof - * @param {Details=} optDetails The details to throw - * @returns {asserts specimen is string} - */ - -/** - * @callback AssertNote - * The `assert.note` method. - * - * Annotate an error with details, potentially to be used by an - * augmented console such as the causal console of `console.js`, to - * provide extra information associated with logged errors. - * - * @param {Error} error - * @param {Details} detailsNote - * @returns {void} - */ - -// ///////////////////////////////////////////////////////////////////////////// - -/** - * @typedef {{}} DetailsToken - * A call to the `details` template literal makes and returns a fresh details - * token, which is a frozen empty object associated with the arguments of that - * `details` template literal expression. - */ - -/** - * @typedef {string | DetailsToken} Details - * Either a plain string, or made by the `details` template literal tag. - */ - -/** - * @typedef {object} StringablePayload - * Holds the payload passed to quote so that its printed form is visible. - * @property {() => string} toString How to print the payload - */ - -/** - * To "declassify" and quote a substitution value used in a - * ``` details`...` ``` template literal, enclose that substitution expression - * in a call to `quote`. This makes the value appear quoted - * (as if with `JSON.stringify`) in the message of the thrown error. The - * payload itself is still passed unquoted to the console as it would be - * without `quote`. - * - * For example, the following will reveal the expected sky color, but not the - * actual incorrect sky color, in the thrown error's message: - * ```js - * sky.color === expectedColor || Fail`${sky.color} should be ${quote(expectedColor)}`; - * ``` - * - * // TODO Update SES-shim to new convention, where `details` is - * // renamed to `X` rather than `d`. - * The normal convention is to locally rename `details` to `d` and `quote` to `q` - * like `const { details: d, quote: q } = assert;`, so the above example would then be - * ```js - * sky.color === expectedColor || Fail`${sky.color} should be ${q(expectedColor)}`; - * ``` - * - * @callback AssertQuote - * @param {any} payload What to declassify - * @param {(string|number)=} spaces - * @returns {StringablePayload} The declassified payload - */ - -/** - * @callback Raise - * - * To make an `assert` which terminates some larger unit of computation - * like a transaction, vat, or process, call `makeAssert` with a `Raise` - * callback, where that callback actually performs that larger termination. - * If possible, the callback should also report its `reason` parameter as - * the alleged reason for the termination. - * - * @param {Error} reason - */ - -/** - * @callback MakeAssert - * - * Makes and returns an `assert` function object that shares the bookkeeping - * state defined by this module with other `assert` function objects made by - * `makeAssert`. This state is per-module-instance and is exposed by the - * `loggedErrorHandler` above. We refer to `assert` as a "function object" - * because it can be called directly as a function, but also has methods that - * can be called. - * - * If `optRaise` is provided, the returned `assert` function object will call - * `optRaise(reason)` before throwing the error. This enables `optRaise` to - * engage in even more violent termination behavior, like terminating the vat, - * that prevents execution from reaching the following throw. However, if - * `optRaise` returns normally, which would be unusual, the throw following - * `optRaise(reason)` would still happen. - * - * @param {Raise=} optRaise - * @param {boolean=} unredacted - * @returns {Assert} - */ - -/** - * @typedef {(template: TemplateStringsArray | string[], ...args: any) => DetailsToken} DetailsTag - * - * Use the `details` function as a template literal tag to create - * informative error messages. The assertion functions take such messages - * as optional arguments: - * ```js - * assert(sky.isBlue(), details`${sky.color} should be "blue"`); - * ``` - * // TODO Update SES-shim to new convention, where `details` is - * // renamed to `X` rather than `d`. - * or following the normal convention to locally rename `details` to `d` - * and `quote` to `q` like `const { details: d, quote: q } = assert;`: - * ```js - * assert(sky.isBlue(), d`${sky.color} should be "blue"`); - * ``` - * However, note that in most cases it is preferable to instead use the `Fail` - * template literal tag (which has the same input signature as `details` - * but automatically creates and throws an error): - * ```js - * sky.isBlue() || Fail`${sky.color} should be "blue"`; - * ``` - * - * The details template tag returns a `DetailsToken` object that can print - * itself with the formatted message in two ways. - * It will report full details to the console, but - * mask embedded substitution values with their typeof information in the thrown error - * to prevent revealing secrets up the exceptional path. In the example - * above, the thrown error may reveal only that `sky.color` is a string, - * whereas the same diagnostic printed to the console reveals that the - * sky was green. This masking can be disabled for an individual substitution value - * using `quote`. - * - * The `raw` property of an input template array is ignored, so a simple - * array of strings may be provided directly. - */ - -/** - * @typedef {(template: TemplateStringsArray | string[], ...args: any) => never} FailTag - * - * Use the `Fail` function as a template literal tag to efficiently - * create and throw a `details`-style error only when a condition is not satisfied. - * ```js - * condition || Fail`...complaint...`; - * ``` - * This avoids the overhead of creating usually-unnecessary errors like - * ```js - * assert(condition, details`...complaint...`); - * ``` - * while improving readability over alternatives like - * ```js - * condition || assert.fail(details`...complaint...`); - * ``` - * - * However, due to current weakness in TypeScript, static reasoning - * is less powerful with the `||` patterns than with an `assert` call. - * Until/unless https://github.com/microsoft/TypeScript/issues/51426 is fixed, - * for `||`-style assertions where this loss of static reasoning is a problem, - * instead express the assertion as - * ```js - * if (!condition) { - * Fail`...complaint...`; - * } - * ``` - * or, if needed, - * ```js - * if (!condition) { - * // `throw` is noop since `Fail` throws, but it improves static analysis - * throw Fail`...complaint...`; - * } - * ``` - */ +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; $h‍_imports([]); // @ts-check -/** - * assert that expr is truthy, with an optional details to describe - * the assertion. It is a tagged template literal like - * ```js - * assert(expr, details`....`);` - * ``` - * - * The literal portions of the template are assumed non-sensitive, as - * are the `typeof` types of the substitution values. These are - * assembled into the thrown error message. The actual contents of the - * substitution values are assumed sensitive, to be revealed to - * the console only. We assume only the virtual platform's owner can read - * what is written to the console, where the owner is in a privileged - * position over computation running on that platform. - * - * The optional `optDetails` can be a string for backwards compatibility - * with the nodejs assertion library. - * - * @typedef { BaseAssert & { - * typeof: AssertTypeof, - * error: AssertMakeError, - * fail: AssertFail, - * equal: AssertEqual, - * string: AssertString, - * note: AssertNote, - * details: DetailsTag, - * Fail: FailTag, - * quote: AssertQuote, - * bare: AssertQuote, - * makeAssert: MakeAssert, - * } } Assert - */ - -// ///////////////////////////////////////////////////////////////////////////// +/** @import {GenericErrorConstructor, AssertMakeErrorOptions, DetailsToken, StringablePayload} from '../../types.js' */ /** * @typedef {object} VirtualConsole @@ -1009,13 +779,13 @@ freeze(bestEffortStringify); * @callback FilterConsole * @param {VirtualConsole} baseConsole * @param {ConsoleFilter} filter - * @param {string=} topic + * @param {string} [topic] * @returns {VirtualConsole} */ })() , // === functors[6] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([]); // @ts-check +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; $h‍_imports([]); // @ts-check /** * @typedef {readonly any[]} LogArgs @@ -1086,7 +856,12 @@ freeze(bestEffortStringify); */ /** - * @typedef {{ NOTE: 'ERROR_NOTE:', MESSAGE: 'ERROR_MESSAGE:' }} ErrorInfo + * @typedef {{ + * NOTE: 'ERROR_NOTE:', + * MESSAGE: 'ERROR_MESSAGE:', + * CAUSE: 'cause:', + * ERRORS: 'errors:', + * }} ErrorInfo */ /** @@ -1107,14 +882,15 @@ freeze(bestEffortStringify); })() , // === functors[7] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([["./internal-types.js", []]]); - - - - +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; $h‍_imports([]); // @ts-check +/* eslint-disable @endo/no-polymorphic-call */ -const { freeze}= Object; +// eslint-disable-next-line no-restricted-globals const { isSafeInteger}= Number; +// eslint-disable-next-line no-restricted-globals +const { freeze}= Object; +// eslint-disable-next-line no-restricted-globals +const { toStringTag: toStringTagSymbol}= Symbol; /** * @template Data @@ -1161,9 +937,11 @@ const makeSelfCell= (data)=>{ */ const spliceAfter= (prev, selfCell)=> { if( prev=== selfCell) { + // eslint-disable-next-line no-restricted-globals throw TypeError('Cannot splice a cell into itself'); } if( selfCell.next!== selfCell|| selfCell.prev!== selfCell) { + // eslint-disable-next-line no-restricted-globals throw TypeError('Expected self-linked cell'); } const cell= selfCell; @@ -1211,10 +989,12 @@ const spliceOut= (cell)=>{ */ const makeLRUCacheMap= (keysBudget)=>{ if( !isSafeInteger(keysBudget)|| keysBudget< 0) { + // eslint-disable-next-line no-restricted-globals throw TypeError('keysBudget must be a safe non-negative integer number'); } /** @typedef {DoublyLinkedCell | undefined>} LRUCacheCell */ /** @type {WeakMap} */ + // eslint-disable-next-line no-restricted-globals const keyToCell= new WeakMap(); let size= 0; // `size` must remain <= `keysBudget` // As a sigil, `head` uniquely is not in the `keyToCell` map. @@ -1269,6 +1049,7 @@ const makeLRUCacheMap= (keysBudget)=>{ // Either a fresh cell or a reused condemned cell. size+= 1; // Add its data. + // eslint-disable-next-line no-restricted-globals cell.data= new WeakMap(); // Advertise the cell for this key. keyToCell.set(key, cell); @@ -1315,11 +1096,25 @@ const makeLRUCacheMap= (keysBudget)=>{ get, set, delete: deleteIt, - [Symbol.toStringTag]: 'LRUCacheMap'}); + // eslint-disable-next-line jsdoc/check-types + [/** @type {typeof Symbol.toStringTag} */ toStringTagSymbol]: + 'LRUCacheMap'}); return lruCacheMap; };$h‍_once.makeLRUCacheMap(makeLRUCacheMap); freeze(makeLRUCacheMap); +})() +, +// === functors[8] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let makeLRUCacheMap;$h‍_imports([["../make-lru-cachemap.js", [["makeLRUCacheMap", [$h‍_a => (makeLRUCacheMap = $h‍_a)]]]],["./internal-types.js", []]]); + + + + + + +const { freeze}= Object; +const { isSafeInteger}= Number; const defaultLoggedErrorsBudget= 1000; const defaultArgsPerErrorBudget= 100; @@ -1386,8 +1181,14 @@ const makeNoteLogArgsArrayKit= ( freeze(makeNoteLogArgsArrayKit); })() , -// === functors[8] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let RangeError,TypeError,WeakMap,arrayJoin,arrayMap,arrayPop,arrayPush,assign,freeze,globalThis,is,isError,regexpTest,stringIndexOf,stringReplace,stringSlice,stringStartsWith,weakmapDelete,weakmapGet,weakmapHas,weakmapSet,an,bestEffortStringify,makeNoteLogArgsArrayKit;$h‍_imports([["../commons.js", [["RangeError", [$h‍_a => (RangeError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arrayPop", [$h‍_a => (arrayPop = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["assign", [$h‍_a => (assign = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["isError", [$h‍_a => (isError = $h‍_a)]],["regexpTest", [$h‍_a => (regexpTest = $h‍_a)]],["stringIndexOf", [$h‍_a => (stringIndexOf = $h‍_a)]],["stringReplace", [$h‍_a => (stringReplace = $h‍_a)]],["stringSlice", [$h‍_a => (stringSlice = $h‍_a)]],["stringStartsWith", [$h‍_a => (stringStartsWith = $h‍_a)]],["weakmapDelete", [$h‍_a => (weakmapDelete = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapHas", [$h‍_a => (weakmapHas = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]]]],["./stringify-utils.js", [["an", [$h‍_a => (an = $h‍_a)]],["bestEffortStringify", [$h‍_a => (bestEffortStringify = $h‍_a)]]]],["./types.js", []],["./internal-types.js", []],["./note-log-args.js", [["makeNoteLogArgsArrayKit", [$h‍_a => (makeNoteLogArgsArrayKit = $h‍_a)]]]]]); +// === functors[9] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let RangeError,TypeError,WeakMap,arrayJoin,arrayMap,arrayPop,arrayPush,assign,freeze,defineProperty,globalThis,is,isError,regexpTest,stringIndexOf,stringReplace,stringSlice,stringStartsWith,weakmapDelete,weakmapGet,weakmapHas,weakmapSet,AggregateError,getOwnPropertyDescriptors,ownKeys,create,objectPrototype,objectHasOwnProperty,an,bestEffortStringify,makeNoteLogArgsArrayKit;$h‍_imports([["../commons.js", [["RangeError", [$h‍_a => (RangeError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arrayPop", [$h‍_a => (arrayPop = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["assign", [$h‍_a => (assign = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["isError", [$h‍_a => (isError = $h‍_a)]],["regexpTest", [$h‍_a => (regexpTest = $h‍_a)]],["stringIndexOf", [$h‍_a => (stringIndexOf = $h‍_a)]],["stringReplace", [$h‍_a => (stringReplace = $h‍_a)]],["stringSlice", [$h‍_a => (stringSlice = $h‍_a)]],["stringStartsWith", [$h‍_a => (stringStartsWith = $h‍_a)]],["weakmapDelete", [$h‍_a => (weakmapDelete = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapHas", [$h‍_a => (weakmapHas = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]],["AggregateError", [$h‍_a => (AggregateError = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["objectPrototype", [$h‍_a => (objectPrototype = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]]]],["./stringify-utils.js", [["an", [$h‍_a => (an = $h‍_a)]],["bestEffortStringify", [$h‍_a => (bestEffortStringify = $h‍_a)]]]],["./types.js", []],["./internal-types.js", []],["./note-log-args.js", [["makeNoteLogArgsArrayKit", [$h‍_a => (makeNoteLogArgsArrayKit = $h‍_a)]]]]]); + + + + + + @@ -1427,6 +1228,11 @@ freeze(makeNoteLogArgsArrayKit); + + +/** + * @import {BaseAssert, Assert, AssertionFunctions, AssertionUtilities, StringablePayload, DetailsToken, MakeAssert} from '../../types.js' + */ // For our internal debugging purposes, uncomment // const internalDebugConsole = console; @@ -1436,7 +1242,7 @@ freeze(makeNoteLogArgsArrayKit); /** @type {WeakMap} */ const declassifiers= new WeakMap(); -/** @type {AssertQuote} */ +/** @type {AssertionUtilities['quote']} */ const quote= (payload, spaces= undefined)=> { const result= freeze({ toString: freeze(()=> bestEffortStringify(payload, spaces))}); @@ -1449,19 +1255,7 @@ freeze(quote); const canBeBare= freeze(/^[\w:-]( ?[\w:-])*$/); /** - * Embed a string directly into error details without wrapping punctuation. - * To avoid injection attacks that exploit quoting confusion, this must NEVER - * be used with data that is possibly attacker-controlled. - * As a further safeguard, we fall back to quoting any input that is not a - * string of sufficiently word-like parts separated by isolated spaces (rather - * than throwing an exception, which could hide the original problem for which - * explanatory details are being constructed---i.e., ``` assert.details`...` ``` - * should never be the source of a new exception, nor should an attempt to - * render its output, although we _could_ instead decide to handle the latter - * by inline replacement similar to that of `bestEffortStringify` for producing - * rendered messages like `(an object) was tagged "[Unsafe bare string]"`). - * - * @type {AssertQuote} + * @type {AssertionUtilities['bare']} */ const bare= (payload, spaces= undefined)=> { if( typeof payload!== 'string'|| !regexpTest(canBeBare, payload)) { @@ -1547,7 +1341,7 @@ freeze(DetailsTokenProto.toString); * of them should be uses where the template literal has no redacted * substitution values. In those cases, the two are equivalent. * - * @type {DetailsTag} + * @type {AssertionUtilities['details']} */ const redactedDetails= (template, ...args)=> { // Keep in mind that the vast majority of calls to `details` creates @@ -1556,7 +1350,7 @@ const redactedDetails= (template, ...args)=> { // all the work to happen only if needed, for example, if an assertion fails. const detailsToken= freeze({ __proto__: DetailsTokenProto}); weakmapSet(hiddenDetailsMap, detailsToken, { template, args}); - return detailsToken; + return (/** @type {DetailsToken} */ /** @type {unknown} */ detailsToken); }; freeze(redactedDetails); @@ -1571,7 +1365,7 @@ freeze(redactedDetails); * of safety. `unredactedDetails` also sacrifices the speed of `details`, * which is usually fine in debugging and testing. * - * @type {DetailsTag} + * @type {AssertionUtilities['details']} */ const unredactedDetails= (template, ...args)=> { args= arrayMap(args, (arg)=> @@ -1642,12 +1436,79 @@ const tagError= (err, optErrorName= err.name)=> { }; /** - * @type {AssertMakeError} + * Make reasonable best efforts to make a `Passable` error. + * - `sanitizeError` will remove any "extraneous" own properties already added + * by the host, + * such as `fileName`,`lineNumber` on FireFox or `line` on Safari. + * - If any such "extraneous" properties were removed, `sanitizeError` will + * annotate + * the error with them, so they still appear on the causal console + * log output for diagnostic purposes, but not be otherwise visible. + * - `sanitizeError` will ensure that any expected properties already + * added by the host are data + * properties, converting accessor properties to data properties as needed, + * such as `stack` on v8 (Chrome, Brave, Edge?) + * - `sanitizeError` will freeze the error, preventing any correct engine from + * adding or + * altering any of the error's own properties `sanitizeError` is done. + * + * However, `sanitizeError` will not, for example, `harden` + * (i.e., deeply freeze) + * or ensure that the `cause` or `errors` property satisfy the `Passable` + * constraints. The purpose of `sanitizeError` is only to protect against + * mischief the host may have already added to the error as created, + * not to ensure that the error is actually Passable. For that, + * see `toPassableError` in `@endo/pass-style`. + * + * @param {Error} error */ +const sanitizeError= (error)=>{ + const descs= getOwnPropertyDescriptors(error); + const { + name: _nameDesc, + message: _messageDesc, + errors: _errorsDesc= undefined, + cause: _causeDesc= undefined, + stack: _stackDesc= undefined, + ...restDescs}= + descs; + + const restNames= ownKeys(restDescs); + if( restNames.length>= 1) { + for( const name of restNames) { + delete error[name]; + } + const droppedNote= create(objectPrototype, restDescs); + // eslint-disable-next-line no-use-before-define + note( + error, + redactedDetails `originally with properties ${quote(droppedNote)}`); + + } + for( const name of ownKeys(error)) { + // @ts-expect-error TS still confused by symbols as property names + const desc= descs[name]; + if( desc&& objectHasOwnProperty(desc, 'get')) { + defineProperty(error, name, { + value: error[name] // invoke the getter to convert to data property +}); + } + } + freeze(error); + }; + +/** + * @type {AssertionUtilities['error']} + */$h‍_once.sanitizeError(sanitizeError); const makeError= ( optDetails= redactedDetails `Assert failed`, - ErrorConstructor= globalThis.Error, - { errorName= undefined}= {})=> + errConstructor= globalThis.Error, + { + errorName= undefined, + cause= undefined, + errors= undefined, + sanitize= true}= + {})=> { if( typeof optDetails=== 'string') { // If it is a string, use it as the literal part of the template so @@ -1659,11 +1520,36 @@ const makeError= ( throw TypeError( `unrecognized details ${quote(optDetails)}`); } const messageString= getMessageString(hiddenDetails); - const error= new ErrorConstructor(messageString); + const opts= cause&& { cause}; + let error; + if( + typeof AggregateError!== 'undefined'&& + errConstructor=== AggregateError) + { + error= AggregateError(errors|| [], messageString, opts); + }else { + error= /** @type {ErrorConstructor} */ errConstructor( + messageString, + opts); + + if( errors!== undefined) { + // Since we need to tolerate `errors` on an AggregateError, may as + // well tolerate it on all errors. + defineProperty(error, 'errors', { + value: errors, + writable: true, + enumerable: false, + configurable: true}); + + } + } weakmapSet(hiddenMessageLogArgs, error, getLogArgs(hiddenDetails)); if( errorName!== undefined) { tagError(error, errorName); } + if( sanitize) { + sanitizeError(error); + } // The next line is a particularly fruitful place to put a breakpoint. return error; }; @@ -1687,7 +1573,7 @@ const { addLogArgs, takeLogArgsArray}= makeNoteLogArgsArrayKit(); */ const hiddenNoteCallbackArrays= new WeakMap(); -/** @type {AssertNote} */ +/** @type {AssertionUtilities['note']} */ const note= (error, detailsNote)=> { if( typeof detailsNote=== 'string') { // If it is a string, use it as the literal part of the template so @@ -1768,20 +1654,22 @@ const makeAssert= (optRaise= undefined, unredacted= false)=> { const details= unredacted? unredactedDetails: redactedDetails; const assertFailedDetails= details `Check failed`; - /** @type {AssertFail} */ + /** @type {AssertionFunctions['fail']} */ const fail= ( optDetails= assertFailedDetails, - ErrorConstructor= globalThis.Error)=> + errConstructor= undefined, + options= undefined)=> { - const reason= makeError(optDetails, ErrorConstructor); + const reason= makeError(optDetails, errConstructor, options); if( optRaise!== undefined) { + // @ts-ignore returns `never` doesn't mean it isn't callable optRaise(reason); } throw reason; }; freeze(fail); - /** @type {FailTag} */ + /** @type {AssertionUtilities['Fail']} */ const Fail= (template, ...args)=> fail(details(template, ...args)); // Don't freeze or export `baseAssert` until we add methods. @@ -1791,27 +1679,30 @@ const makeAssert= (optRaise= undefined, unredacted= false)=> { function baseAssert( flag, optDetails= undefined, - ErrorConstructor= undefined) + errConstructor= undefined, + options= undefined) { - flag|| fail(optDetails, ErrorConstructor); + flag|| fail(optDetails, errConstructor, options); } - /** @type {AssertEqual} */ + /** @type {AssertionFunctions['equal']} */ const equal= ( actual, expected, optDetails= undefined, - ErrorConstructor= undefined)=> + errConstructor= undefined, + options= undefined)=> { is(actual, expected)|| fail( optDetails|| details `Expected ${actual} is same as ${expected}`, - ErrorConstructor|| RangeError); + errConstructor|| RangeError, + options); }; freeze(equal); - /** @type {AssertTypeof} */ + /** @type {AssertionFunctions['typeof']} */ const assertTypeof= (specimen, typename, optDetails)=> { // This will safely fall through if typename is not a string, // which is what we want. @@ -1830,7 +1721,7 @@ const makeAssert= (optRaise= undefined, unredacted= false)=> { }; freeze(assertTypeof); - /** @type {AssertString} */ + /** @type {AssertionFunctions['string']} */ const assertString= (specimen, optDetails= undefined)=> assertTypeof(specimen, 'string', optDetails); @@ -1858,8 +1749,8 @@ freeze(makeAssert); const assert= makeAssert();$h‍_once.assert(assert); })() , -// === functors[9] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Set,String,TypeError,WeakMap,WeakSet,globalThis,apply,arrayForEach,defineProperty,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,getPrototypeOf,isInteger,isObject,objectHasOwnProperty,ownKeys,preventExtensions,setAdd,setForEach,setHas,toStringTagSymbol,typedArrayPrototype,weakmapGet,weakmapSet,weaksetAdd,weaksetHas,assert;$h‍_imports([["./commons.js", [["Set", [$h‍_a => (Set = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["arrayForEach", [$h‍_a => (arrayForEach = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["isInteger", [$h‍_a => (isInteger = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["preventExtensions", [$h‍_a => (preventExtensions = $h‍_a)]],["setAdd", [$h‍_a => (setAdd = $h‍_a)]],["setForEach", [$h‍_a => (setForEach = $h‍_a)]],["setHas", [$h‍_a => (setHas = $h‍_a)]],["toStringTagSymbol", [$h‍_a => (toStringTagSymbol = $h‍_a)]],["typedArrayPrototype", [$h‍_a => (typedArrayPrototype = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]],["weaksetAdd", [$h‍_a => (weaksetAdd = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); +// === functors[10] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let Set,String,TypeError,WeakSet,globalThis,apply,arrayForEach,defineProperty,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,getPrototypeOf,isInteger,isObject,objectHasOwnProperty,ownKeys,preventExtensions,setAdd,setForEach,setHas,toStringTagSymbol,typedArrayPrototype,weaksetAdd,weaksetHas,FERAL_STACK_GETTER,FERAL_STACK_SETTER,isError,assert;$h‍_imports([["./commons.js", [["Set", [$h‍_a => (Set = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["arrayForEach", [$h‍_a => (arrayForEach = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["isInteger", [$h‍_a => (isInteger = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["preventExtensions", [$h‍_a => (preventExtensions = $h‍_a)]],["setAdd", [$h‍_a => (setAdd = $h‍_a)]],["setForEach", [$h‍_a => (setForEach = $h‍_a)]],["setHas", [$h‍_a => (setHas = $h‍_a)]],["toStringTagSymbol", [$h‍_a => (toStringTagSymbol = $h‍_a)]],["typedArrayPrototype", [$h‍_a => (typedArrayPrototype = $h‍_a)]],["weaksetAdd", [$h‍_a => (weaksetAdd = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]],["FERAL_STACK_GETTER", [$h‍_a => (FERAL_STACK_GETTER = $h‍_a)]],["FERAL_STACK_SETTER", [$h‍_a => (FERAL_STACK_SETTER = $h‍_a)]],["isError", [$h‍_a => (isError = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); @@ -1914,7 +1805,7 @@ const assert= makeAssert();$h‍_once.assert(assert); /** - * @typedef {import('../types.js').Harden} Harden + * @import {Harden} from '../types.js' */ // Obtain the string tag accessor of of TypedArray so we can indirectly use the @@ -2005,15 +1896,13 @@ const makeHardener= ()=> { */ harden(root) { const toFreeze= new Set(); - const paths= new WeakMap(); // If val is something we should be freezing but aren't yet, // add it to toFreeze. /** * @param {any} val - * @param {string} [path] */ - function enqueue(val, path= undefined) { + function enqueue(val) { if( !isObject(val)) { // ignore primitives return; @@ -2029,13 +1918,12 @@ const makeHardener= ()=> { } // console.warn(`adding ${val} to toFreeze`, val); setAdd(toFreeze, val); - weakmapSet(paths, val, path); } /** * @param {any} obj */ - function freezeAndTraverse(obj) { + const baseFreezeAndTraverse= (obj)=>{ // Now freeze the object to ensure reactive // objects such as proxies won't add properties // during traversal, before they get frozen. @@ -2054,13 +1942,11 @@ const makeHardener= ()=> { // get stable/immutable outbound links before a Proxy has a chance to do // something sneaky. - const path= weakmapGet(paths, obj)|| 'unknown'; const descs= getOwnPropertyDescriptors(obj); const proto= getPrototypeOf(obj); - enqueue(proto, `${path}.__proto__`); + enqueue(proto); arrayForEach(ownKeys(descs), (/** @type {string | symbol} */ name)=> { - const pathname= `${path}.${String(name)}`; // The 'name' may be a symbol, and TypeScript doesn't like us to // index arbitrary symbols on objects, so we pretend they're just // strings. @@ -2073,27 +1959,60 @@ const makeHardener= ()=> { // whether 'value' is present or not, which tells us for sure that // this is a data property. if( objectHasOwnProperty(desc, 'value')) { - enqueue(desc.value, `${pathname}`); + enqueue(desc.value); }else { - enqueue(desc.get, `${pathname}(get)`); - enqueue(desc.set, `${pathname}(set)`); + enqueue(desc.get); + enqueue(desc.set); } }); - } + }; - function dequeue() { + const freezeAndTraverse= + FERAL_STACK_GETTER=== undefined&& FERAL_STACK_SETTER=== undefined? + // On platforms without v8's error own stack accessor problem, + // don't pay for any extra overhead. + baseFreezeAndTraverse: + (obj)=>{ + if( isError(obj)) { + // Only pay the overhead if it first passes this cheap isError + // check. Otherwise, it will be unrepaired, but won't be judged + // to be a passable error anyway, so will not be unsafe. + const stackDesc= getOwnPropertyDescriptor(obj, 'stack'); + if( + stackDesc&& + stackDesc.get=== FERAL_STACK_GETTER&& + stackDesc.configurable) + { + // Can only repair if it is configurable. Otherwise, leave + // unrepaired, in which case it will not be judged passable, + // avoiding a safety problem. + defineProperty(obj, 'stack', { + // NOTE: Calls getter during harden, which seems dangerous. + // But we're only calling the problematic getter whose + // hazards we think we understand. + // @ts-expect-error TS should know FERAL_STACK_GETTER + // cannot be `undefined` here. + // See https://github.com/endojs/endo/pull/2232#discussion_r1575179471 + value: apply(FERAL_STACK_GETTER, obj, [])}); + + } + } + return baseFreezeAndTraverse(obj); + }; + + const dequeue= ()=> { // New values added before forEach() has finished will be visited. setForEach(toFreeze, freezeAndTraverse); - } + }; /** @param {any} value */ - function markHardened(value) { + const markHardened= (value)=>{ weaksetAdd(hardened, value); - } + }; - function commit() { + const commit= ()=> { setForEach(toFreeze, markHardened); - } + }; enqueue(root); dequeue(); @@ -2108,8 +2027,14 @@ const makeHardener= ()=> { };$h‍_once.makeHardener(makeHardener); })() , -// === functors[10] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([]); /* eslint-disable no-restricted-globals */ +// === functors[11] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let arrayPush;$h‍_imports([["./commons.js", [["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]]]]]); + + + + +/** @import {GenericErrorConstructor} from '../types.js' */ + /** * @file Exports {@code whitelist}, a recursively defined * JSON record enumerating all intrinsics and their properties @@ -2119,8 +2044,6 @@ const makeHardener= ()=> { * @author Mark S. Miller */ -/* eslint max-lines: 0 */ - /** * constantProperties * non-configurable, non-writable data properties of all global objects. @@ -2164,6 +2087,8 @@ const universalPropertyNames= { Boolean: 'Boolean', DataView: 'DataView', EvalError: 'EvalError', + // https://github.com/tc39/proposal-float16array + Float16Array: 'Float16Array', Float32Array: 'Float32Array', Float64Array: 'Float64Array', Int8Array: 'Int8Array', @@ -2191,6 +2116,8 @@ const universalPropertyNames= { Iterator: 'Iterator', // https://github.com/tc39/proposal-async-iterator-helpers AsyncIterator: 'AsyncIterator', + // https://github.com/endojs/endo/issues/550 + AggregateError: 'AggregateError', // *** Other Properties of the Global Object @@ -2294,14 +2221,25 @@ const uniqueGlobalPropertyNames= { // All the "subclasses" of Error. These are collectively represented in the // ECMAScript spec by the meta variable NativeError. -// TODO Add AggregateError https://github.com/Agoric/SES-shim/issues/550 -$h‍_once.uniqueGlobalPropertyNames(uniqueGlobalPropertyNames);const NativeErrors=[ +/** @type {GenericErrorConstructor[]} */$h‍_once.uniqueGlobalPropertyNames(uniqueGlobalPropertyNames); +const NativeErrors= [ EvalError, RangeError, ReferenceError, SyntaxError, TypeError, - URIError]; + URIError + // https://github.com/endojs/endo/issues/550 + // Commented out to accommodate platforms prior to AggregateError. + // Instead, conditional push below. + // AggregateError, +];$h‍_once.NativeErrors(NativeErrors); + +if( typeof AggregateError!== 'undefined') { + // Conditional, to accommodate platforms prior to AggregateError + arrayPush(NativeErrors, AggregateError); + } + /** @@ -2351,7 +2289,7 @@ $h‍_once.uniqueGlobalPropertyNames(uniqueGlobalPropertyNames);const NativeErro */ // Function Instances -$h‍_once.NativeErrors(NativeErrors);const FunctionInstance={ +const FunctionInstance= { '[[Proto]]': '%FunctionPrototype%', length: 'number', name: 'string' @@ -2492,7 +2430,9 @@ const CommonMath= { // See https://github.com/Moddable-OpenSource/moddable/issues/523 irem: false, // See https://github.com/Moddable-OpenSource/moddable/issues/523 - mod: false}; + mod: false, + // See https://github.com/Moddable-OpenSource/moddable/issues/523#issuecomment-1942904505 + irandom: false}; const permitted= { @@ -2553,7 +2493,9 @@ const permitted= { setPrototypeOf: fn, values: fn, // https://github.com/tc39/proposal-array-grouping - groupBy: fn}, + groupBy: fn, + // Seen on QuickJS + __getClass: false}, '%ObjectPrototype%': { @@ -2599,7 +2541,11 @@ const permitted= { // proposed but not yet std. To be removed if there caller: false, // proposed but not yet std. To be removed if there - arguments: false}, + arguments: false, + // Seen on QuickJS. TODO grab getter for use by console + fileName: false, + // Seen on QuickJS. TODO grab getter for use by console + lineNumber: false}, Boolean: { @@ -2638,7 +2584,9 @@ const permitted= { // Seen at core-js https://github.com/zloirock/core-js#ecmascript-symbol useSimple: false, // Seen at core-js https://github.com/zloirock/core-js#ecmascript-symbol - useSetter: false}, + useSetter: false, + // Seen on QuickJS + operatorSet: false}, '%SymbolPrototype%': { @@ -2698,6 +2646,8 @@ const permitted= { SyntaxError: NativeError('%SyntaxErrorPrototype%'), TypeError: NativeError('%TypeErrorPrototype%'), URIError: NativeError('%URIErrorPrototype%'), + // https://github.com/endojs/endo/issues/550 + AggregateError: NativeError('%AggregateErrorPrototype%'), '%EvalErrorPrototype%': NativeErrorPrototype('EvalError'), '%RangeErrorPrototype%': NativeErrorPrototype('RangeError'), @@ -2705,6 +2655,8 @@ const permitted= { '%SyntaxErrorPrototype%': NativeErrorPrototype('SyntaxError'), '%TypeErrorPrototype%': NativeErrorPrototype('TypeError'), '%URIErrorPrototype%': NativeErrorPrototype('URIError'), + // https://github.com/endojs/endo/issues/550 + '%AggregateErrorPrototype%': NativeErrorPrototype('AggregateError'), // *** Numbers and Dates @@ -2748,7 +2700,31 @@ const permitted= { // See https://github.com/Moddable-OpenSource/moddable/issues/523 bitLength: false, // See https://github.com/Moddable-OpenSource/moddable/issues/523 - fromArrayBuffer: false}, + fromArrayBuffer: false, + // Seen on QuickJS + tdiv: false, + // Seen on QuickJS + fdiv: false, + // Seen on QuickJS + cdiv: false, + // Seen on QuickJS + ediv: false, + // Seen on QuickJS + tdivrem: false, + // Seen on QuickJS + fdivrem: false, + // Seen on QuickJS + cdivrem: false, + // Seen on QuickJS + edivrem: false, + // Seen on QuickJS + sqrt: false, + // Seen on QuickJS + sqrtrem: false, + // Seen on QuickJS + floorLog2: false, + // Seen on QuickJS + ctz: false}, '%BigIntPrototype%': { @@ -2916,7 +2892,9 @@ const permitted= { // https://github.com/tc39/proposal-is-usv-string isWellFormed: fn, toWellFormed: fn, - unicodeSets: fn}, + unicodeSets: fn, + // Seen on QuickJS + __quote: false}, '%StringIteratorPrototype%': { @@ -3156,6 +3134,8 @@ const permitted= { BigInt64Array: TypedArray('%BigInt64ArrayPrototype%'), BigUint64Array: TypedArray('%BigUint64ArrayPrototype%'), + // https://github.com/tc39/proposal-float16array + Float16Array: TypedArray('%Float16ArrayPrototype%'), Float32Array: TypedArray('%Float32ArrayPrototype%'), Float64Array: TypedArray('%Float64ArrayPrototype%'), Int16Array: TypedArray('%Int16ArrayPrototype%'), @@ -3168,6 +3148,8 @@ const permitted= { '%BigInt64ArrayPrototype%': TypedArrayPrototype('BigInt64Array'), '%BigUint64ArrayPrototype%': TypedArrayPrototype('BigUint64Array'), + // https://github.com/tc39/proposal-float16array + '%Float16ArrayPrototype%': TypedArrayPrototype('Float16Array'), '%Float32ArrayPrototype%': TypedArrayPrototype('Float32Array'), '%Float64ArrayPrototype%': TypedArrayPrototype('Float64Array'), '%Int16ArrayPrototype%': TypedArrayPrototype('Int16Array'), @@ -3216,7 +3198,9 @@ const permitted= { // Properties of the Set Constructor '[[Proto]]': '%FunctionPrototype%', prototype: '%SetPrototype%', - '@@species': getter}, + '@@species': getter, + // Seen on QuickJS + groupBy: false}, '%SetPrototype%': { @@ -3231,7 +3215,21 @@ const permitted= { size: getter, values: fn, '@@iterator': fn, - '@@toStringTag': 'string'}, + '@@toStringTag': 'string', + // See https://github.com/tc39/proposal-set-methods + intersection: fn, + // See https://github.com/tc39/proposal-set-methods + union: fn, + // See https://github.com/tc39/proposal-set-methods + difference: fn, + // See https://github.com/tc39/proposal-set-methods + symmetricDifference: fn, + // See https://github.com/tc39/proposal-set-methods + isSubsetOf: fn, + // See https://github.com/tc39/proposal-set-methods + isSupersetOf: fn, + // See https://github.com/tc39/proposal-set-methods + isDisjointFrom: fn}, '%SetIteratorPrototype%': { @@ -3319,6 +3317,8 @@ const permitted= { constructor: 'DataView', getBigInt64: fn, getBigUint64: fn, + // https://github.com/tc39/proposal-float16array + getFloat16: fn, getFloat32: fn, getFloat64: fn, getInt8: fn, @@ -3329,6 +3329,8 @@ const permitted= { getUint32: fn, setBigInt64: fn, setBigUint64: fn, + // https://github.com/tc39/proposal-float16array + setFloat16: fn, setFloat32: fn, setFloat64: fn, setInt8: fn, @@ -3380,7 +3382,9 @@ const permitted= { find: fn, '@@toStringTag': 'string', // https://github.com/tc39/proposal-async-iterator-helpers - toAsync: fn}, + toAsync: fn, + // See https://github.com/Moddable-OpenSource/moddable/issues/523#issuecomment-1942904505 + '@@dispose': false}, // https://github.com/tc39/proposal-iterator-helpers @@ -3422,7 +3426,9 @@ const permitted= { some: fn, every: fn, find: fn, - '@@toStringTag': 'string'}, + '@@toStringTag': 'string', + // See https://github.com/Moddable-OpenSource/moddable/issues/523#issuecomment-1942904505 + '@@asyncDispose': false}, // https://github.com/tc39/proposal-async-iterator-helpers @@ -3518,9 +3524,8 @@ const permitted= { '[[Proto]]': '%FunctionPrototype%', all: fn, allSettled: fn, - // To transition from `false` to `fn` once we also have `AggregateError` - // TODO https://github.com/Agoric/SES-shim/issues/550 - any: false, // ES2021 + // https://github.com/Agoric/SES-shim/issues/550 + any: fn, prototype: '%PromisePrototype%', race: fn, reject: fn, @@ -3613,12 +3618,11 @@ const permitted= { evaluate: fn, globalThis: getter, name: getter, - // Should this be proposed? - toString: fn, import: asyncFn, load: asyncFn, importNow: fn, - module: fn}, + module: fn, + '@@toStringTag': 'string'}, lockdown: fn, @@ -3627,8 +3631,8 @@ const permitted= { '%InitialGetStackString%': fn};$h‍_once.permitted(permitted); })() , -// === functors[11] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let TypeError,WeakSet,arrayFilter,create,defineProperty,entries,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,globalThis,is,isObject,objectHasOwnProperty,values,weaksetHas,constantProperties,sharedGlobalPropertyNames,universalPropertyNames,permitted;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["values", [$h‍_a => (values = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]],["./permits.js", [["constantProperties", [$h‍_a => (constantProperties = $h‍_a)]],["sharedGlobalPropertyNames", [$h‍_a => (sharedGlobalPropertyNames = $h‍_a)]],["universalPropertyNames", [$h‍_a => (universalPropertyNames = $h‍_a)]],["permitted", [$h‍_a => (permitted = $h‍_a)]]]]]); +// === functors[12] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let TypeError,WeakSet,arrayFilter,create,defineProperty,entries,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,globalThis,is,isObject,objectHasOwnProperty,values,weaksetHas,constantProperties,sharedGlobalPropertyNames,universalPropertyNames,permitted;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["values", [$h‍_a => (values = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]],["./permits.js", [["constantProperties", [$h‍_a => (constantProperties = $h‍_a)]],["sharedGlobalPropertyNames", [$h‍_a => (sharedGlobalPropertyNames = $h‍_a)]],["universalPropertyNames", [$h‍_a => (universalPropertyNames = $h‍_a)]],["permitted", [$h‍_a => (permitted = $h‍_a)]]]]]); @@ -3804,8 +3808,8 @@ const getGlobalIntrinsics= (globalObject)=>{ };$h‍_once.getGlobalIntrinsics(getGlobalIntrinsics); })() , -// === functors[12] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let permitted,FunctionInstance,isAccessorPermit,Map,String,Symbol,TypeError,arrayFilter,arrayIncludes,arrayMap,entries,getOwnPropertyDescriptor,getPrototypeOf,isObject,mapGet,objectHasOwnProperty,ownKeys,symbolKeyFor;$h‍_imports([["./permits.js", [["permitted", [$h‍_a => (permitted = $h‍_a)]],["FunctionInstance", [$h‍_a => (FunctionInstance = $h‍_a)]],["isAccessorPermit", [$h‍_a => (isAccessorPermit = $h‍_a)]]]],["./commons.js", [["Map", [$h‍_a => (Map = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["Symbol", [$h‍_a => (Symbol = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["arrayIncludes", [$h‍_a => (arrayIncludes = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["symbolKeyFor", [$h‍_a => (symbolKeyFor = $h‍_a)]]]]]); +// === functors[13] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let permitted,FunctionInstance,isAccessorPermit,Map,String,Symbol,TypeError,arrayFilter,arrayIncludes,arrayMap,entries,getOwnPropertyDescriptor,getPrototypeOf,isObject,mapGet,objectHasOwnProperty,ownKeys,symbolKeyFor;$h‍_imports([["./permits.js", [["permitted", [$h‍_a => (permitted = $h‍_a)]],["FunctionInstance", [$h‍_a => (FunctionInstance = $h‍_a)]],["isAccessorPermit", [$h‍_a => (isAccessorPermit = $h‍_a)]]]],["./commons.js", [["Map", [$h‍_a => (Map = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["Symbol", [$h‍_a => (Symbol = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["arrayIncludes", [$h‍_a => (arrayIncludes = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["symbolKeyFor", [$h‍_a => (symbolKeyFor = $h‍_a)]]]]]); @@ -3881,7 +3885,18 @@ function whitelistIntrinsics( intrinsics, markVirtualizedNativeFunction) { - // These primitives are allowed allowed for permits. + let groupStarted= false; + const inConsoleGroup= (level, ...args)=> { + if( !groupStarted) { + // eslint-disable-next-line @endo/no-polymorphic-call + console.groupCollapsed('Removing unpermitted intrinsics'); + groupStarted= true; + } + // eslint-disable-next-line @endo/no-polymorphic-call + return console[level](...args); + }; + + // These primitives are allowed for permits. const primitives= ['undefined', 'boolean', 'number', 'string', 'symbol']; // These symbols are allowed as well-known symbols @@ -4086,11 +4101,7 @@ function whitelistIntrinsics( // that we are removing it so we know to look into it, as happens when // the language evolves new features to existing intrinsics. if( subPermit!== false) { - // This call to `console.warn` is intentional. It is not a vestige of - // a debugging attempt. See the comment at top of file for an - // explanation. - // eslint-disable-next-line @endo/no-polymorphic-call - console.warn( `Removing ${subPath}`); + inConsoleGroup('warn', `Removing ${subPath}`); } try { delete obj[prop]; @@ -4099,17 +4110,17 @@ function whitelistIntrinsics( if( typeof obj=== 'function'&& prop=== 'prototype') { obj.prototype= undefined; if( obj.prototype=== undefined) { - // eslint-disable-next-line @endo/no-polymorphic-call - console.warn( `Tolerating undeletable ${subPath} === undefined`); + inConsoleGroup( + 'warn', + `Tolerating undeletable ${subPath} === undefined`); + // eslint-disable-next-line no-continue continue; } } - // eslint-disable-next-line @endo/no-polymorphic-call - console.error( `failed to delete ${subPath}`,err); + inConsoleGroup('error', `failed to delete ${subPath}`,err); }else { - // eslint-disable-next-line @endo/no-polymorphic-call - console.error( `deleting ${subPath} threw`,err); + inConsoleGroup('error', `deleting ${subPath} threw`,err); } throw err; } @@ -4117,14 +4128,21 @@ function whitelistIntrinsics( } } - // Start path with 'intrinsics' to clarify that properties are not - // removed from the global object by the whitelisting operation. - visitProperties('intrinsics', intrinsics, permitted); + try { + // Start path with 'intrinsics' to clarify that properties are not + // removed from the global object by the whitelisting operation. + visitProperties('intrinsics', intrinsics, permitted); + }finally { + if( groupStarted) { + // eslint-disable-next-line @endo/no-polymorphic-call + console.groupEnd(); + } + } }$h‍_once.default( whitelistIntrinsics); })() , -// === functors[13] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_FUNCTION,SyntaxError,TypeError,defineProperties,getPrototypeOf,setPrototypeOf,freeze;$h‍_imports([["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["SyntaxError", [$h‍_a => (SyntaxError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["setPrototypeOf", [$h‍_a => (setPrototypeOf = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]]]); +// === functors[14] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let FERAL_FUNCTION,SyntaxError,TypeError,defineProperties,getPrototypeOf,setPrototypeOf,freeze;$h‍_imports([["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["SyntaxError", [$h‍_a => (SyntaxError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["setPrototypeOf", [$h‍_a => (setPrototypeOf = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]]]); @@ -4262,8 +4280,8 @@ function tameFunctionConstructors() { }$h‍_once.default( tameFunctionConstructors); })() , -// === functors[14] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Date,TypeError,apply,construct,defineProperties;$h‍_imports([["./commons.js", [["Date", [$h‍_a => (Date = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["construct", [$h‍_a => (construct = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]]]]]); +// === functors[15] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let Date,TypeError,apply,construct,defineProperties;$h‍_imports([["./commons.js", [["Date", [$h‍_a => (Date = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["construct", [$h‍_a => (construct = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]]]]]); @@ -4395,8 +4413,8 @@ function tameDateConstructor(dateTaming= 'safe') { }$h‍_once.default( tameDateConstructor); })() , -// === functors[15] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Math,TypeError,create,getOwnPropertyDescriptors,objectPrototype;$h‍_imports([["./commons.js", [["Math", [$h‍_a => (Math = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["objectPrototype", [$h‍_a => (objectPrototype = $h‍_a)]]]]]); +// === functors[16] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let Math,TypeError,create,getOwnPropertyDescriptors,objectPrototype;$h‍_imports([["./commons.js", [["Math", [$h‍_a => (Math = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["objectPrototype", [$h‍_a => (objectPrototype = $h‍_a)]]]]]); @@ -4442,8 +4460,8 @@ function tameMathObject(mathTaming= 'safe') { }$h‍_once.default( tameMathObject); })() , -// === functors[16] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_REG_EXP,TypeError,construct,defineProperties,getOwnPropertyDescriptor,speciesSymbol;$h‍_imports([["./commons.js", [["FERAL_REG_EXP", [$h‍_a => (FERAL_REG_EXP = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["construct", [$h‍_a => (construct = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["speciesSymbol", [$h‍_a => (speciesSymbol = $h‍_a)]]]]]); +// === functors[17] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let FERAL_REG_EXP,TypeError,construct,defineProperties,getOwnPropertyDescriptor,speciesSymbol;$h‍_imports([["./commons.js", [["FERAL_REG_EXP", [$h‍_a => (FERAL_REG_EXP = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["construct", [$h‍_a => (construct = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["speciesSymbol", [$h‍_a => (speciesSymbol = $h‍_a)]]]]]); @@ -4470,21 +4488,28 @@ function tameRegExpConstructor(regExpTaming= 'safe') { return construct(FERAL_REG_EXP, rest, new.target); }; - const speciesDesc= getOwnPropertyDescriptor(FERAL_REG_EXP, speciesSymbol); - if( !speciesDesc) { - throw TypeError('no RegExp[Symbol.species] descriptor'); - } - defineProperties(ResultRegExp, { length: { value: 2}, prototype: { value: RegExpPrototype, writable: false, enumerable: false, - configurable: false}, + configurable: false}}); - [speciesSymbol]: speciesDesc}); + // Hermes does not have `Symbol.species`. We should support such platforms. + if( speciesSymbol) { + const speciesDesc= getOwnPropertyDescriptor( + FERAL_REG_EXP, + speciesSymbol); + + if( !speciesDesc) { + throw TypeError('no RegExp[Symbol.species] descriptor'); + } + defineProperties(ResultRegExp, { + [speciesSymbol]: speciesDesc}); + + } return ResultRegExp; }; @@ -4506,8 +4531,10 @@ function tameRegExpConstructor(regExpTaming= 'safe') { }$h‍_once.default( tameRegExpConstructor); })() , -// === functors[17] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([]); /** +// === functors[18] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let toStringTagSymbol,iteratorSymbol;$h‍_imports([["./commons.js", [["toStringTagSymbol", [$h‍_a => (toStringTagSymbol = $h‍_a)]],["iteratorSymbol", [$h‍_a => (iteratorSymbol = $h‍_a)]]]]]); + +/** * @file Exports {@code enablements}, a recursively defined * JSON record defining the optimum set of intrinsics properties * that need to be "repaired" before hardening is applied on @@ -4582,7 +4609,14 @@ const minEnablements= { '%ErrorPrototype%': { name: true // set by "precond", "ava", "node-fetch" -}}; +}, + '%IteratorPrototype%': { + toString: true, + // https://github.com/tc39/proposal-iterator-helpers + constructor: true, + // https://github.com/tc39/proposal-iterator-helpers + [toStringTagSymbol]: true}}; + /** @@ -4596,7 +4630,9 @@ const moderateEnablements= { '%ArrayPrototype%': { toString: true, - push: true // set by "Google Analytics" + push: true, // set by "Google Analytics" + concat: true, // set by mobx generated code (old TS compiler?) + [iteratorSymbol]: true // set by mobx generated code (old TS compiler?) }, // Function.prototype has no 'prototype' property to enable. @@ -4647,6 +4683,12 @@ const moderateEnablements= { name: true // set by "node 14" }, + // https://github.com/endojs/endo/issues/550 + '%AggregateErrorPrototype%': { + message: true, // to match TypeErrorPrototype.message + name: true // set by "node 14"? +}, + '%PromisePrototype%': { constructor: true // set by "core-js" }, @@ -4660,7 +4702,11 @@ const moderateEnablements= { '%IteratorPrototype%': { - toString: true}}; + toString: true, + // https://github.com/tc39/proposal-iterator-helpers + constructor: true, + // https://github.com/tc39/proposal-iterator-helpers + [toStringTagSymbol]: true}}; @@ -4729,9 +4775,8 @@ const severeEnablements= { '%SetPrototype%': '*'};$h‍_once.severeEnablements(severeEnablements); })() , -// === functors[18] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Set,String,TypeError,arrayForEach,defineProperty,getOwnPropertyDescriptor,getOwnPropertyDescriptors,getOwnPropertyNames,isObject,objectHasOwnProperty,ownKeys,setHas,minEnablements,moderateEnablements,severeEnablements;$h‍_imports([["./commons.js", [["Set", [$h‍_a => (Set = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayForEach", [$h‍_a => (arrayForEach = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["getOwnPropertyNames", [$h‍_a => (getOwnPropertyNames = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["setHas", [$h‍_a => (setHas = $h‍_a)]]]],["./enablements.js", [["minEnablements", [$h‍_a => (minEnablements = $h‍_a)]],["moderateEnablements", [$h‍_a => (moderateEnablements = $h‍_a)]],["severeEnablements", [$h‍_a => (severeEnablements = $h‍_a)]]]]]); - +// === functors[19] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let Set,String,TypeError,arrayForEach,defineProperty,getOwnPropertyDescriptor,getOwnPropertyDescriptors,isObject,objectHasOwnProperty,ownKeys,setHas,minEnablements,moderateEnablements,severeEnablements;$h‍_imports([["./commons.js", [["Set", [$h‍_a => (Set = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayForEach", [$h‍_a => (arrayForEach = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["setHas", [$h‍_a => (setHas = $h‍_a)]]]],["./enablements.js", [["minEnablements", [$h‍_a => (minEnablements = $h‍_a)]],["moderateEnablements", [$h‍_a => (moderateEnablements = $h‍_a)]],["severeEnablements", [$h‍_a => (severeEnablements = $h‍_a)]]]]]); @@ -4820,9 +4865,43 @@ function enablePropertyOverrides( if( 'value'in desc&& desc.configurable) { const { value}= desc; - function getter() { - return value; - } + const isDebug= setHas(debugProperties, prop); + + // We use concise method syntax to be `this` sensitive, but still + // omit a prototype property or [[Construct]] behavior. + // @ts-expect-error We know there is an accessor descriptor there + const { get: getter, set: setter}= getOwnPropertyDescriptor( + { + get[ prop]() { + return value; + }, + set[ prop](newValue) { + if( obj=== this) { + throw TypeError( + `Cannot assign to read only property '${String( + prop) + }' of '${path}'`); + + } + if( objectHasOwnProperty(this, prop)) { + this[prop]= newValue; + }else { + if( isDebug) { + // eslint-disable-next-line @endo/no-polymorphic-call + console.error(TypeError( `Override property ${prop}`)); + } + defineProperty(this, prop, { + value: newValue, + writable: true, + enumerable: true, + configurable: true}); + + } + }}, + + prop); + + defineProperty(getter, 'originalValue', { value, writable: false, @@ -4830,32 +4909,6 @@ function enablePropertyOverrides( configurable: false}); - const isDebug= setHas(debugProperties, prop); - - function setter(newValue) { - if( obj=== this) { - throw TypeError( - `Cannot assign to read only property '${String( - prop) - }' of '${path}'`); - - } - if( objectHasOwnProperty(this, prop)) { - this[prop]= newValue; - }else { - if( isDebug) { - // eslint-disable-next-line @endo/no-polymorphic-call - console.error(TypeError( `Override property ${prop}`)); - } - defineProperty(this, prop, { - value: newValue, - writable: true, - enumerable: true, - configurable: true}); - - } - } - defineProperty(obj, prop, { get: getter, set: setter, @@ -4880,12 +4933,11 @@ function enablePropertyOverrides( } // TypeScript does not allow symbols to be used as indexes because it // cannot recokon types of symbolized properties. - // @ts-ignore arrayForEach(ownKeys(descs), (prop)=>enable(path, obj, prop, descs[prop])); } function enableProperties(path, obj, plan) { - for( const prop of getOwnPropertyNames(plan)) { + for( const prop of ownKeys(plan)) { const desc= getOwnPropertyDescriptor(obj, prop); if( !desc|| desc.get|| desc.set) { // No not a value property, nothing to do. @@ -4893,10 +4945,8 @@ function enablePropertyOverrides( continue; } - // Plan has no symbol keys and we use getOwnPropertyNames() - // so `prop` cannot only be a string, not a symbol. We coerce it in place - // with `String(..)` anyway just as good hygiene, since these paths are just - // for diagnostic purposes. + // In case `prop` is a symbol, we first coerce it with `String`, + // purely for diagnostic purposes. const subPath= `${path}.${String(prop)}`; const subPlan= plan[prop]; @@ -4936,8 +4986,8 @@ function enablePropertyOverrides( }$h‍_once.default( enablePropertyOverrides); })() , -// === functors[19] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Number,String,TypeError,defineProperty,getOwnPropertyNames,isObject,regexpExec,assert;$h‍_imports([["./commons.js", [["Number", [$h‍_a => (Number = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["getOwnPropertyNames", [$h‍_a => (getOwnPropertyNames = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["regexpExec", [$h‍_a => (regexpExec = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); +// === functors[20] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let Number,String,TypeError,defineProperty,getOwnPropertyNames,isObject,regexpExec,assert;$h‍_imports([["./commons.js", [["Number", [$h‍_a => (Number = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["getOwnPropertyNames", [$h‍_a => (getOwnPropertyNames = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["regexpExec", [$h‍_a => (regexpExec = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); @@ -5020,8 +5070,8 @@ function tameLocaleMethods(intrinsics, localeTaming= 'safe') { }$h‍_once.default( tameLocaleMethods); })() , -// === functors[20] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([]); /** +// === functors[21] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; $h‍_imports([]); /** * makeEvalFunction() * A safe version of the native eval function which relies on * the safety of safeEvaluate for confinement. @@ -5029,7 +5079,7 @@ function tameLocaleMethods(intrinsics, localeTaming= 'safe') { * @param {Function} safeEvaluate */ const makeEvalFunction= (safeEvaluate)=>{ - // We use the the concise method syntax to create an eval without a + // We use the concise method syntax to create an eval without a // [[Construct]] behavior (such that the invocation "new eval()" throws // TypeError: eval is not a constructor"), but which still accepts a // 'this' binding. @@ -5050,8 +5100,8 @@ const makeEvalFunction= (safeEvaluate)=>{ };$h‍_once.makeEvalFunction(makeEvalFunction); })() , -// === functors[21] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_FUNCTION,arrayJoin,arrayPop,defineProperties,getPrototypeOf,assert;$h‍_imports([["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayPop", [$h‍_a => (arrayPop = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); +// === functors[22] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let FERAL_FUNCTION,arrayJoin,arrayPop,defineProperties,getPrototypeOf,assert;$h‍_imports([["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayPop", [$h‍_a => (arrayPop = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); @@ -5131,8 +5181,8 @@ const makeFunctionConstructor= (safeEvaluate)=>{ };$h‍_once.makeFunctionConstructor(makeFunctionConstructor); })() , -// === functors[22] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let TypeError,assign,create,defineProperty,entries,freeze,objectHasOwnProperty,unscopablesSymbol,makeEvalFunction,makeFunctionConstructor,constantProperties,universalPropertyNames;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["assign", [$h‍_a => (assign = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["unscopablesSymbol", [$h‍_a => (unscopablesSymbol = $h‍_a)]]]],["./make-eval-function.js", [["makeEvalFunction", [$h‍_a => (makeEvalFunction = $h‍_a)]]]],["./make-function-constructor.js", [["makeFunctionConstructor", [$h‍_a => (makeFunctionConstructor = $h‍_a)]]]],["./permits.js", [["constantProperties", [$h‍_a => (constantProperties = $h‍_a)]],["universalPropertyNames", [$h‍_a => (universalPropertyNames = $h‍_a)]]]]]); +// === functors[23] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let TypeError,assign,create,defineProperty,entries,freeze,objectHasOwnProperty,unscopablesSymbol,makeEvalFunction,makeFunctionConstructor,constantProperties,universalPropertyNames;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["assign", [$h‍_a => (assign = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["unscopablesSymbol", [$h‍_a => (unscopablesSymbol = $h‍_a)]]]],["./make-eval-function.js", [["makeEvalFunction", [$h‍_a => (makeEvalFunction = $h‍_a)]]]],["./make-function-constructor.js", [["makeFunctionConstructor", [$h‍_a => (makeFunctionConstructor = $h‍_a)]]]],["./permits.js", [["constantProperties", [$h‍_a => (constantProperties = $h‍_a)]],["universalPropertyNames", [$h‍_a => (universalPropertyNames = $h‍_a)]]]]]); @@ -5303,8 +5353,8 @@ const setGlobalObjectEvaluators= ( };$h‍_once.setGlobalObjectEvaluators(setGlobalObjectEvaluators); })() , -// === functors[23] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Proxy,String,TypeError,ReferenceError,create,freeze,getOwnPropertyDescriptors,globalThis,immutableObject,assert;$h‍_imports([["./commons.js", [["Proxy", [$h‍_a => (Proxy = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["immutableObject", [$h‍_a => (immutableObject = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); +// === functors[24] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let Proxy,String,TypeError,ReferenceError,create,freeze,getOwnPropertyDescriptors,globalThis,immutableObject,assert;$h‍_imports([["./commons.js", [["Proxy", [$h‍_a => (Proxy = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["immutableObject", [$h‍_a => (immutableObject = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); @@ -5398,8 +5448,8 @@ const strictScopeTerminator= new Proxy( strictScopeTerminatorHandler);$h‍_once.strictScopeTerminator(strictScopeTerminator); })() , -// === functors[24] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Proxy,create,freeze,getOwnPropertyDescriptors,immutableObject,reflectSet,strictScopeTerminatorHandler,alwaysThrowHandler;$h‍_imports([["./commons.js", [["Proxy", [$h‍_a => (Proxy = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["immutableObject", [$h‍_a => (immutableObject = $h‍_a)]],["reflectSet", [$h‍_a => (reflectSet = $h‍_a)]]]],["./strict-scope-terminator.js", [["strictScopeTerminatorHandler", [$h‍_a => (strictScopeTerminatorHandler = $h‍_a)]],["alwaysThrowHandler", [$h‍_a => (alwaysThrowHandler = $h‍_a)]]]]]); +// === functors[25] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let Proxy,create,freeze,getOwnPropertyDescriptors,immutableObject,reflectSet,strictScopeTerminatorHandler,alwaysThrowHandler;$h‍_imports([["./commons.js", [["Proxy", [$h‍_a => (Proxy = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["immutableObject", [$h‍_a => (immutableObject = $h‍_a)]],["reflectSet", [$h‍_a => (reflectSet = $h‍_a)]]]],["./strict-scope-terminator.js", [["strictScopeTerminatorHandler", [$h‍_a => (strictScopeTerminatorHandler = $h‍_a)]],["alwaysThrowHandler", [$h‍_a => (alwaysThrowHandler = $h‍_a)]]]]]); @@ -5455,8 +5505,8 @@ const createSloppyGlobalsScopeTerminator= (globalObject)=>{ freeze(createSloppyGlobalsScopeTerminator); })() , -// === functors[25] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_EVAL,create,defineProperties,freeze,assert;$h‍_imports([["./commons.js", [["FERAL_EVAL", [$h‍_a => (FERAL_EVAL = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); +// === functors[26] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let FERAL_EVAL,create,defineProperties,freeze,assert;$h‍_imports([["./commons.js", [["FERAL_EVAL", [$h‍_a => (FERAL_EVAL = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); @@ -5547,8 +5597,8 @@ const makeEvalScopeKit= ()=> { };$h‍_once.makeEvalScopeKit(makeEvalScopeKit); })() , -// === functors[26] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_REG_EXP,regexpExec,stringSlice;$h‍_imports([["./commons.js", [["FERAL_REG_EXP", [$h‍_a => (FERAL_REG_EXP = $h‍_a)]],["regexpExec", [$h‍_a => (regexpExec = $h‍_a)]],["stringSlice", [$h‍_a => (stringSlice = $h‍_a)]]]]]); +// === functors[27] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let FERAL_REG_EXP,regexpExec,stringSlice;$h‍_imports([["./commons.js", [["FERAL_REG_EXP", [$h‍_a => (FERAL_REG_EXP = $h‍_a)]],["regexpExec", [$h‍_a => (regexpExec = $h‍_a)]],["stringSlice", [$h‍_a => (stringSlice = $h‍_a)]]]]]); // Captures a key and value of the form #key=value or @key=value const sourceMetaEntryRegExp= @@ -5600,8 +5650,8 @@ const getSourceURL= (src)=>{ };$h‍_once.getSourceURL(getSourceURL); })() , -// === functors[27] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_REG_EXP,SyntaxError,stringReplace,stringSearch,stringSlice,stringSplit,freeze,getSourceURL;$h‍_imports([["./commons.js", [["FERAL_REG_EXP", [$h‍_a => (FERAL_REG_EXP = $h‍_a)]],["SyntaxError", [$h‍_a => (SyntaxError = $h‍_a)]],["stringReplace", [$h‍_a => (stringReplace = $h‍_a)]],["stringSearch", [$h‍_a => (stringSearch = $h‍_a)]],["stringSlice", [$h‍_a => (stringSlice = $h‍_a)]],["stringSplit", [$h‍_a => (stringSplit = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]],["./get-source-url.js", [["getSourceURL", [$h‍_a => (getSourceURL = $h‍_a)]]]]]); +// === functors[28] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let FERAL_REG_EXP,SyntaxError,stringReplace,stringSearch,stringSlice,stringSplit,freeze,getSourceURL;$h‍_imports([["./commons.js", [["FERAL_REG_EXP", [$h‍_a => (FERAL_REG_EXP = $h‍_a)]],["SyntaxError", [$h‍_a => (SyntaxError = $h‍_a)]],["stringReplace", [$h‍_a => (stringReplace = $h‍_a)]],["stringSearch", [$h‍_a => (stringSearch = $h‍_a)]],["stringSlice", [$h‍_a => (stringSlice = $h‍_a)]],["stringSplit", [$h‍_a => (stringSplit = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]],["./get-source-url.js", [["getSourceURL", [$h‍_a => (getSourceURL = $h‍_a)]]]]]); @@ -5868,8 +5918,8 @@ $h‍_once.applyTransforms(applyTransforms);const transforms=freeze({ applyTransforms: freeze(applyTransforms)});$h‍_once.transforms(transforms); })() , -// === functors[28] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let arrayFilter,arrayIncludes,getOwnPropertyDescriptor,getOwnPropertyNames,objectHasOwnProperty,regexpTest;$h‍_imports([["./commons.js", [["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["arrayIncludes", [$h‍_a => (arrayIncludes = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyNames", [$h‍_a => (getOwnPropertyNames = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["regexpTest", [$h‍_a => (regexpTest = $h‍_a)]]]]]); +// === functors[29] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let arrayFilter,arrayIncludes,getOwnPropertyDescriptor,getOwnPropertyNames,objectHasOwnProperty,regexpTest;$h‍_imports([["./commons.js", [["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["arrayIncludes", [$h‍_a => (arrayIncludes = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyNames", [$h‍_a => (getOwnPropertyNames = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["regexpTest", [$h‍_a => (regexpTest = $h‍_a)]]]]]); @@ -6051,8 +6101,8 @@ const getScopeConstants= (globalObject, moduleLexicals= {})=> { };$h‍_once.getScopeConstants(getScopeConstants); })() , -// === functors[29] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_FUNCTION,arrayJoin,apply,getScopeConstants;$h‍_imports([["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]]]],["./scope-constants.js", [["getScopeConstants", [$h‍_a => (getScopeConstants = $h‍_a)]]]]]); +// === functors[30] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let FERAL_FUNCTION,arrayJoin,apply,getScopeConstants;$h‍_imports([["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]]]],["./scope-constants.js", [["getScopeConstants", [$h‍_a => (getScopeConstants = $h‍_a)]]]]]); @@ -6164,8 +6214,8 @@ const makeEvaluate= (context)=>{ };$h‍_once.makeEvaluate(makeEvaluate); })() , -// === functors[30] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let apply,freeze,strictScopeTerminator,createSloppyGlobalsScopeTerminator,makeEvalScopeKit,applyTransforms,mandatoryTransforms,makeEvaluate,assert;$h‍_imports([["./commons.js", [["apply", [$h‍_a => (apply = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]],["./strict-scope-terminator.js", [["strictScopeTerminator", [$h‍_a => (strictScopeTerminator = $h‍_a)]]]],["./sloppy-globals-scope-terminator.js", [["createSloppyGlobalsScopeTerminator", [$h‍_a => (createSloppyGlobalsScopeTerminator = $h‍_a)]]]],["./eval-scope.js", [["makeEvalScopeKit", [$h‍_a => (makeEvalScopeKit = $h‍_a)]]]],["./transforms.js", [["applyTransforms", [$h‍_a => (applyTransforms = $h‍_a)]],["mandatoryTransforms", [$h‍_a => (mandatoryTransforms = $h‍_a)]]]],["./make-evaluate.js", [["makeEvaluate", [$h‍_a => (makeEvaluate = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); +// === functors[31] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let apply,freeze,strictScopeTerminator,createSloppyGlobalsScopeTerminator,makeEvalScopeKit,applyTransforms,mandatoryTransforms,makeEvaluate,assert;$h‍_imports([["./commons.js", [["apply", [$h‍_a => (apply = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]],["./strict-scope-terminator.js", [["strictScopeTerminator", [$h‍_a => (strictScopeTerminator = $h‍_a)]]]],["./sloppy-globals-scope-terminator.js", [["createSloppyGlobalsScopeTerminator", [$h‍_a => (createSloppyGlobalsScopeTerminator = $h‍_a)]]]],["./eval-scope.js", [["makeEvalScopeKit", [$h‍_a => (makeEvalScopeKit = $h‍_a)]]]],["./transforms.js", [["applyTransforms", [$h‍_a => (applyTransforms = $h‍_a)]],["mandatoryTransforms", [$h‍_a => (mandatoryTransforms = $h‍_a)]]]],["./make-evaluate.js", [["makeEvaluate", [$h‍_a => (makeEvaluate = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); @@ -6277,8 +6327,8 @@ const makeSafeEvaluator= ({ };$h‍_once.makeSafeEvaluator(makeSafeEvaluator); })() , -// === functors[31] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let WeakSet,defineProperty,freeze,functionPrototype,functionToString,stringEndsWith,weaksetAdd,weaksetHas;$h‍_imports([["./commons.js", [["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["functionPrototype", [$h‍_a => (functionPrototype = $h‍_a)]],["functionToString", [$h‍_a => (functionToString = $h‍_a)]],["stringEndsWith", [$h‍_a => (stringEndsWith = $h‍_a)]],["weaksetAdd", [$h‍_a => (weaksetAdd = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]]]); +// === functors[32] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let WeakSet,defineProperty,freeze,functionPrototype,functionToString,stringEndsWith,weaksetAdd,weaksetHas;$h‍_imports([["./commons.js", [["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["functionPrototype", [$h‍_a => (functionPrototype = $h‍_a)]],["functionToString", [$h‍_a => (functionToString = $h‍_a)]],["stringEndsWith", [$h‍_a => (stringEndsWith = $h‍_a)]],["weaksetAdd", [$h‍_a => (weaksetAdd = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]]]); @@ -6330,8 +6380,8 @@ const tameFunctionToString= ()=> { };$h‍_once.tameFunctionToString(tameFunctionToString); })() , -// === functors[32] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let TypeError,globalThis,getOwnPropertyDescriptor,defineProperty;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]]]]]);Object.defineProperty(tameDomains, 'name', {value: "tameDomains"});$h‍_once.tameDomains(tameDomains); +// === functors[33] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let TypeError,globalThis,getOwnPropertyDescriptor,defineProperty;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]]]]]);Object.defineProperty(tameDomains, 'name', {value: "tameDomains"});$h‍_once.tameDomains(tameDomains); @@ -6350,12 +6400,10 @@ function tameDomains(domainTaming= 'safe') { } // Protect against the hazard presented by Node.js domains. - if( typeof globalThis.process=== 'object'&& globalThis.process!== null) { + const globalProcess= globalThis.process|| undefined; + if( typeof globalProcess=== 'object') { // Check whether domains were initialized. - const domainDescriptor= getOwnPropertyDescriptor( - globalThis.process, - 'domain'); - + const domainDescriptor= getOwnPropertyDescriptor(globalProcess, 'domain'); if( domainDescriptor!== undefined&& domainDescriptor.get!== undefined) { // The domain descriptor on Node.js initially has value: null, which // becomes a get, set pair after domains initialize. @@ -6370,7 +6418,7 @@ function tameDomains(domainTaming= 'safe') { // The domain module merely throws an exception when it attempts to define // the domain property of the process global during its initialization. // We have no better recourse because Node.js uses defineProperty too. - defineProperty(globalThis.process, 'domain', { + defineProperty(globalProcess, 'domain', { value: null, configurable: false, writable: false, @@ -6380,8 +6428,12 @@ function tameDomains(domainTaming= 'safe') { } })() , -// === functors[33] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let WeakSet,arrayFilter,arrayMap,arrayPush,defineProperty,freeze,fromEntries,isError,stringEndsWith,weaksetAdd,weaksetHas;$h‍_imports([["../commons.js", [["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["fromEntries", [$h‍_a => (fromEntries = $h‍_a)]],["isError", [$h‍_a => (isError = $h‍_a)]],["stringEndsWith", [$h‍_a => (stringEndsWith = $h‍_a)]],["weaksetAdd", [$h‍_a => (weaksetAdd = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]],["./types.js", []],["./internal-types.js", []]]); +// === functors[34] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let WeakSet,arrayFilter,arrayFlatMap,arrayMap,arrayPop,arrayPush,defineProperty,freeze,fromEntries,isError,stringEndsWith,stringIncludes,stringSplit,weaksetAdd,weaksetHas;$h‍_imports([["../commons.js", [["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["arrayFlatMap", [$h‍_a => (arrayFlatMap = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arrayPop", [$h‍_a => (arrayPop = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["fromEntries", [$h‍_a => (fromEntries = $h‍_a)]],["isError", [$h‍_a => (isError = $h‍_a)]],["stringEndsWith", [$h‍_a => (stringEndsWith = $h‍_a)]],["stringIncludes", [$h‍_a => (stringIncludes = $h‍_a)]],["stringSplit", [$h‍_a => (stringSplit = $h‍_a)]],["weaksetAdd", [$h‍_a => (weaksetAdd = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]],["./types.js", []],["./internal-types.js", []]]); + + + + @@ -6429,8 +6481,17 @@ function tameDomains(domainTaming= 'safe') { /** @typedef {keyof VirtualConsole | 'profile' | 'profileEnd'} ConsoleProps */ -/** @type {readonly [ConsoleProps, LogSeverity | undefined][]} */ -const consoleLevelMethods= freeze([ +/** + * Those console methods whose actual parameters are `(fmt?, ...args)` + * even if their TypeScript types claim otherwise. + * + * Each is paired with what we consider to be their log severity level. + * This is the same as the log severity of these on other + * platform console implementations when they all agree. + * + * @type {readonly [ConsoleProps, LogSeverity | undefined][]} + */ +const consoleLevelMethods= freeze([ ['debug', 'debug'], // (fmt?, ...args) verbose level on Chrome ['log', 'log'], // (fmt?, ...args) info level on Chrome ['info', 'info'], // (fmt?, ...args) @@ -6438,13 +6499,22 @@ const consoleLevelMethods= freeze([ ['error', 'error'], // (fmt?, ...args) ['trace', 'log'], // (fmt?, ...args) - ['dirxml', 'log'], // (fmt?, ...args) - ['group', 'log'], // (fmt?, ...args) - ['groupCollapsed', 'log'] // (fmt?, ...args) + ['dirxml', 'log'], // (fmt?, ...args) but TS typed (...data) + ['group', 'log'], // (fmt?, ...args) but TS typed (...label) + ['groupCollapsed', 'log'] // (fmt?, ...args) but TS typed (...label) ]); -/** @type {readonly [ConsoleProps, LogSeverity | undefined][]} */ -const consoleOtherMethods= freeze([ +/** + * Those console methods other than those already enumerated by + * `consoleLevelMethods`. + * + * Each is paired with what we consider to be their log severity level. + * This is the same as the log severity of these on other + * platform console implementations when they all agree. + * + * @type {readonly [ConsoleProps, LogSeverity | undefined][]} + */$h‍_once.consoleLevelMethods(consoleLevelMethods); +const consoleOtherMethods= freeze([ ['assert', 'error'], // (value, fmt?, ...args) ['timeLog', 'log'], // (label?, ...args) no fmt string @@ -6467,8 +6537,8 @@ const consoleOtherMethods= freeze([ ['timeStamp', undefined] // (label?) ]); -/** @type {readonly [ConsoleProps, LogSeverity | undefined][]} */ -const consoleWhitelist= freeze([ +/** @type {readonly [ConsoleProps, LogSeverity | undefined][]} */$h‍_once.consoleOtherMethods(consoleOtherMethods); +const consoleWhitelist= freeze([ ...consoleLevelMethods, ...consoleOtherMethods]); @@ -6500,10 +6570,10 @@ const consoleWhitelist= freeze([ * ]); */ -// ///////////////////////////////////////////////////////////////////////////// +// //////////////////////////// Logging Console //////////////////////////////// -/** @type {MakeLoggingConsoleKit} */$h‍_once.consoleWhitelist(consoleWhitelist); -const makeLoggingConsoleKit= ( +/** @type {MakeLoggingConsoleKit} */ +const makeLoggingConsoleKit= ( loggedErrorHandler, { shouldResetForDebugging= false}= {})=> { @@ -6545,18 +6615,34 @@ const makeLoggingConsoleKit= ( };$h‍_once.makeLoggingConsoleKit(makeLoggingConsoleKit); freeze(makeLoggingConsoleKit); +/** + * Makes the same calls on a `baseConsole` that were made on a + * `loggingConsole` to produce this `log`. In this way, a logging console + * can be used as a buffer to delay the application of these calls to a + * `baseConsole`. + * + * @param {LogRecord[]} log + * @param {VirtualConsole} baseConsole + */ +const pumpLogToConsole= (log, baseConsole)=> { + for( const [name, ...args]of log) { + // eslint-disable-next-line @endo/no-polymorphic-call + baseConsole[name](...args); + } + }; +// //////////////////////////// Causal Console ///////////////////////////////// -// ///////////////////////////////////////////////////////////////////////////// - -/** @type {ErrorInfo} */ +/** @type {ErrorInfo} */$h‍_once.pumpLogToConsole(pumpLogToConsole); const ErrorInfo= { NOTE: 'ERROR_NOTE:', - MESSAGE: 'ERROR_MESSAGE:'}; + MESSAGE: 'ERROR_MESSAGE:', + CAUSE: 'cause:', + ERRORS: 'errors:'}; freeze(ErrorInfo); /** @type {MakeCausalConsole} */ -const makeCausalConsole= (baseConsole, loggedErrorHandler)=> { +const makeCausalConsole= (baseConsole, loggedErrorHandler)=> { if( !baseConsole) { return undefined; } @@ -6691,6 +6777,14 @@ const makeCausalConsole= (baseConsole, loggedErrorHandler)=> { // eslint-disable-next-line @endo/no-polymorphic-call baseConsole[severity](stackString); // Show the other annotations on error + if( error.cause) { + logErrorInfo(severity, error, ErrorInfo.CAUSE, [error.cause], subErrors); + } + // @ts-expect-error AggregateError has an `errors` property. + if( error.errors) { + // @ts-expect-error AggregateError has an `errors` property. + logErrorInfo(severity, error, ErrorInfo.ERRORS, error.errors, subErrors); + } for( const noteLogArgs of noteLogArgsArray) { logErrorInfo(severity, error, ErrorInfo.NOTE, noteLogArgs, subErrors); } @@ -6736,11 +6830,105 @@ const makeCausalConsole= (baseConsole, loggedErrorHandler)=> { };$h‍_once.makeCausalConsole(makeCausalConsole); freeze(makeCausalConsole); +/** + * @typedef {(...args: unknown[]) => void} Logger + */ + +/** + * This is a rather horrible kludge to indent the output to a logger in + * the case where some arguments are strings containing newlines. Part of + * the problem is that console-like loggers, including the one in ava, + * join the string arguments of the log message with a space. + * Because of this, there's an extra space at the beginning of each of + * the split lines. So this kludge compensated by putting an extra empty + * string at the beginning, so that the logger will add the same extra + * joiner. + * TODO: Fix this horrible kludge, and indent in a sane manner. + * + * @param {string} str + * @param {string} sep + * @param {string[]} indents + * @returns {string[]} + */ +const indentAfterAllSeps= (str, sep, indents)=> { + const [firstLine, ...restLines]= stringSplit(str, sep); + const indentedRest= arrayFlatMap(restLines, (line)=>[sep, ...indents, line]); + return ['', firstLine, ...indentedRest]; + }; -// ///////////////////////////////////////////////////////////////////////////// +/** + * @param {LoggedErrorHandler} loggedErrorHandler + */ +const defineCausalConsoleFromLogger= (loggedErrorHandler)=>{ + /** + * Implement the `VirtualConsole` API badly by turning all calls into + * calls on `tlogger`. We need to do this to have `console` logging + * turn into calls to Ava's `t.log`, so these console log messages + * are output in the right place. + * + * @param {Logger} tlogger + * @returns {VirtualConsole} + */ + const makeCausalConsoleFromLogger= (tlogger)=>{ + const indents= []; + const logWithIndent= (...args)=> { + if( indents.length> 0) { + args= arrayFlatMap(args, (arg)=> + typeof arg=== 'string'&& stringIncludes(arg, '\n')? + indentAfterAllSeps(arg, '\n', indents): + [arg]); + + args= [...indents, ...args]; + } + return tlogger(...args); + }; + const makeNamed= (name, fn)=> + ({ [name]: (...args)=> fn(...args)})[ name]; + + const baseConsole= fromEntries([ + ...arrayMap(consoleLevelMethods, ([name])=> [ + name, + makeNamed(name, logWithIndent)]), + + ...arrayMap(consoleOtherMethods, ([name])=> [ + name, + makeNamed(name, (...args)=> logWithIndent(name, ...args))])]); + + + // https://console.spec.whatwg.org/#grouping + for( const name of ['group', 'groupCollapsed']) { + if( baseConsole[name]) { + baseConsole[name]= makeNamed(name, (...args)=> { + if( args.length>= 1) { + // Prefix the logged data with "group" or "groupCollapsed". + logWithIndent(...args); + } + // A single space is enough; + // the host console will separate them with additional spaces. + arrayPush(indents, ' '); + }); + } + } + if( baseConsole.groupEnd) { + baseConsole.groupEnd= makeNamed('groupEnd', (...args)=> { + arrayPop(indents); + }); + } + harden(baseConsole); + const causalConsole= makeCausalConsole( + /** @type {VirtualConsole} */ baseConsole, + loggedErrorHandler); + + return (/** @type {VirtualConsole} */ causalConsole); + }; + return freeze(makeCausalConsoleFromLogger); + };$h‍_once.defineCausalConsoleFromLogger(defineCausalConsoleFromLogger); +freeze(defineCausalConsoleFromLogger); + +// ///////////////////////// Filter Console //////////////////////////////////// /** @type {FilterConsole} */ -const filterConsole= (baseConsole, filter, _topic= undefined)=> { +const filterConsole= (baseConsole, filter, _topic= undefined)=> { // TODO do something with optional topic string const whitelist= arrayFilter( consoleWhitelist, @@ -6766,8 +6954,8 @@ const filterConsole= (baseConsole, filter, _topic= undefined)=> { freeze(filterConsole); })() , -// === functors[34] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FinalizationRegistry,Map,mapGet,mapDelete,WeakMap,mapSet,finalizationRegistryRegister,weakmapSet,weakmapGet,mapEntries,mapHas;$h‍_imports([["../commons.js", [["FinalizationRegistry", [$h‍_a => (FinalizationRegistry = $h‍_a)]],["Map", [$h‍_a => (Map = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["mapDelete", [$h‍_a => (mapDelete = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["mapSet", [$h‍_a => (mapSet = $h‍_a)]],["finalizationRegistryRegister", [$h‍_a => (finalizationRegistryRegister = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["mapEntries", [$h‍_a => (mapEntries = $h‍_a)]],["mapHas", [$h‍_a => (mapHas = $h‍_a)]]]]]); +// === functors[35] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let FinalizationRegistry,Map,mapGet,mapDelete,WeakMap,mapSet,finalizationRegistryRegister,weakmapSet,weakmapGet,mapEntries,mapHas;$h‍_imports([["../commons.js", [["FinalizationRegistry", [$h‍_a => (FinalizationRegistry = $h‍_a)]],["Map", [$h‍_a => (Map = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["mapDelete", [$h‍_a => (mapDelete = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["mapSet", [$h‍_a => (mapSet = $h‍_a)]],["finalizationRegistryRegister", [$h‍_a => (finalizationRegistryRegister = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["mapEntries", [$h‍_a => (mapEntries = $h‍_a)]],["mapHas", [$h‍_a => (mapHas = $h‍_a)]]]]]); @@ -6891,8 +7079,8 @@ const makeRejectionHandlers= (reportReason)=>{ };$h‍_once.makeRejectionHandlers(makeRejectionHandlers); })() , -// === functors[35] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let TypeError,apply,defineProperty,freeze,globalThis,defaultHandler,makeCausalConsole,makeRejectionHandlers;$h‍_imports([["../commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./assert.js", [["loggedErrorHandler", [$h‍_a => (defaultHandler = $h‍_a)]]]],["./console.js", [["makeCausalConsole", [$h‍_a => (makeCausalConsole = $h‍_a)]]]],["./unhandled-rejection.js", [["makeRejectionHandlers", [$h‍_a => (makeRejectionHandlers = $h‍_a)]]]],["./types.js", []],["./internal-types.js", []]]); +// === functors[36] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let TypeError,apply,defineProperty,freeze,globalThis,defaultHandler,makeCausalConsole,makeRejectionHandlers;$h‍_imports([["../commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./assert.js", [["loggedErrorHandler", [$h‍_a => (defaultHandler = $h‍_a)]]]],["./console.js", [["makeCausalConsole", [$h‍_a => (makeCausalConsole = $h‍_a)]]]],["./unhandled-rejection.js", [["makeRejectionHandlers", [$h‍_a => (makeRejectionHandlers = $h‍_a)]]]],["./types.js", []],["./internal-types.js", []]]); @@ -6907,35 +7095,13 @@ const makeRejectionHandlers= (reportReason)=>{ -const wrapLogger= (logger, thisArg)=> - freeze((...args)=> apply(logger, thisArg, args)); -// eslint-disable-next-line no-restricted-globals -const originalConsole= /** @type {VirtualConsole} */ - // eslint-disable-next-line no-nested-ternary - typeof console!== 'undefined'? - console: - typeof print=== 'function'? - // Make a good-enough console for eshost (including only functions that - // log at a specific level with no special argument interpretation). - // https://console.spec.whatwg.org/#logging - ((p)=>freeze({ debug: p, log: p, info: p, warn: p, error: p}))( - // eslint-disable-next-line no-undef - wrapLogger(print)): - - undefined; - - -// Upgrade a log-only console (as in `eshost -h SpiderMonkey`). -if( originalConsole&& originalConsole.log) { - for( const methodName of ['warn', 'error']) { - if( !originalConsole[methodName]) { - defineProperty(originalConsole, methodName, { - value: wrapLogger(originalConsole.log, originalConsole)}); +const failFast= (message)=>{ + throw TypeError(message); + }; - } - } - } +const wrapLogger= (logger, thisArg)=> + freeze((...args)=> apply(logger, thisArg, args)); /** * Wrap console unless suppressed. @@ -6954,9 +7120,9 @@ const tameConsole= ( unhandledRejectionTrapping= 'report', optGetStackString= undefined)=> { - if( consoleTaming!== 'safe'&& consoleTaming!== 'unsafe') { - throw TypeError( `unrecognized consoleTaming ${consoleTaming}`); - } + consoleTaming=== 'safe'|| + consoleTaming=== 'unsafe'|| + failFast( `unrecognized consoleTaming ${consoleTaming}`); let loggedErrorHandler; if( optGetStackString=== undefined) { @@ -6967,6 +7133,34 @@ const tameConsole= ( getStackString: optGetStackString}; } + + // eslint-disable-next-line no-restricted-globals + const originalConsole= /** @type {VirtualConsole} */ + // eslint-disable-next-line no-nested-ternary + typeof globalThis.console!== 'undefined'? + globalThis.console: + typeof globalThis.print=== 'function'? + // Make a good-enough console for eshost (including only functions that + // log at a specific level with no special argument interpretation). + // https://console.spec.whatwg.org/#logging + ((p)=>freeze({ debug: p, log: p, info: p, warn: p, error: p}))( + // eslint-disable-next-line no-undef + wrapLogger(globalThis.print)): + + undefined; + + + // Upgrade a log-only console (as in `eshost -h SpiderMonkey`). + if( originalConsole&& originalConsole.log) { + for( const methodName of ['warn', 'error']) { + if( !originalConsole[methodName]) { + defineProperty(originalConsole, methodName, { + value: wrapLogger(originalConsole.log, originalConsole)}); + + } + } + } + const ourConsole= /** @type {VirtualConsole} */ consoleTaming=== 'unsafe'? originalConsole: @@ -6989,21 +7183,36 @@ const tameConsole= ( /* eslint-disable @endo/no-polymorphic-call */ // Node.js - if( errorTrapping!== 'none'&& globalThis.process!== undefined) { - globalThis.process.on('uncaughtException', (error)=>{ + const globalProcess= globalThis.process|| undefined; + if( + errorTrapping!== 'none'&& + typeof globalProcess=== 'object'&& + typeof globalProcess.on=== 'function') + { + let terminate; + if( errorTrapping=== 'platform'|| errorTrapping=== 'exit') { + const { exit}= globalProcess; + // If there is a function-valued process.on but no function-valued process.exit, + // fail early without caring whether errorTrapping is "platform" only by default. + typeof exit=== 'function'|| failFast('missing process.exit'); + terminate= ()=> exit(globalProcess.exitCode|| -1); + }else if( errorTrapping=== 'abort') { + terminate= globalProcess.abort; + typeof terminate=== 'function'|| failFast('missing process.abort'); + } + + globalProcess.on('uncaughtException', (error)=>{ // causalConsole is born frozen so not vulnerable to method tampering. ourConsole.error(error); - if( errorTrapping=== 'platform'|| errorTrapping=== 'exit') { - globalThis.process.exit(globalThis.process.exitCode|| -1); - }else if( errorTrapping=== 'abort') { - globalThis.process.abort(); + if( terminate) { + terminate(); } }); } - if( unhandledRejectionTrapping!== 'none'&& - globalThis.process!== undefined) + typeof globalProcess=== 'object'&& + typeof globalProcess.on=== 'function') { const handleRejection= (reason)=>{ // 'platform' and 'report' just log the reason. @@ -7013,32 +7222,32 @@ const tameConsole= ( const h= makeRejectionHandlers(handleRejection); if( h) { // Rejection handlers are supported. - globalThis.process.on('unhandledRejection', h.unhandledRejectionHandler); - globalThis.process.on('rejectionHandled', h.rejectionHandledHandler); - globalThis.process.on('exit', h.processTerminationHandler); + globalProcess.on('unhandledRejection', h.unhandledRejectionHandler); + globalProcess.on('rejectionHandled', h.rejectionHandledHandler); + globalProcess.on('exit', h.processTerminationHandler); } } // Browser + const globalWindow= globalThis.window|| undefined; if( errorTrapping!== 'none'&& - globalThis.window!== undefined&& - globalThis.window.addEventListener!== undefined) + typeof globalWindow=== 'object'&& + typeof globalWindow.addEventListener=== 'function') { - globalThis.window.addEventListener('error', (event)=>{ + globalWindow.addEventListener('error', (event)=>{ event.preventDefault(); // 'platform' and 'report' just log the reason. ourConsole.error(event.error); if( errorTrapping=== 'exit'|| errorTrapping=== 'abort') { - globalThis.window.location.href= `about:blank`; + globalWindow.location.href= `about:blank`; } }); } - if( unhandledRejectionTrapping!== 'none'&& - globalThis.window!== undefined&& - globalThis.window.addEventListener!== undefined) + typeof globalWindow=== 'object'&& + typeof globalWindow.addEventListener=== 'function') { const handleRejection= (reason)=>{ ourConsole.error('SES_UNHANDLED_REJECTION:', reason); @@ -7047,17 +7256,17 @@ const tameConsole= ( const h= makeRejectionHandlers(handleRejection); if( h) { // Rejection handlers are supported. - globalThis.window.addEventListener('unhandledrejection', (event)=>{ + globalWindow.addEventListener('unhandledrejection', (event)=>{ event.preventDefault(); h.unhandledRejectionHandler(event.reason, event.promise); }); - globalThis.window.addEventListener('rejectionhandled', (event)=>{ + globalWindow.addEventListener('rejectionhandled', (event)=>{ event.preventDefault(); h.rejectionHandledHandler(event.promise); }); - globalThis.window.addEventListener('beforeunload', (_event)=>{ + globalWindow.addEventListener('beforeunload', (_event)=>{ h.processTerminationHandler(); }); } @@ -7068,8 +7277,8 @@ const tameConsole= ( };$h‍_once.tameConsole(tameConsole); })() , -// === functors[36] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let WeakMap,WeakSet,apply,arrayFilter,arrayJoin,arrayMap,arraySlice,create,defineProperties,fromEntries,reflectSet,regexpExec,regexpTest,weakmapGet,weakmapSet,weaksetAdd,weaksetHas;$h‍_imports([["../commons.js", [["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arraySlice", [$h‍_a => (arraySlice = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["fromEntries", [$h‍_a => (fromEntries = $h‍_a)]],["reflectSet", [$h‍_a => (reflectSet = $h‍_a)]],["regexpExec", [$h‍_a => (regexpExec = $h‍_a)]],["regexpTest", [$h‍_a => (regexpTest = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]],["weaksetAdd", [$h‍_a => (weaksetAdd = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]]]); +// === functors[37] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let WeakMap,WeakSet,apply,arrayFilter,arrayJoin,arrayMap,arraySlice,create,defineProperties,fromEntries,reflectSet,regexpExec,regexpTest,weakmapGet,weakmapSet,weaksetAdd,weaksetHas;$h‍_imports([["../commons.js", [["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["WeakSet", [$h‍_a => (WeakSet = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arraySlice", [$h‍_a => (arraySlice = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["fromEntries", [$h‍_a => (fromEntries = $h‍_a)]],["reflectSet", [$h‍_a => (reflectSet = $h‍_a)]],["regexpExec", [$h‍_a => (regexpExec = $h‍_a)]],["regexpTest", [$h‍_a => (regexpTest = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]],["weaksetAdd", [$h‍_a => (weaksetAdd = $h‍_a)]],["weaksetHas", [$h‍_a => (weaksetHas = $h‍_a)]]]]]); @@ -7408,8 +7617,8 @@ const tameV8ErrorConstructor= ( };$h‍_once.tameV8ErrorConstructor(tameV8ErrorConstructor); })() , -// === functors[37] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_ERROR,TypeError,apply,construct,defineProperties,setPrototypeOf,getOwnPropertyDescriptor,defineProperty,NativeErrors,tameV8ErrorConstructor;$h‍_imports([["../commons.js", [["FERAL_ERROR", [$h‍_a => (FERAL_ERROR = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["construct", [$h‍_a => (construct = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["setPrototypeOf", [$h‍_a => (setPrototypeOf = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]]]],["../permits.js", [["NativeErrors", [$h‍_a => (NativeErrors = $h‍_a)]]]],["./tame-v8-error-constructor.js", [["tameV8ErrorConstructor", [$h‍_a => (tameV8ErrorConstructor = $h‍_a)]]]]]); +// === functors[38] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let FERAL_ERROR,TypeError,apply,construct,defineProperties,setPrototypeOf,getOwnPropertyDescriptor,defineProperty,NativeErrors,tameV8ErrorConstructor;$h‍_imports([["../commons.js", [["FERAL_ERROR", [$h‍_a => (FERAL_ERROR = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["construct", [$h‍_a => (construct = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["setPrototypeOf", [$h‍_a => (setPrototypeOf = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]]]],["../permits.js", [["NativeErrors", [$h‍_a => (NativeErrors = $h‍_a)]]]],["./tame-v8-error-constructor.js", [["tameV8ErrorConstructor", [$h‍_a => (tameV8ErrorConstructor = $h‍_a)]]]]]); @@ -7662,8 +7871,10 @@ function tameErrorConstructor( }$h‍_once.default( tameErrorConstructor); })() , -// === functors[38] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let ReferenceError,TypeError,Map,Set,arrayJoin,arrayMap,arrayPush,create,freeze,mapGet,mapHas,mapSet,setAdd,promiseCatch,promiseThen,values,weakmapGet,assert;$h‍_imports([["./commons.js", [["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["Map", [$h‍_a => (Map = $h‍_a)]],["Set", [$h‍_a => (Set = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["mapHas", [$h‍_a => (mapHas = $h‍_a)]],["mapSet", [$h‍_a => (mapSet = $h‍_a)]],["setAdd", [$h‍_a => (setAdd = $h‍_a)]],["promiseCatch", [$h‍_a => (promiseCatch = $h‍_a)]],["promiseThen", [$h‍_a => (promiseThen = $h‍_a)]],["values", [$h‍_a => (values = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); +// === functors[39] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let getenv,ReferenceError,TypeError,Map,Set,arrayJoin,arrayMap,arrayPush,create,freeze,mapGet,mapHas,mapSet,setAdd,promiseThen,values,weakmapGet,generatorNext,generatorThrow,assert;$h‍_imports([["@endo/env-options", [["getEnvironmentOption", [$h‍_a => (getenv = $h‍_a)]]]],["./commons.js", [["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["Map", [$h‍_a => (Map = $h‍_a)]],["Set", [$h‍_a => (Set = $h‍_a)]],["arrayJoin", [$h‍_a => (arrayJoin = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["mapHas", [$h‍_a => (mapHas = $h‍_a)]],["mapSet", [$h‍_a => (mapSet = $h‍_a)]],["setAdd", [$h‍_a => (setAdd = $h‍_a)]],["promiseThen", [$h‍_a => (promiseThen = $h‍_a)]],["values", [$h‍_a => (values = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["generatorNext", [$h‍_a => (generatorNext = $h‍_a)]],["generatorThrow", [$h‍_a => (generatorThrow = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); + + @@ -7696,6 +7907,33 @@ const { Fail, details: d, quote: q}= assert; const noop= ()=> { }; +async function asyncTrampoline(generatorFunc, args, errorWrapper) { + const iterator= generatorFunc(...args); + let result= generatorNext(iterator); + while( !result.done) { + try { + // eslint-disable-next-line no-await-in-loop + const val= await result.value; + result= generatorNext(iterator, val); + }catch( error) { + result= generatorThrow(iterator, errorWrapper(error)); + } + } + return result.value; + } + +function syncTrampoline(generatorFunc, args) { + const iterator= generatorFunc(...args); + let result= generatorNext(iterator); + while( !result.done) { + try { + result= generatorNext(iterator, result.value); + }catch( error) { + result= generatorThrow(iterator, error); + } + } + return result.value; + } // `makeAlias` constructs compartment specifier tuples for the `aliases` // private field of compartments. // These aliases allow a compartment to alias an internal module specifier to a @@ -7725,9 +7963,9 @@ const loadRecord= ( compartment, moduleSpecifier, staticModuleRecord, - pendingJobs, + enqueueJob, + selectImplementation, moduleLoads, - errors, importMeta)=> { const { resolveHook, moduleRecords}= weakmapGet( @@ -7753,20 +7991,14 @@ const loadRecord= ( for( const fullSpecifier of values(resolvedImports)) { // Behold: recursion. // eslint-disable-next-line no-use-before-define - const dependencyLoaded= memoizedLoadWithErrorAnnotation( + enqueueJob(memoizedLoadWithErrorAnnotation, [ compartmentPrivateFields, moduleAliases, compartment, fullSpecifier, - pendingJobs, - moduleLoads, - errors); - - setAdd( - pendingJobs, - promiseThen(dependencyLoaded, noop, (error)=>{ - arrayPush(errors, error); - })); + enqueueJob, + selectImplementation, + moduleLoads]); } @@ -7775,19 +8007,17 @@ const loadRecord= ( return moduleRecord; }; -const loadWithoutErrorAnnotation= async( +function* loadWithoutErrorAnnotation( compartmentPrivateFields, moduleAliases, compartment, moduleSpecifier, - pendingJobs, - moduleLoads, - errors)=> - { - const { importHook, moduleMap, moduleMapHook, moduleRecords}= weakmapGet( - compartmentPrivateFields, - compartment); - + enqueueJob, + selectImplementation, + moduleLoads) + { + const { importHook, importNowHook, moduleMap, moduleMapHook, moduleRecords}= + weakmapGet(compartmentPrivateFields, compartment); // Follow moduleMap, or moduleMapHook if present. let aliasNamespace= moduleMap[moduleSpecifier]; @@ -7815,14 +8045,14 @@ const loadWithoutErrorAnnotation= async( } // Behold: recursion. // eslint-disable-next-line no-use-before-define - const aliasRecord= await memoizedLoadWithErrorAnnotation( + const aliasRecord= yield memoizedLoadWithErrorAnnotation( compartmentPrivateFields, moduleAliases, alias.compartment, alias.specifier, - pendingJobs, - moduleLoads, - errors); + enqueueJob, + selectImplementation, + moduleLoads); mapSet(moduleRecords, moduleSpecifier, aliasRecord); return aliasRecord; @@ -7832,7 +8062,10 @@ const loadWithoutErrorAnnotation= async( return mapGet(moduleRecords, moduleSpecifier); } - const staticModuleRecord= await importHook(moduleSpecifier); + const staticModuleRecord= yield selectImplementation( + importHook, + importNowHook)( + moduleSpecifier); if( staticModuleRecord=== null|| typeof staticModuleRecord!== 'object') { Fail `importHook must return a promise for an object, for module ${q( @@ -7863,9 +8096,9 @@ const loadWithoutErrorAnnotation= async( aliasCompartment, aliasSpecifier, aliasModuleRecord, - pendingJobs, + enqueueJob, + selectImplementation, moduleLoads, - errors, importMeta); mapSet(moduleRecords, moduleSpecifier, aliasRecord); @@ -7882,14 +8115,14 @@ const loadWithoutErrorAnnotation= async( } // Behold: recursion. // eslint-disable-next-line no-use-before-define - const aliasRecord= await memoizedLoadWithErrorAnnotation( + const aliasRecord= yield memoizedLoadWithErrorAnnotation( compartmentPrivateFields, moduleAliases, staticModuleRecord.compartment, staticModuleRecord.specifier, - pendingJobs, - moduleLoads, - errors); + enqueueJob, + selectImplementation, + moduleLoads); mapSet(moduleRecords, moduleSpecifier, aliasRecord); return aliasRecord; @@ -7904,20 +8137,20 @@ const loadWithoutErrorAnnotation= async( compartment, moduleSpecifier, staticModuleRecord, - pendingJobs, - moduleLoads, - errors); + enqueueJob, + selectImplementation, + moduleLoads); - }; + } -const memoizedLoadWithErrorAnnotation= async( +const memoizedLoadWithErrorAnnotation= ( compartmentPrivateFields, moduleAliases, compartment, moduleSpecifier, - pendingJobs, - moduleLoads, - errors)=> + enqueueJob, + selectImplementation, + moduleLoads)=> { const { name: compartmentName}= weakmapGet( compartmentPrivateFields, @@ -7935,15 +8168,16 @@ const memoizedLoadWithErrorAnnotation= async( return moduleLoading; } - moduleLoading= promiseCatch( - loadWithoutErrorAnnotation( + moduleLoading= selectImplementation(asyncTrampoline, syncTrampoline)( + loadWithoutErrorAnnotation, + [ compartmentPrivateFields, moduleAliases, compartment, moduleSpecifier, - pendingJobs, - moduleLoads, - errors), + enqueueJob, + selectImplementation, + moduleLoads], (error)=>{ // eslint-disable-next-line @endo/no-polymorphic-call @@ -7962,6 +8196,64 @@ const memoizedLoadWithErrorAnnotation= async( return moduleLoading; }; +function asyncJobQueue() { + /** @type {Set>} */ + const pendingJobs= new Set(); + /** @type {Array} */ + const errors= []; + + /** + * Enqueues a job that starts immediately but won't be awaited until drainQueue is called. + * + * @template {any[]} T + * @param {(...args: T)=>Promise<*>} func + * @param {T} args + */ + const enqueueJob= (func, args)=> { + setAdd( + pendingJobs, + promiseThen(func(...args), noop, (error)=>{ + arrayPush(errors, error); + })); + + }; + /** + * Sequentially awaits pending jobs and returns an array of errors + * + * @returns {Promise>} + */ + const drainQueue= async()=> { + for( const job of pendingJobs) { + // eslint-disable-next-line no-await-in-loop + await job; + } + return errors; + }; + return { enqueueJob, drainQueue}; + } + +/** + * @param {object} options + * @param {Array} options.errors + * @param {string} options.errorPrefix + */ +function throwAggregateError({ errors, errorPrefix}) { + // Throw an aggregate error if there were any errors. + if( errors.length> 0) { + const verbose= + getenv('COMPARTMENT_LOAD_ERRORS', '', ['verbose'])=== 'verbose'; + throw TypeError( + `${errorPrefix} (${errors.length} underlying failures: ${arrayJoin( + arrayMap(errors, (error)=>error.message+( verbose? error.stack: '')), + ', ') + }`); + + } + } + +const preferSync= (_asyncImpl, syncImpl)=> syncImpl; +const preferAsync= (asyncImpl, _syncImpl)=> asyncImpl; + /* * `load` asynchronously gathers the `StaticModuleRecord`s for a module and its * transitive dependencies. @@ -7980,54 +8272,86 @@ const load= async( compartment); - /** @type {Set>} */ - const pendingJobs= new Set(); /** @type {Map>>>} */ const moduleLoads= new Map(); - /** @type {Array} */ - const errors= []; - const dependencyLoaded= memoizedLoadWithErrorAnnotation( + const { enqueueJob, drainQueue}= asyncJobQueue(); + + enqueueJob(memoizedLoadWithErrorAnnotation, [ compartmentPrivateFields, moduleAliases, compartment, moduleSpecifier, - pendingJobs, - moduleLoads, - errors); + enqueueJob, + preferAsync, + moduleLoads]); + + + // Drain pending jobs queue and throw an aggregate error + const errors= await drainQueue(); + + throwAggregateError({ + errors, + errorPrefix: `Failed to load module ${q(moduleSpecifier)} in package ${q( + compartmentName) + }`}); - setAdd( - pendingJobs, - promiseThen(dependencyLoaded, noop, (error)=>{ + }; + +/* + * `loadNow` synchronously gathers the `StaticModuleRecord`s for a module and its + * transitive dependencies. + * The module records refer to each other by a reference to the dependency's + * compartment and the specifier of the module within its own compartment. + * This graph is then ready to be synchronously linked and executed. + */$h‍_once.load(load); +const loadNow= ( + compartmentPrivateFields, + moduleAliases, + compartment, + moduleSpecifier)=> + { + const { name: compartmentName}= weakmapGet( + compartmentPrivateFields, + compartment); + + + /** @type {Map>>>} */ + const moduleLoads= new Map(); + + /** @type {Array} */ + const errors= []; + + const enqueueJob= (func, args)=> { + try { + func(...args); + }catch( error) { arrayPush(errors, error); - })); + } + }; + enqueueJob(memoizedLoadWithErrorAnnotation, [ + compartmentPrivateFields, + moduleAliases, + compartment, + moduleSpecifier, + enqueueJob, + preferSync, + moduleLoads]); - // Drain pending jobs queue. - // Each job is a promise for undefined, regardless of success or failure. - // Before we add a job to the queue, we catch any error and push it into the - // `errors` accumulator. - for( const job of pendingJobs) { - // eslint-disable-next-line no-await-in-loop - await job; - } - // Throw an aggregate error if there were any errors. - if( errors.length> 0) { - throw TypeError( - `Failed to load module ${q(moduleSpecifier)} in package ${q( - compartmentName) - } (${errors.length} underlying failures: ${arrayJoin( - arrayMap(errors, (error)=>error.message), - ', ') - }`); + throwAggregateError({ + errors, + errorPrefix: `Failed to load module ${q(moduleSpecifier)} in package ${q( + compartmentName) + }`}); - } - };$h‍_once.load(load); + };$h‍_once.loadNow(loadNow); })() , -// === functors[39] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let makeAlias,Proxy,TypeError,create,freeze,mapGet,mapHas,mapSet,ownKeys,reflectGet,reflectGetOwnPropertyDescriptor,reflectHas,reflectIsExtensible,reflectPreventExtensions,weakmapSet,assert;$h‍_imports([["./module-load.js", [["makeAlias", [$h‍_a => (makeAlias = $h‍_a)]]]],["./commons.js", [["Proxy", [$h‍_a => (Proxy = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["mapHas", [$h‍_a => (mapHas = $h‍_a)]],["mapSet", [$h‍_a => (mapSet = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["reflectGet", [$h‍_a => (reflectGet = $h‍_a)]],["reflectGetOwnPropertyDescriptor", [$h‍_a => (reflectGetOwnPropertyDescriptor = $h‍_a)]],["reflectHas", [$h‍_a => (reflectHas = $h‍_a)]],["reflectIsExtensible", [$h‍_a => (reflectIsExtensible = $h‍_a)]],["reflectPreventExtensions", [$h‍_a => (reflectPreventExtensions = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); +// === functors[40] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let makeAlias,Proxy,TypeError,create,freeze,mapGet,mapHas,mapSet,ownKeys,reflectGet,reflectGetOwnPropertyDescriptor,reflectHas,reflectIsExtensible,reflectPreventExtensions,toStringTagSymbol,weakmapSet,assert;$h‍_imports([["./module-load.js", [["makeAlias", [$h‍_a => (makeAlias = $h‍_a)]]]],["./commons.js", [["Proxy", [$h‍_a => (Proxy = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["mapHas", [$h‍_a => (mapHas = $h‍_a)]],["mapSet", [$h‍_a => (mapSet = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["reflectGet", [$h‍_a => (reflectGet = $h‍_a)]],["reflectGetOwnPropertyDescriptor", [$h‍_a => (reflectGetOwnPropertyDescriptor = $h‍_a)]],["reflectHas", [$h‍_a => (reflectHas = $h‍_a)]],["reflectIsExtensible", [$h‍_a => (reflectIsExtensible = $h‍_a)]],["reflectPreventExtensions", [$h‍_a => (reflectPreventExtensions = $h‍_a)]],["toStringTagSymbol", [$h‍_a => (toStringTagSymbol = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); + @@ -8080,13 +8404,21 @@ const { quote: q}= assert; // const deferExports= ()=> { let active= false; - const proxiedExports= create(null); + const exportsTarget= create(null, { + // Make this appear like an ESM module namespace object. + [toStringTagSymbol]: { + value: 'Module', + writable: false, + enumerable: false, + configurable: false}}); + + return freeze({ activate() { active= true; }, - proxiedExports, - exportsProxy: new Proxy(proxiedExports, { + exportsTarget, + exportsProxy: new Proxy(exportsTarget, { get(_target, name, receiver) { if( !active) { throw TypeError( @@ -8095,7 +8427,7 @@ const deferExports= ()=> { } of module exports namespace, the module has not yet begun to execute`); } - return reflectGet(proxiedExports, name, receiver); + return reflectGet(exportsTarget, name, receiver); }, set(_target, name, _value) { throw TypeError( @@ -8110,7 +8442,7 @@ const deferExports= ()=> { }, the module has not yet begun to execute`); } - return reflectHas(proxiedExports, name); + return reflectHas(exportsTarget, name); }, deleteProperty(_target, name) { throw TypeError( @@ -8123,7 +8455,7 @@ const deferExports= ()=> { 'Cannot enumerate keys, the module has not yet begun to execute'); } - return ownKeys(proxiedExports); + return ownKeys(exportsTarget); }, getOwnPropertyDescriptor(_target, name) { if( !active) { @@ -8133,7 +8465,7 @@ const deferExports= ()=> { }, the module has not yet begun to execute`); } - return reflectGetOwnPropertyDescriptor(proxiedExports, name); + return reflectGetOwnPropertyDescriptor(exportsTarget, name); }, preventExtensions(_target) { if( !active) { @@ -8141,7 +8473,7 @@ const deferExports= ()=> { 'Cannot prevent extensions of module exports namespace, the module has not yet begun to execute'); } - return reflectPreventExtensions(proxiedExports); + return reflectPreventExtensions(exportsTarget); }, isExtensible() { if( !active) { @@ -8149,7 +8481,7 @@ const deferExports= ()=> { 'Cannot check extensibility of module exports namespace, the module has not yet begun to execute'); } - return reflectIsExtensible(proxiedExports); + return reflectIsExtensible(exportsTarget); }, getPrototypeOf(_target) { return null; @@ -8176,12 +8508,31 @@ const deferExports= ()=> { }; -// `getDeferredExports` memoizes the creation of a deferred module exports -// namespace proxy for any abritrary full specifier in a compartment. -// It also records the compartment and specifier affiliated with that module -// exports namespace proxy so it can be used as an alias into another -// compartment when threaded through a compartment's `moduleMap` argument. -$h‍_once.deferExports(deferExports);const getDeferredExports=( +/** + * @typedef {object} DeferredExports + * @property {Record} exportsTarget - The object to which a + * module's exports will be added. + * @property {Record} exportsProxy - A proxy over the `exportsTarget`, + * used to expose its "exports" to other compartments. + * @property {() => void} activate - Activate the `exportsProxy` such that it can + * be used as a module namespace object. + */ + +/** + * Memoizes the creation of a deferred module exports namespace proxy for any + * arbitrary full specifier in a compartment. It also records the compartment + * and specifier affiliated with that module exports namespace proxy so it + * can be used as an alias into another compartment when threaded through + * a compartment's `moduleMap` argument. + * + * @param {*} compartment - The compartment to retrieve deferred exports from. + * @param {*} compartmentPrivateFields - The private fields of the compartment. + * @param {*} moduleAliases - The module aliases of the compartment. + * @param {string} specifier - The module specifier to retrieve deferred exports for. + * @returns {DeferredExports} - The deferred exports for the module specifier of + * the compartment. + */$h‍_once.deferExports(deferExports); +const getDeferredExports= ( compartment, compartmentPrivateFields, moduleAliases, @@ -8201,8 +8552,8 @@ $h‍_once.deferExports(deferExports);const getDeferredExports=( };$h‍_once.getDeferredExports(getDeferredExports); })() , -// === functors[40] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let TypeError,arrayPush,create,getOwnPropertyDescriptors,evadeHtmlCommentTest,evadeImportExpressionTest,rejectSomeDirectEvalExpressions,makeSafeEvaluator;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]]]],["./transforms.js", [["evadeHtmlCommentTest", [$h‍_a => (evadeHtmlCommentTest = $h‍_a)]],["evadeImportExpressionTest", [$h‍_a => (evadeImportExpressionTest = $h‍_a)]],["rejectSomeDirectEvalExpressions", [$h‍_a => (rejectSomeDirectEvalExpressions = $h‍_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator", [$h‍_a => (makeSafeEvaluator = $h‍_a)]]]]]); +// === functors[41] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let TypeError,arrayPush,create,getOwnPropertyDescriptors,evadeHtmlCommentTest,evadeImportExpressionTest,rejectSomeDirectEvalExpressions,makeSafeEvaluator;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]]]],["./transforms.js", [["evadeHtmlCommentTest", [$h‍_a => (evadeHtmlCommentTest = $h‍_a)]],["evadeImportExpressionTest", [$h‍_a => (evadeImportExpressionTest = $h‍_a)]],["rejectSomeDirectEvalExpressions", [$h‍_a => (rejectSomeDirectEvalExpressions = $h‍_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator", [$h‍_a => (makeSafeEvaluator = $h‍_a)]]]]]); @@ -8297,8 +8648,8 @@ const compartmentEvaluate= (compartmentFields, source, options)=> { };$h‍_once.compartmentEvaluate(compartmentEvaluate); })() , -// === functors[41] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let assert,getDeferredExports,ReferenceError,SyntaxError,TypeError,arrayForEach,arrayIncludes,arrayPush,arraySome,arraySort,create,defineProperty,entries,freeze,isArray,keys,mapGet,weakmapGet,reflectHas,assign,compartmentEvaluate;$h‍_imports([["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]],["./module-proxy.js", [["getDeferredExports", [$h‍_a => (getDeferredExports = $h‍_a)]]]],["./commons.js", [["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["SyntaxError", [$h‍_a => (SyntaxError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayForEach", [$h‍_a => (arrayForEach = $h‍_a)]],["arrayIncludes", [$h‍_a => (arrayIncludes = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["arraySome", [$h‍_a => (arraySome = $h‍_a)]],["arraySort", [$h‍_a => (arraySort = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["isArray", [$h‍_a => (isArray = $h‍_a)]],["keys", [$h‍_a => (keys = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["reflectHas", [$h‍_a => (reflectHas = $h‍_a)]],["assign", [$h‍_a => (assign = $h‍_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate", [$h‍_a => (compartmentEvaluate = $h‍_a)]]]]]); +// === functors[42] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let assert,getDeferredExports,ReferenceError,SyntaxError,TypeError,arrayForEach,arrayIncludes,arrayPush,arraySome,arraySort,create,defineProperty,entries,freeze,isArray,keys,mapGet,weakmapGet,reflectHas,assign,compartmentEvaluate;$h‍_imports([["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]],["./module-proxy.js", [["getDeferredExports", [$h‍_a => (getDeferredExports = $h‍_a)]]]],["./commons.js", [["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["SyntaxError", [$h‍_a => (SyntaxError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayForEach", [$h‍_a => (arrayForEach = $h‍_a)]],["arrayIncludes", [$h‍_a => (arrayIncludes = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["arraySome", [$h‍_a => (arraySome = $h‍_a)]],["arraySort", [$h‍_a => (arraySort = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["isArray", [$h‍_a => (isArray = $h‍_a)]],["keys", [$h‍_a => (keys = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["reflectHas", [$h‍_a => (reflectHas = $h‍_a)]],["assign", [$h‍_a => (assign = $h‍_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate", [$h‍_a => (compartmentEvaluate = $h‍_a)]]]]]); @@ -8332,7 +8683,7 @@ const makeThirdPartyModuleInstance= ( moduleSpecifier, resolvedImports)=> { - const { exportsProxy, proxiedExports, activate}= getDeferredExports( + const { exportsProxy, exportsTarget, activate}= getDeferredExports( compartment, weakmapGet(compartmentPrivateFields, compartment), moduleAliases, @@ -8351,7 +8702,7 @@ const makeThirdPartyModuleInstance= ( } arrayForEach(staticModuleRecord.exports, (name)=>{ - let value= proxiedExports[name]; + let value= exportsTarget[name]; const updaters= []; const get= ()=> value; @@ -8363,7 +8714,7 @@ const makeThirdPartyModuleInstance= ( } }; - defineProperty(proxiedExports, name, { + defineProperty(exportsTarget, name, { get, set, enumerable: true, @@ -8375,9 +8726,9 @@ const makeThirdPartyModuleInstance= ( update(value); }; }); - // This is enough to support import * from cjs - the '*' field doesn't need to be in exports nor proxiedExports because import will only ever access it via notifiers + // This is enough to support import * from cjs - the '*' field doesn't need to be in exports nor exportsTarget because import will only ever access it via notifiers notifiers['*']= (update)=>{ - update(proxiedExports); + update(exportsTarget); }; } @@ -8397,7 +8748,7 @@ const makeThirdPartyModuleInstance= ( try { // eslint-disable-next-line @endo/no-polymorphic-call staticModuleRecord.execute( - proxiedExports, + exportsTarget, compartment, resolvedImports); @@ -8443,7 +8794,7 @@ $h‍_once.makeThirdPartyModuleInstance(makeThirdPartyModuleInstance);const make const { __shimTransforms__, importMetaHook}= compartmentFields; - const { exportsProxy, proxiedExports, activate}= getDeferredExports( + const { exportsProxy, exportsTarget, activate}= getDeferredExports( compartment, compartmentFields, moduleAliases, @@ -8642,7 +8993,7 @@ $h‍_once.makeThirdPartyModuleInstance(makeThirdPartyModuleInstance);const make const notifyStar= (update)=>{ - update(proxiedExports); + update(exportsTarget); }; notifiers['*']= notifyStar; @@ -8735,10 +9086,10 @@ $h‍_once.makeThirdPartyModuleInstance(makeThirdPartyModuleInstance);const make // and the string must correspond to a valid identifier, sorting these // properties works for this specific case. arrayForEach(arraySort(keys(exportsProps)), (k)=> - defineProperty(proxiedExports, k, exportsProps[k])); + defineProperty(exportsTarget, k, exportsProps[k])); - freeze(proxiedExports); + freeze(exportsTarget); activate(); } @@ -8788,8 +9139,8 @@ $h‍_once.makeThirdPartyModuleInstance(makeThirdPartyModuleInstance);const make };$h‍_once.makeModuleInstance(makeModuleInstance); })() , -// === functors[42] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let assert,makeModuleInstance,makeThirdPartyModuleInstance,Map,ReferenceError,TypeError,entries,isArray,isObject,mapGet,mapHas,mapSet,weakmapGet;$h‍_imports([["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]],["./module-instance.js", [["makeModuleInstance", [$h‍_a => (makeModuleInstance = $h‍_a)]],["makeThirdPartyModuleInstance", [$h‍_a => (makeThirdPartyModuleInstance = $h‍_a)]]]],["./commons.js", [["Map", [$h‍_a => (Map = $h‍_a)]],["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["isArray", [$h‍_a => (isArray = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["mapHas", [$h‍_a => (mapHas = $h‍_a)]],["mapSet", [$h‍_a => (mapSet = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]]]]]); +// === functors[43] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let assert,makeModuleInstance,makeThirdPartyModuleInstance,Map,ReferenceError,TypeError,entries,isArray,isObject,mapGet,mapHas,mapSet,weakmapGet;$h‍_imports([["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]],["./module-instance.js", [["makeModuleInstance", [$h‍_a => (makeModuleInstance = $h‍_a)]],["makeThirdPartyModuleInstance", [$h‍_a => (makeThirdPartyModuleInstance = $h‍_a)]]]],["./commons.js", [["Map", [$h‍_a => (Map = $h‍_a)]],["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["isArray", [$h‍_a => (isArray = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["mapHas", [$h‍_a => (mapHas = $h‍_a)]],["mapSet", [$h‍_a => (mapSet = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]]]]]); @@ -8968,8 +9319,9 @@ const instantiate= ( };$h‍_once.instantiate(instantiate); })() , -// === functors[43] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Map,ReferenceError,TypeError,WeakMap,assign,defineProperties,entries,promiseThen,weakmapGet,weakmapSet,setGlobalObjectSymbolUnscopables,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,setGlobalObjectEvaluators,sharedGlobalPropertyNames,load,link,getDeferredExports,assert,compartmentEvaluate,makeSafeEvaluator;$h‍_imports([["./commons.js", [["Map", [$h‍_a => (Map = $h‍_a)]],["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["assign", [$h‍_a => (assign = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["promiseThen", [$h‍_a => (promiseThen = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]]]],["./global-object.js", [["setGlobalObjectSymbolUnscopables", [$h‍_a => (setGlobalObjectSymbolUnscopables = $h‍_a)]],["setGlobalObjectConstantProperties", [$h‍_a => (setGlobalObjectConstantProperties = $h‍_a)]],["setGlobalObjectMutableProperties", [$h‍_a => (setGlobalObjectMutableProperties = $h‍_a)]],["setGlobalObjectEvaluators", [$h‍_a => (setGlobalObjectEvaluators = $h‍_a)]]]],["./permits.js", [["sharedGlobalPropertyNames", [$h‍_a => (sharedGlobalPropertyNames = $h‍_a)]]]],["./module-load.js", [["load", [$h‍_a => (load = $h‍_a)]]]],["./module-link.js", [["link", [$h‍_a => (link = $h‍_a)]]]],["./module-proxy.js", [["getDeferredExports", [$h‍_a => (getDeferredExports = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate", [$h‍_a => (compartmentEvaluate = $h‍_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator", [$h‍_a => (makeSafeEvaluator = $h‍_a)]]]]]); +// === functors[44] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let Map,ReferenceError,TypeError,WeakMap,assign,defineProperties,entries,promiseThen,toStringTagSymbol,weakmapGet,weakmapSet,setGlobalObjectSymbolUnscopables,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,setGlobalObjectEvaluators,sharedGlobalPropertyNames,load,loadNow,link,getDeferredExports,assert,compartmentEvaluate,makeSafeEvaluator;$h‍_imports([["./commons.js", [["Map", [$h‍_a => (Map = $h‍_a)]],["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["WeakMap", [$h‍_a => (WeakMap = $h‍_a)]],["assign", [$h‍_a => (assign = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["promiseThen", [$h‍_a => (promiseThen = $h‍_a)]],["toStringTagSymbol", [$h‍_a => (toStringTagSymbol = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["weakmapSet", [$h‍_a => (weakmapSet = $h‍_a)]]]],["./global-object.js", [["setGlobalObjectSymbolUnscopables", [$h‍_a => (setGlobalObjectSymbolUnscopables = $h‍_a)]],["setGlobalObjectConstantProperties", [$h‍_a => (setGlobalObjectConstantProperties = $h‍_a)]],["setGlobalObjectMutableProperties", [$h‍_a => (setGlobalObjectMutableProperties = $h‍_a)]],["setGlobalObjectEvaluators", [$h‍_a => (setGlobalObjectEvaluators = $h‍_a)]]]],["./permits.js", [["sharedGlobalPropertyNames", [$h‍_a => (sharedGlobalPropertyNames = $h‍_a)]]]],["./module-load.js", [["load", [$h‍_a => (load = $h‍_a)]],["loadNow", [$h‍_a => (loadNow = $h‍_a)]]]],["./module-link.js", [["link", [$h‍_a => (link = $h‍_a)]]]],["./module-proxy.js", [["getDeferredExports", [$h‍_a => (getDeferredExports = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate", [$h‍_a => (compartmentEvaluate = $h‍_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator", [$h‍_a => (makeSafeEvaluator = $h‍_a)]]]]]); + @@ -9076,10 +9428,6 @@ const CompartmentPrototype= { return compartmentEvaluate(compartmentFields, source, options); }, - toString() { - return '[object Compartment]'; - }, - module(specifier) { if( typeof specifier!== 'string') { throw TypeError('first argument of module() must be a string'); @@ -9134,9 +9482,21 @@ const CompartmentPrototype= { } assertModuleHooks(this); - + loadNow(privateFields, moduleAliases, this, specifier); return compartmentImportNow(/** @type {Compartment} */ this, specifier); - }};$h‍_once.CompartmentPrototype(CompartmentPrototype); + }}; + + +// This causes `String(new Compartment())` to evaluate to `[object Compartment]`. +// The descriptor follows the conventions of other globals with @@toStringTag +// properties, e.g. Math. +$h‍_once.CompartmentPrototype(CompartmentPrototype);defineProperties(CompartmentPrototype,{ + [toStringTagSymbol]: { + value: 'Compartment', + writable: false, + enumerable: false, + configurable: true}}); + defineProperties(InertCompartment, { @@ -9171,6 +9531,7 @@ const makeCompartmentConstructor= ( __shimTransforms__= [], resolveHook, importHook, + importNowHook, moduleMapHook, importMetaHook}= options; @@ -9247,6 +9608,7 @@ const makeCompartmentConstructor= ( safeEvaluate, resolveHook, importHook, + importNowHook, moduleMap, moduleMapHook, importMetaHook, @@ -9263,8 +9625,8 @@ const makeCompartmentConstructor= ( };$h‍_once.makeCompartmentConstructor(makeCompartmentConstructor); })() , -// === functors[44] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let FERAL_FUNCTION,Float32Array,Map,Set,String,getOwnPropertyDescriptor,getPrototypeOf,iterateArray,iterateMap,iterateSet,iterateString,matchAllRegExp,matchAllSymbol,regexpPrototype,globalThis,InertCompartment;$h‍_imports([["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["Float32Array", [$h‍_a => (Float32Array = $h‍_a)]],["Map", [$h‍_a => (Map = $h‍_a)]],["Set", [$h‍_a => (Set = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["iterateArray", [$h‍_a => (iterateArray = $h‍_a)]],["iterateMap", [$h‍_a => (iterateMap = $h‍_a)]],["iterateSet", [$h‍_a => (iterateSet = $h‍_a)]],["iterateString", [$h‍_a => (iterateString = $h‍_a)]],["matchAllRegExp", [$h‍_a => (matchAllRegExp = $h‍_a)]],["matchAllSymbol", [$h‍_a => (matchAllSymbol = $h‍_a)]],["regexpPrototype", [$h‍_a => (regexpPrototype = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./compartment.js", [["InertCompartment", [$h‍_a => (InertCompartment = $h‍_a)]]]]]); +// === functors[45] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let FERAL_FUNCTION,Float32Array,Map,Set,String,getOwnPropertyDescriptor,getPrototypeOf,iterateArray,iterateMap,iterateSet,iterateString,matchAllRegExp,matchAllSymbol,regexpPrototype,globalThis,InertCompartment;$h‍_imports([["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["Float32Array", [$h‍_a => (Float32Array = $h‍_a)]],["Map", [$h‍_a => (Map = $h‍_a)]],["Set", [$h‍_a => (Set = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["iterateArray", [$h‍_a => (iterateArray = $h‍_a)]],["iterateMap", [$h‍_a => (iterateMap = $h‍_a)]],["iterateSet", [$h‍_a => (iterateSet = $h‍_a)]],["iterateString", [$h‍_a => (iterateString = $h‍_a)]],["matchAllRegExp", [$h‍_a => (matchAllRegExp = $h‍_a)]],["matchAllSymbol", [$h‍_a => (matchAllSymbol = $h‍_a)]],["regexpPrototype", [$h‍_a => (regexpPrototype = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./compartment.js", [["InertCompartment", [$h‍_a => (InertCompartment = $h‍_a)]]]]]); @@ -9427,8 +9789,8 @@ const getAnonymousIntrinsics= ()=> { };$h‍_once.getAnonymousIntrinsics(getAnonymousIntrinsics); })() , -// === functors[45] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let TypeError,freeze;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]]]); +// === functors[46] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let TypeError,freeze;$h‍_imports([["./commons.js", [["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]]]]]); const tameHarden= (safeHarden, hardenTaming)=> { @@ -9459,8 +9821,9 @@ const tameHarden= (safeHarden, hardenTaming)=> { freeze(tameHarden); })() , -// === functors[46] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let Symbol,entries,fromEntries,getOwnPropertyDescriptors,defineProperties,arrayMap;$h‍_imports([["./commons.js", [["Symbol", [$h‍_a => (Symbol = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["fromEntries", [$h‍_a => (fromEntries = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]]]]]); +// === functors[47] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let Symbol,entries,fromEntries,getOwnPropertyDescriptors,defineProperties,arrayMap,functionBind;$h‍_imports([["./commons.js", [["Symbol", [$h‍_a => (Symbol = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["fromEntries", [$h‍_a => (fromEntries = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["defineProperties", [$h‍_a => (defineProperties = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["functionBind", [$h‍_a => (functionBind = $h‍_a)]]]]]); + @@ -9499,11 +9862,9 @@ const tameSymbolConstructor= ()=> { const OriginalSymbol= Symbol; const SymbolPrototype= OriginalSymbol.prototype; - const SharedSymbol= { - Symbol(description) { - return OriginalSymbol(description); - }}. - Symbol; + // Bypass Hermes bug, fixed in: https://github.com/facebook/hermes/commit/00f18c89c720e1c34592bb85a1a8d311e6e99599 + // Make a "copy" of the primordial [Symbol "constructor"](https://tc39.es/ecma262/#sec-symbol-description) which maintains all observable behavior. The primordial explicitly throws on `[[Construct]]` and has a `[[Call]]` which ignores the receiver. Binding also maintains the `toString` source as a native function. The `name` is restored below when copying own properties. + const SharedSymbol= functionBind(Symbol, undefined); defineProperties(SymbolPrototype, { constructor: { @@ -9527,13 +9888,222 @@ const tameSymbolConstructor= ()=> { };$h‍_once.tameSymbolConstructor(tameSymbolConstructor); })() , -// === functors[47] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let makeEnvironmentCaptor,FERAL_FUNCTION,FERAL_EVAL,TypeError,arrayFilter,globalThis,is,ownKeys,stringSplit,noEvalEvaluate,getOwnPropertyNames,makeHardener,makeIntrinsicsCollector,whitelistIntrinsics,tameFunctionConstructors,tameDateConstructor,tameMathObject,tameRegExpConstructor,enablePropertyOverrides,tameLocaleMethods,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,setGlobalObjectEvaluators,makeSafeEvaluator,initialGlobalPropertyNames,tameFunctionToString,tameDomains,tameConsole,tameErrorConstructor,assert,makeAssert,getAnonymousIntrinsics,makeCompartmentConstructor,tameHarden,tameSymbolConstructor;$h‍_imports([["@endo/env-options", [["makeEnvironmentCaptor", [$h‍_a => (makeEnvironmentCaptor = $h‍_a)]]]],["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["FERAL_EVAL", [$h‍_a => (FERAL_EVAL = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["stringSplit", [$h‍_a => (stringSplit = $h‍_a)]],["noEvalEvaluate", [$h‍_a => (noEvalEvaluate = $h‍_a)]],["getOwnPropertyNames", [$h‍_a => (getOwnPropertyNames = $h‍_a)]]]],["./make-hardener.js", [["makeHardener", [$h‍_a => (makeHardener = $h‍_a)]]]],["./intrinsics.js", [["makeIntrinsicsCollector", [$h‍_a => (makeIntrinsicsCollector = $h‍_a)]]]],["./permits-intrinsics.js", [["default", [$h‍_a => (whitelistIntrinsics = $h‍_a)]]]],["./tame-function-constructors.js", [["default", [$h‍_a => (tameFunctionConstructors = $h‍_a)]]]],["./tame-date-constructor.js", [["default", [$h‍_a => (tameDateConstructor = $h‍_a)]]]],["./tame-math-object.js", [["default", [$h‍_a => (tameMathObject = $h‍_a)]]]],["./tame-regexp-constructor.js", [["default", [$h‍_a => (tameRegExpConstructor = $h‍_a)]]]],["./enable-property-overrides.js", [["default", [$h‍_a => (enablePropertyOverrides = $h‍_a)]]]],["./tame-locale-methods.js", [["default", [$h‍_a => (tameLocaleMethods = $h‍_a)]]]],["./global-object.js", [["setGlobalObjectConstantProperties", [$h‍_a => (setGlobalObjectConstantProperties = $h‍_a)]],["setGlobalObjectMutableProperties", [$h‍_a => (setGlobalObjectMutableProperties = $h‍_a)]],["setGlobalObjectEvaluators", [$h‍_a => (setGlobalObjectEvaluators = $h‍_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator", [$h‍_a => (makeSafeEvaluator = $h‍_a)]]]],["./permits.js", [["initialGlobalPropertyNames", [$h‍_a => (initialGlobalPropertyNames = $h‍_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString", [$h‍_a => (tameFunctionToString = $h‍_a)]]]],["./tame-domains.js", [["tameDomains", [$h‍_a => (tameDomains = $h‍_a)]]]],["./error/tame-console.js", [["tameConsole", [$h‍_a => (tameConsole = $h‍_a)]]]],["./error/tame-error-constructor.js", [["default", [$h‍_a => (tameErrorConstructor = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]],["makeAssert", [$h‍_a => (makeAssert = $h‍_a)]]]],["./get-anonymous-intrinsics.js", [["getAnonymousIntrinsics", [$h‍_a => (getAnonymousIntrinsics = $h‍_a)]]]],["./compartment.js", [["makeCompartmentConstructor", [$h‍_a => (makeCompartmentConstructor = $h‍_a)]]]],["./tame-harden.js", [["tameHarden", [$h‍_a => (tameHarden = $h‍_a)]]]],["./tame-symbol-constructor.js", [["tameSymbolConstructor", [$h‍_a => (tameSymbolConstructor = $h‍_a)]]]]]); +// === functors[48] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let getOwnPropertyDescriptor,apply,defineProperty,toStringTagSymbol;$h‍_imports([["./commons.js", [["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["apply", [$h‍_a => (apply = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["toStringTagSymbol", [$h‍_a => (toStringTagSymbol = $h‍_a)]]]]]); + +const throws= (thunk)=>{ + try { + thunk(); + return false; + }catch( er) { + return true; + } + }; + +/** + * Exported for convenience of unit testing. Harmless, but not expected + * to be useful by itself. + * + * @param {any} obj + * @param {string|symbol} prop + * @param {any} expectedValue + * @returns {boolean} + * Returns whether `tameFauxDataProperty` turned the property in question + * from an apparent faux data property into the actual data property it + * seemed to emulate. + * If this function returns `false`, then we hope no effects happened. + * However, sniffing out if an accessor property seems to be a faux data + * property requires invoking the getter and setter functions that might + * possibly have side effects. + * `tameFauxDataProperty` is not in a position to tell. + */ +const tameFauxDataProperty= (obj, prop, expectedValue)=> { + if( obj=== undefined) { + // The object does not exist in this version of the platform + return false; + } + const desc= getOwnPropertyDescriptor(obj, prop); + if( !desc|| 'value'in desc) { + // The property either doesn't exist, or is already an actual data property. + return false; + } + const { get, set}= desc; + if( typeof get!== 'function'|| typeof set!== 'function') { + // A faux data property has both a getter and a setter + return false; + } + if( get()!== expectedValue) { + // The getter called by itself should produce the expectedValue + return false; + } + if( apply(get, obj, [])!== expectedValue) { + // The getter called with `this === obj` should also return the + // expectedValue. + return false; + } + const testValue= 'Seems to be a setter'; + const subject1= { __proto__: null}; + apply(set, subject1, [testValue]); + if( subject1[prop]!== testValue) { + // The setter called with an unrelated object as `this` should + // set the property on the object. + return false; + } + const subject2= { __proto__: obj}; + apply(set, subject2, [testValue]); + if( subject2[prop]!== testValue) { + // The setter called on an object that inherits from `obj` should + // override the property from `obj` as if by assignment. + return false; + } + if( !throws(()=> apply(set, obj, [expectedValue]))) { + // The setter called with `this === obj` should throw without having + // caused any effect. + // This is the test that has the greatest danger of leaving behind some + // persistent side effect. The most obvious one is to emulate a + // successful assignment to the property. That's why this test + // uses `expectedValue`, so that case is likely not to actually + // change anything. + return false; + } + if( 'originalValue'in get) { + // The ses-shim uniquely, as far as we know, puts an `originalValue` + // property on the getter, so that reflect property tranversal algorithms, + // like `harden`, will traverse into the enulated value without + // calling the getter. That does not happen until `permits-intrinsics.js` + // which is much later. So if we see one this early, we should + // not assume we understand what's going on. + return false; + } + + // We assume that this code runs before any untrusted code runs, so + // we do not need to worry about the above conditions passing because of + // malicious intent. In fact, it runs even before vetted shims are supposed + // to run, between repair and hardening. Given that, after all these tests + // pass, we have adequately validated that the property in question is + // an accessor function whose purpose is suppressing the override mistake, + // i.e., enabling a non-writable property to be overridden by assignment. + // In that case, here we *temporarily* turn it into the data property + // it seems to emulate, but writable so that it does not trigger the + // override mistake while in this temporary state. + + // For those properties that are also listed in `enablements.js`, + // that phase will re-enable override for these properties, but + // via accessor functions that SES controls, so we know what they are + // doing. In addition, the getter functions installed by + // `enable-property-overrides.js` have an `originalValue` field + // enabling meta-traversal code like harden to visit the original value + // without calling the getter. + + if( desc.configurable=== false) { + // Even though it seems to be a faux data property, we're unable to fix it. + return false; + } + + // Many of the `return false;` cases above plausibly should be turned into + // errors, or an least generate warnings. However, for those, the checks + // following this phase are likely to signal an error anyway. + + // At this point, we have passed all our sniff checks for validating that + // it seems to be a faux data property with the expected value. Turn + // it into the actual data property it emulates, but writable so there is + // not yet an override mistake problem. + + defineProperty(obj, prop, { + value: expectedValue, + writable: true, + enumerable: desc.enumerable, + configurable: true}); + + + return true; + }; + +/** + * In JavaScript, the so-called "override mistake" is the inability to + * override an inherited non-writable data property by assignment. A common + * workaround is to instead define an accessor property that acts like + * a non-writable data property, except that it allows an object that + * inherits this property to override it by assignment. Let's call + * an access property that acts this way a "faux data property". In this + * ses-shim, `enable-property-overrides.js` makes the properties listed in + * `enablements.js` into faux data properties. + * + * But the ses-shim is not alone in use of this trick. Starting with the + * [Iterator Helpers proposal](https://github.com/tc39/proposal-iterator-helpers), + * some properties are defined as (what we call) faux data properties. + * Some of these are new properties (`Interator.prototype.constructor`) and + * some are old data properties converted to accessor properties + * (`Iterator.prototype[String.toStringTag]`). So the ses-shim needs to be + * prepared for some enumerated set of properties to already be faux data + * properties in the platform prior to our initialization. + * + * For these possible faux data properties, it is important that + * `permits.js` describe each as a data property, so that it can further + * constrain the apparent value (that allegedly would be returned by the + * getter) according to its own permits. + * + * However, at the time of this writing, the precise behavior specified + * by the iterator-helpers proposal for these faux data properties is + * novel. We should not be too confident that all further such platform + * additions do what we would now expect. So, for each of these possible + * faux data properties, we do some sniffing to see if it behaves as we + * currently expect a faux data property to act. If not, then + * `tameFauxDataProperties` tries not to modify it, leaving it to later + * checks, especially `permits-intrinsics.js`, to error when it sees an + * unexpected accessor. + * + * If one of these enumerated accessor properties does seem to be + * a faithful faux data property, then `tameFauxDataProperties` itself + * *tempoarily* turns it into the actual data property that it seems to emulate. + * This data property starts as writable, so that in this state it will + * not trigger the override mistake, i.e., assignment to an object inheriting + * this property is allowed to succeed at overriding this property. + * + * For those properties that should be a faux data property rather than an + * actual one, such as those from the iterator-helpers proposal, + * they should be listed as such in `enablements.js`, so + * `enable-property-overrides.js` will turn it back into a faux data property. + * But one controlled by the ses-shim, whose behavior we understand. + * + * `tameFauxDataProperties`, which turns these into actual data properties, + * happens during the `repairIntrinsics` phase + * of `lockdown`, before even vetted shim are supposed to run. + * `enable-property-overrides.js` runs after vetted shims, turning the + * appropriate ones back into faux data properties. Thus vetted shims + * can observe the possibly non-conforming state where these are temporarily + * actual data properties, rather than faux data properties. + * + * Coordinate the property enumeration here + * with `enablements.js`, so the appropriate properties are + * turned back to faux data properties. + * + * @param {Record} intrinsics + */$h‍_once.tameFauxDataProperty(tameFauxDataProperty); +const tameFauxDataProperties= (intrinsics)=>{ + // https://github.com/tc39/proposal-iterator-helpers + tameFauxDataProperty( + intrinsics['%IteratorPrototype%'], + 'constructor', + intrinsics.Iterator); + + // https://github.com/tc39/proposal-iterator-helpers + tameFauxDataProperty( + intrinsics['%IteratorPrototype%'], + toStringTagSymbol, + 'Iterator'); + + };$h‍_once.tameFauxDataProperties(tameFauxDataProperties); +})() +, +// === functors[49] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let getenv,FERAL_FUNCTION,FERAL_EVAL,TypeError,arrayFilter,globalThis,is,ownKeys,stringSplit,noEvalEvaluate,getOwnPropertyNames,getPrototypeOf,makeHardener,makeIntrinsicsCollector,whitelistIntrinsics,tameFunctionConstructors,tameDateConstructor,tameMathObject,tameRegExpConstructor,enablePropertyOverrides,tameLocaleMethods,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,setGlobalObjectEvaluators,makeSafeEvaluator,initialGlobalPropertyNames,tameFunctionToString,tameDomains,tameConsole,tameErrorConstructor,assert,makeAssert,getAnonymousIntrinsics,makeCompartmentConstructor,tameHarden,tameSymbolConstructor,tameFauxDataProperties;$h‍_imports([["@endo/env-options", [["getEnvironmentOption", [$h‍_a => (getenv = $h‍_a)]]]],["./commons.js", [["FERAL_FUNCTION", [$h‍_a => (FERAL_FUNCTION = $h‍_a)]],["FERAL_EVAL", [$h‍_a => (FERAL_EVAL = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["is", [$h‍_a => (is = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["stringSplit", [$h‍_a => (stringSplit = $h‍_a)]],["noEvalEvaluate", [$h‍_a => (noEvalEvaluate = $h‍_a)]],["getOwnPropertyNames", [$h‍_a => (getOwnPropertyNames = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]]]],["./make-hardener.js", [["makeHardener", [$h‍_a => (makeHardener = $h‍_a)]]]],["./intrinsics.js", [["makeIntrinsicsCollector", [$h‍_a => (makeIntrinsicsCollector = $h‍_a)]]]],["./permits-intrinsics.js", [["default", [$h‍_a => (whitelistIntrinsics = $h‍_a)]]]],["./tame-function-constructors.js", [["default", [$h‍_a => (tameFunctionConstructors = $h‍_a)]]]],["./tame-date-constructor.js", [["default", [$h‍_a => (tameDateConstructor = $h‍_a)]]]],["./tame-math-object.js", [["default", [$h‍_a => (tameMathObject = $h‍_a)]]]],["./tame-regexp-constructor.js", [["default", [$h‍_a => (tameRegExpConstructor = $h‍_a)]]]],["./enable-property-overrides.js", [["default", [$h‍_a => (enablePropertyOverrides = $h‍_a)]]]],["./tame-locale-methods.js", [["default", [$h‍_a => (tameLocaleMethods = $h‍_a)]]]],["./global-object.js", [["setGlobalObjectConstantProperties", [$h‍_a => (setGlobalObjectConstantProperties = $h‍_a)]],["setGlobalObjectMutableProperties", [$h‍_a => (setGlobalObjectMutableProperties = $h‍_a)]],["setGlobalObjectEvaluators", [$h‍_a => (setGlobalObjectEvaluators = $h‍_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator", [$h‍_a => (makeSafeEvaluator = $h‍_a)]]]],["./permits.js", [["initialGlobalPropertyNames", [$h‍_a => (initialGlobalPropertyNames = $h‍_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString", [$h‍_a => (tameFunctionToString = $h‍_a)]]]],["./tame-domains.js", [["tameDomains", [$h‍_a => (tameDomains = $h‍_a)]]]],["./error/tame-console.js", [["tameConsole", [$h‍_a => (tameConsole = $h‍_a)]]]],["./error/tame-error-constructor.js", [["default", [$h‍_a => (tameErrorConstructor = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]],["makeAssert", [$h‍_a => (makeAssert = $h‍_a)]]]],["./get-anonymous-intrinsics.js", [["getAnonymousIntrinsics", [$h‍_a => (getAnonymousIntrinsics = $h‍_a)]]]],["./compartment.js", [["makeCompartmentConstructor", [$h‍_a => (makeCompartmentConstructor = $h‍_a)]]]],["./tame-harden.js", [["tameHarden", [$h‍_a => (tameHarden = $h‍_a)]]]],["./tame-symbol-constructor.js", [["tameSymbolConstructor", [$h‍_a => (tameSymbolConstructor = $h‍_a)]]]],["./tame-faux-data-properties.js", [["tameFauxDataProperties", [$h‍_a => (tameFauxDataProperties = $h‍_a)]]]]]); + @@ -9584,7 +10154,13 @@ const tameSymbolConstructor= ()=> { -/** @typedef {import('../types.js').LockdownOptions} LockdownOptions */ + + + + + + +/** @import {LockdownOptions} from '../types.js' */ const { Fail, details: d, quote: q}= assert; @@ -9685,8 +10261,6 @@ const repairIntrinsics= (options= {})=> { // [`stackFiltering` options](https://github.com/Agoric/SES-shim/blob/master/packages/ses/docs/lockdown.md#stackfiltering-options) // for an explanation. - const { getEnvironmentOption: getenv}= makeEnvironmentCaptor(globalThis); - const { errorTaming= getenv('LOCKDOWN_ERROR_TAMING', 'safe'), errorTrapping= /** @type {"platform" | "none" | "report" | "abort" | "exit" | undefined} */ @@ -9811,6 +10385,14 @@ const repairIntrinsics= (options= {})=> { const intrinsics= finalIntrinsics(); + const hostIntrinsics= { __proto__: null}; + + // The Node.js Buffer is a derived class of Uint8Array, and as such is often + // passed around where a Uint8Array is expected. + if( typeof globalThis.Buffer=== 'function') { + hostIntrinsics.Buffer= globalThis.Buffer; + } + /** * Wrap console unless suppressed. * At the moment, the console is considered a host power in the start @@ -9831,6 +10413,19 @@ const repairIntrinsics= (options= {})=> { globalThis.console= /** @type {Console} */ consoleRecord.console; + // The untamed Node.js console cannot itself be hardened as it has mutable + // internal properties, but some of these properties expose internal versions + // of classes from node's "primordials" concept. + // eslint-disable-next-line no-underscore-dangle + if( typeof /** @type {any} */ consoleRecord.console. _times=== 'object') { + // SafeMap is a derived Map class used internally by Node + // There doesn't seem to be a cleaner way to reach it. + hostIntrinsics.SafeMap= getPrototypeOf( + // eslint-disable-next-line no-underscore-dangle + /** @type {any} */ consoleRecord.console. _times); + + } + // @ts-ignore assert is absent on globalThis type def. if( errorTaming=== 'unsafe'&& globalThis.assert=== assert) { // If errorTaming is 'unsafe' we replace the global assert with @@ -9845,6 +10440,8 @@ const repairIntrinsics= (options= {})=> { // Replace *Locale* methods with their non-locale equivalents tameLocaleMethods(intrinsics, localeTaming); + tameFauxDataProperties(intrinsics); + /** * 2. WHITELIST to standardize the environment. */ @@ -9918,20 +10515,28 @@ const repairIntrinsics= (options= {})=> { // Finally register and optionally freeze all the intrinsics. This // must be the operation that modifies the intrinsics. - tamedHarden(intrinsics); + const toHarden= { + intrinsics, + hostIntrinsics, + globals: { + // Harden evaluators + Function: globalThis.Function, + eval: globalThis.eval, + // @ts-ignore Compartment does exist on globalThis + Compartment: globalThis.Compartment, + + // Harden Symbol + Symbol: globalThis.Symbol}}; + - // Harden evaluators - tamedHarden(globalThis.Function); - tamedHarden(globalThis.eval); - // @ts-ignore Compartment does exist on globalThis - tamedHarden(globalThis.Compartment); // Harden Symbol and properties for initialGlobalPropertyNames in the host realm - tamedHarden(globalThis.Symbol); for( const prop of getOwnPropertyNames(initialGlobalPropertyNames)) { - tamedHarden(globalThis[prop]); + toHarden.globals[prop]= globalThis[prop]; } + tamedHarden(toHarden); + return tamedHarden; }; @@ -9939,8 +10544,9 @@ const repairIntrinsics= (options= {})=> { };$h‍_once.repairIntrinsics(repairIntrinsics); })() , -// === functors[48] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let globalThis,repairIntrinsics;$h‍_imports([["./assert-sloppy-mode.js", []],["./commons.js", [["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./lockdown.js", [["repairIntrinsics", [$h‍_a => (repairIntrinsics = $h‍_a)]]]]]); +// === functors[50] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let globalThis,repairIntrinsics;$h‍_imports([["./assert-sloppy-mode.js", []],["./commons.js", [["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./lockdown.js", [["repairIntrinsics", [$h‍_a => (repairIntrinsics = $h‍_a)]]]]]); + @@ -9948,9 +10554,10 @@ const repairIntrinsics= (options= {})=> { +/** @import {LockdownOptions} from '../types.js' */ /** - * @param {import('./lockdown.js').LockdownOptions} options + * @param {LockdownOptions} options */ globalThis.lockdown= (options)=>{ const hardenIntrinsics= repairIntrinsics(options); @@ -9958,7 +10565,7 @@ globalThis.lockdown= (options)=>{ }; /** - * @param {import('./lockdown.js').LockdownOptions} options + * @param {LockdownOptions} options */ globalThis.repairIntrinsics= (options)=>{ const hardenIntrinsics= repairIntrinsics(options); @@ -9977,8 +10584,8 @@ globalThis.repairIntrinsics= (options)=>{ }; })() , -// === functors[49] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let globalThis,makeCompartmentConstructor,tameFunctionToString,getGlobalIntrinsics;$h‍_imports([["./commons.js", [["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./compartment.js", [["makeCompartmentConstructor", [$h‍_a => (makeCompartmentConstructor = $h‍_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString", [$h‍_a => (tameFunctionToString = $h‍_a)]]]],["./intrinsics.js", [["getGlobalIntrinsics", [$h‍_a => (getGlobalIntrinsics = $h‍_a)]]]]]); +// === functors[51] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let globalThis,makeCompartmentConstructor,tameFunctionToString,getGlobalIntrinsics;$h‍_imports([["./commons.js", [["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./compartment.js", [["makeCompartmentConstructor", [$h‍_a => (makeCompartmentConstructor = $h‍_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString", [$h‍_a => (tameFunctionToString = $h‍_a)]]]],["./intrinsics.js", [["getGlobalIntrinsics", [$h‍_a => (getGlobalIntrinsics = $h‍_a)]]]]]); @@ -9994,15 +10601,68 @@ globalThis.Compartment= makeCompartmentConstructor( markVirtualizedNativeFunction); })() , -// === functors[50] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { let globalThis,assert;$h‍_imports([["./commons.js", [["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); +// === functors[52] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let globalThis,assert;$h‍_imports([["./commons.js", [["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]); globalThis.assert= assert; })() , -// === functors[51] === -({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { $h‍_imports([["./src/lockdown-shim.js", []],["./src/compartment-shim.js", []],["./src/assert-shim.js", []]]); +// === functors[53] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; let symbolFor,globalThis,defineCausalConsoleFromLogger,loggedErrorHandler;$h‍_imports([["./commons.js", [["symbolFor", [$h‍_a => (symbolFor = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]]]],["./error/console.js", [["defineCausalConsoleFromLogger", [$h‍_a => (defineCausalConsoleFromLogger = $h‍_a)]]]],["./error/assert.js", [["loggedErrorHandler", [$h‍_a => (loggedErrorHandler = $h‍_a)]]]]]); + + + +// TODO possible additional exports. Some are privileged. +// export { loggedErrorHandler }; +// export { +// makeCausalConsole, +// consoleLevelMethods, +// consoleOtherMethods, +// makeLoggingConsoleKit, +// filterConsole, +// pumpLogToConsole, +// } from './src/error/console.js'; +// export { assertLogs, throwsAndLogs } from './src/error/throws-and-logs.js'; + +/** + * Makes a Console like the + * [SES causal `console`](https://github.com/endojs/endo/blob/master/packages/ses/src/error/README.md) + * but whose output is redirected to the supplied `logger` function. + */ +const makeCausalConsoleFromLoggerForSesAva= + defineCausalConsoleFromLogger(loggedErrorHandler); + +/** + *`makeCausalConsoleFromLoggerForSesAva` is privileged because it exposes + * unredacted error info onto the `Logger` provided by the caller. It + * should not be made available to non-privileged code. + * + * Further, we consider this particular API choice to be experimental + * and may change in the future. It is currently only intended for use by + * `@endo/ses-ava`, with which it will be co-maintained. + * + * Thus, this `console-shim.js` makes `makeCausalConsoleFromLoggerForSesAva` + * available on `globalThis` which it *assumes* is the global of the start + * compartment and is therefore allowed to hold powers that should not be + * available in constructed compartments. It makes it available as the value of + * a global property named by a registered symbol named + * `MAKE_CAUSAL_CONSOLE_FROM_LOGGER_KEY_FOR_SES_AVA`. + * + * Anyone accessing this, including `@endo/ses-ava`, should feature test for + * this and be tolerant of its absence. It may indeed disappear from later + * versions of the ses-shim. + */ +const MAKE_CAUSAL_CONSOLE_FROM_LOGGER_KEY_FOR_SES_AVA= symbolFor( + 'MAKE_CAUSAL_CONSOLE_FROM_LOGGER_KEY_FOR_SES_AVA'); + + +globalThis[MAKE_CAUSAL_CONSOLE_FROM_LOGGER_KEY_FOR_SES_AVA]= + makeCausalConsoleFromLoggerForSesAva; +})() +, +// === functors[54] === +({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, importMeta: $h‍____meta, }) => (function () { 'use strict'; $h‍_imports([["./src/lockdown-shim.js", []],["./src/compartment-shim.js", []],["./src/assert-shim.js", []],["./src/console-shim.js", []]]); })() , ]; // functors end @@ -10053,6 +10713,7 @@ globalThis.assert= assert; ReferenceError: cell("ReferenceError"), SyntaxError: cell("SyntaxError"), TypeError: cell("TypeError"), + AggregateError: cell("AggregateError"), assign: cell("assign"), create: cell("create"), defineProperties: cell("defineProperties"), @@ -10103,6 +10764,7 @@ globalThis.assert= assert; weaksetPrototype: cell("weaksetPrototype"), functionPrototype: cell("functionPrototype"), promisePrototype: cell("promisePrototype"), + generatorPrototype: cell("generatorPrototype"), typedArrayPrototype: cell("typedArrayPrototype"), uncurryThis: cell("uncurryThis"), objectHasOwnProperty: cell("objectHasOwnProperty"), @@ -10111,6 +10773,7 @@ globalThis.assert= assert; arrayIncludes: cell("arrayIncludes"), arrayJoin: cell("arrayJoin"), arrayMap: cell("arrayMap"), + arrayFlatMap: cell("arrayFlatMap"), arrayPop: cell("arrayPop"), arrayPush: cell("arrayPush"), arraySlice: cell("arraySlice"), @@ -10135,6 +10798,8 @@ globalThis.assert= assert; stringIncludes: cell("stringIncludes"), stringIndexOf: cell("stringIndexOf"), stringMatch: cell("stringMatch"), + generatorNext: cell("generatorNext"), + generatorThrow: cell("generatorThrow"), stringReplace: cell("stringReplace"), stringSearch: cell("stringSearch"), stringSlice: cell("stringSlice"), @@ -10148,6 +10813,7 @@ globalThis.assert= assert; weaksetAdd: cell("weaksetAdd"), weaksetHas: cell("weaksetHas"), functionToString: cell("functionToString"), + functionBind: cell("functionBind"), promiseAll: cell("promiseAll"), promiseCatch: cell("promiseCatch"), promiseThen: cell("promiseThen"), @@ -10160,11 +10826,16 @@ globalThis.assert= assert; FERAL_EVAL: cell("FERAL_EVAL"), FERAL_FUNCTION: cell("FERAL_FUNCTION"), noEvalEvaluate: cell("noEvalEvaluate"), + FERAL_STACK_GETTER: cell("FERAL_STACK_GETTER"), + FERAL_STACK_SETTER: cell("FERAL_STACK_SETTER"), }, { }, { makeEnvironmentCaptor: cell("makeEnvironmentCaptor"), + getEnvironmentOption: cell("getEnvironmentOption"), + getEnvironmentOptionsList: cell("getEnvironmentOptionsList"), + environmentOptionsListHas: cell("environmentOptionsListHas"), }, { }, @@ -10179,6 +10850,8 @@ globalThis.assert= assert; }, { makeLRUCacheMap: cell("makeLRUCacheMap"), + }, + { makeNoteLogArgsArrayKit: cell("makeNoteLogArgsArrayKit"), }, { @@ -10186,18 +10859,19 @@ globalThis.assert= assert; loggedErrorHandler: cell("loggedErrorHandler"), makeAssert: cell("makeAssert"), assert: cell("assert"), + sanitizeError: cell("sanitizeError"), }, { isTypedArray: cell("isTypedArray"), makeHardener: cell("makeHardener"), }, { + NativeErrors: cell("NativeErrors"), constantProperties: cell("constantProperties"), universalPropertyNames: cell("universalPropertyNames"), initialGlobalPropertyNames: cell("initialGlobalPropertyNames"), sharedGlobalPropertyNames: cell("sharedGlobalPropertyNames"), uniqueGlobalPropertyNames: cell("uniqueGlobalPropertyNames"), - NativeErrors: cell("NativeErrors"), FunctionInstance: cell("FunctionInstance"), AsyncFunctionInstance: cell("AsyncFunctionInstance"), isAccessorPermit: cell("isAccessorPermit"), @@ -10286,10 +10960,13 @@ globalThis.assert= assert; tameDomains: cell("tameDomains"), }, { + consoleLevelMethods: cell("consoleLevelMethods"), + consoleOtherMethods: cell("consoleOtherMethods"), makeLoggingConsoleKit: cell("makeLoggingConsoleKit"), + pumpLogToConsole: cell("pumpLogToConsole"), makeCausalConsole: cell("makeCausalConsole"), + defineCausalConsoleFromLogger: cell("defineCausalConsoleFromLogger"), filterConsole: cell("filterConsole"), - consoleWhitelist: cell("consoleWhitelist"), }, { makeRejectionHandlers: cell("makeRejectionHandlers"), @@ -10308,6 +10985,7 @@ globalThis.assert= assert; { makeAlias: cell("makeAlias"), load: cell("load"), + loadNow: cell("loadNow"), }, { deferExports: cell("deferExports"), @@ -10339,6 +11017,10 @@ globalThis.assert= assert; { tameSymbolConstructor: cell("tameSymbolConstructor"), }, + { + tameFauxDataProperty: cell("tameFauxDataProperty"), + tameFauxDataProperties: cell("tameFauxDataProperties"), + }, { repairIntrinsics: cell("repairIntrinsics"), }, @@ -10350,11 +11032,22 @@ globalThis.assert= assert; }, { }, + { + }, ]; Object.defineProperties(cells[3], Object.getOwnPropertyDescriptors(cells[2])); - const namespaces = cells.map(cells => Object.freeze(Object.create(null, cells))); +const namespaces = cells.map(cells => Object.freeze(Object.create(null, { + ...cells, + // Make this appear like an ESM module namespace object. + [Symbol.toStringTag]: { + value: 'Module', + writable: false, + enumerable: false, + configurable: false, + }, + }))); for (let index = 0; index < namespaces.length; index += 1) { cells[index]['*'] = cell('*', namespaces[index]); @@ -10404,6 +11097,7 @@ function observeImports(map, importName, importIndex) { ReferenceError: cells[0].ReferenceError.set, SyntaxError: cells[0].SyntaxError.set, TypeError: cells[0].TypeError.set, + AggregateError: cells[0].AggregateError.set, assign: cells[0].assign.set, create: cells[0].create.set, defineProperties: cells[0].defineProperties.set, @@ -10454,6 +11148,7 @@ function observeImports(map, importName, importIndex) { weaksetPrototype: cells[0].weaksetPrototype.set, functionPrototype: cells[0].functionPrototype.set, promisePrototype: cells[0].promisePrototype.set, + generatorPrototype: cells[0].generatorPrototype.set, typedArrayPrototype: cells[0].typedArrayPrototype.set, uncurryThis: cells[0].uncurryThis.set, objectHasOwnProperty: cells[0].objectHasOwnProperty.set, @@ -10462,6 +11157,7 @@ function observeImports(map, importName, importIndex) { arrayIncludes: cells[0].arrayIncludes.set, arrayJoin: cells[0].arrayJoin.set, arrayMap: cells[0].arrayMap.set, + arrayFlatMap: cells[0].arrayFlatMap.set, arrayPop: cells[0].arrayPop.set, arrayPush: cells[0].arrayPush.set, arraySlice: cells[0].arraySlice.set, @@ -10486,6 +11182,8 @@ function observeImports(map, importName, importIndex) { stringIncludes: cells[0].stringIncludes.set, stringIndexOf: cells[0].stringIndexOf.set, stringMatch: cells[0].stringMatch.set, + generatorNext: cells[0].generatorNext.set, + generatorThrow: cells[0].generatorThrow.set, stringReplace: cells[0].stringReplace.set, stringSearch: cells[0].stringSearch.set, stringSlice: cells[0].stringSlice.set, @@ -10499,6 +11197,7 @@ function observeImports(map, importName, importIndex) { weaksetAdd: cells[0].weaksetAdd.set, weaksetHas: cells[0].weaksetHas.set, functionToString: cells[0].functionToString.set, + functionBind: cells[0].functionBind.set, promiseAll: cells[0].promiseAll.set, promiseCatch: cells[0].promiseCatch.set, promiseThen: cells[0].promiseThen.set, @@ -10511,6 +11210,8 @@ function observeImports(map, importName, importIndex) { FERAL_EVAL: cells[0].FERAL_EVAL.set, FERAL_FUNCTION: cells[0].FERAL_FUNCTION.set, noEvalEvaluate: cells[0].noEvalEvaluate.set, + FERAL_STACK_GETTER: cells[0].FERAL_STACK_GETTER.set, + FERAL_STACK_SETTER: cells[0].FERAL_STACK_SETTER.set, }, importMeta: {}, }); @@ -10533,6 +11234,9 @@ function observeImports(map, importName, importIndex) { }, onceVar: { makeEnvironmentCaptor: cells[2].makeEnvironmentCaptor.set, + getEnvironmentOption: cells[2].getEnvironmentOption.set, + getEnvironmentOptionsList: cells[2].getEnvironmentOptionsList.set, + environmentOptionsListHas: cells[2].environmentOptionsListHas.set, }, importMeta: {}, }); @@ -10584,66 +11288,58 @@ function observeImports(map, importName, importIndex) { functors[7]({ imports(entries) { const map = new Map(entries); - observeImports(map, "./internal-types.js", 6); }, liveVar: { }, onceVar: { makeLRUCacheMap: cells[7].makeLRUCacheMap.set, - makeNoteLogArgsArrayKit: cells[7].makeNoteLogArgsArrayKit.set, }, importMeta: {}, }); functors[8]({ imports(entries) { const map = new Map(entries); - observeImports(map, "../commons.js", 0); - observeImports(map, "./stringify-utils.js", 4); - observeImports(map, "./types.js", 5); + observeImports(map, "../make-lru-cachemap.js", 7); observeImports(map, "./internal-types.js", 6); - observeImports(map, "./note-log-args.js", 7); }, liveVar: { }, onceVar: { - unredactedDetails: cells[8].unredactedDetails.set, - loggedErrorHandler: cells[8].loggedErrorHandler.set, - makeAssert: cells[8].makeAssert.set, - assert: cells[8].assert.set, + makeNoteLogArgsArrayKit: cells[8].makeNoteLogArgsArrayKit.set, }, importMeta: {}, }); functors[9]({ imports(entries) { const map = new Map(entries); - observeImports(map, "./commons.js", 0); - observeImports(map, "./error/assert.js", 8); + observeImports(map, "../commons.js", 0); + observeImports(map, "./stringify-utils.js", 4); + observeImports(map, "./types.js", 5); + observeImports(map, "./internal-types.js", 6); + observeImports(map, "./note-log-args.js", 8); }, liveVar: { }, onceVar: { - isTypedArray: cells[9].isTypedArray.set, - makeHardener: cells[9].makeHardener.set, + unredactedDetails: cells[9].unredactedDetails.set, + loggedErrorHandler: cells[9].loggedErrorHandler.set, + makeAssert: cells[9].makeAssert.set, + assert: cells[9].assert.set, + sanitizeError: cells[9].sanitizeError.set, }, importMeta: {}, }); functors[10]({ imports(entries) { const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./error/assert.js", 9); }, liveVar: { }, onceVar: { - constantProperties: cells[10].constantProperties.set, - universalPropertyNames: cells[10].universalPropertyNames.set, - initialGlobalPropertyNames: cells[10].initialGlobalPropertyNames.set, - sharedGlobalPropertyNames: cells[10].sharedGlobalPropertyNames.set, - uniqueGlobalPropertyNames: cells[10].uniqueGlobalPropertyNames.set, - NativeErrors: cells[10].NativeErrors.set, - FunctionInstance: cells[10].FunctionInstance.set, - AsyncFunctionInstance: cells[10].AsyncFunctionInstance.set, - isAccessorPermit: cells[10].isAccessorPermit.set, - permitted: cells[10].permitted.set, + isTypedArray: cells[10].isTypedArray.set, + makeHardener: cells[10].makeHardener.set, }, importMeta: {}, }); @@ -10651,32 +11347,41 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); - observeImports(map, "./permits.js", 10); }, liveVar: { }, onceVar: { - makeIntrinsicsCollector: cells[11].makeIntrinsicsCollector.set, - getGlobalIntrinsics: cells[11].getGlobalIntrinsics.set, + NativeErrors: cells[11].NativeErrors.set, + constantProperties: cells[11].constantProperties.set, + universalPropertyNames: cells[11].universalPropertyNames.set, + initialGlobalPropertyNames: cells[11].initialGlobalPropertyNames.set, + sharedGlobalPropertyNames: cells[11].sharedGlobalPropertyNames.set, + uniqueGlobalPropertyNames: cells[11].uniqueGlobalPropertyNames.set, + FunctionInstance: cells[11].FunctionInstance.set, + AsyncFunctionInstance: cells[11].AsyncFunctionInstance.set, + isAccessorPermit: cells[11].isAccessorPermit.set, + permitted: cells[11].permitted.set, }, importMeta: {}, }); functors[12]({ imports(entries) { const map = new Map(entries); - observeImports(map, "./permits.js", 10); observeImports(map, "./commons.js", 0); + observeImports(map, "./permits.js", 11); }, liveVar: { }, onceVar: { - default: cells[12].default.set, + makeIntrinsicsCollector: cells[12].makeIntrinsicsCollector.set, + getGlobalIntrinsics: cells[12].getGlobalIntrinsics.set, }, importMeta: {}, }); functors[13]({ imports(entries) { const map = new Map(entries); + observeImports(map, "./permits.js", 11); observeImports(map, "./commons.js", 0); }, liveVar: { @@ -10725,13 +11430,12 @@ function observeImports(map, importName, importIndex) { functors[17]({ imports(entries) { const map = new Map(entries); + observeImports(map, "./commons.js", 0); }, liveVar: { }, onceVar: { - minEnablements: cells[17].minEnablements.set, - moderateEnablements: cells[17].moderateEnablements.set, - severeEnablements: cells[17].severeEnablements.set, + default: cells[17].default.set, }, importMeta: {}, }); @@ -10739,12 +11443,13 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); - observeImports(map, "./enablements.js", 17); }, liveVar: { }, onceVar: { - default: cells[18].default.set, + minEnablements: cells[18].minEnablements.set, + moderateEnablements: cells[18].moderateEnablements.set, + severeEnablements: cells[18].severeEnablements.set, }, importMeta: {}, }); @@ -10752,7 +11457,7 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); - observeImports(map, "./error/assert.js", 8); + observeImports(map, "./enablements.js", 18); }, liveVar: { }, @@ -10764,24 +11469,24 @@ function observeImports(map, importName, importIndex) { functors[20]({ imports(entries) { const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./error/assert.js", 9); }, liveVar: { }, onceVar: { - makeEvalFunction: cells[20].makeEvalFunction.set, + default: cells[20].default.set, }, importMeta: {}, }); functors[21]({ imports(entries) { const map = new Map(entries); - observeImports(map, "./commons.js", 0); - observeImports(map, "./error/assert.js", 8); }, liveVar: { }, onceVar: { - makeFunctionConstructor: cells[21].makeFunctionConstructor.set, + makeEvalFunction: cells[21].makeEvalFunction.set, }, importMeta: {}, }); @@ -10789,17 +11494,12 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); - observeImports(map, "./make-eval-function.js", 20); - observeImports(map, "./make-function-constructor.js", 21); - observeImports(map, "./permits.js", 10); + observeImports(map, "./error/assert.js", 9); }, liveVar: { }, onceVar: { - setGlobalObjectSymbolUnscopables: cells[22].setGlobalObjectSymbolUnscopables.set, - setGlobalObjectConstantProperties: cells[22].setGlobalObjectConstantProperties.set, - setGlobalObjectMutableProperties: cells[22].setGlobalObjectMutableProperties.set, - setGlobalObjectEvaluators: cells[22].setGlobalObjectEvaluators.set, + makeFunctionConstructor: cells[22].makeFunctionConstructor.set, }, importMeta: {}, }); @@ -10807,14 +11507,17 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); - observeImports(map, "./error/assert.js", 8); + observeImports(map, "./make-eval-function.js", 21); + observeImports(map, "./make-function-constructor.js", 22); + observeImports(map, "./permits.js", 11); }, liveVar: { }, onceVar: { - alwaysThrowHandler: cells[23].alwaysThrowHandler.set, - strictScopeTerminatorHandler: cells[23].strictScopeTerminatorHandler.set, - strictScopeTerminator: cells[23].strictScopeTerminator.set, + setGlobalObjectSymbolUnscopables: cells[23].setGlobalObjectSymbolUnscopables.set, + setGlobalObjectConstantProperties: cells[23].setGlobalObjectConstantProperties.set, + setGlobalObjectMutableProperties: cells[23].setGlobalObjectMutableProperties.set, + setGlobalObjectEvaluators: cells[23].setGlobalObjectEvaluators.set, }, importMeta: {}, }); @@ -10822,12 +11525,14 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); - observeImports(map, "./strict-scope-terminator.js", 23); + observeImports(map, "./error/assert.js", 9); }, liveVar: { }, onceVar: { - createSloppyGlobalsScopeTerminator: cells[24].createSloppyGlobalsScopeTerminator.set, + alwaysThrowHandler: cells[24].alwaysThrowHandler.set, + strictScopeTerminatorHandler: cells[24].strictScopeTerminatorHandler.set, + strictScopeTerminator: cells[24].strictScopeTerminator.set, }, importMeta: {}, }); @@ -10835,12 +11540,12 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); - observeImports(map, "./error/assert.js", 8); + observeImports(map, "./strict-scope-terminator.js", 24); }, liveVar: { }, onceVar: { - makeEvalScopeKit: cells[25].makeEvalScopeKit.set, + createSloppyGlobalsScopeTerminator: cells[25].createSloppyGlobalsScopeTerminator.set, }, importMeta: {}, }); @@ -10848,11 +11553,12 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); + observeImports(map, "./error/assert.js", 9); }, liveVar: { }, onceVar: { - getSourceURL: cells[26].getSourceURL.set, + makeEvalScopeKit: cells[26].makeEvalScopeKit.set, }, importMeta: {}, }); @@ -10860,19 +11566,11 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); - observeImports(map, "./get-source-url.js", 26); }, liveVar: { }, onceVar: { - rejectHtmlComments: cells[27].rejectHtmlComments.set, - evadeHtmlCommentTest: cells[27].evadeHtmlCommentTest.set, - rejectImportExpressions: cells[27].rejectImportExpressions.set, - evadeImportExpressionTest: cells[27].evadeImportExpressionTest.set, - rejectSomeDirectEvalExpressions: cells[27].rejectSomeDirectEvalExpressions.set, - mandatoryTransforms: cells[27].mandatoryTransforms.set, - applyTransforms: cells[27].applyTransforms.set, - transforms: cells[27].transforms.set, + getSourceURL: cells[27].getSourceURL.set, }, importMeta: {}, }); @@ -10880,12 +11578,19 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); + observeImports(map, "./get-source-url.js", 27); }, liveVar: { }, onceVar: { - isValidIdentifierName: cells[28].isValidIdentifierName.set, - getScopeConstants: cells[28].getScopeConstants.set, + rejectHtmlComments: cells[28].rejectHtmlComments.set, + evadeHtmlCommentTest: cells[28].evadeHtmlCommentTest.set, + rejectImportExpressions: cells[28].rejectImportExpressions.set, + evadeImportExpressionTest: cells[28].evadeImportExpressionTest.set, + rejectSomeDirectEvalExpressions: cells[28].rejectSomeDirectEvalExpressions.set, + mandatoryTransforms: cells[28].mandatoryTransforms.set, + applyTransforms: cells[28].applyTransforms.set, + transforms: cells[28].transforms.set, }, importMeta: {}, }); @@ -10893,12 +11598,12 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); - observeImports(map, "./scope-constants.js", 28); }, liveVar: { }, onceVar: { - makeEvaluate: cells[29].makeEvaluate.set, + isValidIdentifierName: cells[29].isValidIdentifierName.set, + getScopeConstants: cells[29].getScopeConstants.set, }, importMeta: {}, }); @@ -10906,17 +11611,12 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); - observeImports(map, "./strict-scope-terminator.js", 23); - observeImports(map, "./sloppy-globals-scope-terminator.js", 24); - observeImports(map, "./eval-scope.js", 25); - observeImports(map, "./transforms.js", 27); - observeImports(map, "./make-evaluate.js", 29); - observeImports(map, "./error/assert.js", 8); + observeImports(map, "./scope-constants.js", 29); }, liveVar: { }, onceVar: { - makeSafeEvaluator: cells[30].makeSafeEvaluator.set, + makeEvaluate: cells[30].makeEvaluate.set, }, importMeta: {}, }); @@ -10924,11 +11624,17 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); + observeImports(map, "./strict-scope-terminator.js", 24); + observeImports(map, "./sloppy-globals-scope-terminator.js", 25); + observeImports(map, "./eval-scope.js", 26); + observeImports(map, "./transforms.js", 28); + observeImports(map, "./make-evaluate.js", 30); + observeImports(map, "./error/assert.js", 9); }, liveVar: { }, onceVar: { - tameFunctionToString: cells[31].tameFunctionToString.set, + makeSafeEvaluator: cells[31].makeSafeEvaluator.set, }, importMeta: {}, }); @@ -10940,24 +11646,19 @@ function observeImports(map, importName, importIndex) { liveVar: { }, onceVar: { - tameDomains: cells[32].tameDomains.set, + tameFunctionToString: cells[32].tameFunctionToString.set, }, importMeta: {}, }); functors[33]({ imports(entries) { const map = new Map(entries); - observeImports(map, "../commons.js", 0); - observeImports(map, "./types.js", 5); - observeImports(map, "./internal-types.js", 6); + observeImports(map, "./commons.js", 0); }, liveVar: { }, onceVar: { - makeLoggingConsoleKit: cells[33].makeLoggingConsoleKit.set, - makeCausalConsole: cells[33].makeCausalConsole.set, - filterConsole: cells[33].filterConsole.set, - consoleWhitelist: cells[33].consoleWhitelist.set, + tameDomains: cells[33].tameDomains.set, }, importMeta: {}, }); @@ -10965,11 +11666,19 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "../commons.js", 0); + observeImports(map, "./types.js", 5); + observeImports(map, "./internal-types.js", 6); }, liveVar: { }, onceVar: { - makeRejectionHandlers: cells[34].makeRejectionHandlers.set, + consoleLevelMethods: cells[34].consoleLevelMethods.set, + consoleOtherMethods: cells[34].consoleOtherMethods.set, + makeLoggingConsoleKit: cells[34].makeLoggingConsoleKit.set, + pumpLogToConsole: cells[34].pumpLogToConsole.set, + makeCausalConsole: cells[34].makeCausalConsole.set, + defineCausalConsoleFromLogger: cells[34].defineCausalConsoleFromLogger.set, + filterConsole: cells[34].filterConsole.set, }, importMeta: {}, }); @@ -10977,16 +11686,11 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "../commons.js", 0); - observeImports(map, "./assert.js", 8); - observeImports(map, "./console.js", 33); - observeImports(map, "./unhandled-rejection.js", 34); - observeImports(map, "./types.js", 5); - observeImports(map, "./internal-types.js", 6); }, liveVar: { }, onceVar: { - tameConsole: cells[35].tameConsole.set, + makeRejectionHandlers: cells[35].makeRejectionHandlers.set, }, importMeta: {}, }); @@ -10994,13 +11698,16 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "../commons.js", 0); + observeImports(map, "./assert.js", 9); + observeImports(map, "./console.js", 34); + observeImports(map, "./unhandled-rejection.js", 35); + observeImports(map, "./types.js", 5); + observeImports(map, "./internal-types.js", 6); }, liveVar: { }, onceVar: { - filterFileName: cells[36].filterFileName.set, - shortenCallSiteString: cells[36].shortenCallSiteString.set, - tameV8ErrorConstructor: cells[36].tameV8ErrorConstructor.set, + tameConsole: cells[36].tameConsole.set, }, importMeta: {}, }); @@ -11008,110 +11715,104 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "../commons.js", 0); - observeImports(map, "../permits.js", 10); - observeImports(map, "./tame-v8-error-constructor.js", 36); }, liveVar: { }, onceVar: { - default: cells[37].default.set, + filterFileName: cells[37].filterFileName.set, + shortenCallSiteString: cells[37].shortenCallSiteString.set, + tameV8ErrorConstructor: cells[37].tameV8ErrorConstructor.set, }, importMeta: {}, }); functors[38]({ imports(entries) { const map = new Map(entries); - observeImports(map, "./commons.js", 0); - observeImports(map, "./error/assert.js", 8); + observeImports(map, "../commons.js", 0); + observeImports(map, "../permits.js", 11); + observeImports(map, "./tame-v8-error-constructor.js", 37); }, liveVar: { }, onceVar: { - makeAlias: cells[38].makeAlias.set, - load: cells[38].load.set, + default: cells[38].default.set, }, importMeta: {}, }); functors[39]({ imports(entries) { const map = new Map(entries); - observeImports(map, "./module-load.js", 38); + observeImports(map, "@endo/env-options", 3); observeImports(map, "./commons.js", 0); - observeImports(map, "./error/assert.js", 8); + observeImports(map, "./error/assert.js", 9); }, liveVar: { }, onceVar: { - deferExports: cells[39].deferExports.set, - getDeferredExports: cells[39].getDeferredExports.set, + makeAlias: cells[39].makeAlias.set, + load: cells[39].load.set, + loadNow: cells[39].loadNow.set, }, importMeta: {}, }); functors[40]({ imports(entries) { const map = new Map(entries); + observeImports(map, "./module-load.js", 39); observeImports(map, "./commons.js", 0); - observeImports(map, "./transforms.js", 27); - observeImports(map, "./make-safe-evaluator.js", 30); + observeImports(map, "./error/assert.js", 9); }, liveVar: { }, onceVar: { - provideCompartmentEvaluator: cells[40].provideCompartmentEvaluator.set, - compartmentEvaluate: cells[40].compartmentEvaluate.set, + deferExports: cells[40].deferExports.set, + getDeferredExports: cells[40].getDeferredExports.set, }, importMeta: {}, }); functors[41]({ imports(entries) { const map = new Map(entries); - observeImports(map, "./error/assert.js", 8); - observeImports(map, "./module-proxy.js", 39); observeImports(map, "./commons.js", 0); - observeImports(map, "./compartment-evaluate.js", 40); + observeImports(map, "./transforms.js", 28); + observeImports(map, "./make-safe-evaluator.js", 31); }, liveVar: { }, onceVar: { - makeThirdPartyModuleInstance: cells[41].makeThirdPartyModuleInstance.set, - makeModuleInstance: cells[41].makeModuleInstance.set, + provideCompartmentEvaluator: cells[41].provideCompartmentEvaluator.set, + compartmentEvaluate: cells[41].compartmentEvaluate.set, }, importMeta: {}, }); functors[42]({ imports(entries) { const map = new Map(entries); - observeImports(map, "./error/assert.js", 8); - observeImports(map, "./module-instance.js", 41); + observeImports(map, "./error/assert.js", 9); + observeImports(map, "./module-proxy.js", 40); observeImports(map, "./commons.js", 0); + observeImports(map, "./compartment-evaluate.js", 41); }, liveVar: { }, onceVar: { - link: cells[42].link.set, - instantiate: cells[42].instantiate.set, + makeThirdPartyModuleInstance: cells[42].makeThirdPartyModuleInstance.set, + makeModuleInstance: cells[42].makeModuleInstance.set, }, importMeta: {}, }); functors[43]({ imports(entries) { const map = new Map(entries); + observeImports(map, "./error/assert.js", 9); + observeImports(map, "./module-instance.js", 42); observeImports(map, "./commons.js", 0); - observeImports(map, "./global-object.js", 22); - observeImports(map, "./permits.js", 10); - observeImports(map, "./module-load.js", 38); - observeImports(map, "./module-link.js", 42); - observeImports(map, "./module-proxy.js", 39); - observeImports(map, "./error/assert.js", 8); - observeImports(map, "./compartment-evaluate.js", 40); - observeImports(map, "./make-safe-evaluator.js", 30); }, liveVar: { }, onceVar: { - InertCompartment: cells[43].InertCompartment.set, - CompartmentPrototype: cells[43].CompartmentPrototype.set, - makeCompartmentConstructor: cells[43].makeCompartmentConstructor.set, + link: cells[43].link.set, + instantiate: cells[43].instantiate.set, }, importMeta: {}, }); @@ -11119,12 +11820,21 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); - observeImports(map, "./compartment.js", 43); + observeImports(map, "./global-object.js", 23); + observeImports(map, "./permits.js", 11); + observeImports(map, "./module-load.js", 39); + observeImports(map, "./module-link.js", 43); + observeImports(map, "./module-proxy.js", 40); + observeImports(map, "./error/assert.js", 9); + observeImports(map, "./compartment-evaluate.js", 41); + observeImports(map, "./make-safe-evaluator.js", 31); }, liveVar: { }, onceVar: { - getAnonymousIntrinsics: cells[44].getAnonymousIntrinsics.set, + InertCompartment: cells[44].InertCompartment.set, + CompartmentPrototype: cells[44].CompartmentPrototype.set, + makeCompartmentConstructor: cells[44].makeCompartmentConstructor.set, }, importMeta: {}, }); @@ -11132,11 +11842,12 @@ function observeImports(map, importName, importIndex) { imports(entries) { const map = new Map(entries); observeImports(map, "./commons.js", 0); + observeImports(map, "./compartment.js", 44); }, liveVar: { }, onceVar: { - tameHarden: cells[45].tameHarden.set, + getAnonymousIntrinsics: cells[45].getAnonymousIntrinsics.set, }, importMeta: {}, }); @@ -11148,76 +11859,76 @@ function observeImports(map, importName, importIndex) { liveVar: { }, onceVar: { - tameSymbolConstructor: cells[46].tameSymbolConstructor.set, + tameHarden: cells[46].tameHarden.set, }, importMeta: {}, }); functors[47]({ imports(entries) { const map = new Map(entries); - observeImports(map, "@endo/env-options", 3); observeImports(map, "./commons.js", 0); - observeImports(map, "./make-hardener.js", 9); - observeImports(map, "./intrinsics.js", 11); - observeImports(map, "./permits-intrinsics.js", 12); - observeImports(map, "./tame-function-constructors.js", 13); - observeImports(map, "./tame-date-constructor.js", 14); - observeImports(map, "./tame-math-object.js", 15); - observeImports(map, "./tame-regexp-constructor.js", 16); - observeImports(map, "./enable-property-overrides.js", 18); - observeImports(map, "./tame-locale-methods.js", 19); - observeImports(map, "./global-object.js", 22); - observeImports(map, "./make-safe-evaluator.js", 30); - observeImports(map, "./permits.js", 10); - observeImports(map, "./tame-function-tostring.js", 31); - observeImports(map, "./tame-domains.js", 32); - observeImports(map, "./error/tame-console.js", 35); - observeImports(map, "./error/tame-error-constructor.js", 37); - observeImports(map, "./error/assert.js", 8); - observeImports(map, "./get-anonymous-intrinsics.js", 44); - observeImports(map, "./compartment.js", 43); - observeImports(map, "./tame-harden.js", 45); - observeImports(map, "./tame-symbol-constructor.js", 46); }, liveVar: { }, onceVar: { - repairIntrinsics: cells[47].repairIntrinsics.set, + tameSymbolConstructor: cells[47].tameSymbolConstructor.set, }, importMeta: {}, }); functors[48]({ imports(entries) { const map = new Map(entries); - observeImports(map, "./assert-sloppy-mode.js", 1); observeImports(map, "./commons.js", 0); - observeImports(map, "./lockdown.js", 47); }, liveVar: { }, onceVar: { + tameFauxDataProperty: cells[48].tameFauxDataProperty.set, + tameFauxDataProperties: cells[48].tameFauxDataProperties.set, }, importMeta: {}, }); functors[49]({ imports(entries) { const map = new Map(entries); + observeImports(map, "@endo/env-options", 3); observeImports(map, "./commons.js", 0); - observeImports(map, "./compartment.js", 43); - observeImports(map, "./tame-function-tostring.js", 31); - observeImports(map, "./intrinsics.js", 11); + observeImports(map, "./make-hardener.js", 10); + observeImports(map, "./intrinsics.js", 12); + observeImports(map, "./permits-intrinsics.js", 13); + observeImports(map, "./tame-function-constructors.js", 14); + observeImports(map, "./tame-date-constructor.js", 15); + observeImports(map, "./tame-math-object.js", 16); + observeImports(map, "./tame-regexp-constructor.js", 17); + observeImports(map, "./enable-property-overrides.js", 19); + observeImports(map, "./tame-locale-methods.js", 20); + observeImports(map, "./global-object.js", 23); + observeImports(map, "./make-safe-evaluator.js", 31); + observeImports(map, "./permits.js", 11); + observeImports(map, "./tame-function-tostring.js", 32); + observeImports(map, "./tame-domains.js", 33); + observeImports(map, "./error/tame-console.js", 36); + observeImports(map, "./error/tame-error-constructor.js", 38); + observeImports(map, "./error/assert.js", 9); + observeImports(map, "./get-anonymous-intrinsics.js", 45); + observeImports(map, "./compartment.js", 44); + observeImports(map, "./tame-harden.js", 46); + observeImports(map, "./tame-symbol-constructor.js", 47); + observeImports(map, "./tame-faux-data-properties.js", 48); }, liveVar: { }, onceVar: { + repairIntrinsics: cells[49].repairIntrinsics.set, }, importMeta: {}, }); functors[50]({ imports(entries) { const map = new Map(entries); + observeImports(map, "./assert-sloppy-mode.js", 1); observeImports(map, "./commons.js", 0); - observeImports(map, "./error/assert.js", 8); + observeImports(map, "./lockdown.js", 49); }, liveVar: { }, @@ -11228,9 +11939,49 @@ function observeImports(map, importName, importIndex) { functors[51]({ imports(entries) { const map = new Map(entries); - observeImports(map, "./src/lockdown-shim.js", 48); - observeImports(map, "./src/compartment-shim.js", 49); - observeImports(map, "./src/assert-shim.js", 50); + observeImports(map, "./commons.js", 0); + observeImports(map, "./compartment.js", 44); + observeImports(map, "./tame-function-tostring.js", 32); + observeImports(map, "./intrinsics.js", 12); + }, + liveVar: { + }, + onceVar: { + }, + importMeta: {}, + }); + functors[52]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./error/assert.js", 9); + }, + liveVar: { + }, + onceVar: { + }, + importMeta: {}, + }); + functors[53]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./commons.js", 0); + observeImports(map, "./error/console.js", 34); + observeImports(map, "./error/assert.js", 9); + }, + liveVar: { + }, + onceVar: { + }, + importMeta: {}, + }); + functors[54]({ + imports(entries) { + const map = new Map(entries); + observeImports(map, "./src/lockdown-shim.js", 50); + observeImports(map, "./src/compartment-shim.js", 51); + observeImports(map, "./src/assert-shim.js", 52); + observeImports(map, "./src/console-shim.js", 53); }, liveVar: { }, From bb4ccd06325e1256107516cf8a9df6a996a8c3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Fri, 1 Nov 2024 12:33:16 -0300 Subject: [PATCH 29/47] feat: patched intl to work in SES --- patches/intl+1.2.5.patch | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 patches/intl+1.2.5.patch diff --git a/patches/intl+1.2.5.patch b/patches/intl+1.2.5.patch new file mode 100644 index 000000000..347be4762 --- /dev/null +++ b/patches/intl+1.2.5.patch @@ -0,0 +1,45 @@ +diff --git a/node_modules/intl/lib/core.js b/node_modules/intl/lib/core.js +index 9334cfc..78e7f06 100644 +--- a/node_modules/intl/lib/core.js ++++ b/node_modules/intl/lib/core.js +@@ -591,7 +591,8 @@ function createRegExpRestore() { + + // Set the lastIndex of the generated expression to ensure that the match + // is found in the correct index. +- expr.lastIndex = regExpCache.leftContext.length; ++ const leftContext = regExpCache.leftContext || ''; ++ expr.lastIndex = leftContext.length; + + expr.exec(regExpCache.input); + }; +@@ -4291,13 +4292,26 @@ defineProperty(Intl, '__applyLocaleSensitivePrototypes', { + writable: true, + configurable: true, + value: function value() { +- defineProperty(Number.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Number.toLocaleString }); +- // Need this here for IE 8, to avoid the _DontEnum_ bug +- defineProperty(Date.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Date.toLocaleString }); ++ // Create wrapper functions for locale operations ++ const localeHelpers = { ++ formatNumber: function(num) { ++ return ls.Number.toLocaleString.call(num); ++ }, ++ formatDate: function(date) { ++ return ls.Date.toLocaleString.call(date); ++ } ++ }; + ++ // Add other Date methods from ls.Date + for (var k in ls.Date) { +- if (hop.call(ls.Date, k)) defineProperty(Date.prototype, k, { writable: true, configurable: true, value: ls.Date[k] }); ++ if (hop.call(ls.Date, k)) { ++ localeHelpers[`date_${k}`] = function(date) { ++ return ls.Date[k].call(date); ++ }; ++ } + } ++ ++ return localeHelpers; + } + }); + From 4d4c8a1485570378479e6aa9fe7f30981b7292dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Fri, 1 Nov 2024 18:42:52 -0300 Subject: [PATCH 30/47] refactor: updated react-native patch import order --- patches/react-native+0.72.5.patch | 1525 ++++++++++++++++++++++++++++- 1 file changed, 1516 insertions(+), 9 deletions(-) diff --git a/patches/react-native+0.72.5.patch b/patches/react-native+0.72.5.patch index deeebffa8..fc2d26347 100644 --- a/patches/react-native+0.72.5.patch +++ b/patches/react-native+0.72.5.patch @@ -1,11 +1,31 @@ diff --git a/node_modules/react-native/Libraries/Core/InitializeCore.js b/node_modules/react-native/Libraries/Core/InitializeCore.js -index 25377f6..cd98bb5 100644 +index 25377f6..18193d4 100644 --- a/node_modules/react-native/Libraries/Core/InitializeCore.js +++ b/node_modules/react-native/Libraries/Core/InitializeCore.js -@@ -24,6 +24,47 @@ +@@ -26,6 +26,9 @@ - 'use strict'; + const start = Date.now(); ++require('./setUpXHR'); ++// setUpSES should be imported after setUpXHR because setUpXHR adds AbortController: ++require('./setUpSES'); + require('./setUpGlobals'); + require('./setUpDOM'); + require('./setUpPerformance'); +@@ -33,7 +36,6 @@ require('./setUpErrorHandling'); + require('./polyfillPromise'); + require('./setUpRegeneratorRuntime'); + require('./setUpTimers'); +-require('./setUpXHR'); + require('./setUpAlert'); + require('./setUpNavigator'); + require('./setUpBatchedBridge'); +diff --git a/node_modules/react-native/Libraries/Core/setUpSES.js b/node_modules/react-native/Libraries/Core/setUpSES.js +new file mode 100644 +index 0000000..6f3dbbf +--- /dev/null ++++ b/node_modules/react-native/Libraries/Core/setUpSES.js +@@ -0,0 +1,38 @@ +import { MMKV } from 'react-native-mmkv'; +import { SHOULD_ENABLE_SES_STORAGE_KEY } from '../../../../src/constants'; + @@ -19,11 +39,9 @@ index 25377f6..cd98bb5 100644 + storage.set(SHOULD_ENABLE_SES_STORAGE_KEY, true); +} + -+const Platform = require('../Utilities/Platform'); -+ +// This piece of code was taken from this PR: https://github.com/MetaMask/metamask-mobile/pull/6586/files +// which is the reference implementation of SES On react-native -+if (isSesEnabled && Platform.OS === 'ios' && !global?.HermesInternal) { ++if (isSesEnabled && !global?.HermesInternal) { + require('../../../../lockdown.umd.js'); + + /** @@ -46,7 +64,1496 @@ index 25377f6..cd98bb5 100644 + + hardenIntrinsics(); +} +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h +new file mode 100644 +index 0000000..37b7d8d +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h +@@ -0,0 +1,29 @@ + - const start = Date.now(); - - require('./setUpGlobals'); ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateComponentDescriptorH.js ++ */ ++ ++#pragma once ++ ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++using AndroidHorizontalScrollContentViewComponentDescriptor = ConcreteComponentDescriptor; ++using AndroidSwipeRefreshLayoutComponentDescriptor = ConcreteComponentDescriptor; ++using PullToRefreshViewComponentDescriptor = ConcreteComponentDescriptor; ++using AndroidDrawerLayoutComponentDescriptor = ConcreteComponentDescriptor; ++using ActivityIndicatorViewComponentDescriptor = ConcreteComponentDescriptor; ++using UnimplementedNativeViewComponentDescriptor = ConcreteComponentDescriptor; ++using SwitchComponentDescriptor = ConcreteComponentDescriptor; ++using TraceUpdateOverlayComponentDescriptor = ConcreteComponentDescriptor; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp +new file mode 100644 +index 0000000..229fadc +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp +@@ -0,0 +1,111 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateEventEmitterCpp.js ++ */ ++ ++#include ++ ++namespace facebook { ++namespace react { ++ ++ ++ ++ ++void AndroidSwipeRefreshLayoutEventEmitter::onRefresh(OnRefresh event) const { ++ dispatchEvent("refresh", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void PullToRefreshViewEventEmitter::onRefresh(OnRefresh event) const { ++ dispatchEvent("refresh", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++ ++void AndroidDrawerLayoutEventEmitter::onDrawerSlide(OnDrawerSlide event) const { ++ dispatchEvent("drawerSlide", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "offset", event.offset); ++ return payload; ++ }); ++} ++void AndroidDrawerLayoutEventEmitter::onDrawerStateChanged(OnDrawerStateChanged event) const { ++ dispatchEvent("drawerStateChanged", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "drawerState", event.drawerState); ++ return payload; ++ }); ++} ++void AndroidDrawerLayoutEventEmitter::onDrawerOpen(OnDrawerOpen event) const { ++ dispatchEvent("drawerOpen", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void AndroidDrawerLayoutEventEmitter::onDrawerClose(OnDrawerClose event) const { ++ dispatchEvent("drawerClose", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++ ++ ++void SwitchEventEmitter::onChange(OnChange event) const { ++ dispatchEvent("change", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "value", event.value); ++payload.setProperty(runtime, "target", event.target); ++ return payload; ++ }); ++} ++void AndroidSwitchEventEmitter::onChange(OnChange event) const { ++ dispatchEvent("change", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "value", event.value); ++payload.setProperty(runtime, "target", event.target); ++ return payload; ++ }); ++} ++ ++void ModalHostViewEventEmitter::onRequestClose(OnRequestClose event) const { ++ dispatchEvent("requestClose", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void ModalHostViewEventEmitter::onShow(OnShow event) const { ++ dispatchEvent("show", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void ModalHostViewEventEmitter::onDismiss(OnDismiss event) const { ++ dispatchEvent("dismiss", [](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ ++ return payload; ++ }); ++} ++void ModalHostViewEventEmitter::onOrientationChange(OnOrientationChange event) const { ++ dispatchEvent("orientationChange", [event=std::move(event)](jsi::Runtime &runtime) { ++ auto payload = jsi::Object(runtime); ++ payload.setProperty(runtime, "orientation", toString(event.orientation)); ++ return payload; ++ }); ++} ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h +new file mode 100644 +index 0000000..1897be1 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h +@@ -0,0 +1,186 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateEventEmitterH.js ++ */ ++#pragma once ++ ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++class JSI_EXPORT SafeAreaViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT AndroidHorizontalScrollContentViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT AndroidProgressBarEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT AndroidSwipeRefreshLayoutEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnRefresh { ++ ++ }; ++ ++ void onRefresh(OnRefresh value) const; ++}; ++class JSI_EXPORT PullToRefreshViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnRefresh { ++ ++ }; ++ ++ void onRefresh(OnRefresh value) const; ++}; ++class JSI_EXPORT InputAccessoryEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT AndroidDrawerLayoutEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnDrawerSlide { ++ Float offset; ++ }; ++ ++ struct OnDrawerStateChanged { ++ int drawerState; ++ }; ++ ++ struct OnDrawerOpen { ++ ++ }; ++ ++ struct OnDrawerClose { ++ ++ }; ++ ++ void onDrawerSlide(OnDrawerSlide value) const; ++ ++ void onDrawerStateChanged(OnDrawerStateChanged value) const; ++ ++ void onDrawerOpen(OnDrawerOpen value) const; ++ ++ void onDrawerClose(OnDrawerClose value) const; ++}; ++class JSI_EXPORT ActivityIndicatorViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT UnimplementedNativeViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT SwitchEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnChange { ++ bool value; ++ int target; ++ }; ++ ++ void onChange(OnChange value) const; ++}; ++class JSI_EXPORT AndroidSwitchEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnChange { ++ bool value; ++ int target; ++ }; ++ ++ void onChange(OnChange value) const; ++}; ++class JSI_EXPORT TraceUpdateOverlayEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ ++ ++ ++}; ++class JSI_EXPORT ModalHostViewEventEmitter : public ViewEventEmitter { ++ public: ++ using ViewEventEmitter::ViewEventEmitter; ++ ++ struct OnRequestClose { ++ ++ }; ++ ++ struct OnShow { ++ ++ }; ++ ++ struct OnDismiss { ++ ++ }; ++ ++ enum class OnOrientationChangeOrientation { ++ Portrait, ++ Landscape ++ }; ++ ++ static char const *toString(const OnOrientationChangeOrientation value) { ++ switch (value) { ++ case OnOrientationChangeOrientation::Portrait: return "portrait"; ++ case OnOrientationChangeOrientation::Landscape: return "landscape"; ++ } ++ } ++ ++ struct OnOrientationChange { ++ OnOrientationChangeOrientation orientation; ++ }; ++ ++ void onRequestClose(OnRequestClose value) const; ++ ++ void onShow(OnShow value) const; ++ ++ void onDismiss(OnDismiss value) const; ++ ++ void onOrientationChange(OnOrientationChange value) const; ++}; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp +new file mode 100644 +index 0000000..59f24e5 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp +@@ -0,0 +1,157 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GeneratePropsCpp.js ++ */ ++ ++#include ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++SafeAreaViewProps::SafeAreaViewProps( ++ const PropsParserContext &context, ++ const SafeAreaViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) ++ ++ ++ {} ++AndroidHorizontalScrollContentViewProps::AndroidHorizontalScrollContentViewProps( ++ const PropsParserContext &context, ++ const AndroidHorizontalScrollContentViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ removeClippedSubviews(convertRawProp(context, rawProps, "removeClippedSubviews", sourceProps.removeClippedSubviews, {false})) ++ {} ++AndroidProgressBarProps::AndroidProgressBarProps( ++ const PropsParserContext &context, ++ const AndroidProgressBarProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ styleAttr(convertRawProp(context, rawProps, "styleAttr", sourceProps.styleAttr, {})), ++ typeAttr(convertRawProp(context, rawProps, "typeAttr", sourceProps.typeAttr, {})), ++ indeterminate(convertRawProp(context, rawProps, "indeterminate", sourceProps.indeterminate, {false})), ++ progress(convertRawProp(context, rawProps, "progress", sourceProps.progress, {0.0})), ++ animating(convertRawProp(context, rawProps, "animating", sourceProps.animating, {true})), ++ color(convertRawProp(context, rawProps, "color", sourceProps.color, {})), ++ testID(convertRawProp(context, rawProps, "testID", sourceProps.testID, {""})) ++ {} ++AndroidSwipeRefreshLayoutProps::AndroidSwipeRefreshLayoutProps( ++ const PropsParserContext &context, ++ const AndroidSwipeRefreshLayoutProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ enabled(convertRawProp(context, rawProps, "enabled", sourceProps.enabled, {true})), ++ colors(convertRawProp(context, rawProps, "colors", sourceProps.colors, {})), ++ progressBackgroundColor(convertRawProp(context, rawProps, "progressBackgroundColor", sourceProps.progressBackgroundColor, {})), ++ size(convertRawProp(context, rawProps, "size", sourceProps.size, {AndroidSwipeRefreshLayoutSize::Default})), ++ progressViewOffset(convertRawProp(context, rawProps, "progressViewOffset", sourceProps.progressViewOffset, {0.0})), ++ refreshing(convertRawProp(context, rawProps, "refreshing", sourceProps.refreshing, {false})) ++ {} ++PullToRefreshViewProps::PullToRefreshViewProps( ++ const PropsParserContext &context, ++ const PullToRefreshViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ tintColor(convertRawProp(context, rawProps, "tintColor", sourceProps.tintColor, {})), ++ titleColor(convertRawProp(context, rawProps, "titleColor", sourceProps.titleColor, {})), ++ title(convertRawProp(context, rawProps, "title", sourceProps.title, {})), ++ progressViewOffset(convertRawProp(context, rawProps, "progressViewOffset", sourceProps.progressViewOffset, {0.0})), ++ refreshing(convertRawProp(context, rawProps, "refreshing", sourceProps.refreshing, {false})) ++ {} ++InputAccessoryProps::InputAccessoryProps( ++ const PropsParserContext &context, ++ const InputAccessoryProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ backgroundColor(convertRawProp(context, rawProps, "backgroundColor", sourceProps.backgroundColor, {})) ++ {} ++AndroidDrawerLayoutProps::AndroidDrawerLayoutProps( ++ const PropsParserContext &context, ++ const AndroidDrawerLayoutProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ keyboardDismissMode(convertRawProp(context, rawProps, "keyboardDismissMode", sourceProps.keyboardDismissMode, {AndroidDrawerLayoutKeyboardDismissMode::None})), ++ drawerBackgroundColor(convertRawProp(context, rawProps, "drawerBackgroundColor", sourceProps.drawerBackgroundColor, {})), ++ drawerPosition(convertRawProp(context, rawProps, "drawerPosition", sourceProps.drawerPosition, {AndroidDrawerLayoutDrawerPosition::Left})), ++ drawerWidth(convertRawProp(context, rawProps, "drawerWidth", sourceProps.drawerWidth, {})), ++ drawerLockMode(convertRawProp(context, rawProps, "drawerLockMode", sourceProps.drawerLockMode, {AndroidDrawerLayoutDrawerLockMode::Unlocked})), ++ statusBarBackgroundColor(convertRawProp(context, rawProps, "statusBarBackgroundColor", sourceProps.statusBarBackgroundColor, {})) ++ {} ++ActivityIndicatorViewProps::ActivityIndicatorViewProps( ++ const PropsParserContext &context, ++ const ActivityIndicatorViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ hidesWhenStopped(convertRawProp(context, rawProps, "hidesWhenStopped", sourceProps.hidesWhenStopped, {false})), ++ animating(convertRawProp(context, rawProps, "animating", sourceProps.animating, {false})), ++ color(convertRawProp(context, rawProps, "color", sourceProps.color, {})), ++ size(convertRawProp(context, rawProps, "size", sourceProps.size, {ActivityIndicatorViewSize::Small})) ++ {} ++UnimplementedNativeViewProps::UnimplementedNativeViewProps( ++ const PropsParserContext &context, ++ const UnimplementedNativeViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ name(convertRawProp(context, rawProps, "name", sourceProps.name, {""})) ++ {} ++SwitchProps::SwitchProps( ++ const PropsParserContext &context, ++ const SwitchProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ disabled(convertRawProp(context, rawProps, "disabled", sourceProps.disabled, {false})), ++ value(convertRawProp(context, rawProps, "value", sourceProps.value, {false})), ++ tintColor(convertRawProp(context, rawProps, "tintColor", sourceProps.tintColor, {})), ++ onTintColor(convertRawProp(context, rawProps, "onTintColor", sourceProps.onTintColor, {})), ++ thumbTintColor(convertRawProp(context, rawProps, "thumbTintColor", sourceProps.thumbTintColor, {})), ++ thumbColor(convertRawProp(context, rawProps, "thumbColor", sourceProps.thumbColor, {})), ++ trackColorForFalse(convertRawProp(context, rawProps, "trackColorForFalse", sourceProps.trackColorForFalse, {})), ++ trackColorForTrue(convertRawProp(context, rawProps, "trackColorForTrue", sourceProps.trackColorForTrue, {})) ++ {} ++AndroidSwitchProps::AndroidSwitchProps( ++ const PropsParserContext &context, ++ const AndroidSwitchProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ disabled(convertRawProp(context, rawProps, "disabled", sourceProps.disabled, {false})), ++ enabled(convertRawProp(context, rawProps, "enabled", sourceProps.enabled, {true})), ++ thumbColor(convertRawProp(context, rawProps, "thumbColor", sourceProps.thumbColor, {})), ++ trackColorForFalse(convertRawProp(context, rawProps, "trackColorForFalse", sourceProps.trackColorForFalse, {})), ++ trackColorForTrue(convertRawProp(context, rawProps, "trackColorForTrue", sourceProps.trackColorForTrue, {})), ++ value(convertRawProp(context, rawProps, "value", sourceProps.value, {false})), ++ on(convertRawProp(context, rawProps, "on", sourceProps.on, {false})), ++ thumbTintColor(convertRawProp(context, rawProps, "thumbTintColor", sourceProps.thumbTintColor, {})), ++ trackTintColor(convertRawProp(context, rawProps, "trackTintColor", sourceProps.trackTintColor, {})) ++ {} ++TraceUpdateOverlayProps::TraceUpdateOverlayProps( ++ const PropsParserContext &context, ++ const TraceUpdateOverlayProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) ++ ++ ++ {} ++ModalHostViewProps::ModalHostViewProps( ++ const PropsParserContext &context, ++ const ModalHostViewProps &sourceProps, ++ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), ++ ++ animationType(convertRawProp(context, rawProps, "animationType", sourceProps.animationType, {ModalHostViewAnimationType::None})), ++ presentationStyle(convertRawProp(context, rawProps, "presentationStyle", sourceProps.presentationStyle, {ModalHostViewPresentationStyle::FullScreen})), ++ transparent(convertRawProp(context, rawProps, "transparent", sourceProps.transparent, {false})), ++ statusBarTranslucent(convertRawProp(context, rawProps, "statusBarTranslucent", sourceProps.statusBarTranslucent, {false})), ++ hardwareAccelerated(convertRawProp(context, rawProps, "hardwareAccelerated", sourceProps.hardwareAccelerated, {false})), ++ visible(convertRawProp(context, rawProps, "visible", sourceProps.visible, {false})), ++ animated(convertRawProp(context, rawProps, "animated", sourceProps.animated, {false})), ++ supportedOrientations(convertRawProp(context, rawProps, "supportedOrientations", sourceProps.supportedOrientations, {static_cast(ModalHostViewSupportedOrientations::Portrait)})), ++ identifier(convertRawProp(context, rawProps, "identifier", sourceProps.identifier, {0})) ++ {} ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h +new file mode 100644 +index 0000000..f402340 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h +@@ -0,0 +1,395 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GeneratePropsH.js ++ */ ++#pragma once ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++class JSI_EXPORT SafeAreaViewProps final : public ViewProps { ++ public: ++ SafeAreaViewProps() = default; ++ SafeAreaViewProps(const PropsParserContext& context, const SafeAreaViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ ++}; ++ ++class JSI_EXPORT AndroidHorizontalScrollContentViewProps final : public ViewProps { ++ public: ++ AndroidHorizontalScrollContentViewProps() = default; ++ AndroidHorizontalScrollContentViewProps(const PropsParserContext& context, const AndroidHorizontalScrollContentViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool removeClippedSubviews{false}; ++}; ++ ++class JSI_EXPORT AndroidProgressBarProps final : public ViewProps { ++ public: ++ AndroidProgressBarProps() = default; ++ AndroidProgressBarProps(const PropsParserContext& context, const AndroidProgressBarProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ std::string styleAttr{}; ++ std::string typeAttr{}; ++ bool indeterminate{false}; ++ double progress{0.0}; ++ bool animating{true}; ++ SharedColor color{}; ++ std::string testID{""}; ++}; ++ ++enum class AndroidSwipeRefreshLayoutSize { Default, Large }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidSwipeRefreshLayoutSize &result) { ++ auto string = (std::string)value; ++ if (string == "default") { result = AndroidSwipeRefreshLayoutSize::Default; return; } ++ if (string == "large") { result = AndroidSwipeRefreshLayoutSize::Large; return; } ++ abort(); ++} ++ ++static inline std::string toString(const AndroidSwipeRefreshLayoutSize &value) { ++ switch (value) { ++ case AndroidSwipeRefreshLayoutSize::Default: return "default"; ++ case AndroidSwipeRefreshLayoutSize::Large: return "large"; ++ } ++} ++ ++class JSI_EXPORT AndroidSwipeRefreshLayoutProps final : public ViewProps { ++ public: ++ AndroidSwipeRefreshLayoutProps() = default; ++ AndroidSwipeRefreshLayoutProps(const PropsParserContext& context, const AndroidSwipeRefreshLayoutProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool enabled{true}; ++ std::vector colors{}; ++ SharedColor progressBackgroundColor{}; ++ AndroidSwipeRefreshLayoutSize size{AndroidSwipeRefreshLayoutSize::Default}; ++ Float progressViewOffset{0.0}; ++ bool refreshing{false}; ++}; ++ ++class JSI_EXPORT PullToRefreshViewProps final : public ViewProps { ++ public: ++ PullToRefreshViewProps() = default; ++ PullToRefreshViewProps(const PropsParserContext& context, const PullToRefreshViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ SharedColor tintColor{}; ++ SharedColor titleColor{}; ++ std::string title{}; ++ Float progressViewOffset{0.0}; ++ bool refreshing{false}; ++}; ++ ++class JSI_EXPORT InputAccessoryProps final : public ViewProps { ++ public: ++ InputAccessoryProps() = default; ++ InputAccessoryProps(const PropsParserContext& context, const InputAccessoryProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ SharedColor backgroundColor{}; ++}; ++ ++enum class AndroidDrawerLayoutKeyboardDismissMode { None, OnDrag }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutKeyboardDismissMode &result) { ++ auto string = (std::string)value; ++ if (string == "none") { result = AndroidDrawerLayoutKeyboardDismissMode::None; return; } ++ if (string == "on-drag") { result = AndroidDrawerLayoutKeyboardDismissMode::OnDrag; return; } ++ abort(); ++} ++ ++static inline std::string toString(const AndroidDrawerLayoutKeyboardDismissMode &value) { ++ switch (value) { ++ case AndroidDrawerLayoutKeyboardDismissMode::None: return "none"; ++ case AndroidDrawerLayoutKeyboardDismissMode::OnDrag: return "on-drag"; ++ } ++} ++enum class AndroidDrawerLayoutDrawerPosition { Left, Right }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutDrawerPosition &result) { ++ auto string = (std::string)value; ++ if (string == "left") { result = AndroidDrawerLayoutDrawerPosition::Left; return; } ++ if (string == "right") { result = AndroidDrawerLayoutDrawerPosition::Right; return; } ++ abort(); ++} ++ ++static inline std::string toString(const AndroidDrawerLayoutDrawerPosition &value) { ++ switch (value) { ++ case AndroidDrawerLayoutDrawerPosition::Left: return "left"; ++ case AndroidDrawerLayoutDrawerPosition::Right: return "right"; ++ } ++} ++enum class AndroidDrawerLayoutDrawerLockMode { Unlocked, LockedClosed, LockedOpen }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutDrawerLockMode &result) { ++ auto string = (std::string)value; ++ if (string == "unlocked") { result = AndroidDrawerLayoutDrawerLockMode::Unlocked; return; } ++ if (string == "locked-closed") { result = AndroidDrawerLayoutDrawerLockMode::LockedClosed; return; } ++ if (string == "locked-open") { result = AndroidDrawerLayoutDrawerLockMode::LockedOpen; return; } ++ abort(); ++} ++ ++static inline std::string toString(const AndroidDrawerLayoutDrawerLockMode &value) { ++ switch (value) { ++ case AndroidDrawerLayoutDrawerLockMode::Unlocked: return "unlocked"; ++ case AndroidDrawerLayoutDrawerLockMode::LockedClosed: return "locked-closed"; ++ case AndroidDrawerLayoutDrawerLockMode::LockedOpen: return "locked-open"; ++ } ++} ++ ++class JSI_EXPORT AndroidDrawerLayoutProps final : public ViewProps { ++ public: ++ AndroidDrawerLayoutProps() = default; ++ AndroidDrawerLayoutProps(const PropsParserContext& context, const AndroidDrawerLayoutProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ AndroidDrawerLayoutKeyboardDismissMode keyboardDismissMode{AndroidDrawerLayoutKeyboardDismissMode::None}; ++ SharedColor drawerBackgroundColor{}; ++ AndroidDrawerLayoutDrawerPosition drawerPosition{AndroidDrawerLayoutDrawerPosition::Left}; ++ Float drawerWidth{}; ++ AndroidDrawerLayoutDrawerLockMode drawerLockMode{AndroidDrawerLayoutDrawerLockMode::Unlocked}; ++ SharedColor statusBarBackgroundColor{}; ++}; ++ ++enum class ActivityIndicatorViewSize { Small, Large }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ActivityIndicatorViewSize &result) { ++ auto string = (std::string)value; ++ if (string == "small") { result = ActivityIndicatorViewSize::Small; return; } ++ if (string == "large") { result = ActivityIndicatorViewSize::Large; return; } ++ abort(); ++} ++ ++static inline std::string toString(const ActivityIndicatorViewSize &value) { ++ switch (value) { ++ case ActivityIndicatorViewSize::Small: return "small"; ++ case ActivityIndicatorViewSize::Large: return "large"; ++ } ++} ++ ++class JSI_EXPORT ActivityIndicatorViewProps final : public ViewProps { ++ public: ++ ActivityIndicatorViewProps() = default; ++ ActivityIndicatorViewProps(const PropsParserContext& context, const ActivityIndicatorViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool hidesWhenStopped{false}; ++ bool animating{false}; ++ SharedColor color{}; ++ ActivityIndicatorViewSize size{ActivityIndicatorViewSize::Small}; ++}; ++ ++class JSI_EXPORT UnimplementedNativeViewProps final : public ViewProps { ++ public: ++ UnimplementedNativeViewProps() = default; ++ UnimplementedNativeViewProps(const PropsParserContext& context, const UnimplementedNativeViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ std::string name{""}; ++}; ++ ++class JSI_EXPORT SwitchProps final : public ViewProps { ++ public: ++ SwitchProps() = default; ++ SwitchProps(const PropsParserContext& context, const SwitchProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool disabled{false}; ++ bool value{false}; ++ SharedColor tintColor{}; ++ SharedColor onTintColor{}; ++ SharedColor thumbTintColor{}; ++ SharedColor thumbColor{}; ++ SharedColor trackColorForFalse{}; ++ SharedColor trackColorForTrue{}; ++}; ++ ++class JSI_EXPORT AndroidSwitchProps final : public ViewProps { ++ public: ++ AndroidSwitchProps() = default; ++ AndroidSwitchProps(const PropsParserContext& context, const AndroidSwitchProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ bool disabled{false}; ++ bool enabled{true}; ++ SharedColor thumbColor{}; ++ SharedColor trackColorForFalse{}; ++ SharedColor trackColorForTrue{}; ++ bool value{false}; ++ bool on{false}; ++ SharedColor thumbTintColor{}; ++ SharedColor trackTintColor{}; ++}; ++ ++class JSI_EXPORT TraceUpdateOverlayProps final : public ViewProps { ++ public: ++ TraceUpdateOverlayProps() = default; ++ TraceUpdateOverlayProps(const PropsParserContext& context, const TraceUpdateOverlayProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ ++}; ++ ++enum class ModalHostViewAnimationType { None, Slide, Fade }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewAnimationType &result) { ++ auto string = (std::string)value; ++ if (string == "none") { result = ModalHostViewAnimationType::None; return; } ++ if (string == "slide") { result = ModalHostViewAnimationType::Slide; return; } ++ if (string == "fade") { result = ModalHostViewAnimationType::Fade; return; } ++ abort(); ++} ++ ++static inline std::string toString(const ModalHostViewAnimationType &value) { ++ switch (value) { ++ case ModalHostViewAnimationType::None: return "none"; ++ case ModalHostViewAnimationType::Slide: return "slide"; ++ case ModalHostViewAnimationType::Fade: return "fade"; ++ } ++} ++enum class ModalHostViewPresentationStyle { FullScreen, PageSheet, FormSheet, OverFullScreen }; ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewPresentationStyle &result) { ++ auto string = (std::string)value; ++ if (string == "fullScreen") { result = ModalHostViewPresentationStyle::FullScreen; return; } ++ if (string == "pageSheet") { result = ModalHostViewPresentationStyle::PageSheet; return; } ++ if (string == "formSheet") { result = ModalHostViewPresentationStyle::FormSheet; return; } ++ if (string == "overFullScreen") { result = ModalHostViewPresentationStyle::OverFullScreen; return; } ++ abort(); ++} ++ ++static inline std::string toString(const ModalHostViewPresentationStyle &value) { ++ switch (value) { ++ case ModalHostViewPresentationStyle::FullScreen: return "fullScreen"; ++ case ModalHostViewPresentationStyle::PageSheet: return "pageSheet"; ++ case ModalHostViewPresentationStyle::FormSheet: return "formSheet"; ++ case ModalHostViewPresentationStyle::OverFullScreen: return "overFullScreen"; ++ } ++} ++using ModalHostViewSupportedOrientationsMask = uint32_t; ++ ++enum class ModalHostViewSupportedOrientations: ModalHostViewSupportedOrientationsMask { ++ Portrait = 1 << 0, ++ PortraitUpsideDown = 1 << 1, ++ Landscape = 1 << 2, ++ LandscapeLeft = 1 << 3, ++ LandscapeRight = 1 << 4 ++}; ++ ++constexpr bool operator&( ++ ModalHostViewSupportedOrientationsMask const lhs, ++ enum ModalHostViewSupportedOrientations const rhs) { ++ return lhs & static_cast(rhs); ++} ++ ++constexpr ModalHostViewSupportedOrientationsMask operator|( ++ ModalHostViewSupportedOrientationsMask const lhs, ++ enum ModalHostViewSupportedOrientations const rhs) { ++ return lhs | static_cast(rhs); ++} ++ ++constexpr void operator|=( ++ ModalHostViewSupportedOrientationsMask &lhs, ++ enum ModalHostViewSupportedOrientations const rhs) { ++ lhs = lhs | static_cast(rhs); ++} ++ ++static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewSupportedOrientationsMask &result) { ++ auto items = std::vector{value}; ++ for (const auto &item : items) { ++ if (item == "portrait") { ++ result |= ModalHostViewSupportedOrientations::Portrait; ++ continue; ++ } ++ if (item == "portrait-upside-down") { ++ result |= ModalHostViewSupportedOrientations::PortraitUpsideDown; ++ continue; ++ } ++ if (item == "landscape") { ++ result |= ModalHostViewSupportedOrientations::Landscape; ++ continue; ++ } ++ if (item == "landscape-left") { ++ result |= ModalHostViewSupportedOrientations::LandscapeLeft; ++ continue; ++ } ++ if (item == "landscape-right") { ++ result |= ModalHostViewSupportedOrientations::LandscapeRight; ++ continue; ++ } ++ abort(); ++ } ++} ++ ++static inline std::string toString(const ModalHostViewSupportedOrientationsMask &value) { ++ auto result = std::string{}; ++ auto separator = std::string{", "}; ++ ++ if (value & ModalHostViewSupportedOrientations::Portrait) { ++ result += "portrait" + separator; ++ } ++ if (value & ModalHostViewSupportedOrientations::PortraitUpsideDown) { ++ result += "portrait-upside-down" + separator; ++ } ++ if (value & ModalHostViewSupportedOrientations::Landscape) { ++ result += "landscape" + separator; ++ } ++ if (value & ModalHostViewSupportedOrientations::LandscapeLeft) { ++ result += "landscape-left" + separator; ++ } ++ if (value & ModalHostViewSupportedOrientations::LandscapeRight) { ++ result += "landscape-right" + separator; ++ } ++ if (!result.empty()) { ++ result.erase(result.length() - separator.length()); ++ } ++ return result; ++} ++ ++class JSI_EXPORT ModalHostViewProps final : public ViewProps { ++ public: ++ ModalHostViewProps() = default; ++ ModalHostViewProps(const PropsParserContext& context, const ModalHostViewProps &sourceProps, const RawProps &rawProps); ++ ++#pragma mark - Props ++ ++ ModalHostViewAnimationType animationType{ModalHostViewAnimationType::None}; ++ ModalHostViewPresentationStyle presentationStyle{ModalHostViewPresentationStyle::FullScreen}; ++ bool transparent{false}; ++ bool statusBarTranslucent{false}; ++ bool hardwareAccelerated{false}; ++ bool visible{false}; ++ bool animated{false}; ++ ModalHostViewSupportedOrientationsMask supportedOrientations{static_cast(ModalHostViewSupportedOrientations::Portrait)}; ++ int identifier{0}; ++}; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h +new file mode 100644 +index 0000000..e08f2ae +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h +@@ -0,0 +1,257 @@ ++/** ++* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++* ++* Do not edit this file as changes may cause incorrect behavior and will be lost ++* once the code is regenerated. ++* ++* @generated by codegen project: GenerateComponentHObjCpp.js ++*/ ++ ++#import ++#import ++#import ++ ++NS_ASSUME_NONNULL_BEGIN ++ ++@protocol RCTSafeAreaViewViewProtocol ++ ++@end ++ ++@protocol RCTAndroidHorizontalScrollContentViewViewProtocol ++ ++@end ++ ++@protocol RCTAndroidProgressBarViewProtocol ++ ++@end ++ ++@protocol RCTAndroidSwipeRefreshLayoutViewProtocol ++- (void)setNativeRefreshing:(BOOL)value; ++@end ++ ++RCT_EXTERN inline void RCTAndroidSwipeRefreshLayoutHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"setNativeRefreshing"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidSwipeRefreshLayout", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"AndroidSwipeRefreshLayout", commandName, @"1st")) { ++ return; ++ } ++#endif ++ BOOL value = [(NSNumber *)arg0 boolValue]; ++ ++ [componentView setNativeRefreshing:value]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidSwipeRefreshLayout", commandName); ++#endif ++} ++ ++@protocol RCTPullToRefreshViewViewProtocol ++- (void)setNativeRefreshing:(BOOL)refreshing; ++@end ++ ++RCT_EXTERN inline void RCTPullToRefreshViewHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"setNativeRefreshing"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"PullToRefreshView", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"PullToRefreshView", commandName, @"1st")) { ++ return; ++ } ++#endif ++ BOOL refreshing = [(NSNumber *)arg0 boolValue]; ++ ++ [componentView setNativeRefreshing:refreshing]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"PullToRefreshView", commandName); ++#endif ++} ++ ++@protocol RCTInputAccessoryViewProtocol ++ ++@end ++ ++@protocol RCTAndroidDrawerLayoutViewProtocol ++- (void)openDrawer; ++- (void)closeDrawer; ++@end ++ ++RCT_EXTERN inline void RCTAndroidDrawerLayoutHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"openDrawer"]) { ++#if RCT_DEBUG ++ if ([args count] != 0) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidDrawerLayout", commandName, (int)[args count], 0); ++ return; ++ } ++#endif ++ ++ ++ ++ [componentView openDrawer]; ++ return; ++} ++ ++if ([commandName isEqualToString:@"closeDrawer"]) { ++#if RCT_DEBUG ++ if ([args count] != 0) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidDrawerLayout", commandName, (int)[args count], 0); ++ return; ++ } ++#endif ++ ++ ++ ++ [componentView closeDrawer]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidDrawerLayout", commandName); ++#endif ++} ++ ++@protocol RCTActivityIndicatorViewViewProtocol ++ ++@end ++ ++@protocol RCTUnimplementedNativeViewViewProtocol ++ ++@end ++ ++@protocol RCTSwitchViewProtocol ++- (void)setValue:(BOOL)value; ++@end ++ ++RCT_EXTERN inline void RCTSwitchHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"setValue"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"Switch", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"Switch", commandName, @"1st")) { ++ return; ++ } ++#endif ++ BOOL value = [(NSNumber *)arg0 boolValue]; ++ ++ [componentView setValue:value]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"Switch", commandName); ++#endif ++} ++ ++@protocol RCTAndroidSwitchViewProtocol ++- (void)setNativeValue:(BOOL)value; ++@end ++ ++RCT_EXTERN inline void RCTAndroidSwitchHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"setNativeValue"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidSwitch", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"AndroidSwitch", commandName, @"1st")) { ++ return; ++ } ++#endif ++ BOOL value = [(NSNumber *)arg0 boolValue]; ++ ++ [componentView setNativeValue:value]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidSwitch", commandName); ++#endif ++} ++ ++@protocol RCTTraceUpdateOverlayViewProtocol ++- (void)draw:(NSString *)overlays; ++@end ++ ++RCT_EXTERN inline void RCTTraceUpdateOverlayHandleCommand( ++ id componentView, ++ NSString const *commandName, ++ NSArray const *args) ++{ ++ if ([commandName isEqualToString:@"draw"]) { ++#if RCT_DEBUG ++ if ([args count] != 1) { ++ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"TraceUpdateOverlay", commandName, (int)[args count], 1); ++ return; ++ } ++#endif ++ ++ NSObject *arg0 = args[0]; ++#if RCT_DEBUG ++ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSString class], @"string", @"TraceUpdateOverlay", commandName, @"1st")) { ++ return; ++ } ++#endif ++ NSString * overlays = (NSString *)arg0; ++ ++ [componentView draw:overlays]; ++ return; ++} ++ ++#if RCT_DEBUG ++ RCTLogError(@"%@ received command %@, which is not a supported command.", @"TraceUpdateOverlay", commandName); ++#endif ++} ++ ++@protocol RCTModalHostViewViewProtocol ++ ++@end ++ ++NS_ASSUME_NONNULL_END +\ No newline at end of file +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp +new file mode 100644 +index 0000000..d9a2760 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp +@@ -0,0 +1,26 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateShadowNodeCpp.js ++ */ ++ ++#include ++ ++namespace facebook { ++namespace react { ++ ++extern const char AndroidHorizontalScrollContentViewComponentName[] = "AndroidHorizontalScrollContentView"; ++extern const char AndroidSwipeRefreshLayoutComponentName[] = "AndroidSwipeRefreshLayout"; ++extern const char PullToRefreshViewComponentName[] = "PullToRefreshView"; ++extern const char AndroidDrawerLayoutComponentName[] = "AndroidDrawerLayout"; ++extern const char ActivityIndicatorViewComponentName[] = "ActivityIndicatorView"; ++extern const char UnimplementedNativeViewComponentName[] = "UnimplementedNativeView"; ++extern const char SwitchComponentName[] = "Switch"; ++extern const char TraceUpdateOverlayComponentName[] = "TraceUpdateOverlay"; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h +new file mode 100644 +index 0000000..a5874dc +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h +@@ -0,0 +1,111 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateShadowNodeH.js ++ */ ++ ++#pragma once ++ ++#include ++#include ++#include ++#include ++#include ++ ++namespace facebook { ++namespace react { ++ ++JSI_EXPORT extern const char AndroidHorizontalScrollContentViewComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using AndroidHorizontalScrollContentViewShadowNode = ConcreteViewShadowNode< ++ AndroidHorizontalScrollContentViewComponentName, ++ AndroidHorizontalScrollContentViewProps, ++ AndroidHorizontalScrollContentViewEventEmitter, ++ AndroidHorizontalScrollContentViewState>; ++ ++JSI_EXPORT extern const char AndroidSwipeRefreshLayoutComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using AndroidSwipeRefreshLayoutShadowNode = ConcreteViewShadowNode< ++ AndroidSwipeRefreshLayoutComponentName, ++ AndroidSwipeRefreshLayoutProps, ++ AndroidSwipeRefreshLayoutEventEmitter, ++ AndroidSwipeRefreshLayoutState>; ++ ++JSI_EXPORT extern const char PullToRefreshViewComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using PullToRefreshViewShadowNode = ConcreteViewShadowNode< ++ PullToRefreshViewComponentName, ++ PullToRefreshViewProps, ++ PullToRefreshViewEventEmitter, ++ PullToRefreshViewState>; ++ ++JSI_EXPORT extern const char AndroidDrawerLayoutComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using AndroidDrawerLayoutShadowNode = ConcreteViewShadowNode< ++ AndroidDrawerLayoutComponentName, ++ AndroidDrawerLayoutProps, ++ AndroidDrawerLayoutEventEmitter, ++ AndroidDrawerLayoutState>; ++ ++JSI_EXPORT extern const char ActivityIndicatorViewComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using ActivityIndicatorViewShadowNode = ConcreteViewShadowNode< ++ ActivityIndicatorViewComponentName, ++ ActivityIndicatorViewProps, ++ ActivityIndicatorViewEventEmitter, ++ ActivityIndicatorViewState>; ++ ++JSI_EXPORT extern const char UnimplementedNativeViewComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using UnimplementedNativeViewShadowNode = ConcreteViewShadowNode< ++ UnimplementedNativeViewComponentName, ++ UnimplementedNativeViewProps, ++ UnimplementedNativeViewEventEmitter, ++ UnimplementedNativeViewState>; ++ ++JSI_EXPORT extern const char SwitchComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using SwitchShadowNode = ConcreteViewShadowNode< ++ SwitchComponentName, ++ SwitchProps, ++ SwitchEventEmitter, ++ SwitchState>; ++ ++JSI_EXPORT extern const char TraceUpdateOverlayComponentName[]; ++ ++/* ++ * `ShadowNode` for component. ++ */ ++using TraceUpdateOverlayShadowNode = ConcreteViewShadowNode< ++ TraceUpdateOverlayComponentName, ++ TraceUpdateOverlayProps, ++ TraceUpdateOverlayEventEmitter, ++ TraceUpdateOverlayState>; ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp +new file mode 100644 +index 0000000..3b5a0f5 +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp +@@ -0,0 +1,18 @@ ++ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateStateCpp.js ++ */ ++#include ++ ++namespace facebook { ++namespace react { ++ ++ ++ ++} // namespace react ++} // namespace facebook +diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h +new file mode 100644 +index 0000000..29ac2df +--- /dev/null ++++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h +@@ -0,0 +1,141 @@ ++/** ++ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). ++ * ++ * Do not edit this file as changes may cause incorrect behavior and will be lost ++ * once the code is regenerated. ++ * ++ * @generated by codegen project: GenerateStateH.js ++ */ ++#pragma once ++ ++#ifdef ANDROID ++#include ++#include ++#include ++#endif ++ ++namespace facebook { ++namespace react { ++ ++class AndroidHorizontalScrollContentViewState { ++public: ++ AndroidHorizontalScrollContentViewState() = default; ++ ++#ifdef ANDROID ++ AndroidHorizontalScrollContentViewState(AndroidHorizontalScrollContentViewState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class AndroidSwipeRefreshLayoutState { ++public: ++ AndroidSwipeRefreshLayoutState() = default; ++ ++#ifdef ANDROID ++ AndroidSwipeRefreshLayoutState(AndroidSwipeRefreshLayoutState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class PullToRefreshViewState { ++public: ++ PullToRefreshViewState() = default; ++ ++#ifdef ANDROID ++ PullToRefreshViewState(PullToRefreshViewState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class AndroidDrawerLayoutState { ++public: ++ AndroidDrawerLayoutState() = default; ++ ++#ifdef ANDROID ++ AndroidDrawerLayoutState(AndroidDrawerLayoutState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class ActivityIndicatorViewState { ++public: ++ ActivityIndicatorViewState() = default; ++ ++#ifdef ANDROID ++ ActivityIndicatorViewState(ActivityIndicatorViewState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class UnimplementedNativeViewState { ++public: ++ UnimplementedNativeViewState() = default; ++ ++#ifdef ANDROID ++ UnimplementedNativeViewState(UnimplementedNativeViewState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class SwitchState { ++public: ++ SwitchState() = default; ++ ++#ifdef ANDROID ++ SwitchState(SwitchState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++class TraceUpdateOverlayState { ++public: ++ TraceUpdateOverlayState() = default; ++ ++#ifdef ANDROID ++ TraceUpdateOverlayState(TraceUpdateOverlayState const &previousState, folly::dynamic data){}; ++ folly::dynamic getDynamic() const { ++ return {}; ++ }; ++ MapBuffer getMapBuffer() const { ++ return MapBufferBuilder::EMPTY(); ++ }; ++#endif ++}; ++ ++} // namespace react ++} // namespace facebook +\ No newline at end of file From 181a9a59baf8807bf6c2b33dddca796db99f5949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Fri, 1 Nov 2024 18:59:05 -0300 Subject: [PATCH 31/47] feat: improved logging and updated podfile with sentry update and mmkv --- ios/HathorMobile.xcodeproj/project.pbxproj | 6 ++++-- ios/Podfile.lock | 22 +++++++++------------- src/sagas/ses.js | 6 +++++- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ios/HathorMobile.xcodeproj/project.pbxproj b/ios/HathorMobile.xcodeproj/project.pbxproj index 603fc42a0..dbbe91c87 100644 --- a/ios/HathorMobile.xcodeproj/project.pbxproj +++ b/ios/HathorMobile.xcodeproj/project.pbxproj @@ -602,7 +602,8 @@ OTHER_CPLUSPLUSFLAGS = "$(inherited)"; OTHER_LDFLAGS = ( "$(inherited)", - " ", + "-Wl", + "-ld_classic", "-Wl -ld_classic ", ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; @@ -681,7 +682,8 @@ OTHER_CPLUSPLUSFLAGS = "$(inherited)"; OTHER_LDFLAGS = ( "$(inherited)", - " ", + "-Wl", + "-ld_classic", "-Wl -ld_classic ", ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 146182563..ce92584e2 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -359,9 +359,8 @@ PODS: - React-jsinspector (0.72.5) - React-logger (0.72.5): - glog - - react-native-mmkv (2.12.2): - - MMKV (>= 1.3.3) - - RCT-Folly (= 2021.07.22.00) + - react-native-mmkv (2.11.0): + - MMKV (>= 1.2.13) - React-Core - react-native-pager-view (5.4.25): - React-Core @@ -541,16 +540,15 @@ PODS: - RNScreens (3.22.1): - React-Core - React-RCTImage - - RNSentry (5.6.0): + - RNSentry (5.31.0): + - RCT-Folly (= 2021.07.22.00) - React-Core - - Sentry/HybridSDK (= 8.7.3) + - Sentry/HybridSDK (= 8.36.0) - RNSVG (13.10.0): - React-Core - RNVectorIcons (9.2.0): - React-Core - - Sentry/HybridSDK (8.7.3): - - SentryPrivate (= 8.7.3) - - SentryPrivate (8.7.3) + - Sentry/HybridSDK (8.36.0) - SocketRocket (0.6.1) - Yoga (1.14.0) @@ -636,7 +634,6 @@ SPEC REPOS: - nanopb - PromisesObjC - Sentry - - SentryPrivate - SocketRocket EXTERNAL SOURCES: @@ -801,7 +798,7 @@ SPEC CHECKSUMS: React-jsiexecutor: f32f98d8ddbdfd97dea286af90381a731d68c505 React-jsinspector: aef73cbd43b70675f572214d10fa438c89bf11ba React-logger: 2e4aee3e11b3ec4fa6cfd8004610bbb3b8d6cca4 - react-native-mmkv: b738e135cc27fc8ed25b39ec451b2e3e0ae9ce1b + react-native-mmkv: e97c0c79403fb94577e5d902ab1ebd42b0715b43 react-native-pager-view: da490aa1f902c9a5aeecf0909cc975ad0e92e53e react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846 react-native-restart: 7595693413fe3ca15893702f2c8306c62a708162 @@ -837,11 +834,10 @@ SPEC CHECKSUMS: RNPermissions: d9db16f082ce2e09908e58c925189e2637d2786b RNReanimated: bdadbf5322d7894bb6016985d8ae5c9ed5fc83d0 RNScreens: 50ffe2fa2342eabb2d0afbe19f7c1af286bc7fb3 - RNSentry: 9f0447b3ce13806f544903748de423259ead8552 + RNSentry: af5968c291d69856a4cac69ed84277a1e373d9a3 RNSVG: 80584470ff1ffc7994923ea135a3e5ad825546b9 RNVectorIcons: fcc2f6cb32f5735b586e66d14103a74ce6ad61f8 - Sentry: c7a86f43510a7d5678d4de28d78c28ab351d295b - SentryPrivate: 2eaabf598a46d4b9b8822aef766df2a84caf2e6f + Sentry: f8374b5415bc38dfb5645941b3ae31230fbeae57 SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 Yoga: 86fed2e4d425ee4c6eab3813ba1791101ee153c6 diff --git a/src/sagas/ses.js b/src/sagas/ses.js index a679ae741..36eefbd2e 100644 --- a/src/sagas/ses.js +++ b/src/sagas/ses.js @@ -20,10 +20,12 @@ import { logger } from '../logger'; import { onExceptionCaptured } from '../actions'; import { verifySesEnabled } from '../utils'; +const log = logger('ses'); + const storage = new MMKV(); function disableSes(restart = true) { - logger.debug('Disabling SAS'); + log.debug('Disabling SAS'); storage.set(SHOULD_ENABLE_SES_STORAGE_KEY, false); if (restart) { @@ -55,6 +57,7 @@ function* init() { } if (!unleashEnabled && storageEnabled) { + log.debug('Unleash is disabled and storage is not, disabling SES!'); // SES was enabled, we should disable it in storage which gets read in the // react-native initialization (more on this in patches/react-native+0.72.5.patch) // and restart the react-native bundle. @@ -62,6 +65,7 @@ function* init() { } if (unleashEnabled && !storageEnabled) { + log.debug('Unleash is enabled and storage is not, enabling SES!'); enableSes(); } } From b8a7f7c4708f7c9a061b990218fdc079c27e5b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Fri, 1 Nov 2024 18:59:58 -0300 Subject: [PATCH 32/47] fix: typo --- src/sagas/ses.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sagas/ses.js b/src/sagas/ses.js index 36eefbd2e..095df2ff5 100644 --- a/src/sagas/ses.js +++ b/src/sagas/ses.js @@ -25,7 +25,7 @@ const log = logger('ses'); const storage = new MMKV(); function disableSes(restart = true) { - log.debug('Disabling SAS'); + log.debug('Disabling SES'); storage.set(SHOULD_ENABLE_SES_STORAGE_KEY, false); if (restart) { From 588be9a9acfe78f55f5ff52e1609688e9935ba09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Fri, 1 Nov 2024 19:01:56 -0300 Subject: [PATCH 33/47] docs: improved comment on unleash disabled --- src/sagas/ses.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sagas/ses.js b/src/sagas/ses.js index 095df2ff5..ae0a3b51f 100644 --- a/src/sagas/ses.js +++ b/src/sagas/ses.js @@ -58,9 +58,11 @@ function* init() { if (!unleashEnabled && storageEnabled) { log.debug('Unleash is disabled and storage is not, disabling SES!'); - // SES was enabled, we should disable it in storage which gets read in the - // react-native initialization (more on this in patches/react-native+0.72.5.patch) - // and restart the react-native bundle. + // SES was disabled in Unleash and is enabled in the storage, + // meaning that it will be loaded in the next boot we should disable it in + // storage which gets read in the react-native initialization + // (more on this in patches/react-native+0.72.5.patch) and restart the + // react-native bundle. disableSes(); } From aa22bdc6ca3c22154a7a76ae3d02722a5bce96d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Fri, 1 Nov 2024 19:04:54 -0300 Subject: [PATCH 34/47] refactor: use isSESEnabled --- src/sagas/ses.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sagas/ses.js b/src/sagas/ses.js index ae0a3b51f..6afa8030e 100644 --- a/src/sagas/ses.js +++ b/src/sagas/ses.js @@ -47,7 +47,7 @@ function enableSes(restart = true) { */ function* init() { const storageEnabled = storage.getBoolean('should-enable-ses'); - const unleashEnabled = yield call(checkForFeatureFlag, SES_FEATURE_TOGGLE); + const unleashEnabled = yield call(isSESEnabled); const sesEnabled = verifySesEnabled(); if (unleashEnabled && storageEnabled && !sesEnabled) { From cd03b31ecbe074fdd59a1e3e609d74ecdb81f3fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Fri, 1 Nov 2024 19:05:53 -0300 Subject: [PATCH 35/47] chore: updated sha256sums --- SHA256SUMS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SHA256SUMS b/SHA256SUMS index 484309b74..08c41e8fb 100644 --- a/SHA256SUMS +++ b/SHA256SUMS @@ -1 +1 @@ -f6220be2d2bad5babb5b8e50ecca6b7b2bb6751eb6548ca65f44e30e29abb93c lockdown.umd.js +f10f4088c8bd9689f6108fac0e2c1d7ea3f0c1f159c64822e7830aa7018671a7 lockdown.umd.js From 27a14492f7d4c2ad96ec413ee028d61c8bcc91bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Fri, 1 Nov 2024 19:09:57 -0300 Subject: [PATCH 36/47] docs: updated SES_AND_LAVAMOAT document with better explanation on SES --- SES_AND_LAVAMOAT.md | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/SES_AND_LAVAMOAT.md b/SES_AND_LAVAMOAT.md index 76dcaea05..cc3df8b73 100644 --- a/SES_AND_LAVAMOAT.md +++ b/SES_AND_LAVAMOAT.md @@ -10,12 +10,46 @@ LavaMoat does not yet fully support react-native, there is a compatibility track This is done through a patch on the react-native package, using `patch-package`. -We are currently using version `1.0.1` of SES, which is the latest version that works with react-native, it is loaded from the project root, `lockdown.umd.js`. +We are currently using version `1.5.0` of SES, which is the latest version that works with react-native, it is loaded from the project root, `lockdown.umd.js`. +### Understanding SES Hardening + +SES hardens JavaScript's built-in objects ("intrinsics") to prevent malicious code from modifying them. This includes: + +- Object prototype methods (e.g. `Object.prototype.toString`) +- Array methods (e.g. `Array.prototype.push`) +- String methods +- Promise implementation +- Math object +- JSON object +- And other global objects + +Common issues you might encounter: +1. "TypeError: Cannot assign to read only property": This means code is trying to modify a hardened object +2. "TypeError: Object.prototype.foo is not configurable": Attempting to add methods to hardened prototypes +3. "Cannot create property 'bar' on frozen object": Trying to modify frozen global objects + +Debug tips: +- If you see these errors, check if your code or a third-party library is trying to: + - Modify built-in prototypes + - Add properties to global objects + - Override native methods +- Consider using proper alternatives: + - Create new objects instead of modifying built-ins + - Use class inheritance instead of prototype modification + - Keep modifications within your own object instances + ### Updating SES -As soon as react-native is fully supported by LavaMoat, we will replace the current patch with its official package and install it using npm, but until then, in order to update SES we should do the following steps: +Once React Native is fully supported by LavaMoat, we'll replace the current patch with its official npm package. Until then, to update SES: 1. Update the `lockdown.umd.js` file to the latest supported SES lockdown file 2. Update the sha256sum of the lockdown library in the SHA256SUMS file + +### Future Plans + +We plan to migrate to LavaMoat's full implementation once React Native support is complete. This will provide: +- Better integration with the ecosystem +- Easier updates through npm +- Additional security features from LavaMoat From 8bdf6b6b10699f29e5b178d243ac4c1580d854c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 4 Nov 2024 08:28:58 -0300 Subject: [PATCH 37/47] refactor: disabled hermes on android --- android/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/gradle.properties b/android/gradle.properties index 54ff666ca..4b709d26d 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -42,7 +42,7 @@ newArchEnabled=false # Use this property to enable or disable the Hermes JS engine. # If set to false, you will be using JSC instead. -hermesEnabled=true +hermesEnabled=false # Increase maximum size of memory allocation org.gradle.jvmargs=-Xmx4096M From c170bed8904833601ce4172300c3dd523ea0deec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 4 Nov 2024 10:14:47 -0300 Subject: [PATCH 38/47] refactor: updated react-native patch, removed unused changes --- patches/react-native+0.72.5.patch | 1500 +---------------------------- 1 file changed, 3 insertions(+), 1497 deletions(-) diff --git a/patches/react-native+0.72.5.patch b/patches/react-native+0.72.5.patch index fc2d26347..60eb86d51 100644 --- a/patches/react-native+0.72.5.patch +++ b/patches/react-native+0.72.5.patch @@ -1,18 +1,17 @@ diff --git a/node_modules/react-native/Libraries/Core/InitializeCore.js b/node_modules/react-native/Libraries/Core/InitializeCore.js -index 25377f6..18193d4 100644 +index 25377f6..1d0dd73 100644 --- a/node_modules/react-native/Libraries/Core/InitializeCore.js +++ b/node_modules/react-native/Libraries/Core/InitializeCore.js -@@ -26,6 +26,9 @@ +@@ -26,6 +26,8 @@ const start = Date.now(); +require('./setUpXHR'); -+// setUpSES should be imported after setUpXHR because setUpXHR adds AbortController: +require('./setUpSES'); require('./setUpGlobals'); require('./setUpDOM'); require('./setUpPerformance'); -@@ -33,7 +36,6 @@ require('./setUpErrorHandling'); +@@ -33,7 +35,6 @@ require('./setUpErrorHandling'); require('./polyfillPromise'); require('./setUpRegeneratorRuntime'); require('./setUpTimers'); @@ -64,1496 +63,3 @@ index 0000000..6f3dbbf + + hardenIntrinsics(); +} -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h -new file mode 100644 -index 0000000..37b7d8d ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h -@@ -0,0 +1,29 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateComponentDescriptorH.js -+ */ -+ -+#pragma once -+ -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+using AndroidHorizontalScrollContentViewComponentDescriptor = ConcreteComponentDescriptor; -+using AndroidSwipeRefreshLayoutComponentDescriptor = ConcreteComponentDescriptor; -+using PullToRefreshViewComponentDescriptor = ConcreteComponentDescriptor; -+using AndroidDrawerLayoutComponentDescriptor = ConcreteComponentDescriptor; -+using ActivityIndicatorViewComponentDescriptor = ConcreteComponentDescriptor; -+using UnimplementedNativeViewComponentDescriptor = ConcreteComponentDescriptor; -+using SwitchComponentDescriptor = ConcreteComponentDescriptor; -+using TraceUpdateOverlayComponentDescriptor = ConcreteComponentDescriptor; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp -new file mode 100644 -index 0000000..229fadc ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp -@@ -0,0 +1,111 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateEventEmitterCpp.js -+ */ -+ -+#include -+ -+namespace facebook { -+namespace react { -+ -+ -+ -+ -+void AndroidSwipeRefreshLayoutEventEmitter::onRefresh(OnRefresh event) const { -+ dispatchEvent("refresh", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void PullToRefreshViewEventEmitter::onRefresh(OnRefresh event) const { -+ dispatchEvent("refresh", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+ -+void AndroidDrawerLayoutEventEmitter::onDrawerSlide(OnDrawerSlide event) const { -+ dispatchEvent("drawerSlide", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "offset", event.offset); -+ return payload; -+ }); -+} -+void AndroidDrawerLayoutEventEmitter::onDrawerStateChanged(OnDrawerStateChanged event) const { -+ dispatchEvent("drawerStateChanged", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "drawerState", event.drawerState); -+ return payload; -+ }); -+} -+void AndroidDrawerLayoutEventEmitter::onDrawerOpen(OnDrawerOpen event) const { -+ dispatchEvent("drawerOpen", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void AndroidDrawerLayoutEventEmitter::onDrawerClose(OnDrawerClose event) const { -+ dispatchEvent("drawerClose", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+ -+ -+void SwitchEventEmitter::onChange(OnChange event) const { -+ dispatchEvent("change", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "value", event.value); -+payload.setProperty(runtime, "target", event.target); -+ return payload; -+ }); -+} -+void AndroidSwitchEventEmitter::onChange(OnChange event) const { -+ dispatchEvent("change", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "value", event.value); -+payload.setProperty(runtime, "target", event.target); -+ return payload; -+ }); -+} -+ -+void ModalHostViewEventEmitter::onRequestClose(OnRequestClose event) const { -+ dispatchEvent("requestClose", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void ModalHostViewEventEmitter::onShow(OnShow event) const { -+ dispatchEvent("show", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void ModalHostViewEventEmitter::onDismiss(OnDismiss event) const { -+ dispatchEvent("dismiss", [](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ -+ return payload; -+ }); -+} -+void ModalHostViewEventEmitter::onOrientationChange(OnOrientationChange event) const { -+ dispatchEvent("orientationChange", [event=std::move(event)](jsi::Runtime &runtime) { -+ auto payload = jsi::Object(runtime); -+ payload.setProperty(runtime, "orientation", toString(event.orientation)); -+ return payload; -+ }); -+} -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h -new file mode 100644 -index 0000000..1897be1 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.h -@@ -0,0 +1,186 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateEventEmitterH.js -+ */ -+#pragma once -+ -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+class JSI_EXPORT SafeAreaViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT AndroidHorizontalScrollContentViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT AndroidProgressBarEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT AndroidSwipeRefreshLayoutEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnRefresh { -+ -+ }; -+ -+ void onRefresh(OnRefresh value) const; -+}; -+class JSI_EXPORT PullToRefreshViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnRefresh { -+ -+ }; -+ -+ void onRefresh(OnRefresh value) const; -+}; -+class JSI_EXPORT InputAccessoryEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT AndroidDrawerLayoutEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnDrawerSlide { -+ Float offset; -+ }; -+ -+ struct OnDrawerStateChanged { -+ int drawerState; -+ }; -+ -+ struct OnDrawerOpen { -+ -+ }; -+ -+ struct OnDrawerClose { -+ -+ }; -+ -+ void onDrawerSlide(OnDrawerSlide value) const; -+ -+ void onDrawerStateChanged(OnDrawerStateChanged value) const; -+ -+ void onDrawerOpen(OnDrawerOpen value) const; -+ -+ void onDrawerClose(OnDrawerClose value) const; -+}; -+class JSI_EXPORT ActivityIndicatorViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT UnimplementedNativeViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT SwitchEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnChange { -+ bool value; -+ int target; -+ }; -+ -+ void onChange(OnChange value) const; -+}; -+class JSI_EXPORT AndroidSwitchEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnChange { -+ bool value; -+ int target; -+ }; -+ -+ void onChange(OnChange value) const; -+}; -+class JSI_EXPORT TraceUpdateOverlayEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ -+ -+ -+}; -+class JSI_EXPORT ModalHostViewEventEmitter : public ViewEventEmitter { -+ public: -+ using ViewEventEmitter::ViewEventEmitter; -+ -+ struct OnRequestClose { -+ -+ }; -+ -+ struct OnShow { -+ -+ }; -+ -+ struct OnDismiss { -+ -+ }; -+ -+ enum class OnOrientationChangeOrientation { -+ Portrait, -+ Landscape -+ }; -+ -+ static char const *toString(const OnOrientationChangeOrientation value) { -+ switch (value) { -+ case OnOrientationChangeOrientation::Portrait: return "portrait"; -+ case OnOrientationChangeOrientation::Landscape: return "landscape"; -+ } -+ } -+ -+ struct OnOrientationChange { -+ OnOrientationChangeOrientation orientation; -+ }; -+ -+ void onRequestClose(OnRequestClose value) const; -+ -+ void onShow(OnShow value) const; -+ -+ void onDismiss(OnDismiss value) const; -+ -+ void onOrientationChange(OnOrientationChange value) const; -+}; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp -new file mode 100644 -index 0000000..59f24e5 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.cpp -@@ -0,0 +1,157 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GeneratePropsCpp.js -+ */ -+ -+#include -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+SafeAreaViewProps::SafeAreaViewProps( -+ const PropsParserContext &context, -+ const SafeAreaViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) -+ -+ -+ {} -+AndroidHorizontalScrollContentViewProps::AndroidHorizontalScrollContentViewProps( -+ const PropsParserContext &context, -+ const AndroidHorizontalScrollContentViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ removeClippedSubviews(convertRawProp(context, rawProps, "removeClippedSubviews", sourceProps.removeClippedSubviews, {false})) -+ {} -+AndroidProgressBarProps::AndroidProgressBarProps( -+ const PropsParserContext &context, -+ const AndroidProgressBarProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ styleAttr(convertRawProp(context, rawProps, "styleAttr", sourceProps.styleAttr, {})), -+ typeAttr(convertRawProp(context, rawProps, "typeAttr", sourceProps.typeAttr, {})), -+ indeterminate(convertRawProp(context, rawProps, "indeterminate", sourceProps.indeterminate, {false})), -+ progress(convertRawProp(context, rawProps, "progress", sourceProps.progress, {0.0})), -+ animating(convertRawProp(context, rawProps, "animating", sourceProps.animating, {true})), -+ color(convertRawProp(context, rawProps, "color", sourceProps.color, {})), -+ testID(convertRawProp(context, rawProps, "testID", sourceProps.testID, {""})) -+ {} -+AndroidSwipeRefreshLayoutProps::AndroidSwipeRefreshLayoutProps( -+ const PropsParserContext &context, -+ const AndroidSwipeRefreshLayoutProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ enabled(convertRawProp(context, rawProps, "enabled", sourceProps.enabled, {true})), -+ colors(convertRawProp(context, rawProps, "colors", sourceProps.colors, {})), -+ progressBackgroundColor(convertRawProp(context, rawProps, "progressBackgroundColor", sourceProps.progressBackgroundColor, {})), -+ size(convertRawProp(context, rawProps, "size", sourceProps.size, {AndroidSwipeRefreshLayoutSize::Default})), -+ progressViewOffset(convertRawProp(context, rawProps, "progressViewOffset", sourceProps.progressViewOffset, {0.0})), -+ refreshing(convertRawProp(context, rawProps, "refreshing", sourceProps.refreshing, {false})) -+ {} -+PullToRefreshViewProps::PullToRefreshViewProps( -+ const PropsParserContext &context, -+ const PullToRefreshViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ tintColor(convertRawProp(context, rawProps, "tintColor", sourceProps.tintColor, {})), -+ titleColor(convertRawProp(context, rawProps, "titleColor", sourceProps.titleColor, {})), -+ title(convertRawProp(context, rawProps, "title", sourceProps.title, {})), -+ progressViewOffset(convertRawProp(context, rawProps, "progressViewOffset", sourceProps.progressViewOffset, {0.0})), -+ refreshing(convertRawProp(context, rawProps, "refreshing", sourceProps.refreshing, {false})) -+ {} -+InputAccessoryProps::InputAccessoryProps( -+ const PropsParserContext &context, -+ const InputAccessoryProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ backgroundColor(convertRawProp(context, rawProps, "backgroundColor", sourceProps.backgroundColor, {})) -+ {} -+AndroidDrawerLayoutProps::AndroidDrawerLayoutProps( -+ const PropsParserContext &context, -+ const AndroidDrawerLayoutProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ keyboardDismissMode(convertRawProp(context, rawProps, "keyboardDismissMode", sourceProps.keyboardDismissMode, {AndroidDrawerLayoutKeyboardDismissMode::None})), -+ drawerBackgroundColor(convertRawProp(context, rawProps, "drawerBackgroundColor", sourceProps.drawerBackgroundColor, {})), -+ drawerPosition(convertRawProp(context, rawProps, "drawerPosition", sourceProps.drawerPosition, {AndroidDrawerLayoutDrawerPosition::Left})), -+ drawerWidth(convertRawProp(context, rawProps, "drawerWidth", sourceProps.drawerWidth, {})), -+ drawerLockMode(convertRawProp(context, rawProps, "drawerLockMode", sourceProps.drawerLockMode, {AndroidDrawerLayoutDrawerLockMode::Unlocked})), -+ statusBarBackgroundColor(convertRawProp(context, rawProps, "statusBarBackgroundColor", sourceProps.statusBarBackgroundColor, {})) -+ {} -+ActivityIndicatorViewProps::ActivityIndicatorViewProps( -+ const PropsParserContext &context, -+ const ActivityIndicatorViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ hidesWhenStopped(convertRawProp(context, rawProps, "hidesWhenStopped", sourceProps.hidesWhenStopped, {false})), -+ animating(convertRawProp(context, rawProps, "animating", sourceProps.animating, {false})), -+ color(convertRawProp(context, rawProps, "color", sourceProps.color, {})), -+ size(convertRawProp(context, rawProps, "size", sourceProps.size, {ActivityIndicatorViewSize::Small})) -+ {} -+UnimplementedNativeViewProps::UnimplementedNativeViewProps( -+ const PropsParserContext &context, -+ const UnimplementedNativeViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ name(convertRawProp(context, rawProps, "name", sourceProps.name, {""})) -+ {} -+SwitchProps::SwitchProps( -+ const PropsParserContext &context, -+ const SwitchProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ disabled(convertRawProp(context, rawProps, "disabled", sourceProps.disabled, {false})), -+ value(convertRawProp(context, rawProps, "value", sourceProps.value, {false})), -+ tintColor(convertRawProp(context, rawProps, "tintColor", sourceProps.tintColor, {})), -+ onTintColor(convertRawProp(context, rawProps, "onTintColor", sourceProps.onTintColor, {})), -+ thumbTintColor(convertRawProp(context, rawProps, "thumbTintColor", sourceProps.thumbTintColor, {})), -+ thumbColor(convertRawProp(context, rawProps, "thumbColor", sourceProps.thumbColor, {})), -+ trackColorForFalse(convertRawProp(context, rawProps, "trackColorForFalse", sourceProps.trackColorForFalse, {})), -+ trackColorForTrue(convertRawProp(context, rawProps, "trackColorForTrue", sourceProps.trackColorForTrue, {})) -+ {} -+AndroidSwitchProps::AndroidSwitchProps( -+ const PropsParserContext &context, -+ const AndroidSwitchProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ disabled(convertRawProp(context, rawProps, "disabled", sourceProps.disabled, {false})), -+ enabled(convertRawProp(context, rawProps, "enabled", sourceProps.enabled, {true})), -+ thumbColor(convertRawProp(context, rawProps, "thumbColor", sourceProps.thumbColor, {})), -+ trackColorForFalse(convertRawProp(context, rawProps, "trackColorForFalse", sourceProps.trackColorForFalse, {})), -+ trackColorForTrue(convertRawProp(context, rawProps, "trackColorForTrue", sourceProps.trackColorForTrue, {})), -+ value(convertRawProp(context, rawProps, "value", sourceProps.value, {false})), -+ on(convertRawProp(context, rawProps, "on", sourceProps.on, {false})), -+ thumbTintColor(convertRawProp(context, rawProps, "thumbTintColor", sourceProps.thumbTintColor, {})), -+ trackTintColor(convertRawProp(context, rawProps, "trackTintColor", sourceProps.trackTintColor, {})) -+ {} -+TraceUpdateOverlayProps::TraceUpdateOverlayProps( -+ const PropsParserContext &context, -+ const TraceUpdateOverlayProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) -+ -+ -+ {} -+ModalHostViewProps::ModalHostViewProps( -+ const PropsParserContext &context, -+ const ModalHostViewProps &sourceProps, -+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), -+ -+ animationType(convertRawProp(context, rawProps, "animationType", sourceProps.animationType, {ModalHostViewAnimationType::None})), -+ presentationStyle(convertRawProp(context, rawProps, "presentationStyle", sourceProps.presentationStyle, {ModalHostViewPresentationStyle::FullScreen})), -+ transparent(convertRawProp(context, rawProps, "transparent", sourceProps.transparent, {false})), -+ statusBarTranslucent(convertRawProp(context, rawProps, "statusBarTranslucent", sourceProps.statusBarTranslucent, {false})), -+ hardwareAccelerated(convertRawProp(context, rawProps, "hardwareAccelerated", sourceProps.hardwareAccelerated, {false})), -+ visible(convertRawProp(context, rawProps, "visible", sourceProps.visible, {false})), -+ animated(convertRawProp(context, rawProps, "animated", sourceProps.animated, {false})), -+ supportedOrientations(convertRawProp(context, rawProps, "supportedOrientations", sourceProps.supportedOrientations, {static_cast(ModalHostViewSupportedOrientations::Portrait)})), -+ identifier(convertRawProp(context, rawProps, "identifier", sourceProps.identifier, {0})) -+ {} -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h -new file mode 100644 -index 0000000..f402340 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/Props.h -@@ -0,0 +1,395 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GeneratePropsH.js -+ */ -+#pragma once -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+class JSI_EXPORT SafeAreaViewProps final : public ViewProps { -+ public: -+ SafeAreaViewProps() = default; -+ SafeAreaViewProps(const PropsParserContext& context, const SafeAreaViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ -+}; -+ -+class JSI_EXPORT AndroidHorizontalScrollContentViewProps final : public ViewProps { -+ public: -+ AndroidHorizontalScrollContentViewProps() = default; -+ AndroidHorizontalScrollContentViewProps(const PropsParserContext& context, const AndroidHorizontalScrollContentViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool removeClippedSubviews{false}; -+}; -+ -+class JSI_EXPORT AndroidProgressBarProps final : public ViewProps { -+ public: -+ AndroidProgressBarProps() = default; -+ AndroidProgressBarProps(const PropsParserContext& context, const AndroidProgressBarProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ std::string styleAttr{}; -+ std::string typeAttr{}; -+ bool indeterminate{false}; -+ double progress{0.0}; -+ bool animating{true}; -+ SharedColor color{}; -+ std::string testID{""}; -+}; -+ -+enum class AndroidSwipeRefreshLayoutSize { Default, Large }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidSwipeRefreshLayoutSize &result) { -+ auto string = (std::string)value; -+ if (string == "default") { result = AndroidSwipeRefreshLayoutSize::Default; return; } -+ if (string == "large") { result = AndroidSwipeRefreshLayoutSize::Large; return; } -+ abort(); -+} -+ -+static inline std::string toString(const AndroidSwipeRefreshLayoutSize &value) { -+ switch (value) { -+ case AndroidSwipeRefreshLayoutSize::Default: return "default"; -+ case AndroidSwipeRefreshLayoutSize::Large: return "large"; -+ } -+} -+ -+class JSI_EXPORT AndroidSwipeRefreshLayoutProps final : public ViewProps { -+ public: -+ AndroidSwipeRefreshLayoutProps() = default; -+ AndroidSwipeRefreshLayoutProps(const PropsParserContext& context, const AndroidSwipeRefreshLayoutProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool enabled{true}; -+ std::vector colors{}; -+ SharedColor progressBackgroundColor{}; -+ AndroidSwipeRefreshLayoutSize size{AndroidSwipeRefreshLayoutSize::Default}; -+ Float progressViewOffset{0.0}; -+ bool refreshing{false}; -+}; -+ -+class JSI_EXPORT PullToRefreshViewProps final : public ViewProps { -+ public: -+ PullToRefreshViewProps() = default; -+ PullToRefreshViewProps(const PropsParserContext& context, const PullToRefreshViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ SharedColor tintColor{}; -+ SharedColor titleColor{}; -+ std::string title{}; -+ Float progressViewOffset{0.0}; -+ bool refreshing{false}; -+}; -+ -+class JSI_EXPORT InputAccessoryProps final : public ViewProps { -+ public: -+ InputAccessoryProps() = default; -+ InputAccessoryProps(const PropsParserContext& context, const InputAccessoryProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ SharedColor backgroundColor{}; -+}; -+ -+enum class AndroidDrawerLayoutKeyboardDismissMode { None, OnDrag }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutKeyboardDismissMode &result) { -+ auto string = (std::string)value; -+ if (string == "none") { result = AndroidDrawerLayoutKeyboardDismissMode::None; return; } -+ if (string == "on-drag") { result = AndroidDrawerLayoutKeyboardDismissMode::OnDrag; return; } -+ abort(); -+} -+ -+static inline std::string toString(const AndroidDrawerLayoutKeyboardDismissMode &value) { -+ switch (value) { -+ case AndroidDrawerLayoutKeyboardDismissMode::None: return "none"; -+ case AndroidDrawerLayoutKeyboardDismissMode::OnDrag: return "on-drag"; -+ } -+} -+enum class AndroidDrawerLayoutDrawerPosition { Left, Right }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutDrawerPosition &result) { -+ auto string = (std::string)value; -+ if (string == "left") { result = AndroidDrawerLayoutDrawerPosition::Left; return; } -+ if (string == "right") { result = AndroidDrawerLayoutDrawerPosition::Right; return; } -+ abort(); -+} -+ -+static inline std::string toString(const AndroidDrawerLayoutDrawerPosition &value) { -+ switch (value) { -+ case AndroidDrawerLayoutDrawerPosition::Left: return "left"; -+ case AndroidDrawerLayoutDrawerPosition::Right: return "right"; -+ } -+} -+enum class AndroidDrawerLayoutDrawerLockMode { Unlocked, LockedClosed, LockedOpen }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, AndroidDrawerLayoutDrawerLockMode &result) { -+ auto string = (std::string)value; -+ if (string == "unlocked") { result = AndroidDrawerLayoutDrawerLockMode::Unlocked; return; } -+ if (string == "locked-closed") { result = AndroidDrawerLayoutDrawerLockMode::LockedClosed; return; } -+ if (string == "locked-open") { result = AndroidDrawerLayoutDrawerLockMode::LockedOpen; return; } -+ abort(); -+} -+ -+static inline std::string toString(const AndroidDrawerLayoutDrawerLockMode &value) { -+ switch (value) { -+ case AndroidDrawerLayoutDrawerLockMode::Unlocked: return "unlocked"; -+ case AndroidDrawerLayoutDrawerLockMode::LockedClosed: return "locked-closed"; -+ case AndroidDrawerLayoutDrawerLockMode::LockedOpen: return "locked-open"; -+ } -+} -+ -+class JSI_EXPORT AndroidDrawerLayoutProps final : public ViewProps { -+ public: -+ AndroidDrawerLayoutProps() = default; -+ AndroidDrawerLayoutProps(const PropsParserContext& context, const AndroidDrawerLayoutProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ AndroidDrawerLayoutKeyboardDismissMode keyboardDismissMode{AndroidDrawerLayoutKeyboardDismissMode::None}; -+ SharedColor drawerBackgroundColor{}; -+ AndroidDrawerLayoutDrawerPosition drawerPosition{AndroidDrawerLayoutDrawerPosition::Left}; -+ Float drawerWidth{}; -+ AndroidDrawerLayoutDrawerLockMode drawerLockMode{AndroidDrawerLayoutDrawerLockMode::Unlocked}; -+ SharedColor statusBarBackgroundColor{}; -+}; -+ -+enum class ActivityIndicatorViewSize { Small, Large }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ActivityIndicatorViewSize &result) { -+ auto string = (std::string)value; -+ if (string == "small") { result = ActivityIndicatorViewSize::Small; return; } -+ if (string == "large") { result = ActivityIndicatorViewSize::Large; return; } -+ abort(); -+} -+ -+static inline std::string toString(const ActivityIndicatorViewSize &value) { -+ switch (value) { -+ case ActivityIndicatorViewSize::Small: return "small"; -+ case ActivityIndicatorViewSize::Large: return "large"; -+ } -+} -+ -+class JSI_EXPORT ActivityIndicatorViewProps final : public ViewProps { -+ public: -+ ActivityIndicatorViewProps() = default; -+ ActivityIndicatorViewProps(const PropsParserContext& context, const ActivityIndicatorViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool hidesWhenStopped{false}; -+ bool animating{false}; -+ SharedColor color{}; -+ ActivityIndicatorViewSize size{ActivityIndicatorViewSize::Small}; -+}; -+ -+class JSI_EXPORT UnimplementedNativeViewProps final : public ViewProps { -+ public: -+ UnimplementedNativeViewProps() = default; -+ UnimplementedNativeViewProps(const PropsParserContext& context, const UnimplementedNativeViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ std::string name{""}; -+}; -+ -+class JSI_EXPORT SwitchProps final : public ViewProps { -+ public: -+ SwitchProps() = default; -+ SwitchProps(const PropsParserContext& context, const SwitchProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool disabled{false}; -+ bool value{false}; -+ SharedColor tintColor{}; -+ SharedColor onTintColor{}; -+ SharedColor thumbTintColor{}; -+ SharedColor thumbColor{}; -+ SharedColor trackColorForFalse{}; -+ SharedColor trackColorForTrue{}; -+}; -+ -+class JSI_EXPORT AndroidSwitchProps final : public ViewProps { -+ public: -+ AndroidSwitchProps() = default; -+ AndroidSwitchProps(const PropsParserContext& context, const AndroidSwitchProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ bool disabled{false}; -+ bool enabled{true}; -+ SharedColor thumbColor{}; -+ SharedColor trackColorForFalse{}; -+ SharedColor trackColorForTrue{}; -+ bool value{false}; -+ bool on{false}; -+ SharedColor thumbTintColor{}; -+ SharedColor trackTintColor{}; -+}; -+ -+class JSI_EXPORT TraceUpdateOverlayProps final : public ViewProps { -+ public: -+ TraceUpdateOverlayProps() = default; -+ TraceUpdateOverlayProps(const PropsParserContext& context, const TraceUpdateOverlayProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ -+}; -+ -+enum class ModalHostViewAnimationType { None, Slide, Fade }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewAnimationType &result) { -+ auto string = (std::string)value; -+ if (string == "none") { result = ModalHostViewAnimationType::None; return; } -+ if (string == "slide") { result = ModalHostViewAnimationType::Slide; return; } -+ if (string == "fade") { result = ModalHostViewAnimationType::Fade; return; } -+ abort(); -+} -+ -+static inline std::string toString(const ModalHostViewAnimationType &value) { -+ switch (value) { -+ case ModalHostViewAnimationType::None: return "none"; -+ case ModalHostViewAnimationType::Slide: return "slide"; -+ case ModalHostViewAnimationType::Fade: return "fade"; -+ } -+} -+enum class ModalHostViewPresentationStyle { FullScreen, PageSheet, FormSheet, OverFullScreen }; -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewPresentationStyle &result) { -+ auto string = (std::string)value; -+ if (string == "fullScreen") { result = ModalHostViewPresentationStyle::FullScreen; return; } -+ if (string == "pageSheet") { result = ModalHostViewPresentationStyle::PageSheet; return; } -+ if (string == "formSheet") { result = ModalHostViewPresentationStyle::FormSheet; return; } -+ if (string == "overFullScreen") { result = ModalHostViewPresentationStyle::OverFullScreen; return; } -+ abort(); -+} -+ -+static inline std::string toString(const ModalHostViewPresentationStyle &value) { -+ switch (value) { -+ case ModalHostViewPresentationStyle::FullScreen: return "fullScreen"; -+ case ModalHostViewPresentationStyle::PageSheet: return "pageSheet"; -+ case ModalHostViewPresentationStyle::FormSheet: return "formSheet"; -+ case ModalHostViewPresentationStyle::OverFullScreen: return "overFullScreen"; -+ } -+} -+using ModalHostViewSupportedOrientationsMask = uint32_t; -+ -+enum class ModalHostViewSupportedOrientations: ModalHostViewSupportedOrientationsMask { -+ Portrait = 1 << 0, -+ PortraitUpsideDown = 1 << 1, -+ Landscape = 1 << 2, -+ LandscapeLeft = 1 << 3, -+ LandscapeRight = 1 << 4 -+}; -+ -+constexpr bool operator&( -+ ModalHostViewSupportedOrientationsMask const lhs, -+ enum ModalHostViewSupportedOrientations const rhs) { -+ return lhs & static_cast(rhs); -+} -+ -+constexpr ModalHostViewSupportedOrientationsMask operator|( -+ ModalHostViewSupportedOrientationsMask const lhs, -+ enum ModalHostViewSupportedOrientations const rhs) { -+ return lhs | static_cast(rhs); -+} -+ -+constexpr void operator|=( -+ ModalHostViewSupportedOrientationsMask &lhs, -+ enum ModalHostViewSupportedOrientations const rhs) { -+ lhs = lhs | static_cast(rhs); -+} -+ -+static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ModalHostViewSupportedOrientationsMask &result) { -+ auto items = std::vector{value}; -+ for (const auto &item : items) { -+ if (item == "portrait") { -+ result |= ModalHostViewSupportedOrientations::Portrait; -+ continue; -+ } -+ if (item == "portrait-upside-down") { -+ result |= ModalHostViewSupportedOrientations::PortraitUpsideDown; -+ continue; -+ } -+ if (item == "landscape") { -+ result |= ModalHostViewSupportedOrientations::Landscape; -+ continue; -+ } -+ if (item == "landscape-left") { -+ result |= ModalHostViewSupportedOrientations::LandscapeLeft; -+ continue; -+ } -+ if (item == "landscape-right") { -+ result |= ModalHostViewSupportedOrientations::LandscapeRight; -+ continue; -+ } -+ abort(); -+ } -+} -+ -+static inline std::string toString(const ModalHostViewSupportedOrientationsMask &value) { -+ auto result = std::string{}; -+ auto separator = std::string{", "}; -+ -+ if (value & ModalHostViewSupportedOrientations::Portrait) { -+ result += "portrait" + separator; -+ } -+ if (value & ModalHostViewSupportedOrientations::PortraitUpsideDown) { -+ result += "portrait-upside-down" + separator; -+ } -+ if (value & ModalHostViewSupportedOrientations::Landscape) { -+ result += "landscape" + separator; -+ } -+ if (value & ModalHostViewSupportedOrientations::LandscapeLeft) { -+ result += "landscape-left" + separator; -+ } -+ if (value & ModalHostViewSupportedOrientations::LandscapeRight) { -+ result += "landscape-right" + separator; -+ } -+ if (!result.empty()) { -+ result.erase(result.length() - separator.length()); -+ } -+ return result; -+} -+ -+class JSI_EXPORT ModalHostViewProps final : public ViewProps { -+ public: -+ ModalHostViewProps() = default; -+ ModalHostViewProps(const PropsParserContext& context, const ModalHostViewProps &sourceProps, const RawProps &rawProps); -+ -+#pragma mark - Props -+ -+ ModalHostViewAnimationType animationType{ModalHostViewAnimationType::None}; -+ ModalHostViewPresentationStyle presentationStyle{ModalHostViewPresentationStyle::FullScreen}; -+ bool transparent{false}; -+ bool statusBarTranslucent{false}; -+ bool hardwareAccelerated{false}; -+ bool visible{false}; -+ bool animated{false}; -+ ModalHostViewSupportedOrientationsMask supportedOrientations{static_cast(ModalHostViewSupportedOrientations::Portrait)}; -+ int identifier{0}; -+}; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h -new file mode 100644 -index 0000000..e08f2ae ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h -@@ -0,0 +1,257 @@ -+/** -+* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+* -+* Do not edit this file as changes may cause incorrect behavior and will be lost -+* once the code is regenerated. -+* -+* @generated by codegen project: GenerateComponentHObjCpp.js -+*/ -+ -+#import -+#import -+#import -+ -+NS_ASSUME_NONNULL_BEGIN -+ -+@protocol RCTSafeAreaViewViewProtocol -+ -+@end -+ -+@protocol RCTAndroidHorizontalScrollContentViewViewProtocol -+ -+@end -+ -+@protocol RCTAndroidProgressBarViewProtocol -+ -+@end -+ -+@protocol RCTAndroidSwipeRefreshLayoutViewProtocol -+- (void)setNativeRefreshing:(BOOL)value; -+@end -+ -+RCT_EXTERN inline void RCTAndroidSwipeRefreshLayoutHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"setNativeRefreshing"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidSwipeRefreshLayout", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"AndroidSwipeRefreshLayout", commandName, @"1st")) { -+ return; -+ } -+#endif -+ BOOL value = [(NSNumber *)arg0 boolValue]; -+ -+ [componentView setNativeRefreshing:value]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidSwipeRefreshLayout", commandName); -+#endif -+} -+ -+@protocol RCTPullToRefreshViewViewProtocol -+- (void)setNativeRefreshing:(BOOL)refreshing; -+@end -+ -+RCT_EXTERN inline void RCTPullToRefreshViewHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"setNativeRefreshing"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"PullToRefreshView", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"PullToRefreshView", commandName, @"1st")) { -+ return; -+ } -+#endif -+ BOOL refreshing = [(NSNumber *)arg0 boolValue]; -+ -+ [componentView setNativeRefreshing:refreshing]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"PullToRefreshView", commandName); -+#endif -+} -+ -+@protocol RCTInputAccessoryViewProtocol -+ -+@end -+ -+@protocol RCTAndroidDrawerLayoutViewProtocol -+- (void)openDrawer; -+- (void)closeDrawer; -+@end -+ -+RCT_EXTERN inline void RCTAndroidDrawerLayoutHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"openDrawer"]) { -+#if RCT_DEBUG -+ if ([args count] != 0) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidDrawerLayout", commandName, (int)[args count], 0); -+ return; -+ } -+#endif -+ -+ -+ -+ [componentView openDrawer]; -+ return; -+} -+ -+if ([commandName isEqualToString:@"closeDrawer"]) { -+#if RCT_DEBUG -+ if ([args count] != 0) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidDrawerLayout", commandName, (int)[args count], 0); -+ return; -+ } -+#endif -+ -+ -+ -+ [componentView closeDrawer]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidDrawerLayout", commandName); -+#endif -+} -+ -+@protocol RCTActivityIndicatorViewViewProtocol -+ -+@end -+ -+@protocol RCTUnimplementedNativeViewViewProtocol -+ -+@end -+ -+@protocol RCTSwitchViewProtocol -+- (void)setValue:(BOOL)value; -+@end -+ -+RCT_EXTERN inline void RCTSwitchHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"setValue"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"Switch", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"Switch", commandName, @"1st")) { -+ return; -+ } -+#endif -+ BOOL value = [(NSNumber *)arg0 boolValue]; -+ -+ [componentView setValue:value]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"Switch", commandName); -+#endif -+} -+ -+@protocol RCTAndroidSwitchViewProtocol -+- (void)setNativeValue:(BOOL)value; -+@end -+ -+RCT_EXTERN inline void RCTAndroidSwitchHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"setNativeValue"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"AndroidSwitch", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"boolean", @"AndroidSwitch", commandName, @"1st")) { -+ return; -+ } -+#endif -+ BOOL value = [(NSNumber *)arg0 boolValue]; -+ -+ [componentView setNativeValue:value]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"AndroidSwitch", commandName); -+#endif -+} -+ -+@protocol RCTTraceUpdateOverlayViewProtocol -+- (void)draw:(NSString *)overlays; -+@end -+ -+RCT_EXTERN inline void RCTTraceUpdateOverlayHandleCommand( -+ id componentView, -+ NSString const *commandName, -+ NSArray const *args) -+{ -+ if ([commandName isEqualToString:@"draw"]) { -+#if RCT_DEBUG -+ if ([args count] != 1) { -+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"TraceUpdateOverlay", commandName, (int)[args count], 1); -+ return; -+ } -+#endif -+ -+ NSObject *arg0 = args[0]; -+#if RCT_DEBUG -+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSString class], @"string", @"TraceUpdateOverlay", commandName, @"1st")) { -+ return; -+ } -+#endif -+ NSString * overlays = (NSString *)arg0; -+ -+ [componentView draw:overlays]; -+ return; -+} -+ -+#if RCT_DEBUG -+ RCTLogError(@"%@ received command %@, which is not a supported command.", @"TraceUpdateOverlay", commandName); -+#endif -+} -+ -+@protocol RCTModalHostViewViewProtocol -+ -+@end -+ -+NS_ASSUME_NONNULL_END -\ No newline at end of file -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp -new file mode 100644 -index 0000000..d9a2760 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp -@@ -0,0 +1,26 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateShadowNodeCpp.js -+ */ -+ -+#include -+ -+namespace facebook { -+namespace react { -+ -+extern const char AndroidHorizontalScrollContentViewComponentName[] = "AndroidHorizontalScrollContentView"; -+extern const char AndroidSwipeRefreshLayoutComponentName[] = "AndroidSwipeRefreshLayout"; -+extern const char PullToRefreshViewComponentName[] = "PullToRefreshView"; -+extern const char AndroidDrawerLayoutComponentName[] = "AndroidDrawerLayout"; -+extern const char ActivityIndicatorViewComponentName[] = "ActivityIndicatorView"; -+extern const char UnimplementedNativeViewComponentName[] = "UnimplementedNativeView"; -+extern const char SwitchComponentName[] = "Switch"; -+extern const char TraceUpdateOverlayComponentName[] = "TraceUpdateOverlay"; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h -new file mode 100644 -index 0000000..a5874dc ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ShadowNodes.h -@@ -0,0 +1,111 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateShadowNodeH.js -+ */ -+ -+#pragma once -+ -+#include -+#include -+#include -+#include -+#include -+ -+namespace facebook { -+namespace react { -+ -+JSI_EXPORT extern const char AndroidHorizontalScrollContentViewComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using AndroidHorizontalScrollContentViewShadowNode = ConcreteViewShadowNode< -+ AndroidHorizontalScrollContentViewComponentName, -+ AndroidHorizontalScrollContentViewProps, -+ AndroidHorizontalScrollContentViewEventEmitter, -+ AndroidHorizontalScrollContentViewState>; -+ -+JSI_EXPORT extern const char AndroidSwipeRefreshLayoutComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using AndroidSwipeRefreshLayoutShadowNode = ConcreteViewShadowNode< -+ AndroidSwipeRefreshLayoutComponentName, -+ AndroidSwipeRefreshLayoutProps, -+ AndroidSwipeRefreshLayoutEventEmitter, -+ AndroidSwipeRefreshLayoutState>; -+ -+JSI_EXPORT extern const char PullToRefreshViewComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using PullToRefreshViewShadowNode = ConcreteViewShadowNode< -+ PullToRefreshViewComponentName, -+ PullToRefreshViewProps, -+ PullToRefreshViewEventEmitter, -+ PullToRefreshViewState>; -+ -+JSI_EXPORT extern const char AndroidDrawerLayoutComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using AndroidDrawerLayoutShadowNode = ConcreteViewShadowNode< -+ AndroidDrawerLayoutComponentName, -+ AndroidDrawerLayoutProps, -+ AndroidDrawerLayoutEventEmitter, -+ AndroidDrawerLayoutState>; -+ -+JSI_EXPORT extern const char ActivityIndicatorViewComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using ActivityIndicatorViewShadowNode = ConcreteViewShadowNode< -+ ActivityIndicatorViewComponentName, -+ ActivityIndicatorViewProps, -+ ActivityIndicatorViewEventEmitter, -+ ActivityIndicatorViewState>; -+ -+JSI_EXPORT extern const char UnimplementedNativeViewComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using UnimplementedNativeViewShadowNode = ConcreteViewShadowNode< -+ UnimplementedNativeViewComponentName, -+ UnimplementedNativeViewProps, -+ UnimplementedNativeViewEventEmitter, -+ UnimplementedNativeViewState>; -+ -+JSI_EXPORT extern const char SwitchComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using SwitchShadowNode = ConcreteViewShadowNode< -+ SwitchComponentName, -+ SwitchProps, -+ SwitchEventEmitter, -+ SwitchState>; -+ -+JSI_EXPORT extern const char TraceUpdateOverlayComponentName[]; -+ -+/* -+ * `ShadowNode` for component. -+ */ -+using TraceUpdateOverlayShadowNode = ConcreteViewShadowNode< -+ TraceUpdateOverlayComponentName, -+ TraceUpdateOverlayProps, -+ TraceUpdateOverlayEventEmitter, -+ TraceUpdateOverlayState>; -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp -new file mode 100644 -index 0000000..3b5a0f5 ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.cpp -@@ -0,0 +1,18 @@ -+ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateStateCpp.js -+ */ -+#include -+ -+namespace facebook { -+namespace react { -+ -+ -+ -+} // namespace react -+} // namespace facebook -diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h -new file mode 100644 -index 0000000..29ac2df ---- /dev/null -+++ b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/States.h -@@ -0,0 +1,141 @@ -+/** -+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). -+ * -+ * Do not edit this file as changes may cause incorrect behavior and will be lost -+ * once the code is regenerated. -+ * -+ * @generated by codegen project: GenerateStateH.js -+ */ -+#pragma once -+ -+#ifdef ANDROID -+#include -+#include -+#include -+#endif -+ -+namespace facebook { -+namespace react { -+ -+class AndroidHorizontalScrollContentViewState { -+public: -+ AndroidHorizontalScrollContentViewState() = default; -+ -+#ifdef ANDROID -+ AndroidHorizontalScrollContentViewState(AndroidHorizontalScrollContentViewState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class AndroidSwipeRefreshLayoutState { -+public: -+ AndroidSwipeRefreshLayoutState() = default; -+ -+#ifdef ANDROID -+ AndroidSwipeRefreshLayoutState(AndroidSwipeRefreshLayoutState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class PullToRefreshViewState { -+public: -+ PullToRefreshViewState() = default; -+ -+#ifdef ANDROID -+ PullToRefreshViewState(PullToRefreshViewState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class AndroidDrawerLayoutState { -+public: -+ AndroidDrawerLayoutState() = default; -+ -+#ifdef ANDROID -+ AndroidDrawerLayoutState(AndroidDrawerLayoutState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class ActivityIndicatorViewState { -+public: -+ ActivityIndicatorViewState() = default; -+ -+#ifdef ANDROID -+ ActivityIndicatorViewState(ActivityIndicatorViewState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class UnimplementedNativeViewState { -+public: -+ UnimplementedNativeViewState() = default; -+ -+#ifdef ANDROID -+ UnimplementedNativeViewState(UnimplementedNativeViewState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class SwitchState { -+public: -+ SwitchState() = default; -+ -+#ifdef ANDROID -+ SwitchState(SwitchState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+class TraceUpdateOverlayState { -+public: -+ TraceUpdateOverlayState() = default; -+ -+#ifdef ANDROID -+ TraceUpdateOverlayState(TraceUpdateOverlayState const &previousState, folly::dynamic data){}; -+ folly::dynamic getDynamic() const { -+ return {}; -+ }; -+ MapBuffer getMapBuffer() const { -+ return MapBufferBuilder::EMPTY(); -+ }; -+#endif -+}; -+ -+} // namespace react -+} // namespace facebook -\ No newline at end of file From b7d12e70419cf6487c411e353a75845695b4cb64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 4 Nov 2024 12:31:06 -0300 Subject: [PATCH 39/47] refactor: updated intl patch to remove unused implementation --- patches/intl+1.2.5.patch | 52 +++++++++++----------------------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/patches/intl+1.2.5.patch b/patches/intl+1.2.5.patch index 347be4762..bf2bb4b85 100644 --- a/patches/intl+1.2.5.patch +++ b/patches/intl+1.2.5.patch @@ -1,45 +1,21 @@ diff --git a/node_modules/intl/lib/core.js b/node_modules/intl/lib/core.js -index 9334cfc..78e7f06 100644 +index 9334cfc..4525a08 100644 --- a/node_modules/intl/lib/core.js +++ b/node_modules/intl/lib/core.js -@@ -591,7 +591,8 @@ function createRegExpRestore() { +@@ -540,7 +540,7 @@ function createRegExpRestore() { - // Set the lastIndex of the generated expression to ensure that the match - // is found in the correct index. -- expr.lastIndex = regExpCache.leftContext.length; -+ const leftContext = regExpCache.leftContext || ''; -+ expr.lastIndex = leftContext.length; - - expr.exec(regExpCache.input); - }; -@@ -4291,13 +4292,26 @@ defineProperty(Intl, '__applyLocaleSensitivePrototypes', { + var regExpCache = { + lastMatch: RegExp.lastMatch || '', +- leftContext: RegExp.leftContext, ++ leftContext: RegExp.leftContext || '', + multiline: RegExp.multiline, + input: RegExp.input + }, +@@ -4291,6 +4291,7 @@ defineProperty(Intl, '__applyLocaleSensitivePrototypes', { writable: true, configurable: true, value: function value() { -- defineProperty(Number.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Number.toLocaleString }); -- // Need this here for IE 8, to avoid the _DontEnum_ bug -- defineProperty(Date.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Date.toLocaleString }); -+ // Create wrapper functions for locale operations -+ const localeHelpers = { -+ formatNumber: function(num) { -+ return ls.Number.toLocaleString.call(num); -+ }, -+ formatDate: function(date) { -+ return ls.Date.toLocaleString.call(date); -+ } -+ }; - -+ // Add other Date methods from ls.Date - for (var k in ls.Date) { -- if (hop.call(ls.Date, k)) defineProperty(Date.prototype, k, { writable: true, configurable: true, value: ls.Date[k] }); -+ if (hop.call(ls.Date, k)) { -+ localeHelpers[`date_${k}`] = function(date) { -+ return ls.Date[k].call(date); -+ }; -+ } - } -+ -+ return localeHelpers; - } - }); - ++ return null; + defineProperty(Number.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Number.toLocaleString }); + // Need this here for IE 8, to avoid the _DontEnum_ bug + defineProperty(Date.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Date.toLocaleString }); From 0b7766405d007dcdf70771291b46ed62e341f49a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 4 Nov 2024 13:10:29 -0300 Subject: [PATCH 40/47] chore: added comment on react-native patch --- patches/react-native+0.72.5.patch | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/patches/react-native+0.72.5.patch b/patches/react-native+0.72.5.patch index 60eb86d51..787525e2f 100644 --- a/patches/react-native+0.72.5.patch +++ b/patches/react-native+0.72.5.patch @@ -1,17 +1,18 @@ diff --git a/node_modules/react-native/Libraries/Core/InitializeCore.js b/node_modules/react-native/Libraries/Core/InitializeCore.js -index 25377f6..1d0dd73 100644 +index 25377f6..cd13707 100644 --- a/node_modules/react-native/Libraries/Core/InitializeCore.js +++ b/node_modules/react-native/Libraries/Core/InitializeCore.js -@@ -26,6 +26,8 @@ +@@ -26,6 +26,9 @@ const start = Date.now(); ++// setUpSES should be imported after setUpXHR because setUpXHR adds AbortController: +require('./setUpXHR'); +require('./setUpSES'); require('./setUpGlobals'); require('./setUpDOM'); require('./setUpPerformance'); -@@ -33,7 +35,6 @@ require('./setUpErrorHandling'); +@@ -33,7 +36,6 @@ require('./setUpErrorHandling'); require('./polyfillPromise'); require('./setUpRegeneratorRuntime'); require('./setUpTimers'); From 1cb45b72707436d2a6ec66de40ca8abc8f6a5081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 4 Nov 2024 13:11:09 -0300 Subject: [PATCH 41/47] chore: removed exit 1 from preinstall on root --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 80f6e9f91..837292d7c 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "test": "jest", "setup": "npm install && ./node_modules/.bin/allow-scripts && npm run postinstall", "locale-update-pot": "ttag extract -o ./locale/texts.pot ./src/", - "preinstall": "exit 1", "postinstall": "rn-nodeify --install stream,process,path,events,crypto,console,buffer --hack && npx patch-package" }, "dependencies": { From 608458690138f6f8e8333b9ed3145b5c06ba837c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Mon, 4 Nov 2024 13:35:30 -0300 Subject: [PATCH 42/47] chore: updated intl patch to add a comment --- patches/intl+1.2.5.patch | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/patches/intl+1.2.5.patch b/patches/intl+1.2.5.patch index bf2bb4b85..5b33443db 100644 --- a/patches/intl+1.2.5.patch +++ b/patches/intl+1.2.5.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/intl/lib/core.js b/node_modules/intl/lib/core.js -index 9334cfc..4525a08 100644 +index 9334cfc..552a228 100644 --- a/node_modules/intl/lib/core.js +++ b/node_modules/intl/lib/core.js @@ -540,7 +540,7 @@ function createRegExpRestore() { @@ -11,11 +11,24 @@ index 9334cfc..4525a08 100644 multiline: RegExp.multiline, input: RegExp.input }, -@@ -4291,6 +4291,7 @@ defineProperty(Intl, '__applyLocaleSensitivePrototypes', { +@@ -4291,6 +4291,12 @@ defineProperty(Intl, '__applyLocaleSensitivePrototypes', { writable: true, configurable: true, value: function value() { -+ return null; ++ return null; ++ /* ++ XXX: These are mutating Number and Date prototypes which is blocked by SES, causing the app to crash. ++ Since we're not using toLocaleString anywhere in our code, I'm just returning `null` here. ++ */ ++ /* defineProperty(Number.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Number.toLocaleString }); // Need this here for IE 8, to avoid the _DontEnum_ bug defineProperty(Date.prototype, 'toLocaleString', { writable: true, configurable: true, value: ls.Date.toLocaleString }); +@@ -4298,6 +4304,7 @@ defineProperty(Intl, '__applyLocaleSensitivePrototypes', { + for (var k in ls.Date) { + if (hop.call(ls.Date, k)) defineProperty(Date.prototype, k, { writable: true, configurable: true, value: ls.Date[k] }); + } ++ */ + } + }); + From 018bb1aa39d357cccb36560f2d70dbf07fc2f20f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Wed, 6 Nov 2024 17:36:53 -0300 Subject: [PATCH 43/47] chore: removed testMatch from package.json --- package.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/package.json b/package.json index 837292d7c..eefc6cffa 100644 --- a/package.json +++ b/package.json @@ -152,9 +152,6 @@ "@lavamoat/preinstall-always-fail": false, "@sentry/react-native>@sentry/cli": false, "ttag-cli": false - }, - "testMatch": [ - "**/*.test.js" - ] + } } } From 0fb31a7f93d888913e0cd99f790b0202fca09df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Wed, 6 Nov 2024 17:38:20 -0300 Subject: [PATCH 44/47] chore: updated allow-scripts --- package-lock.json | 1352 ++++++++++++++++++++++++++++++++------------- package.json | 4 +- 2 files changed, 960 insertions(+), 396 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0383f9f32..3849b9992 100644 --- a/package-lock.json +++ b/package-lock.json @@ -77,7 +77,7 @@ "@babel/preset-env": "7.22.7", "@babel/runtime": "7.22.6", "@jest/globals": "29.7.0", - "@lavamoat/allow-scripts": "3.0.1", + "@lavamoat/allow-scripts": "3.3.0", "@react-native/eslint-config": "0.72.2", "@react-native/metro-config": "0.72.11", "@tsconfig/react-native": "3.0.2", @@ -2533,12 +2533,6 @@ "react-native-svg": "> 7.0" } }, - "node_modules/@gar/promisify": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", - "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", - "dev": true - }, "node_modules/@hapi/hoek": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", @@ -2745,6 +2739,96 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -4197,9 +4281,9 @@ "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" }, "node_modules/@lavamoat/aa": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@lavamoat/aa/-/aa-4.0.1.tgz", - "integrity": "sha512-OB9ckERyYRctJ61jWV6DiKZcgsBCngGyLwxToqn9tar7UHvnTYCT6E/uuBE1qnjBDfje6aQCMqS+/QZ9DuoGcw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@lavamoat/aa/-/aa-4.3.0.tgz", + "integrity": "sha512-Kwf64RpLDvWCzHdG1IEItGf0JfMH9DyjBhIAj1NNJQzmKIaFE/DCc6INKJu7iVqp7aVdKaVB3aJlV4/lKOmJDg==", "dev": true, "dependencies": { "resolve": "1.22.8" @@ -4208,18 +4292,18 @@ "lavamoat-ls": "src/cli.js" }, "engines": { - "node": "^16.20.0 || ^18.0.0 || ^20.0.0" + "node": "^16.20.0 || ^18.0.0 || ^20.0.0 || ^22.0.0" } }, "node_modules/@lavamoat/allow-scripts": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@lavamoat/allow-scripts/-/allow-scripts-3.0.1.tgz", - "integrity": "sha512-Y+aGBwX2fUcUyqvv4n4GW0JlMRH68r9h+zk42dTRb0hAQktz1kz/y1Bw0K5TAGAGRc0ecvE0jRJ7CXO3MeTqbQ==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@lavamoat/allow-scripts/-/allow-scripts-3.3.0.tgz", + "integrity": "sha512-1R7SBnCghbkPv/+8t6P8BHJlu8+dtUKiWMvaryIbSbXvDRPYaj2NG6hqbCPbsqMMqqjJViSw+LFhg2wn0Re61Q==", "dev": true, "dependencies": { - "@lavamoat/aa": "^4.0.1", - "@npmcli/run-script": "6.0.2", - "bin-links": "4.0.3", + "@lavamoat/aa": "^4.3.0", + "@npmcli/run-script": "8.1.0", + "bin-links": "4.0.4", "npm-normalize-package-bin": "3.0.1", "yargs": "17.7.2" }, @@ -4227,7 +4311,10 @@ "allow-scripts": "src/cli.js" }, "engines": { - "node": "^16.20.0 || ^18.0.0 || ^20.0.0" + "node": "^16.20.0 || ^18.0.0 || ^20.0.0 || ^22.0.0" + }, + "peerDependencies": { + "@lavamoat/preinstall-always-fail": "*" } }, "node_modules/@lavamoat/allow-scripts/node_modules/ansi-styles": { @@ -4399,43 +4486,113 @@ "react-native": "*" } }, + "node_modules/@npmcli/agent": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-2.2.2.tgz", + "integrity": "sha512-OrcNPXdpSl9UX7qPVRWbmWMCSXrcDa2M9DvrbOTj7ao1S4PlqVFYv9/yLKMkrJKZ/V5A/kDBC690or307i26Og==", + "dev": true, + "dependencies": { + "agent-base": "^7.1.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.1", + "lru-cache": "^10.0.1", + "socks-proxy-agent": "^8.0.3" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/agent/node_modules/agent-base": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", + "dev": true, + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@npmcli/agent/node_modules/https-proxy-agent": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", + "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", + "dev": true, + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@npmcli/agent/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true + }, "node_modules/@npmcli/fs": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-2.1.2.tgz", - "integrity": "sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-3.1.1.tgz", + "integrity": "sha512-q9CRWjpHCMIh5sVyefoD1cA7PkvILqCZsnSOEUUivORLjxCO/Irmue2DprETiNgEqktDBZaM1Bi+jrarx1XdCg==", "dev": true, "dependencies": { - "@gar/promisify": "^1.1.3", "semver": "^7.3.5" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/@npmcli/move-file": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-2.0.1.tgz", - "integrity": "sha512-mJd2Z5TjYWq/ttPLLGqArdtnC74J6bOzg4rMDnN+p1xTacZ2yPRCk2y0oSWQtygLR9YVQXgOcONrwtnk3JupxQ==", - "deprecated": "This functionality has been moved to @npmcli/fs", + "node_modules/@npmcli/git": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-5.0.8.tgz", + "integrity": "sha512-liASfw5cqhjNW9UFd+ruwwdEf/lbOAQjLL2XY2dFW/bkJheXDYZgOyul/4gVvEV4BWkTXjYGmDqMw9uegdbJNQ==", "dev": true, "dependencies": { - "mkdirp": "^1.0.4", - "rimraf": "^3.0.2" + "@npmcli/promise-spawn": "^7.0.0", + "ini": "^4.1.3", + "lru-cache": "^10.0.1", + "npm-pick-manifest": "^9.0.0", + "proc-log": "^4.0.0", + "promise-inflight": "^1.0.1", + "promise-retry": "^2.0.1", + "semver": "^7.3.5", + "which": "^4.0.0" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/@npmcli/move-file/node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "node_modules/@npmcli/git/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/@npmcli/git/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true + }, + "node_modules/@npmcli/git/node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", "dev": true, + "dependencies": { + "isexe": "^3.1.1" + }, "bin": { - "mkdirp": "bin/cmd.js" + "node-which": "bin/which.js" }, "engines": { - "node": ">=10" + "node": "^16.13.0 || >=18.0.0" } }, "node_modules/@npmcli/node-gyp": { @@ -4447,62 +4604,162 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/@npmcli/promise-spawn": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-6.0.2.tgz", - "integrity": "sha512-gGq0NJkIGSwdbUt4yhdF8ZrmkGKVz9vAdVzpOfnom+V8PLSmSOVhZwbNvZZS1EYcJN5hzzKBxmmVVAInM6HQLg==", + "node_modules/@npmcli/package-json": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-5.2.1.tgz", + "integrity": "sha512-f7zYC6kQautXHvNbLEWgD/uGu1+xCn9izgqBfgItWSx22U0ZDekxN08A1vM8cTxj/cRVe0Q94Ode+tdoYmIOOQ==", + "dev": true, + "dependencies": { + "@npmcli/git": "^5.0.0", + "glob": "^10.2.2", + "hosted-git-info": "^7.0.0", + "json-parse-even-better-errors": "^3.0.0", + "normalize-package-data": "^6.0.0", + "proc-log": "^4.0.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/package-json/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "dependencies": { - "which": "^3.0.0" + "balanced-match": "^1.0.0" + } + }, + "node_modules/@npmcli/package-json/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@npmcli/package-json/node_modules/json-parse-even-better-errors": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.2.tgz", + "integrity": "sha512-fi0NG4bPjCHunUJffmLd0gxssIgkNmArMvis4iNah6Owg1MCJjWhEcDLmsK6iGkJq3tHwbDkTlce70/tmXN4cQ==", + "dev": true, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/@npmcli/package-json/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@npmcli/promise-spawn": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-7.0.2.tgz", + "integrity": "sha512-xhfYPXoV5Dy4UkY0D+v2KkwvnDfiA/8Mt3sWCGI/hM03NsYIH8ZaG6QzS9x7pje5vHZBZJ2v6VRFVTWACnqcmQ==", + "dev": true, + "dependencies": { + "which": "^4.0.0" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/promise-spawn/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, "node_modules/@npmcli/promise-spawn/node_modules/which": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/which/-/which-3.0.1.tgz", - "integrity": "sha512-XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", "dev": true, "dependencies": { - "isexe": "^2.0.0" + "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.13.0 || >=18.0.0" } }, "node_modules/@npmcli/run-script": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-6.0.2.tgz", - "integrity": "sha512-NCcr1uQo1k5U+SYlnIrbAh3cxy+OQT1VtqiAbxdymSlptbzBb62AjH2xXgjNCoP073hoa1CfCAcwoZ8k96C4nA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-8.1.0.tgz", + "integrity": "sha512-y7efHHwghQfk28G2z3tlZ67pLG0XdfYbcVG26r7YIXALRsrVQcTq4/tdenSmdOrEsNahIYA/eh8aEVROWGFUDg==", "dev": true, "dependencies": { "@npmcli/node-gyp": "^3.0.0", - "@npmcli/promise-spawn": "^6.0.0", - "node-gyp": "^9.0.0", - "read-package-json-fast": "^3.0.0", - "which": "^3.0.0" + "@npmcli/package-json": "^5.0.0", + "@npmcli/promise-spawn": "^7.0.0", + "node-gyp": "^10.0.0", + "proc-log": "^4.0.0", + "which": "^4.0.0" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/@npmcli/run-script/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "dev": true, + "engines": { + "node": ">=16" } }, "node_modules/@npmcli/run-script/node_modules/which": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/which/-/which-3.0.1.tgz", - "integrity": "sha512-XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", "dev": true, "dependencies": { - "isexe": "^2.0.0" + "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.13.0 || >=18.0.0" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" } }, "node_modules/@react-native-async-storage/async-storage": { @@ -7067,15 +7324,6 @@ "@sinonjs/commons": "^3.0.0" } }, - "node_modules/@tootallnate/once": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", - "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", - "dev": true, - "engines": { - "node": ">= 10" - } - }, "node_modules/@tsconfig/react-native": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@tsconfig/react-native/-/react-native-3.0.2.tgz", @@ -7519,10 +7767,13 @@ "dev": true }, "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-2.0.0.tgz", + "integrity": "sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } }, "node_modules/abort-controller": { "version": "3.0.0", @@ -7624,18 +7875,6 @@ "node": ">= 6.0.0" } }, - "node_modules/agentkeepalive": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", - "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", - "dev": true, - "dependencies": { - "humanize-ms": "^1.2.1" - }, - "engines": { - "node": ">= 8.0.0" - } - }, "node_modules/aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -7756,54 +7995,6 @@ "resolved": "https://registry.npmjs.org/appdirsjs/-/appdirsjs-1.2.7.tgz", "integrity": "sha512-Quji6+8kLBC3NnBeo14nPDq0+2jUs5s3/xEye+udFHumHhRk4M7aAMXp/PBJqkKYGuuyR9M/6Dq7d2AViiGmhw==" }, - "node_modules/aproba": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", - "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", - "dev": true - }, - "node_modules/are-we-there-yet": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz", - "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==", - "dev": true, - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/are-we-there-yet/node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/are-we-there-yet/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/are-we-there-yet/node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -8510,9 +8701,9 @@ } }, "node_modules/bin-links": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-4.0.3.tgz", - "integrity": "sha512-obsRaULtJurnfox/MDwgq6Yo9kzbv1CPTk/1/s7Z/61Lezc8IKkFCOXNeVLXz0456WRzBQmSsDWlai2tIhBsfA==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-4.0.4.tgz", + "integrity": "sha512-cMtq4W5ZsEwcutJrVId+a/tjt8GSbS+h0oNkdl6+6rBuEv8Ot33Bevj5KPm40t309zuhVic8NjpuL42QCiJWWA==", "dev": true, "dependencies": { "cmd-shim": "^6.0.0", @@ -8875,32 +9066,26 @@ } }, "node_modules/cacache": { - "version": "16.1.3", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-16.1.3.tgz", - "integrity": "sha512-/+Emcj9DAXxX4cwlLmRI9c166RuL3w30zp4R7Joiv2cQTtTtA+jeuCAjH3ZlGnYS3tKENSrKhAzVVP9GVyzeYQ==", + "version": "18.0.4", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-18.0.4.tgz", + "integrity": "sha512-B+L5iIa9mgcjLbliir2th36yEwPftrzteHYujzsx3dFP/31GCHcIeS8f5MGd80odLOjaOvSpU3EEAmRQptkxLQ==", "dev": true, "dependencies": { - "@npmcli/fs": "^2.1.0", - "@npmcli/move-file": "^2.0.0", - "chownr": "^2.0.0", - "fs-minipass": "^2.1.0", - "glob": "^8.0.1", - "infer-owner": "^1.0.4", - "lru-cache": "^7.7.1", - "minipass": "^3.1.6", - "minipass-collect": "^1.0.2", + "@npmcli/fs": "^3.1.0", + "fs-minipass": "^3.0.0", + "glob": "^10.2.2", + "lru-cache": "^10.0.1", + "minipass": "^7.0.3", + "minipass-collect": "^2.0.1", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", - "mkdirp": "^1.0.4", "p-map": "^4.0.0", - "promise-inflight": "^1.0.1", - "rimraf": "^3.0.2", - "ssri": "^9.0.0", + "ssri": "^10.0.0", "tar": "^6.1.11", - "unique-filename": "^2.0.0" + "unique-filename": "^3.0.0" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/cacache/node_modules/brace-expansion": { @@ -8913,55 +9098,44 @@ } }, "node_modules/cacache/node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", "dev": true, "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" }, - "engines": { - "node": ">=12" + "bin": { + "glob": "dist/esm/bin.mjs" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/cacache/node_modules/lru-cache": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", - "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", - "dev": true, - "engines": { - "node": ">=12" - } + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true }, "node_modules/cacache/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" }, "engines": { - "node": ">=10" - } - }, - "node_modules/cacache/node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true, - "bin": { - "mkdirp": "bin/cmd.js" + "node": ">=16 || 14 >=14.17" }, - "engines": { - "node": ">=10" + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/cache-content-type": { @@ -9202,9 +9376,9 @@ } }, "node_modules/cmd-shim": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-6.0.2.tgz", - "integrity": "sha512-+FFYbB0YLaAkhkcrjkyNLYDiOsFSfRjwjY19LXk/psmMx1z00xlCv7hhQoTGXXIKi+YXHL/iiFo8NqMVQX9nOw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-6.0.3.tgz", + "integrity": "sha512-FMabTRlc5t5zjdenF6mS0MBeFZm0XqHqeOkcskKFb/LYCcRQ5fVgLOHVc4Lq9CqABd9zhjwPjMBCJvMCziSVtA==", "dev": true, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" @@ -9272,15 +9446,6 @@ "simple-swizzle": "^0.2.2" } }, - "node_modules/color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true, - "bin": { - "color-support": "bin.js" - } - }, "node_modules/color/node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -9420,12 +9585,6 @@ "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==" }, - "node_modules/console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", - "dev": true - }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -10018,6 +10177,12 @@ "url": "https://github.com/fb55/domutils?sponsor=1" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -11432,6 +11597,34 @@ "integrity": "sha512-J+ler7Ta54FwwNcx6wQRDhTIbNeyDcARMkOcguEqnEdtm0jKvN3Li3PDAb2Du3ubJYEWfYL83XMROXdsXAXycw==", "dev": true }, + "node_modules/foreground-child": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", + "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/foreground-child/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -11474,15 +11667,15 @@ } }, "node_modules/fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", + "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==", "dev": true, "dependencies": { - "minipass": "^3.0.0" + "minipass": "^7.0.3" }, "engines": { - "node": ">= 8" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/fs.realpath": { @@ -11538,25 +11731,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/gauge": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz", - "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==", - "dev": true, - "dependencies": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.3", - "console-control-strings": "^1.1.0", - "has-unicode": "^2.0.1", - "signal-exit": "^3.0.7", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.5" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -11894,12 +12068,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", - "dev": true - }, "node_modules/hash-base": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", @@ -12014,6 +12182,24 @@ "react-is": "^16.7.0" } }, + "node_modules/hosted-git-info": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.2.tgz", + "integrity": "sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==", + "dev": true, + "dependencies": { + "lru-cache": "^10.0.1" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/hosted-git-info/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true + }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -12105,17 +12291,28 @@ } }, "node_modules/http-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", - "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "dev": true, "dependencies": { - "@tootallnate/once": "2", - "agent-base": "6", - "debug": "4" + "agent-base": "^7.1.0", + "debug": "^4.3.4" }, "engines": { - "node": ">= 6" + "node": ">= 14" + } + }, + "node_modules/http-proxy-agent/node_modules/agent-base": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", + "dev": true, + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" } }, "node_modules/https-proxy-agent": { @@ -12139,15 +12336,6 @@ "node": ">=10.17.0" } }, - "node_modules/humanize-ms": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", - "dev": true, - "dependencies": { - "ms": "^2.0.0" - } - }, "node_modules/humps": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/humps/-/humps-2.0.1.tgz", @@ -12280,12 +12468,6 @@ "node": ">=8" } }, - "node_modules/infer-owner": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", - "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", - "dev": true - }, "node_modules/inflation": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/inflation/-/inflation-2.0.0.tgz", @@ -12309,6 +12491,15 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", "integrity": "sha512-8nWq2nLTAwd02jTqJExUYFSD/fKq6VH9Y/oG2accc/kdI0V98Bag8d5a4gi3XHz73rDWa2PvTtvcWYquKqSENA==" }, + "node_modules/ini": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.3.tgz", + "integrity": "sha512-X7rqawQBvfdjS10YU1y1YVreA3SsLrW9dX2CewP2EbBJM4ypVNLDkO5y04gejPwKIY9lR+7r9gn3rFPt/kmWFg==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/internal-slot": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", @@ -12341,6 +12532,25 @@ "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==" }, + "node_modules/ip-address": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", + "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "dev": true, + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/ip-address/node_modules/sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", + "dev": true + }, "node_modules/is-arguments": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", @@ -12873,6 +13083,21 @@ "node": ">=8" } }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, "node_modules/jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", @@ -15685,6 +15910,12 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", + "dev": true + }, "node_modules/jsc-android": { "version": "250231.0.0", "resolved": "https://registry.npmjs.org/jsc-android/-/jsc-android-250231.0.0.tgz", @@ -16394,39 +16625,26 @@ } }, "node_modules/make-fetch-happen": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz", - "integrity": "sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w==", + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-13.0.1.tgz", + "integrity": "sha512-cKTUFc/rbKUd/9meOvgrpJ2WrNzymt6jfRDdwg5UCnVzv9dTpEj9JS5m3wtziXVCjluIXyL8pcaukYqezIzZQA==", "dev": true, "dependencies": { - "agentkeepalive": "^4.2.1", - "cacache": "^16.1.0", - "http-cache-semantics": "^4.1.0", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.0", + "@npmcli/agent": "^2.0.0", + "cacache": "^18.0.0", + "http-cache-semantics": "^4.1.1", "is-lambda": "^1.0.1", - "lru-cache": "^7.7.1", - "minipass": "^3.1.6", - "minipass-collect": "^1.0.2", - "minipass-fetch": "^2.0.3", + "minipass": "^7.0.2", + "minipass-fetch": "^3.0.0", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "negotiator": "^0.6.3", + "proc-log": "^4.2.0", "promise-retry": "^2.0.1", - "socks-proxy-agent": "^7.0.0", - "ssri": "^9.0.0" + "ssri": "^10.0.0" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/make-fetch-happen/node_modules/lru-cache": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", - "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", - "dev": true, - "engines": { - "node": ">=12" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/makeerror": { @@ -17593,41 +17811,38 @@ } }, "node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, "engines": { - "node": ">=8" + "node": ">=16 || 14 >=14.17" } }, "node_modules/minipass-collect": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", - "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-2.0.1.tgz", + "integrity": "sha512-D7V8PO9oaz7PWGLbCACuI1qEOsq7UKfLotx/C0Aet43fCUB/wfQ7DYeq2oR/svFJGYDHPr38SHATeaj/ZoKHKw==", "dev": true, "dependencies": { - "minipass": "^3.0.0" + "minipass": "^7.0.3" }, "engines": { - "node": ">= 8" + "node": ">=16 || 14 >=14.17" } }, "node_modules/minipass-fetch": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.1.2.tgz", - "integrity": "sha512-LT49Zi2/WMROHYoqGgdlQIZh8mLPZmOrN2NdJjMXxYe4nkN6FUyuPuOAOedNJDrx0IRGg9+4guZewtp8hE6TxA==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.5.tgz", + "integrity": "sha512-2N8elDQAtSnFV0Dk7gt15KHsS0Fyz6CbYZ360h0WTYV1Ty46li3rAXVOQj1THMNLdmrD9Vt5pBPtWtVkpwGBqg==", "dev": true, "dependencies": { - "minipass": "^3.1.6", + "minipass": "^7.0.3", "minipass-sized": "^1.0.3", "minizlib": "^2.1.2" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" }, "optionalDependencies": { "encoding": "^0.1.13" @@ -17645,6 +17860,24 @@ "node": ">= 8" } }, + "node_modules/minipass-flush/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-flush/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/minipass-pipeline": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", @@ -17657,6 +17890,24 @@ "node": ">=8" } }, + "node_modules/minipass-pipeline/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-pipeline/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/minipass-sized": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", @@ -17669,7 +17920,19 @@ "node": ">=8" } }, - "node_modules/minipass/node_modules/yallist": { + "node_modules/minipass-sized/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minipass-sized/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", @@ -17688,6 +17951,18 @@ "node": ">= 8" } }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/minizlib/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", @@ -17864,28 +18139,27 @@ } }, "node_modules/node-gyp": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.1.tgz", - "integrity": "sha512-OQkWKbjQKbGkMf/xqI1jjy3oCTgMKJac58G2+bjZb3fza6gW2YrCSdMQYaoTb70crvE//Gngr4f0AgVHmqHvBQ==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-10.2.0.tgz", + "integrity": "sha512-sp3FonBAaFe4aYTcFdZUn2NYkbP7xroPGYvQmP4Nl5PxamznItBnNCgjrVTKrEfQynInMsJvZrdmqUnysCJ8rw==", "dev": true, "dependencies": { "env-paths": "^2.2.0", "exponential-backoff": "^3.1.1", - "glob": "^7.1.4", + "glob": "^10.3.10", "graceful-fs": "^4.2.6", - "make-fetch-happen": "^10.0.3", - "nopt": "^6.0.0", - "npmlog": "^6.0.0", - "rimraf": "^3.0.2", + "make-fetch-happen": "^13.0.0", + "nopt": "^7.0.0", + "proc-log": "^4.1.0", "semver": "^7.3.5", - "tar": "^6.1.2", - "which": "^2.0.2" + "tar": "^6.2.1", + "which": "^4.0.0" }, "bin": { "node-gyp": "bin/node-gyp.js" }, "engines": { - "node": "^12.13 || ^14.13 || >=16" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/node-gyp-build": { @@ -17898,6 +18172,74 @@ "node-gyp-build-test": "build-test.js" } }, + "node_modules/node-gyp/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/node-gyp/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/node-gyp/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/node-gyp/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/node-gyp/node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "dev": true, + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^16.13.0 || >=18.0.0" + } + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -17921,18 +18263,32 @@ } }, "node_modules/nopt": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz", - "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==", + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-7.2.1.tgz", + "integrity": "sha512-taM24ViiimT/XntxbPyJQzCG+p4EKOpgD3mxFwW38mGjVUrfERQOeY4EDHjdnptttfHuHQXFx+lTP08Q+mLa/w==", "dev": true, "dependencies": { - "abbrev": "^1.0.0" + "abbrev": "^2.0.0" }, "bin": { "nopt": "bin/nopt.js" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/normalize-package-data": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.2.tgz", + "integrity": "sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g==", + "dev": true, + "dependencies": { + "hosted-git-info": "^7.0.0", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/normalize-path": { @@ -17943,6 +18299,18 @@ "node": ">=0.10.0" } }, + "node_modules/npm-install-checks": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-6.3.0.tgz", + "integrity": "sha512-W29RiK/xtpCGqn6f3ixfRYGk+zRyr+Ew9F2E20BfXxT5/euLdA/Nm7fO7OeTGuAmTs30cpgInyJ0cYe708YTZw==", + "dev": true, + "dependencies": { + "semver": "^7.1.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/npm-normalize-package-bin": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-3.0.1.tgz", @@ -17952,30 +18320,45 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "node_modules/npm-package-arg": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-11.0.3.tgz", + "integrity": "sha512-sHGJy8sOC1YraBywpzQlIKBE4pBbGbiF95U6Auspzyem956E0+FtDtsx1ZxlOJkQCZ1AFXAY/yuvtFYrOxF+Bw==", + "dev": true, "dependencies": { - "path-key": "^3.0.0" + "hosted-git-info": "^7.0.0", + "proc-log": "^4.0.0", + "semver": "^7.3.5", + "validate-npm-package-name": "^5.0.0" }, "engines": { - "node": ">=8" + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/npmlog": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz", - "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==", + "node_modules/npm-pick-manifest": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-9.1.0.tgz", + "integrity": "sha512-nkc+3pIIhqHVQr085X9d2JzPzLyjzQS96zbruppqC9aZRm/x8xx6xhI98gHtsfELP2bE+loHq8ZaHFHhe+NauA==", "dev": true, "dependencies": { - "are-we-there-yet": "^3.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^4.0.3", - "set-blocking": "^2.0.0" + "npm-install-checks": "^6.0.0", + "npm-normalize-package-bin": "^3.0.0", + "npm-package-arg": "^11.0.0", + "semver": "^7.3.5" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" } }, "node_modules/nth-check": { @@ -18365,6 +18748,12 @@ "node": ">=6" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -18640,6 +19029,28 @@ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true + }, "node_modules/path-to-regexp": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", @@ -18890,6 +19301,15 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" }, + "node_modules/proc-log": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-4.2.0.tgz", + "integrity": "sha512-g8+OnU/L2v+wyiVK+D5fA34J7EH8jZ8DDlvwhRCMxmMj7UCBvxiO1mGeN+36JXIKF4zevU4kRBd8lVgG9vLelA==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -19879,28 +20299,6 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/read-package-json-fast": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/read-package-json-fast/-/read-package-json-fast-3.0.2.tgz", - "integrity": "sha512-0J+Msgym3vrLOUB3hzQCuZHII0xkNGCtz/HJH9xZshwv9DbDwkw1KaE3gx/e2J5rpEY5rtOy6cyhKOPrkP7FZw==", - "dev": true, - "dependencies": { - "json-parse-even-better-errors": "^3.0.0", - "npm-normalize-package-bin": "^3.0.0" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, - "node_modules/read-package-json-fast/node_modules/json-parse-even-better-errors": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.1.tgz", - "integrity": "sha512-aatBvbL26wVUCLmbWdCpeu9iF5wOyWpagiKkInA+kfws3sWdBrTnsvN2CKcyCYyUrc7rebNBlK6+kteg7ksecg==", - "dev": true, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, "node_modules/readable-stream": { "version": "1.1.14", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", @@ -20609,38 +21007,44 @@ } }, "node_modules/socks": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", - "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz", + "integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==", "dev": true, "dependencies": { - "ip": "^2.0.0", + "ip-address": "^9.0.5", "smart-buffer": "^4.2.0" }, "engines": { - "node": ">= 10.13.0", + "node": ">= 10.0.0", "npm": ">= 3.0.0" } }, "node_modules/socks-proxy-agent": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz", - "integrity": "sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.4.tgz", + "integrity": "sha512-GNAq/eg8Udq2x0eNiFkr9gRg5bA7PXEWagQdeRX4cPSG+X/8V38v637gim9bjFptMk1QWsCTr0ttrJEiXbNnRw==", "dev": true, "dependencies": { - "agent-base": "^6.0.2", - "debug": "^4.3.3", - "socks": "^2.6.2" + "agent-base": "^7.1.1", + "debug": "^4.3.4", + "socks": "^2.8.3" }, "engines": { - "node": ">= 10" + "node": ">= 14" } }, - "node_modules/socks/node_modules/ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", - "dev": true + "node_modules/socks-proxy-agent/node_modules/agent-base": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", + "dev": true, + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } }, "node_modules/source-map": { "version": "0.6.1", @@ -20659,6 +21063,38 @@ "source-map": "^0.6.0" } }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.20", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.20.tgz", + "integrity": "sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw==", + "dev": true + }, "node_modules/split-on-first": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", @@ -20673,15 +21109,15 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" }, "node_modules/ssri": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.1.tgz", - "integrity": "sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q==", + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-10.0.6.tgz", + "integrity": "sha512-MGrFH9Z4NP9Iyhqn16sDtBpRRNJ0Y2hNa6D65h736fVSaPCHr4DM4sWUNvVaSuC+0OBGhwsrydQwmgfg5LncqQ==", "dev": true, "dependencies": { - "minipass": "^3.1.1" + "minipass": "^7.0.3" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/stack-utils": { @@ -20797,6 +21233,36 @@ "node": ">=8" } }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/string-width-cjs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/string-width/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -20885,6 +21351,19 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", @@ -21008,9 +21487,9 @@ } }, "node_modules/tar": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", - "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", "dev": true, "dependencies": { "chownr": "^2.0.0", @@ -21024,6 +21503,30 @@ "node": ">=10" } }, + "node_modules/tar/node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/tar/node_modules/minipass": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", @@ -21749,27 +22252,27 @@ } }, "node_modules/unique-filename": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-2.0.1.tgz", - "integrity": "sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-3.0.0.tgz", + "integrity": "sha512-afXhuC55wkAmZ0P18QsVE6kp8JaxrEokN2HGIoIVv2ijHQd419H0+6EigAFcIzXeMIkcIkNBpB3L/DXB3cTS/g==", "dev": true, "dependencies": { - "unique-slug": "^3.0.0" + "unique-slug": "^4.0.0" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/unique-slug": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-3.0.0.tgz", - "integrity": "sha512-8EyMynh679x/0gqE9fT9oilG+qEt+ibFyqjuVTsZn1+CMxH+XLlpvr2UZx4nVcCwTpx81nICr2JQFkM+HPLq4w==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-4.0.0.tgz", + "integrity": "sha512-WrcA6AyEfqDX5bWige/4NQfPZMtASNVxdmWR76WESYQVAACSgWcR6e9i0mofqqBxYFtL4oAxPIptY73/0YE1DQ==", "dev": true, "dependencies": { "imurmurhash": "^0.1.4" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/universalify": { @@ -21914,6 +22417,25 @@ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/validate-npm-package-name": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-5.0.1.tgz", + "integrity": "sha512-OljLrQ9SQdOUqTaQxqL5dEfZWrXExyyWsozYlAWFawPVNuD83igl7uJD2RTkNMbniIYgt8l81eCJGIdQF7avLQ==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -22025,15 +22547,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/wide-align": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", - "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", - "dev": true, - "dependencies": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, "node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -22047,6 +22560,57 @@ "node": ">=8" } }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "node_modules/wrap-ansi/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", diff --git a/package.json b/package.json index eefc6cffa..2a6a01168 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,8 @@ "@fortawesome/react-native-fontawesome": "0.2.7", "@hathor/hathor-rpc-handler": "0.0.1-experimental-alpha", "@hathor/unleash-client": "0.1.0", - "@lavamoat/preinstall-always-fail": "2.0.0", "@hathor/wallet-lib": "1.10.0", + "@lavamoat/preinstall-always-fail": "2.0.0", "@notifee/react-native": "5.7.0", "@react-native-async-storage/async-storage": "1.19.0", "@react-native-firebase/app": "16.7.0", @@ -86,7 +86,7 @@ "@babel/preset-env": "7.22.7", "@babel/runtime": "7.22.6", "@jest/globals": "29.7.0", - "@lavamoat/allow-scripts": "3.0.1", + "@lavamoat/allow-scripts": "3.3.0", "@react-native/eslint-config": "0.72.2", "@react-native/metro-config": "0.72.11", "@tsconfig/react-native": "3.0.2", From de2fdb995a28ef1ede1a016e3f8a8f47ff919f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Wed, 6 Nov 2024 18:01:32 -0300 Subject: [PATCH 45/47] chore: updated comment explaining the race condition --- patches/react-native+0.72.5.patch | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/patches/react-native+0.72.5.patch b/patches/react-native+0.72.5.patch index 787525e2f..127e0243e 100644 --- a/patches/react-native+0.72.5.patch +++ b/patches/react-native+0.72.5.patch @@ -1,18 +1,23 @@ diff --git a/node_modules/react-native/Libraries/Core/InitializeCore.js b/node_modules/react-native/Libraries/Core/InitializeCore.js -index 25377f6..cd13707 100644 +index 25377f6..a209fa9 100644 --- a/node_modules/react-native/Libraries/Core/InitializeCore.js +++ b/node_modules/react-native/Libraries/Core/InitializeCore.js -@@ -26,6 +26,9 @@ +@@ -26,6 +26,14 @@ const start = Date.now(); ++if (global.window === undefined) { ++ // If we don't do this here, there will be a race condition in node_modules/react-native-crypto because setUpSES blocks the execution with react-native-mmkv causing `window` to not be available and getRandomValues won't be added to it, causing a crash. ++ global.window = global; ++} ++ +// setUpSES should be imported after setUpXHR because setUpXHR adds AbortController: +require('./setUpXHR'); +require('./setUpSES'); require('./setUpGlobals'); require('./setUpDOM'); require('./setUpPerformance'); -@@ -33,7 +36,6 @@ require('./setUpErrorHandling'); +@@ -33,7 +41,6 @@ require('./setUpErrorHandling'); require('./polyfillPromise'); require('./setUpRegeneratorRuntime'); require('./setUpTimers'); From 96a14c2a56655087466e4dfe4b06d14678820df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Wed, 6 Nov 2024 18:32:21 -0300 Subject: [PATCH 46/47] chore: added react patch on Error --- patches/react+18.2.0.patch | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 patches/react+18.2.0.patch diff --git a/patches/react+18.2.0.patch b/patches/react+18.2.0.patch new file mode 100644 index 000000000..1e900a024 --- /dev/null +++ b/patches/react+18.2.0.patch @@ -0,0 +1,26 @@ +diff --git a/node_modules/react/cjs/react-jsx-dev-runtime.development.js b/node_modules/react/cjs/react-jsx-dev-runtime.development.js +index 3fe63ac..415fb06 100644 +--- a/node_modules/react/cjs/react-jsx-dev-runtime.development.js ++++ b/node_modules/react/cjs/react-jsx-dev-runtime.development.js +@@ -369,7 +369,9 @@ function describeNativeComponentFrame(fn, construct) { + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. + +- Error.prepareStackTrace = undefined; ++ // XXX: SES blocks this, it shouldn't. This will cause us to have less information on dev logs. ++ // We should remove this comment after this is fixed on SES side. ++ // Error.prepareStackTrace = undefined; + var previousDispatcher; + + { +@@ -495,7 +497,9 @@ function describeNativeComponentFrame(fn, construct) { + reenableLogs(); + } + +- Error.prepareStackTrace = previousPrepareStackTrace; ++ // XXX: SES blocks this, it shouldn't. This will cause us to have less information on dev logs. ++ // We should remove this comment after this is fixed on SES side. ++ // Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. + + From f829b6425e00eac96346cd50b8632c7f4c0aa311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Abadesso?= Date: Wed, 6 Nov 2024 19:06:03 -0300 Subject: [PATCH 47/47] chore: updated preinstall-always-fail and added nodeify to setup script --- package-lock.json | 11 +++++------ package.json | 7 +++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3849b9992..d1cec3d2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,6 @@ "": { "name": "HathorMobile", "version": "0.27.2", - "hasInstallScript": true, "dependencies": { "@fortawesome/fontawesome-svg-core": "1.2.36", "@fortawesome/free-regular-svg-icons": "6.4.0", @@ -16,7 +15,7 @@ "@hathor/hathor-rpc-handler": "0.0.1-experimental-alpha", "@hathor/unleash-client": "0.1.0", "@hathor/wallet-lib": "1.10.0", - "@lavamoat/preinstall-always-fail": "2.0.0", + "@lavamoat/preinstall-always-fail": "2.1.0", "@notifee/react-native": "5.7.0", "@react-native-async-storage/async-storage": "1.19.0", "@react-native-firebase/app": "16.7.0", @@ -4418,12 +4417,12 @@ } }, "node_modules/@lavamoat/preinstall-always-fail": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@lavamoat/preinstall-always-fail/-/preinstall-always-fail-2.0.0.tgz", - "integrity": "sha512-7sgV9DtAD7z7nhxLb2vSjEqgjd3xVk2CbZKwBDVFXkZk1L6xrOIaJTNv5rgNy801/Rjc54KyJ48fHR3djwU35A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@lavamoat/preinstall-always-fail/-/preinstall-always-fail-2.1.0.tgz", + "integrity": "sha512-9xSsxxryPMyBWxfV+Ver7FZhvC1PhE1wDCsYFwsiqZzmeWH8e7Y7gWRFJqPw4M8WNbfeuPhKbLdCK3GsPz9gKg==", "hasInstallScript": true, "engines": { - "node": "^16.20.0 || ^18.0.0 || ^20.0.0" + "node": "^16.20.0 || ^18.0.0 || ^20.0.0 || ^22.0.0" } }, "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { diff --git a/package.json b/package.json index 2a6a01168..476407358 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,8 @@ "start:clean": "react-native start --reset-cache", "lint": "eslint .", "test": "jest", - "setup": "npm install && ./node_modules/.bin/allow-scripts && npm run postinstall", - "locale-update-pot": "ttag extract -o ./locale/texts.pot ./src/", - "postinstall": "rn-nodeify --install stream,process,path,events,crypto,console,buffer --hack && npx patch-package" + "setup": "npm install && ./node_modules/.bin/allow-scripts && rn-nodeify --install stream,process,path,events,crypto,console,buffer --hack && npx patch-package", + "locale-update-pot": "ttag extract -o ./locale/texts.pot ./src/" }, "dependencies": { "@fortawesome/fontawesome-svg-core": "1.2.36", @@ -25,7 +24,7 @@ "@hathor/hathor-rpc-handler": "0.0.1-experimental-alpha", "@hathor/unleash-client": "0.1.0", "@hathor/wallet-lib": "1.10.0", - "@lavamoat/preinstall-always-fail": "2.0.0", + "@lavamoat/preinstall-always-fail": "2.1.0", "@notifee/react-native": "5.7.0", "@react-native-async-storage/async-storage": "1.19.0", "@react-native-firebase/app": "16.7.0",