Skip to content

Commit 6d98e16

Browse files
authored
chore: update to Docusaurus 3.6, adopt rspack and SWC (#495)
* chore: bump Docusaurus * refactor: adopt rspack, SWC
1 parent b1833ab commit 6d98e16

File tree

5 files changed

+3359
-2494
lines changed

5 files changed

+3359
-2494
lines changed

docusaurus.config.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,8 @@ const config: Config = {
5050
require.resolve("@fontsource/jetbrains-mono/index.css"),
5151
],
5252

53-
webpack: {
54-
jsLoader: (isServer) => ({
55-
loader: require.resolve("esbuild-loader"),
56-
options: {
57-
loader: "tsx",
58-
target: isServer ? "node12" : "es2017",
59-
},
60-
}),
53+
future: {
54+
experimental_faster: true,
6155
},
6256

6357
headTags: [

package.json

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@
1616
"format:check": "prettier . --check"
1717
},
1818
"dependencies": {
19-
"@docusaurus/core": "3.5.2",
20-
"@docusaurus/plugin-content-docs": "3.5.2",
21-
"@docusaurus/plugin-content-pages": "3.5.2",
22-
"@docusaurus/plugin-debug": "3.5.2",
23-
"@docusaurus/plugin-pwa": "3.5.2",
24-
"@docusaurus/plugin-sitemap": "3.5.2",
25-
"@docusaurus/theme-classic": "3.5.2",
26-
"@docusaurus/theme-common": "3.5.2",
27-
"@docusaurus/theme-mermaid": "3.5.2",
28-
"@docusaurus/theme-search-algolia": "3.5.2",
19+
"@docusaurus/core": "3.6.0",
20+
"@docusaurus/faster": "^3.6.0",
21+
"@docusaurus/plugin-content-docs": "3.6.0",
22+
"@docusaurus/plugin-content-pages": "3.6.0",
23+
"@docusaurus/plugin-debug": "3.6.0",
24+
"@docusaurus/plugin-pwa": "3.6.0",
25+
"@docusaurus/plugin-sitemap": "3.6.0",
26+
"@docusaurus/theme-classic": "3.6.0",
27+
"@docusaurus/theme-common": "3.6.0",
28+
"@docusaurus/theme-mermaid": "3.6.0",
29+
"@docusaurus/theme-search-algolia": "3.6.0",
2930
"@floating-ui/react": "^0.26.16",
3031
"@fontsource/jetbrains-mono": "5.0.20",
3132
"@iconify/react": "5.0.1",
@@ -40,22 +41,18 @@
4041
"react-markdown": "8.0.7"
4142
},
4243
"devDependencies": {
43-
"@docusaurus/module-type-aliases": "3.5.2",
44-
"@docusaurus/types": "3.5.2",
45-
"@docusaurus/tsconfig": "3.5.2",
44+
"@docusaurus/module-type-aliases": "3.6.0",
45+
"@docusaurus/tsconfig": "3.6.0",
46+
"@docusaurus/types": "3.6.0",
4647
"@fec/remark-a11y-emoji": "4.0.2",
4748
"@types/is-ci": "3.0.4",
4849
"@types/js-yaml": "^4.0.9",
4950
"@types/node": "20.14.2",
5051
"@types/react": "^18.2.79",
51-
"esbuild": "^0.20.2",
52-
"esbuild-loader": "4.1.0",
53-
"esbuild-register": "3.5.0",
5452
"is-ci": "3.0.1",
5553
"prettier": "3.3.1",
5654
"regenerator-runtime": "0.14.1",
57-
"typescript": "5.4.5",
58-
"webpack": "^5.91.0"
55+
"typescript": "5.4.5"
5956
},
6057
"browserslist": {
6158
"production": [
@@ -70,11 +67,11 @@
7067
"last 1 safari version"
7168
]
7269
},
73-
"packageManager": "pnpm@9.11.0+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b",
70+
"packageManager": "pnpm@9.12.3+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee",
7471
"pnpm": {
7572
"patchedDependencies": {
76-
"@docusaurus/utils@3.5.2": "patches/@docusaurus__utils@3.5.2.patch",
77-
"@docusaurus/plugin-content-docs@3.5.2": "patches/@docusaurus__plugin-content-docs@3.5.2.patch"
73+
"@docusaurus/plugin-content-docs@3.6.0": "patches/@docusaurus__plugin-content-docs@3.6.0.patch",
74+
"@docusaurus/utils@3.6.0": "patches/@docusaurus__utils@3.6.0.patch"
7875
}
7976
}
8077
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/lib/client/docsSearch.js b/lib/client/docsSearch.js
2-
index fb1fb547238f704c3f27b4cc40af1e55766702df..2543ba879f86fa967b123b8ba55deb8186ac7fc9 100644
2+
index fb1fb547238f704c3f27b4cc40af1e55766702df..2543ba879f86fa967b123b8ba55deb8186ac7fc9 100755
33
--- a/lib/client/docsSearch.js
44
+++ b/lib/client/docsSearch.js
55
@@ -35,5 +35,5 @@ export function useDocsContextualSearchTags() {
@@ -10,7 +10,7 @@ index fb1fb547238f704c3f27b4cc40af1e55766702df..2543ba879f86fa967b123b8ba55deb81
1010
+ return [...(activePluginAndVersion ? [activePluginAndVersion.activePlugin.pluginId] : Object.keys(allDocsData)).map(getDocPluginTags)];
1111
}
1212
diff --git a/lib/constants.js b/lib/constants.js
13-
index f91e43f00e1f9160afa6a34ed1df71c90fe45a28..db04a015ea2d4474339b1d02f6fbec75ba14c894 100644
13+
index f91e43f00e1f9160afa6a34ed1df71c90fe45a28..db04a015ea2d4474339b1d02f6fbec75ba14c894 100755
1414
--- a/lib/constants.js
1515
+++ b/lib/constants.js
1616
@@ -10,8 +10,8 @@ exports.VERSIONS_JSON_FILE = exports.VERSIONED_SIDEBARS_DIR = exports.VERSIONED_
@@ -26,7 +26,7 @@ index f91e43f00e1f9160afa6a34ed1df71c90fe45a28..db04a015ea2d4474339b1d02f6fbec75
2626
-exports.VERSIONS_JSON_FILE = 'versions.json';
2727
+exports.VERSIONED_BASE_DIR = 'docs/versioned';
2828
diff --git a/lib/versions/files.js b/lib/versions/files.js
29-
index f63cbb295242437ca8b417d3c32e228e370944e9..396b08c66bec0e4b8b455d32171196fcdd71aa1f 100644
29+
index f63cbb295242437ca8b417d3c32e228e370944e9..396b08c66bec0e4b8b455d32171196fcdd71aa1f 100755
3030
--- a/lib/versions/files.js
3131
+++ b/lib/versions/files.js
3232
@@ -19,19 +19,19 @@ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/src/gitUtils.ts b/src/gitUtils.ts
2-
index 39a3ad754a0c5ab27cfb78c7b44a9f0be3785a62..c3116d7a725d4a5420286baac8147f4e821e5631 100644
2+
index 39a3ad754a0c5ab27cfb78c7b44a9f0be3785a62..c3116d7a725d4a5420286baac8147f4e821e5631 100755
33
--- a/src/gitUtils.ts
44
+++ b/src/gitUtils.ts
55
@@ -95,6 +95,13 @@ export async function getFileCommitDate(
@@ -21,12 +21,12 @@ index 39a3ad754a0c5ab27cfb78c7b44a9f0be3785a62..c3116d7a725d4a5420286baac8147f4e
2121
);
2222
}
2323
+}
24-
24+
2525
+function createArgs(format: string, includeAuthor?: boolean, age: 'oldest' | 'newest' = 'oldest') {
2626
// We add a "RESULT:" prefix to make parsing easier
2727
// See why: https://github.com/facebook/docusaurus/pull/10022
2828
const resultFormat = includeAuthor ? 'RESULT:%ct,%an' : 'RESULT:%ct';
29-
29+
3030
const args = [
3131
- `--format=${resultFormat}`,
3232
+ `--format=${includeAuthor === undefined ? format : resultFormat}`,
@@ -35,7 +35,7 @@ index 39a3ad754a0c5ab27cfb78c7b44a9f0be3785a62..c3116d7a725d4a5420286baac8147f4e
3535
]
3636
.filter(Boolean)
3737
.join(' ');
38-
38+
3939
+ return args;
4040
+}
4141
+async function runGitCommandOnFile(file: string, args: string): Promise<{
@@ -49,7 +49,7 @@ index 39a3ad754a0c5ab27cfb78c7b44a9f0be3785a62..c3116d7a725d4a5420286baac8147f4e
4949
@@ -147,12 +163,18 @@ export async function getFileCommitDate(
5050
);
5151
}
52-
52+
5353
+ return result;
5454
+}
5555
+function retrieveCorrectRegex(includeAuthor: boolean) {
@@ -58,17 +58,17 @@ index 39a3ad754a0c5ab27cfb78c7b44a9f0be3785a62..c3116d7a725d4a5420286baac8147f4e
5858
const regex = includeAuthor
5959
? /(?:^|\n)RESULT:(?<timestamp>\d+),(?<author>.+)(?:$|\n)/
6060
: /(?:^|\n)RESULT:(?<timestamp>\d+)(?:$|\n)/;
61-
61+
6262
+ return regex;
6363
+}
6464
+function matchFromRegex(file: string, regex: RegExp, result: { code: number; stdout: string; stderr: string; }): RegExpMatchArray {
6565
const output = result.stdout.trim();
66-
66+
6767
if (!output) {
6868
@@ -169,6 +191,13 @@ export async function getFileCommitDate(
6969
);
7070
}
71-
71+
7272
+ return match;
7373
+}
7474
+function matchDateAndTimestamp(match: RegExpMatchArray, includeAuthor: boolean): {

0 commit comments

Comments
 (0)