Skip to content

Commit 1beff72

Browse files
committed
Ship RescriptTools module with the rescript npm package
1 parent 476bdaa commit 1beff72

16 files changed

+103
-124
lines changed

lib/es6/RescriptTools.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
3+
import * as Bin_path from "../../cli/bin_path";
4+
5+
let binaryPath = Bin_path.rescript_tools_exe;
6+
7+
let Docgen;
8+
9+
export {
10+
Docgen,
11+
binaryPath,
12+
}
13+
/* binaryPath Not a pure module */

lib/es6/RescriptTools_Docgen.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
3+
4+
function decodeFromJson(prim) {
5+
return prim;
6+
}
7+
8+
export {
9+
decodeFromJson,
10+
}
11+
/* No side effect */

lib/js/RescriptTools.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
3+
let Bin_path = require("../../cli/bin_path");
4+
5+
let binaryPath = Bin_path.rescript_tools_exe;
6+
7+
let Docgen;
8+
9+
exports.Docgen = Docgen;
10+
exports.binaryPath = binaryPath;
11+
/* binaryPath Not a pure module */

lib/js/RescriptTools_Docgen.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
3+
4+
function decodeFromJson(prim) {
5+
return prim;
6+
}
7+
8+
exports.decodeFromJson = decodeFromJson;
9+
/* No side effect */

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"bsc": "cli/bsc",
4040
"bstracing": "lib/bstracing",
4141
"rescript": "cli/rescript",
42+
"rescript-tools": "cli/rescript-tools",
4243
"rewatch": "cli/rewatch"
4344
},
4445
"scripts": {

packages/artifacts.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ lib/es6/Primitive_string_extern.js
185185
lib/es6/Primitive_util.js
186186
lib/es6/Promise.js
187187
lib/es6/RegExp.js
188+
lib/es6/RescriptTools.js
189+
lib/es6/RescriptTools_Docgen.js
188190
lib/es6/Result.js
189191
lib/es6/Set.js
190192
lib/es6/String.js
@@ -353,6 +355,8 @@ lib/js/Primitive_string_extern.js
353355
lib/js/Primitive_util.js
354356
lib/js/Promise.js
355357
lib/js/RegExp.js
358+
lib/js/RescriptTools.js
359+
lib/js/RescriptTools_Docgen.js
356360
lib/js/Result.js
357361
lib/js/Set.js
358362
lib/js/String.js
@@ -1134,6 +1138,16 @@ lib/ocaml/RegExp.cmt
11341138
lib/ocaml/RegExp.cmti
11351139
lib/ocaml/RegExp.res
11361140
lib/ocaml/RegExp.resi
1141+
lib/ocaml/RescriptTools.cmi
1142+
lib/ocaml/RescriptTools.cmj
1143+
lib/ocaml/RescriptTools.cmt
1144+
lib/ocaml/RescriptTools.res
1145+
lib/ocaml/RescriptTools_Docgen.cmi
1146+
lib/ocaml/RescriptTools_Docgen.cmj
1147+
lib/ocaml/RescriptTools_Docgen.cmt
1148+
lib/ocaml/RescriptTools_Docgen.cmti
1149+
lib/ocaml/RescriptTools_Docgen.res
1150+
lib/ocaml/RescriptTools_Docgen.resi
11371151
lib/ocaml/Result.cmi
11381152
lib/ocaml/Result.cmj
11391153
lib/ocaml/Result.cmt
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module Docgen = Tools_Docgen
1+
module Docgen = RescriptTools_Docgen
22

33
/** Returns the full file system path to the `rescript-tools` binary for the current platform, side stepping the JS that wraps the CLI.
44
@@ -7,8 +7,8 @@ module Docgen = Tools_Docgen
77
## Examples
88
```rescript
99
// Prints the current ReScript Tools version.
10-
let stringifiedJson = ChildProcess.execFileSync(RescriptTools.getBinaryPath(), ["-v"])
10+
let stringifiedJson = ChildProcess.execFileSync(RescriptTools.binaryPath, ["-v"])
1111
```
1212
*/
13-
@module("./getBinaryPath.js")
14-
external getBinaryPath: unit => string = "getBinaryPath"
13+
@module("../../cli/bin_path")
14+
external binaryPath: string = "rescript_tools_exe"
File renamed without changes.
File renamed without changes.

tests/analysis_tests/tests/src/expected/Completion.res.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,26 @@ Path Res
18861886
"modulePath": "RescriptReactRouter",
18871887
"filePath": "src/Completion.res"
18881888
}
1889+
}, {
1890+
"label": "RescriptTools",
1891+
"kind": 9,
1892+
"tags": [],
1893+
"detail": "module RescriptTools",
1894+
"documentation": null,
1895+
"data": {
1896+
"modulePath": "RescriptTools",
1897+
"filePath": "src/Completion.res"
1898+
}
1899+
}, {
1900+
"label": "RescriptTools_Docgen",
1901+
"kind": 9,
1902+
"tags": [],
1903+
"detail": "module RescriptTools_Docgen",
1904+
"documentation": null,
1905+
"data": {
1906+
"modulePath": "RescriptTools_Docgen",
1907+
"filePath": "src/Completion.res"
1908+
}
18891909
}, {
18901910
"label": "Result",
18911911
"kind": 9,

tests/analysis_tests/tests/src/expected/RecoveryOnProp.res.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,26 @@ Path Res
3535
"modulePath": "RescriptReactRouter",
3636
"filePath": "src/RecoveryOnProp.res"
3737
}
38+
}, {
39+
"label": "RescriptTools",
40+
"kind": 9,
41+
"tags": [],
42+
"detail": "module RescriptTools",
43+
"documentation": null,
44+
"data": {
45+
"modulePath": "RescriptTools",
46+
"filePath": "src/RecoveryOnProp.res"
47+
}
48+
}, {
49+
"label": "RescriptTools_Docgen",
50+
"kind": 9,
51+
"tags": [],
52+
"detail": "module RescriptTools_Docgen",
53+
"documentation": null,
54+
"data": {
55+
"modulePath": "RescriptTools_Docgen",
56+
"filePath": "src/RecoveryOnProp.res"
57+
}
3858
}, {
3959
"label": "Result",
4060
"kind": 9,

tools/binaries/.gitkeep

Whitespace-only changes.

tools/npm/cli.js

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

tools/npm/getBinaryPath.js

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

tools/package-lock.json

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

tools/package.json

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

0 commit comments

Comments
 (0)