Skip to content

Commit ddf6611

Browse files
committed
Merge branch 'master' of github.com:rescript-lang/rescript-lang.org into vlk/dark-mode
2 parents c8f7fd5 + 3b0d4b6 commit ddf6611

40 files changed

Lines changed: 616 additions & 589 deletions

.codex

Whitespace-only changes.

cypress/support/e2e.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@ const knownHydrationErrors = [
77
/Minified React error #425\b/,
88
];
99

10+
const knownPlaygroundBootstrapErrors = [
11+
/Sys_error.*file already exists/i,
12+
/\/static\/Belt\.cmi\s*:\s*file already exists/i,
13+
];
14+
1015
Cypress.on("uncaught:exception", (err) => {
1116
const message = err && err.message ? err.message : "";
1217
const isKnownHydrationError = knownHydrationErrors.some((pattern) =>
1318
pattern.test(message),
1419
);
20+
const isKnownPlaygroundBootstrapError = knownPlaygroundBootstrapErrors.some(
21+
(pattern) => pattern.test(message),
22+
);
1523

1624
if (isKnownHydrationError) {
1725
console.warn("Suppressing known React hydration exception in Cypress:", {
@@ -20,4 +28,15 @@ Cypress.on("uncaught:exception", (err) => {
2028
});
2129
return false;
2230
}
31+
32+
if (isKnownPlaygroundBootstrapError) {
33+
console.warn(
34+
"Suppressing known Playground bootstrap exception in Cypress:",
35+
{
36+
message,
37+
error: err,
38+
},
39+
);
40+
return false;
41+
}
2342
});

e2e/Playground.cy.res

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,27 @@ describe("Playground", () => {
8080
->ignore
8181

8282
// Verify playground shell is in light mode
83-
get("main")->shouldWithValue("have.class", "bg-gray-5")->ignore
83+
get("main")->shouldWithValue("have.class", "playground-theme-light")->ignore
84+
cyWindow()
85+
->its("localStorage")
86+
->invokeWithArg("getItem", "playgroundTheme")
87+
->shouldWithValue("eq", "light")
88+
->ignore
8489

8590
// Switch back to dark mode from Settings
8691
contains("Settings")->click->ignore
87-
contains("Playground Theme")
88-
->closest("div")
92+
get("main")
8993
->find("button")
9094
->containsChainable("Dark")
9195
->click
9296
->ignore
9397

9498
// Verify playground shell is back to dark mode
95-
get("main")->shouldWithValue("have.class", "bg-gray-100")->ignore
99+
get("main")->shouldWithValue("have.class", "playground-theme-dark")->ignore
100+
cyWindow()
101+
->its("localStorage")
102+
->invokeWithArg("getItem", "playgroundTheme")
103+
->shouldWithValue("eq", "dark")
104+
->ignore
96105
})
97106
})

