88#include < folly/json.h>
99#include < gflags/gflags.h>
1010#include < glog/logging.h>
11+ #include < hermes/hermes.h>
12+ #include < jsi/jsi.h>
1113#include < react/featureflags/ReactNativeFeatureFlags.h>
1214#include < react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h>
1315#include < yoga/YGEnums.h>
@@ -23,6 +25,8 @@ DEFINE_string(
2325 " JSON representation of the common feature flags to set for the app" );
2426
2527using namespace facebook ::react;
28+ using namespace facebook ::hermes;
29+ using namespace facebook ::jsi;
2630
2731static void setUpLogging () {
2832 google::InitGoogleLogging (" react-native-fantom" );
@@ -46,6 +50,31 @@ static folly::dynamic setUpFeatureFlags() {
4650 return dynamicFeatureFlags;
4751}
4852
53+ void createHermesInstance () {
54+ auto gcConfig = ::hermes::vm::GCConfig::Builder ()
55+ // Default to 3GB
56+ .withMaxHeapSize (3072 << 20 )
57+ .withName (" RNBridgeless" );
58+ ::hermes::vm::RuntimeConfig::Builder runtimeConfigBuilder =
59+ ::hermes::vm::RuntimeConfig::Builder ()
60+ .withGCConfig(gcConfig.build())
61+ .withEnableSampleProfiling(true );
62+
63+ std::unique_ptr<HermesRuntime> hermesRuntime =
64+ makeHermesRuntime (runtimeConfigBuilder.build ());
65+
66+ hermesRuntime->evaluateJavaScript (
67+ std::make_unique<StringBuffer>(
68+ " var fantom = 'Hello, I am fantom_tester'" ),
69+ " script.js" );
70+
71+ LOG (INFO ) << " JS evaluated value: "
72+ << hermesRuntime->global ()
73+ .getProperty (*hermesRuntime, " fantom" )
74+ .getString (*hermesRuntime)
75+ .utf8 (*hermesRuntime);
76+ }
77+
4978int main (int argc, char * argv[]) {
5079 if (argc > 0 && argv != nullptr ) {
5180 // Don't exit app on unknown flags, as some of those may be provided when
@@ -64,5 +93,7 @@ int main(int argc, char* argv[]) {
6493 LOG (INFO ) << fmt::format (
6594 " [FeatureFlags] overrides: {}" , folly::toJson (dynamicFeatureFlags));
6695
96+ createHermesInstance ();
97+
6798 return 0 ;
6899}
0 commit comments