Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18.0', '20', '22', '24']
node: ['20.0', '20', '22', '24']
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
node: ['18.0', '20', '22', '24']
node: ['20.0', '20', '22', '24']
steps:
- name: Support longpaths
run: git config --system core.longpaths true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18.0', '20', '22', '24']
node: ['20.0', '20', '22', '24']
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/create-docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"@types/supports-color": "^8.1.1"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
]
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/create-docusaurus/templates/classic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
]
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/create-docusaurus/templates/shared/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new

### What you'll need

- [Node.js](https://nodejs.org/en/download/) version 18.0 or above:
- [Node.js](https://nodejs.org/en/download/) version 20.0 or above:
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.

## Generate a new site
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@
"tslib": "^2.6.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@
"@total-typescript/shoehorn": "^0.1.2"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-cssnano-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"to-vfile": "^6.1.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-faster/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"webpack": "^5.95.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
},
"peerDependencies": {
"@docusaurus/types": "*"
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"tslib": "^2.6.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
},
"devDependencies": {
"@types/supports-color": "^8.1.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-mdx-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-client-redirects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
},
"devDependencies": {
"@total-typescript/shoehorn": "^0.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-css-cascade-layers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
"tslib": "^2.6.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-google-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-google-gtag/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-google-tag-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-ideal-image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@
}
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-rsdoctor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-sitemap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-svgr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-vercel-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-preset-classic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-remark-plugin-npm2yarn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"to-vfile": "^6.1.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-theme-classic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-theme-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
14 changes: 11 additions & 3 deletions packages/docusaurus-theme-common/src/contexts/colorMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import React, {
useMemo,
type ReactNode,
} from 'react';
import useIsBrowser from '@docusaurus/useIsBrowser';
import {ReactContextError} from '../utils/reactUtils';
import {createStorageSlot} from '../utils/storageUtils';
import {useThemeConfig} from '../utils/useThemeConfig';
Expand Down Expand Up @@ -124,10 +125,17 @@ function useColorModeState() {
const {
colorMode: {defaultMode},
} = useThemeConfig();
const isBrowser = useIsBrowser();

const [colorMode, setColorModeState] = useState<ColorMode>(defaultMode);
const [colorModeChoice, setColorModeChoiceState] =
useState<ColorModeChoice>(null);
// Since the provider may unmount/remount on client navigation, we need to
// reinitialize the state with the correct values to avoid visual glitches.
// See also https://github.com/facebook/docusaurus/issues/11399#issuecomment-3279181314
const [colorMode, setColorModeState] = useState<ColorMode>(
isBrowser ? ColorModeAttribute.get() : defaultMode,
);
const [colorModeChoice, setColorModeChoiceState] = useState<ColorModeChoice>(
isBrowser ? ColorModeChoiceAttribute.get() : null,
);

useEffect(() => {
setColorModeState(ColorModeAttribute.get());
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-theme-live-codeblock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-theme-mermaid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@
}
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-theme-search-algolia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-theme-translations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"lodash": "^4.17.21"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-utils-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"tslib": "^2.6.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-utils-validation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"tmp-promise": "^3.0.3"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/docusaurus-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"webpack": "^5.88.1"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
},
"devDependencies": {
"@types/dedent": "^0.7.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"update-notifier": "^6.0.2",
"webpack": "^5.95.0",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-dev-server": "^4.15.2",
"webpack-dev-server": "^5.2.2",
"webpack-merge": "^6.0.1"
},
"devDependencies": {
Expand All @@ -96,6 +96,6 @@
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
1 change: 1 addition & 0 deletions packages/docusaurus/src/server/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function getDefaultDirection(localeStr: string) {
// see https://github.com/tc39/proposal-intl-locale-info
// see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
// Node 18.0 implements a former version of the getTextInfo() proposal
// TODO Docusaurus v4: remove the fallback to locale.textInfo
// @ts-expect-error: The TC39 proposal was updated
const textInto = locale.getTextInfo?.() ?? locale.textInfo;
return textInto.direction;
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"eslint": ">=6"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
}
}
2 changes: 1 addition & 1 deletion packages/lqip-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"tslib": "^2.6.0"
},
"engines": {
"node": ">=18.0"
"node": ">=20.0"
},
"devDependencies": {
"@types/file-loader": "^5.0.1"
Expand Down
Loading
Loading