Skip to content

Commit 2c03999

Browse files
Open ReScript Core by default (#871)
1 parent 87673cb commit 2c03999

File tree

13 files changed

+44
-45
lines changed

13 files changed

+44
-45
lines changed

rescript.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
],
1212
"uncurried": true,
1313
"ppx-flags": [],
14-
"bsc-flags": [],
14+
"bsc-flags": [
15+
"-open RescriptCore"
16+
],
1517
"sources": [
1618
{
1719
"dir": "src",

src/Blog.res

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
*/
1515

1616
module Link = Next.Link
17-
open RescriptCore
1817

1918
let defaultPreviewImg = "/static/Art-3-rescript-launch.jpg"
2019

src/BlogArticle.res

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
builds are taking too long. I think we will be fine for now.
1717
Link to NextJS discussion: https://github.com/zeit/next.js/discussions/11728#discussioncomment-3501
1818
*/
19-
open RescriptCore
2019

2120
let middleDotSpacer = " " ++ (String.fromCharCode(183) ++ " ")
2221

src/Design.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// NOTE: This file will later be important to document our
22
// design tokens etc.
3-
open RescriptCore
3+
44
module ColorSquare = {
55
@react.component
66
let make = (~className="") => {

src/DocsOverview.res

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
open RescriptCore
21
module Card = {
32
@react.component
43
let make = (~title: string, ~hrefs: array<(string, string)>) => {

src/SyntaxLookup.res

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ module Status = {
5555

5656
let compare = (a, b) =>
5757
switch (a, b) {
58-
| (Deprecated, Deprecated) | (Active, Active) => 0
59-
| (Active, Deprecated) => -1
60-
| (Deprecated, Active) => 1
58+
| (Deprecated, Deprecated) | (Active, Active) => Ordering.equal
59+
| (Active, Deprecated) => Ordering.less
60+
| (Deprecated, Active) => Ordering.greater
6161
}
6262
}
6363

@@ -76,7 +76,7 @@ module Item = {
7676

7777
let compare = (a, b) =>
7878
switch Status.compare(a.status, b.status) {
79-
| 0 => String.compare(a.name, b.name)
79+
| 0. => String.compare(a.name, b.name)
8080
| x => x
8181
}
8282
}
@@ -299,15 +299,15 @@ let default = (props: props) => {
299299
})
300300
})
301301
->Js.Dict.entries
302-
->Belt.Array.reduce([], (acc, entry) => {
302+
->Array.reduce([], (acc, entry) => {
303303
let (title, items) = entry
304-
if Js.Array.length(items) === 0 {
304+
if Array.length(items) === 0 {
305305
acc
306306
} else {
307307
let children =
308308
items
309-
->Belt.SortArray.stableSortBy(Item.compare)
310-
->Belt.Array.map(item => {
309+
->Array.toSorted(Item.compare)
310+
->Array.map(item => {
311311
let onMouseDown = evt => {
312312
ReactEvent.Mouse.preventDefault(evt)
313313
onSearchValueChange(item.name)

src/bindings/RescriptCompilerApi.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ module LocMsg = {
128128
let result = Js.Dict.empty()
129129

130130
for i in 0 to Js.Array.length(arr) - 1 {
131-
let locMsg = Js.Array2.unsafe_get(arr, i)
131+
let locMsg = Array.getUnsafe(arr, i)
132132
let id = makeId(locMsg)
133133

134134
// The last element with the same id wins

src/common/Ansi.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ module Lexer = {
182182
switch x {
183183
| Some(result) =>
184184
let groups = Js.Re.captures(result)
185-
switch Js.Nullable.toOption(groups[1]) {
185+
switch groups[1]->Option.flatMap(o => o->Js.Nullable.toOption) {
186186
| Some(str) =>
187187
switch Js.String2.split(str, ";") {
188188
| ["0"] => ClearSgr({loc, raw})

src/common/BlogApi.res

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ let getAllPosts = () => {
7676
}
7777
})
7878

79-
Js.Array2.concat(nonArchivedPosts, archivedPosts)->Js.Array2.sortInPlaceWith((a, b) => {
79+
Array.concat(nonArchivedPosts, archivedPosts)->Array.toSorted((a, b) =>
8080
String.compare(Node.Path.basename(b.path), Node.Path.basename(a.path))
81-
})
81+
)
8282
}
8383

8484
let getLivePosts = () => {
@@ -97,9 +97,9 @@ let getLivePosts = () => {
9797
}
9898
})
9999

100-
livePosts->Js.Array2.sortInPlaceWith((a, b) => {
100+
livePosts->Array.toSorted((a, b) =>
101101
String.compare(Node.Path.basename(b.path), Node.Path.basename(a.path))
102-
})
102+
)
103103
}
104104

105105
let getArchivedPosts = () => {
@@ -119,9 +119,9 @@ let getArchivedPosts = () => {
119119
}
120120
})
121121

122-
archivedPosts->Js.Array2.sortInPlaceWith((a, b) => {
122+
archivedPosts->Array.toSorted((a, b) =>
123123
String.compare(Node.Path.basename(b.path), Node.Path.basename(a.path))
124-
})
124+
)
125125
}
126126

127127
module RssFeed = {
@@ -156,7 +156,7 @@ module RssFeed = {
156156
let getLatest = (~max=10, ~baseUrl="https://rescript-lang.org", ()): array<item> => {
157157
let items =
158158
getAllPosts()
159-
->Js.Array2.map(post => {
159+
->Array.map(post => {
160160
let fm = post.frontmatter
161161
let description = Js.Null.toOption(fm.description)->Belt.Option.getWithDefault("")
162162
{
@@ -166,7 +166,7 @@ module RssFeed = {
166166
pubDate: DateStr.toDate(fm.date),
167167
}
168168
})
169-
->Js.Array2.slice(~start=0, ~end_=max)
169+
->Array.slice(~start=0, ~end=max)
170170
items
171171
}
172172

src/common/Url.res

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ let parse = (route: string): t => {
6464
(NoVersion, fullpath, [])
6565
} else {
6666
let version = switch fullpath[foundVersionIndex] {
67-
| "latest" => Latest
68-
| v => Version(v)
67+
| Some("latest") => Latest
68+
| Some(v) => Version(v)
69+
| None => NoVersion
6970
}
7071
(
7172
version,

0 commit comments

Comments
 (0)