Skip to content

Commit 25d4a35

Browse files
committed
Updated NextJS to v.13
* Update next-transpile-modules to v.10 * Switch to @next/mdx * Adjust transpileModules * Remove child <a> tags of <link>
1 parent 2456665 commit 25d4a35

File tree

14 files changed

+3930
-1139
lines changed

14 files changed

+3930
-1139
lines changed

next.config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const remarkSlug = require("remark-slug");
66
const transpileModules = ["rescript"].concat(bsconfig["bs-dependencies"]);
77
const withTM = require("next-transpile-modules")(transpileModules);
88

9-
const withMdx = require("./plugins/next-mdx")({
9+
const withMdx = require("@next/mdx")({
1010
extension: /\.mdx?$/,
1111
options: {
1212
remarkPlugins: [remarkSlug],
@@ -61,4 +61,7 @@ const config = {
6161
},
6262
};
6363

64-
module.exports = withMdx(withTM(config));
64+
module.exports = withMdx({
65+
transpilePackages: transpileModules,
66+
...config,
67+
});

package-lock.json

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

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,25 @@
99
},
1010
"dependencies": {
1111
"@headlessui/react": "^1.2.0",
12-
"@mdx-js/loader": "^1.5.5",
12+
"@mdx-js/loader": "^1.6.22",
1313
"@next/mdx": "^8.1.0",
1414
"@rescript/react": "^0.10.3",
1515
"@ryyppy/rescript-promise": "2.1.0",
1616
"codemirror": "^5.54.0",
1717
"docson": "^2.1.0",
18+
"eslint-config-next": "^13.1.1",
1819
"fuse.js": "^6.4.3",
1920
"gentype": "^3.44.0",
2021
"glob": "^7.1.4",
2122
"gray-matter": "^4.0.2",
2223
"highlight.js": "^10.5.0",
2324
"lz-string": "^1.4.4",
24-
"next": "^12.3.4",
25+
"next": "^13.1.1",
2526
"next-transpile-modules": "^9.1.0",
2627
"postcss": "^8.3.0",
2728
"prettier": "^1.18.2",
28-
"react": "17.0.1",
29-
"react-dom": "17.0.1",
29+
"react": "^18.2.0",
30+
"react-dom": "^18.2.0",
3031
"remark-parse": "^7.0.1",
3132
"remark-slug": "^5.1.2",
3233
"remark-stringify": "^7.0.3",
@@ -42,9 +43,10 @@
4243
"update-index": "node scripts/extract-indices.mjs && node scripts/extract-tocs.mjs && node scripts/extract-syntax.mjs && node scripts/generate_feed.mjs > public/blog/feed.xml"
4344
},
4445
"devDependencies": {
46+
"@mdx-js/react": "^1.6.22",
4547
"autoprefixer": "^10.2.6",
4648
"cssnano": "^4.1.10",
47-
"esbuild-loader": "^2.13.1",
49+
"esbuild-loader": "^2.20.0",
4850
"postcss-cli": "^8.3.0",
4951
"reanalyze": "^2.16.0",
5052
"rescript": "^10.1.0-rc.4",

src/Blog.res

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -101,23 +101,22 @@ module BlogCard = {
101101
<Badge badge />
102102
</div>
103103
}}
104-
<Link href="/blog/[slug]" _as={"/blog/" ++ slug}>
105-
<a className="relative hl-title block mb-4 pt-9/16">
106-
{
107-
let className = "absolute top-0 h-full w-full object-cover"
108-
switch previewImg {
109-
| Some(src) => <img className src />
110-
| None => <img className src=defaultPreviewImg />
111-
}
104+
<Link
105+
href="/blog/[slug]"
106+
_as={"/blog/" ++ slug}
107+
className="relative hl-title block mb-4 pt-9/16">
108+
{
109+
let className = "absolute top-0 h-full w-full object-cover"
110+
switch previewImg {
111+
| Some(src) => <img className src />
112+
| None => <img className src=defaultPreviewImg />
112113
}
113-
</a>
114+
}
114115
</Link>
115116
</div>
116117
<div className="px-2">
117118
<Link href="/blog/[slug]" _as={"/blog/" ++ slug}>
118-
<a>
119-
<h2 className="hl-4"> {React.string(title)} </h2>
120-
</a>
119+
<h2 className="hl-4"> {React.string(title)} </h2>
121120
</Link>
122121
<div className="captions text-gray-40 pt-1">
123122
{switch category {
@@ -157,23 +156,21 @@ module FeatureCard = {
157156
~maxHeight="25.4375rem",
158157
(),
159158
)}>
160-
<Link href="/blog/[slug]" _as={"/blog/" ++ slug}>
161-
<a className="relative block pt-2/3">
162-
{switch badge {
163-
| Some(badge) =>
164-
<div className="absolute z-10 top-0 mt-10 ml-4 lg:-ml-4">
165-
<Badge badge />
166-
</div>
167-
| None => React.null
168-
}}
169-
{
170-
let className = "absolute top-0 h-full w-full object-cover"
171-
switch previewImg {
172-
| Some(src) => <img className src />
173-
| None => <img className src=defaultPreviewImg />
174-
}
159+
<Link href="/blog/[slug]" _as={"/blog/" ++ slug} className="relative block pt-2/3">
160+
{switch badge {
161+
| Some(badge) =>
162+
<div className="absolute z-10 top-0 mt-10 ml-4 lg:-ml-4">
163+
<Badge badge />
164+
</div>
165+
| None => React.null
166+
}}
167+
{
168+
let className = "absolute top-0 h-full w-full object-cover"
169+
switch previewImg {
170+
| Some(src) => <img className src />
171+
| None => <img className src=defaultPreviewImg />
175172
}
176-
</a>
173+
}
177174
</Link>
178175
</div>
179176
<div
@@ -206,9 +203,7 @@ module FeatureCard = {
206203
</div>
207204
</div>
208205
<Link href="/blog/[slug]" _as={"/blog/" ++ slug}>
209-
<a>
210-
<Button> {React.string("Read Article")} </Button>
211-
</a>
206+
<Button> {React.string("Read Article")} </Button>
212207
</Link>
213208
</div>
214209
</section>

src/BlogArticle.res

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,9 @@ let default = (props: props) => {
187187
<div className="text-24 sm:text-32 text-center text-gray-80 font-medium">
188188
{React.string("Want to read more?")}
189189
</div>
190-
<Next.Link href="/blog">
191-
<a className="text-fire hover:text-fire-70">
192-
{React.string("Back to Overview")}
193-
<Icon.ArrowRight className="ml-2 inline-block" />
194-
</a>
190+
<Next.Link href="/blog" className="text-fire hover:text-fire-70">
191+
{React.string("Back to Overview")}
192+
<Icon.ArrowRight className="ml-2 inline-block" />
195193
</Next.Link>
196194
</div>
197195
</div>

src/Packages.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,12 @@ module InfoSidebar = {
306306
<div>
307307
<h2 className=h2> {React.string("Guidelines")} </h2>
308308
<ul className="space-y-4">
309-
<Next.Link href="/docs/guidelines/publishing-packages">
310-
<a className=link> {React.string("Publishing ReScript npm packages")} </a>
309+
<Next.Link href="/docs/guidelines/publishing-packages" className=link>
310+
{React.string("Publishing ReScript npm packages")}
311311
</Next.Link>
312312
/* <li> */
313-
/* <Next.Link href="/docs/guidelines/writing-bindings"> */
314-
/* <a className=link> {React.string("Writing Bindings & Libraries")} </a> */
313+
/* <Next.Link href="/docs/guidelines/writing-bindings" className=link> */
314+
/* {React.string("Writing Bindings & Libraries")} */
315315
/* </Next.Link> */
316316
/* </li> */
317317
</ul>

src/bindings/Next.res

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ module Link = {
6161
~shallow: option<bool>=?,
6262
~passHref: option<bool>=?,
6363
~children: React.element,
64+
~className: option<string>=?,
65+
~target: string=?,
66+
~hrefRel: string=?,
6467
) => React.element = "default"
6568
}
6669

src/bindings/Next.resi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ module Link: {
6161
~shallow: option<bool>=?,
6262
~passHref: option<bool>=?,
6363
~children: React.element,
64+
~className: option<string>=?,
65+
~target: string=?,
66+
~hrefRel: string=?,
6467
) => React.element
6568
}
6669

src/components/CodeExample.res

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,12 @@ module Toggle = {
230230
| Some({code: ""}) => React.null
231231
| Some(tab) =>
232232
let playgroundLinkButton =
233-
<Next.Link href={`/try?code=${LzString.compressToEncodedURIComponent(tab.code)}}`}>
234-
<a target="_blank">
235-
// ICON Link to PLAYGROUND
236-
<Icon.ExternalLink
237-
className="text-gray-30 mt-px hover:cursor-pointer hover:text-gray-60 hover:bg-gray-30 w-6 h-6 p-1 rounded transition-all duration-300 ease-in-out"
238-
/>
239-
</a>
233+
<Next.Link
234+
href={`/try?code=${LzString.compressToEncodedURIComponent(tab.code)}}`} target="_blank">
235+
// ICON Link to PLAYGROUND
236+
<Icon.ExternalLink
237+
className="text-gray-30 mt-px hover:cursor-pointer hover:text-gray-60 hover:bg-gray-30 w-6 h-6 p-1 rounded transition-all duration-300 ease-in-out"
238+
/>
240239
</Next.Link>
241240

242241
let copyButton = <CopyButton code={tab.code} />

src/components/Footer.res

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ let make = () => {
4646
<Section title="About">
4747
<ul className="text-16 text-gray-80-tr space-y-2">
4848
<li>
49-
<Next.Link href="/community#core-team">
50-
<a className={linkClass}> {React.string("Team")} </a>
49+
<Next.Link href="/community#core-team" className={linkClass}>
50+
{React.string("Team")}
5151
</Next.Link>
5252
</li>
5353
<li>

0 commit comments

Comments
 (0)