Skip to content

Commit facba3c

Browse files
authored
Merge pull request rescript-lang#293 from rescript-association/upgrade-to-9
Upgrade docs to 8.3, 8.4 and then to 9.x
2 parents 3ec49fe + 7b74cf0 commit facba3c

37 files changed

+480
-329
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ node_modules/
1111
.next/
1212
index_data/*.json
1313

14+
pages/docs/manual/v8.0.0/
15+
1416
yarn-error.log
1517

1618
.bsb.lock

_blogposts/2020-12-07-release-8-4.mdx

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,30 +55,9 @@ dependent's command line flags for building binary artifacts. Such strategy bene
5555

5656
### Introducing `pinned-dependencies`
5757

58-
To make `bsb -make-world` more practical, we also introduce a new concept called: `pinned-dependencies`.
59-
In general, packages are classified as three categories:
60-
61-
- toplevel
62-
- warnings reported
63-
- warn-error respected
64-
- build dev dependency
65-
- run custom rules
66-
- package-specs like ES6/CommonJS overrides all its dependencies
67-
- pinned dependencies
68-
- warnings reported
69-
- warn-error respected
70-
- build dev dependency
71-
- run custom rules
72-
- normal dependencies
73-
- warnings, warn-error ignored
74-
- ignore dev directories
75-
- ignore custom generator rules
76-
77-
Previously, we only had `toplevel` and `normal dependencies`, by introducing `pinned-dependencies`,
78-
such package will be built mostly like `toplevel` packages.
79-
80-
The usage is quite simple, add `pinned-dependencies` in the toplevel package's `bsconfig.json`.
81-
Note such field only make sense in toplevel's configuration.
58+
To make `bsb -make-world` more practical for e.g. multi-package setups (`lerna`, `yarn workspaces`, etc.), we introduced a new concept called `pinned-dependencies`. A pinned dependency allows you to automatically rebuild packages that are pinned by a toplevel package, like your final webapp.
59+
60+
Please refer to our [pinned dependencies](/docs/manual/latest/build-pinned-dependencies) docs for more details.
8261

8362
### More robust handling of removal of staled output
8463

_blogposts/2021-02-09-release-9-0.mdx

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -35,48 +35,8 @@ Our compiler comes with a set of stdlib modules (such as `Belt`, `Pervasives`, e
3535

3636
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.
3737

38-
To fix this problem, we now publish our pre-compiled stdlib JS files as a separate npm package called [`@rescript/std`](https://www.npmjs.com/package/@rescript/std). Each new `bs-platform` release has a matching `@rescript/std` release for runtime compatibility.
3938

40-
We also introduced a new configuration within our `bsconfig.json` file to tell the compiler to use our pre-compiled package instead:
41-
42-
```json
43-
{
44-
/* ... */
45-
"external-stdlib" : "@rescript/std"
46-
}
47-
```
48-
49-
With this configuration set, compiled JS code will now point to the defined `external-stdlib` path:
50-
51-
<CodeTab labels={["ReScript", "JavaScript"]}>
52-
53-
```res
54-
Belt.Array.forEach([1, 2, 3], (num) => Js.log(num))
55-
```
56-
57-
```js
58-
// Note the import path starting with "@rescript/std"
59-
import * as Belt_Array from "@rescript/std/lib/es6/belt_Array.js";
60-
61-
Belt_Array.forEach([
62-
1,
63-
2,
64-
3
65-
], (function (num) {
66-
console.log(num);
67-
68-
}));
69-
```
70-
71-
</CodeTab>
72-
73-
The JavaScript output above was compiled with an `es6` target, but will also work with `commonjs`.
74-
75-
**Important:** When using this option, you need to make sure that the version number of `bs-platform` and `@rescript/std` matches with the same version number in your `package.json` file, otherwise you'll eventually run into runtime problems due to mismatching stdlib behavior!
76-
77-
To prevent unnecessary complications, only use this feature when...
78-
- You want to ship a library for JS / TS consumers without making them depend on `bs-platform`
79-
- You can't depend on `bs-platform` due to toolchain size (docker containers, low-storage deployment devices, etc)
39+
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/latest/build-external-stdlib) documentation.
8040

8141
### Less Bundle Bloat when Adding ReScript
8242

compilers/package-lock.json

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

compilers/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "index.js",
66
"license": "MIT",
77
"dependencies": {
8+
"rescript-902": "npm:[email protected]",
89
"rescript-820": "npm:[email protected]"
910
}
1011
}

data/blog_authors.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"username": "hongbo",
44
"fullname": "Hongbo Zhang",
55
"role": "Compiler & Build System",
6-
"img_url": "https://pbs.twimg.com/profile_images/3157941111/cf58e90adce60b796f589b2ae5a0394a_400x400.jpeg",
6+
"img_url": "https://pbs.twimg.com/profile_images/1369548222314598400/E2y46vrB_400x400.jpg",
77
"twitter": "bobzhang1988"
88
},
99
{

data/build-schema.json

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@
154154

155155
"type": {
156156
"enum": [
157-
"dev",
158-
"lib"
157+
"dev"
159158
]
160159
},
161160
"files": {
@@ -481,24 +480,17 @@
481480
"type": "boolean",
482481
"description": "(Experimental) whether to use the OCaml standard library. Default: true"
483482
},
483+
"external-stdlib" : {
484+
"type" : "string",
485+
"description": "Use the external stdlib library instead of the one shipped with the compiler package"
486+
},
484487
"bs-external-includes": {
485488
"type": "array",
486489
"items": {
487490
"type": "string"
488491
},
489492
"description": "(Not needed usually) external include directories, which will be applied `-I` to all compilation units"
490493
},
491-
"refmt": {
492-
"$ref": "#/definitions/refmt-specs",
493-
"description": "Reason syntax configuration"
494-
},
495-
"refmt-flags": {
496-
"type": "array",
497-
"items": {
498-
"type": "string"
499-
},
500-
"description": "(Not needed usually) arguments to pass to `refmt` above. Default: `[\"--print\", \"binary\"]`."
501-
},
502494
"suffix" : {
503495
"$ref" : "#/definitions/suffix-spec"
504496
}

data/sidebar_manual_latest.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
"build-overview",
5454
"build-configuration",
5555
"build-configuration-schema",
56+
"build-external-stdlib",
57+
"build-pinned-dependencies",
5658
"interop-with-js-build-systems",
5759
"build-performance"
5860
],

pages/docs/manual/latest/api/js/array-2.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ A type used to describe JavaScript objects that are like an array or are iterabl
4747
## from
4848

4949
```res sig
50-
let from: array_like<'a> => array<'b>
50+
let from: array_like<'a> => array<'a>
5151
```
5252

5353
Creates a shallow copy of an array from an array-like object. See [`Array.from`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from) on MDN.

pages/docs/manual/latest/api/js/array.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ A type used to describe JavaScript objects that are like an array or are iterabl
4848
## from
4949

5050
```res sig
51-
let from: array_like<'a> => array<'b>
51+
let from: array_like<'a> => array<'a>
5252
```
5353

5454
Creates a shallow copy of an array from an array-like object. See [`Array.from`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from) on MDN.

0 commit comments

Comments
 (0)