|
1 | | -//@ts-check |
| 1 | +// @ts-check |
2 | 2 |
|
3 | | -const path = require("path"); |
| 3 | +const path = require("node:path"); |
4 | 4 |
|
5 | 5 | /** |
6 | | - * @type{string} |
7 | | - * |
8 | 6 | * For compatibility reasons, if the architecture is x64, omit it from the bin directory name. |
9 | 7 | * So we'll have "darwin", "linux" and "win32" for x64 arch, |
10 | 8 | * but "darwinarm64" and "linuxarm64" for arm64 arch. |
11 | 9 | * Also, we do not have Windows ARM binaries yet. But the x64 binaries do work on Windows 11 ARM. |
12 | 10 | * So omit the architecture for Windows, too. |
13 | 11 | */ |
14 | | -const binDirName = |
| 12 | +const platformName = |
15 | 13 | process.arch === "x64" || process.platform === "win32" |
16 | 14 | ? process.platform |
17 | 15 | : process.platform + process.arch; |
18 | 16 |
|
19 | 17 | /** |
20 | | - * |
21 | | - * @type{string} |
| 18 | + * @type {string} |
22 | 19 | */ |
23 | | -const binAbsolutePath = path.join(__dirname, "..", binDirName); |
| 20 | +const platformDir = path.resolve(__dirname, "..", platformName); |
24 | 21 |
|
25 | 22 | /** |
26 | | - * @type{string} |
| 23 | + * @type {string} |
27 | 24 | */ |
28 | | -const bsc_exe = path.join(binAbsolutePath, "bsc.exe"); |
| 25 | +const bsc_exe = path.join(platformDir, "bsc.exe"); |
29 | 26 |
|
30 | 27 | /** |
31 | | - * @type{string} |
| 28 | + * @type {string} |
32 | 29 | */ |
33 | | -const ninja_exe = path.join(binAbsolutePath, "ninja.exe"); |
| 30 | +const ninja_exe = path.join(platformDir, "ninja.exe"); |
34 | 31 |
|
35 | 32 | /** |
36 | | - * @type{string} |
| 33 | + * @type {string} |
37 | 34 | */ |
38 | | -const rescript_exe = path.join(binAbsolutePath, "rescript.exe"); |
| 35 | +const rescript_exe = path.join(platformDir, "rescript.exe"); |
39 | 36 |
|
40 | 37 | /** |
41 | | - * @type{string} |
| 38 | + * @type {string} |
42 | 39 | */ |
43 | | -const rescript_tools_exe = path.join(binAbsolutePath, "rescript-tools.exe"); |
| 40 | +const rescript_tools_exe = path.join(platformDir, "rescript-tools.exe"); |
44 | 41 |
|
45 | 42 | /** |
46 | | - * @type{string} |
| 43 | + * @type {string} |
47 | 44 | */ |
48 | 45 | const rescript_editor_analysis_exe = path.join( |
49 | | - binAbsolutePath, |
| 46 | + platformDir, |
50 | 47 | "rescript-editor-analysis.exe", |
51 | 48 | ); |
52 | 49 |
|
53 | | -exports.dirName = binDirName; |
54 | | -exports.absolutePath = binAbsolutePath; |
| 50 | +/** |
| 51 | + * @type {string} |
| 52 | + */ |
| 53 | +const rewatch_exe = path.join(platformDir, "rewatch.exe"); |
| 54 | + |
| 55 | +exports.platformDir = platformDir; |
55 | 56 | exports.bsc_exe = bsc_exe; |
56 | 57 | exports.ninja_exe = ninja_exe; |
57 | 58 | exports.rescript_exe = rescript_exe; |
58 | 59 | exports.rescript_tools_exe = rescript_tools_exe; |
59 | 60 | exports.rescript_editor_analysis_exe = rescript_editor_analysis_exe; |
| 61 | +exports.rewatch_exe = rewatch_exe; |
0 commit comments