Skip to content

Commit 9f83aed

Browse files
committed
Add -runtime-path handling to bsc.js
1 parent e21a595 commit 9f83aed

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

cli/bsc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
import { execFileSync } from "node:child_process";
66

77
import { bsc_exe } from "./common/bins.js";
8+
import { runtimePath } from "./common/runtime.js";
89

910
const delegate_args = process.argv.slice(2);
11+
if (!delegate_args.includes("-runtime-path")) {
12+
delegate_args.push("-runtime-path", runtimePath);
13+
}
1014

1115
try {
1216
execFileSync(bsc_exe, delegate_args, { stdio: "inherit" });

cli/common/runtime.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @ts-check
2+
import { createRequire } from "node:module";
3+
import * as path from "node:path";
4+
5+
const require = createRequire(import.meta.url);
6+
7+
const runtimePackageJson = require.resolve("@rescript/runtime/package.json");
8+
9+
export const runtimePath = path.dirname(runtimePackageJson);

packages/artifacts.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"cli/bsc.js",
1010
"cli/bstracing.js",
1111
"cli/common/bins.js",
12+
"cli/common/runtime.js",
1213
"cli/rescript-legacy.js",
1314
"cli/rescript-legacy/args.js",
1415
"cli/rescript-legacy/bsb.js",

0 commit comments

Comments
 (0)