Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to Docusaurus 3.6, adopt rspack and SWC #495

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,8 @@ const config: Config = {
require.resolve("@fontsource/jetbrains-mono/index.css"),
],

webpack: {
jsLoader: (isServer) => ({
loader: require.resolve("esbuild-loader"),
options: {
loader: "tsx",
target: isServer ? "node12" : "es2017",
},
}),
future: {
experimental_faster: true,
},

headTags: [
Expand Down
39 changes: 18 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@
"format:check": "prettier . --check"
},
"dependencies": {
"@docusaurus/core": "3.5.2",
"@docusaurus/plugin-content-docs": "3.5.2",
"@docusaurus/plugin-content-pages": "3.5.2",
"@docusaurus/plugin-debug": "3.5.2",
"@docusaurus/plugin-pwa": "3.5.2",
"@docusaurus/plugin-sitemap": "3.5.2",
"@docusaurus/theme-classic": "3.5.2",
"@docusaurus/theme-common": "3.5.2",
"@docusaurus/theme-mermaid": "3.5.2",
"@docusaurus/theme-search-algolia": "3.5.2",
"@docusaurus/core": "3.6.0",
"@docusaurus/faster": "^3.6.0",
"@docusaurus/plugin-content-docs": "3.6.0",
"@docusaurus/plugin-content-pages": "3.6.0",
"@docusaurus/plugin-debug": "3.6.0",
"@docusaurus/plugin-pwa": "3.6.0",
"@docusaurus/plugin-sitemap": "3.6.0",
"@docusaurus/theme-classic": "3.6.0",
"@docusaurus/theme-common": "3.6.0",
"@docusaurus/theme-mermaid": "3.6.0",
"@docusaurus/theme-search-algolia": "3.6.0",
"@floating-ui/react": "^0.26.16",
"@fontsource/jetbrains-mono": "5.0.20",
"@iconify/react": "5.0.1",
Expand All @@ -40,22 +41,18 @@
"react-markdown": "8.0.7"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.5.2",
"@docusaurus/types": "3.5.2",
"@docusaurus/tsconfig": "3.5.2",
"@docusaurus/module-type-aliases": "3.6.0",
"@docusaurus/tsconfig": "3.6.0",
"@docusaurus/types": "3.6.0",
"@fec/remark-a11y-emoji": "4.0.2",
"@types/is-ci": "3.0.4",
"@types/js-yaml": "^4.0.9",
"@types/node": "20.14.2",
"@types/react": "^18.2.79",
"esbuild": "^0.20.2",
"esbuild-loader": "4.1.0",
"esbuild-register": "3.5.0",
"is-ci": "3.0.1",
"prettier": "3.3.1",
"regenerator-runtime": "0.14.1",
"typescript": "5.4.5",
"webpack": "^5.91.0"
"typescript": "5.4.5"
},
"browserslist": {
"production": [
Expand All @@ -70,11 +67,11 @@
"last 1 safari version"
]
},
"packageManager": "pnpm@9.11.0+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b",
"packageManager": "pnpm@9.12.3+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee",
"pnpm": {
"patchedDependencies": {
"@docusaurus/utils@3.5.2": "patches/@docusaurus__utils@3.5.2.patch",
"@docusaurus/plugin-content-docs@3.5.2": "patches/@docusaurus__plugin-content-docs@3.5.2.patch"
"@docusaurus/plugin-content-docs@3.6.0": "patches/@docusaurus__plugin-content-docs@3.6.0.patch",
"@docusaurus/utils@3.6.0": "patches/@docusaurus__utils@3.6.0.patch"
}
}
}
6 changes: 3 additions & 3 deletions [email protected][email protected]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/lib/client/docsSearch.js b/lib/client/docsSearch.js
index fb1fb547238f704c3f27b4cc40af1e55766702df..2543ba879f86fa967b123b8ba55deb8186ac7fc9 100644
index fb1fb547238f704c3f27b4cc40af1e55766702df..2543ba879f86fa967b123b8ba55deb8186ac7fc9 100755
--- a/lib/client/docsSearch.js
+++ b/lib/client/docsSearch.js
@@ -35,5 +35,5 @@ export function useDocsContextualSearchTags() {
Expand All @@ -10,7 +10,7 @@ index fb1fb547238f704c3f27b4cc40af1e55766702df..2543ba879f86fa967b123b8ba55deb81
+ return [...(activePluginAndVersion ? [activePluginAndVersion.activePlugin.pluginId] : Object.keys(allDocsData)).map(getDocPluginTags)];
}
diff --git a/lib/constants.js b/lib/constants.js
index f91e43f00e1f9160afa6a34ed1df71c90fe45a28..db04a015ea2d4474339b1d02f6fbec75ba14c894 100644
index f91e43f00e1f9160afa6a34ed1df71c90fe45a28..db04a015ea2d4474339b1d02f6fbec75ba14c894 100755
--- a/lib/constants.js
+++ b/lib/constants.js
@@ -10,8 +10,8 @@ exports.VERSIONS_JSON_FILE = exports.VERSIONED_SIDEBARS_DIR = exports.VERSIONED_
Expand All @@ -26,7 +26,7 @@ index f91e43f00e1f9160afa6a34ed1df71c90fe45a28..db04a015ea2d4474339b1d02f6fbec75
-exports.VERSIONS_JSON_FILE = 'versions.json';
+exports.VERSIONED_BASE_DIR = 'docs/versioned';
diff --git a/lib/versions/files.js b/lib/versions/files.js
index f63cbb295242437ca8b417d3c32e228e370944e9..396b08c66bec0e4b8b455d32171196fcdd71aa1f 100644
index f63cbb295242437ca8b417d3c32e228e370944e9..396b08c66bec0e4b8b455d32171196fcdd71aa1f 100755
--- a/lib/versions/files.js
+++ b/lib/versions/files.js
@@ -19,19 +19,19 @@ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
Expand Down
16 changes: 8 additions & 8 deletions patches/@[email protected] → patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/src/gitUtils.ts b/src/gitUtils.ts
index 39a3ad754a0c5ab27cfb78c7b44a9f0be3785a62..c3116d7a725d4a5420286baac8147f4e821e5631 100644
index 39a3ad754a0c5ab27cfb78c7b44a9f0be3785a62..c3116d7a725d4a5420286baac8147f4e821e5631 100755
--- a/src/gitUtils.ts
+++ b/src/gitUtils.ts
@@ -95,6 +95,13 @@ export async function getFileCommitDate(
Expand All @@ -21,12 +21,12 @@ index 39a3ad754a0c5ab27cfb78c7b44a9f0be3785a62..c3116d7a725d4a5420286baac8147f4e
);
}
+}

