Skip to content

Commit b621443

Browse files
committed
ReScript
1 parent 481a587 commit b621443

11 files changed

+135
-143
lines changed

Diff for: .gitattributes

-3
This file was deleted.

Diff for: .github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
**Before submitting a pull request,** please make you followed our CONTRIBUTING guide
44
5-
https://github.com/reason-react-native/fetch-blob/blob/master/CONTRIBUTING.md
5+
https://github.com/rescript-react-native/fetch-blob/blob/master/CONTRIBUTING.md
66
77
-->
88

Diff for: .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

Diff for: CHANGELOG.md

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

33
## 0.12.1 - 2020-11-17
44

Diff for: 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
3+
Copyright (c) 2019 @rescript-react-native
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

Diff for: README.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# `@reason-react-native/fetch-blob`
1+
# `@rescript-react-native/fetch-blob`
22

3-
[![Build Status](https://github.com/reason-react-native/fetch-blob/workflows/Build/badge.svg)](https://github.com/reason-react-native/fetch-blob/actions)
4-
[![Version](https://img.shields.io/npm/v/@reason-react-native/fetch-blob.svg)](https://www.npmjs.com/@reason-react-native/fetch-blob)
5-
[![Chat](https://img.shields.io/discord/235176658175262720.svg?logo=discord&colorb=blue)](https://reasonml-community.github.io/reason-react-native/discord/)
3+
[![Build Status](https://github.com/rescript-react-native/fetch-blob/workflows/Build/badge.svg)](https://github.com/rescript-react-native/fetch-blob/actions)
4+
[![Version](https://img.shields.io/npm/v/@rescript-react-native/fetch-blob.svg)](https://www.npmjs.com/@rescript-react-native/fetch-blob)
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
[`rn-fetch-blob`](https://github.com/joltup/rn-fetch-blob).
99

1010
Exposed as `ReactNativeFetchBlob` module.
1111

1212
**⚠️ Incomplete bindings!**
1313

14-
`@reason-react-native/fetch-blob` X.y.\* means it's compatible with
14+
`@rescript-react-native/fetch-blob` X.y.\* means it's compatible with
1515
`rn-fetch-blob` X.y.\*
1616

1717
## Installation
@@ -21,22 +21,22 @@ installed & configured by following their installation instructions, you can
2121
install the bindings:
2222

2323
```console
24-
npm install @reason-react-native/fetch-blob
24+
npm install @rescript-react-native/fetch-blob
2525
# or
26-
yarn add @reason-react-native/fetch-blob
26+
yarn add @rescript-react-native/fetch-blob
2727
```
2828

29-
`@reason-react-native/fetch-blob` should be added to `bs-dependencies` in your
29+
`@rescript-react-native/fetch-blob` should be added to `bs-dependencies` in your
3030
`bsconfig.json`:
3131

3232
```diff
3333
{
3434
//...
3535
"bs-dependencies": [
36-
"reason-react",
37-
"reason-react-native",
36+
"@rescript/react",
37+
"rescript-react-native",
3838
// ...
39-
+ "@reason-react-native/fetch-blob"
39+
+ "@rescript-react-native/fetch-blob"
4040
],
4141
//...
4242
}
@@ -55,10 +55,10 @@ releases.
5555

5656
## Contribute
5757

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

6060
## Code of Conduct
6161

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

Diff for: bsconfig.json

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

Diff for: package.json

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@reason-react-native/fetch-blob",
2+
"name": "@rescript-react-native/fetch-blob",
33
"description": "ReScript bindings for rn-fetch-blob.",
44
"version": "0.12.1",
55
"publishConfig": {
@@ -8,19 +8,17 @@
88
"peerDependencies": {
99
"rn-fetch-blob": "^0.12.0"
1010
},
11-
"repository": "https://github.com/reason-react-native/fetch-blob.git",
11+
"repository": "https://github.com/rescript-react-native/fetch-blob.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",

Diff for: src/ReactNativeFetchBlob.re

-105
This file was deleted.

Diff for: src/ReactNativeFetchBlob.res

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
type t
2+
@module("rn-fetch-blob") external fetchBlob: t = "default"
3+
4+
module Config = {
5+
@deriving({abstract: light})
6+
type t = {
7+
@optional
8+
fileCache: bool,
9+
@optional
10+
appendExt: string,
11+
@optional
12+
path: string,
13+
@optional
14+
key: string,
15+
@optional
16+
timeout: int,
17+
@optional
18+
wifiOnly: bool,
19+
}
20+
}
21+
22+
module ResponseInfo = {
23+
type t
24+
@get external headers: t => Js.Dict.t<string> = "headers"
25+
@get external status: t => int = "status"
26+
}
27+
28+
module Response = {
29+
type t
30+
@send external info: t => ResponseInfo.t = "info"
31+
@send external text: t => string = "text"
32+
@send external json: t => Js.Json.t = "json"
33+
34+
/* For file downloads */
35+
@send external path: t => string = "path"
36+
}
37+
38+
module Fetch = {
39+
type t
40+
@send
41+
external fetch: (
42+
t,
43+
~method: string,
44+
~url: string,
45+
~headers: {.},
46+
~body: 'a,
47+
) => Js.Promise.t<Response.t> = "fetch"
48+
}
49+
50+
module Fs = {
51+
module Stat = {
52+
@deriving({abstract: light})
53+
type t = {
54+
filename: string,
55+
path: string,
56+
size: int,
57+
@as("type")
58+
type_: string,
59+
lastModified: float,
60+
}
61+
}
62+
63+
type dirs
64+
65+
@get external documentDir: dirs => string = "DocumentDir"
66+
@get external cacheDir: dirs => string = "CacheDir"
67+
68+
/* Can be used to access files embedded on iOS apps only */
69+
@get external mainBundleDir: dirs => string = "MainBundleDir"
70+
71+
/* Android Only */
72+
@get external dcimDir: dirs => string = "DCIMDir"
73+
@get external downloadDir: dirs => string = "DownloadDir"
74+
@get external musicDir: dirs => string = "MusicDir"
75+
@get external pictureDir: dirs => string = "PictureDir"
76+
@get external movieDir: dirs => string = "MovieDir"
77+
@get external ringtoneDir: dirs => string = "RingtoneDir"
78+
@get external sdCardDir: dirs => string = "SDCardDir"
79+
80+
type t
81+
82+
@get external dirs: t => dirs = "dirs"
83+
@send
84+
external cp: (t, ~from: string, ~to_: string) => Js.Promise.t<unit> = "from"
85+
@send
86+
external unlink: (t, ~path: string) => Js.Promise.t<unit> = "unlink"
87+
@send
88+
external mkdir: (t, ~path: string) => Js.Promise.t<unit> = "mkdir"
89+
@send
90+
external exists: (t, ~path: string) => Js.Promise.t<bool> = "exists"
91+
@send
92+
external lstat: (t, ~path: string) => Js.Promise.t<array<Stat.t>> = "path"
93+
@send
94+
external stat: (t, ~path: string) => Js.Promise.t<Stat.t> = "stat"
95+
@send
96+
external readFile: (t, ~path: string, ~encoding: string) => Js.Promise.t<string> = "readFile"
97+
@send external asset: (t, ~path: string) => string = "asset"
98+
}
99+
100+
@send external config: (t, Config.t) => Fetch.t = "config"
101+
@get external fs: t => Fs.t = "fs"
102+
103+
type data
104+
105+
@send external wrap: (t, ~path: string) => data = "wrap"

Diff for: yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ braces@^3.0.1:
258258
dependencies:
259259
fill-range "^7.0.1"
260260

261-
bs-platform@^8.2.0:
262-
version "8.3.2"
263-
resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-8.3.2.tgz#c307f1cc2d2397c3d088c7f3b62e9f493283cdcf"
264-
integrity sha512-iOTi5JIlNPoCPq31NS9ET79FLyCpwTL2JZbgHz35LzY9Bch1iDtbBR3FVGhRbjphxelAP4fLlFONfUNp5Y3a5g==
261+
bs-platform@^9.0.0:
262+
version "9.0.2"
263+
resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-9.0.2.tgz#a6eac70eb8924a322556dacaccbfbc9b2a0d3a37"
264+
integrity sha512-Ye9JqJ4Oa7mcjjoOVRYI8Uc2Cf8N7jQLWDcdUplY7996d/YErSR7WitmV7XnSwr4EvdrbwjEsg1NxNjUQv3ChA==
265265

266266
callsites@^3.0.0:
267267
version "3.1.0"

0 commit comments

Comments
 (0)