Skip to content

Commit 2b798d5

Browse files
Update rescript + webapi and do a npm cleanup (#1083)
* Update rescript + webapi and do a npm cleanup * Scripts are not just dev
1 parent 72bac16 commit 2b798d5

File tree

13 files changed

+57
-85
lines changed

13 files changed

+57
-85
lines changed

next.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const bsconfig = JSON.parse(
1717

1818
const { ProvidePlugin } = webpack;
1919

20-
const transpileModules = ["rescript"].concat(bsconfig["bs-dependencies"]);
20+
const transpileModules = ["rescript"].concat(bsconfig["dependencies"]);
2121

2222
/** @type {import("next").NextConfig} */
2323
const config = {

package-lock.json

Lines changed: 35 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@
1616
"@headlessui/react": "^2.2.4",
1717
"@mdx-js/loader": "^3.1.0",
1818
"@rescript/react": "^0.14.0-rc.1",
19-
"@rescript/webapi": "^0.1.0-experimental-03eae8b",
19+
"@rescript/webapi": "^0.1.0-experimental-0b87498",
2020
"codemirror": "^5.54.0",
2121
"docson": "^2.1.0",
2222
"escodegen": "^2.1.0",
2323
"eslint-config-next": "^13.1.1",
2424
"fuse.js": "^6.4.3",
25-
"gentype": "^3.44.0",
2625
"glob": "^7.1.4",
2726
"highlight.js": "^11.9.0",
2827
"highlightjs-rescript": "^0.2.2",
@@ -42,7 +41,7 @@
4241
"remark-rehype": "^11.1.1",
4342
"remark-stringify": "^11.0.0",
4443
"request": "^2.88.0",
45-
"rescript": "^12.0.0-alpha.14",
44+
"rescript": "^12.0.0-beta.6",
4645
"stringify-object": "^3.3.0",
4746
"unified": "^11.0.5",
4847
"vfile-matter": "^5.0.0"

rescript.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@
44
"jsx": {
55
"version": 4
66
},
7-
"bs-dependencies": ["@rescript/react", "@rescript/webapi"],
8-
"bsc-flags": ["-open WebAPI.Global"],
7+
"dependencies": ["@rescript/react", "@rescript/webapi"],
8+
"compiler-flags": ["-open WebAPI.Global"],
99
"sources": [
1010
{
1111
"dir": "src",
1212
"subdirs": true
1313
},
1414
{
1515
"dir": "scripts",
16-
"subdirs": true,
17-
"type": "dev"
16+
"subdirs": true
1817
}
1918
],
2019
"package-specs": {

scripts/gendocs.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ node scripts/gendocs.mjs path/to/rescript-compiler latest true
1818
open Node
1919
module Docgen = RescriptTools.Docgen
2020

21-
let args = Process.argv->Array.sliceToEnd(~start=2)
21+
let args = Process.argv->Array.slice(~start=2)
2222
let dirname =
2323
url
2424
->URL.fileURLToPath

src/ApiDocs.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ module DocstringsStylize = {
290290
[Rehype.WithOptions([Plugin(Rehype.slug), SlugOption({prefix: slugPrefix ++ "-"})])]->Some
291291

292292
let content = switch docstrings->Array.length > 1 {
293-
| true => docstrings->Array.sliceToEnd(~start=1)
293+
| true => docstrings->Array.slice(~start=1)
294294
| false => docstrings
295295
}->Array.join("\n")
296296

src/Blog.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ let default = (props: props): React.element => {
218218
| 0 => <div> {React.string("No posts for this category available...")} </div>
219219
| _ =>
220220
let first = Belt.Array.getExn(posts, 0)
221-
let rest = Array.sliceToEnd(posts, ~start=1)
221+
let rest = Array.slice(posts, ~start=1)
222222

223223
let featureBox =
224224
<div className="w-full mb-24 lg:px-8 xl:px-0">

src/Playground.res

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,10 +1478,6 @@ let make = (~versions: array<string>) => {
14781478
(),
14791479
)
14801480

1481-
let overlayState = React.useState(() => false)
1482-
1483-
let windowWidth = CodeMirror.useWindowWidth()
1484-
14851481
let (keyMap, setKeyMap) = React.useState(() => {
14861482
Dom.Storage2.localStorage
14871483
->Dom.Storage2.getItem("vimMode")

src/common/CompilerManagerHook.res

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ let wrapReactApp = code =>
148148

149149
let capitalizeFirstLetter = string => {
150150
let firstLetter = string->String.charAt(0)->String.toUpperCase
151-
`${firstLetter}${string->String.sliceToEnd(~start=1)}`
151+
`${firstLetter}${string->String.slice(~start=1)}`
152152
}
153153

154154
type error =
@@ -548,11 +548,11 @@ let useCompilerManager = (
548548
let ast = Parser.parse(jsCode, {sourceType: "module"})
549549
let {entryPointExists, code, imports} = PlaygroundValidator.validate(ast)
550550
let imports = imports->Dict.mapValues(path => {
551-
let filename = path->String.sliceToEnd(~start=9) // the part after "./stdlib/"
551+
let filename = path->String.slice(~start=9) // the part after "./stdlib/"
552552
let filename = switch state.selected.id {
553553
| {major: 12, minor: 0, patch: 0, preRelease: Some(Alpha(alpha))} if alpha < 8 =>
554554
let filename = if filename->String.startsWith("core__") {
555-
filename->String.sliceToEnd(~start=6)
555+
filename->String.slice(~start=6)
556556
} else {
557557
filename
558558
}

src/common/MetaTagsApi.res

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,9 @@ let extractMetaTags = async (url: string) => {
2727
}
2828

2929
let metaTags = elements->Array.reduce(Dict.fromArray([]), (tags, meta) => {
30-
let name =
31-
meta
32-
->WebAPI.Element.getAttribute("name")
33-
->Null.make
34-
let property =
35-
meta
36-
->WebAPI.Element.getAttribute("property")
37-
->Null.make
38-
let itemprop =
39-
meta
40-
->WebAPI.Element.getAttribute("itemprop")
41-
->Null.make
30+
let name = meta->WebAPI.Element.getAttribute("name")
31+
let property = meta->WebAPI.Element.getAttribute("property")
32+
let itemprop = meta->WebAPI.Element.getAttribute("itemprop")
4233

4334
let name = switch (name, property, itemprop) {
4435
| (Value(name), _, _) => Some(name)
@@ -47,14 +38,10 @@ let extractMetaTags = async (url: string) => {
4738
| _ => None
4839
}
4940

50-
let content =
51-
meta
52-
->WebAPI.Element.getAttribute("content")
53-
->Nullable.make
54-
->Nullable.toOption
41+
let content = meta->WebAPI.Element.getAttribute("content")
5542

5643
switch (name, content) {
57-
| (Some(name), Some(content)) => tags->Dict.set(name, content)
44+
| (Some(name), Value(content)) => tags->Dict.set(name, content)
5845
| _ => ()
5946
}
6047

0 commit comments

Comments
 (0)