Skip to content

Upgrade to NextJS 13 / MDX v2 / Tailwindcss v3 (Cont #645) #705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
2456665
- Update Next.js to version 12
JiaeK Jan 4, 2023
24f612b
Merge branch 'rescript-association:master' into nextjs-12
JiaeK Jan 27, 2023
25d4a35
Updated NextJS to v.13
JiaeK Jan 27, 2023
5334930
Merge branch 'nextjs-12' of https://github.com/JiaeK/rescript-lang.or…
JiaeK Jan 27, 2023
90baa7a
Revert "Merge branch 'nextjs-12' of https://github.com/JiaeK/rescript…
JiaeK Jan 27, 2023
89c8df1
update
aspeddro Jul 30, 2023
66f65ad
update
aspeddro Jul 31, 2023
6929ff4
remove next-transpile-modules
aspeddro Jul 31, 2023
942f2c1
rm postcss
aspeddro Jul 31, 2023
20ad53b
back to html comments
aspeddro Jul 31, 2023
ae6de65
rm .md extension
aspeddro Jul 31, 2023
6fbe8ad
cleanup
aspeddro Jul 31, 2023
2add1d8
format
aspeddro Jul 31, 2023
0e1db89
fix next build
aspeddro Aug 2, 2023
59c00c4
comment extract-tocs for v9
aspeddro Aug 2, 2023
29a2d4b
move v9 docs to pages
aspeddro Aug 2, 2023
08b2e9f
remove v9 from gitignore
aspeddro Aug 2, 2023
be12e8f
Merge branch 'master' into nextjs-13-cont-aspeddro
aspeddro Aug 2, 2023
9cf8fa0
move page: mirate-from-v3 to migrate-react
aspeddro Aug 2, 2023
35c1ba2
update sidebar react section
aspeddro Aug 2, 2023
083f0c7
update rescript to 10.1.4
aspeddro Aug 2, 2023
6bff459
fix |
aspeddro Aug 2, 2023
001ee75
fix |
aspeddro Aug 3, 2023
1a7c319
remove expiremental next.config
aspeddro Aug 3, 2023
4d5d455
restore migrate-react pages
aspeddro Aug 3, 2023
4bb9028
remove import json
aspeddro Aug 3, 2023
e6c88d4
update packge-lock.json
aspeddro Aug 3, 2023
d0039ef
refactor
aspeddro Aug 3, 2023
985fcfe
remove mdx-loader and next-mdx plugins
aspeddro Aug 3, 2023
2414d21
fix parse block code
aspeddro Aug 3, 2023
f7d4b72
fix code block docs overview
aspeddro Aug 3, 2023
e9d378d
uncomment import-from-export-to-js.mdx
aspeddro Aug 3, 2023
90addb4
reduce diff
aspeddro Aug 3, 2023
346bc7f
reduce diff
aspeddro Aug 3, 2023
f334a26
reduce diff
aspeddro Aug 3, 2023
da593d5
remove docs from pages dir
aspeddro Sep 6, 2023
5ec844a
Merge branch 'master' into nextjs-13-cont-aspeddro
aspeddro Sep 6, 2023
ddecb9e
update extract scripts
aspeddro Sep 19, 2023
9817e43
Merge branch 'master' into nextjs-13-cont-aspeddro
aspeddro Oct 4, 2023
cd3d103
test
aspeddro Oct 4, 2023
b7efb67
adjusts
aspeddro Oct 5, 2023
ec4d44b
add pages
aspeddro Oct 5, 2023
66405ec
fix hrefs
aspeddro Oct 7, 2023
309591a
Merge branch 'master' into nextjs-13-cont-aspeddro
aspeddro Oct 7, 2023
aa16d91
cleanup
aspeddro Oct 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 0 additions & 7 deletions .babelrc

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ _tempFile.cmj
_tempFile.cmt

# these docs are checked in, but we consider them frozen.
pages/docs/manual/v8.0.0/
pages/docs/manual/v9.0.0/
# pages/docs/manual/v8.0.0/
# pages/docs/manual/v9.0.0/

.bsb.lock
.merlin
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ If you need inspiration on what to work on, you can check out issues tagged with

We really appreciate all input from users, community members and potential contributors. Please make sure to consider the other person's opinion and don't assume any common knowledge.

**Most importantly: Keep it professional and be nice to each other**
**Most importantly: Keep it professional and be nice to eachother**

There might be situations where others don't understand a proposed feature or have different opinions on certain writing styles. That's fine, discussions are always welcome! Communicate in clear actionables, make your plans clear and always stick to the original topic.
There might be situations where others don't understand a proposed feature or have different opinions on certain writing styles. That's fine, discussions are always welcome! Communicate in clear actionables, make your plans clear and always to stick to the original topic.

If other contributors disagree with certain proposals and don't change their mind after longer discussions, please don't get discouraged when an issue gets closed / postponed. Everyone tries their best to make the platform better, and to look at it in another perspective: Closed issues are also a highly valuable resource for others to understand technical decisions later on.

### Communicate your Time Commitment

Open Source development can be a challenge to coordinate, so please make sure to block enough time to work on your tasks and show commitment when taking on some work. Let other contributors know if your time schedule changes significantly, and also let others know if you can't finish a task.

We value your voluntary work, and of course it's fine to step back from a ticket for any reason (we can also help you if you are getting stuck). Please talk to us in any case, otherwise we might re-assign the ticket to other contributors.
We value your voluntary work, and of course it's fine to step back from a ticket for any reasons (we can also help you if you are getting stuck). Please talk to us in any case, otherwise we might re-assign the ticket to other contributors.

### Communication Channels

Expand All @@ -66,7 +66,7 @@ Always check if there are any designs for certain UI components and think about
### Technical Writing (Documentation)

- Think and write in a JS friendly mindset when explaining concepts / showing examples.
- No `foo` examples if somewhat possible. Try to establish practical context in your showcase examples.
- No `foo` examples if somewhat possible. Try to establish practical context in your show case examples.
- No references to `OCaml`. ReScript is its own language, and we don't rely on external resources of our host language.
- If possible, no references to `Reason` examples / external resources. Our goal is to migrate everything to ReScript syntax.

Expand Down
2 changes: 1 addition & 1 deletion _blogposts/2020-09-25-release-8-3-2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ There are two ways of removing staled artifacts, the second one is introduced in

- Based on live analysis and prebuilt-in knowledge

We scan `lib/bs` directory and check some dangling cm{i,t,j,ti} files, if it does not exist in
We scan `lib/bs` directory and check some dangling `cm{i,t,j,ti}` files, if it does not exist in
the current build set, it is considered stale artifacts. If it is `cmt` file, it would trigger some hooks of `genType`, notably -cmt-rm.

- Based on previous build logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ A detailed list of changes are listed as below:
- #1658, fix typeof = "null" issue
- #1656, bs.get/set/get_index/set_index respects bs.ignore
- #1654, `bsb -init` fails if package or current dir has space (parent dir can have spaces)
- #1678, bs.get{null;undefined} in object type
- #1678, `bs.get{null;undefined}` in object type
- #1692, fix invalid js syntax output
- #1701, fix tailcall handling interaction with exception handler
- #1666, fix misue of GADT api
Expand Down
7 changes: 6 additions & 1 deletion pages/brand.mdx → community/brand.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
title: "Brand Assets"
description: "ReScript Logo"
canonical: "/community/brand"
---

# Brand Assets

## Logo
Expand Down Expand Up @@ -25,4 +31,3 @@
[white.svg](/static/brand/rescript-logo-white.svg) | [white.png](/static/brand/rescript-logo-white.png) | [red.svg](/static/brand/rescript-logo.svg) | [red.png](/static/brand/rescript-logo.png)

</div>

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion data/sidebar_community.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"overview",
"roadmap",
"code-of-conduct",
"translations"
"translations",
"brand"
]
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: "Guidelines on publishing ReScript bindings and libraries to our Pa
canonical: "/guidelines/publishing-npm-packages"
---

