Skip to content

Commit d75edfd

Browse files
authored
Merge pull request #121 from jeddeloh/bucklescript-cleanup
Bucklescript cleanup
2 parents 8d15501 + 12348ca commit d75edfd

File tree

33 files changed

+798
-158
lines changed

33 files changed

+798
-158
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
> ⚠️ **NOTICE:** This package recently changed and is now published as `rescript-apollo-client`!
2-
31
<p align="center">
42
<img src="assets/logo-mashup.svg" alt="Logo">
53
<br><br>

docs/4d54d076.3ea537c3.js

Lines changed: 643 additions & 1 deletion
Large diffs are not rendered by default.

docs/docs/contributing/index.html

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

documentationWebsite/docs/contributing.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Sometimes multiple types were required to represent a single type in TypeScript.
8383

8484
### Binding to Methods
8585

86-
Prefer T-first with `[@bs.send]`. Again, `externals` go under a `Js_` module with a `type t` and any types they reference should be `Js_.t` versions.
86+
Prefer T-first with `[@send]`. Again, `externals` go under a `Js_` module with a `type t` and any types they reference should be `Js_.t` versions.
8787

8888
### Binding to Objects
8989

@@ -97,7 +97,7 @@ Prefer standard variants. `jsConverter` works great for ints, but otherwise use
9797

9898
- Prefer T-first because that's the Reason community default
9999
- Hooks are T-last because that makes sense given their usage
100-
- ApolloClient methods are a Frankenstein T-first _and_ T-last because they want to maintain similarity with hooks api, but are also T-first due to [@bs.send] and T-first preference
100+
- ApolloClient methods are a Frankenstein T-first _and_ T-last because they want to maintain similarity with hooks api, but are also T-first due to [@send] and T-first preference
101101

102102
### Reasoning behind `Js_` modules
103103

@@ -152,7 +152,7 @@ module TypeName = {
152152
+ optionalProp: option(bool),
153153
+ }
154154

