@qalqi/headless-hermes-linux-x64 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/BUILD-INFO.txt CHANGED
@@ -1,4 +1,4 @@
1
- Hermes commit: d41288df5432666c832abc2b2d8d53a14c1ec3de (https://github.com/facebook/hermes/commit/d41288df5432666c832abc2b2d8d53a14c1ec3de)
1
+ Hermes commit: 64d47e22398073ca6a5ae65249ddcc65e85df3fd (https://github.com/facebook/hermes/commit/64d47e22398073ca6a5ae65249ddcc65e85df3fd)
2
2
  Platform: linux-x64
3
3
  Build type: Release
4
4
  Built by: headless-hermes-jsi-node-api scripts/build-hermes.sh and scripts/package.sh
package/bin/hermes CHANGED
Binary file
Binary file
package/bin/napi-host ADDED
Binary file
@@ -0,0 +1,57 @@
1
+ // headless_hermes.h: what hermes-jsi-run gives the native libraries it loads.
2
+ //
3
+ // A library exports one of:
4
+ //
5
+ // extern "C" void headless_hermes_register(facebook::jsi::Runtime &rt, const headless_hermes_host *host);
6
+ // extern "C" void registerNatives(facebook::jsi::Runtime &rt); // no host: synchronous functions only
7
+ //
8
+ // `host` lives as long as the process. Its functions may be called from any thread: `post` queues a task that runs on
9
+ // the JavaScript thread (microtasks are drained after it), which is how a result computed on another thread gets back
10
+ // to JavaScript; `ref` / `unref` keep the event loop alive while such work is pending (the process exits when no
11
+ // timers, no posted tasks and no refs remain). This is the role React Native's CallInvoker plays in an app.
12
+ //
13
+ // Licensed under the Apache License 2.0 (see LICENSE).
14
+ #pragma once
15
+
16
+ #ifdef __cplusplus
17
+ extern "C" {
18
+ #endif
19
+
20
+ /// A task posted to the JavaScript thread: `runtime` is the `facebook::jsi::Runtime *`.
21
+ typedef void (*headless_hermes_task)(void *runtime, void *data);
22
+
23
+ typedef struct headless_hermes_host {
24
+ /// 1 for this layout; fields are only ever added at the end.
25
+ int version;
26
+ /// Queue `task(runtime, data)` on the JavaScript thread. Any thread.
27
+ void (*post)(headless_hermes_task task, void *data);
28
+ /// Keep the event loop alive until the matching `unref`. Any thread.
29
+ void (*ref)(void);
30
+ void (*unref)(void);
31
+ } headless_hermes_host;
32
+
33
+ #ifdef __cplusplus
34
+ }
35
+
36
+ #include <functional>
37
+ #include <memory>
38
+
39
+ namespace facebook::jsi {
40
+ class Runtime;
41
+ }
42
+
43
+ namespace headless_hermes {
44
+
45
+ /// `host->post` with a C++ callable.
46
+ inline void post(const headless_hermes_host *host, std::function<void(facebook::jsi::Runtime &)> fn) {
47
+ using Fn = std::function<void(facebook::jsi::Runtime &)>;
48
+ host->post(
49
+ [](void *rt, void *data) {
50
+ std::unique_ptr<Fn> f(static_cast<Fn *>(data));
51
+ (*f)(*static_cast<facebook::jsi::Runtime *>(rt));
52
+ },
53
+ new Fn(std::move(fn)));
54
+ }
55
+
56
+ } // namespace headless_hermes
57
+ #endif
Binary file
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@qalqi/headless-hermes-linux-x64",
3
- "version": "0.1.2",
4
- "description": "Prebuilt Hermes (linux-x64) for @qalqi/headless-hermes: libhermesvm, hermes, hermesc, headers. Hermes commit d41288df5432666c832abc2b2d8d53a14c1ec3de.",
3
+ "version": "0.2.1",
4
+ "description": "Prebuilt Hermes (linux-x64) for @qalqi/headless-hermes: libhermesvm, hermes, hermesc, hermes-jsi-run, napi-host, headers. Hermes commit 64d47e22398073ca6a5ae65249ddcc65e85df3fd.",
5
5
  "license": "Apache-2.0 AND MIT",
6
6
  "repository": { "type": "git", "url": "git+https://github.com/qalqi/headless-hermes-jsi-node-api.git" },
7
7
  "os": ["linux"],
8
8
  "cpu": ["x64"],
9
- "hermes": { "commit": "d41288df5432666c832abc2b2d8d53a14c1ec3de" },
9
+ "hermes": { "commit": "64d47e22398073ca6a5ae65249ddcc65e85df3fd" },
10
10
  "files": ["include/", "lib/", "bin/", "LICENSE", "LICENSE-hermes", "BUILD-INFO.txt"]
11
11
  }