[<-- Back to packages](../../packages)
[\<-- Back to packages](../../packages)

## Publishing ReScript Libraries / Bindings

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Collection functions for manipulating the `list` data structures, a singly-linke

</Intro>

## t<'a>
## t\<'a>

```res prelude
type t<'a> = list<'a>
Expand All @@ -36,7 +36,7 @@ Belt.List.length(list{1, 2, 3}) // 3
let size: t<'a> => int
```

**See:** list{length}(#length)
**See:** list\{length}(#length)

## head

Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions docs/manual/latest/build-configuration-schema.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: "Configuration Schema"
metaTitle: "Build System Configuration Schema"
description: "Schema exploration widget for the ReScript configuration file"
canonical: "/docs/manual/latest/build-configuration-schema"
---
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ We've stress-tested `rescript.exe` on a big project of 10,000 files (2 directori
<!-- TODO: better repro -->

- No-op build of 10k files: `800ms` (the minimum amount of time required to check the mtimes of 10k files).
- Clean build: <3 minutes.
- Clean build: \<3 minutes.
- Incremental build: depends on the number of the dependents of the file. No dependent means `1s`.

### Stability
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ However, if you want to more rigidly bind to the JavaScript library you want, ke

## Performance & Output Readability

`external`s declarations are inlined into their callers during compilation, **and completely disappear from the JS output**. This means any time you use one, you can be sure that you're not incurring extra JavaScript <-> ReScript conversion cost.
`external`s declarations are inlined into their callers during compilation, **and completely disappear from the JS output**. This means any time you use one, you can be sure that you're not incurring extra JavaScript \<-> ReScript conversion cost.

Additionally, no extra ReScript-specific runtime is better for output readability.

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ switch fruitFromJs(100) {

### More Safety

Similar to the JS object <-> record deriving, you can hide the fact that the JS enum are ints by using the same `newType` option with `@deriving(jsConverter)`:
Similar to the JS object \<-> record deriving, you can hide the fact that the JS enum are ints by using the same `newType` option with `@deriving(jsConverter)`:

```res
@deriving({jsConverter: newType})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ canonical: "/docs/manual/latest/import-from-export-to-js"

You've seen how ReScript's idiomatic [Import & Export](import-export.md) works. This section describes how we work with importing stuff from JavaScript and exporting stuff for JavaScript consumption.

**Note**: due to JS ecosystem's module compatibility issues, our advice of keeping your ReScript file's compiled JS output open in a tab applies here **more than ever**, as you don't want to subtly output the wrong JS module import/export code, on top of having to deal with Babel/Webpack/Jest/Node's CommonJS<->ES6 compatibility shims.
**Note**: due to JS ecosystem's module compatibility issues, our advice of keeping your ReScript file's compiled JS output open in a tab applies here **more than ever**, as you don't want to subtly output the wrong JS module import/export code, on top of having to deal with Babel/Webpack/Jest/Node's CommonJS \<-> ES6 compatibility shims.

In short: **make sure your bindings below output what you'd have manually written in JS**.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This is a glossary with examples. All the features are described by later pages.

## List of Decorators

> **Note:** In ReScript <8.3, all our attributes started with the `bs.` prefix. This is no longer needed and our formatter automatically removes them in newer ReScript versions.
> **Note:** In ReScript < 8.3, all our attributes started with the `bs.` prefix. This is no longer needed and our formatter automatically removes them in newer ReScript versions.

<!-- Synced from https://github.com/rescript-lang/syntax/blob/123760c5a264da5288eeee5213ddd25eb86d62fe/src/res_printer.ml#L19-L51 -->

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let message = {
let part2 = "world"
part1 ++ " " ++ part2
}
// `part1` and `part2` are not accessible here!
// `part1` and `part2` not accessible here!
```
```js
var message = "hello world";
Expand Down Expand Up @@ -72,7 +72,7 @@ Let bindings are "immutable", aka "cannot change". This helps our type system de

## Binding Shadowing

The above restriction might sound impractical at first. How would you change a value then? Usually, 2 ways:
The above restriction might sound unpractical at first. How would you change a value then? Usually, 2 ways:

The first is to realize that many times, what you want isn't to mutate a variable's value. For example, this JavaScript pattern:

Expand Down Expand Up @@ -181,5 +181,5 @@ Still, `%%private` is useful in the following scenarios:

- **Code generators.** Some code generators want to hide some values but it is sometimes very hard or time consuming for code generators to synthesize the types for public fields.

- **Quick prototyping.** During prototyping, we still want to hide some values, but the interface file is not stable yet, `%%private` provides you such convenience.
- **Quick prototyping.** During prototyping, we still want to hide some values, but the interface file is not stable yet, `%%private` provide you such convenience.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Enjoy the improved experience!

### Upgrade Individual Folders

This is useful for per-directory conversions:
This is useful for per-directory convertions:

```console
# *.rei, *.ml, *.mli,....
Expand Down Expand Up @@ -56,7 +56,7 @@ npx rescript convert -all
- First class module: from `(module S: Student)` to `module(S: Student)`.
- No custom infix operator for now (including `mod`).
- Object access: from `settings##visible #= true` to `settings["visible"] = true`. Rejoice!
- Object: from `Js.t({"age": int})` to just `{"age": int}`. The `Js.t` part is now unneeded.
- Object: from `Js.t({"age": int})` to just `{"age": int}`. The `Js.t` part is now uneeded.
- Attribute: from `[@myAttribute "hello"]` to `@myAttribute("hello")`. From `[%re bla]` to `%re(bla)`.
- Removed dereference syntax `result^`. Just use `result.contents`.
- `fun` pattern matching syntax removed.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,28 @@ canonical: "/docs/manual/latest/overview"
<thead>
<tr>
<th>JavaScript</th>
<th>ReScript </th>
<th>ReScript</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<pre><code>{`const myFun = (x, y) => {
const doubleX = x + x;
const doubleY = y + y;
return doubleX + doubleY
};`}</code></pre>
```
const myFun = (x, y) => {
const doubleX = x + x;
const doubleY = y + y;
return doubleX + doubleY
};
```
</td>
<td>
<pre><code>{`let myFun = (x, y) => {
let doubleX = x + x
let doubleY = y + y
doubleX + doubleY
}`}</code></pre>
```
let myFun = (x, y) => {
let doubleX = x + x
let doubleY = y + y
doubleX + doubleY
}
```
</td>
</tr>
</tbody>
Expand All @@ -154,7 +158,7 @@ canonical: "/docs/manual/latest/overview"
| JavaScript | ReScript |
| ----------------------------- | --------------------------------------------- |
| `const {a, b} = data` | `let {a, b} = data` |
| `const [a, b] = data` | <code>let [a, b] = data</code> \* |
| `const [a, b] = data` | `let [a, b] = data` \* |
| `const {a: aa, b: bb} = data` | `let {a: aa, b: bb} = data` |

\* Gives good compiler warning that `data` might not be of length 2.
Expand Down Expand Up @@ -183,7 +187,7 @@ canonical: "/docs/manual/latest/overview"
| JavaScript | ReScript |
| ----------------------------------------------- | ------------------------------------------ |
| `throw new SomeError(...)` | `raise(SomeError(...))` |
| `try {a} catch (Err) {...} finally {...}` | <code>try a catch { &#124; Err => ...}</code> \* |
| `try {a} catch (Err) {...} finally {...}` | `try a catch { \| Err => ...}` \* |

\* No finally.

Expand All @@ -201,18 +205,22 @@ The last expression of a block delimited by `{}` implicitly returns (including f
<tbody>
<tr>
<td>
<pre><code>{`let result = (function() {
const x = 23;
const y = 34;
return x + y;
})();`}</code></pre>
```
let result = (function() {
const x = 23;
const y = 34;
return x + y;
})();
```
</td>
<td>
<pre><code>{`let result = {
let x = 23
let y = 34
x + y
}`}</code></pre>
```
let result = {
let x = 23
let y = 34
x + y
}
```
</td>
</tr>
</tbody>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ ReScript's `true/false` compiles into a JavaScript `true/false`.

32-bits, truncated when necessary. We provide the usual operations on them: `+`, `-`, `*`, `/`, etc. See [Js.Int](api/js/int) for helper functions.

**Be careful when you bind to JavaScript numbers!** Since ReScript integers have a much smaller range than JavaScript numbers, data might get lost when dealing with large numbers. In those cases, it’s much safer to bind the numbers as **floats**. Be extra mindful of this when binding to JavaScript Dates and their epoch time.
**Be careful when you bind to JavaScript numbers!** Since ReScript integers have a much smaller range than JavaScript numbers, data might get lost when dealing with large numbers. In those cases it’s much safer to bind the numbers as **float**. Be extra mindful of this when binding to JavaScript Dates and their epoch time.

To improve readability, you may place underscores in the middle of numeric literals such as `1_000_000`. Note that underscores can be placed anywhere within a number, not just every three digits.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ canonical: "/docs/manual/latest/type"
Types are the highlight of ReScript! They are:
- **Strong**. A type can't change into another type. In JavaScript, your variable's type might change when the code runs (aka at runtime). E.g. a `number` variable might change into a `string` sometimes. This is an anti-feature; it makes the code much harder to understand when reading or debugging.
- **Static**. ReScript types are erased after compilation and don't exist at runtime. Never worry about your types dragging down performance. You don't need type info during runtime; we report all the information (especially all the type errors) during compile time. Catch the bugs earlier!
- **Sound**. This is our biggest differentiator versus many other typed languages that compile to JavaScript. Our type system is guaranteed to **never** be wrong. Most type systems make a guess at the type of a value and show you a type in your editor that's sometimes incorrect. We don't do that. We believe that a type system that is sometimes incorrect can end up dangerous due to expectation mismatches.
- **Sound**. This is our biggest differentiator versus many other typed languages that compile to JavaScript. Our type system is guaranteed to **never** be wrong. Most type systems make a guess at the type of a value and show you a type in your editor that's sometime incorrect. We don't do that. We believe that a type system that is sometime incorrect can end up being dangerous due to expectation mismatches.
- **Fast**. Many developers underestimate how much of their project's build time goes into type checking. Our type checker is one of the fastest around.
- **Inferred**. You don't have to write down the types! ReScript can deduce them from their values. Yes, it might seem magical that we can deduce all of your program's types, without incorrectness, without your manual annotation, and do so quickly. Welcome to ReScript =).

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ description: "Available compiler warning numbers in ReScript"
canonical: "/docs/manual/latest/warning-numbers"
---

import { make as WarningTable } from "src/components/WarningTable.mjs";

# Warning Numbers

You can configure which warnings the ReScript compiler generates
[in the build configuration](/docs/manual/latest/build-configuration#warnings) or
using the [`@warning()`](/syntax-lookup#expression-warning-decorator) or the [`@@warning()`](/syntax-lookup#module-warning-decorator) decorator.

<WarningTable />
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ We've stress-tested bsb on a big project of 10,000 files (2 directories, 5000 fi
<!-- TODO: better repro -->

- No-op build of 10k files: `800ms` (the minimum amount of time required to check the mtimes of 10k files).
- Clean build: <3 minutes.
- Clean build: \<3 minutes.
- Incremental build: depends on the number of the dependents of the file. No dependent means `1s`.

Note that bsb is a file-based build system. We don't do in-memory build, even if that speeds up the build a lot. In-memory builds risk memory leaks, out-of-memory errors and others. The bsb watcher, on the other hand, can stay open for days.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ However, if you want to more rigidly bind to the JavaScript library you want, ke

## Performance & Output Readability

`external`s declarations are inlined into their callers during compilation, **and completely disappear from the JS output**. This means any time you use one, you can be sure that you're not incurring extra JavaScript <-> ReScript conversion cost.
`external`s declarations are inlined into their callers during compilation, **and completely disappear from the JS output**. This means any time you use one, you can be sure that you're not incurring extra JavaScript \<-> ReScript conversion cost.

Additionally, no extra ReScript-specific runtime is better for output readability.

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ match fruitFromJs 100 with

### More Safety

Similar to the JS object <-> record deriving, you can hide the fact that the JS enum are ints by using the same `newType` option with `[@bs.deriving jsConverter]`:
Similar to the JS object \<-> record deriving, you can hide the fact that the JS enum are ints by using the same `newType` option with `[@bs.deriving jsConverter]`:

<CodeTab labels={["Reason (Old Syntax)", "ML (Older Syntax)"]}>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading