Skip to content

Commit

Permalink
Ship RescriptTools module with the rescript npm package
Browse files Browse the repository at this point in the history
  • Loading branch information
cknitt committed Nov 11, 2024
1 parent 476bdaa commit cb9cc31
Show file tree
Hide file tree
Showing 16 changed files with 103 additions and 124 deletions.
13 changes: 13 additions & 0 deletions lib/es6/RescriptTools.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


import * as Bin_path from "../../cli/bin_path";

let binaryPath = Bin_path.rescript_tools_exe;

let Docgen;

export {
Docgen,
binaryPath,
}
/* binaryPath Not a pure module */
11 changes: 11 additions & 0 deletions lib/es6/RescriptTools_Docgen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@



function decodeFromJson(prim) {
return prim;
}

export {
decodeFromJson,
}
/* No side effect */
11 changes: 11 additions & 0 deletions lib/js/RescriptTools.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

let Bin_path = require("../../cli/bin_path");

let binaryPath = Bin_path.rescript_tools_exe;

let Docgen;

exports.Docgen = Docgen;
exports.binaryPath = binaryPath;
/* binaryPath Not a pure module */
9 changes: 9 additions & 0 deletions lib/js/RescriptTools_Docgen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';


function decodeFromJson(prim) {
return prim;
}

exports.decodeFromJson = decodeFromJson;
/* No side effect */
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"bsc": "cli/bsc",
"bstracing": "lib/bstracing",
"rescript": "cli/rescript",
"rescript-tools": "cli/rescript-tools",
"rewatch": "cli/rewatch"
},
"scripts": {
Expand Down
14 changes: 14 additions & 0 deletions packages/artifacts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ lib/es6/Primitive_string_extern.js
lib/es6/Primitive_util.js
lib/es6/Promise.js
lib/es6/RegExp.js
lib/es6/RescriptTools.js
lib/es6/RescriptTools_Docgen.js
lib/es6/Result.js
lib/es6/Set.js
lib/es6/String.js
Expand Down Expand Up @@ -353,6 +355,8 @@ lib/js/Primitive_string_extern.js
lib/js/Primitive_util.js
lib/js/Promise.js
lib/js/RegExp.js
lib/js/RescriptTools.js
lib/js/RescriptTools_Docgen.js
lib/js/Result.js
lib/js/Set.js
lib/js/String.js
Expand Down Expand Up @@ -1134,6 +1138,16 @@ lib/ocaml/RegExp.cmt
lib/ocaml/RegExp.cmti
lib/ocaml/RegExp.res
lib/ocaml/RegExp.resi
lib/ocaml/RescriptTools.cmi
lib/ocaml/RescriptTools.cmj
lib/ocaml/RescriptTools.cmt
lib/ocaml/RescriptTools.res
lib/ocaml/RescriptTools_Docgen.cmi
lib/ocaml/RescriptTools_Docgen.cmj
lib/ocaml/RescriptTools_Docgen.cmt
lib/ocaml/RescriptTools_Docgen.cmti
lib/ocaml/RescriptTools_Docgen.res
lib/ocaml/RescriptTools_Docgen.resi
lib/ocaml/Result.cmi
lib/ocaml/Result.cmj
lib/ocaml/Result.cmt
Expand Down
8 changes: 4 additions & 4 deletions tools/npm/RescriptTools.res → runtime/RescriptTools.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Docgen = Tools_Docgen
module Docgen = RescriptTools_Docgen

/** Returns the full file system path to the `rescript-tools` binary for the current platform, side stepping the JS that wraps the CLI.
Expand All @@ -7,8 +7,8 @@ module Docgen = Tools_Docgen
## Examples
```rescript
// Prints the current ReScript Tools version.
let stringifiedJson = ChildProcess.execFileSync(RescriptTools.getBinaryPath(), ["-v"])
let stringifiedJson = ChildProcess.execFileSync(RescriptTools.binaryPath, ["-v"])
```
*/
@module("./getBinaryPath.js")
external getBinaryPath: unit => string = "getBinaryPath"
@module("../../cli/bin_path.js")
external binaryPath: string = "rescript_tools_exe"
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions tests/analysis_tests/tests/src/expected/Completion.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1886,6 +1886,26 @@ Path Res
"modulePath": "RescriptReactRouter",
"filePath": "src/Completion.res"
}
}, {
"label": "RescriptTools",
"kind": 9,
"tags": [],
"detail": "module RescriptTools",
"documentation": null,
"data": {
"modulePath": "RescriptTools",
"filePath": "src/Completion.res"
}
}, {
"label": "RescriptTools_Docgen",
"kind": 9,
"tags": [],
"detail": "module RescriptTools_Docgen",
"documentation": null,
"data": {
"modulePath": "RescriptTools_Docgen",
"filePath": "src/Completion.res"
}
}, {
"label": "Result",
"kind": 9,
Expand Down
20 changes: 20 additions & 0 deletions tests/analysis_tests/tests/src/expected/RecoveryOnProp.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,26 @@ Path Res
"modulePath": "RescriptReactRouter",
"filePath": "src/RecoveryOnProp.res"
}
}, {
"label": "RescriptTools",
"kind": 9,
"tags": [],
"detail": "module RescriptTools",
"documentation": null,
"data": {
"modulePath": "RescriptTools",
"filePath": "src/RecoveryOnProp.res"
}
}, {
"label": "RescriptTools_Docgen",
"kind": 9,
"tags": [],
"detail": "module RescriptTools_Docgen",
"documentation": null,
"data": {
"modulePath": "RescriptTools_Docgen",
"filePath": "src/RecoveryOnProp.res"
}
}, {
"label": "Result",
"kind": 9,
Expand Down
Empty file removed tools/binaries/.gitkeep
Empty file.
16 changes: 0 additions & 16 deletions tools/npm/cli.js

This file was deleted.

19 changes: 0 additions & 19 deletions tools/npm/getBinaryPath.js

This file was deleted.

43 changes: 0 additions & 43 deletions tools/package-lock.json

This file was deleted.

42 changes: 0 additions & 42 deletions tools/package.json

This file was deleted.

0 comments on commit cb9cc31

Please sign in to comment.