Priority matrix
SES: module / lockdown shim
JS engine: JSC * / V8 (debug) / Hermes / more
JS transformer: Babel / SWC , react-codemod
JS features: BigInt / Promises / etc, libs
RN version: <=0.66.x / 0.66.5* metamask-mobile / 0.69.x* / 0.70.x / 0.71.x metamask-mobile / 0.72.x / 0.73.x
min: platform :ios, '11.0' 0.69+: 12.4
RN bundler: Metro / Re.Pack / rn-esbuild , bundling / sourcemaps
RN platform: Android / iOS / rn-web / rn-macos / rn-windows
RN variant* mode: debug / release
RN arch: old / new**
SES integration: entry file / RN core
* undergoing retirement
** 3rd party libs not yet mature, but issues prioritised
Tracker
RN 0.66.5 + npm SES 0.18.1: Babel fails to ignore ses.cjs #10
RN + SES: TypeError: undefined is not a function (near '...globalThis.process.on...') #11
RN 0.66.5 + RN CLI: PhaseScriptExecution error (not with Xcode) #15
RN 0.66.5 + SES 0.18.1: Error failed to del intrinsics.%AsyncGenerator%.length #16
RN + SES: TypeError: undefined is not a function (near '...globalThis.process.on...') #11
we use rn-nodeify in mm-mobile so this isn't an issue
but vanilla RN shouldn't need a Node process shim
nb: trusted shim valid cases for deps reflect-metadata, pos Sentry
Create scripts for debug/release Android/iOS building/bundling/running
QA [RN 0.66.5 + SES 0.18.2patched] bundling and sourcemap gen
Proof of Concept Insights - lockdown() options #3
Proof of Concept Insights - Removing the Promise Polyfill at RN #5
[RN 0.71.6+, SES module / lockdown shim, 0.18.1+, Android/iOS, JSC/V8] with Promises
metamask-mobile RN 0.67 support RN 0.71 support
as seen in (4) past issues
as seen in [WIP] SES lockdown() - LavaMoat Compatibility MetaMask/metamask-mobile#3794
React Native Incompatibility: TypeError: (0 , _getPrototypeOf2.default) is not a function endojs/endo#699 solved since below
iOS JSC : UI TypeError: undefined is not an object (evaluating 'state.engine.backgroundState.NetworkController.network') w/o polyfillPromise (prev: immediate error, fewer warnings) 22 warnings, 3->6 errors (and remaining libraries)
iOS V8 : (prev UI TypeError: Cannot read properties of undefined (reading 'network')), 3->5 errors , 3 Sentry warnings, SES intrinsics removed warnings below (and remaining libraries)
18-20 warnings (w/o polyfillPromise, prev: immediate error): 4-6 Object, 2 Reflect, 7 %ArrayPrototype%, 2 %StringPrototype%, 1 %RegExpPrototype%, 3 %TypedArrayPrototype%
18 warnings (w polyfillPromise): 7 Promise, 4 %PromisePrototype%; 7 undeletable tolerated (4 Promise.x.prototype, 3 %PromisePrototype%.x.prototype)
2 errors stemming from redux-persist
SES_UNHANDLED_REJECTION: missing Exception error msg
RN upgrade from 0.66.5 to 0.71.6
feat: SES lockdown v0.18.8 (iOS JSC) MetaMask/metamask-mobile#6586
Deprecate JSC support, unless for backward-compat only
RN 0.72.0-rc.1 + RN CLI: ❌ Installing (RubyGems) Bundler #17
Close ☂️ React Native Compatibility Tracker #1
nb: npx react-native@latest init RN0720RC0 --version 0.72.0-rc.0 now requires Node 16 to init
Hermes support
QA: [RN 0.72.x + SES/lockdown 0.18.x + Android/iOS + Hermes + debug/release + Bundling + Promises]
fix: regenerator-runtime and reenable SES (v1.1.0) on iOS (JSC) MetaMask/metamask-mobile#8033
Road to 0.73.0 reactwg/react-native-releases#64
Build/compiler time protection
Runtime protection
Close React Native Compat Tracking Issue endojs/endo#661
React Native New Architecture support
Sample/demo repo's
Official integration into React Native core?
Detect if ses is being transformed endojs/endo#662
allow-scripts setup for yarn berry LavaMoat#349
Bundlers support
Transformers support
Static transformers support
React Native backward-compat pre-0.66.5
Expo support (babel-preset-expo )
Further JS engine support
🚀 Breaking changes for Yarn 4 yarnpkg/berry#3591
Future-proofing
endojs/Jessie for RN
Cross-platform support
metamask-mobile
LogBox.ignoreLogs([...])
deps (Sentry, eth...)
e2e (Detox/(Appium))
4.3. Enabling unencrypted traffic for Detox
For Detox to work, its native code running on Android device has to be able to connect to the Node.js host running tests. It sends an unencrypted HTTP traffic via virtual localhost interface, that's why you need to create a new file which adds a couple of exceptions to the security rules.
If properly configured, this approach in no way compromises the security settings of your app. For more details, refer to Android’s security-config guide and the dedicated article in the Android developers blog.
Notes
RN 0.66.5 types (globals.d.ts ) (js global objects )
android-jsc (fbarchive ) (debug-mode, release-mode)
"jsc-android": "^250231.0.0" (WebKitGTK 2.26.1) pre-RN 0.72
jscFlavor = 'org.webkit:android-jsc:+' (or jscFlavor = 'org.webkit:android-jsc-intl:+')
pre-release: v294992.0.0 (WebKitGTK 2.36.3) (only jscFlavor = 'org.webkit:android-jsc-intl:+')
Moved out of package.json in 0.72-stable | RN Monorepo | Migrate to package
v8-android (debug-mode: Remote JS Debugging, opt-in : release-mode)
v11.110.1 (jit/aot, intl/nointl)
Simplified model of moving parts (todo: interactive diagram)
javascript-environment : RN JS engines (3), transforms (~37), polyfills (11)
JavaScriptCore does not use JIT due to the absence of writable executable memory in iOS apps
When using Chrome debugging, all JavaScript code runs within Chrome itself, communicating with native code via WebSockets. Chrome uses V8 as its JavaScript engine
RN JS features per engine/platform table (excluding with )
metro-react-native-babel-preset v0.76.0
react/metro@e5950ae : [Breaking] : Increase minimum Node version from 14 to 16
package.json : 36 plugins
main.js : 23 extraPlugins.push
babel > packages
tc39: terminology glossary
Node (debug via cli-doctor )
https://drive.google.com/file/d/1mgKxKlpgjm2_KX4TP-G7hUti-JKjR2Xv/view
https://tmikov.blogspot.com/2023/09/how-to-speed-up-micro-benchmark-300x.html
https://www.youtube.com/watch?v=q-xKYA0EO-c
Join the convo 🌍
Priority matrix
moreSWC,react-codemod<=0.66.x/0.66.5* metamask-mobile/0.69.x*/0.70.x/ 0.71.x metamask-mobile / 0.72.x / 0.73.xplatform :ios, '11.0'0.69+: 12.4Re.Pack/rn-esbuild, bundling / sourcemapsrn-web/rn-macos/rn-windowsvariant*mode: debug / releasenew*** undergoing retirement
** 3rd party libs not yet mature, but issues prioritised
Tracker
lengthon AsyncGenerator and AsyncFunctionPrototype react-native-community/jsc-android-buildscripts#181 we're no longer using android-jsc but Hermes insteadlength(number) prop to whitelist AsyncGenerator and AsyncFunctionPrototype endojs/endo#1511TypeError: Promise constructor's argument is not a functionTypeError: undefined is not an object (evaluating 'getPrototypeOf(AsyncGeneratorPrototype)')TypeError: Promise constructor's argument is not a functionTypeError: Cannot convert undefined or null to objectdebug via Chrome[SyntaxError: No identifiers allowed directly after numeric literal] x2 no stack x2, BigInt(1) + BigInt(2)ReferenceError: Can't find variable: BigIntbig-integershim testing onandroid-jscMetaMask/metamask-mobile#6221jsc-androidfrom250230.2.1to294992.0.0(@next) forBigIntMetaMask/metamask-mobile#6314TypeError: Promise constructor's argument is not a functionRN 0.67 supportRN 0.71 supportTypeError: undefined is not an object (evaluating 'state.engine.backgroundState.NetworkController.network')w/o polyfillPromise (prev: immediate error, fewer warnings) 22 warnings, 3->6 errors (and remaining libraries)TypeError: Cannot read properties of undefined (reading 'network')), 3->5 errors, 3 Sentry warnings, SES intrinsics removed warnings below (and remaining libraries)SES_UNHANDLED_REJECTION:missing Exception error msgnpx react-native@latest init RN0720RC0 --version 0.72.0-rc.0now requires Node 16 to initevalfor SES (Secure EcmaScript) support facebook/hermes#957 not happening anytime soonwithstatement for SES (Secure EcmaScript) support facebook/hermes#1056 not happening anytime soonQA: [RN 0.72.x + SES/lockdown 0.18.x + Android/iOS + Hermes + debug/release + Bundling + Promises]Running under lockdownabove ^react-native-lavamoat-lockdownrepo (since this is beyond /docs now) w CI matrix? lavamoat/RN/node versESBuild support,Not flexible enough atmReact Native backward-compat pre-0.66.5endojs/Jessie for RNCross-platform supportFlutterKMMmetamask-mobile
Notes
RN 0.66.5 types (globals.d.ts) (js global objects)
android-jsc (fbarchive) (debug-mode, release-mode)
"jsc-android": "^250231.0.0" (WebKitGTK 2.26.1) pre-RN 0.72
jscFlavor = 'org.webkit:android-jsc:+'(orjscFlavor = 'org.webkit:android-jsc-intl:+')pre-release: v294992.0.0 (WebKitGTK 2.36.3) (only
jscFlavor = 'org.webkit:android-jsc-intl:+')Moved out of package.json in 0.72-stable | RN Monorepo | Migrate to package
v8-android (debug-mode: Remote JS Debugging, opt-in: release-mode)
v11.110.1 (jit/aot, intl/nointl)
Simplified model of moving parts (todo: interactive diagram)
javascript-environment: RN JS engines (3), transforms (~37), polyfills (11)
RN JS features per engine/platform table (excluding with)
metro-react-native-babel-preset v0.76.0
react/metro@e5950ae: [Breaking]: Increase minimum Node version from 14 to 16
package.json: 36 plugins
main.js: 23
extraPlugins.pushbabel > packages
tc39: terminology glossary
Node (debug via cli-doctor)
https://drive.google.com/file/d/1mgKxKlpgjm2_KX4TP-G7hUti-JKjR2Xv/view
https://tmikov.blogspot.com/2023/09/how-to-speed-up-micro-benchmark-300x.html
https://www.youtube.com/watch?v=q-xKYA0EO-c
Join the convo 🌍