Skip to content

Commit e0bdee0

Browse files
authored
Fix jsi.h and update package versions (#11)
1 parent 6506206 commit e0bdee0

File tree

4 files changed

+45
-15
lines changed

4 files changed

+45
-15
lines changed

jsi/jsi/README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,16 @@ https://github.com/facebook/hermes repo.
2525
| 3 | `0c9daa5a5eee7649558a53e3e541b80c89048c42` | Change jsi::Runtime::lockWeakObject to take a mutable ref
2626
| 2 | `e0616e77e1ddc3ea5e2ccbca2e20dd0c4049c637` | Make it possible for a Runtime implementation to provide its own JSON parsing
2727
| 1 | `3ba9615f80913764ecb6456779d502e31dde9e5d` | Fix build break in MSVC (#26462)
28-
| 0 | `f22a18f67da3f03db59c1ec715d6ec3776b03fbf` | Initial commit
28+
| 0 | `f22a18f67da3f03db59c1ec715d6ec3776b03fbf` | Initial commit
29+
30+
Relationship to React Native versions:
31+
32+
| RN Version | JSI version |
33+
|-----------:|------------:|
34+
| main | 12 |
35+
| 0.74 | 11 |
36+
| 0.73 | 10 |
37+
| 0.72 | 10 |
38+
| 0.71 | 9 |
39+
| 0.70 | 6 |
40+
| 0.69 | 5 |

jsi/jsi/decorator.h

+6
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,12 @@ class WithRuntimeDecorator : public RuntimeDecorator<Plain, Base> {
567567
Around around{with_};
568568
return RD::evaluatePreparedJavaScript(js);
569569
}
570+
#if JSI_VERSION >= 12
571+
void queueMicrotask(const Function& callback) override {
572+
Around around{with_};
573+
RD::queueMicrotask(callback);
574+
}
575+
#endif
570576
#if JSI_VERSION >= 4
571577
bool drainMicrotasks(int maxMicrotasksHint) override {
572578
Around around{with_};

jsi/jsi/jsi.h

+24-12
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,19 @@
1515
#include <string>
1616
#include <vector>
1717

18-
#ifndef JSI_EXPORT
19-
#ifdef _MSC_VER
20-
#ifdef CREATE_SHARED_LIBRARY
21-
#define JSI_EXPORT __declspec(dllexport)
22-
#else
23-
#define JSI_EXPORT
24-
#endif // CREATE_SHARED_LIBRARY
25-
#else // _MSC_VER
26-
#define JSI_EXPORT __attribute__((visibility("default")))
27-
#endif // _MSC_VER
28-
#endif // !defined(JSI_EXPORT)
29-
3018
// JSI version defines set of features available in the API.
3119
// Each significant API change must be under a new version.
20+
// The JSI_VERSION can be provided as a parameter to compiler
21+
// or in the optional "jsi_version.h" file.
22+
23+
#ifndef JSI_VERSION
24+
#if defined(__has_include) && __has_include(<jsi/jsi-version.h>)
25+
#include <jsi/jsi-version.h>
26+
#endif
27+
#endif
28+
3229
#ifndef JSI_VERSION
30+
// Use the latest version by default
3331
#define JSI_VERSION 12
3432
#endif
3533

@@ -45,6 +43,18 @@
4543
#define JSI_CONST_10
4644
#endif
4745

46+
#ifndef JSI_EXPORT
47+
#ifdef _MSC_VER
48+
#ifdef CREATE_SHARED_LIBRARY
49+
#define JSI_EXPORT __declspec(dllexport)
50+
#else
51+
#define JSI_EXPORT
52+
#endif // CREATE_SHARED_LIBRARY
53+
#else // _MSC_VER
54+
#define JSI_EXPORT __attribute__((visibility("default")))
55+
#endif // _MSC_VER
56+
#endif // !defined(JSI_EXPORT)
57+
4858
class FBJSRuntime;
4959
namespace facebook {
5060
namespace jsi {
@@ -241,6 +251,7 @@ class JSI_EXPORT Runtime {
241251
/// \param callback a function to be executed as a microtask.
242252
virtual void queueMicrotask(const jsi::Function& callback) = 0;
243253
#endif
254+
244255
#if JSI_VERSION >= 4
245256
/// Drain the JavaScript VM internal Microtask (a.k.a. Job in ECMA262) queue.
246257
///
@@ -1592,6 +1603,7 @@ class JSI_EXPORT JSError : public JSIException {
15921603
return *value_;
15931604
}
15941605

1606+
//TODO: (vmoroz) Can we remove it considering that we have the new JSError constructor?
15951607
// In V8's case, creating an Error object in JS doesn't record the callstack.
15961608
// To preserve it, we need a way to manually add the stack here and on the JS
15971609
// side.

tests/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ endif()
4040
execute_process(
4141
COMMAND ${NUGET_EXE}
4242
install "Microsoft.JavaScript.Hermes"
43-
-Version 0.1.18
43+
-Version 0.1.27
4444
-ExcludeVersion
4545
-OutputDirectory ${CMAKE_BINARY_DIR}/packages
4646
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
@@ -50,7 +50,7 @@ target_link_libraries(jsi_tests PRIVATE ${CMAKE_BINARY_DIR}/packages/Microsoft.J
5050
execute_process(
5151
COMMAND ${NUGET_EXE}
5252
install "ReactNative.V8Jsi.Windows"
53-
-Version 0.71.12
53+
-Version 0.75.4
5454
-ExcludeVersion
5555
-OutputDirectory ${CMAKE_BINARY_DIR}/packages
5656
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

0 commit comments

Comments
 (0)