Skip to content

Commit 7c49880

Browse files
committed
ReScript
1 parent 17b4996 commit 7c49880

10 files changed

+100
-110
lines changed

.gitattributes

-3
This file was deleted.

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ node_modules
99
# npm unused lock file (we use yarn.lock)
1010
package-lock.json
1111

12-
# ReScript / Reason / Ocaml artifacts
13-
#*.bs.js # we do want this files to ensure zero-cost
12+
# ReScript artifacts
13+
# *.bs.js # we do want this files to ensure zero-cost
1414
.bsb.lock
1515
**/lib/bs
1616
**/lib/ocaml

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Changelog of `@reason-react-native/async-storage`
1+
# Changelog of `@rescript-react-native/async-storage`
22

33
## 1.6.2 - 2021-20-19
44

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 @reason-react-native contributors
3+
Copyright (c) 2019 @rescript-react-native contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+27-27
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# `@reason-react-native/async-storage`
1+
# `@rescript-react-native/async-storage`
22

3-
[![Build Status](https://github.com/reason-react-native/async-storage/workflows/Build/badge.svg)](https://github.com/reason-react-native/async-storage/actions)
4-
[![Version](https://img.shields.io/npm/v/@reason-react-native/async-storage.svg)](https://www.npmjs.com/@reason-react-native/async-storage)
5-
[![Chat](https://img.shields.io/discord/235176658175262720.svg?logo=discord&colorb=blue)](https://reason-react-native.github.io/discord/)
3+
[![Build Status](https://github.com/rescript-react-native/async-storage/workflows/Build/badge.svg)](https://github.com/rescript-react-native/async-storage/actions)
4+
[![Version](https://img.shields.io/npm/v/@rescript-react-native/async-storage.svg)](https://www.npmjs.com/@rescript-react-native/async-storage)
5+
[![ReScript Forum](https://img.shields.io/discourse/posts?color=e6484f&label=ReScript%20Forum&server=https%3A%2F%2Fforum.rescript-lang.org)](https://forum.rescript-lang.org/)
66

7-
[ReScript](https://rescript-lang.org) / [Reason](https://reasonml.github.io) bindings for
7+
[ReScript](https://rescript-lang.org) bindings for
88
[`@react-native-async-storage/async-storage`](https://github.com/react-native-async-storage/async-storage).
99

1010
Exposed as `ReactNativeAsyncStorage` module.
1111

12-
`@reason-react-native/async-storage` X.y.\* means it's compatible with
12+
`@rescript-react-native/async-storage` X.y.\* means it's compatible with
1313
`@react-native-async-storage/async-storage` X.y.\*
1414

1515
## Installation
@@ -20,22 +20,22 @@ is properly installed & configured by following their installation instructions,
2020
you can install the bindings:
2121

2222
```console
23-
npm install @reason-react-native/async-storage
23+
npm install @rescript-react-native/async-storage
2424
# or
25-
yarn add @reason-react-native/async-storage
25+
yarn add @rescript-react-native/async-storage
2626
```
2727

28-
`@reason-react-native/async-storage` should be added to `bs-dependencies` in
28+
`@rescript-react-native/async-storage` should be added to `bs-dependencies` in
2929
your `bsconfig.json`:
3030

3131
```diff
3232
{
3333
//...
3434
"bs-dependencies": [
35-
"reason-react",
36-
"reason-react-native",
35+
"@rescript/react",
36+
"rescript-react-native",
3737
// ...
38-
+ "@reason-react-native/async-storage"
38+
+ "@rescript-react-native/async-storage"
3939
],
4040
//...
4141
}
@@ -47,7 +47,7 @@ your `bsconfig.json`:
4747

4848
#### `ReactNativeAsyncStorage.asyncStorageState`
4949

50-
```reason
50+
```rescript
5151
type asyncStorageState = {
5252
getItem: unit => Js.Promise.t(Js.Null.t(string)),
5353
setItem: string => Js.Promise.t(unit),
@@ -64,73 +64,73 @@ type asyncStorageState = {
6464

6565
#### `ReactNativeAsyncStorage.getItem`
6666

67-
```reason
67+
```rescript
6868
string => Js.Promise.t(Js.Null.t(string))
6969
```
7070

7171
#### `ReactNativeAsyncStorage.setItem`
7272

73-
```reason
73+
```rescript
7474
(string, string) => Js.Promise.t(unit)
7575
```
7676

7777
#### `ReactNativeAsyncStorage.removeItem`
7878

79-
```reason
79+
```rescript
8080
string => Js.Promise.t(unit)
8181
```
8282

8383
#### `ReactNativeAsyncStorage.mergeItem`
8484

85-
```reason
85+
```rescript
8686
(string, string) => Js.Promise.t(unit)
8787
```
8888

8989
#### `ReactNativeAsyncStorage.clear`
9090

91-
```reason
91+
```rescript
9292
unit => Js.Promise.t(unit)
9393
```
9494

9595
#### `ReactNativeAsyncStorage.getAllKeys`
9696

97-
```reason
97+
```rescript
9898
unit => Js.Promise.t(Js.Null.t(array(string)))
9999
```
100100

101101
#### `ReactNativeAsyncStorage.multiGet`
102102

103-
```reason
103+
```rescript
104104
array(string) => Js.Promise.t(array((string, Js.Null.t(string))))
105105
```
106106

107107
#### `ReactNativeAsyncStorage.multiSet`
108108

109-
```reason
109+
```rescript
110110
array((string, string)) => Js.Promise.t(unit)
111111
```
112112

113113
#### `ReactNativeAsyncStorage.multiMerge`
114114

115-
```reason
115+
```rescript
116116
array((string, string)) => Js.Promise.t(unit)
117117
```
118118

119119
#### `ReactNativeAsyncStorage.multiRemove`
120120

121-
```reason
121+
```rescript
122122
array(string) => Js.Promise.t(unit)
123123
```
124124

125125
#### `ReactNativeAsyncStorage.flushGetRequests`
126126

127-
```reason
127+
```rescript
128128
unit => unit
129129
```
130130

131131
#### `ReactNativeAsyncStorage.useAsyncStorage`
132132

133-
```reason
133+
```rescript
134134
string => asyncStorageState
135135
```
136136

@@ -146,11 +146,11 @@ releases.
146146
## Contribute
147147

148148
Read the
149-
[contribution guidelines](https://github.com/reason-react-native/.github/blob/master/CONTRIBUTING.md)
149+
[contribution guidelines](https://github.com/rescript-react-native/.github/blob/master/CONTRIBUTING.md)
150150
before contributing.
151151

152152
## Code of Conduct
153153

154154
We want this community to be friendly and respectful to each other. Please read
155-
[our full code of conduct](https://github.com/reason-react-native/.github/blob/master/CODE_OF_CONDUCT.md)
155+
[our full code of conduct](https://github.com/rescript-react-native/.github/blob/master/CODE_OF_CONDUCT.md)
156156
so that you can understand what actions will and will not be tolerated.

bsconfig.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
2-
"name": "@reason-react-native/async-storage",
3-
"refmt": 3,
4-
"reason": {
5-
"react-jsx": 3
6-
},
2+
"name": "@rescript-react-native/async-storage",
3+
"reason": { "react-jsx": 3 },
74
"package-specs": {
85
"module": "commonjs",
96
"in-source": true

package.json

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@reason-react-native/async-storage",
2+
"name": "@rescript-react-native/async-storage",
33
"description": "ReScript bindings for @react-native-async-storage/async-storage.",
44
"version": "1.6.2",
55
"publishConfig": {
@@ -8,19 +8,17 @@
88
"peerDependencies": {
99
"@react-native-community/async-storage": "^1.6.0"
1010
},
11-
"repository": "https://github.com/reason-react-native/async-storage.git",
11+
"repository": "https://github.com/rescript-react-native/async-storage.git",
1212
"license": "MIT",
1313
"keywords": [
1414
"rescript",
15-
"reason",
16-
"reasonml",
17-
"bucklescript",
1815
"react-native"
1916
],
2017
"files": [
2118
"*.md",
2219
"bsconfig.json",
23-
"src/**/*.re",
20+
"src/**/*.res",
21+
"src/**/*.resi",
2422
"src/**/*.js",
2523
"!src/**/*.bs.js"
2624
],
@@ -37,7 +35,7 @@
3735
"release": "npmpub"
3836
},
3937
"devDependencies": {
40-
"bs-platform": "^8.2.0",
38+
"bs-platform": "^9.0.0",
4139
"husky": "^4.0.0",
4240
"lint-staged": "^10.0.0",
4341
"npmpub": "^5.0.0",

src/ReactNativeAsyncStorage.re

-60
This file was deleted.

src/ReactNativeAsyncStorage.res

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
@scope("default") @module("@react-native-async-storage/async-storage")
2+
external getItem: string => Js.Promise.t<Js.Null.t<string>> = "getItem"
3+
4+
@scope("default") @module("@react-native-async-storage/async-storage")
5+
external setItem: (string, string) => Js.Promise.t<unit> = "setItem"
6+
7+
@scope("default") @module("@react-native-async-storage/async-storage")
8+
external removeItem: string => Js.Promise.t<unit> = "removeItem"
9+
10+
@scope("default") @module("@react-native-async-storage/async-storage")
11+
external mergeItem: (string, string) => Js.Promise.t<unit> = "mergeItem"
12+
13+
@scope("default") @module("@react-native-async-storage/async-storage")
14+
external clear: unit => Js.Promise.t<unit> = "clear"
15+
16+
@scope("default") @module("@react-native-async-storage/async-storage")
17+
external getAllKeys: unit => Js.Promise.t<Js.Null.t<array<string>>> = "getAllKeys"
18+
19+
@scope("default") @module("@react-native-async-storage/async-storage")
20+
external multiGet: array<string> => Js.Promise.t<array<(string, Js.Null.t<string>)>> = "multiGet"
21+
22+
@scope("default") @module("@react-native-async-storage/async-storage")
23+
external multiSet: array<(string, string)> => Js.Promise.t<unit> = "multiSet"
24+
25+
@scope("default") @module("@react-native-async-storage/async-storage")
26+
external multiMerge: array<(string, string)> => Js.Promise.t<unit> = "multiMerge"
27+
28+
@scope("default") @module("@react-native-async-storage/async-storage")
29+
external multiRemove: array<string> => Js.Promise.t<unit> = "multiRemove"
30+
31+
@scope("default") @module("@react-native-async-storage/async-storage")
32+
external flushGetRequests: unit => unit = "flushGetRequests"
33+
34+
type asyncStorageState = {
35+
@meth
36+
"getItem": unit => Js.Promise.t<Js.Null.t<string>>,
37+
@meth
38+
"setItem": string => Js.Promise.t<unit>,
39+
@meth
40+
"mergeItem": string => Js.Promise.t<unit>,
41+
@meth
42+
"removeItem": unit => Js.Promise.t<unit>,
43+
}
44+
45+
@deprecated(
46+
"Please use `useAsyncStorage_` instead of `useAsyncStorage` to use record syntax. In next major release, `useAsyncStorage_` will become `useAsyncStorage`."
47+
)
48+
@module("@react-native-async-storage/async-storage")
49+
external useAsyncStorage: string => asyncStorageState = "useAsyncStorage"
50+
type asyncStorageStateAlt = {
51+
getItem: unit => Js.Promise.t<Js.Null.t<string>>,
52+
setItem: string => Js.Promise.t<unit>,
53+
mergeItem: string => Js.Promise.t<unit>,
54+
removeItem: unit => Js.Promise.t<unit>,
55+
}
56+
57+
@module("@react-native-async-storage/async-storage")
58+
external useAsyncStorage_: string => asyncStorageState = "useAsyncStorage"

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,10 @@ braces@^3.0.1:
251251
dependencies:
252252
fill-range "^7.0.1"
253253

254-
bs-platform@^8.2.0:
255-
version "8.3.2"
256-
resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-8.3.2.tgz#c307f1cc2d2397c3d088c7f3b62e9f493283cdcf"
257-
integrity sha512-iOTi5JIlNPoCPq31NS9ET79FLyCpwTL2JZbgHz35LzY9Bch1iDtbBR3FVGhRbjphxelAP4fLlFONfUNp5Y3a5g==
254+
bs-platform@^9.0.0:
255+
version "9.0.2"
256+
resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-9.0.2.tgz#a6eac70eb8924a322556dacaccbfbc9b2a0d3a37"
257+
integrity sha512-Ye9JqJ4Oa7mcjjoOVRYI8Uc2Cf8N7jQLWDcdUplY7996d/YErSR7WitmV7XnSwr4EvdrbwjEsg1NxNjUQv3ChA==
258258

259259
callsites@^3.0.0:
260260
version "3.1.0"

0 commit comments

Comments
 (0)