@greenlabs/ppx-spice 0.2.0-next.0 → 0.2.1-rc.0
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 +11 -0
- package/README.md +9 -0
- package/greenlabs-ppx-spice-0.2.1-rc.0.tgz +0 -0
- package/package.json +2 -2
- package/ppx-linux.exe +0 -0
- package/ppx-osx.exe +0 -0
- package/ppx-windows.exe +0 -0
- package/src/rescript/Spice.res +4 -4
- package/src/rescript/Spice_Codecs.res +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 0.2.1 (unreleased)
|
|
4
|
+
|
|
5
|
+
- a190663 Utilize Js.Json.Boolean(bool) instead oif Js.Json.True, False https://github.com/green-labs/ppx_spice/pull/58
|
|
6
|
+
- a190663 Add support of uncurried mode for interface(*.resi) https://github.com/green-labs/ppx_spice/pull/58
|
|
7
|
+
|
|
8
|
+
## 0.2.0
|
|
9
|
+
|
|
10
|
+
### Minor Changes
|
|
11
|
+
|
|
12
|
+
- 9ce55bf: Compat the untagged variant
|
|
13
|
+
|
|
3
14
|
## 0.2.0-next.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -74,6 +74,8 @@ type data = {
|
|
|
74
74
|
|
|
75
75
|
There are many cases to parse and stringify the string data into (polymorphic) variants. Furthermore, the Unicode string needs to be handled with a variant. Currently, pattern matching is not working for the Unicode string in ReScript, the Spice is using `if ... then ... else` to compare the Unicode string in case of adding `@spice.as` attribute.
|
|
76
76
|
|
|
77
|
+
3. Last but not least, Spice supports the latest ReScript compilers: v10's optional field record, v11's untagged variant, and more.
|
|
78
|
+
|
|
77
79
|
## Example
|
|
78
80
|
|
|
79
81
|
1. Variant
|
|
@@ -124,6 +126,13 @@ Read our [Guide with examples](docs/GUIDE.md)
|
|
|
124
126
|
|
|
125
127
|
## Install
|
|
126
128
|
|
|
129
|
+
### Versions
|
|
130
|
+
|
|
131
|
+
|Compiler|Ppx_spice |
|
|
132
|
+
|--------|-----------|
|
|
133
|
+
|v10 |~<= v0.1.15|
|
|
134
|
+
|v11 |>= v0.2.0 |
|
|
135
|
+
|
|
127
136
|
```sh
|
|
128
137
|
yarn add -D @greenlabs/ppx-spice
|
|
129
138
|
```
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@greenlabs/ppx-spice",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1-rc.0",
|
|
4
4
|
"description": "ReScript PPX which generate JSON (de)serializer",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Greenlabs Dev <developer@greenlabs.co.kr>",
|
|
@@ -21,4 +21,4 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@changesets/cli": "^2.26.2"
|
|
23
23
|
}
|
|
24
|
-
}
|
|
24
|
+
}
|
package/ppx-linux.exe
CHANGED
|
Binary file
|
package/ppx-osx.exe
CHANGED
|
Binary file
|
package/ppx-windows.exe
CHANGED
|
Binary file
|
package/src/rescript/Spice.res
CHANGED
|
@@ -60,13 +60,13 @@ let floatFromJson = j =>
|
|
|
60
60
|
|
|
61
61
|
let boolToJson = (v): Js.Json.t =>
|
|
62
62
|
switch v {
|
|
63
|
-
| true => Js.Json.
|
|
64
|
-
| false => Js.Json.
|
|
63
|
+
| true => Js.Json.Boolean(true)
|
|
64
|
+
| false => Js.Json.Boolean(false)
|
|
65
65
|
}
|
|
66
66
|
let boolFromJson = j =>
|
|
67
67
|
switch (j: Js.Json.t) {
|
|
68
|
-
| Js.Json.
|
|
69
|
-
| Js.Json.
|
|
68
|
+
| Js.Json.Boolean(true) => Belt.Result.Ok(true)
|
|
69
|
+
| Js.Json.Boolean(false) => Belt.Result.Ok(false)
|
|
70
70
|
| _ => Belt.Result.Error({path: "", message: "Not a boolean", value: j})
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
let falseableEncode = (encoder, opt) =>
|
|
2
2
|
switch opt {
|
|
3
|
-
| None => Js.Json.
|
|
3
|
+
| None => Js.Json.Boolean(false)
|
|
4
4
|
| Some(v) => encoder(v)
|
|
5
5
|
}
|
|
6
6
|
let falseableDecode = (decoder, json) =>
|
|
7
7
|
switch json {
|
|
8
|
-
| Js.Json.
|
|
8
|
+
| Js.Json.Boolean(false) => Belt.Result.Ok(None)
|
|
9
9
|
| _ => Belt.Result.map(decoder(json), v => Some(v))
|
|
10
10
|
}
|
|
11
11
|
let falseable = (falseableEncode, falseableDecode)
|