@granite-js/plugin-hermes 0.1.21 → 0.1.23-next.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @granite-js/plugin-hermes
2
2
 
3
+ ## 0.1.23-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - @granite-js/plugin-core@0.1.23-next.0
8
+ - @granite-js/utils@0.1.23-next.0
9
+
10
+ ## 0.1.22
11
+
12
+ ### Patch Changes
13
+
14
+ - @granite-js/plugin-core@0.1.22
15
+ - @granite-js/utils@0.1.22
16
+
3
17
  ## 0.1.21
4
18
 
5
19
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -27,6 +27,7 @@ const execa = __toESM(require("execa"));
27
27
  const fs_promises = __toESM(require("fs/promises"));
28
28
  const source_map = __toESM(require("source-map"));
29
29
  const os = __toESM(require("os"));
30
+ const path = __toESM(require("path"));
30
31
  const __granite_js_utils = __toESM(require("@granite-js/utils"));
31
32
 
32
33
  //#region src/compileHbc.ts
@@ -82,12 +83,36 @@ const BINARY_PATH = {
82
83
  Linux: "react-native/sdks/hermesc/linux64-bin/hermesc",
83
84
  Windows_NT: "react-native/sdks/hermesc/win64-bin/hermesc.exe"
84
85
  };
86
+ /**
87
+ * Returns the Hermes OS binary folder name for the current platform.
88
+ */
89
+ function getHermesOSBin() {
90
+ switch (process.platform) {
91
+ case "win32": return "win64-bin";
92
+ case "darwin": return "osx-bin";
93
+ default: return "linux64-bin";
94
+ }
95
+ }
96
+ /**
97
+ * Returns the Hermes executable name for the current platform.
98
+ */
99
+ function getHermesOSExe() {
100
+ const hermesExecutableName = "hermesc";
101
+ return process.platform === "win32" ? `${hermesExecutableName}.exe` : hermesExecutableName;
102
+ }
103
+ function getReactNativePackagePath(root) {
104
+ try {
105
+ return path.default.dirname(require.resolve("react-native/package.json", { paths: [root] }));
106
+ } catch {
107
+ return path.default.join("node_modules", "react-native");
108
+ }
109
+ }
85
110
  function resolveHermesBinaryPath() {
86
111
  const root = (0, __granite_js_utils.getPackageRoot)();
87
112
  const os$1 = (0, os.type)();
88
113
  const binaryPath = BINARY_PATH[os$1];
89
114
  if (binaryPath == null) throw new Error(`Unsupported OS: ${os$1}`);
90
- return require.resolve(binaryPath, { paths: [root] });
115
+ return path.default.join(getReactNativePackagePath(root), "sdks", "hermesc", getHermesOSBin(), getHermesOSExe());
91
116
  }
92
117
 
93
118
  //#endregion
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import execa from "execa";
5
5
  import * as fs from "fs/promises";
6
6
  import { SourceMapConsumer, SourceMapGenerator } from "source-map";
7
7
  import { type } from "os";
8
+ import path from "path";
8
9
  import { getPackageRoot } from "@granite-js/utils";
9
10
 
10
11
  //#region rolldown:runtime
@@ -64,12 +65,36 @@ const BINARY_PATH = {
64
65
  Linux: "react-native/sdks/hermesc/linux64-bin/hermesc",
65
66
  Windows_NT: "react-native/sdks/hermesc/win64-bin/hermesc.exe"
66
67
  };
68
+ /**
69
+ * Returns the Hermes OS binary folder name for the current platform.
70
+ */
71
+ function getHermesOSBin() {
72
+ switch (process.platform) {
73
+ case "win32": return "win64-bin";
74
+ case "darwin": return "osx-bin";
75
+ default: return "linux64-bin";
76
+ }
77
+ }
78
+ /**
79
+ * Returns the Hermes executable name for the current platform.
80
+ */
81
+ function getHermesOSExe() {
82
+ const hermesExecutableName = "hermesc";
83
+ return process.platform === "win32" ? `${hermesExecutableName}.exe` : hermesExecutableName;
84
+ }
85
+ function getReactNativePackagePath(root) {
86
+ try {
87
+ return path.dirname(__require.resolve("react-native/package.json", { paths: [root] }));
88
+ } catch {
89
+ return path.join("node_modules", "react-native");
90
+ }
91
+ }
67
92
  function resolveHermesBinaryPath() {
68
93
  const root = getPackageRoot();
69
94
  const os = type();
70
95
  const binaryPath = BINARY_PATH[os];
71
96
  if (binaryPath == null) throw new Error(`Unsupported OS: ${os}`);
72
- return __require.resolve(binaryPath, { paths: [root] });
97
+ return path.join(getReactNativePackagePath(root), "sdks", "hermesc", getHermesOSBin(), getHermesOSExe());
73
98
  }
74
99
 
75
100
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@granite-js/plugin-hermes",
3
3
  "type": "module",
4
- "version": "0.1.21",
4
+ "version": "0.1.23-next.0",
5
5
  "description": "Hermes compilation plugin for Granite",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -35,8 +35,8 @@
35
35
  "vitest": "^3.1.3"
36
36
  },
37
37
  "dependencies": {
38
- "@granite-js/plugin-core": "0.1.21",
39
- "@granite-js/utils": "0.1.21",
38
+ "@granite-js/plugin-core": "0.1.23-next.0",
39
+ "@granite-js/utils": "0.1.23-next.0",
40
40
  "es-toolkit": "^1.39.8",
41
41
  "execa": "^5",
42
42
  "source-map": "^0.8.0-beta.0"