markdown-pages/blog/release-9-0.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Our compiler comes with a set of stdlib modules (such as `Belt`, `Pervasives`, e
3434

3535
In previous versions, users couldn't ship their compiled JS code without defining a `package.json` dependency on `bs-platform`. Whenever a ReScript developer wanted to publish a package just for pure JS consumption / lean container deployment, they were required to use a bundler to bundle up their library / stdlib code, which made things way more complex and harder to understand.
3636

37-
To fix this problem, we introduced an `external-stdlib` configuration that allows specifying a pre-compiled stdlib npm package (`@rescript/std`). More details on how to use that feature can be found in our [External Stdlib](../docs/manual/build-external-stdlib.mdx) documentation.
37+
To fix this problem, we introduced an `external-stdlib` configuration that allows specifying a pre-compiled stdlib npm package (`@rescript/std`).
3838

3939
### Less Bundle Bloat when Adding ReScript
4040

markdown-pages/docs/manual/array-and-list.mdx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ order: 12
1010

1111
## Array
1212

13-
Arrays are our main ordered data structure. They work the same way as JavaScript arrays: they can be randomly accessed, dynamically resized, updated, etc.
13+
Arrays are the main ordered data structure in ReScript. They can be randomly accessed, dynamically resized, and updated.
1414

1515
<CodeTab labels={["ReScript", "JS Output"]}>
1616

@@ -84,7 +84,7 @@ myArray[0] = "bye";
8484

8585
**Since 11.1**
8686

87-
You can spread arrays of the the same type into new arrays, just like in JavaScript:
87+
You can spread arrays of the same type into new arrays:
8888

8989
<CodeTab labels={["ReScript", "JS Output"]}>
9090

@@ -96,21 +96,17 @@ let x3 = [...y]
9696
```
9797

9898
```javascript
99-
var Belt_Array = require("rescript/lib/js/belt_Array.js");
100-
10199
var y = [1, 2];
102100

103-
var x = Belt_Array.concatMany([[4, 5], y]);
101+
var x = [4, 5, ...y];
104102

105-
var x2 = Belt_Array.concatMany([[4, 5], y, [7], y]);
103+
var x2 = [4, 5, ...y, 7, ...y];
106104

107-
var x3 = Belt_Array.concatMany([y]);
105+
var x3 = [...y];
108106
```
109107

110108
</CodeTab>
111109

112-
> Note that array spreads compiles to `Belt.Array.concatMany` right now. This is likely to change to native array spreads in the future.
113-
114110
## List
115111

116112
ReScript provides a singly linked list too. Lists are:

markdown-pages/docs/manual/async-await.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ You will probably notice that this looks very similar to `async` / `await` in JS
6767
- `await` may only be called on a `promise` value
6868
- `await` calls are expressions, therefore they can be used in pattern matching (`switch`)
6969
- A function returning a `promise<'a>` is equivalent to an `async` function returning a value `'a` (important for writing signature files and bindings)
70-
- `promise` values and types returned from an `async` function don't auto-collapse into a "flat promise" like in JS (more on this later)
70+
- `promise` values and types returned from an `async` function don't auto-collapse into a flat promise. See the details below.
7171

7272
## Types and `async` functions
7373

markdown-pages/docs/manual/browser-support-polyfills.mdx

Lines changed: 0 additions & 20 deletions
This file was deleted.

markdown-pages/docs/manual/build-configuration.mdx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,13 @@ Here, the file `src/MyMainModule.res` is exposed to outside consumers, while all
8181
}
8282
```
8383

84-
## bs-dependencies, bs-dev-dependencies
84+
## dependencies, dev-dependencies
8585

8686
List of ReScript dependencies. Just like `package.json`'s dependencies, they'll be searched in `node_modules`.
8787

88-
Note that only sources marked with `"type":"dev"` will be able to resolve modules from `bs-dev-dependencies`.
88+
Note that only sources marked with `"type":"dev"` will be able to resolve modules from `dev-dependencies`.
8989

90-
## external-stdlib
91-
92-
**Since 9.0**: This setting allows depending on an externally built stdlib package (instead of a locally built stdlib runtime). Useful for shipping packages that are only consumed in JS or TS without any dependencies to the ReScript development toolchain.
93-
94-
More details can be found on our [external stdlib](./build-external-stdlib.mdx) page.
90+
> The legacy keys `bs-dependencies` and `bs-dev-dependencies` are still accepted but deprecated.
9591
9692
## js-post-build
9793

@@ -155,7 +151,8 @@ This configuration only applies to you, when you develop the project. When the p
155151

156152
## suffix
157153

158-
**Since 11.0**: The suffix can now be freely chosen. However, we still suggest you stick to the convention and use
154+
**Since 11.0**: The suffix can be freely chosen. However, we still suggest you stick to the convention and use
155+
159156
one of the following:
160157

161158
- `".js`
@@ -190,12 +187,14 @@ Turn off warning `44` and `102` (polymorphic comparison). Turn warning `5` (part
190187

191188
The warning numbers are shown in the build output when they're triggered. See [Warning Numbers](./warning-numbers.mdx) for the complete list.
192189

193-
## bsc-flags
190+
## compiler-flags
194191

195192
Extra flags to pass to the compiler. For advanced usages.
196193

197194
- `-open ABC` opens the module `ABC` for each file in the project. `ABC` can either be a dependency, namespaced project or local module of the current project.
198195

196+
> The legacy key `bsc-flags` is still accepted but deprecated.
197+
199198
## gentypeconfig
200199

201200
To enable genType, set `"gentypeconfig"` at top level in the project's `rescript.json`.

markdown-pages/docs/manual/build-external-stdlib.mdx

Lines changed: 0 additions & 62 deletions
This file was deleted.

markdown-pages/docs/manual/build-monorepo-setup.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The root `rescript.json` manages the monorepo by listing its packages.
5858
"in-source": true
5959
},
6060
"suffix": ".res.mjs",
61-
"bsc-flags": []
61+
"compiler-flags": []
6262
}
6363
```
6464

0 commit comments

Comments
 (0)