Skip to content

Commit 759c7d8

Browse files
committed
change binary package exports
1 parent 1e52560 commit 759c7d8

File tree

17 files changed

+123
-137
lines changed

17 files changed

+123
-137
lines changed

cli/common/bins.js

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
/**
44
* @typedef {{
5-
* platformDir: string,
5+
* binDir: string,
6+
* binPaths: BinaryPaths,
7+
* }} BinaryModuleExports
8+
*
9+
* @typedef {{
610
* bsb_helper_exe: string,
711
* bsc_exe: string,
812
* ninja_exe: string,
@@ -15,22 +19,23 @@
1519

1620
const target = `${process.platform}-${process.arch}`;
1721

18-
/** @type {BinaryPaths} */
19-
let binPaths;
22+
/** @type {BinaryModuleExports} */
23+
let mod;
2024
try {
21-
binPaths = await import(`@rescript/${target}/paths`);
22-
} catch (err) {
23-
console.error(`Platform ${target} is not supported!`);
24-
throw err;
25+
mod = await import(`@rescript/${target}`);
26+
} catch {
27+
throw new Error(`Platform ${target} is not supported!`);
2528
}
2629

2730
export const {
28-
platformDir,
29-
bsb_helper_exe,
30-
bsc_exe,
31-
ninja_exe,
32-
rescript_editor_analysis_exe,
33-
rescript_tools_exe,
34-
rescript_exe,
35-
rewatch_exe,
36-
} = binPaths;
31+
binDir: platformDir,
32+
binPaths: {
33+
bsb_helper_exe,
34+
bsc_exe,
35+
ninja_exe,
36+
rescript_editor_analysis_exe,
37+
rescript_tools_exe,
38+
rescript_exe,
39+
rewatch_exe,
40+
},
41+
} = mod;

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
"CREDITS.md",
6060
"ninja.COPYING",
6161
"docs/docson/build-schema.json",
62-
"lib",
62+
"lib/js/*.js",
63+
"lib/es6/*.js",
6364
"cli"
6465
],
6566
"exports": {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @ts-check
2+
3+
import * as path from "node:path";
4+
5+
export const binDir = path.join(import.meta.dirname, "bin");
6+
7+
export const binPaths = {
8+
bsc_exe: path.join(binDir, "bsc.exe"),
9+
ninja_exe: path.join(binDir, "ninja.exe"),
10+
rescript_exe: path.join(binDir, "rescript.exe"),
11+
rescript_tools_exe: path.join(binDir, "rescript-tools.exe"),
12+
rescript_editor_analysis_exe: path.join(
13+
binDir,
14+
"rescript-editor-analysis.exe",
15+
),
16+
rewatch_exe: path.join(binDir, "rewatch.exe"),
17+
};

packages/@rescript/darwin-arm64/bin/paths.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/@rescript/darwin-arm64/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"arm64"
2121
],
2222
"files": [
23-
"bin"
23+
"bin.js",
24+
"bin/"
2425
],
2526
"bin": {
2627
"bsb_helper.exe": "./bin/bsb_helper.exe",
@@ -31,8 +32,6 @@
3132
"rescript.exe": "./bin/rescript.exe",
3233
"rewatch.exe": "./bin/rewatch.exe"
3334
},
34-
"exports": {
35-
"./paths": "./bin/paths.js"
36-
},
35+
"exports": "./bin.js",
3736
"preferUnplugged": true
3837
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @ts-check
2+
3+
import * as path from "node:path";
4+
5+
export const binDir = path.join(import.meta.dirname, "bin");
6+
7+
export const binPaths = {
8+
bsc_exe: path.join(binDir, "bsc.exe"),
9+
ninja_exe: path.join(binDir, "ninja.exe"),
10+
rescript_exe: path.join(binDir, "rescript.exe"),
11+
rescript_tools_exe: path.join(binDir, "rescript-tools.exe"),
12+
rescript_editor_analysis_exe: path.join(
13+
binDir,
14+
"rescript-editor-analysis.exe",
15+
),
16+
rewatch_exe: path.join(binDir, "rewatch.exe"),
17+
};

packages/@rescript/darwin-x64/bin/paths.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/@rescript/darwin-x64/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"x64"
2121
],
2222
"files": [
23-
"bin"
23+
"bin.js",
24+
"bin/"
2425
],
2526
"bin": {
2627
"bsb_helper.exe": "./bin/bsb_helper.exe",
@@ -31,8 +32,6 @@
3132
"rescript.exe": "./bin/rescript.exe",
3233
"rewatch.exe": "./bin/rewatch.exe"
3334
},
34-
"exports": {
35-
"./paths": "./bin/paths.js"
36-
},
35+
"exports": "./bin.js",
3736
"preferUnplugged": true
3837
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @ts-check
2+
3+
import * as path from "node:path";
4+
5+
export const binDir = path.join(import.meta.dirname, "bin");
6+
7+
export const binPaths = {
8+
bsc_exe: path.join(binDir, "bsc.exe"),
9+
ninja_exe: path.join(binDir, "ninja.exe"),
10+
rescript_exe: path.join(binDir, "rescript.exe"),
11+
rescript_tools_exe: path.join(binDir, "rescript-tools.exe"),
12+
rescript_editor_analysis_exe: path.join(
13+
binDir,
14+
"rescript-editor-analysis.exe",
15+
),
16+
rewatch_exe: path.join(binDir, "rewatch.exe"),
17+
};

packages/@rescript/linux-arm64/bin/paths.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)