Skip to content

Commit 049cf37

Browse files
author
kanishka-work
authored
Document "import" warning in Unified module (ocaml#412)
* also: add build deps count * also: pin bsconfig schema version
1 parent 3e528ae commit 049cf37

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

site/bsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/master/docs/docson/build-schema.json",
2+
"$schema": "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/9.0.0/docs/docson/build-schema.json",
33
"name": "ocamlorg",
44
"namespace": true,
55
"reason": {

site/package.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@
2727
"next:debug": "NODE_OPTIONS='--inspect' next dev",
2828
"watch": "concurrently --raw \"bsb -make-world -w\" \"next dev\" ",
2929
"watch-and-serve": "concurrently --raw \"bsb -make-world -w\" \"next dev\" \"http-server out\"",
30-
"build": "bsb -clean-world -make-world && next build && next export",
31-
"start-test-server": "http-server out"
30+
"build": "bsb -clean-world -make-world && next build && next export && yarn total-dependencies-check",
31+
"start-test-server": "http-server out",
32+
"total-dependencies-check": "(test $(grep '^[a-zA-Z@].*:$' yarn.lock | wc -l) -lt 500 && echo ok) || (echo too many deps && exit 1) "
3233
},
3334
"scriptsDescription": {
34-
"build": "at present, next export is only used to ensure that we strictly use static site functionality",
35-
"start-test-server": "Vercel deployments use next start, but this command tests running a pure static site. TODO: use npx from Makefile instead."
35+
"build": "At present, next export is only used to ensure that we strictly use static site functionality.",
36+
"start-test-server": "Vercel deployments use next start, but this command tests running a pure static site. TODO: use npx from Makefile instead.",
37+
"total-dependencies-check": "Test, approximately, whether the current transitiive dependencies has grown significantly."
3638
},
3739
"devDependencies": {
3840
"@tailwindcss/typography": "^0.4.0",

site/src/Unified.res

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
// The following code causes a warning. My limited understanding is that the warning
2+
// occurs because there is a mismatch between ReScript's assumptions about the version
3+
// of Javascript being used and the actual version of Javascript used in NextJS. Currently,
4+
// we have ReScript configured to target the ES6 version of Javascript. This is the emerging standard. At the same time,
5+
// there are open issues in NextJS requesting ES6 support, but NextJS does not
6+
// currently evaluate Javascript in an ES6 context. NextJS uses CommonJS when
7+
// evaluating Javascript. The warning occurs because ReScript uses an external validator
8+
// on the generated Javascript and the external validator notes that using "import" in
9+
// the syntax below is not valid in ES6. The syntax is valid in CommonJS, which means
10+
// the code will successfully run in NextJS.
11+
// This warning will hopefully be resolved by September of 2021, if
12+
// NextJS proceeds to lift its restriction on using ES6. The status of this issue
13+
// can be tracked in Github issue #298.
114
%%raw(`
215
const MdastUtilToStringInternal = (await import('mdast-util-to-string')).toString
316
`)

0 commit comments

Comments
 (0)