+function createArgs(format: string, includeAuthor?: boolean, age: 'oldest' | 'newest' = 'oldest') {
// We add a "RESULT:" prefix to make parsing easier
// See why: https://github.com/facebook/docusaurus/pull/10022
const resultFormat = includeAuthor ? 'RESULT:%ct,%an' : 'RESULT:%ct';

const args = [
- `--format=${resultFormat}`,
+ `--format=${includeAuthor === undefined ? format : resultFormat}`,
Expand All @@ -35,7 +35,7 @@ index 39a3ad754a0c5ab27cfb78c7b44a9f0be3785a62..c3116d7a725d4a5420286baac8147f4e
]
.filter(Boolean)
.join(' ');

+ return args;
+}
+async function runGitCommandOnFile(file: string, args: string): Promise<{
Expand All @@ -49,7 +49,7 @@ index 39a3ad754a0c5ab27cfb78c7b44a9f0be3785a62..c3116d7a725d4a5420286baac8147f4e
@@ -147,12 +163,18 @@ export async function getFileCommitDate(
);
}

+ return result;
+}
+function retrieveCorrectRegex(includeAuthor: boolean) {
Expand All @@ -58,17 +58,17 @@ index 39a3ad754a0c5ab27cfb78c7b44a9f0be3785a62..c3116d7a725d4a5420286baac8147f4e
const regex = includeAuthor
? /(?:^|\n)RESULT:(?<timestamp>\d+),(?<author>.+)(?:$|\n)/
: /(?:^|\n)RESULT:(?<timestamp>\d+)(?:$|\n)/;

+ return regex;
+}
+function matchFromRegex(file: string, regex: RegExp, result: { code: number; stdout: string; stderr: string; }): RegExpMatchArray {
const output = result.stdout.trim();

if (!output) {
@@ -169,6 +191,13 @@ export async function getFileCommitDate(
);
}

+ return match;
+}
+function matchDateAndTimestamp(match: RegExpMatchArray, includeAuthor: boolean): {
Expand Down
Loading