155-
+ [@bs.new] [@bs.module "someModule"]
155+
+ [@new] [@module "someModule"]
156156
+ external make = (make_options('jsData)) => t = "someClass";
157157
}
158158

@@ -193,7 +193,7 @@ module TypeName = {
193193
optionalProp: option(bool),
194194
+ reusedType: ReusedType.Js_.t
195195
}
196-
[@bs.new] [@bs.module "someModule"]
196+
[@new] [@module "someModule"]
197197
external make = (make_options('jsData)) => t = "someClass";
198198
}
199199

@@ -239,7 +239,7 @@ module TypeName = {
239239
optionalProp: option(bool),
240240
reusedType: ReusedType.Js_.t
241241
}
242-
[@bs.new] [@bs.module "someModule"]
242+
[@new] [@module "someModule"]
243243
external make = (make_options('jsData)) => t = "someClass";
244244
}
245245

src/@apollo/client/cache/core/ApolloClient__Cache_Core_Cache.res

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module ApolloCache = {
3636
type reference
3737

3838
// readFragment<FragmentType, TVariables = any>(options: DataProxy.Fragment<TVariables>, optimistic?: boolean): FragmentType | null;
39-
@bs.send
39+
@send
4040
external readFragment: (
4141
t<'tSerialized>,
4242
~options: DataProxy.Fragment.Js_.t,
@@ -45,22 +45,22 @@ module ApolloCache = {
4545
) => Js.nullable<'jsData> = "readFragment"
4646

4747
// readQuery<QueryType, TVariables = any>(options: DataProxy.Query<TVariables>, optimistic?: boolean): QueryType | null;
48-
@bs.send
48+
@send
4949
external readQuery: (
5050
t<'tSerialized>,
5151
~options: DataProxy.Query.Js_.t<'jsVariables>,
5252
~optimistic: option<bool>,
5353
) => Js.nullable<'jsData> = "readQuery"
5454

5555
// writeFragment<TData = any, TVariables = any>(options: Cache.WriteFragmentOptions<TData, TVariables>): Reference | undefined;
56-
@bs.send
56+
@send
5757
external writeFragment: (
5858
t<'tSerialized>,
5959
~options: DataProxy.WriteFragmentOptions.Js_.t<'jsData, 'jsVariables>,
6060
) => option<reference> = "writeFragment"
6161

6262
// writeQuery<TData = any, TVariables = any>(options: Cache.WriteQueryOptions<TData, TVariables>): Reference | undefined;
63-
@bs.send
63+
@send
6464
external writeQuery: (
6565
t<'tSerialized>,
6666
~options: DataProxy.WriteQueryOptions.Js_.t<'jsData, 'jsVariables>,
@@ -70,15 +70,15 @@ module ApolloCache = {
7070
type reference = Js_.reference
7171

7272
type t<'tSerialized> = {
73-
@bs.as("rescript_readFragment")
73+
@as("rescript_readFragment")
7474
readFragment: 'data. (
7575
~fragment: module(Fragment with type t = 'data),
7676
~id: string,
7777
~optimistic: bool=?,
7878
~fragmentName: string=?,
7979
unit,
8080
) => option<Types.parseResult<'data>>,
81-
@bs.as("rescript_readQuery")
81+
@as("rescript_readQuery")
8282
readQuery: 'data 'variables 'jsVariables. (
8383
~query: module(Operation with
8484
type t = 'data
@@ -90,7 +90,7 @@ module ApolloCache = {
9090
~optimistic: bool=?,
9191
'variables,
9292
) => option<Types.parseResult<'data>>,
93-
@bs.as("rescript_writeFragment")
93+
@as("rescript_writeFragment")
9494
writeFragment: 'data. (
9595
~fragment: module(Fragment with type t = 'data),
9696
~data: 'data,
@@ -99,7 +99,7 @@ module ApolloCache = {
9999
~fragmentName: string=?,
100100
unit,
101101
) => option<reference>,
102-
@bs.as("rescript_writeQuery")
102+
@as("rescript_writeQuery")
103103
writeQuery: 'data 'variables 'jsVariables. (
104104
~query: module(Operation with
105105
type t = 'data
@@ -115,7 +115,7 @@ module ApolloCache = {
115115
}
116116

117117
let preserveJsPropsAndContext: (Js_.t<'a>, t<'a>) => t<'a> = (js, t) =>
118-
%bs.raw(`
118+
%raw(`
119119
function (js, t) {
120120
return Object.assign(js, t)
121121
}

src/@apollo/client/cache/inmemory/ApolloClient__Cache_InMemory_InMemoryCache.res

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ module InMemoryCacheConfig = {
1212
// typePolicies?: TypePolicies;
1313
// }
1414
// NOTE: Using deriving abstract here because passing properties that are undefined has effects
15-
@bs.deriving(abstract)
15+
@deriving(abstract)
1616
type t = {
17-
@bs.optional
17+
@optional
1818
resultCaching: bool,
19-
@bs.optional
19+
@optional
2020
possibleTypes: PossibleTypesMap.Js_.t,
21-
@bs.optional
21+
@optional
2222
typePolicies: TypePolicies.Js_.t,
2323
// ...extends ApolloReducerConfig
24-
@bs.optional
24+
@optional
2525
dataIdFromObject: KeyFieldsFunction.Js_.t,
26-
@bs.optional
26+
@optional
2727
addTypename: bool,
2828
}
2929
}
@@ -67,7 +67,7 @@ module Js_ = {
6767
// }
6868
type t = ApolloCache.Js_.t<Js.Json.t>
6969

70-
@bs.module("@apollo/client") @bs.new
70+
@module("@apollo/client") @new
7171
external make: InMemoryCacheConfig.Js_.t => t = "InMemoryCache"
7272
}
7373

src/@apollo/client/cache/inmemory/ApolloClient__Cache_InMemory_Policies.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module KeyFieldsFunction = {
3939
}
4040

4141
// export declare const defaultDataIdFromObject: KeyFieldsFunction;
42-
@bs.module("@apollo/client")
42+
@module("@apollo/client")
4343
external defaultDataIdFromObject: KeyFieldsFunction.t = "defaultDataIdFromObject"
4444

4545
module TypePolicy = {

src/@apollo/client/cache/inmemory/ApolloClient__Cache_InMemory_Policies_FieldPolicy.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ module FieldFunctionOptions = {
4949
storage: Js.nullable<StorageType.Js_.t>,
5050
cache: ApolloCache.t<Js.Json.t>, // Non-Js_ ApolloCache is correct here
5151
}
52-
@bs.send external canRead: t => CanReadFunction.Js_.t = "canRead"
53-
@bs.send
52+
@send external canRead: t => CanReadFunction.Js_.t = "canRead"
53+
@send
5454
external mergeObjects: (t, ~existing: Js.Json.t, ~incoming: Js.Json.t) => option<Js.Json.t> =
5555
"canRead"
56-
@bs.send external readField: t => ReadFieldFunction.Js_.t = "readField"
57-
@bs.send
56+
@send external readField: t => ReadFieldFunction.Js_.t = "readField"
57+
@send
5858
external toReference: t => ToReferenceFunction.t = "toReference"
5959
}
6060

src/@apollo/client/cache/inmemory/ApolloClient__Cache_InMemory_ReactiveVars.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module ReactiveVar = {
77
}
88

99
module Js_ = {
10-
@bs.module("@apollo/client")
10+
@module("@apollo/client")
1111
external makeVar: 'value => ReactiveVar.Js_.t<'value> = "makeVar"
1212
}
1313

0 commit comments

Comments
 (0)