@limlabs/rex 0.8.0-beta.50 → 0.8.0-beta.58

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.
Files changed (2) hide show
  1. package/bin/rex.js +59 -0
  2. package/package.json +10 -1
package/bin/rex.js ADDED
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { execFileSync } = require("child_process");
5
+ const path = require("path");
6
+
7
+ const PLATFORM_PACKAGES = {
8
+ "darwin arm64": "@limlabs/rex-darwin-arm64",
9
+ "darwin x64": "@limlabs/rex-darwin-x64",
10
+ "linux x64": "@limlabs/rex-linux-x64",
11
+ "linux arm64": "@limlabs/rex-linux-arm64",
12
+ };
13
+
14
+ function getBinaryPath() {
15
+ // Allow override via env var
16
+ if (process.env.REX_BINARY_PATH) {
17
+ return process.env.REX_BINARY_PATH;
18
+ }
19
+
20
+ const key = `${process.platform} ${process.arch}`;
21
+ const pkg = PLATFORM_PACKAGES[key];
22
+
23
+ if (!pkg) {
24
+ console.error(
25
+ `Rex does not have a prebuilt binary for your platform: ${process.platform} ${process.arch}\n` +
26
+ `Supported platforms: macOS (arm64, x64), Linux (arm64, x64)\n` +
27
+ `You can build from source: https://github.com/limlabs/rex`
28
+ );
29
+ process.exit(1);
30
+ }
31
+
32
+ try {
33
+ return path.join(
34
+ path.dirname(require.resolve(`${pkg}/package.json`)),
35
+ "bin",
36
+ "rex"
37
+ );
38
+ } catch {
39
+ console.error(
40
+ `The platform-specific package ${pkg} is not installed.\n` +
41
+ `This usually means your package manager did not install optional dependencies.\n\n` +
42
+ `Try:\n` +
43
+ ` npm install ${pkg}\n` +
44
+ ` # or reinstall with: npm install @limlabs/rex\n`
45
+ );
46
+ process.exit(1);
47
+ }
48
+ }
49
+
50
+ const binary = getBinaryPath();
51
+
52
+ try {
53
+ execFileSync(binary, process.argv.slice(2), { stdio: "inherit" });
54
+ } catch (e) {
55
+ if (e.status !== null) {
56
+ process.exit(e.status);
57
+ }
58
+ throw e;
59
+ }
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@limlabs/rex",
3
- "version": "0.8.0-beta.50",
3
+ "version": "0.8.0-beta.58",
4
4
  "description": "Rex - Next.js Pages Router reimplemented in Rust",
5
+ "bin": {
6
+ "rex": "bin/rex.js"
7
+ },
5
8
  "main": "dist/index.js",
6
9
  "types": "dist/index.d.ts",
7
10
  "exports": {
@@ -50,6 +53,12 @@
50
53
  "dependencies": {
51
54
  "oxlint": "^1.0.0"
52
55
  },
56
+ "optionalDependencies": {
57
+ "@limlabs/rex-darwin-arm64": "0.8.0-beta.58",
58
+ "@limlabs/rex-darwin-x64": "0.8.0-beta.58",
59
+ "@limlabs/rex-linux-x64": "0.8.0-beta.58",
60
+ "@limlabs/rex-linux-arm64": "0.8.0-beta.58"
61
+ },
53
62
  "peerDependencies": {
54
63
  "react": "^18.0.0 || ^19.0.0",
55
64
  "react-dom": "^18.0.0 || ^19.0.0"