Skip to content

Commit 266ebe0

Browse files
V12 docs
1 parent d634989 commit 266ebe0

File tree

161 files changed

+12489
-395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+12489
-395
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
VERSION_LATEST="v11.0.0"
2+
VERSION_NEXT="v12.0.0"

data/sidebar_gentype_latest.json

Lines changed: 0 additions & 10 deletions
This file was deleted.
File renamed without changes.

data/sidebar_manual_v1200.json

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"Overview": [
3+
"introduction",
4+
"installation",
5+
"migrate-to-v11",
6+
"editor-plugins",
7+
"try"
8+
],
9+
"Language Features": [
10+
"overview",
11+
"let-binding",
12+
"type",
13+
"primitive-types",
14+
"tuple",
15+
"record",
16+
"object",
17+
"variant",
18+
"polymorphic-variant",
19+
"null-undefined-option",
20+
"array-and-list",
21+
"function",
22+
"control-flow",
23+
"pipe",
24+
"pattern-matching-destructuring",
25+
"mutation",
26+
"jsx",
27+
"exception",
28+
"lazy-values",
29+
"promise",
30+
"async-await",
31+
"tagged-templates",
32+
"module",
33+
"import-export",
34+
"attribute",
35+
"reserved-keywords",
36+
"equality-comparison"
37+
],
38+
"Advanced Features": [
39+
"extensible-variant",
40+
"scoped-polymorphic-types"
41+
],
42+
"JavaScript Interop": [
43+
"interop-cheatsheet",
44+
"embed-raw-javascript",
45+
"shared-data-types",
46+
"external",
47+
"bind-to-js-object",
48+
"bind-to-js-function",
49+
"import-from-export-to-js",
50+
"bind-to-global-js-values",
51+
"json",
52+
"inlining-constants",
53+
"use-illegal-identifier-names",
54+
"generate-converters-accessors",
55+
"browser-support-polyfills",
56+
"libraries",
57+
"typescript-integration"
58+
],
59+
"Build System": [
60+
"build-overview",
61+
"build-configuration",
62+
"build-configuration-schema",
63+
"build-external-stdlib",
64+
"build-pinned-dependencies",
65+
"interop-with-js-build-systems",
66+
"build-performance",
67+
"warning-numbers"
68+
],
69+
"Guides": [
70+
"converting-from-js"
71+
],
72+
"Extra": [
73+
"newcomer-examples",
74+
"project-structure",
75+
"faq"
76+
]
77+
}

next.config.mjs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @ts-check
12
import fs from "fs";
23
import webpack from "webpack";
34
import rehypeSlug from "rehype-slug";
@@ -7,17 +8,19 @@ import remarkFrontmatter from "remark-frontmatter";
78
import remarkMdxFrontmatter from "remark-mdx-frontmatter";
89
import { createLoader } from "simple-functional-loader";
910

10-
const bsconfig = JSON.parse(fs.readFileSync("./rescript.json"));
11+
const bsconfig = JSON.parse(fs.readFileSync("./rescript.json").toString());
1112

1213
const { ProvidePlugin } = webpack;
1314

1415
const transpileModules = ["rescript"].concat(bsconfig["bs-dependencies"]);
1516

1617
const config = {
17-
output: process.env.BUILD_STATIC === 'true' ? 'export' : undefined,
18+
output: process.env.BUILD_STATIC === "true" ? "export" : undefined,
1819
pageExtensions: ["jsx", "js", "bs.js", "mdx", "mjs"],
1920
env: {
2021
ENV: process.env.NODE_ENV,
22+
VERSION_LATEST: process.env.VERSION_LATEST,
23+
VERSION_NEXT: process.env.VERSION_NEXT,
2124
},
2225
swcMinify: false,
2326
webpack: (config, options) => {
@@ -81,6 +84,20 @@ const config = {
8184
config.plugins.push(new ProvidePlugin({ React: "react" }));
8285
return config;
8386
},
87+
async rewrites() {
88+
return {
89+
beforeFiles: [
90+
{
91+
source: "/docs/manual/latest/:slug",
92+
destination: `/docs/manual/${process.env.VERSION_LATEST}/:slug`,
93+
},
94+
{
95+
source: "/docs/manual/next/:slug",
96+
destination: `/docs/manual/${process.env.VERSION_NEXT}/:slug`,
97+
},
98+
],
99+
};
100+
},
84101
async redirects() {
85102
return [
86103
{

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"unified": "^8.4.0"
5858
},
5959
"scripts": {
60-
"dev": "next",
60+
"dev": "NODE_OPTIONS='--inspect' next dev",
6161
"build": "rescript && npm run update-index && next build",
6262
"test": "node scripts/test-examples.mjs && node scripts/test-hrefs.mjs",
6363
"reanalyze": "reanalyze -all-cmt .",

pages/docs/manual/latest/api/[...slug].js renamed to pages/docs/manual/v11.0.0/api/[...slug].js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
getStaticPathsByVersion,
3-
getStaticPropsByVersion
3+
getStaticPropsByVersion,
44
} from "src/ApiDocs.mjs";
55

66
import APIDocs from "src/ApiDocs.mjs";

pages/docs/manual/latest/overview.mdx renamed to pages/docs/manual/v11.0.0/overview.mdx

Lines changed: 65 additions & 65 deletions

pages/docs/manual/v12.0.0/api.mdx

Lines changed: 18 additions & 0 deletions
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import {
2+
getStaticPathsByVersion,
3+
getStaticPropsByVersion,
4+
} from "src/ApiDocs.mjs";
5+
6+
import APIDocs from "src/ApiDocs.mjs";
7+
8+
export async function getStaticProps(ctx) {
9+
return await getStaticPropsByVersion({ ...ctx, version: "latest" });
10+
}
11+
12+
export async function getStaticPaths(ctx) {
13+
return await getStaticPathsByVersion("latest");
14+
}
15+
16+
export default function Comp(props) {
17+
return <APIDocs {...props} />;
18+
}

0 commit comments

Comments
 (0)