@reventlessdev/rescript-node 2.0.0-alpha.15 → 2.0.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/package.json +1 -1
- package/rescript.json +3 -0
- package/src/NodeAssert.res +35 -0
- package/src/NodeAssert.res.mjs +2 -0
- package/src/NodeBuffer.res +4 -0
- package/src/NodeChildProcess.res +4 -0
- package/src/NodeFs.res +9 -0
- package/src/NodeProcess.res +11 -0
- package/src/NodeReadline.res +20 -0
- package/src/NodeReadline.res.mjs +2 -0
- package/src/NodeTest.res +23 -0
- package/src/NodeTest.res.mjs +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 2.0.0-alpha.17 (2026-09-28)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **node:** bind node:test and node:assert, lstatSync, execPath and base64 decoding ([c067e39](https://github.com/ReventlessDev/reventless-core/commit/c067e39ce3a5979f3a18c4761e4673baa6c11ffd))
|
|
11
|
+
* **node:** bind readline's promise API, process.platform and spawnSync's shell option ([c166726](https://github.com/ReventlessDev/reventless-core/commit/c166726008a08bb8b4b3e7b9d33dabde02389bad))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# 2.0.0-alpha.16 (2026-09-27)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **node:** bind node:test and node:assert, lstatSync, execPath and base64 decoding ([c067e39](https://github.com/ReventlessDev/reventless-core/commit/c067e39ce3a5979f3a18c4761e4673baa6c11ffd))
|
|
19
|
+
|
|
20
|
+
|
|
6
21
|
# 2.0.0-alpha.15 (2026-09-23)
|
|
7
22
|
|
|
8
23
|
* feat(node)!: every command-line tool reads its arguments through parseArgs ([2e41979](https://github.com/ReventlessDev/reventless-core/commit/2e41979b73646c46356e197e17eb4a3da0154c73))
|
package/package.json
CHANGED
package/rescript.json
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"dir": "src",
|
|
16
16
|
"subdirs": true,
|
|
17
17
|
"public": [
|
|
18
|
+
"NodeAssert",
|
|
18
19
|
"NodeBuffer",
|
|
19
20
|
"NodeChildProcess",
|
|
20
21
|
"NodeCrypto",
|
|
@@ -24,7 +25,9 @@
|
|
|
24
25
|
"NodeOs",
|
|
25
26
|
"NodePath",
|
|
26
27
|
"NodeProcess",
|
|
28
|
+
"NodeReadline",
|
|
27
29
|
"NodeStreams",
|
|
30
|
+
"NodeTest",
|
|
28
31
|
"NodeUrl",
|
|
29
32
|
"NodeUtil",
|
|
30
33
|
"NodeZlib"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Bindings for [`node:assert/strict`](https://nodejs.org/api/assert.html#strict-assertion-mode).
|
|
2
|
+
|
|
3
|
+
The strict module only: `equal` is `===` and `deepEqual` is `deepStrictEqual`,
|
|
4
|
+
so a test cannot pass on a coercion. Each assertion that takes a message has a
|
|
5
|
+
`…Msg` form; the message replaces Node's generated one when the assertion
|
|
6
|
+
fails, so it should say what went wrong rather than restate the values. */
|
|
7
|
+
@module("node:assert/strict")
|
|
8
|
+
external equal: ('a, 'a) => unit = "equal"
|
|
9
|
+
|
|
10
|
+
@module("node:assert/strict")
|
|
11
|
+
external equalMsg: ('a, 'a, string) => unit = "equal"
|
|
12
|
+
|
|
13
|
+
@module("node:assert/strict")
|
|
14
|
+
external deepEqual: ('a, 'a) => unit = "deepEqual"
|
|
15
|
+
|
|
16
|
+
@module("node:assert/strict")
|
|
17
|
+
external deepEqualMsg: ('a, 'a, string) => unit = "deepEqual"
|
|
18
|
+
|
|
19
|
+
@module("node:assert/strict")
|
|
20
|
+
external ok: bool => unit = "ok"
|
|
21
|
+
|
|
22
|
+
@module("node:assert/strict")
|
|
23
|
+
external okMsg: (bool, string) => unit = "ok"
|
|
24
|
+
|
|
25
|
+
/** `assert.match`, renamed because `match` is not an identifier in ReScript. */
|
|
26
|
+
@module("node:assert/strict")
|
|
27
|
+
external matches: (string, RegExp.t) => unit = "match"
|
|
28
|
+
|
|
29
|
+
@module("node:assert/strict")
|
|
30
|
+
external doesNotMatch: (string, RegExp.t) => unit = "doesNotMatch"
|
|
31
|
+
|
|
32
|
+
/** Always throws, so it types as any value — usable as the arm of a `switch` that
|
|
33
|
+
has nothing to return. */
|
|
34
|
+
@module("node:assert/strict")
|
|
35
|
+
external fail: string => 'a = "fail"
|
package/src/NodeBuffer.res
CHANGED
|
@@ -25,6 +25,10 @@ external fromStringBase64Url: (string, @as("base64url") _) => t = "from"
|
|
|
25
25
|
|
|
26
26
|
/** A `Buffer` over a copy of the bytes. A plain `Uint8Array` — what the AWS SDK
|
|
27
27
|
hands back — has only the array's own `toString`, which joins the numbers. */
|
|
28
|
+
/** Standard base64, the alphabet of a `data:…;base64,` URI. */
|
|
29
|
+
@val @scope("Buffer")
|
|
30
|
+
external fromStringBase64: (string, @as("base64") _) => t = "from"
|
|
31
|
+
|
|
28
32
|
@val @scope("Buffer")
|
|
29
33
|
external fromBytes: Uint8Array.t => t = "from"
|
|
30
34
|
|
package/src/NodeChildProcess.res
CHANGED
|
@@ -8,6 +8,10 @@ type execOptions = {
|
|
|
8
8
|
maxBuffer?: int,
|
|
9
9
|
/** Written to the child's stdin, which is then closed. */
|
|
10
10
|
input?: string,
|
|
11
|
+
/** Runs the command through a shell. Needed on Windows to start a `.cmd` shim
|
|
12
|
+
such as `pnpm`, and for a shell builtin such as `command -v`; otherwise
|
|
13
|
+
leave it off, since a shell re-splits the arguments. */
|
|
14
|
+
shell?: bool,
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
@module("node:child_process")
|
package/src/NodeFs.res
CHANGED
|
@@ -16,6 +16,15 @@ existsSync: string => bool = "existsSync"
|
|
|
16
16
|
@module("node:fs")
|
|
17
17
|
external realpathSync: string => string = "realpathSync"
|
|
18
18
|
|
|
19
|
+
type stats
|
|
20
|
+
|
|
21
|
+
/** Stats the path itself rather than what it points to, which is the only way to
|
|
22
|
+
tell a symbolic link from its target. */
|
|
23
|
+
@module("node:fs")
|
|
24
|
+
external lstatSync: string => stats = "lstatSync"
|
|
25
|
+
|
|
26
|
+
@send external isSymbolicLink: stats => bool = "isSymbolicLink"
|
|
27
|
+
|
|
19
28
|
/** Set a file's access and modification times, in seconds since the epoch.
|
|
20
29
|
|
|
21
30
|
The reason this exists here rather than as a shell-out to `touch`: a build
|
package/src/NodeProcess.res
CHANGED
|
@@ -23,6 +23,17 @@ external exit: int => unit = "exit"
|
|
|
23
23
|
@val @scope("process")
|
|
24
24
|
external pid: int = "pid"
|
|
25
25
|
|
|
26
|
+
/** The absolute path of the running `node` binary — what a test spawns a script
|
|
27
|
+
with, so the child runs on the same Node as the parent rather than whichever
|
|
28
|
+
`node` is first on `PATH`. */
|
|
29
|
+
@val @scope("process")
|
|
30
|
+
external execPath: string = "execPath"
|
|
31
|
+
|
|
32
|
+
/** The operating system Node was built for: `"darwin"`, `"linux"`, `"win32"`, …
|
|
33
|
+
A string rather than a variant because the set is Node's to extend. */
|
|
34
|
+
@val @scope("process")
|
|
35
|
+
external platform: string = "platform"
|
|
36
|
+
|
|
26
37
|
/** `versions["node"]` is the running Node's version, without the leading `v`. */
|
|
27
38
|
@val @scope("process")
|
|
28
39
|
external versions: dict<string> = "versions"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Bindings for [`node:readline/promises`](https://nodejs.org/api/readline.html#promises-api):
|
|
2
|
+
asking a question on a terminal and awaiting the answer.
|
|
3
|
+
|
|
4
|
+
The promise form, for a prompt that reads one answer at a time. A stream read
|
|
5
|
+
line by line is {!NodeStreams.Readline}. The interface holds stdin open, so
|
|
6
|
+
close it once the last answer is in or the process will not exit. */
|
|
7
|
+
type t
|
|
8
|
+
|
|
9
|
+
type options = {input: NodeProcess.stream, output: NodeProcess.stream}
|
|
10
|
+
|
|
11
|
+
@module("node:readline/promises")
|
|
12
|
+
external createInterface: options => t = "createInterface"
|
|
13
|
+
|
|
14
|
+
/** Writes the question to `output` and resolves with the line typed in reply,
|
|
15
|
+
without its line ending. */
|
|
16
|
+
@send
|
|
17
|
+
external question: (t, string) => promise<string> = "question"
|
|
18
|
+
|
|
19
|
+
@send
|
|
20
|
+
external close: t => unit = "close"
|
package/src/NodeTest.res
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Bindings for [`node:test`](https://nodejs.org/api/test.html), the runner behind
|
|
2
|
+
`node --test`.
|
|
3
|
+
|
|
4
|
+
Only the forms a test file declares itself with. A test body is synchronous
|
|
5
|
+
unless it is bound through {!testAsync}; a promise returned from {!test}'s body
|
|
6
|
+
would not be awaited by the type, so the two are kept apart. */
|
|
7
|
+
@module("node:test")
|
|
8
|
+
external test: (string, unit => unit) => unit = "test"
|
|
9
|
+
|
|
10
|
+
@module("node:test")
|
|
11
|
+
external testAsync: (string, unit => promise<unit>) => unit = "test"
|
|
12
|
+
|
|
13
|
+
/** Whether a test runs, or why it is skipped. Node takes `false` or a reason
|
|
14
|
+
string, and prints the reason beside the skipped test. */
|
|
15
|
+
@unboxed
|
|
16
|
+
type skip = | @as(false) Run | Skip(string)
|
|
17
|
+
|
|
18
|
+
type options = {skip?: skip}
|
|
19
|
+
|
|
20
|
+
/** A test that decides at load time whether it can run — one that needs a sibling
|
|
21
|
+
checkout, say, and skips with a reason where there is none. */
|
|
22
|
+
@module("node:test")
|
|
23
|
+
external testWith: (string, options, unit => unit) => unit = "test"
|