Skip to content

Commit 0726d29

Browse files
committed
v9.0.0 🚀 - Reverse & Compile
1 parent 65d1140 commit 0726d29

File tree

9 files changed

+480
-143
lines changed

9 files changed

+480
-143
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ jobs:
260260
- uses: pnpm/action-setup@v2
261261
- uses: actions/setup-node@v3
262262
with:
263-
node-version: 18
263+
node-version: 22.6.0
264264
cache: "pnpm"
265265
- run: pnpm install
266266

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ lib
66
coverage
77
dist
88
packages/artifacts
9+
.tsimp

‎IDEAS.md‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ let trimContract: S.contract<string => string> = S.contract(s => {
1818

1919
- Use internal transform for trim
2020

21-
## v9
22-
23-
- Update documentation:
24-
- Add Enums section to js docs
25-
2621
### Done
2722

2823
- Removed deprecated APIs, check S.resi diff, S.d.ts and RescriptSchema.gen.ts

‎docs/js-usage.md‎

Lines changed: 183 additions & 75 deletions
Large diffs are not rendered by default.

‎docs/rescript-usage.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,9 +1311,9 @@ This is literally the same as convert operations applied to the reversed schema.
13111311

13121312
For some cases you might want to simply assert the input value is valid. For this there's `S.assertOrThrow` operation:
13131313

1314-
| Operation | Interface | Description |
1315-
| --------------- | --------------------------- | ------------------------------------- |
1316-
| S.assertOrThrow | `('any, S.t<'value>) => ()` | Asserts that the input value is valid |
1314+
| Operation | Interface | Description |
1315+
| --------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
1316+
| S.assertOrThrow | `('any, S.t<'value>) => ()` | Asserts that the input value is valid. Since the operation doesn't return a value, it's 2-3 times faster than `parseOrThrow` depending on the schema |
13171317

13181318
All operations either return the output value or raise an exception which you can catch with `try/catch` block:
13191319

@@ -1330,13 +1330,13 @@ try true->S.parseOrThrow(schema) catch {
13301330
If you want to have the most possible performance, or the built-in operations doesn't cover your specific use case, you can use `compile` to create fine-tuned operation functions.
13311331

13321332
```rescript
1333-
let fn = S.compile(
1333+
let operation = S.compile(
13341334
S.string,
13351335
~input=Any,
13361336
~output=Assert,
13371337
~mode=Async,
13381338
)
1339-
await fn("Hello world!")
1339+
await operation("Hello world!")
13401340
// ()
13411341
```
13421342

@@ -1356,7 +1356,7 @@ You can configure compiled function `output` with the following options:
13561356
- `Unknown` - returns `unknown`
13571357
- `Assert` - returns `unit`
13581358
- `Json` - validates that the schema is JSON compatible and returns `Js.Json.t`
1359-
- `JsonString` - validates that the schema is JSON compatible and transforms output to JSON string
1359+
- `JsonString` - validates that the schema is JSON compatible and converts output to JSON string
13601360

13611361
You can configure compiled function `mode` with the following options:
13621362

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
],
6969
"nodeArguments": [
7070
"--no-warnings",
71-
"--loader=ts-node/esm"
71+
"--import=tsimp"
7272
]
7373
},
7474
"devDependencies": {
@@ -81,7 +81,7 @@
8181
"rescript-stdlib-vendorer": "1.1.0",
8282
"rescript-schema": "link:",
8383
"ts-expect": "1.3.0",
84-
"ts-node": "10.9.1",
84+
"tsimp": "2.0.12",
8585
"typescript": "4.9.3",
8686
"valibot": "0.42.1",
8787
"zod": "3.24.1"

0 commit comments

Comments
 (0)